public static Gem.Gui.UIItem CreateGuiSprite(Rectangle Position, int TileIndex, TileSheet TileSheet) { return new Gem.Gui.UIItem( Gem.Gui.Shape.CreateSprite(Position.X, Position.Y, Position.Width, Position.Height), new Gem.Gui.GuiProperties { Image = TileSheet.Texture, ImageTransform = TileSheet.TileMatrix(TileIndex) }); }
private static void MorphBlockTextureCoordinates(TileSheet Tiles, BlockTemplate Template, Gem.Geo.Mesh cube) { Gem.Geo.Gen.MorphEx(cube, (inV) => { var r = inV; var top = Template.Top; var bottom = Template.Bottom == -1 ? Template.Top : Template.Bottom; var sideA = Template.SideA == -1 ? Template.Top : Template.SideA; var sideB = Template.SideB == -1 ? sideA : Template.SideB; if (r.Normal.Z > 0.1f) r.TextureCoordinate = Vector2.Transform(r.TextureCoordinate, Tiles.TileMatrix(bottom)); else if (r.Normal.Z < -0.1f) r.TextureCoordinate = Vector2.Transform(r.TextureCoordinate, Tiles.TileMatrix(top)); else { if (r.Normal.X != 0) r.TextureCoordinate = Vector2.Transform(r.TextureCoordinate, Tiles.TileMatrix(sideA)); else r.TextureCoordinate = Vector2.Transform(r.TextureCoordinate, Tiles.TileMatrix(sideB)); } return r; }); }
private static Gem.Geo.Mesh CreateNormalBlockMesh(TileSheet Tiles, BlockTemplate Template) { var mesh = Gem.Geo.Gen.Copy(ShapeTemplates[Template.Shape].Mesh); MorphBlockTextureCoordinates(Tiles, Template, mesh); return mesh; }
private static Gem.Geo.Mesh CreateMarkerBlockMesh(TileSheet Tiles, int MarkerTile) { var cube = Gem.Geo.Gen.CreateTexturedFacetedCube(); Gem.Geo.Gen.Transform(cube, Matrix.CreateScale(1.02f)); // Make cube slightly larger. Gem.Geo.Gen.Transform(cube, Matrix.CreateTranslation(0.5f, 0.5f, 0.5f)); // re-origin cube. //Morph cube texture coordinates Gem.Geo.Gen.MorphEx(cube, (inV) => { var r = inV; r.TextureCoordinate = Vector2.Transform(r.TextureCoordinate, Tiles.TileMatrix(MarkerTile)); return r; }); return cube; }
public static Gem.Geo.Mesh CreateResourceBlockMesh(TileSheet Tiles, BlockTemplate Template) { var mesh = CreateNormalBlockMesh(Tiles, Template); Gem.Geo.Gen.Transform(mesh, Matrix.CreateScale(0.5f)); return mesh; }
public Gnome(Simulation Sim, TileSheet Sheet) { Mind = new GnomeMind(this); Renderable = new GnomeNode(this, Sim, Sheet); }