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; } } }
public Vector2 GetUVs(int index) { FaceEdgeTextureUvData faceEdgeData = FaceEdgeTextureUvData.Get(this); if (faceEdgeData != null && index < faceEdgeData.TextureUV.Count) { return(faceEdgeData.TextureUV[index]); } return(new Vector2()); }
static public FaceEdgeTextureUvData Get(FaceEdge faceEdgeToGetTextureUvDataFor) { FaceEdgeTextureUvData plugin; faceEdgesWithTextureUvData.TryGetValue(faceEdgeToGetTextureUvDataFor, out plugin); if (plugin == null) { FaceEdgeTextureUvData newPlugin = new FaceEdgeTextureUvData(); faceEdgesWithTextureUvData.Add(faceEdgeToGetTextureUvDataFor, newPlugin); return(newPlugin); } return(plugin); }
static public FaceEdgeTextureUvData Get(FaceEdge faceEdgeToGetTextureUvDataFor) { FaceEdgeTextureUvData plugin = null; lock(faceEdgesWithTextureUvData) { faceEdgesWithTextureUvData.TryGetValue(faceEdgeToGetTextureUvDataFor, out plugin); if (plugin == null) { FaceEdgeTextureUvData newPlugin = new FaceEdgeTextureUvData(); faceEdgesWithTextureUvData.Add(faceEdgeToGetTextureUvDataFor, newPlugin); return newPlugin; } } return plugin; }
static public FaceEdgeTextureUvData Get(FaceEdge faceEdgeToGetTextureUvDataFor) { FaceEdgeTextureUvData plugin = null; using (TimedLock.Lock(faceEdgesWithTextureUvData, "Get FaceEdgeTextureUvData")) { faceEdgesWithTextureUvData.TryGetValue(faceEdgeToGetTextureUvDataFor, out plugin); if (plugin == null) { FaceEdgeTextureUvData newPlugin = new FaceEdgeTextureUvData(); faceEdgesWithTextureUvData.Add(faceEdgeToGetTextureUvDataFor, newPlugin); return(newPlugin); } } return(plugin); }