Example #1
0
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
        {
            BlockMesh drawMesh = new BlockMesh();
            Point3    p        = new Point3(x, y, z);
            Terrain   terrain  = generator.Terrain;

            for (int i = 0; i < 6; i++)
            {
                Point3 pp = p + Fixdirection[i];
                int    v  = terrain.GetCellContents(pp.X, pp.Y, pp.Z);
                if (v == 1003)
                {
                    BlockMesh blockMesh = new BlockMesh();
                    Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[i]).ParentBone);
                    blockMesh.AppendModelMeshPart(model.FindMesh(eles[i]).MeshParts[0], matrix * Matrix.CreateScale(0.7f), false, false, false, false, Color.White);
                    drawMesh.AppendBlockMesh(blockMesh);
                }
            }
            BlockMesh blockMeshd = new BlockMesh();
            Matrix    matrixd    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[6]).ParentBone);

            blockMeshd.AppendModelMeshPart(model.FindMesh(eles[6]).MeshParts[0], matrixd * Matrix.CreateScale(0.7f), false, false, false, false, Color.White);
            drawMesh.AppendBlockMesh(blockMeshd);
            drawMesh.TransformPositions(Matrix.CreateTranslation(0.5f, 0.5f, 0.5f));
            if (!ComponentPlayUpdate.duliBlocks.ContainsKey(p))
            {
                ComponentPlayUpdate.duliBlocks.Add(p, texture);
            }
            generator.GenerateMeshVertices(block, x, y, z, drawMesh, Color.White, Matrix.Identity, ComponentPlayUpdate.GTV(x, y, z, geometry).SubsetTransparent);
            boundmesh = drawMesh;
        }
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
        {
            Point3 p = new Point3(x, y, z);

            if (!ComponentPlayUpdate.duliBlocks.ContainsKey(p))
            {
                ComponentPlayUpdate.duliBlocks.Add(p, texture);
            }
            generator.GenerateMeshVertices(block, x, y, z, drawMesh, Color.White, Matrix.Identity, ComponentPlayUpdate.GTV(x, y, z, geometry).SubsetTransparent);
        }