Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
        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();
            }
        }
Esempio n. 9
0
        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();
            }
        }
Esempio n. 10
0
        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();
            }
        }
Esempio n. 13
0
        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();
            }
        }
Esempio n. 14
0
 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;
 }
Esempio n. 15
0
 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;
 }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
 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;
 }
Esempio n. 18
0
 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;
 }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
 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];
 }
Esempio n. 22
0
        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;
        }
Esempio n. 23
0
 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();
        }
Esempio n. 25
0
        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;

            UpdateProxiesCustomAlpha();
        }
        internal void SetVoxelLod(int lod, MyClipmapScaleEnum scaleEnum)
        {
            m_voxelLod = lod + ((scaleEnum == MyClipmapScaleEnum.Massive) ? 8 : 0);

            //Debug.Assert(m_cullProxy.Proxies != null);

            UpdateProxiesCustomAlpha();
        }
Esempio n. 28
0
        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;
        }