From a783cffdfae21e5d491388cb6ade0bd815f1d99b Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 4 Feb 2019 15:34:29 +0000 Subject: [PATCH] GLDraw: GLCode::Mat4 git-svn-id: svn://ultimatepp.org/upp/trunk@12742 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/GLDraw/Code.cpp | 12 +++++++++++- uppsrc/GLDraw/GLPainter.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/uppsrc/GLDraw/Code.cpp b/uppsrc/GLDraw/Code.cpp index 3116bd4fc..32540e2f2 100644 --- a/uppsrc/GLDraw/Code.cpp +++ b/uppsrc/GLDraw/Code.cpp @@ -114,7 +114,6 @@ GLCode& GLCode::Uniform(const char *id, double a, double b, double c, double d) return *this; } - GLCode& GLCode::operator()(const char *id, Color c, double alpha) { return Uniform(GetUniform(id), c, alpha); @@ -125,4 +124,15 @@ GLCode& GLCode::operator()(int i, Color c, double alpha) return Uniform(i, c.GetR() / 255.0f, c.GetG() / 255.0f, c.GetB() / 255.0f, alpha); } +GLCode& GLCode::Mat4(int i, float *mat4) +{ + glUniformMatrix4fv(i, 1, GL_FALSE, mat4); + return *this; +} + +GLCode& GLCode::Mat4(const char *id, float *mat4) +{ + return Mat4(GetUniform(id), mat4); +} + }; diff --git a/uppsrc/GLDraw/GLPainter.h b/uppsrc/GLDraw/GLPainter.h index 39bf24791..a627baebc 100644 --- a/uppsrc/GLDraw/GLPainter.h +++ b/uppsrc/GLDraw/GLPainter.h @@ -58,6 +58,9 @@ struct GLCode : GLProgram { GLCode& operator()(int i, Sizef sz) { return Uniform(i, sz.cx, sz.cy); } GLCode& operator()(const char *id, Color c, double alpha = 1); GLCode& operator()(int i, Color c, double alpha = 1); + + GLCode& Mat4(int i, float *mat4); + GLCode& Mat4(const char *id, float *mat4); }; class GLTexture {