[Bf-blender-cvs] [a28a1f1] master: GL-utils: Add vector transform functions

Julian Eisel noreply at git.blender.org
Sun Sep 20 18:12:10 CEST 2015


Commit: a28a1f11d6fa533b9b12fba28a79bb1df74e218b
Author: Julian Eisel
Date:   Sun Sep 20 17:21:06 2015 +0200
Branches: master
https://developer.blender.org/rBa28a1f11d6fa533b9b12fba28a79bb1df74e218b

GL-utils: Add vector transform functions

Might also be useful to have _neg versions of these (done quite often),
but decided to keep it simple for now.

===================================================================

M	source/blender/editors/include/BIF_gl.h

===================================================================

diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 49c808e..e2a24b9 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -34,6 +34,7 @@
 #define __BIF_GL_H__
 
 #include "GPU_glew.h"
+#include "BLI_utildefines.h"
 
 /*
  * these should be phased out. cpack should be replaced in
@@ -85,5 +86,20 @@ void cpack(unsigned int x);
 
 #define GLA_PIXEL_OFS 0.375f
 
+
+BLI_INLINE void glTranslate3fv(const float vec[3])  { glTranslatef(UNPACK3(vec));       }
+BLI_INLINE void glTranslate2fv(const float vec[2])  { glTranslatef(UNPACK2(vec), 0.0f); }
+BLI_INLINE void glTranslate3dv(const double vec[3]) { glTranslated(UNPACK3(vec));       }
+BLI_INLINE void glTranslate2dv(const double vec[2]) { glTranslated(UNPACK2(vec), 0.0f); }
+
+BLI_INLINE void glScale3fv(const float vec[3])  { glScalef(UNPACK3(vec));      }
+BLI_INLINE void glScale2fv(const float vec[2])  { glScalef(UNPACK2(vec), 0.0); }
+BLI_INLINE void glScale3dv(const double vec[3]) { glScaled(UNPACK3(vec));      }
+BLI_INLINE void glScale2dv(const double vec[2]) { glScaled(UNPACK2(vec), 0.0); }
+
+/* v2 versions don't make much sense for rotation */
+BLI_INLINE void glRotate3fv(const float angle, const float vec[3])   { glRotatef(angle, UNPACK3(vec)); }
+BLI_INLINE void glRotate3dv(const double angle, const double vec[3]) { glRotated(angle, UNPACK3(vec)); }
+
 #endif /* #ifdef __BIF_GL_H__ */




More information about the Bf-blender-cvs mailing list