bool resizable;
};
-enum CameraKind {
- MAIN_CAMERA,
- FAR_CAMERA,
- GEOMETRY_CAMERA,
- SHADOW_CAMERA,
- BLOOM_CAMERA_1,
- BLOOM_CAMERA_2,
- AO_CAMERA_1,
- AO_CAMERA_2,
- AO_CAMERA_3,
- LIGHTING_CAMERA,
- DISPLAY_CAMERA
-};
-typedef std::map<CameraKind,RenderStageInfo> CameraMap;
+extern const char* MAIN_CAMERA;
+extern const char* FAR_CAMERA;
+extern const char* GEOMETRY_CAMERA;
+extern const char* SHADOW_CAMERA;
+extern const char* LIGHTING_CAMERA;
+extern const char* DISPLAY_CAMERA;
+
+typedef std::map<std::string,RenderStageInfo> CameraMap;
/** A wrapper around osg::Camera that contains some extra information.
*/
projInverse( new osg::Uniform( "fg_ProjectionMatrixInverse", osg::Matrixf() ) ),
viewInverse( new osg::Uniform( "fg_ViewMatrixInverse",osg::Matrixf() ) ),
view( new osg::Uniform( "fg_ViewMatrix",osg::Matrixf() ) ),
+ worldPosCart( new osg::Uniform( "fg_CameraPositionCart", osg::Vec3f() ) ),
+ worldPosGeod( new osg::Uniform( "fg_CameraPositionGeod", osg::Vec3f() ) ),
du( new osg::Uniform( "fg_du",osg::Vec4() ) ),
dv( new osg::Uniform( "fg_dv",osg::Vec4() ) )
{
+ shadowMatrix[0] = new osg::Uniform("fg_ShadowMatrix_0", osg::Matrixf());
+ shadowMatrix[1] = new osg::Uniform("fg_ShadowMatrix_1", osg::Matrixf());
+ shadowMatrix[2] = new osg::Uniform("fg_ShadowMatrix_2", osg::Matrixf());
+ shadowMatrix[3] = new osg::Uniform("fg_ShadowMatrix_3", osg::Matrixf());
}
/** Update and resize cameras
/** the camera objects
*/
CameraMap cameras;
- void addCamera( CameraKind k, osg::Camera* c, int si = -1, bool fs = false ) { cameras[k].camera = c; cameras[k].slaveIndex = si; cameras[k].fullscreen = fs; }
- void addCamera( CameraKind k, osg::Camera* c, bool fs ) { cameras[k].camera = c; cameras[k].fullscreen = fs; }
- void addCamera( CameraKind k, osg::Camera* c, float s ) { cameras[k].camera = c; cameras[k].scaleFactor = s; }
- osg::Camera* getCamera(CameraKind k) const;
+ void addCamera( const std::string& k, osg::Camera* c, int si = -1, bool fs = false ) { cameras[k].camera = c; cameras[k].slaveIndex = si; cameras[k].fullscreen = fs; }
+ void addCamera( const std::string& k, osg::Camera* c, bool fs ) { cameras[k].camera = c; cameras[k].fullscreen = fs; }
+ void addCamera( const std::string& k, osg::Camera* c, float s, bool fs = false ) { cameras[k].camera = c; cameras[k].scaleFactor = s; cameras[k].fullscreen = fs; }
+ osg::Camera* getCamera(const std::string& k) const;
int getMainSlaveIndex() const;
- RenderStageInfo& getRenderStageInfo( CameraKind k ) { return cameras[k]; }
+ RenderStageInfo& getRenderStageInfo( const std::string& k ) { return cameras[k]; }
/** the buffer objects
*/
void addBuffer(const std::string& k, osg::Texture2D* tex, float scale = 1.0 ) { buffers[k] = RenderBufferInfo(tex,scale); }
osg::Texture2D* getBuffer(const std::string& k) const;
- osg::ref_ptr<osg::TexGen> shadowTexGen[4];
-
osg::ref_ptr<osg::Uniform> bufferSize;
- //osg::ref_ptr<osg::Uniform> bloomOffset[2];
osg::ref_ptr<osg::Uniform> projInverse;
osg::ref_ptr<osg::Uniform> viewInverse;
osg::ref_ptr<osg::Uniform> view;
+ osg::ref_ptr<osg::Uniform> worldPosCart;
+ osg::ref_ptr<osg::Uniform> worldPosGeod;
osg::ref_ptr<osg::Uniform> du;
osg::ref_ptr<osg::Uniform> dv;
+ osg::ref_ptr<osg::Uniform> shadowMatrix[4];
void setMatrices( osg::Camera* c );