예제 #1
0
        private void UpdateActorInfo(bool refreshFoliage = false)
        {
            MyVoxelRenderableComponent renderableComponent = m_actor.GetRenderable() as MyVoxelRenderableComponent;
            var matrix = MatrixD.CreateScale(m_scale) * MatrixD.CreateTranslation(m_translation) * m_worldMatrix;

            renderableComponent.m_voxelScale  = m_scale;
            renderableComponent.m_voxelOffset = m_translation;

            m_actor.SetMatrix(ref matrix);
            m_actor.SetAabb(m_localAabb.Transform(m_worldMatrix));
            renderableComponent.SetVoxelLod(m_lod, ScaleGroup);
            m_actor.MarkRenderDirty();

            UpdateFoliage(refreshFoliage);
        }
예제 #2
0
        internal void PropagateMatrixChange(MyActor child)
        {
            var matrix = child.m_relativeTransform.HasValue
                        ? (MatrixD)child.m_relativeTransform.Value * m_owner.WorldMatrix
                        : m_owner.WorldMatrix;

            child.SetMatrix(ref matrix);
        }
예제 #3
0
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            MyMeshes.UpdateVoxelCell(Mesh, msg.Batches);

            m_scale       = msg.PositionScale;
            m_translation = msg.PositionOffset;

            var matrix = (Matrix)(Matrix.CreateScale(m_scale) * Matrix.CreateTranslation(m_translation) * m_worldMatrix);

            m_actor.SetMatrix(ref matrix);
            m_actor.GetRenderable().SetVoxelLod(m_lod);

            m_actor.SetAabb(msg.MeshAabb.Transform((Matrix)m_worldMatrix));

            (m_actor.GetComponent(MyActorComponentEnum.Foliage) as MyFoliageComponent).InvalidateStreams();
            m_actor.MarkRenderDirty();
        }
예제 #4
0
		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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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;
        }
예제 #7
0
        internal MyClipmapCellProxy(MyCellCoord cellCoord, ref VRageMath.MatrixD 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;
        }
예제 #8
0
        internal MyClipmapCellProxy(MyCellCoord cellCoord, ref MatrixD worldMatrix, Vector3D massiveCenter, float massiveRadius, RenderFlags additionalFlags = 0)
        {
            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 = MyMeshes.CreateVoxelCell(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);
        }
        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);
        }
예제 #10
0
 internal void PropagateMatrixChange(MyActor child)
 {
     var matrix = child.m_relativeTransform.HasValue
                 ? (MatrixD)child.m_relativeTransform.Value * m_owner.WorldMatrix
                 : m_owner.WorldMatrix;
     child.SetMatrix(ref matrix);
 }