Finished an untested version of RectTextures.cs.
This commit is contained in:
parent
848017edc2
commit
72a8cc9206
64
RecrownedGTK/Graphics/RectTexture.cs
Normal file
64
RecrownedGTK/Graphics/RectTexture.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using RecrownedGTK.Types;
|
||||
using OpenTK.Graphics;
|
||||
namespace RecrownedGTK.Graphics {
|
||||
public class RectTexture : Rectangle, IDrawable {
|
||||
private VertexInformation[] vertices;
|
||||
private TextureData textureData;
|
||||
public Color4 Color {
|
||||
get {
|
||||
return vertices[0].color;
|
||||
}
|
||||
set {
|
||||
for (int vert = 0; vert < vertices.Length; vert++) {
|
||||
vertices[vert].color = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override float Width {
|
||||
get {
|
||||
return vertices[1].coords.X - vertices[0].coords.X;
|
||||
}
|
||||
set {
|
||||
vertices[1].coords.X = vertices[0].coords.X + value;
|
||||
vertices[2].coords.X = vertices[3].coords.X + value;
|
||||
}
|
||||
}
|
||||
public override float Height {
|
||||
set {
|
||||
vertices[3].coords.Y = vertices[0].coords.Y + value;
|
||||
vertices[2].coords.Y = vertices[1].coords.Y + value;
|
||||
}
|
||||
|
||||
get {
|
||||
return vertices[3].coords.Y - vertices[0].coords.Y;
|
||||
}
|
||||
}
|
||||
public override float X {
|
||||
set {
|
||||
float width = Width;
|
||||
vertices[0].coords.X = value;
|
||||
Width = width;
|
||||
}
|
||||
get {
|
||||
return vertices[0].coords.X;
|
||||
}
|
||||
}
|
||||
public override float Y {
|
||||
set {
|
||||
float height = Height;
|
||||
vertices[0].coords.Y = value;
|
||||
Height = height;
|
||||
}
|
||||
get {
|
||||
return vertices[0].coords.Y;
|
||||
}
|
||||
}
|
||||
public RectTexture(TextureData textureData) {
|
||||
this.textureData = textureData;
|
||||
}
|
||||
public void Draw(out VertexInformation[] vertices, out TextureData textureData) {
|
||||
vertices = this.vertices;
|
||||
textureData = this.textureData;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace RecrownedGTK.Graphics {
|
||||
public class Texture : IDrawable {
|
||||
public Texture() {
|
||||
|
||||
}
|
||||
public void Draw(out VertexInformation[] vertices, out TextureData textureData) {
|
||||
throw new System.NotImplementedException();
|
||||
//TODO: Implement this.
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
namespace RecrownedGTK.Graphics {
|
||||
public struct VertexInformation {
|
||||
public Vector3 vertexCoords;
|
||||
public Vector3 coords;
|
||||
public uint[] indices;
|
||||
public Color4 color;
|
||||
public Vector2 textureCoords;
|
||||
|
Loading…
x
Reference in New Issue
Block a user