Work on the RenderToTexture usage of the new osg::CameraNode. Both osghud

and osgprerender now ported across to osg::CameraNode.
This commit is contained in:
Robert Osfield
2005-06-14 20:51:35 +00:00
parent 868d381528
commit 71122ff38f
9 changed files with 507 additions and 195 deletions

View File

@@ -18,17 +18,24 @@ using namespace osg;
CameraNode::CameraNode():
_clearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)),
_clearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
_clearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT),
_renderOrder(POST_RENDER),
_renderTargetImplementation(FRAME_BUFFER)
{
}
CameraNode::CameraNode(const CameraNode& camera,const CopyOp& copyop):
Transform(camera,copyop),
CullSettings(camera),
_clearColor(camera._clearColor),
_clearMask(camera._clearMask),
_viewport(camera._viewport),
_projectionMatrix(camera._projectionMatrix),
_viewMatrix(camera._viewMatrix)
_viewMatrix(camera._viewMatrix),
_renderOrder(camera._renderOrder),
_renderTargetImplementation(camera._renderTargetImplementation),
_bufferAttachmentMap(camera._bufferAttachmentMap)
{
}
@@ -109,6 +116,29 @@ void CameraNode::getViewMatrixAsLookAt(Vec3& eye,Vec3& center,Vec3& up,float loo
_viewMatrix.getLookAt(eye,center,up,lookDistance);
}
void CameraNode::attach(BufferComponent buffer, GLenum internalFormat)
{
_bufferAttachmentMap[buffer]._internalFormat = internalFormat;
}
void CameraNode::attach(BufferComponent buffer, osg::Texture* texture, unsigned int face)
{
_bufferAttachmentMap[buffer]._texture = texture;
_bufferAttachmentMap[buffer]._face = face;
}
void CameraNode::attach(BufferComponent buffer, osg::Image* image)
{
_bufferAttachmentMap[buffer]._image = image;
}
void CameraNode::detach(BufferComponent buffer)
{
_bufferAttachmentMap.erase(buffer);
}
bool CameraNode::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_RF)