public static void PlaceTextureOnFace(Face face, ImageBuffer textureToUse)
        {
            FaceTextureData faceData = FaceTextureData.Get(face);

            faceData.Textures.Add(textureToUse);
            int count = 0;

            foreach (FaceEdge faceEdge in face.FaceEdges())
            {
                FaceEdgeTextureUvData edgeUV = FaceEdgeTextureUvData.Get(faceEdge);
                switch (count++)
                {
                case 0:
                    edgeUV.TextureUV.Add(new Vector2(0, 0));
                    break;

                case 1:
                    edgeUV.TextureUV.Add(new Vector2(1, 0));
                    break;

                case 2:
                    edgeUV.TextureUV.Add(new Vector2(1, 1));
                    break;

                case 3:
                    edgeUV.TextureUV.Add(new Vector2(0, 1));
                    break;
                }
            }
        }
示例#2
0
文件: Face.cs 项目: asmboom/PixelFarm
        public ImageBuffer GetTexture(int index)
        {
            FaceTextureData faceData = FaceTextureData.Get(this);

            if (faceData != null && index < faceData.Textures.Count)
            {
                return(faceData.Textures[index]);
            }

            return(null);
        }