internal void UpdateEntity(MyActor actor, ref MatrixD matrix, uint depthBias) { uint ID = actor.ID; m_perInstance.Data[m_entities[ID].InstanceIndex] = MyPerInstanceData.FromWorldMatrix(ref matrix, depthBias); m_instancesDataDirty = true; }
internal override int AddInstance(string mesh, Matrix matrix) { AddMesh(mesh); m_meshes[mesh].m_perInstance.Add(MyPerInstanceData.FromWorldMatrix(ref matrix)); m_meshes[mesh].instancesCounter++; return(0); }
internal override int AddInstance(string mesh, Matrix matrix) { AddMesh(mesh); var instanceNum = instancesCounter; foreach (var page in m_includedMeshes[mesh]) { m_pageTable.Add(new MyInstancingTableEntry { InstanceId = instanceNum, MeshId = page }); } m_perInstance.Add(MyPerInstanceData.FromWorldMatrix(ref matrix)); instancesCounter++; return(0); }
internal void AddEntity(uint ID, MeshId model) { var instanceIndex = m_perInstance.Allocate(); m_entities[ID] = new MyInstanceInfo { InstanceIndex = instanceIndex, PageHandles = new List <MyPackedPoolHandle>() }; foreach (var id in m_meshTable.Pages(MyMeshTableSRV.MakeKey(model))) { var pageHandle = m_instancingTable.Allocate(); m_instancingTable.Data[m_instancingTable.AsIndex(pageHandle)] = new MyInstancingTableEntry { InstanceId = instanceIndex, InnerMeshId = id }; m_entities[ID].PageHandles.Add(pageHandle); } m_perInstance.Data[instanceIndex] = MyPerInstanceData.FromWorldMatrix(ref MatrixD.Zero); m_tablesDirty = true; }
internal void AddEntity(MyActor actor, MeshId model) { uint ID = actor.ID; var instanceIndex = m_perInstance.Allocate(); var entityIndex = m_entityInfos.Allocate(); Debug.Assert(instanceIndex == entityIndex); m_entities[ID] = new MyInstanceInfo { InstanceIndex = instanceIndex, PageHandles = new List <MyPackedPoolHandle>() }; int pageOffset = -1; var key = MyMeshTableSrv.MakeKey(model); foreach (var id in m_meshTable.Pages(key)) { if (pageOffset == -1) { pageOffset = id; } var pageHandle = m_instancingTable.Allocate(); m_instancingTable.Data[m_instancingTable.AsIndex(pageHandle)] = new MyInstancingTableEntry { InstanceId = instanceIndex, InnerMeshId = id }; m_entities[ID].PageHandles.Add(pageHandle); } m_perInstance.Data[instanceIndex] = MyPerInstanceData.FromWorldMatrix(ref MatrixD.Zero, 0); m_entityInfos.Data[instanceIndex] = new MyInstanceEntityInfo { EntityId = ID, PageOffset = pageOffset }; m_tableDirty = true; }
internal void UpdateEntity(uint ID, ref MatrixD matrix) { m_perInstance.Data[m_entities[ID].InstanceIndex] = MyPerInstanceData.FromWorldMatrix(ref matrix); m_instancesDataDirty = true; }