示例#1
0
        private static void AppendTexturedFaces(Dictionary<BlockFaceTexture, List<TexturedFace>> texturedFaces, 
            TextureCoordinateDictionary textureCoordinates, 
            Block blockType, Volume volume, Face face, FaceVertices faceVertices)
        {
            BlockFaceTexture blockFaceTexture = blockType.GetFaceTexture(face);

            TexturedFace texturedFace = new TexturedFace(volume, face, faceVertices);
            List<TexturedFace> texturedFacesList;
            if (texturedFaces.TryGetValue(blockFaceTexture, out texturedFacesList))
                texturedFacesList.Add(texturedFace);
            else
            {
                texturedFacesList = new List<TexturedFace>();
                texturedFacesList.Add(texturedFace);
                texturedFaces.Add(blockFaceTexture, texturedFacesList);
            }
            textureCoordinates.EnsureExists(texturedFace.textureMapping);
        }
示例#2
0
        public TexturedFace(Volume volume, Face face, FaceVertices faceVertices)
        {
            this.faceVertices = faceVertices;

            switch (face)
            {
                case Face.PositiveX:
                case Face.NegativeX:
                    textureMapping = new Size(volume.ScaleY, volume.ScaleZ);
                    break;

                case Face.PositiveY:
                case Face.NegativeY:
                    textureMapping = new Size(volume.ScaleX, volume.ScaleZ);
                    break;

                case Face.PositiveZ:
                case Face.NegativeZ:
                    textureMapping = new Size(volume.ScaleX, volume.ScaleY);
                    break;

                default: throw new Exception("Unknown texture face.");
            }
        }
示例#3
0
        public TexturedFace(Volume volume, Face face, FaceVertices faceVertices)
        {
            this.faceVertices = faceVertices;

            switch (face)
            {
            case Face.PositiveX:
            case Face.NegativeX:
                textureMapping = new Size(volume.ScaleY, volume.ScaleZ);
                break;

            case Face.PositiveY:
            case Face.NegativeY:
                textureMapping = new Size(volume.ScaleX, volume.ScaleZ);
                break;

            case Face.PositiveZ:
            case Face.NegativeZ:
                textureMapping = new Size(volume.ScaleX, volume.ScaleY);
                break;

            default: throw new Exception("Unknown texture face.");
            }
        }