Пример #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);
            }
        }
        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);
        }
Пример #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_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);
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
 public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
 {
     for (int i = 0; i < 6; i++)
     {
         if (WireExistsOnFace(value, i))
         {
             generator.GenerateWireVertices(value, x, y, z, i, 0f, Vector2.Zero, geometry.SubsetOpaque);
         }
     }
 }
Пример #6
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);
        }
Пример #7
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);
            }
        }
Пример #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_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);
            }
        }
Пример #9
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);
        }
Пример #10
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);
            }
            generator.GenerateWireVertices(value, x, y, z, GetHingeFace(data), m_pivotDistance * 2f, Vector2.Zero, geometry.SubsetOpaque);
        }
Пример #11
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);
        }
Пример #12
0
        public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            if (generator.SubsystemFurnitureBlockBehavior == null)
            {
                return;
            }
            int             data        = Terrain.ExtractData(value);
            int             designIndex = GetDesignIndex(data);
            int             rotation    = GetRotation(data);
            FurnitureDesign design      = generator.SubsystemFurnitureBlockBehavior.GetDesign(designIndex);

            if (design == null)
            {
                return;
            }
            FurnitureGeometry geometry2 = design.Geometry;
            int mountingFacesMask       = design.MountingFacesMask;

            for (int i = 0; i < 6; i++)
            {
                int   num   = CellFace.OppositeFace((i < 4) ? ((i + rotation) % 4) : i);
                byte  b     = (byte)(LightingManager.LightIntensityByLightValueAndFace[15 + 16 * num] * 255f);
                Color color = new Color(b, b, b);
                if (geometry2.SubsetOpaqueByFace[i] != null)
                {
                    generator.GenerateShadedMeshVertices(this, x, y, z, geometry2.SubsetOpaqueByFace[i], color, m_matrices[rotation], m_facesMaps[rotation], geometry.OpaqueSubsetsByFace[num]);
                }
                if (geometry2.SubsetAlphaTestByFace[i] != null)
                {
                    generator.GenerateShadedMeshVertices(this, x, y, z, geometry2.SubsetAlphaTestByFace[i], color, m_matrices[rotation], m_facesMaps[rotation], geometry.AlphaTestSubsetsByFace[num]);
                }
                int num2 = CellFace.OppositeFace((i < 4) ? ((i - rotation + 4) % 4) : i);
                if ((mountingFacesMask & (1 << num2)) != 0)
                {
                    generator.GenerateWireVertices(value, x, y, z, i, 0f, Vector2.Zero, geometry.SubsetOpaque);
                }
            }
        }
Пример #13
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);
 }