Another restructure with code updates.
Updated RectTextrue.cs, VertexInformation.cs, and IDrawable.cs to properly pass indice information.
This commit is contained in:
@@ -3,10 +3,10 @@ namespace RecrownedGTK.Graphics.Render {
|
||||
public interface IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills the parameters with the information needed to draw this texture.!--
|
||||
/// Fills the parameters with the information needed to draw this texture.
|
||||
/// </summary>
|
||||
/// <param name="vertices">The vertices in pairs of 3 normalized in the order x, y, and z.</param>
|
||||
/// <param name="textureData">The texture data to be used. Can be null.</param>
|
||||
void Draw(out VertexInformation[] vertices, out TextureData textureData);
|
||||
void Draw(out VertexInformation[] vertices, out uint[] indices, out TextureData textureData);
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@ using RecrownedGTK.Types;
|
||||
using OpenTK.Graphics;
|
||||
namespace RecrownedGTK.Graphics.Render {
|
||||
public class RectTexture : Rectangle, IDrawable {
|
||||
private uint[] indices;
|
||||
private VertexInformation[] vertices;
|
||||
private TextureData textureData;
|
||||
public Color4 Color {
|
||||
@@ -55,8 +56,13 @@ namespace RecrownedGTK.Graphics.Render {
|
||||
}
|
||||
public RectTexture(TextureData textureData) {
|
||||
this.textureData = textureData;
|
||||
|
||||
vertices = new VertexInformation[4];
|
||||
indices = new uint[] {0, 1, 3,
|
||||
1, 2, 3};
|
||||
}
|
||||
public void Draw(out VertexInformation[] vertices, out TextureData textureData) {
|
||||
public void Draw(out VertexInformation[] vertices, out uint[] indices, out TextureData textureData) {
|
||||
indices = this.indices;
|
||||
vertices = this.vertices;
|
||||
textureData = this.textureData;
|
||||
}
|
@@ -2,7 +2,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
namespace RecrownedGTK.Graphics.Render.Shader {
|
||||
namespace RecrownedGTK.Graphics.Render.Shaders {
|
||||
public class Shader : IDisposable {
|
||||
int handle;
|
||||
public bool IsDisposed {
|
@@ -7,7 +7,7 @@ namespace RecrownedGTK.Graphics {
|
||||
public class TextureData : IDisposable {
|
||||
private bool disposed;
|
||||
int handle;
|
||||
|
||||
public readonly int width, height;
|
||||
public TextureWrapMode textureWrapModeWidth, textureWrapModeHeight;
|
||||
public Color4 borderColor;
|
||||
public TextureMinFilter textureMinFilter;
|
||||
@@ -25,7 +25,8 @@ namespace RecrownedGTK.Graphics {
|
||||
height = bitmap.Height;
|
||||
}
|
||||
}
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
GenerateTexture(textureData, width, height);
|
||||
}
|
||||
|
||||
@@ -34,7 +35,8 @@ namespace RecrownedGTK.Graphics {
|
||||
textureWrapModeWidth = TextureWrapMode.ClampToBorder;
|
||||
textureMinFilter = TextureMinFilter.LinearMipmapLinear;
|
||||
textureMagFilter = TextureMagFilter.Linear;
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
GenerateTexture(textureData, width, height);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using OpenTK;
|
||||
using RecrownedGTK.Graphics.Render.Shader;
|
||||
using RecrownedGTK.Graphics.Render.Shaders;
|
||||
namespace RecrownedGTK.Graphics {
|
||||
public class VertexAttributesArrayHandle : IDisposable {
|
||||
private bool disposed;
|
||||
@@ -18,7 +18,7 @@ namespace RecrownedGTK.Graphics {
|
||||
/// Creates a basic vertex attributes object handle that takes in vertices, texture coordinates, and a color.
|
||||
/// First 3 values are normalized vertex position (x, y, z), second two are texture coordinates, and last 4 are color values.
|
||||
/// </summary>
|
||||
/// <param name="shader">The shader program used. Default is the one created from <see cref="RecrownedGTK.Graphics.Render.Shader.Shader.CreateBasicShader"/>.</param>
|
||||
/// <param name="shader">The shader program used. Default is the one created from <see cref="RecrownedGTK.Graphics.Render.Shaders.Shader.CreateBasicShader"/>.</param>
|
||||
/// <param name="positionAttribName">The name of the attribute for the vertex's position in the shader. Default is "aPosition".</param>
|
||||
/// <param name="textureAttribName">The name of the attribute for the texture's coordinate. Default is "aTexture".</param>
|
||||
/// <param name="colorAttribName">The name of the attribute for color mixture. Default is "aColor".</param>
|
@@ -3,7 +3,6 @@ using OpenTK.Graphics;
|
||||
namespace RecrownedGTK.Graphics {
|
||||
public struct VertexInformation {
|
||||
public Vector3 coords;
|
||||
public uint[] indices;
|
||||
public Color4 color;
|
||||
public Vector2 textureCoords;
|
||||
}
|
Reference in New Issue
Block a user