Changeset 10621 for OpenSceneGraph/trunk/include/osg/State
 Timestamp:
 10/09/09 15:39:11 (5 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

OpenSceneGraph/trunk/include/osg/State
r10601 r10621 167 167 if (_projection!=matrix) 168 168 { 169 if (matrix) 170 { 171 _projection=matrix; 172 } 173 else 174 { 175 _projection=_identity; 176 } 177 178 if (_projectionMatrixUniform.valid()) _projectionMatrixUniform>set(*_projection); 179 if (_modelViewProjectionMatrixUniform.valid()) _modelViewProjectionMatrixUniform>set((*_modelView) * (*_projection)); 180 169 181 glMatrixMode( GL_PROJECTION ); 182 glLoadMatrix(_projection>ptr()); 183 glMatrixMode( GL_MODELVIEW ); 184 } 185 } 186 187 inline const osg::Matrix& getProjectionMatrix() const 188 { 189 return *_projection; 190 } 191 192 inline void applyModelViewMatrix(const osg::RefMatrix* matrix) 193 { 194 if (_modelView!=matrix) 195 { 170 196 if (matrix) 171 197 { 172 _projection=matrix; 173 glLoadMatrix(matrix>ptr()); 198 _modelView=matrix; 174 199 } 175 200 else 176 201 { 177 _projection=_identity;178 glLoadIdentity();179 }180 glMatrixMode( GL_MODELVIEW );181 }182 }183 184 inline const osg::Matrix& getProjectionMatrix() const185 {186 return *_projection;187 }188 189 inline void applyModelViewMatrix(const osg::RefMatrix* matrix)190 {191 if (_modelView!=matrix)192 {193 if (matrix)194 {195 _modelView=matrix;196 glLoadMatrix(matrix>ptr());197 }198 else199 {200 202 _modelView=_identity; 201 glLoadIdentity(); 202 } 203 } 204 205 if (_modelViewMatrixUniform.valid()) _modelViewMatrixUniform>set(*_modelView); 206 if (_modelViewProjectionMatrixUniform.valid()) _modelViewProjectionMatrixUniform>set((*_modelView) * (*_projection)); 207 208 glLoadMatrix(_modelView>ptr()); 203 209 } 204 210 } … … 208 214 return *_modelView; 209 215 } 216 217 void applyModelViewAndProjectionUniformsIfRequired(); 218 219 osg::Uniform* getModelViewMatrixUniform() { return _modelViewMatrixUniform.get(); } 220 osg::Uniform* getProjectionMatrixUniform() { return _projectionMatrixUniform.get(); } 221 osg::Uniform* getModelViewProjectionMatrixUniform() { return _modelViewProjectionMatrixUniform.get(); } 210 222 211 223 … … 1088 1100 ref_ptr<const RefMatrix> _projection; 1089 1101 ref_ptr<const RefMatrix> _modelView; 1102 1103 ref_ptr<Uniform> _modelViewMatrixUniform; 1104 ref_ptr<Uniform> _projectionMatrixUniform; 1105 ref_ptr<Uniform> _modelViewProjectionMatrixUniform; 1090 1106 1091 1107 Matrix _initialInverseViewMatrix;