Replaced deprecated osg::Geometry::set*Binding() usage.

This commit is contained in:
Robert Osfield 2013-06-27 09:59:33 +00:00
parent 87add5f508
commit 592c580721
6 changed files with 132 additions and 146 deletions

View File

@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2010 Jeremy Moles <cubicool@gmail.com> * Copyright (C) 2010 Jeremy Moles <cubicool@gmail.com>
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -50,8 +50,7 @@ osg::Geometry* createEaseMotionGeometry(osgAnimation::Motion* motion) {
geom->setUseDisplayList(false); geom->setUseDisplayList(false);
geom->setVertexArray(v); geom->setVertexArray(v);
geom->setColorArray(cols); geom->setColorArray(cols, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size())); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
return geom; return geom;
@ -105,11 +104,11 @@ struct ColorLabel: public osgWidget::Label {
setFont("fonts/VeraMono.ttf"); setFont("fonts/VeraMono.ttf");
setFontSize(14); setFontSize(14);
setFontColor(1.0f, 1.0f, 1.0f, 1.0f); setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
setColor(0.3f, 0.3f, 0.3f, 1.0f); setColor(0.3f, 0.3f, 0.3f, 1.0f);
setPadding(2.0f); setPadding(2.0f);
setCanFill(true); setCanFill(true);
addSize(150.0f, 25.0f); addSize(150.0f, 25.0f);
setLabel(label); setLabel(label);
@ -118,9 +117,9 @@ struct ColorLabel: public osgWidget::Label {
bool mousePush(double, double, const osgWidget::WindowManager*) { bool mousePush(double, double, const osgWidget::WindowManager*) {
osgWidget::Table* p = dynamic_cast<osgWidget::Table*>(_parent); osgWidget::Table* p = dynamic_cast<osgWidget::Table*>(_parent);
if(!p) return false; if(!p) return false;
p->hide(); p->hide();
const std::string& name = getName(); const std::string& name = getName();
@ -232,7 +231,7 @@ struct ColorLabel: public osgWidget::Label {
else if(!name.compare("InOutExpoMotion")) else if(!name.compare("InOutExpoMotion"))
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutExpoMotion>() EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutExpoMotion>()
; ;
else EASE_MOTION_SAMPLER->setMotion<osgAnimation::LinearMotion>(); else EASE_MOTION_SAMPLER->setMotion<osgAnimation::LinearMotion>();
return true; return true;
@ -240,13 +239,13 @@ struct ColorLabel: public osgWidget::Label {
bool mouseEnter(double, double, const osgWidget::WindowManager*) { bool mouseEnter(double, double, const osgWidget::WindowManager*) {
setColor(0.9f, 0.6f, 0.1f, 1.0f); setColor(0.9f, 0.6f, 0.1f, 1.0f);
return true; return true;
} }
bool mouseLeave(double, double, const osgWidget::WindowManager*) { bool mouseLeave(double, double, const osgWidget::WindowManager*) {
setColor(0.3f, 0.3f, 0.3f, 1.0f); setColor(0.3f, 0.3f, 0.3f, 1.0f);
return true; return true;
} }
}; };
@ -286,7 +285,7 @@ public:
_window->addWidget(new ColorLabel("OutCircMotion"), 3, 3); _window->addWidget(new ColorLabel("OutCircMotion"), 3, 3);
_window->addWidget(new ColorLabel("InCircMotion"), 4, 3); _window->addWidget(new ColorLabel("InCircMotion"), 4, 3);
_window->addWidget(new ColorLabel("InOutCircMotion"), 5, 3); _window->addWidget(new ColorLabel("InOutCircMotion"), 5, 3);
_window->addWidget(new ColorLabel("OutExpoMotion"), 0, 4); _window->addWidget(new ColorLabel("OutExpoMotion"), 0, 4);
_window->addWidget(new ColorLabel("InExpoMotion"), 1, 4); _window->addWidget(new ColorLabel("InExpoMotion"), 1, 4);
_window->addWidget(new ColorLabel("InOutExpoMotion"), 2, 4); _window->addWidget(new ColorLabel("InOutExpoMotion"), 2, 4);

View File

@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -34,7 +34,7 @@
osg::Geode* createAxis() osg::Geode* createAxis()
{ {
osg::Geode* geode (new osg::Geode()); osg::Geode* geode (new osg::Geode());
osg::Geometry* geometry (new osg::Geometry()); osg::Geometry* geometry (new osg::Geometry());
osg::Vec3Array* vertices (new osg::Vec3Array()); osg::Vec3Array* vertices (new osg::Vec3Array());
@ -53,9 +53,7 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors); geometry->setColorArray (colors, osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry ); geode->addDrawable( geometry );
@ -70,12 +68,11 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get()); geometry->setVertexArray (vertices.get());
geometry->setColorArray (colors.get()); geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
float step = size / static_cast<float>(nsplit); float step = size / static_cast<float>(nsplit);
float s = 0.5f/4.0f; float s = 0.5f/4.0f;
for (int i = 0; i < nsplit; i++) for (int i = 0; i < nsplit; i++)
{ {
float x = -1.0f + static_cast<float>(i) * step; float x = -1.0f + static_cast<float>(i) * step;
std::cout << x << std::endl; std::cout << x << std::endl;
@ -92,7 +89,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
} }
osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray; osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray;
for (int i = 0; i < nsplit - 1; i++) for (int i = 0; i < nsplit - 1; i++)
{ {
int base = i * 4; int base = i * 4;
array->push_back(base); array->push_back(base);
@ -123,7 +120,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
array->push_back(base+2); array->push_back(base+2);
array->push_back(base+7); array->push_back(base+7);
} }
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front())); geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front()));
geometry->setUseDisplayList( false ); geometry->setUseDisplayList( false );
riggeometry->setSourceGeometry(geometry); riggeometry->setSourceGeometry(geometry);
@ -144,7 +141,7 @@ void initVertexMap(osgAnimation::Bone* b0,
(*vim)[b1->getName()].setName(b1->getName()); (*vim)[b1->getName()].setName(b1->getName());
(*vim)[b2->getName()].setName(b2->getName()); (*vim)[b2->getName()].setName(b2->getName());
for (int i = 0; i < (int)array->size(); i++) for (int i = 0; i < (int)array->size(); i++)
{ {
float val = (*array)[i][0]; float val = (*array)[i][0];
std::cout << val << std::endl; std::cout << val << std::endl;
@ -229,7 +226,7 @@ int main (int argc, char* argv[])
} }
manager->registerAnimation(anim); manager->registerAnimation(anim);
manager->buildTargetReference(); manager->buildTargetReference();
// let's start ! // let's start !
manager->playAnimation(anim); manager->playAnimation(anim);
@ -247,7 +244,7 @@ int main (int argc, char* argv[])
trueroot->setDataVariance(osg::Object::DYNAMIC); trueroot->setDataVariance(osg::Object::DYNAMIC);
rootTransform->addChild(trueroot); rootTransform->addChild(trueroot);
scene->addChild(rootTransform); scene->addChild(rootTransform);
osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0f); osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0f);
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom); geode->addDrawable(geom);

View File

@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -30,7 +30,7 @@ using namespace osgAnimation;
osg::ref_ptr<osg::Geode> createAxis() osg::ref_ptr<osg::Geode> createAxis()
{ {
osg::ref_ptr<osg::Geode> geode (new osg::Geode()); osg::ref_ptr<osg::Geode> geode (new osg::Geode());
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry()); osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
@ -49,9 +49,7 @@ osg::ref_ptr<osg::Geode> createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get()); geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() ); geode->addDrawable( geometry.get() );
@ -114,7 +112,7 @@ int main (int argc, char* argv[])
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0))); channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0))); channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0)));
osgAnimation::Animation* anim1 = new osgAnimation::Animation; osgAnimation::Animation* anim1 = new osgAnimation::Animation;
anim1->addChannel(channelAnimation1); anim1->addChannel(channelAnimation1);
anim1->setPlayMode(osgAnimation::Animation::PPONG); anim1->setPlayMode(osgAnimation::Animation::PPONG);
@ -130,12 +128,12 @@ int main (int argc, char* argv[])
osgAnimation::Animation* anim2 = new osgAnimation::Animation; osgAnimation::Animation* anim2 = new osgAnimation::Animation;
anim2->addChannel(channelAnimation2); anim2->addChannel(channelAnimation2);
anim2->setPlayMode(osgAnimation::Animation::LOOP); anim2->setPlayMode(osgAnimation::Animation::LOOP);
// We register all animation inside the scheduler // We register all animation inside the scheduler
mng->registerAnimation(anim1); mng->registerAnimation(anim1);
mng->registerAnimation(anim2); mng->registerAnimation(anim2);
//start the animation //start the animation
mng->playAnimation(anim1); mng->playAnimation(anim1);
mng->playAnimation(anim2); mng->playAnimation(anim2);

View File

@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
* *
* Authors: * Authors:
@ -37,13 +37,13 @@ const int WIDTH = 1440;
const int HEIGHT = 900; const int HEIGHT = 900;
osg::Geode* createAxis() osg::Geode* createAxis()
{ {
osg::Geode* geode = new osg::Geode(); osg::Geode* geode = new osg::Geode();
osg::Geometry* geometry = new osg::Geometry(); osg::Geometry* geometry = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array(); osg::Vec3Array* vertices = new osg::Vec3Array();
osg::Vec4Array* colors = new osg::Vec4Array(); osg::Vec4Array* colors = new osg::Vec4Array();
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
@ -57,10 +57,9 @@ osg::Geode* createAxis()
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
geometry->setVertexArray(vertices); geometry->setVertexArray(vertices);
geometry->setColorArray(colors); geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false); geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
@ -100,7 +99,7 @@ struct AddHelperBone : public osg::NodeVisitor
} }
}; };
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
osg::ArgumentParser arguments(&argc, argv); osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
@ -153,7 +152,7 @@ int main(int argc, char** argv)
AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234); AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234);
osg::Camera* camera = gui->createParentOrthoCamera(); osg::Camera* camera = gui->createParentOrthoCamera();
node->setNodeMask(0x0001); node->setNodeMask(0x0001);
group->addChild(node); group->addChild(node);

View File

@ -33,7 +33,7 @@ ImageReaderWriter::DataReference::DataReference():
_center(0.625f,0.0f,0.0f), _center(0.625f,0.0f,0.0f),
_maximumWidth(1.25f,0.0f,0.0f), _maximumWidth(1.25f,0.0f,0.0f),
_maximumHeight(0.0f,0.0f,1.0f), _maximumHeight(0.0f,0.0f,1.0f),
_numPointsAcross(10), _numPointsAcross(10),
_numPointsUp(10), _numPointsUp(10),
_backPage(false) {} _backPage(false) {}
@ -44,7 +44,7 @@ ImageReaderWriter::DataReference::DataReference(const std::string& fileName, uns
_center(width*0.5f,0.0f,height*0.5f), _center(width*0.5f,0.0f,height*0.5f),
_maximumWidth(width,0.0f,0.0f), _maximumWidth(width,0.0f,0.0f),
_maximumHeight(0.0f,0.0f,height), _maximumHeight(0.0f,0.0f,height),
_numPointsAcross(10), _numPointsAcross(10),
_numPointsUp(10), _numPointsUp(10),
_backPage(backPage) {} _backPage(backPage) {}
@ -55,7 +55,7 @@ ImageReaderWriter::DataReference::DataReference(const DataReference& rhs):
_center(rhs._center), _center(rhs._center),
_maximumWidth(rhs._maximumWidth), _maximumWidth(rhs._maximumWidth),
_maximumHeight(rhs._maximumHeight), _maximumHeight(rhs._maximumHeight),
_numPointsAcross(rhs._numPointsAcross), _numPointsAcross(rhs._numPointsAcross),
_numPointsUp(rhs._numPointsUp), _numPointsUp(rhs._numPointsUp),
_backPage(rhs._backPage) {} _backPage(rhs._backPage) {}
@ -121,11 +121,11 @@ osgDB::ReaderWriter::ReadResult ImageReaderWriter::local_readNode(const std::str
osg::Image* image = 0; osg::Image* image = 0;
float s=1.0f,t=1.0f; float s=1.0f,t=1.0f;
// try to load photo from any loaded PhotoArchives // try to load photo from any loaded PhotoArchives
if (!_photoArchiveList.empty()) if (!_photoArchiveList.empty())
image = readImage_Archive(dr,s,t); image = readImage_Archive(dr,s,t);
// not loaded yet, so try to load it directly. // not loaded yet, so try to load it directly.
if (!image) if (!image)
image = readImage_DynamicSampling(dr,s,t); image = readImage_DynamicSampling(dr,s,t);
@ -210,8 +210,7 @@ osgDB::ReaderWriter::ReadResult ImageReaderWriter::local_readNode(const std::str
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

View File

@ -38,7 +38,7 @@ using namespace osg;
// now register with Registry to instantiate the above reader/writer, // now register with Registry to instantiate the above reader/writer,
// declaring in main so that the code to set up PagedLOD can get a handle // declaring in main so that the code to set up PagedLOD can get a handle
// to the ImageReaderWriter's // to the ImageReaderWriter's
osgDB::RegisterReaderWriterProxy<ImageReaderWriter> g_ImageReaderWriter; osgDB::RegisterReaderWriterProxy<ImageReaderWriter> g_ImageReaderWriter;
class Album; class Album;
@ -54,13 +54,13 @@ public:
if (page.valid()) return page.release(); if (page.valid()) return page.release();
else return 0; else return 0;
} }
virtual void traverse(osg::NodeVisitor& nv); virtual void traverse(osg::NodeVisitor& nv);
void setRotation(float angle) void setRotation(float angle)
{ {
_rotation = angle; _rotation = angle;
_targetRotation = angle; _targetRotation = angle;
dirtyBound(); dirtyBound();
} }
@ -68,10 +68,10 @@ public:
void rotateTo(float angle, float timeToRotateBy) void rotateTo(float angle, float timeToRotateBy)
{ {
_targetRotation = angle; _targetRotation = angle;
_targetTime = timeToRotateBy; _targetTime = timeToRotateBy;
} }
bool rotating() const { return _targetRotation!=_rotation; } bool rotating() const { return _targetRotation!=_rotation; }
void setPageVisible(bool frontVisible,bool backVisible) void setPageVisible(bool frontVisible,bool backVisible)
@ -86,7 +86,7 @@ public:
public: public:
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const
{ {
if (_referenceFrame==RELATIVE_RF) if (_referenceFrame==RELATIVE_RF)
{ {
@ -119,7 +119,7 @@ public:
osg::Matrix getInverseMatrix() const { return osg::Matrix::inverse(getMatrix()); } osg::Matrix getInverseMatrix() const { return osg::Matrix::inverse(getMatrix()); }
protected: protected:
Page(Album* album, unsigned int pageNo, const std::string& frontFileName, const std::string& backFileName, float width, float height); Page(Album* album, unsigned int pageNo, const std::string& frontFileName, const std::string& backFileName, float width, float height);
float _rotation; float _rotation;
@ -141,19 +141,19 @@ public:
Album(osg::ArgumentParser& ap, float width, float height); Album(osg::ArgumentParser& ap, float width, float height);
osg::Group* getScene() { return _group.get(); } osg::Group* getScene() { return _group.get(); }
const osg::Group* getScene() const { return _group.get(); } const osg::Group* getScene() const { return _group.get(); }
osg::Matrix getPageOffset(unsigned int pageNo) const; osg::Matrix getPageOffset(unsigned int pageNo) const;
bool nextPage(float timeToRotateBy) { return gotoPage(_currentPageNo+1,timeToRotateBy); } bool nextPage(float timeToRotateBy) { return gotoPage(_currentPageNo+1,timeToRotateBy); }
bool previousPage(float timeToRotateBy) { return _currentPageNo>=1?gotoPage(_currentPageNo-1,timeToRotateBy):false; } bool previousPage(float timeToRotateBy) { return _currentPageNo>=1?gotoPage(_currentPageNo-1,timeToRotateBy):false; }
bool gotoPage(unsigned int pageNo, float timeToRotateBy); bool gotoPage(unsigned int pageNo, float timeToRotateBy);
osg::StateSet* getBackgroundStateSet() { return _backgroundStateSet.get(); } osg::StateSet* getBackgroundStateSet() { return _backgroundStateSet.get(); }
void setVisibility(); void setVisibility();
protected: protected:
@ -162,13 +162,13 @@ protected:
osg::ref_ptr<osg::Group> _group; osg::ref_ptr<osg::Group> _group;
PageList _pages; PageList _pages;
osg::ref_ptr<osg::StateSet> _backgroundStateSet; osg::ref_ptr<osg::StateSet> _backgroundStateSet;
unsigned int _currentPageNo; unsigned int _currentPageNo;
float _radiusOfRings; float _radiusOfRings;
float _startAngleOfPages; float _startAngleOfPages;
float _deltaAngleBetweenPages; float _deltaAngleBetweenPages;
}; };
@ -183,12 +183,12 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
_targetRotation = 0; _targetRotation = 0;
_targetTime = 0; _targetTime = 0;
_lastTimeTraverse = 0; _lastTimeTraverse = 0;
_pageOffset = album->getPageOffset(pageNo); _pageOffset = album->getPageOffset(pageNo);
setNumChildrenRequiringUpdateTraversal(1); setNumChildrenRequiringUpdateTraversal(1);
// set up subgraph // set up subgraph
osgDB::ReaderWriter* readerWriter = osgDB::Registry::instance()->getReaderWriterForExtension("gdal"); osgDB::ReaderWriter* readerWriter = osgDB::Registry::instance()->getReaderWriterForExtension("gdal");
if (!readerWriter) if (!readerWriter)
@ -200,7 +200,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
ImageReaderWriter* rw = g_ImageReaderWriter.get(); ImageReaderWriter* rw = g_ImageReaderWriter.get();
// set up non visible page. // set up non visible page.
osg::Group* non_visible_page = new osg::Group; osg::Group* non_visible_page = new osg::Group;
_switch->addChild(non_visible_page); _switch->addChild(non_visible_page);
@ -218,7 +218,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
(*coords)[6].set(width,0.0f,0.0f); (*coords)[6].set(width,0.0f,0.0f);
(*coords)[7].set(0.0f,0.0f,0.0f); (*coords)[7].set(0.0f,0.0f,0.0f);
geom->setVertexArray(coords); geom->setVertexArray(coords);
osg::Vec3Array* normals = new osg::Vec3Array(8); osg::Vec3Array* normals = new osg::Vec3Array(8);
(*normals)[0].set(-1.0f,0.0f,0.0f); (*normals)[0].set(-1.0f,0.0f,0.0f);
@ -229,8 +229,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
(*normals)[5].set(1.0f,0.0f,0.0f); (*normals)[5].set(1.0f,0.0f,0.0f);
(*normals)[6].set(0.0f,0.0f,1.0f); (*normals)[6].set(0.0f,0.0f,1.0f);
(*normals)[7].set(0.0f,0.0f,1.0f); (*normals)[7].set(0.0f,0.0f,1.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
osg::Vec2Array* tcoords = new osg::Vec2Array(8); osg::Vec2Array* tcoords = new osg::Vec2Array(8);
(*tcoords)[0].set(0.0f,0.0f); (*tcoords)[0].set(0.0f,0.0f);
@ -245,16 +244,15 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8));
// set up the geode. // set up the geode.
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom); geode->addDrawable(geom);
non_visible_page->addChild(geode); non_visible_page->addChild(geode);
} }
@ -277,8 +275,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec3Array* normals = new osg::Vec3Array(1); osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,-1.0f,0.0f); (*normals)[0].set(0.0f,-1.0f,0.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4); osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,1.0f); (*tcoords)[0].set(0.0f,1.0f);
@ -289,16 +286,15 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
// set up the geode. // set up the geode.
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom); geode->addDrawable(geom);
front_page->addChild(geode); front_page->addChild(geode);
} }
@ -306,7 +302,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
{ {
float cut_off_distance = 8.0f; float cut_off_distance = 8.0f;
float max_visible_distance = 300.0f; float max_visible_distance = 300.0f;
osg::Vec3 center(width*0.5f,0.0f,height*0.5f); osg::Vec3 center(width*0.5f,0.0f,height*0.5f);
osgText::Text* text = new osgText::Text; osgText::Text* text = new osgText::Text;
@ -320,15 +316,15 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(text); geode->addDrawable(text);
osg::PagedLOD* pagedlod = new osg::PagedLOD; osg::PagedLOD* pagedlod = new osg::PagedLOD;
pagedlod->setCenter(center); pagedlod->setCenter(center);
pagedlod->setRadius(1.6f); pagedlod->setRadius(1.6f);
pagedlod->setNumChildrenThatCannotBeExpired(2); pagedlod->setNumChildrenThatCannotBeExpired(2);
pagedlod->setRange(0,max_visible_distance,1e7); pagedlod->setRange(0,max_visible_distance,1e7);
pagedlod->addChild(geode); pagedlod->addChild(geode);
pagedlod->setRange(1,cut_off_distance,max_visible_distance); pagedlod->setRange(1,cut_off_distance,max_visible_distance);
pagedlod->setFileName(1,rw->insertReference(frontFileName,256,width,height,false)); pagedlod->setFileName(1,rw->insertReference(frontFileName,256,width,height,false));
@ -337,8 +333,8 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
front_page->addChild(pagedlod); front_page->addChild(pagedlod);
} }
// set up back of page. // set up back of page.
osg::Group* back_page = new osg::Group; osg::Group* back_page = new osg::Group;
_switch->addChild(back_page); _switch->addChild(back_page);
@ -357,8 +353,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec3Array* normals = new osg::Vec3Array(1); osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,1.0f,0.0f); (*normals)[0].set(0.0f,1.0f,0.0f);
geom->setNormalArray(normals); geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4); osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(1.0f,1.0f); (*tcoords)[0].set(1.0f,1.0f);
@ -369,16 +364,15 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Vec4Array* colours = new osg::Vec4Array(1); osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f); (*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours); geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
// set up the geode. // set up the geode.
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom); geode->addDrawable(geom);
back_page->addChild(geode); back_page->addChild(geode);
} }
@ -386,7 +380,7 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
{ {
float cut_off_distance = 8.0f; float cut_off_distance = 8.0f;
float max_visible_distance = 300.0f; float max_visible_distance = 300.0f;
osg::Vec3 center(width*0.5f,0.0f,height*0.5f); osg::Vec3 center(width*0.5f,0.0f,height*0.5f);
osgText::Text* text = new osgText::Text; osgText::Text* text = new osgText::Text;
@ -400,15 +394,15 @@ Page::Page(Album* album, unsigned int pageNo, const std::string& frontFileName,
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(text); geode->addDrawable(text);
osg::PagedLOD* pagedlod = new osg::PagedLOD; osg::PagedLOD* pagedlod = new osg::PagedLOD;
pagedlod->setCenter(center); pagedlod->setCenter(center);
pagedlod->setRadius(1.6f); pagedlod->setRadius(1.6f);
pagedlod->setNumChildrenThatCannotBeExpired(2); pagedlod->setNumChildrenThatCannotBeExpired(2);
pagedlod->setRange(0,max_visible_distance,1e7); pagedlod->setRange(0,max_visible_distance,1e7);
pagedlod->addChild(geode); pagedlod->addChild(geode);
pagedlod->setRange(1,cut_off_distance,max_visible_distance); pagedlod->setRange(1,cut_off_distance,max_visible_distance);
pagedlod->setFileName(1,rw->insertReference(backFileName,256,width,height,true)); pagedlod->setFileName(1,rw->insertReference(backFileName,256,width,height,true));
@ -430,15 +424,15 @@ void Page::traverse(osg::NodeVisitor& nv)
if (framestamp) if (framestamp)
{ {
double t = framestamp->getSimulationTime(); double t = framestamp->getSimulationTime();
if (_rotation!=_targetRotation) if (_rotation!=_targetRotation)
{ {
if (t>=_targetTime) _rotation = _targetRotation; if (t>=_targetTime) _rotation = _targetRotation;
else _rotation += (_targetRotation-_rotation)*(t-_lastTimeTraverse)/(_targetTime-_lastTimeTraverse); else _rotation += (_targetRotation-_rotation)*(t-_lastTimeTraverse)/(_targetTime-_lastTimeTraverse);
dirtyBound(); dirtyBound();
} }
_lastTimeTraverse = t; _lastTimeTraverse = t;
} }
@ -458,7 +452,7 @@ Album::Album(osg::ArgumentParser& arguments, float width, float height)
for(int pos=1;pos<arguments.argc();++pos) for(int pos=1;pos<arguments.argc();++pos)
{ {
if (arguments.isString(pos)) if (arguments.isString(pos))
{ {
std::string filename(arguments[pos]); std::string filename(arguments[pos]);
if (osgDB::getLowerCaseFileExtension(filename)=="album") if (osgDB::getLowerCaseFileExtension(filename)=="album")
@ -469,7 +463,7 @@ Album::Album(osg::ArgumentParser& arguments, float width, float height)
g_ImageReaderWriter.get()->addPhotoArchive(photoArchive); g_ImageReaderWriter.get()->addPhotoArchive(photoArchive);
photoArchive->getImageFileNameList(fileList); photoArchive->getImageFileNameList(fileList);
} }
} }
else else
{ {
@ -477,17 +471,17 @@ Album::Album(osg::ArgumentParser& arguments, float width, float height)
} }
} }
} }
_radiusOfRings = 0.02; _radiusOfRings = 0.02;
_startAngleOfPages = 0.0f; _startAngleOfPages = 0.0f;
_deltaAngleBetweenPages = osg::PI/(float)fileList.size(); _deltaAngleBetweenPages = osg::PI/(float)fileList.size();
_group = new osg::Group; _group = new osg::Group;
_group->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace,osg::StateAttribute::ON); _group->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace,osg::StateAttribute::ON);
_backgroundStateSet = new osg::StateSet; _backgroundStateSet = new osg::StateSet;
_backgroundStateSet->setAttributeAndModes(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON); _backgroundStateSet->setAttributeAndModes(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
// load the images. // load the images.
unsigned int i; unsigned int i;
for(i=0;i<fileList.size();i+=2) for(i=0;i<fileList.size();i+=2)
@ -501,7 +495,7 @@ Album::Album(osg::ArgumentParser& arguments, float width, float height)
_group->addChild(page); _group->addChild(page);
} }
} }
setVisibility(); setVisibility();
} }
@ -524,7 +518,7 @@ bool Album::gotoPage(unsigned int pageNo, float timeToRotateBy)
_pages[i]->rotateTo(osg::PI,timeToRotateBy); _pages[i]->rotateTo(osg::PI,timeToRotateBy);
} }
_currentPageNo = pageNo; _currentPageNo = pageNo;
return true; return true;
} }
else if (pageNo<_currentPageNo) else if (pageNo<_currentPageNo)
@ -534,10 +528,10 @@ bool Album::gotoPage(unsigned int pageNo, float timeToRotateBy)
_pages[i]->rotateTo(0,timeToRotateBy); _pages[i]->rotateTo(0,timeToRotateBy);
} }
_currentPageNo = pageNo; _currentPageNo = pageNo;
return true; return true;
} }
return false; return false;
} }
@ -554,10 +548,10 @@ void Album::setVisibility()
((i+1)<_pages.size()?_pages[i+1]->rotating():false) || ((i+1)<_pages.size()?_pages[i+1]->rotating():false) ||
i==_currentPageNo-1 || i==_currentPageNo-1 ||
i==_pages.size()-1; i==_pages.size()-1;
_pages[i]->setPageVisible(front_visible,back_visible); _pages[i]->setPageVisible(front_visible,back_visible);
} }
} }
@ -569,13 +563,13 @@ class SlideEventHandler : public osgGA::GUIEventHandler
public: public:
SlideEventHandler(); SlideEventHandler();
META_Object(osgStereImageApp,SlideEventHandler); META_Object(osgStereImageApp,SlideEventHandler);
void set(Album* album, float timePerSlide, bool autoSteppingActive); void set(Album* album, float timePerSlide, bool autoSteppingActive);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&); virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void getUsage(osg::ApplicationUsage& usage) const; virtual void getUsage(osg::ApplicationUsage& usage) const;
protected: protected:
@ -604,8 +598,8 @@ void SlideEventHandler::set(Album* album, float timePerSlide, bool autoSteppingA
_album = album; _album = album;
_timePerSlide = timePerSlide; _timePerSlide = timePerSlide;
_autoSteppingActive = autoSteppingActive; _autoSteppingActive = autoSteppingActive;
} }
bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&) bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
@ -648,7 +642,7 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
_album->nextPage(ea.getTime()+1.0f); _album->nextPage(ea.getTime()+1.0f);
} }
} }
_album->setVisibility(); _album->setVisibility();
} }
@ -671,7 +665,7 @@ int main( int argc, char **argv )
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images."); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file [image_file]"); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file [image_file]");
@ -679,11 +673,11 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up."); arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--create <filename>","Create an photo archive of specified files"); arguments.getApplicationUsage()->addCommandLineOption("--create <filename>","Create an photo archive of specified files");
// construct the viewer. // construct the viewer.
osgViewer::Viewer viewer(arguments); osgViewer::Viewer viewer(arguments);
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// register the handler to add keyboard and mouse handling. // register the handler to add keyboard and mouse handling.
@ -706,7 +700,7 @@ int main( int argc, char **argv )
std::string archiveName; std::string archiveName;
while (arguments.read("--create",archiveName)) {} while (arguments.read("--create",archiveName)) {}
// any option left unread are converted into errors to write out later. // any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized(); arguments.reportRemainingOptionsAsUnrecognized();
@ -716,7 +710,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1) if (arguments.argc()<=1)
{ {
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@ -732,9 +726,9 @@ int main( int argc, char **argv )
{ {
if (arguments.isString(i)) fileNameList.push_back(std::string(arguments[i])); if (arguments.isString(i)) fileNameList.push_back(std::string(arguments[i]));
} }
PhotoArchive::buildArchive(archiveName,fileNameList); PhotoArchive::buildArchive(archiveName,fileNameList);
return 0; return 0;
} }
@ -746,7 +740,7 @@ int main( int argc, char **argv )
fovy = osg::DegreesToRadians(fovy); fovy = osg::DegreesToRadians(fovy);
double fovx = atan(tan(fovy*0.5)*aspectRatio)*2.0; double fovx = atan(tan(fovy*0.5)*aspectRatio)*2.0;
float radius = 1.0f; float radius = 1.0f;
float width = 2*radius*tan(fovx*0.5f); float width = 2*radius*tan(fovx*0.5f);
float height = 2*radius*tan(fovy*0.5f); float height = 2*radius*tan(fovy*0.5f);
@ -755,7 +749,7 @@ int main( int argc, char **argv )
// creat the scene from the file list. // creat the scene from the file list.
osg::ref_ptr<osg::Group> rootNode = album->getScene(); osg::ref_ptr<osg::Group> rootNode = album->getScene();
if (!rootNode) return 0; if (!rootNode) return 0;
@ -766,9 +760,9 @@ int main( int argc, char **argv )
// set up the SlideEventHandler. // set up the SlideEventHandler.
seh->set(album.get(),timeDelayBetweenSlides,autoSteppingActive); seh->set(album.get(),timeDelayBetweenSlides,autoSteppingActive);
viewer.realize(); viewer.realize();
// switch off the cursor // switch off the cursor
osgViewer::Viewer::Windows windows; osgViewer::Viewer::Windows windows;
viewer.getWindows(windows); viewer.getWindows(windows);