Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Hardware/Video/OpenGL/Headers/glResources.h

Diff revisions: vs.
  @@ -23,9 +23,11 @@
23 23 #ifndef _GL_RESOURCES_H_
24 24 #define _GL_RESOURCES_H_
25 25
26 + #include "config.h"
27 +
26 28 enum MATRIX_MODE;
27 29 enum EXTENDED_MATRIX;
28 - #if defined( __WIN32__ ) || defined( _WIN32 )
30 + #if defined( OS_WINDOWS )
29 31 # ifndef WIN32_LEAN_AND_MEAN
30 32 # define WIN32_LEAN_AND_MEAN
31 33 # endif
  @@ -38,11 +40,11 @@
38 40 # endif
39 41 //////////////////////////////////////////////////////////////////////
40 42 ////////////////////////////////////Needed Linux Headers//////////////
41 - #elif defined OIS_LINUX_PLATFORM
43 + #elif defined OS_LINUX
42 44 # include <X11/Xlib.h>
43 45 //////////////////////////////////////////////////////////////////////
44 46 ////////////////////////////////////Needed Mac Headers//////////////
45 - #elif defined OIS_APPLE_PLATFORM
47 + #elif defined OS_APPLE
46 48 # include <Carbon/Carbon.h>
47 49 #endif
48 50
  @@ -54,7 +56,7 @@
54 56 #define GLEW_MX
55 57 #endif
56 58 #include <glew.h>
57 - #if defined(_WIN32)
59 + #if defined( OS_WINDOWS )
58 60 #include <wglew.h>
59 61 #else
60 62 #include <glxew.h>
  @@ -66,6 +68,7 @@
66 68 #include <glm.hpp>
67 69 #include <GL/glfw3.h>
68 70 #include "Utility/Headers/Vector.h"
71 + #include "Hardware/Platform/Headers/PlatformDefines.h"
69 72 #include <CEGUI/RendererModules/OpenGL/GL3Renderer.h>
70 73 #include <boost/thread/tss.hpp>
71 74
  @@ -226,9 +229,12 @@
226 229
227 230 template<class T> class mat4;
228 231 template<class T> class mat3;
232 + template<class T> class vec3;
233 + template<class T> class vec4;
229 234
230 235 namespace Divide {
231 236 namespace GL {
237 +
232 238 ///State the various attribute locations to use in GLSL with VAO/VBO's
233 239 enum {
234 240 VERTEX_POSITION_LOCATION = 0,
  @@ -239,28 +245,55 @@
239 245 VERTEX_BONE_WEIGHT_LOCATION = 5,
240 246 VERTEX_BONE_INDICE_LOCATION = 6
241 247 };
248 +
249 + /*----------- GLU overrides ------*/
250 + typedef std::stack<glm::mat4, vectorImpl<glm::mat4 > > matrixStack;
251 + typedef std::stack<vec3<F32>, vectorImpl<vec3<F32> > > vector3Stack;
252 + typedef std::stack<vec4<U32>, vectorImpl<vec4<U32> > > viewportStack;
242 253
254 + /*--------- Object Management-------*/
255 + extern GLuint _invalidObjectID;
243 256 /*--------- Context Management -----*/
244 257 extern bool _applicationClosing;
245 258 extern bool _contextAvailable;
246 259 extern bool _useDebugOutputCallback;
247 -
260 +
248 261 ///Main rendering window
249 262 extern GLFWwindow* _mainWindow;
250 263 ///Background thread for loading resources
251 264 extern GLFWwindow* _loaderWindow;
252 -
253 - /*----------- GLU overrides ------*/
254 - typedef std::stack<glm::mat4, vectorImpl<glm::mat4 > > matrixStack;
255 - typedef std::stack<glm::vec3, vectorImpl<glm::vec3 > > vector3Stack;
265 + ///Matrix management
266 + ///Current active matrix for push/pop operations: PROJECTION/VIEW/TEXTURE
267 + extern MATRIX_MODE _currentMatrixMode;
268 + ///Current view matrix. Changed only by LookAt call
269 + extern matrixStack _viewMatrix;
270 + ///Current projection matrix. Changed by Perspective and Ortho calls
271 + extern matrixStack _projectionMatrix;
272 + ///Current texture matrix. Multiply and change manually if needed
273 + extern matrixStack _textureMatrix;
274 + ///Current viewpoert stack
275 + extern viewportStack _viewport;
276 + ///The current model matrix. Change per model or set to identity
277 + extern glm::mat4 _modelMatrix;
278 + ///A bias matrix is useful for shadow calculations
279 + extern glm::mat4 _biasMatrix;
280 + ///A cache value for anaglyph eye offset
281 + extern GLfloat _anaglyphIOD;
282 + ///current camera view direction
283 + extern vector3Stack _currentViewDirection;
284 + ///If the model matrix had a uniform scale applied or not
285 + extern bool _isUniformScaled;
286 + ///Use for lazy reset of the model matrix
287 + extern bool _resetModelMatrixFlag;
256 288
257 289 void _initStacks();
258 290 /*-----------------BEGIN: FIXED PIPELINE EMULATION -----------------------*/
259 - void _matrixMode(const MATRIX_MODE& mode);
291 + inline void _matrixMode(const MATRIX_MODE& mode) { _currentMatrixMode = mode; }
260 292
261 - void _LookAt(const glm::vec3& eye,const glm::vec3& lookAt,const glm::vec3& up, bool invertx, bool inverty);
293 + void _LookAt(const GLfloat* viewMatrix, const vec3<F32>& viewDirection);
262 294 void _ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
263 295 void _perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
296 + void _anaglyph(GLfloat IOD, GLdouble zNear, GLdouble zFar, GLfloat aspect, GLfloat fovy, bool rightFrustum = false);
264 297 void _pushMatrix();
265 298 void _popMatrix();
266 299 void _loadIdentity();
  @@ -298,10 +331,10 @@
298 331 extern glm::mat4 _modelMatrix;
299 332 ///A bias matrix is useful for shadow calculations
300 333 extern glm::mat4 _biasMatrix;
301 - ///current View_Matrix eye vector
302 - extern vector3Stack _currentEyeVector;
303 - ///current View_Matrix look-at vector
304 - extern vector3Stack _currentLookAtVector;
334 + ///A cache value for anaglyph eye offset
335 + extern GLfloat _anaglyphIOD;
336 + ///current camera view direction
337 + extern vector3Stack _currentViewDirection;
305 338 ///If the model matrix had a uniform scale applied or not
306 339 extern bool _isUniformScaled;
307 340 ///Use for lazy reset of the model matrix
  @@ -311,11 +344,11 @@
311 344
312 345 #ifdef GLEW_MX
313 346 GLEWContext* glewGetContext();
314 - # if defined(_WIN32)
347 + # if defined( OS_WINDOWS )
315 348 WGLEWContext* wglewGetContext();
316 - # else//_WIN32
349 + # else
317 350 GLXEWContext* glxewGetContext();
318 - # endif//_WIN32
351 + # endif
319 352 #endif//GLEW_MX
320 353
321 354 #if defined(_MSC_VER)