public GuiItemModel(ShaderProgram shader) { this.shader = shader; var rawQuad = new RawQuad(new float[] { -1, 1, -1, -1, 1, -1, 1, 1 }, new float[] { 0, 0, 1, 0, 1, 1, 0, 1 }); rawModel = GraphicsManager.loadModelToVAO(new List <RawQuad> { rawQuad }, 2); }
protected virtual void renderBlock(EnumBlock block, float scale, int x, int y) { var UVs = TextureManager.getUVsFromBlock(block); GraphicsManager.overrideModelUVsInVAO(itemModel.rawModel.bufferIDs[1], UVs.getUVForSide(EnumFacing.SOUTH).ToArray()); var unit = new Vector2(1f / Game.INSTANCE.ClientSize.Width, 1f / Game.INSTANCE.ClientSize.Height); float width = 16; float height = 16; float scaledWidth = 16 * scale; float scaledHeight = 16 * scale; float posX = x + scaledWidth / 2; float posY = -y - scaledHeight / 2; var pos = new Vector2(posX, posY) * unit; var mat = MatrixHelper.createTransformationMatrix(pos * 2 - Vector2.UnitX + Vector2.UnitY, scale * new Vector2(width, height) * unit); itemModel.shader.start(); itemModel.shader.loadTransformationMatrix(mat); GL.BindVertexArray(itemModel.rawModel.vaoID); GL.EnableVertexAttribArray(0); GL.EnableVertexAttribArray(1); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, TextureManager.blockTextureAtlasID); GL.DrawArrays(itemModel.shader.renderType, 0, 4); GL.DisableVertexAttribArray(0); GL.DisableVertexAttribArray(1); GL.BindVertexArray(0); itemModel.shader.stop(); }
public CubeOutlineModel(ShaderProgram shader) { this.shader = shader; rawModel = GraphicsManager.loadModelToVAO(ModelManager.createCubeModel(), 3); }
public static void stitchTextures() { blockTextureAtlasID = GraphicsManager.loadTexture(generateTextureMap(), false); }
public override void onClose() { GraphicsManager.deleteTexture(background.textureID); }
public GuiScreenIngameMenu() { background = new GuiTexture(GraphicsManager.loadTexture("gui/bg_transparent", false), Vector2.Zero, Vector2.One * 4); }
public void overrideData(List <RawQuad> quads) { rawModel = GraphicsManager.overrideModelInVAO(rawModel.vaoID, rawModel.bufferIDs, quads, 3); }
static GuiButton() { GUI_BUTTON = new GuiTexture(GraphicsManager.loadTexture("gui/button", false)); GUI_BUTTON_HOVER = new GuiTexture(GraphicsManager.loadTexture("gui/button_hover", false)); }
public override void onClose() { GraphicsManager.deleteTexture(gui.textureID); }
public GuiScreenCrafting() { gui = new GuiTexture(GraphicsManager.loadTexture("gui/crafting", false), Vector2.One * 0.5f); }
public virtual void onClose() { GraphicsManager.deleteTexture(background.textureID); }
public GuiScreen() { background = new GuiTexture(GraphicsManager.loadTexture("gui/bg", false), Vector2.Zero, Vector2.One * 4); }