Added reference frame to TexGenNode
This commit is contained in:
parent
ec5463c10d
commit
cfac4c74bc
@ -33,6 +33,20 @@ class OSG_EXPORT TexGenNode : public Group
|
||||
META_Node(osg, TexGenNode);
|
||||
|
||||
|
||||
enum ReferenceFrame
|
||||
{
|
||||
RELATIVE_RF,
|
||||
ABSOLUTE_RF
|
||||
};
|
||||
|
||||
/** Set the TexGenNode's ReferenceFrame, either to be relative to its
|
||||
* parent reference frame. */
|
||||
void setReferenceFrame(ReferenceFrame rf);
|
||||
|
||||
/** Ge thte TexGenNode's ReferenceFrame.*/
|
||||
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
|
||||
|
||||
/** Set the texture unit that this TexGenNode is associated with.*/
|
||||
void setTextureUnit(unsigned int textureUnit) { _textureUnit = textureUnit; }
|
||||
|
||||
unsigned int getTextureUnit() const { return _textureUnit; }
|
||||
@ -54,6 +68,8 @@ class OSG_EXPORT TexGenNode : public Group
|
||||
unsigned int _textureUnit;
|
||||
StateAttribute::GLModeValue _value;
|
||||
osg::ref_ptr<TexGen> _texgen;
|
||||
|
||||
ReferenceFrame _referenceFrame;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -873,10 +873,17 @@ void CullVisitor::apply(TexGenNode& node)
|
||||
StateSet* node_state = node.getStateSet();
|
||||
if (node_state) pushStateSet(node_state);
|
||||
|
||||
RefMatrix& matrix = getModelViewMatrix();
|
||||
|
||||
addPositionedTextureAttribute(node.getTextureUnit(), &matrix,node.getTexGen());
|
||||
|
||||
if (node.getReferenceFrame()==osg::TexGenNode::RELATIVE_RF)
|
||||
{
|
||||
RefMatrix& matrix = getModelViewMatrix();
|
||||
addPositionedTextureAttribute(node.getTextureUnit(), &matrix ,node.getTexGen());
|
||||
}
|
||||
else
|
||||
{
|
||||
addPositionedTextureAttribute(node.getTextureUnit(), 0 ,node.getTexGen());
|
||||
}
|
||||
|
||||
handle_cull_callbacks_and_traverse(node);
|
||||
|
||||
// pop the node's state off the geostate stack.
|
||||
@ -1028,6 +1035,7 @@ void CullVisitor::apply(osg::CameraNode& camera)
|
||||
// push the node's state.
|
||||
StateSet* node_state = camera.getStateSet();
|
||||
if (node_state) pushStateSet(node_state);
|
||||
|
||||
|
||||
if (camera.getReferenceFrame()==osg::Transform::ABSOLUTE_RF)
|
||||
{
|
||||
@ -1080,7 +1088,7 @@ void CullVisitor::apply(osg::CameraNode& camera)
|
||||
rtts->setViewport( viewport );
|
||||
|
||||
// set up to charge the same RenderStageLighting is the parent previous stage.
|
||||
rtts->setRenderStageLighting(previous_stage->getRenderStageLighting());
|
||||
//rtts->setRenderStageLighting(previous_stage->getRenderStageLighting());
|
||||
|
||||
// record the render bin, to be restored after creation
|
||||
// of the render to text
|
||||
|
Loading…
Reference in New Issue
Block a user