From f0f340dec7821cee103ab9267ef941a917ef4dc4 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 18 Nov 2018 23:31:17 +0800 Subject: =?UTF-8?q?*=E7=9B=AE=E5=BD=95=E6=94=B9=E4=B8=BA=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/graphics/je_gl.h | 140 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 src/libjin/graphics/je_gl.h (limited to 'src/libjin/graphics/je_gl.h') diff --git a/src/libjin/graphics/je_gl.h b/src/libjin/graphics/je_gl.h new file mode 100644 index 0000000..134cfee --- /dev/null +++ b/src/libjin/graphics/je_gl.h @@ -0,0 +1,140 @@ +#ifndef __JE_OPENGL_H__ +#define __JE_OPENGL_H__ + +#include + +#include "../math/je_matrix.h" +#include "../math/je_transform.h" + +#include "GLee/GLee.h" +#include "ogl/OpenGL.h" + +#include "je_color.h" + +namespace JinEngine +{ + namespace Graphics + { + + /*class Canvas; + class Shader; + class Font; +*/ + class OpenGL + : public ogl2d::OpenGL + { + public: + /// + /// + /// + OpenGL(); + + void setColor(Channel r, Channel g, Channel b, Channel a); + + void setColor(Color c); + + Color getColor(); + + void clearMatrix(); + + void push(); + + void translate(float x, float y); + + void scale(float sx, float sy); + + void rotate(float r); + + void pop(); + + /// + /// + /// + Math::Matrix getModelViewMatrix(const Math::Transform& tansform); + + /// + /// Get model view matrix. + /// + Math::Matrix getModelViewMatrix(float x, float y, float sx, float sy, float r, float ox, float oy); + + /// + /// Get model view matrix. + /// + Math::Matrix getModelViewMatrix(); + + /// + /// Set orthogonal matrix. + /// + void setProjectionMatrix(float l, float r, float b, float t, float n, float f); + + /// + /// Get orthogonal matrix. + /// + const Math::Matrix& getProjectionMatrix(); + + /// + /// + /// + void useShader(); + + /// + /// + /// + void useFont(); + + /// + /// + /// + void useCanvas(); + + /// + /// + /// + void unUseShader(); + + private: + + /// + /// + /// + std::vector mModelViewMatrices; + + /// + /// + /// + Math::Matrix mModelViewMatrix; + + /// + /// + /// + Math::Matrix mProjectionMatrix; + + /// + /// + /// + Color mCurrentColor; +/* + /// + /// + /// + Canvas* mCurrentCanvas; + + /// + /// + /// + Shader* mCurrentShader; + + /// + /// + /// + Font* mCurrentFont; +*/ + }; + + // Singleton. + extern OpenGL gl; + + } // namespace Graphics +} // namespace JinEngine + +#endif // __JE_OPENGL_H__ \ No newline at end of file -- cgit v1.1-26-g67d0