Ejemplo n.º 1
0
        //public void BuildTriangle(Vector3 point1, Vector3 point2, Vector3 point3)
        //{
        //    int direction = 0;
        //    BlockTexture texture = TextureHelper.GetTexture(BlockTexture.Grass, (BlockFaceDirection)direction, BlockTexture.None);
        //    int faceIndex = (int)direction;
        //    Vector2[] UVList = TextureHelper.UVMappings[(int)texture * 6 + faceIndex];

        //    float light = 0f;
        //    Color color = Color.White;

        //    addVertex(point1, UVList[0], light, color);
        //    addVertex(point2, UVList[1], light, color);
        //    addVertex(point3, UVList[2], light, color);
        //    addIndex(0, 1, 2);
        //}

        public void BuildFace(BlockCorners corners, TileType type)
        {
            //BlockTexture texture = TextureHelper.GetTexture(type, (BlockFaceDirection)direction, BlockTexture.None);
            //int faceIndex = (int)direction;
            //Vector2[] UVList = TextureHelper.UVMappings[(int)texture * 6 + faceIndex];

            float light = 0.5f;
            Color color = Color.White;

            //addVertex(corners.BackUpperLeft, new Vector2(0.0f, 0.0f), light, color);
            //addVertex(corners.FrontUpperLeft, new Vector2(1.0f, 0.0f), light, color);
            //addVertex(corners.BackLowerLeft, new Vector2(0.0f, 1.0f), light, color);
            //addVertex(corners.FrontLowerLeft, new Vector2(1.0f, 1.0f), light, color);

            //addIndex(0, 1, 2, 2, 1, 3);
            //addIndex(0, 1, 3, 0, 3, 2);

            Vector2[] textureMapping = TextureHelper.GetCoordinates(type);

            addVertex(corners.FrontUpperRight, textureMapping[0], light, color);
            addVertex(corners.BackUpperRight, textureMapping[1], light, color);
            addVertex(corners.FrontLowerRight, textureMapping[2], light, color);
            addVertex(corners.BackLowerRight, textureMapping[3], light, color);

            //addVertex(corners.FrontUpperRight, new Vector2(0.0f, 0.0f), light, color);
            //addVertex(corners.BackUpperRight, new Vector2(1.0f, 0.0f), light, color);
            //addVertex(corners.FrontLowerRight, new Vector2(0.0f, 1.0f), light, color);
            //addVertex(corners.BackLowerRight, new Vector2(1.0f, 1.0f), light, color);

            addIndex(0, 1, 3, 0, 3, 2);
        }
Ejemplo n.º 2
0
        public void BuildFace(BlockCorners corners, TextureList texture, int rotation)
        {
            float light = 0.5f;
            Color color = Color.White;

            Vector2[] textureMapping = TextureHelper.RequestTexture(texture, rotation);

            addVertex(corners.FrontUpperRight, textureMapping[0], light, color);
            addVertex(corners.BackUpperRight, textureMapping[1], light, color);
            addVertex(corners.FrontLowerRight, textureMapping[2], light, color);
            addVertex(corners.BackLowerRight, textureMapping[3], light, color);

            addIndex(0, 1, 3, 0, 3, 2);
        }