internal void Clear()
 {
     WorldMatrix           = MatrixD.Zero;
     CommonObjectData      = default(MyObjectDataCommon);
     NonVoxelObjectData    = MyObjectDataNonVoxel.Invalid;
     VoxelCommonObjectData = MyObjectDataVoxelCommon.Invalid;
     Mesh             = LodMeshId.NULL;
     MergedMesh       = MyMergedLodMeshId.NULL;
     Instancing       = InstancingId.NULL;
     DepthShaders     = MyMaterialShadersBundleId.NULL;
     Shaders          = MyMaterialShadersBundleId.NULL;
     ForwardShaders   = MyMaterialShadersBundleId.NULL;
     DrawSubmesh      = default(MyDrawSubmesh);
     PerMaterialIndex = 0;
     SectionSubmeshes = null;
     InstanceCount    = 0;
     StartInstance    = 0;
     SkinningMatrices = null;
     Type             = MyMaterialType.OPAQUE;
     Flags            = 0;
     Lod          = 0;
     ObjectBuffer = null;
     Parent       = null;
     Material     = MyStringId.NullOrEmpty;
 }
Esempio n. 2
0
        static unsafe IConstantBuffer GetObjectCB(MyRenderContext RC, MyInstanceComponent instance, float stateData)
        {
            Vector4 col0, col1, col2;

            instance.GetMatrixCols(0, out col0, out col1, out col2);
            Matrix matrix = Matrix.Identity;

            matrix.SetRow(0, col0);
            matrix.SetRow(1, col1);
            matrix.SetRow(2, col2);
            matrix = Matrix.Transpose(matrix);

            int cbSize = sizeof(MyObjectDataCommon);

            cbSize += sizeof(MyObjectDataNonVoxel);

            IConstantBuffer      cb           = MyCommon.GetObjectCB(cbSize);
            var                  mapping      = MyMapping.MapDiscard(RC, cb);
            MyObjectDataNonVoxel nonVoxelData = new MyObjectDataNonVoxel();

            mapping.WriteAndPosition(ref nonVoxelData);
            MyObjectDataCommon commonData = new MyObjectDataCommon();

            commonData.LocalMatrix = matrix;
            commonData.ColorMul    = Vector3.One;
            commonData.KeyColor    = new Vector3(0, -1f, 0f);
            commonData.CustomAlpha = stateData;

            mapping.WriteAndPosition(ref commonData);
            mapping.Unmap();
            return(cb);
        }
Esempio n. 3
0
        protected static unsafe IConstantBuffer GetPlaceholderObjectCB(MyRenderContext RC, uint lod)
        {
            int cbSize = sizeof(MyObjectDataCommon);

            cbSize += sizeof(MyObjectDataNonVoxel);

            IConstantBuffer      cb           = MyCommon.GetObjectCB(cbSize);
            var                  mapping      = MyMapping.MapDiscard(RC, cb);
            MyObjectDataNonVoxel nonVoxelData = new MyObjectDataNonVoxel();

            mapping.WriteAndPosition(ref nonVoxelData);
            MyObjectDataCommon commonData = new MyObjectDataCommon();

            commonData.LocalMatrix = Matrix.Identity;
            commonData.ColorMul    = Vector3.One;
            commonData.KeyColor    = new Vector3(0, 0f, 0f);
            commonData.LOD         = lod;
            mapping.WriteAndPosition(ref commonData);
            mapping.Unmap();
            return(cb);
        }
 internal void Clear()
 {
     WorldMatrix = MatrixD.Zero;
     CommonObjectData = default(MyObjectDataCommon);
     NonVoxelObjectData = MyObjectDataNonVoxel.Invalid;
     VoxelCommonObjectData = MyObjectDataVoxelCommon.Invalid;
     Mesh = LodMeshId.NULL;
     MergedMesh = MyMergedLodMeshId.NULL;
     Instancing = InstancingId.NULL;
     DepthShaders = MyMaterialShadersBundleId.NULL;
     Shaders = MyMaterialShadersBundleId.NULL;
     ForwardShaders = MyMaterialShadersBundleId.NULL;
     DrawSubmesh = default(MyDrawSubmesh);
     PerMaterialIndex = 0;
     SectionSubmeshes = null;
     InstanceCount = 0;
     StartInstance = 0;
     SkinningMatrices = null;
     Type = MyMaterialType.OPAQUE;
     Flags = 0;
     Lod = 0;
     ObjectBuffer = null;
     Parent = null;
     Material = MyMeshMaterialId.NULL;
     UnusedMaterials = UnusedMaterials ?? new HashSet<string>();
     UnusedMaterials.Clear();
 }