From 8b00d67febf133e89f6a0bfabc41feed555dc4a9 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 12 Jan 2019 21:48:33 +0800 Subject: =?UTF-8?q?*=E5=8E=BB=E6=8E=89=E6=96=87=E4=BB=B6=E5=89=8D=E7=BC=80?= =?UTF-8?q?je=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/graphics/je_gl.h | 270 -------------------------------------------- 1 file changed, 270 deletions(-) delete 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 deleted file mode 100644 index 6f88ba1..0000000 --- a/src/libjin/graphics/je_gl.h +++ /dev/null @@ -1,270 +0,0 @@ -#ifndef __JE_OPENGL_H__ -#define __JE_OPENGL_H__ - -#include - -#include "../math/je_matrix.h" -#include "../math/je_transform.h" - -//#include "GLee/GLee.h" -#include "glad/glad.h" - -#include "je_color.h" - -namespace JinEngine -{ - namespace Graphics - { - // Wrap OpenGL API. - - namespace Shaders { class Shader; }; - namespace Fonts { class Font; }; - - class Texture; - - class Canvas; - - class OpenGL - { - public: - /// - /// Blend mode. - /// https://www.andersriggelsen.dk/glblendfunc.php - /// - enum class BlendMode - { - ALPHA = 1, - ADDITIVE = 2, - PREMULTIPLIEDALPHA = 3, - }; - - struct Stats - { - int drawCalls; - //int drawCallsBatched; - int canvasSwitches; - int shaderSwitches; - int fontSwitches; - int textures; - int canvases; - int fonts; - //int64 textureMemory; - }; - - static Canvas* const SCREEN; - - OpenGL(); - ~OpenGL(); - - bool initContext(); - - void init(); - - void enable(GLenum cap); - - void disable(GLenum cap); - - void setClearColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a); - - void pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255); - - void popColor(); - - void flushError(); - - GLuint genTexture(); - - void deleteTexture(GLuint texture); - - void bindTexture2D(GLuint texture = 0); - - void setTexParameter(GLenum pname, GLint param); - - void texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels = NULL); - - void texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); - - void activeTextureUnit(unsigned int unit = 0); - - void drawArrays(GLenum mode, GLint first, GLsizei count); - - void drawBuffer(GLenum mode); - - void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); - - void enableClientState(GLenum arr); - - void disableClientState(GLenum arr); - - GLuint genFrameBuffer(); - - void bindFrameBuffer(GLuint fbo); - - void ortho(int w, float radio); - - void orthox(int w, int h); - - void setColor(Channel r, Channel g, Channel b, Channel a); - - void setColor(Color c); - - Color getColor(); - - void clearMatrix(); - - void pushMatrix(); - - void translate(float x, float y); - - void scale(float sx, float sy); - - void rotate(float r); - - void popMatrix(); - - /// - /// - /// - 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(Shaders::Shader* shader); - - /// - /// - /// - void unuseShader(); - - /// - /// - /// - Shaders::Shader* getShader(); - - /// - /// - /// - void setFont(Fonts::Font* font); - - /// - /// - /// - void unsetFont(); - - /// - /// - /// - Fonts::Font* getFont(); - - /// - /// - /// - void bindCanvas(Canvas* canvas); - - /// - /// - /// - void unbindCanvas(); - - /// - /// - /// - Canvas* getCanvas(); - - /// - /// - /// - void setBlendMode(BlendMode mode); - - /// - /// - /// - BlendMode getBlendMode(); - - /// - /// - /// - void resetStats(); - - /// - /// - /// - Stats& getStats(); - - private: - - /// - /// - /// - std::vector mModelViewMatrices; - - /// - /// - /// - Math::Matrix mModelViewMatrix; - - /// - /// - /// - Math::Matrix mProjectionMatrix; - - /// - /// - /// - BlendMode mBlendMode; - - /// - /// - /// - Color mColor; - - /// - /// - /// - Canvas* mCanvas; - - /// - /// - /// - Shaders::Shader* mShader; - - /// - /// - /// - Fonts::Font* mFont; - - /// - /// - /// - Stats mStats; - - }; - - // Singleton. - extern OpenGL gl; - - } // namespace Graphics -} // namespace JinEngine - -#endif // __JE_OPENGL_H__ \ No newline at end of file -- cgit v1.1-26-g67d0