public BitmapDecal(ConfigNode node, BitmapDecalCache.Sheet sheet, Texture2D texture) { type = Type.MONO; if (node.HasValue("type")) type = (Type)ConfigNode.ParseEnum(typeof(Type), node.GetValue("type")); name = node.GetValue("name"); url = sheet.url + "/" + name; Rectangle rect = new Rectangle(); rect.x = int.Parse(node.GetValue("x")); rect.y = int.Parse(node.GetValue("y")); rect.w = int.Parse(node.GetValue("w")); rect.h = int.Parse(node.GetValue("h")); if (rect.w == 0 || rect.h == 0) return; if (sheet.origin == BitmapDecalCache.Origin.TOP_LEFT) { rect.y = texture.height - rect.y - rect.h; } Orientation orientation = Orientation.UPRIGHT; if (node.HasValue("orientation")) orientation = (Orientation)ConfigNode.ParseEnum(typeof(Orientation), node.GetValue("orientation")); image = texture.GetImage(rect); switch (orientation) { case Orientation.FLIPPED_XY: image.flipXY(false); break; case Orientation.INVERTED: image.flipVertically(); break; case Orientation.UPRIGHT: default: break; } }
public void setDecalCache(BitmapDecalCache decalCache) { _decalCache = decalCache; }