Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-09-22 13:11:40 +0300
committerMike Erwin <significant.bit@gmail.com>2016-09-22 13:11:40 +0300
commit0e7c3dfe75cb16158eb5df0520f32b7b7f0921f0 (patch)
tree2ac960ef8dddc358b79fc9dbdaddd683c317e4b8 /source/blender/gpu/GPU_matrix.h
parent825150605e36547a6216228deabf79153ae2ae00 (diff)
OpenGL: matrix code from viewport-fx
Bringing over whole files from rB194998766c65
Diffstat (limited to 'source/blender/gpu/GPU_matrix.h')
-rw-r--r--source/blender/gpu/GPU_matrix.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
new file mode 100644
index 00000000000..9d61084af30
--- /dev/null
+++ b/source/blender/gpu/GPU_matrix.h
@@ -0,0 +1,106 @@
+#ifndef _GPU_MATRIX_H_
+#define _GPU_MATRIX_H_
+
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Alexandr Kuznetsov, Jason Wilkins
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file source/blender/gpu/GPU_matrix.h
+ * \ingroup gpu
+ */
+
+#include "GPU_glew.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum eGPUMatrixMode {
+ GPU_MODELVIEW_MATRIX = 0,
+ GPU_PROJECTION_MATRIX = 1,
+ GPU_TEXTURE_MATRIX = 2
+} eGPUMatrixMode;
+
+void gpuPushMatrix(eGPUMatrixMode stack);
+void gpuPopMatrix(eGPUMatrixMode stack);
+
+void gpuLoadMatrix(eGPUMatrixMode stack, const float m[16]);
+void gpuLoadMatrixd(eGPUMatrixMode stack, const double m[16]);
+const float *gpuGetMatrix(eGPUMatrixMode stack, float m[16]);
+void gpuGetMatrixd(eGPUMatrixMode stack, double m[16]);
+
+void gpuLoadIdentity(eGPUMatrixMode stack);
+
+void gpuMultMatrix(eGPUMatrixMode stack, const float m[16]);
+void gpuMultMatrixd(eGPUMatrixMode stack, const double m[16]);
+
+void gpuTranslate(eGPUMatrixMode stack, float x, float y, float z);
+void gpuScale(eGPUMatrixMode stack, GLfloat x, GLfloat y, GLfloat z);
+void gpuRotateVector(eGPUMatrixMode stack, GLfloat deg, GLfloat vector[3]);
+void gpuRotateAxis(eGPUMatrixMode stack, GLfloat deg, char axis);
+void gpuRotateRight(eGPUMatrixMode stack, char type);
+
+void gpuOrtho(eGPUMatrixMode stack, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
+void gpuFrustum(eGPUMatrixMode stack, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
+
+void gpuLoadOrtho(eGPUMatrixMode stack, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
+void gpuLoadFrustum(eGPUMatrixMode stack, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
+
+void gpuLookAt(eGPUMatrixMode stack, GLfloat eyeX, GLfloat eyeY, GLfloat eyeZ, GLfloat centerX, GLfloat centerY, GLfloat centerZ, GLfloat upX, GLfloat upY, GLfloat upZ);
+
+void gpuProject(const GLfloat obj[3], const GLfloat model[16], const GLfloat proj[16], const GLint view[4], GLfloat win[3]);
+GLboolean gpuUnProject(const GLfloat win[3], const GLfloat model[16], const GLfloat proj[16], const GLint view[4], GLfloat obj[3]);
+
+void gpu_commit_matrix(void);
+
+void GPU_feedback_vertex_3fv(GLenum type, GLfloat x, GLfloat y, GLfloat z, GLfloat out[3]);
+void GPU_feedback_vertex_4fv(GLenum type, GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat out[4]);
+void GPU_feedback_vertex_4dv(GLenum type, GLdouble x, GLdouble y, GLdouble z, GLdouble w, GLdouble out[4]);
+
+#if defined(GLEW_ES_ONLY)
+
+/* ES 2.0 doesn't define these symbolic constants, but the matrix stack replacement library emulates them
+ * (GL core has deprecated matrix stacks, but it should still be in the header) */
+
+#ifndef GL_MODELVIEW_MATRIX
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#endif
+
+#ifndef GL_PROJECTION_MATRIX
+#define GL_PROJECTION_MATRIX 0x0BA7
+#endif
+
+#ifndef GL_TEXTURE_MATRIX
+#define GL_TEXTURE_MATRIX 0x0BA8
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GPU_MATRIX_H */