Oolite
Loading...
Searching...
No Matches
OOOpenGLMatrixManager.h
Go to the documentation of this file.
1/*
2
3OOOpenGLMatrixManager.h
4
5Manages OpenGL Model, View, etc. matrices.
6
7Oolite
8Copyright (C) 2004-2014 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "OOMaths.h"
28
29extern const char* ooliteStandardMatrixUniforms[];
30
31enum {
46};
47
48@interface OOOpenGLMatrixStack : NSObject {
49@private
50 NSMutableArray* stack;
51}
52
53- (id)init;
54- (void)dealloc;
55- (void)push:(OOMatrix)matrix;
56- (OOMatrix)pop;
57- (NSUInteger)stackCount;
58
59@end
60
61@interface OOOpenGLMatrixManager : NSObject {
62@private
63 OOMatrix matrices[OOLITE_GL_MATRIX_END];
64 BOOL valid[OOLITE_GL_MATRIX_END];
67}
68
69- (id)init;
70- (void)dealloc;
71- (void)loadModelView:(OOMatrix)matrix;
72- (void)resetModelView;
73- (void)multModelView:(OOMatrix)matrix;
74- (void)translateModelView:(Vector)vector;
75- (void)rotateModelView:(GLfloat)angle axis:(Vector)axis;
76- (void)scaleModelView:(Vector)scale;
77- (void)lookAtWithEye:(Vector)eye center:(Vector)center up:(Vector)up;
78- (void)pushModelView;
79- (OOMatrix)popModelView;
80- (OOMatrix)getModelView;
81- (NSUInteger)countModelView;
82- (void)syncModelView;
83- (void)loadProjection:(OOMatrix)matrix;
84- (void)multProjection:(OOMatrix)matrix;
85- (void)translateProjection:(Vector)vector;
86- (void)rotateProjection:(GLfloat)angle axis:(Vector)axis;
87- (void)scaleProjection:(Vector)scale;
88- (void)frustumLeft:(double)l right:(double)r bottom:(double)b top:(double)t near:(double)n far:(double)f;
89- (void)orthoLeft:(double)l right:(double)r bottom:(double)b top:(double)t near:(double)n far:(double)f;
90- (void)perspectiveFovy:(double)fovy aspect:(double)aspect zNear:(double)zNear zFar:(double)zFar;
91- (void)resetProjection;
92- (void)pushProjection;
93- (OOMatrix)popProjection;
94- (OOMatrix)getProjection;
95- (void)syncProjection;
96- (OOMatrix)getMatrix:(int)which;
97- (NSArray*)standardMatrixUniformLocations:(GLhandleARB)program;
98
99@end
100
101void OOGLPushModelView(void);
104void OOGLResetModelView(void);
105void OOGLLoadModelView(OOMatrix matrix);
106void OOGLMultModelView(OOMatrix matrix);
107void OOGLTranslateModelView(Vector vector);
108void OOGLRotateModelView(GLfloat angle, Vector axis);
109void OOGLScaleModelView(Vector scale);
110void OOGLLookAt(Vector eye, Vector center, Vector up);
111
112void OOGLResetProjection(void);
113void OOGLPushProjection(void);
116void OOGLLoadProjection(OOMatrix matrix);
117void OOGLMultProjection(OOMatrix matrix);
119void OOGLRotateProjection(GLfloat angle, Vector axis);
120void OOGLScaleProjection(Vector scale);
121void OOGLFrustum(double left, double right, double bottom, double top, double near, double far);
122void OOGLOrtho(double left, double right, double bottom, double top, double near, double far);
123void OOGLPerspective(double fovy, double aspect, double zNear, double zFar);
124
void OOGLLoadModelView(OOMatrix matrix)
void OOGLRotateProjection(GLfloat angle, Vector axis)
void OOGLTranslateProjection(Vector vector)
void OOGLRotateModelView(GLfloat angle, Vector axis)
void OOGLLookAt(Vector eye, Vector center, Vector up)
void OOGLLoadProjection(OOMatrix matrix)
void OOGLScaleProjection(Vector scale)
OOMatrix OOGLGetModelView(void)
void OOGLScaleModelView(Vector scale)
void OOGLPushModelView(void)
void OOGLPushProjection(void)
void OOGLResetModelView(void)
void OOGLTranslateModelView(Vector vector)
void OOGLMultProjection(OOMatrix matrix)
OOMatrix OOGLGetProjection(void)
void OOGLFrustum(double left, double right, double bottom, double top, double near, double far)
void OOGLPerspective(double fovy, double aspect, double zNear, double zFar)
void OOGLMultModelView(OOMatrix matrix)
OOMatrix OOGLGetModelViewProjection(void)
OOMatrix OOGLPopModelView(void)
void OOGLResetProjection(void)
void OOGLOrtho(double left, double right, double bottom, double top, double near, double far)
@ OOLITE_GL_MATRIX_MODELVIEW
@ OOLITE_GL_MATRIX_MODELVIEW_PROJECTION
@ OOLITE_GL_MATRIX_MODELVIEW_INVERSE
@ OOLITE_GL_MATRIX_MODELVIEW_INVERSE_TRANSPOSE
@ OOLITE_GL_MATRIX_PROJECTION
@ OOLITE_GL_MATRIX_PROJECTION_TRANSPOSE
@ OOLITE_GL_MATRIX_PROJECTION_INVERSE
@ OOLITE_GL_MATRIX_PROJECTION_INVERSE_TRANSPOSE
@ OOLITE_GL_MATRIX_MODELVIEW_PROJECTION_INVERSE_TRANSPOSE
@ OOLITE_GL_MATRIX_NORMAL
@ OOLITE_GL_MATRIX_END
@ OOLITE_GL_MATRIX_MODELVIEW_PROJECTION_TRANSPOSE
@ OOLITE_GL_MATRIX_MODELVIEW_PROJECTION_INVERSE
@ OOLITE_GL_MATRIX_MODELVIEW_TRANSPOSE
const char * ooliteStandardMatrixUniforms[]
OOMatrix OOGLPopProjection(void)
OOMatrix matrices[OOLITE_GL_MATRIX_END]
OOOpenGLMatrixStack * projectionStack
OOOpenGLMatrixStack * modelViewStack
BOOL valid[OOLITE_GL_MATRIX_END]