internal bool IsMergable(MeshId model) { // check if one and only spoorted vertex format // check if same material as the rest // check if has one part(!) // check if has one lod - for now return model.Info.LodsNum == 1 && MyMeshes.GetLodMesh(model, 0).Info.PartsNum == 1 && m_meshTable.IsMergable(model); }
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix, RenderFlags additionalFlags = 0) { m_worldMatrix = worldMatrix; m_actor = MyActorFactory.CreateSceneObject(); m_actor.SetMatrix(ref worldMatrix); m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create()); m_lod = cellCoord.Lod; Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod); m_actor.GetRenderable().SetModel(Mesh); m_actor.GetRenderable().m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags); }
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.Matrix worldMatrix) { m_worldMatrix = worldMatrix; m_actor = MyActorFactory.CreateSceneObject(); //m_mesh = new MyVoxelMesh(cellCoord.CoordInLod, cellCoord.Lod, ""); //m_actor.GetRenderable().SetModel(m_mesh); m_actor.SetMatrix(ref worldMatrix); m_actor.AddComponent(MyComponentFactory<MyFoliageComponent>.Create()); m_lod = cellCoord.Lod; Mesh = MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod); m_actor.GetRenderable().SetModel(Mesh); m_discardingOn = false; }
internal override void Construct() { base.Construct(); Type = MyActorComponentEnum.Renderable; //m_mesh = null; m_lods = null; m_cullProxy = MyProxiesFactory.CreateCullProxy(); m_btreeProxy = -1; Mesh = MeshId.NULL; Instancing = InstancingId.NULL; m_instanceCount = 0; m_startInstance = 0; m_isRenderedStandalone = true; m_keyColor = Vector3.One; m_objectDithering = 0; m_renderableProxiesForLodTransition = null; m_lodTransitionState = 0; m_lod = 0; m_voxelLod = -1; m_additionalFlags = 0; ModelProperties = new Dictionary<MyEntityMaterialKey, MyModelProperties>(); }
static void DebugRecordMeshPartCommands(MeshId model, int sectionIndex, MyRenderableComponent render, MyRenderLod renderLod, MyMeshSectionPartInfo1[] meshes, int index) { Debug.Assert(false, "DebugRecordMeshPartCommands1: Call Francesco"); MyLog.Default.WriteLine("DebugRecordMeshPartCommands1"); MyLog.Default.WriteLine("sectionIndex: " + sectionIndex); MyLog.Default.WriteLine("model.Info.Name: " + model.Info.Name); MyLog.Default.WriteLine("render.CurrentLod: " + render.CurrentLod); MyLog.Default.WriteLine("renderLod.RenderableProxies.Length: " + renderLod.RenderableProxies.Length); MyLog.Default.WriteLine("meshes.Length: " + meshes.Length); MyLog.Default.WriteLine("Mesh index: " + index); MyLog.Default.WriteLine("Mesh part index: " + meshes[index].PartIndex); }
internal static MyMeshTableEntry MakeKey(MeshId model) { return new MyMeshTableEntry { Model = model, Lod = 0, Part = 0 }; }
private static void RecordMeshPartCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyHighlightDesc desc, ref float maxThickness) { WriteHighlightConstants(ref desc, ref maxThickness); var submeshCount = lodModelId.Info.PartsNum; for (int submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex) { var part = MyMeshes.GetMeshPart(model, rendercomp.CurrentLod, submeshIndex); MyRenderUtils.BindShaderBundle(RC, renderLod.RenderableProxies[submeshIndex].HighlightShaders); MyHighlightPass.Instance.RecordCommands(renderLod.RenderableProxies[submeshIndex], -1, desc.InstanceId); } }
/// <returns>True if the section was found</returns> private static bool RecordMeshSectionCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyOutlineDesc desc, ref OutlineConstantsLayout constants, ref float maxThickness) { MeshSectionId sectionId; bool found = MyMeshes.TryGetMeshSection(model, rendercomp.CurrentLod, desc.SectionIndex, out sectionId); if (!found) return false; MyMeshSectionInfo1 section = sectionId.Info; MyMeshSectionPartInfo1[] meshes = section.Meshes; for (int idx = 0; idx < meshes.Length; idx++) { maxThickness = Math.Max(desc.Thickness, maxThickness); constants.Color = desc.Color.ToVector4(); var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); RC.BindShaders(renderLod.HighlightShaders[meshes[idx].PartIndex]); MyRenderableProxy proxy = renderLod.RenderableProxies[meshes[idx].PartIndex]; MyOutlinePass.Instance.RecordCommands(proxy, meshes[idx].PartSubmeshIndex); } return 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; foreach (var id in m_meshTable.Pages(MyMeshTableSRV.MakeKey(model))) { 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 bool IsMergable(MeshId model) { var mesh = MyMeshes.GetLodMesh(model, 0); return(mesh.Info.Data.VertexLayout == OneAndOnlySupportedVertexLayout && mesh.Info.IndicesNum > 0 && model.Info.RuntimeGenerated == false && model.Info.Dynamic == false); }
private static void RecordMeshPartCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyOutlineDesc desc, ref OutlineConstantsLayout constants, ref float maxThickness) { var submeshCount = lodModelId.Info.PartsNum; for (int submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex) { var part = MyMeshes.GetMeshPart(model, rendercomp.CurrentLod, submeshIndex); maxThickness = Math.Max(desc.Thickness, maxThickness); constants.Color = desc.Color.ToVector4(); var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); RC.BindShaders(renderLod.HighlightShaders[submeshIndex]); MyOutlinePass.Instance.RecordCommands(renderLod.RenderableProxies[submeshIndex]); } }
internal unsafe void AddMesh(MeshId model) { Debug.Assert(IsMergable(model)); var key = new MyMeshTableEntry { Model = model, Lod = 0, Part = 0 }; if (!ContainsKey(key)) { var vertexOffset = m_vertices; var indexOffset = m_indices; var mesh = MyMeshes.GetLodMesh(model, 0); Debug.Assert(mesh.Info.Data.IndicesFmt == SharpDX.DXGI.Format.R16_UInt); var meshInfo = mesh.Info; var data = meshInfo.Data; int verticesCapacity = vertexOffset + meshInfo.VerticesNum; int indicesCapacity = CalculateIndicesCapacity(indexOffset, meshInfo.IndicesNum); m_vertices = verticesCapacity; m_indices = indicesCapacity; MyArrayHelpers.Reserve(ref m_vertexStream0, verticesCapacity * Stride0, 1024 * 1024); MyArrayHelpers.Reserve(ref m_vertexStream1, verticesCapacity * Stride1, 1024 * 1024); MyArrayHelpers.Reserve(ref m_indexStream, indicesCapacity * IndexStride, 1024 * 1024); var list = new List <int>(); fixed(byte *src = data.VertexStream0, dst_ = m_vertexStream0) { byte *dst = dst_ + data.Stride0 * vertexOffset; SharpDX.Utilities.CopyMemory(new IntPtr(dst), new IntPtr(src), data.Stride0 * meshInfo.VerticesNum); } fixed(byte *src = data.VertexStream1, dst_ = m_vertexStream1) { byte *dst = dst_ + data.Stride1 * vertexOffset; SharpDX.Utilities.CopyMemory(new IntPtr(dst), new IntPtr(src), data.Stride1 * meshInfo.VerticesNum); } fixed(void *dst = m_indexStream) { uint *stream = (uint *)dst; stream += indexOffset; fixed(void *src = data.Indices) { ushort *indices = (ushort *)src; for (int k = 0; k < meshInfo.IndicesNum; k += m_indexPageSize) { int iEnd = Math.Min(k + m_indexPageSize, meshInfo.IndicesNum); for (int i = k; i < iEnd; i++) { stream[i] = (uint)(indices[i] + vertexOffset); } list.Add(m_pagesUsed++); } if ((meshInfo.IndicesNum % m_indexPageSize) != 0) { var pageIndex = meshInfo.IndicesNum / m_indexPageSize; var pageOffset = meshInfo.IndicesNum % m_indexPageSize; uint lastIndex = stream[pageIndex * m_indexPageSize + pageOffset - 1]; for (int i = pageOffset; i < m_indexPageSize; i++) { stream[pageIndex * m_indexPageSize + i] = lastIndex; } } } } m_table.Add(key, new MyMeshTableSRV_Entry { Pages = list }); m_dirty = true; } }
internal static MyMeshTableEntry MakeKey(MeshId model) { return(new MyMeshTableEntry { Model = model, Lod = 0, Part = 0 }); }
internal void AddEntity(MyActor actor, MeshId model) { m_actors.Add(actor); m_mergeGroup.AddEntity(actor.ID, model); }
internal void AddEntity(MyActor actor, MeshId model) { m_actors[actor.ID] = actor; m_mergeGroup.AddEntity(actor, model); }
private void AssignLodMeshToProxy(MeshId mesh, MyRenderableProxy proxy) { if (MyMeshes.IsMergedVoxelMesh(mesh)) proxy.MergedMesh = MyMeshes.GetMergedLodMesh(mesh, 0); else proxy.Mesh = MyMeshes.GetLodMesh(mesh, 0); }
internal bool IsMergable(MeshId model) { var mesh = MyMeshes.GetLodMesh(model, 0); return mesh.Info.Data.VertexLayout == OneAndOnlySupportedVertexLayout && mesh.Info.IndicesNum > 0 && model.Info.RuntimeGenerated == false && model.Info.Dynamic == false; }
internal void AddEntity(MyActor actor, MeshId model) { m_actors[actor.ID] = actor; m_mergeGroup.AddEntity(actor, model); }
private static void RecordMeshPartCommands(MeshId model, MyActor actor, MyGroupRootComponent group, MyCullProxy_2 proxy, MyHighlightDesc desc, ref float maxThickness) { MeshSectionId sectionId; bool found = MyMeshes.TryGetMeshSection(model, 0, desc.SectionIndex, out sectionId); if (!found) return; WriteHighlightConstants(ref desc, ref maxThickness); MyMeshSectionInfo1 section = sectionId.Info; MyMeshSectionPartInfo1[] meshes = section.Meshes; for (int idx = 0; idx < meshes.Length; idx++) { MyMaterialMergeGroup materialGroup; found = group.TryGetMaterialGroup(meshes[idx].Material, out materialGroup); if (!found) { DebugRecordMeshPartCommands(model, desc.SectionIndex, meshes[idx].Material); return; } int actorIndex; found = materialGroup.TryGetActorIndex(actor, out actorIndex); if (!found) return; MyHighlightPass.Instance.RecordCommands(ref proxy.Proxies[materialGroup.Index], actorIndex, meshes[idx].PartIndex); } }
internal void AddEntity(MyActor actor, MeshId model) { m_actors.Add(actor); m_mergeGroup.AddEntity(actor.ID, model); }
/// <returns>True if the section was found</returns> private static void RecordMeshSectionCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyHighlightDesc desc, ref float maxThickness) { MeshSectionId sectionId; bool found = MyMeshes.TryGetMeshSection(model, rendercomp.CurrentLod, desc.SectionIndex, out sectionId); if (!found) return; WriteHighlightConstants(ref desc, ref maxThickness); MyMeshSectionInfo1 section = sectionId.Info; MyMeshSectionPartInfo1[] meshes = section.Meshes; for (int idx = 0; idx < meshes.Length; idx++) { MyMeshSectionPartInfo1 sectionInfo = meshes[idx]; if (renderLod.RenderableProxies.Length <= sectionInfo.PartIndex) { DebugRecordMeshPartCommands(model, desc.SectionIndex, rendercomp, renderLod, meshes, idx); return; } MyRenderableProxy proxy = renderLod.RenderableProxies[sectionInfo.PartIndex]; MyHighlightPass.Instance.RecordCommands(proxy, sectionInfo.PartSubmeshIndex, desc.InstanceId); } return; }
internal MyClipmapCellProxy(MyCellCoord cellCoord, ref MatrixD worldMatrix, Vector3D massiveCenter, float massiveRadius, RenderFlags additionalFlags = 0, bool mergedMesh = false) { m_worldMatrix = worldMatrix; m_actor = MyActorFactory.CreateVoxelCell(); m_actor.SetMatrix(ref worldMatrix); m_lod = cellCoord.Lod; MyVoxelRenderableComponent renderableComponent = m_actor.GetRenderable() as MyVoxelRenderableComponent; m_mesh = !mergedMesh ? MyMeshes.CreateVoxelCell(cellCoord.CoordInLod, cellCoord.Lod) : MyMeshes.CreateMergedVoxelCell(cellCoord.CoordInLod, cellCoord.Lod); renderableComponent.SetVoxelLod(m_lod, ScaleGroup); renderableComponent.SetModel(m_mesh); renderableComponent.m_massiveCenter = massiveCenter; renderableComponent.m_massiveRadius = massiveRadius; renderableComponent.m_additionalFlags = MyProxiesFactory.GetRenderableProxyFlags(additionalFlags); }
static void DebugRecordMeshPartCommands(MeshId model, int sectionIndex, MyMeshMaterialId material) { Debug.Assert(false, "DebugRecordMeshPartCommands2: Call Francesco"); MyLog.Default.WriteLine("DebugRecordMeshPartCommands2"); MyLog.Default.WriteLine("sectionIndex: " + sectionIndex); MyLog.Default.WriteLine("model.Info.Name: " + model.Info.Name); MyLog.Default.WriteLine("material.Info.Name: " + material.Info.Name); }
private static void RecordMeshPartCommands(MeshId model, MyActor actor, MyGroupRootComponent group, MyCullProxy_2 proxy, MyOutlineDesc desc, ref float maxThickness) { MeshSectionId sectionId; bool found = MyMeshes.TryGetMeshSection(model, 0, desc.SectionIndex, out sectionId); if (!found) return; OutlineConstantsLayout constants = new OutlineConstantsLayout(); maxThickness = Math.Max(desc.Thickness, maxThickness); constants.Color = desc.Color.ToVector4(); if (desc.PulseTimeInFrames > 0) constants.Color.W *= (float)Math.Pow((float)Math.Cos(2.0 * Math.PI * (float)MyRender11.GameplayFrameCounter / (float)desc.PulseTimeInFrames), 2.0); MyMeshSectionInfo1 section = sectionId.Info; MyMeshSectionPartInfo1[] meshes = section.Meshes; for (int idx = 0; idx < meshes.Length; idx++) { MyMaterialMergeGroup materialGroup; found = group.TryGetMaterialGroup(meshes[idx].Material, out materialGroup); if (!found) { DebugRecordMeshPartCommands(model, desc.SectionIndex, meshes[idx].Material); return; } int actorIndex; found = materialGroup.TryGetActorIndex(actor, out actorIndex); if (!found) return; var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); MyOutlinePass.Instance.RecordCommands(ref proxy.Proxies[materialGroup.Index], actorIndex, meshes[idx].PartIndex); } }
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, 0); m_tablesDirty = true; }
private static void RecordMeshPartCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyOutlineDesc desc, ref float maxThickness) { OutlineConstantsLayout constants = new OutlineConstantsLayout(); var submeshCount = lodModelId.Info.PartsNum; for (int submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex) { var part = MyMeshes.GetMeshPart(model, rendercomp.CurrentLod, submeshIndex); maxThickness = Math.Max(desc.Thickness, maxThickness); constants.Color = desc.Color.ToVector4(); if (desc.PulseTimeInFrames > 0) constants.Color.W *= (float)Math.Pow((float)Math.Cos(2.0 * Math.PI * (float)MyRender11.GameplayFrameCounter / (float)desc.PulseTimeInFrames), 2.0); var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); MyRenderUtils.BindShaderBundle(RC, renderLod.RenderableProxies[submeshIndex].HighlightShaders); MyOutlinePass.Instance.RecordCommands(renderLod.RenderableProxies[submeshIndex], -1, desc.InstanceId); } }
private bool TryCancelMergeJob(int divideIndex, MeshId meshIdToRemove) { bool canceled = false; if (m_mergeJobs[divideIndex].LodMeshesBeingMerged.Count > 0) { // Send the cancel message MyRenderProxy.CancelVoxelMeshMerge(m_parentClipmap.Id, m_mergeJobs[divideIndex].CurrentWorkId); if (meshIdToRemove != MeshId.NULL) m_mergeJobs[divideIndex].LodMeshesBeingMerged.Remove(MyMeshes.GetLodMesh(meshIdToRemove, 0)); // Put the canceled meshes back into the correct pending queue var mergedId = MyMeshes.GetMergedLodMesh(m_mergedLodMeshProxies[divideIndex].MeshId, 0); mergedId.Info.PendingLodMeshes.UnionWith(m_mergeJobs[divideIndex].LodMeshesBeingMerged); ResetMerge(divideIndex); canceled = true; } return canceled; }
/// <returns>True if the section was found</returns> private static void RecordMeshSectionCommands(MeshId model, LodMeshId lodModelId, MyRenderableComponent rendercomp, MyRenderLod renderLod, MyOutlineDesc desc, ref float maxThickness) { MeshSectionId sectionId; bool found = MyMeshes.TryGetMeshSection(model, rendercomp.CurrentLod, desc.SectionIndex, out sectionId); if (!found) return; OutlineConstantsLayout constants = new OutlineConstantsLayout(); MyMeshSectionInfo1 section = sectionId.Info; MyMeshSectionPartInfo1[] meshes = section.Meshes; for (int idx = 0; idx < meshes.Length; idx++) { MyMeshSectionPartInfo1 sectionInfo = meshes[idx]; if (renderLod.RenderableProxies.Length <= sectionInfo.PartIndex) { DebugRecordMeshPartCommands(model, desc.SectionIndex, rendercomp, renderLod, meshes, idx); return; } maxThickness = Math.Max(desc.Thickness, maxThickness); constants.Color = desc.Color.ToVector4(); if (desc.PulseTimeInFrames > 0) constants.Color.W *= (float)Math.Pow((float)Math.Cos(2.0 * Math.PI * (float)MyRender11.GameplayFrameCounter / (float)desc.PulseTimeInFrames), 2.0); var mapping = MyMapping.MapDiscard(MyCommon.OutlineConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); MyRenderUtils.BindShaderBundle(RC, renderLod.RenderableProxies[sectionInfo.PartIndex].HighlightShaders); MyRenderableProxy proxy = renderLod.RenderableProxies[sectionInfo.PartIndex]; MyOutlinePass.Instance.RecordCommands(proxy, sectionInfo.PartSubmeshIndex, desc.InstanceId); } return; }
internal static RenderableId CreateRenderable(EntityId entity, MeshId model, Vector3 keyColor) { var id = new RenderableId { Index = Renderables.Allocate() }; Renderables.Data[id.Index] = new MyRenderableInfo { KeyColor = keyColor, ObjectDithering = 0, Mesh = model }; EntityDirty.Add(entity); RenderableIndex[entity] = id; return id; }
internal unsafe void AddMesh(MeshId model) { Debug.Assert(IsMergable(model)); var key = new MyMeshTableEntry { Model = model, Lod = 0, Part = 0 }; if (!ContainsKey(key)) { var vertexOffset = m_vertices; var indexOffset = m_indices; var mesh = MyMeshes.GetLodMesh(model, 0); Debug.Assert(mesh.Info.Data.IndicesFmt == SharpDX.DXGI.Format.R16_UInt); var meshInfo = mesh.Info; var data = meshInfo.Data; int verticesCapacity = vertexOffset + meshInfo.VerticesNum; int indicesCapacity = CalculateIndicesCapacity(indexOffset, meshInfo.IndicesNum); m_vertices = verticesCapacity; m_indices = indicesCapacity; MyArrayHelpers.Reserve(ref m_vertexStream0, verticesCapacity * Stride0, 1024 * 1024); MyArrayHelpers.Reserve(ref m_vertexStream1, verticesCapacity * Stride1, 1024 * 1024); MyArrayHelpers.Reserve(ref m_indexStream, indicesCapacity * IndexStride, 1024 * 1024); var list = new List<int>(); fixed(byte* src = data.VertexStream0, dst_ = m_vertexStream0) { byte* dst = dst_ + data.Stride0 * vertexOffset; SharpDX.Utilities.CopyMemory(new IntPtr(dst), new IntPtr(src), data.Stride0 * meshInfo.VerticesNum); } fixed (byte* src = data.VertexStream1, dst_ = m_vertexStream1) { byte* dst = dst_ + data.Stride1 * vertexOffset; SharpDX.Utilities.CopyMemory(new IntPtr(dst), new IntPtr(src), data.Stride1 * meshInfo.VerticesNum); } fixed (void* dst = m_indexStream) { uint* stream = (uint*) dst; stream += indexOffset; fixed(void* src = data.Indices) { ushort* indices = (ushort*)src; for (int k = 0; k < meshInfo.IndicesNum; k += m_indexPageSize) { int iEnd = Math.Min(k + m_indexPageSize, meshInfo.IndicesNum); for (int i = k; i < iEnd; i++) { stream[i] = (uint) (indices[i] + vertexOffset); } list.Add(m_pagesUsed++); } if ((meshInfo.IndicesNum % m_indexPageSize) != 0) { var pageIndex = meshInfo.IndicesNum / m_indexPageSize; var pageOffset = meshInfo.IndicesNum % m_indexPageSize; uint lastIndex = stream[pageIndex * m_indexPageSize + pageOffset - 1]; for (int i = pageOffset; i < m_indexPageSize; i++) { stream[pageIndex * m_indexPageSize + i] = lastIndex; } } } } m_table.Add(key, new MyMeshTableSrv_Entry { Pages = list }); m_dirty = true; } }
internal void SetModel(MeshId mesh) { Mesh = mesh; SetLocalAabbToModelLod(0); m_owner.MarkRenderDirty(); }
internal static BoundingBox?GetBoundingBox(this MeshId meshId, int lod) { return(MyMeshes.IsMergedVoxelMesh(meshId) ? MyMeshes.GetMergedLodMesh(meshId, 0).Info.BoundingBox : MyMeshes.GetLodMesh(meshId, lod).Info.BoundingBox); }