internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, RenderFlags additionalFlags) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this); m_renderFlags = additionalFlags; MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, m_clipmapBase); }
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix, m_massiveCenter, m_massiveRadius, m_renderFlags); cell.SetVisibility(false); cell.ScaleGroup = scaleGroup; return cell; }
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix, m_massiveCenter, m_massiveRadius, m_renderFlags); cell.SetVisibility(false); cell.ScaleGroup = scaleGroup; return(cell); }
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix) { var cell = new MyClipmapCellProxy(cellCoord, ref worldMatrix); cell.SetVisibility(false); cell.ScaleGroup = scaleGroup; return(cell); }
public MyRenderVoxelCell(MyClipmapScaleEnum scaleGroup, MyCellCoord coord, ref MatrixD worldMatrix) : base(0, "MyRenderVoxelCell", RenderFlags.Visible | RenderFlags.CastShadows, CullingOptions.VoxelMap) { m_scaleGroup = scaleGroup; m_metadata.Cell = coord; m_worldMatrix = worldMatrix; m_fakeVoxelMaterial.DrawTechnique = MyMeshDrawTechnique.VOXEL_MAP; }
public MyRenderVoxelCell(MyClipmapScaleEnum scaleGroup, MyCellCoord coord, ref MatrixD worldMatrix) : base(0, "MyRenderVoxelCell", RenderFlags.Visible | RenderFlags.CastShadows, CullingOptions.VoxelMap) { m_scaleGroup = scaleGroup; m_coord = coord; m_worldMatrix = worldMatrix; m_fakeVoxelMaterial.DrawTechnique = MyMeshDrawTechnique.VOXEL_MAP; }
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { switch (scaleGroup) { case MyClipmapScaleEnum.Normal: return(new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix)); default: throw new InvalidBranchException(); } }
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { switch (scaleGroup) { case MyClipmapScaleEnum.Normal: return new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix); default: throw new InvalidBranchException(); } }
internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, MyClipmap.PruningFunc prunningFunc) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc); m_massiveCenter = massiveCenter; m_renderFlags = additionalFlags; if (spherize) { m_massiveRadius = massiveRadius; } MyClipmap.AddToUpdate(MyRender11.Environment.Matrices.CameraPosition, Base); }
internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc); m_massiveCenter = massiveCenter; m_renderFlags = additionalFlags; if (spherize) m_massiveRadius = massiveRadius; const int mergeLodSubdivideCount = 3; m_mergeHandler = new MyLodMeshMergeHandler(Base, MyCellCoord.MAX_LOD_COUNT, mergeLodSubdivideCount, ref worldMatrix, ref massiveCenter, massiveRadius, m_renderFlags); MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base); }
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { switch (scaleGroup) { case MyClipmapScaleEnum.Normal: return new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix); case MyClipmapScaleEnum.Massive: return new MyRenderVoxelCellBackground(cellCoord, ref worldMatrix, m_position, m_atmosphereRadius, m_planetRadius, m_hasAtmosphere); default: throw new InvalidBranchException(); } }
IMyClipmapCell IMyClipmapCellHandler.CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref MatrixD worldMatrix) { switch (scaleGroup) { case MyClipmapScaleEnum.Normal: return(new MyRenderVoxelCell(scaleGroup, cellCoord, ref worldMatrix)); case MyClipmapScaleEnum.Massive: return(new MyRenderVoxelCellBackground(cellCoord, ref worldMatrix, m_position, m_atmosphereRadius, m_planetRadius, m_hasAtmosphere, m_atmosphereWaveLengths.Value)); default: throw new InvalidBranchException(); } }
public MyClipmap(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, IMyClipmapCellHandler cellProvider) { m_scaleGroup = scaleGroup; m_worldMatrix = worldMatrix; MatrixD.Invert(ref m_worldMatrix, out m_invWorldMatrix); m_sizeLod0 = sizeLod0; m_localAABB = new BoundingBoxD(Vector3D.Zero, new Vector3D(sizeLod0 * MyVoxelConstants.RENDER_CELL_SIZE_IN_METRES)); for (int lod = 0; lod < m_lodLevels.Length; ++lod) { m_lodLevels[lod] = new LodLevel(this, lod, ((m_sizeLod0 - 1) >> lod) + 1); } m_updateQueueItem = new UpdateQueueItem(this); m_requestCollector = new RequestCollector(id); m_cellHandler = cellProvider; }
internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc); m_massiveCenter = massiveCenter; m_renderFlags = additionalFlags; m_mergeHandler = null; if (spherize) m_massiveRadius = massiveRadius; if (MyLodMeshMergeHandler.ShouldAllocate(m_mergeHandler)) m_mergeHandler = AllocateMergeHandler(); MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base); }
public MyClipmap(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, IMyClipmapCellHandler cellProvider) { m_scaleGroup = scaleGroup; m_worldMatrix = worldMatrix; MatrixD.Invert(ref m_worldMatrix, out m_invWorldMatrix); m_sizeLod0 = sizeLod0; m_localAABB = new BoundingBoxD(Vector3D.Zero, new Vector3D(sizeLod0 * MyVoxelCoordSystems.RenderCellSizeInMeters(0))); for (int lod = 0; lod < m_lodLevels.Length; ++lod) { var sizeShift = lod + MyVoxelCoordSystems.RenderCellSizeInLodVoxelsShiftDelta(lod); m_lodLevels[lod] = new LodLevel(this, lod, ((m_sizeLod0 - 1) >> sizeShift) + 1); } m_updateQueueItem = new UpdateQueueItem(this); m_requestCollector = new RequestCollector(id); m_cellHandler = cellProvider; }
internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc); m_massiveCenter = massiveCenter; m_renderFlags = additionalFlags; if (spherize) { m_massiveRadius = massiveRadius; } const int mergeLodSubdivideCount = 3; m_mergeHandler = new MyLodMeshMergeHandler(Base, MyCellCoord.MAX_LOD_COUNT, mergeLodSubdivideCount, ref worldMatrix, ref massiveCenter, massiveRadius, m_renderFlags); MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base); }
internal MyClipmapHandler(uint id, MyClipmapScaleEnum scaleGroup, MatrixD worldMatrix, Vector3I sizeLod0, Vector3D massiveCenter, float massiveRadius, bool spherize, RenderFlags additionalFlags, VRage.Voxels.MyClipmap.PruningFunc prunningFunc) { m_clipmapBase = new MyClipmap(id, scaleGroup, worldMatrix, sizeLod0, this, massiveCenter, massiveRadius, prunningFunc); m_massiveCenter = massiveCenter; m_renderFlags = additionalFlags; m_mergeHandler = null; if (spherize) { m_massiveRadius = massiveRadius; } if (MyLodMeshMergeHandler.ShouldAllocate(m_mergeHandler)) { m_mergeHandler = AllocateMergeHandler(); } MyClipmap.AddToUpdate(MyEnvironment.CameraPosition, Base); }
public static void ComputeLodViewBounds(MyClipmapScaleEnum scale, int lod, out float min, out float max) { min = m_lodRangeGroups[(int)scale][lod]; max = m_lodRangeGroups[(int)scale][lod + 1]; }
public static uint CreateClipmap( MatrixD worldMatrix, Vector3I sizeLod0, MyClipmapScaleEnum scaleGroup, Vector3D position, RenderFlags additionalFlags = 0) { var message = MessagePool.Get<MyRenderMessageCreateClipmap>(MyRenderMessageEnum.CreateClipmap); uint clipmapId = GetMessageId(); message.ClipmapId = clipmapId; message.WorldMatrix = worldMatrix; message.SizeLod0 = sizeLod0; message.ScaleGroup = scaleGroup; message.Position = position; message.AdditionalRenderFlags = additionalFlags; EnqueueMessage(message); return clipmapId; }
public IMyClipmapCell CreateCell(MyClipmapScaleEnum scaleGroup, MyCellCoord cellCoord, ref VRageMath.MatrixD worldMatrix) { Matrix m = (Matrix)worldMatrix; var cell = new MyClipmapCellProxy(cellCoord, ref m); cell.SetVisibility(false); cell.ScaleGroup = scaleGroup; return cell; }
internal void SetVoxelLod(int lod, MyClipmapScaleEnum scaleEnum) { m_voxelLod = lod; UpdateProxiesCustomAlpha(); }
public static uint CreateClipmap( MatrixD worldMatrix, Vector3I sizeLod0, MyClipmapScaleEnum scaleGroup, Vector3D position, float atmosphereRadius = 0.0f, float planetRadius = 0.0f, bool hasAtmosphere = false, Vector3? atmosphereWaveLenghts = null, bool spherizeWithDistance = true, RenderFlags additionalFlags = 0, VRage.Voxels.MyClipmap.PruningFunc prunningFunc = null) { var message = MessagePool.Get<MyRenderMessageCreateClipmap>(MyRenderMessageEnum.CreateClipmap); uint clipmapId = GetMessageId(); message.ClipmapId = clipmapId; message.WorldMatrix = worldMatrix; message.SizeLod0 = sizeLod0; message.ScaleGroup = scaleGroup; message.AtmosphereRadius = atmosphereRadius; message.PlanetRadius = planetRadius; message.HasAtmosphere = hasAtmosphere; message.Position = position; message.AtmosphereWaveLenghts = atmosphereWaveLenghts; message.SpherizeWithDistance = spherizeWithDistance; message.AdditionalRenderFlags = additionalFlags; message.PrunningFunc = prunningFunc; EnqueueMessage(message); return clipmapId; }
internal void SetVoxelLod(int lod, MyClipmapScaleEnum scaleEnum) { m_voxelLod = lod + ((scaleEnum == MyClipmapScaleEnum.Massive) ? 8 : 0); //Debug.Assert(m_cullProxy.Proxies != null); UpdateProxiesCustomAlpha(); }
public static uint CreateClipmap( MatrixD worldMatrix, Vector3I sizeLod0, MyClipmapScaleEnum scaleGroup, Vector3D position, float atmosphereRadius = 0.0f, float planetRadius = 0.0f, bool hasAtmosphere = false, Vector3? atmosphereWaveLenghts = null) { var message = MessagePool.Get<MyRenderMessageCreateClipmap>(MyRenderMessageEnum.CreateClipmap); uint clipmapId = m_render.GlobalMessageCounter++; message.ClipmapId = clipmapId; message.WorldMatrix = worldMatrix; message.SizeLod0 = sizeLod0; message.ScaleGroup = scaleGroup; message.AtmosphereRadius = atmosphereRadius; message.PlanetRadius = planetRadius; message.HasAtmosphere = hasAtmosphere; message.Position = position; message.AtmosphereWaveLenghts = atmosphereWaveLenghts; EnqueueMessage(message); return clipmapId; }