Introduce Camera::s/getRenderer().
This commit is contained in:
@@ -251,15 +251,20 @@ void Camera::detach(BufferComponent buffer)
|
||||
|
||||
void Camera::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_renderingCache.resize(maxSize);
|
||||
if (_renderer.valid())
|
||||
{
|
||||
const_cast<Camera*>(this)->_renderer->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
Transform::resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void Camera::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
if (state) const_cast<Camera*>(this)->_renderingCache[state->getContextID()] = 0;
|
||||
else const_cast<Camera*>(this)->_renderingCache.setAllElementsTo(0);
|
||||
if (_renderer.valid())
|
||||
{
|
||||
const_cast<Camera*>(this)->_renderer->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
Transform::releaseGLObjects(state);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class FLTReaderWriter : public ReaderWriter
|
||||
|
||||
virtual bool acceptsExtension(const std::string& extension) const
|
||||
{
|
||||
return equalCaseInsensitive(extension,"flt");
|
||||
return equalCaseInsensitive(extension,"flt") || extension.empty();
|
||||
}
|
||||
|
||||
virtual ReadResult readObject(const std::string& file, const Options* options) const
|
||||
|
||||
@@ -1190,11 +1190,11 @@ void CullVisitor::apply(osg::Camera& camera)
|
||||
|
||||
// use render to texture stage.
|
||||
// create the render to texture stage.
|
||||
osg::ref_ptr<osgUtil::RenderStageCache> rsCache = dynamic_cast<osgUtil::RenderStageCache*>(camera.getRenderingCache(contextID));
|
||||
osg::ref_ptr<osgUtil::RenderStageCache> rsCache = dynamic_cast<osgUtil::RenderStageCache*>(camera.getRenderer());
|
||||
if (!rsCache)
|
||||
{
|
||||
rsCache = new osgUtil::RenderStageCache;
|
||||
camera.setRenderingCache(contextID, rsCache.get());
|
||||
camera.setRenderer(rsCache.get());
|
||||
}
|
||||
|
||||
osg::ref_ptr<osgUtil::RenderStage> rtts = rsCache->getRenderStage(this);
|
||||
|
||||
@@ -95,7 +95,7 @@ SceneView::SceneView(DisplaySettings* ds)
|
||||
|
||||
_prioritizeTextures = false;
|
||||
|
||||
_camera = new Camera;
|
||||
setCamera(new Camera);
|
||||
_camera->setViewport(new Viewport);
|
||||
_camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f));
|
||||
|
||||
@@ -132,6 +132,7 @@ SceneView::SceneView(const SceneView& rhs, const osg::CopyOp& copyop):
|
||||
_prioritizeTextures = rhs._prioritizeTextures;
|
||||
|
||||
_camera = rhs._camera;
|
||||
_cameraWithOwnership = rhs._cameraWithOwnership;
|
||||
|
||||
_initCalled = rhs._initCalled;
|
||||
|
||||
@@ -231,7 +232,7 @@ void SceneView::setDefaults(unsigned int options)
|
||||
_camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f));
|
||||
}
|
||||
|
||||
void SceneView::setCamera(osg::Camera* camera)
|
||||
void SceneView::setCamera(osg::Camera* camera, bool assumeOwnershipOfCamera)
|
||||
{
|
||||
if (camera)
|
||||
{
|
||||
@@ -241,6 +242,15 @@ void SceneView::setCamera(osg::Camera* camera)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: attempt to assign a NULL camera to SceneView not permitted."<<std::endl;
|
||||
}
|
||||
|
||||
if (assumeOwnershipOfCamera)
|
||||
{
|
||||
_cameraWithOwnership = _camera.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cameraWithOwnership = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SceneView::setSceneData(osg::Node* node)
|
||||
|
||||
@@ -476,19 +476,19 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
|
||||
__C5_GraphicsContext_P1__getGraphicsContext,
|
||||
"Get the const GraphicsContext. ",
|
||||
"");
|
||||
I_Method2(void, setRenderingCache, IN, unsigned int, contextID, IN, osg::Object *, rc,
|
||||
I_Method1(void, setRenderer, IN, osg::Object *, rc,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setRenderingCache__unsigned_int__osg_Object_P1,
|
||||
__void__setRenderer__osg_Object_P1,
|
||||
"Set the Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method1(osg::Object *, getRenderingCache, IN, unsigned int, contextID,
|
||||
I_Method0(osg::Object *, getRenderer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Object_P1__getRenderingCache__unsigned_int,
|
||||
__osg_Object_P1__getRenderer,
|
||||
"Get the Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method1(const osg::Object *, getRenderingCache, IN, unsigned int, contextID,
|
||||
I_Method0(const osg::Object *, getRenderer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osg_Object_P1__getRenderingCache__unsigned_int,
|
||||
__C5_osg_Object_P1__getRenderer,
|
||||
"Get the const Rendering object that is used to implement rendering of the subgraph. ",
|
||||
"");
|
||||
I_Method1(void, setPreDrawCallback, IN, osg::Camera::DrawCallback *, cb,
|
||||
@@ -606,10 +606,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
|
||||
I_SimpleProperty(osg::Camera::RenderTargetImplementation, RenderTargetImplementation,
|
||||
__RenderTargetImplementation__getRenderTargetImplementation,
|
||||
__void__setRenderTargetImplementation__RenderTargetImplementation);
|
||||
I_IndexedProperty(osg::Object *, RenderingCache,
|
||||
__osg_Object_P1__getRenderingCache__unsigned_int,
|
||||
__void__setRenderingCache__unsigned_int__osg_Object_P1,
|
||||
0);
|
||||
I_SimpleProperty(osg::Object *, Renderer,
|
||||
__osg_Object_P1__getRenderer,
|
||||
__void__setRenderer__osg_Object_P1);
|
||||
I_SimpleProperty(osg::Stats *, Stats,
|
||||
__osg_Stats_P1__getStats,
|
||||
__void__setStats__osg_Stats_P1);
|
||||
|
||||
@@ -121,11 +121,11 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView)
|
||||
__void__setDefaults__unsigned_int,
|
||||
"Set scene view to use default global state, light, camera and render visitor. ",
|
||||
"");
|
||||
I_Method1(void, setCamera, IN, osg::Camera *, camera,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setCamera__osg_Camera_P1,
|
||||
"Set the camera used to represent the camera view of this SceneView. ",
|
||||
"");
|
||||
I_MethodWithDefaults2(void, setCamera, IN, osg::Camera *, camera, , IN, bool, assumeOwnershipOfCamera, true,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setCamera__osg_Camera_P1__bool,
|
||||
"Set the camera used to represent the camera view of this SceneView. ",
|
||||
"");
|
||||
I_Method0(osg::Camera *, getCamera,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Camera_P1__getCamera,
|
||||
@@ -784,7 +784,7 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::SceneView)
|
||||
__void__setActiveUniforms__int);
|
||||
I_SimpleProperty(osg::Camera *, Camera,
|
||||
__osg_Camera_P1__getCamera,
|
||||
__void__setCamera__osg_Camera_P1);
|
||||
0);
|
||||
I_SimpleProperty(const osg::Vec4 &, ClearColor,
|
||||
__C5_osg_Vec4_R1__getClearColor,
|
||||
__void__setClearColor__C5_osg_Vec4_R1);
|
||||
|
||||
Reference in New Issue
Block a user