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/GLWrapper.h

Diff revisions: vs.
  @@ -75,12 +75,15 @@
75 75 void initDevice(GLuint targetFrameRate);
76 76 inline void changeResolution(GLushort w, GLushort h) {changeResolutionInternal(w,h);}
77 77 ///Change the window's position
78 - void setWindowPos(U16 w, U16 h);
79 - void lookAt(const vec3<GLfloat>& eye,
80 - const vec3<GLfloat>& center,
81 - const vec3<GLfloat>& up = vec3<GLfloat>(0,1,0),
82 - const bool invertx = false,
83 - const bool inverty = false);
78 + void setWindowPos(U16 w, U16 h) const;
79 + void setMousePosition(D32 x, D32 y) const;
80 +
81 + void lookAt(const vec3<F32>& eye, const vec3<F32>& target, const vec3<F32>& up);
82 +
83 + inline void lookAt(const mat4<F32>& viewMatrix, const vec3<F32>& viewDirection) {
84 + Divide::GL::_LookAt(viewMatrix.mat, viewDirection);
85 + }
86 +
84 87 void beginFrame();
85 88 void endFrame();
86 89 void idle();
  @@ -107,6 +110,8 @@
107 110
108 111 void setOrthoProjection(const vec4<GLfloat>& rect, const vec2<GLfloat>& planes);
109 112 void setPerspectiveProjection(GLfloat FoV,GLfloat aspectRatio, const vec2<GLfloat>& planes);
113 + void setAnaglyphFrustum(F32 camIOD, bool rightFrustum = false);
114 + void updateClipPlanes();
110 115
111 116 void toggle2D(bool state);
112 117
  @@ -125,7 +130,7 @@
125 130 IMPrimitive* createPrimitive(bool allowPrimitiveRecycle = true);
126 131 /*immediate mode emmlation end*/
127 132
128 - void renderInViewport(const vec4<GLint>& rect, boost::function0<GLvoid> callback);
133 + void renderInViewport(const vec4<GLuint>& rect, boost::function0<GLvoid> callback);
129 134
130 135 void renderInstance(RenderInstance* const instance);
131 136 void renderBuffer(VertexBufferObject* const vbo, Transform* const vboTransform = NULL);
  @@ -139,28 +144,32 @@
139 144
140 145 bool loadInContext(const CurrentContext& context, boost::function0<GLvoid> callback);
141 146
142 - inline static GLuint getActiveTextureUnit() {return _activeTextureUnit;}
143 - inline static GLuint getActiveVAOId() {return _activeVAOId;}
144 -
145 147 protected:
146 148 friend class glVertexArrayObject;
147 149 inline static glShaderProgram* getActiveProgram() {return _activeShaderProgram;}
150 + inline static GLuint getActiveVAOId() {return _activeVAOId;}
148 151
149 152 protected:
150 153 friend class glFrameBufferObject;
151 154 friend class glDeferredBufferObject;
152 155 static void restoreViewport();
153 - static void setViewport(GLint x, GLint y, GLint width, GLint height,bool force = false);
156 + static vec4<U32> setViewport(const vec4<U32>& viewport ,bool force = false);
154 157 static void clearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a, bool force = false);
155 - inline static void clearColor(const vec4<F32>& color,bool force = false) {clearColor(color.r,color.g,color.b,color.a,force);}
156 -
158 + inline static void clearColor(const vec4<F32>& color,bool force = false) {
159 + clearColor(color.r,color.g,color.b,color.a,force);
160 + }
157 161 protected:
158 162 friend class glShader;
159 163 friend class glShaderProgram;
160 164 inline static glslopt_ctx* getGLSLOptContext() {return _GLSLOptContex;}
161 165 inline glUniformBufferObject* getUBO(const UBO_NAME& name) {return _uniformBufferObjects[name]; }
162 166
167 + protected:
168 + friend class glSamplerObject;
169 + inline static GLuint getActiveTextureUnit() {return _activeTextureUnit;}
170 +
163 171 public:
172 +
164 173 static void setActiveTextureUnit(GLuint unit,const bool force = false);
165 174 static void setActiveVAO(GLuint id,const bool force = false);
166 175 static void setActiveProgram(glShaderProgram* const program,const bool force = false);
  @@ -182,6 +191,7 @@
182 191 void setupLineStateViewPort(const OffsetMatrix& mat);
183 192 void releaseLineStateViewPort();
184 193 void changeResolutionInternal(U16 w, U16 h);
194 +
185 195 private: //OpenGL specific:
186 196
187 197 ///Text Rendering
  @@ -197,11 +207,10 @@
197 207 F32 _prevWidthString;
198 208 ///Window management:
199 209 vec2<GLushort> _cachedResolution; ///<Current window resolution
200 -
201 210 //Render state specific:
202 211 glRenderStateBlock* _currentGLRenderStateBlock; //<Currently active rendering states used by OpenGL
203 212 RenderStateBlock* _state2DRendering; //<Special render state for 2D rendering
204 - RenderStateBlock* _defaultStateNoDepth; //<The default render state buth with GL_DEPTH_TEST false
213 + RenderStateBlock* _defaultStateNoDepth; //<The default render state buth with GL_DEPTH_TEST false
205 214 bool _2DRendering;
206 215
207 216 vectorImpl<vec3<GLfloat> > _pointsA;
  @@ -220,16 +229,13 @@
220 229 bool _useMSAA;///<set to falls for FXAA or SMAA
221 230
222 231 static glslopt_ctx* _GLSLOptContex;
223 - static bool _coreGeomShadersAvailable;
224 - static bool _arbGeomShadersAvailable;
225 - static bool _extGeomShadersAvailable;
226 232 static glShaderProgram* _activeShaderProgram;
227 233 static GLuint _activeVAOId;
228 234 static GLuint _activeTextureUnit;
229 - static vec4<GLint> _currentviewportRect;
230 - static vec4<GLint> _prevViewportRect;
231 235 static vec4<GLfloat> _prevClearColor;
232 236
237 + bool _activeClipPlanes[Config::MAX_CLIP_PLANES];
238 +
233 239 END_SINGLETON
234 240
235 241 #endif