From 0056e468d9c3291443d87bfc05441e375a315433 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 08:15:30 +0800 Subject: =?UTF-8?q?*=E6=9B=B4=E6=96=B0gl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Graphics/je_gl.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/libjin/Graphics/je_gl.cpp') diff --git a/src/libjin/Graphics/je_gl.cpp b/src/libjin/Graphics/je_gl.cpp index 3f19d36..a559c07 100644 --- a/src/libjin/Graphics/je_gl.cpp +++ b/src/libjin/Graphics/je_gl.cpp @@ -15,7 +15,7 @@ namespace JinEngine : ogl2d::OpenGL() { mMatrices.push_back(Matrix()); - calcMatrix(); + solve(); } void OpenGL::setColor(Channel r, Channel g, Channel b, Channel a) @@ -51,10 +51,10 @@ namespace JinEngine if (mMatrices.size() == 1) return; mMatrices.pop_back(); - calcMatrix(); + solve(); } - void OpenGL::calcMatrix() + void OpenGL::solve() { mMatrix.setIdentity(); for (Matrix& m : mMatrices) @@ -88,5 +88,17 @@ namespace JinEngine mMatrix.rotate(r); } + Matrix OpenGL::getModelMatrix(float x, float y, float sx, float sy, float r, float ox, float oy) + { + Matrix m; + m.setTransformation(x, y, sx, sy, r, ox, oy); + return mMatrix*m; + } + + Math::Matrix OpenGL::getModelMatrix() + { + return mMatrix; + } + } // namespace Graphics -} // namespace JinEngine +} // namespace JinEngine \ No newline at end of file -- cgit v1.1-26-g67d0