Exemplo n.º 1
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int   data           = Terrain.ExtractData(value);
            int   mountingFace   = GetMountingFace(data);
            int   lightIntensity = GetLightIntensity(data);
            int?  color          = GetColor(data);
            Color color2         = color.HasValue ? SubsystemPalette.GetColor(generator, color) : m_copperColor;

            if (mountingFace < m_bulbBlockMeshes.Length)
            {
                if (lightIntensity <= 0)
                {
                    generator.GenerateMeshVertices(this, x, y, z, m_bulbBlockMeshes[mountingFace], Color.White, null, geometry.SubsetAlphaTest);
                }
                else
                {
                    byte r = (byte)(195 + lightIntensity * 4);
                    byte g = (byte)(180 + lightIntensity * 5);
                    byte b = (byte)(165 + lightIntensity * 6);
                    generator.GenerateMeshVertices(this, x, y, z, m_bulbBlockMeshesLit[mountingFace], new Color(r, g, b), null, geometry.SubsetOpaque);
                }
                generator.GenerateMeshVertices(this, x, y, z, m_sidesBlockMeshes[mountingFace], color2, null, geometry.SubsetOpaque);
                generator.GenerateWireVertices(value, x, y, z, mountingFace, 0.875f, Vector2.Zero, geometry.SubsetOpaque);
            }
        }
Exemplo n.º 2
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int data    = Terrain.ExtractData(value);
            int variant = GetVariant(data);
            int?color   = GetColor(data);

            if (color.HasValue)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_coloredBlockMeshes[variant], SubsystemPalette.GetColor(generator, color), null, m_useAlphaTest ? geometry.SubsetAlphaTest : geometry.SubsetOpaque);
            }
            else
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshes[variant], m_unpaintedColor, null, m_useAlphaTest ? geometry.SubsetAlphaTest : geometry.SubsetOpaque);
            }
        }
Exemplo n.º 3
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (num < m_matricesByData.Length)
            {
                int    num2   = (generator.SubsystemMetersBlockBehavior != null) ? generator.SubsystemMetersBlockBehavior.GetThermometerReading(x, y, z) : 8;
                float  y2     = MathUtils.Lerp(1f, 4f, (float)num2 / 15f);
                Matrix matrix = m_matricesByData[num];
                Matrix value2 = Matrix.CreateTranslation(0f, 0f - m_fluidBottomPosition, 0f) * Matrix.CreateScale(1f, y2, 1f) * Matrix.CreateTranslation(0f, m_fluidBottomPosition, 0f) * matrix;
                generator.GenerateMeshVertices(this, x, y, z, m_caseMesh, Color.White, matrix, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_fluidMesh, Color.White, value2, geometry.SubsetOpaque);
                generator.GenerateWireVertices(value, x, y, z, num & 3, 0.2f, Vector2.Zero, geometry.SubsetOpaque);
            }
        }
Exemplo n.º 4
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (num < m_matricesByData.Length)
            {
                int    humidity = generator.Terrain.GetHumidity(x, z);
                float  radians  = MathUtils.Lerp(1.5f, -1.5f, (float)humidity / 15f);
                Matrix matrix   = m_matricesByData[num];
                Matrix value2   = m_invPointerMatrix * Matrix.CreateRotationX(radians) * m_pointerMatrix * matrix;
                generator.GenerateMeshVertices(this, x, y, z, m_caseMesh, Color.White, matrix, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_pointerMesh, Color.White, value2, geometry.SubsetOpaque);
                generator.GenerateWireVertices(value, x, y, z, num & 3, 0.25f, Vector2.Zero, geometry.SubsetOpaque);
            }
        }
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value) & 0x1F;

            generator.GenerateMeshVertices(this, x, y, z, m_blockMeshes[num], Color.White, null, geometry.SubsetOpaque);
            generator.GenerateWireVertices(value, x, y, z, GetFace(value), m_centerBoxSize, Vector2.Zero, geometry.SubsetOpaque);
        }
Exemplo n.º 6
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int data  = Terrain.ExtractData(value);
            int face  = GetFace(data);
            int?color = GetColor(data);

            if (color.HasValue)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_coloredBlockMeshes[face], SubsystemPalette.GetColor(generator, color), null, geometry.SubsetOpaque);
            }
            else
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshes[face], Color.White, null, geometry.SubsetOpaque);
            }
            generator.GenerateWireVertices(value, x, y, z, GetFace(data), 0.375f, Vector2.Zero, geometry.SubsetOpaque);
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (num < m_collisionBoxesByData.Length)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_meshesByData[num], Color.White, null, geometry.SubsetOpaque);
            }
        }
Exemplo n.º 9
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (num < m_blockMeshesByData.Length)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshesByData[num], Color.White, null, geometry.SubsetOpaque);
                generator.GenerateWireVertices(value, x, y, z, GetFace(value), 0.125f, Vector2.Zero, geometry.SubsetOpaque);
            }
        }
Exemplo n.º 10
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int mountingFace = GetMountingFace(Terrain.ExtractData(value));

            if (mountingFace < m_blockMeshesByFace.Length)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshesByFace[mountingFace], Color.White, null, geometry.SubsetOpaque);
                generator.GenerateWireVertices(value, x, y, z, mountingFace, 1f, Vector2.Zero, geometry.SubsetOpaque);
            }
        }
Exemplo n.º 11
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int   data       = Terrain.ExtractData(value);
            int   face       = BottomSuckerBlock.GetFace(data);
            int   subvariant = BottomSuckerBlock.GetSubvariant(data);
            Color color      = m_colors[subvariant];

            generator.GenerateMeshVertices(this, x, y, z, m_blockMeshes[4 * face + subvariant], color, null, geometry.SubsetOpaque);
            base.GenerateTerrainVertices(generator, geometry, value, x, y, z);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (IsBottomPart(generator.Terrain, x, y, z) && num < m_blockMeshesByData.Length)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshesByData[num], Color.White, null, geometry.SubsetAlphaTest);
            }
            Vector2 centerOffset = GetRightHanded(num) ? new Vector2(-0.45f, 0f) : new Vector2(0.45f, 0f);

            generator.GenerateWireVertices(value, x, y, z, GetHingeFace(num), 0.01f, centerOffset, geometry.SubsetOpaque);
        }
Exemplo n.º 14
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int  data   = Terrain.ExtractData(value);
            int  size   = GetSize(data);
            bool isDead = GetIsDead(data);

            if (size >= 1)
            {
                generator.GenerateMeshVertices(this, x, y, z, m_blockMeshesBySize[size], Color.White, null, geometry.SubsetOpaque);
            }
            if (size == 0)
            {
                generator.GenerateCrossfaceVertices(this, value, x, y, z, new Color(160, 160, 160), 11, geometry.SubsetAlphaTest);
            }
            else if (size < 7 && !isDead)
            {
                generator.GenerateCrossfaceVertices(this, value, x, y, z, Color.White, 28, geometry.SubsetAlphaTest);
            }
        }
Exemplo n.º 15
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            int num = Terrain.ExtractData(value);

            if (num < m_blockMeshes.Length)
            {
                int    num2   = Terrain.ExtractContents((y > 0) ? generator.Terrain.GetCellValueFast(x, y - 1, z) : 0);
                bool   num3   = BlocksManager.Blocks[num2].DigMethod != BlockDigMethod.Shovel;
                bool   flag   = num2 == 7 || num2 == 4 || num2 == 52;
                int    num4   = (int)(MathUtils.Hash((uint)(x + 172 * y + 18271 * z)) & 0xFFFF);
                Matrix value2 = Matrix.Identity;
                if (!num3)
                {
                    float radians  = 0.2f * ((float)(num4 % 16) / 7.5f - 1f);
                    float radians2 = 0.1f * ((float)((num4 >> 4) % 16) / 7.5f - 1f);
                    value2 = ((GetRotation(num) != 0) ? (Matrix.CreateTranslation(-0.5f, 0f, -0.5f) * Matrix.CreateRotationZ(radians) * Matrix.CreateRotationY(radians2) * Matrix.CreateTranslation(0.5f, 0f, 0.5f)) : (Matrix.CreateTranslation(-0.5f, 0f, -0.5f) * Matrix.CreateRotationX(radians) * Matrix.CreateRotationY(radians2) * Matrix.CreateTranslation(0.5f, 0f, 0.5f)));
                }
                float f = num3 ? 0f : MathUtils.Sqr((float)((num4 >> 8) % 16) / 15f);
                generator.GenerateMeshVertices(color: (!flag) ? Color.Lerp(Color.White, new Color(255, 233, 199), f) : Color.Lerp(new Color(217, 206, 123), new Color(229, 206, 123), f), block: this, x: x, y: y, z: z, blockMesh: m_blockMeshes[num], matrix: value2, subset: geometry.SubsetOpaque);
            }
        }
Exemplo n.º 16
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            Color color = BlockColorsMap.SpruceLeavesColorsMap.Lookup(generator.Terrain, x, y, z);

            if (GetLightState(Terrain.ExtractData(value)))
            {
                generator.GenerateMeshVertices(this, x, y, z, m_standTrunkBlockMesh, Color.White, null, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_litDecorationsBlockMesh, Color.White, null, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_leavesBlockMesh, color, null, geometry.SubsetAlphaTest);
            }
            else
            {
                generator.GenerateMeshVertices(this, x, y, z, m_standTrunkBlockMesh, Color.White, null, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_decorationsBlockMesh, Color.White, null, geometry.SubsetOpaque);
                generator.GenerateMeshVertices(this, x, y, z, m_leavesBlockMesh, color, null, geometry.SubsetAlphaTest);
            }
            generator.GenerateWireVertices(value, x, y, z, 4, 0.01f, Vector2.Zero, geometry.SubsetOpaque);
        }
Exemplo n.º 17
0
 public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
 {
     generator.GenerateMeshVertices(this, x, y, z, m_blockMesh, Color.White, null, geometry.SubsetOpaque);
     generator.GenerateWireVertices(value, x, y, z, 4, 0.25f, Vector2.Zero, geometry.SubsetOpaque);
 }
Exemplo n.º 18
0
 public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
 {
     generator.GenerateMeshVertices(this, x, y, z, m_blockMesh, Color.White, null, geometry.SubsetAlphaTest);
 }
Exemplo n.º 19
0
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
        {
            int data = Terrain.ExtractData(value);

            generator.GenerateMeshVertices(block, x, y, z, Meshes[GetType(data)], SubsystemPalette.GetColor(generator, PaintableItemBlock.GetColor(data)), null, geometry.SubsetOpaque);
        }
Exemplo n.º 20
0
 public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
 {
     generator.GenerateMeshVertices(this, x, y, z, m_blockMeshes[GetRailType(Terrain.ExtractData(value))], Color.White, null, geometry.SubsetAlphaTest);
 }
Exemplo n.º 21
0
 public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
 {
     generator.GenerateMeshVertices(block, x, y, z, m_standaloneBlockMesh, Color, null, geometry.SubsetOpaque);
 }
Exemplo n.º 22
0
 public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
 {
     generator.GenerateMeshVertices(block, x, y, z, m_standaloneBlockMesh, SubsystemPalette.GetColor(generator, PaintableItemBlock.GetColor(Terrain.ExtractData(value))), null, geometry.SubsetOpaque);
     WireDevice.GenerateWireVertices(generator, value, x, y, z, 4, 0f, Vector2.Zero, geometry.SubsetOpaque);
 }