aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/graphics')
-rw-r--r--src/libjin/graphics/je_graphic.h4
-rw-r--r--src/libjin/graphics/je_mesh.cpp18
-rw-r--r--src/libjin/graphics/je_vertex.h8
-rw-r--r--src/libjin/graphics/je_window.h4
4 files changed, 18 insertions, 16 deletions
diff --git a/src/libjin/graphics/je_graphic.h b/src/libjin/graphics/je_graphic.h
index f47adbf..92c7c46 100644
--- a/src/libjin/graphics/je_graphic.h
+++ b/src/libjin/graphics/je_graphic.h
@@ -42,12 +42,12 @@ namespace JinEngine
///
///
///
- inline int getWidth() const { return mSize.w; }
+ inline int getWidth() const { return mSize.w(); }
///
///
///
- inline int getHeight() const { return mSize.h; }
+ inline int getHeight() const { return mSize.h(); }
///
/// Get opengl texture token.
diff --git a/src/libjin/graphics/je_mesh.cpp b/src/libjin/graphics/je_mesh.cpp
index 4c27433..b96a4ff 100644
--- a/src/libjin/graphics/je_mesh.cpp
+++ b/src/libjin/graphics/je_mesh.cpp
@@ -24,8 +24,8 @@ namespace JinEngine
void Mesh::pushVertex(float x, float y, float u, float v, Color color)
{
Vertex vert;
- vert.x = x; vert.y = y;
- vert.u = u; vert.v = v;
+ vert.xy.x = x; vert.xy.y = y;
+ vert.uv.u = u; vert.uv.v = v;
vert.color = color;
pushVertex(vert);
}
@@ -37,14 +37,14 @@ namespace JinEngine
if (mVertices.size() == 2)
{
const Vertex& v0 = mVertices[0];
- mBound.l = min(v0.x, vert.x);
- mBound.r = max(v0.x, vert.x);
- mBound.t = min(v0.y, vert.y);
- mBound.b = max(v0.y, vert.y);
+ mBound.l = min(v0.xy.x, vert.xy.x);
+ mBound.r = max(v0.xy.x, vert.xy.x);
+ mBound.t = min(v0.xy.y, vert.xy.y);
+ mBound.b = max(v0.xy.y, vert.xy.y);
}
else
{
- float x = vert.x, y = vert.y;
+ float x = vert.xy.x, y = vert.xy.y;
mBound.l = x < mBound.l ? x : mBound.l;
mBound.r = x > mBound.r ? x : mBound.r;
mBound.t = y < mBound.t ? y : mBound.t;
@@ -63,8 +63,8 @@ namespace JinEngine
shader->sendMatrix4(SHADER_MODELVIEW_MATRIX, &modelViewMatrix);
shader->sendMatrix4(SHADER_PROJECTION_MATRIX, &gl.getProjectionMatrix());
shader->beginUploadAttributes();
- shader->uploadVertices(2, GL_FLOAT, sizeof(Vertex), &(mVertices[0].x));
- shader->uploadUV(2, GL_FLOAT, sizeof(Vertex), &(mVertices[0].u));
+ shader->uploadVertices(2, GL_FLOAT, sizeof(Vertex), &(mVertices[0].xy));
+ shader->uploadUV(2, GL_FLOAT, sizeof(Vertex), &(mVertices[0].uv));
shader->uploadColor(4, GL_UNSIGNED_BYTE, sizeof(Vertex), &(mVertices[0].color), GL_TRUE);
shader->endUploadAttributes();
diff --git a/src/libjin/graphics/je_vertex.h b/src/libjin/graphics/je_vertex.h
index d149cfc..d2b482c 100644
--- a/src/libjin/graphics/je_vertex.h
+++ b/src/libjin/graphics/je_vertex.h
@@ -1,6 +1,8 @@
#ifndef __JE_MATH_VERTEX_H__
#define __JE_MATH_VERTEX_H__
+#include "../math/je_vector2.hpp"
+
#include "je_color.h"
namespace JinEngine
@@ -10,9 +12,9 @@ namespace JinEngine
struct Vertex
{
- float x, y; // Coordinates
- float u, v; // UV
- Color color; // Color
+ Math::Vector2<float> xy;
+ Math::Vector2<float> uv;
+ Color color;
};
}
diff --git a/src/libjin/graphics/je_window.h b/src/libjin/graphics/je_window.h
index 902e873..387395e 100644
--- a/src/libjin/graphics/je_window.h
+++ b/src/libjin/graphics/je_window.h
@@ -53,12 +53,12 @@ namespace JinEngine
///
///
///
- inline int getW(){ return mSize.w; }
+ inline int getW(){ return mSize.w(); }
///
///
///
- inline int getH(){ return mSize.h; }
+ inline int getH(){ return mSize.h(); }
///
///