Esempio n. 1
0
        internal static FlareId Update(int parentGID, FlareId flareId, MyFlareDesc desc)
        {
            if (desc.Enabled)
            {
                if (flareId == FlareId.NULL)
                {
                    flareId = new FlareId {
                        Index = m_flares.Allocate()
                    }
                }
                ;

                var gid = parentGID;
                if (gid != -1 && MyIDTracker <MyActor> .FindByID((uint)gid) != null)
                {
                    var matrix = MyIDTracker <MyActor> .FindByID((uint)gid).WorldMatrix;

                    Vector3.TransformNormal(ref desc.Direction, ref matrix, out desc.Direction);
                }

                desc.MaxDistance = (desc.MaxDistance > 0)
                    ? (float)Math.Min(MyRenderConstants.MAX_GPU_OCCLUSION_QUERY_DISTANCE, desc.MaxDistance)
                    : MyRenderConstants.MAX_GPU_OCCLUSION_QUERY_DISTANCE;

                m_flares.Data[flareId.Index] = desc;
            }
            else if (flareId != FlareId.NULL)
            {
                m_flares.Free(flareId.Index);
                flareId = FlareId.NULL;
            }
            return(flareId);
        }
Esempio n. 2
0
        internal static void RemoveDecal(uint ID)
        {
            var handle = IdIndex[ID];
            var parent = Decals.Data[handle].ParentID;

            EntityDecals[parent].Remove(handle);
            Decals.Free(handle);
            IdIndex.Remove(ID);
        }
Esempio n. 3
0
 internal static void RemoveDecal(uint ID)
 {
     if (IdIndex.ContainsKey(ID))
     {
         var handle = IdIndex[ID];
         var parent = Decals.Data[handle].ParentID;
         EntityDecals[parent].Remove(handle);
         Decals.Free(handle);
         IdIndex.Remove(ID);
     }
     else
     {
         Debug.Assert(true, "Decal already removed");
     }
 }
Esempio n. 4
0
 internal static void Remove(uint GID, InstancingId id)
 {
     Debug.Assert(IdIndex.ContainsKey(GID), "Removing instance that doesn't exist");
     RemoveResource(id);
     IdIndex.Remove(GID);
     Instancings.Free(id.Index);
 }
 internal static void Remove(uint GID, InstancingId id)
 {
     RemoveResource(id);
     IdIndex.Remove(GID);
     Instancings.Data[id.Index] = new MyInstancingInfo {
     };
     Instancings.Free(id.Index);
 }
Esempio n. 6
0
 internal static void Destroy(IndexBufferId id)
 {
     IbIndices.Remove(id);
     if (IBuffersData[id.Index].Buffer != null)
     {
         IBuffersData[id.Index].Buffer.Dispose();
         IBuffersData[id.Index].Buffer = null;
     }
     IBuffers.Free(id.Index);
 }
Esempio n. 7
0
 internal static void Destroy(ConstantsBufferId id)
 {
     CbIndices.Remove(id);
     if (CBuffersData[id.Index].Buffer != null)
     {
         CBuffersData[id.Index].Buffer.Dispose();
         CBuffersData[id.Index].Buffer = null;
     }
     CBuffers.Free(id.Index);
 }
Esempio n. 8
0
        internal void RemoveEntity(uint ID)
        {
            m_perInstance.Free(m_entities[ID].InstanceIndex);
            foreach (var page in m_entities[ID].PageHandles)
            {
                m_instancingTable.Free(page);
            }

            m_tablesDirty = true;
        }
Esempio n. 9
0
 internal static void Destroy(VertexBufferId id)
 {
     Debug.Assert(VbIndices.Contains(id));
     VbIndices.Remove(id);
     if (VBuffersData[id.Index].Buffer != null)
     {
         VBuffersData[id.Index].Buffer.Dispose();
         VBuffersData[id.Index].Buffer = null;
     }
     VBuffers.Free(id.Index);
 }
Esempio n. 10
0
        private static void Remove(GPUEmitterId id)
        {
            var emitter = m_emitters.Data[id.Index];

            m_idIndex.Remove(emitter.GPUEmitter.GID);

            m_freeBufferIndices.Enqueue(emitter.BufferIndex);

            m_emitters.Free(id.Index);

            RemoveTexture(emitter.TextureId);
        }
Esempio n. 11
0
 internal static void Remove(FlareId flareId)
 {
     if (flareId != FlareId.NULL)
     {
         if (m_flares.Data[flareId.Index].Query != null)
         {
             MyOcclusionQueryRenderer.Remove(m_flares.Data[flareId.Index].Query);
             m_flares.Data[flareId.Index].Query = null;
         }
         m_flares.Free(flareId.Index);
     }
 }
Esempio n. 12
0
 internal static void Destroy(StructuredBufferId id)
 {
     SbIndices.Remove(id);
     if (SBuffersData[id.Index].Buffer != null)
     {
         SBuffersData[id.Index].Buffer.Dispose();
         SBuffersData[id.Index].Buffer = null;
     }
     if (SBuffersData[id.Index].Srv != null)
     {
         SBuffersData[id.Index].Srv.Dispose();
         SBuffersData[id.Index].Srv = null;
     }
     SBuffers.Free(id.Index);
 }
Esempio n. 13
0
        internal static FlareId Update(FlareId flareId, MyFlareDesc desc)
        {
            if (desc.Enabled)
            {
                if (flareId == FlareId.NULL)
                {
                    flareId = new FlareId {
                        Index = m_flares.Allocate()
                    };
                }

                desc.MaxDistance = (desc.MaxDistance > 0)
                    ? (float)Math.Min(MyRenderConstants.MAX_GPU_OCCLUSION_QUERY_DISTANCE, desc.MaxDistance)
                    : MyRenderConstants.MAX_GPU_OCCLUSION_QUERY_DISTANCE;

                m_flares.Data[flareId.Index] = desc;
            }
            else if (flareId != FlareId.NULL)
            {
                m_flares.Free(flareId.Index);
                flareId = FlareId.NULL;
            }
            return(flareId);
        }
        internal void RemoveEntity(MyActor actor)
        {
            uint           ID   = actor.ID;
            MyInstanceInfo info = m_entities[ID];

            m_perInstance.Free(info.InstanceIndex);
            m_entityInfos.Free(info.InstanceIndex);
            foreach (var page in m_entities[ID].PageHandles)
            {
                m_instancingTable.Free(page);
            }

            // CHECK-ME m_entities.Remove(ID) is missing

            m_tableDirty = true;
        }
Esempio n. 15
0
        internal static void Remove(uint GID, LightId light)
        {
            IdIndex.Remove(GID);

            if (Pointlights[light.Index].BvhProxyId != -1)
            {
                PointlightsBvh.RemoveProxy(Pointlights[light.Index].BvhProxyId);
            }

            if (Spotlights[light.Index].BvhProxyId != -1)
            {
                SpotlightsBvh.RemoveProxy(Spotlights[light.Index].BvhProxyId);
            }

            DirtyPointlights.Remove(light);
            DirtySpotlights.Remove(light);
            Lights.Free(light.Index);
        }
Esempio n. 16
0
 internal static void FreeProxy(MyMaterialProxyId id)
 {
     ProxyPool.Free(id.Index);
 }