class GraphicsWindow;
struct RenderBufferInfo {
- enum Kind {
- REAL_DEPTH_BUFFER, // Only used if depth buffer is a color texture
- DEPTH_BUFFER,
- NORMAL_BUFFER,
- DIFFUSE_BUFFER,
- SPEC_EMIS_BUFFER,
- LIGHTING_BUFFER,
- SHADOW_BUFFER
- };
-
RenderBufferInfo(osg::Texture2D* t = 0, float s = 1.0 ) : texture(t), scaleFactor(s) {}
osg::ref_ptr<osg::Texture2D> texture;
float scaleFactor;
};
-typedef std::map<RenderBufferInfo::Kind,RenderBufferInfo> RenderBufferMap;
-typedef std::map<osg::Camera::BufferComponent,size_t> AttachmentMap;
+typedef std::map<std::string,RenderBufferInfo> RenderBufferMap;
+typedef std::map<osg::Camera::BufferComponent,std::string> AttachmentMap;
struct RenderStageInfo {
RenderStageInfo(osg::Camera* camera_ = 0, int si = -1, bool fs = false)
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.
*/
/** 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 ) { cameras[k].camera = c; cameras[k].scaleFactor = s; }
+ 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
*/
RenderBufferMap buffers;
- void addBuffer(RenderBufferInfo::Kind k, osg::Texture2D* tex, float scale = 1.0 ) { buffers[k] = RenderBufferInfo(tex,scale); }
- osg::Texture2D* getBuffer(RenderBufferInfo::Kind k) const;
+ 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];