Fixed typo of SEPARATE enums

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14833 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-04-13 11:48:28 +00:00
parent 0a1db3d6fc
commit 87122ca369
7 changed files with 48 additions and 48 deletions

View File

@@ -448,7 +448,7 @@ int main( int argc, char **argv )
while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; }
while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; }
while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; }
while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPARATE_WINDOW; }
while (arguments.read("--fbo-samples", samples)) {}
while (arguments.read("--color-samples", colorSamples)) {}

View File

@@ -110,7 +110,7 @@ osg::NodePath createReflector()
osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
pat->setPosition(osg::Vec3(0.0f,0.0f,0.0f));
pat->setAttitude(osg::Quat(osg::inDegrees(0.0f),osg::Vec3(0.0f,0.0f,1.0f)));
Geode* geode_1 = new Geode;
pat->addChild(geode_1);
@@ -120,18 +120,18 @@ osg::NodePath createReflector()
ShapeDrawable* shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 0.0f), radius * 1.5f), hints.get());
shape->setColor(Vec4(0.8f, 0.8f, 0.8f, 1.0f));
geode_1->addDrawable(shape);
osg::NodePath nodeList;
nodeList.push_back(pat);
nodeList.push_back(geode_1);
return nodeList;
}
class UpdateCameraAndTexGenCallback : public osg::NodeCallback
{
public:
typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList;
UpdateCameraAndTexGenCallback(osg::NodePath& reflectorNodePath, CameraList& Cameras):
@@ -139,7 +139,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback
_Cameras(Cameras)
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
// first update subgraph to make sure objects are all moved into position
@@ -161,43 +161,43 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback
ImageData( osg::Vec3( 0, 0, -1), osg::Vec3( 0, -1, 0) ) // -Z
};
for(unsigned int i=0;
for(unsigned int i=0;
i<6 && i<_Cameras.size();
++i)
{
osg::Matrix localOffset;
localOffset.makeLookAt(position,position+id[i].first,id[i].second);
osg::Matrix viewMatrix = worldToLocal*localOffset;
_Cameras[i]->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
_Cameras[i]->setProjectionMatrixAsFrustum(-1.0,1.0,-1.0,1.0,1.0,10000.0);
_Cameras[i]->setViewMatrix(viewMatrix);
}
}
protected:
virtual ~UpdateCameraAndTexGenCallback() {}
osg::NodePath _reflectorNodePath;
osg::NodePath _reflectorNodePath;
CameraList _Cameras;
};
class TexMatCullCallback : public osg::NodeCallback
{
public:
TexMatCullCallback(osg::TexMat* texmat):
_texmat(texmat)
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
// first update subgraph to make sure objects are all moved into position
traverse(node,nv);
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv)
{
@@ -205,9 +205,9 @@ class TexMatCullCallback : public osg::NodeCallback
_texmat->setMatrix(osg::Matrix::rotate(quat.inverse()));
}
}
protected:
osg::ref_ptr<TexMat> _texmat;
};
@@ -216,7 +216,7 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl
{
osg::Group* group = new osg::Group;
osg::TextureCubeMap* texture = new osg::TextureCubeMap;
texture->setTextureSize(tex_width, tex_height);
@@ -226,7 +226,7 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl
texture->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);
texture->setFilter(osg::TextureCubeMap::MIN_FILTER,osg::TextureCubeMap::LINEAR);
texture->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR);
// set up the render to texture cameras.
UpdateCameraAndTexGenCallback::CameraList Cameras;
for(unsigned int i=0; i<6; ++i)
@@ -251,23 +251,23 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl
// add subgraph to render
camera->addChild(reflectedSubgraph);
group->addChild(camera);
Cameras.push_back(camera);
}
// create the texgen node to project the tex coords onto the subgraph
osg::TexGenNode* texgenNode = new osg::TexGenNode;
texgenNode->getTexGen()->setMode(osg::TexGen::REFLECTION_MAP);
texgenNode->setTextureUnit(unit);
group->addChild(texgenNode);
// set the reflected subgraph so that it uses the texture and tex gen settings.
// set the reflected subgraph so that it uses the texture and tex gen settings.
{
osg::Node* reflectorNode = reflectorNodePath.front();
group->addChild(reflectorNode);
osg::StateSet* stateset = reflectorNode->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(unit,texture,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON);
@@ -277,13 +277,13 @@ osg::Group* createShadowedScene(osg::Node* reflectedSubgraph, osg::NodePath refl
osg::TexMat* texmat = new osg::TexMat;
stateset->setTextureAttributeAndModes(unit,texmat,osg::StateAttribute::ON);
reflectorNode->setCullCallback(new TexMatCullCallback(texmat));
}
// add the reflector scene to draw just as normal
group->addChild(reflectedSubgraph);
// set an update callback to keep moving the camera and tex gen in the right direction.
group->setUpdateCallback(new UpdateCameraAndTexGenCallback(reflectorNodePath, Cameras));
@@ -316,19 +316,19 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
unsigned tex_width = 256;
unsigned tex_height = 256;
while (arguments.read("--width", tex_width)) {}
while (arguments.read("--height", tex_height)) {}
osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; }
while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; }
while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; }
while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPARATE_WINDOW; }
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
@@ -343,7 +343,7 @@ int main(int argc, char** argv)
ref_ptr<MatrixTransform> scene = new MatrixTransform;
scene->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(125.0),1.0,0.0,0.0));
ref_ptr<Group> reflectedSubgraph = _create_scene();
ref_ptr<Group> reflectedSubgraph = _create_scene();
if (!reflectedSubgraph.valid()) return 1;
ref_ptr<Group> reflectedScene = createShadowedScene(reflectedSubgraph.get(), createReflector(), 0, viewer.getCamera()->getClearColor(),