From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)."
This commit is contained in:
@@ -1393,7 +1393,7 @@ int main( int argc, char **argv )
|
||||
// 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()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in sceonds between the display of successive image pairs when in auto advance mode.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in seconds between the display of successive image pairs when in auto advance mode.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images.");
|
||||
@@ -1403,7 +1403,7 @@ int main( int argc, char **argv )
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
|
||||
// register the handler to add keyboard and mosue handling.
|
||||
// register the handler to add keyboard and mouse handling.
|
||||
GameEventHandler* seh = new GameEventHandler();
|
||||
viewer.addEventHandler(seh);
|
||||
|
||||
@@ -1421,7 +1421,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -1287,7 +1287,7 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ DePee::DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned
|
||||
_quadGeode = Utility::getCanvasQuad(_width, _height);
|
||||
|
||||
|
||||
//!!!Getting problems if assigning unit to texture in depth peeling subraph and removing depth peeling steps!!!
|
||||
//!!!Getting problems if assigning unit to texture in depth peeling subgraph and removing depth peeling steps!!!
|
||||
//That's why it is done here
|
||||
osg::StateSet* stateset = _parent->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(1, _normalDepthMap0.get(), osg::StateAttribute::ON);
|
||||
@@ -464,7 +464,7 @@ bool DePee::createEdgeMap(bool first)
|
||||
|
||||
znear *= 0.9f;
|
||||
zfar *= 1.1f;
|
||||
|
||||
|
||||
|
||||
// set up projection.
|
||||
//_dePeePasses.back()->Cameras.top()->setProjectionMatrixAsFrustum(-proj_right,proj_right,-proj_top,proj_top,znear,zfar);
|
||||
@@ -472,7 +472,7 @@ bool DePee::createEdgeMap(bool first)
|
||||
|
||||
//set view
|
||||
_dePeePasses.back()->Cameras[EDGE_MAP]->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||
|
||||
|
||||
_dePeePasses.back()->Cameras[EDGE_MAP]->setViewMatrixAsLookAt(osg::Vec3(0.0f,0.0f,2.0f)*bs.radius(), osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0f,1.0f,0.0f));
|
||||
|
||||
// set viewport
|
||||
@@ -483,7 +483,7 @@ bool DePee::createEdgeMap(bool first)
|
||||
|
||||
// tell the camera to use OpenGL frame buffer object
|
||||
_dePeePasses.back()->Cameras[EDGE_MAP]->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER);
|
||||
|
||||
|
||||
//switch lighting off
|
||||
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
|
||||
|
||||
@@ -501,7 +501,7 @@ bool DePee::createEdgeMap(bool first)
|
||||
stateset->addUniform( new osg::Uniform("edgeMap", 3));
|
||||
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE |
|
||||
osg::StateAttribute::OFF);
|
||||
osg::StateAttribute::OFF);
|
||||
//setup shader
|
||||
stateset->setAttributeAndModes(_edgeMapProgram.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
|
||||
stateset->addUniform(new osg::Uniform("width", (float) _width));
|
||||
@@ -551,7 +551,7 @@ bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
|
||||
float znear = 1.0f*bs.radius();
|
||||
float zfar = 3.0f*bs.radius();
|
||||
|
||||
// 2:1 aspect ratio as per flag geomtry below.
|
||||
// 2:1 aspect ratio as per flag geometry below.
|
||||
float projTop = 0.25f*znear;
|
||||
float projRight = projTop * ((double)_width/(double)_height);
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -323,7 +323,7 @@ int main(int argc, char *argv[])
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors()) {
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
|
||||
|
||||
@@ -39,17 +39,17 @@
|
||||
|
||||
// This demos uses the illustrates how to creates the various different types of geometry that
|
||||
// the osg::Geometry class can represent. This demos uses the OpenGL red books diagram of different
|
||||
// OpenGL Primitives as a template for all the equivilant OpenSceneGraph Primitives. The OpenSceneGraph
|
||||
// OpenGL Primitives as a template for all the equivalent OpenSceneGraph Primitives. The OpenSceneGraph
|
||||
// wraps OpenGL very thinly so uses all the same enum and naming conventions. The coordinate data is also
|
||||
// wrapped around OpenGL's vertex arrays and draw arrays/elements calls. Familarity with
|
||||
// wrapped around OpenGL's vertex arrays and draw arrays/elements calls. Familiarity with
|
||||
// OpenGL will help understand the the osg::Geometry class which encapsulate all this, or if you
|
||||
// havn't learnt OpenGL yet, learning osg::Geometry will help you understand how OpenGL
|
||||
// havn't learned OpenGL yet, learning osg::Geometry will help you understand how OpenGL
|
||||
// works!
|
||||
|
||||
// The osg::Geometry class "is a" subclass of osg::Drawable base class, so is an object that provides
|
||||
// a draw method for drawing objects in the scene. osg::Geometry contains all the vertex, normal
|
||||
// color and texture coordate arrays required to specify the coordinates of your objects, and the
|
||||
// primtives join these coordinates together as the points, lines or surfaces that you will see
|
||||
// color and texture coordinate arrays required to specify the coordinates of your objects, and the
|
||||
// primitives join these coordinates together as the points, lines or surfaces that you will see
|
||||
// rendered on your screen.
|
||||
//
|
||||
// This demo is split into two functions, the createScene() function which creates the scene graph
|
||||
@@ -67,7 +67,7 @@ struct NormalPrint
|
||||
}
|
||||
};
|
||||
|
||||
// decompose Drawable primtives into triangles, print out these triangles and computed normals.
|
||||
// decompose Drawable primitives into triangles, print out these triangles and computed normals.
|
||||
void printTriangles(const std::string& name, osg::Drawable& drawable)
|
||||
{
|
||||
std::cout<<name<<std::endl;
|
||||
@@ -85,19 +85,19 @@ osg::Node* createScene()
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
|
||||
// follows are separate blocks for creating POINTS, LINES, LINE_STRIP, LINE_LOOP, POLYGON, QUADS,
|
||||
// QUAD_STRIP, TRIANGLES, TRIANGLE_STRIP and TRIANGLE_FAN primtives. A image of these primtives
|
||||
// are provided in the distribution : OpenSceneGraph-Data/Images/primtives.gif.
|
||||
// QUAD_STRIP, TRIANGLES, TRIANGLE_STRIP and TRIANGLE_FAN primitives. A image of these primitives
|
||||
// are provided in the distribution : OpenSceneGraph-Data/Images/primitives.gif.
|
||||
|
||||
|
||||
// create POINTS
|
||||
{
|
||||
// create Geometry object to store all the vetices and points primtive.
|
||||
// create Geometry object to store all the vertices and points primitive.
|
||||
osg::Geometry* pointsGeom = new osg::Geometry();
|
||||
|
||||
// create a Vec3Array and add to it all my coordinates.
|
||||
// Like all the *Array variants (see include/osg/Array) , Vec3Array is derivied from both osg::Array
|
||||
// Like all the *Array variants (see include/osg/Array) , Vec3Array is derived from both osg::Array
|
||||
// and std::vector<>. osg::Array's are reference counted and hence sharable,
|
||||
// which std::vector<> provides all the convinience, flexibility and robustness
|
||||
// which std::vector<> provides all the convenience, flexibility and robustness
|
||||
// of the most popular of all STL containers.
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array;
|
||||
vertices->push_back(osg::Vec3(-1.02168, -2.15188e-09, 0.885735));
|
||||
@@ -112,13 +112,13 @@ osg::Node* createScene()
|
||||
|
||||
|
||||
// create the color of the geometry, one single for the whole geometry.
|
||||
// for consitency of design even one single color must added as an element
|
||||
// for consistency of design even one single color must added as an element
|
||||
// in a color array.
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
// add a white color, colors take the form r,g,b,a with 0.0 off, 1.0 full on.
|
||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||
|
||||
// pass the color arry to points geometry, note the binding to tell the geometry
|
||||
// pass the color array to points geometry, note the binding to tell the geometry
|
||||
// that only use one color for the whole object.
|
||||
pointsGeom->setColorArray(colors);
|
||||
pointsGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
@@ -131,24 +131,24 @@ osg::Node* createScene()
|
||||
pointsGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
|
||||
|
||||
// create and add a DrawArray Primitive (see include/osg/Primtive). The first
|
||||
// paramter passed to the DrawArrays constructor is the Primtive::Mode which
|
||||
// create and add a DrawArray Primitive (see include/osg/Primitive). The first
|
||||
// parameter passed to the DrawArrays constructor is the Primitive::Mode which
|
||||
// in this case is POINTS (which has the same value GL_POINTS), the second
|
||||
// parameter is the index position into the vertex array of the first point
|
||||
// to draw, and the third parameter is the number of points to draw.
|
||||
pointsGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,vertices->size()));
|
||||
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(pointsGeom);
|
||||
}
|
||||
|
||||
// create LINES
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* linesGeom = new osg::Geometry();
|
||||
|
||||
// this time we'll prealloacte the vertex array to the size we
|
||||
// this time we'll preallocate the vertex array to the size we
|
||||
// need and then simple set them as array elements, 8 points
|
||||
// makes 4 line segments.
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array(8);
|
||||
@@ -165,7 +165,7 @@ osg::Node* createScene()
|
||||
// pass the created vertex array to the points geometry object.
|
||||
linesGeom->setVertexArray(vertices);
|
||||
|
||||
// set the colors as before, plus using the aobve
|
||||
// set the colors as before, plus using the above
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||
linesGeom->setColorArray(colors);
|
||||
@@ -184,16 +184,16 @@ osg::Node* createScene()
|
||||
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8));
|
||||
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(linesGeom);
|
||||
}
|
||||
|
||||
// create LINE_STRIP
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* linesGeom = new osg::Geometry();
|
||||
|
||||
// this time we'll prealloacte the vertex array to the size
|
||||
// this time we'll preallocate the vertex array to the size
|
||||
// and then use an iterator to fill in the values, a bit perverse
|
||||
// but does demonstrate that we have just a standard std::vector underneath.
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array(5);
|
||||
@@ -207,7 +207,7 @@ osg::Node* createScene()
|
||||
// pass the created vertex array to the points geometry object.
|
||||
linesGeom->setVertexArray(vertices);
|
||||
|
||||
// set the colors as before, plus using the aobve
|
||||
// set the colors as before, plus using the above
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||
linesGeom->setColorArray(colors);
|
||||
@@ -226,16 +226,16 @@ osg::Node* createScene()
|
||||
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,5));
|
||||
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(linesGeom);
|
||||
}
|
||||
|
||||
// create LINE_LOOP
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* linesGeom = new osg::Geometry();
|
||||
|
||||
// this time we'll a C arrays to initilize the vertices.
|
||||
// this time we'll a C arrays to initialize the vertices.
|
||||
|
||||
osg::Vec3 myCoords[] =
|
||||
{
|
||||
@@ -254,7 +254,7 @@ osg::Node* createScene()
|
||||
// pass the created vertex array to the points geometry object.
|
||||
linesGeom->setVertexArray(vertices);
|
||||
|
||||
// set the colors as before, plus using the aobve
|
||||
// set the colors as before, plus using the above
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||
linesGeom->setColorArray(colors);
|
||||
@@ -273,7 +273,7 @@ osg::Node* createScene()
|
||||
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,numCoords));
|
||||
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(linesGeom);
|
||||
}
|
||||
|
||||
@@ -305,11 +305,11 @@ osg::Node* createScene()
|
||||
|
||||
// create POLYGON
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
// this time we'll a C arrays to initilize the vertices.
|
||||
// note, anticlockwsie ordering.
|
||||
// this time we'll a C arrays to initialize the vertices.
|
||||
// note, anticlockwise ordering.
|
||||
// note II, OpenGL polygons must be convex plan polygons, otherwise
|
||||
// undefined results will occur. If you have concave polygons or ones
|
||||
// that cross over themselves then use the osgUtil::Tessellator to fix
|
||||
@@ -346,17 +346,17 @@ osg::Node* createScene()
|
||||
|
||||
printTriangles("Polygon",*polyGeom);
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(polyGeom);
|
||||
}
|
||||
|
||||
|
||||
// create QUADS
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
// note, anticlockwsie ordering.
|
||||
// note, anticlockwise ordering.
|
||||
osg::Vec3 myCoords[] =
|
||||
{
|
||||
osg::Vec3(0.0247182, 0.0f, -0.156548),
|
||||
@@ -394,13 +394,13 @@ osg::Node* createScene()
|
||||
|
||||
printTriangles("Quads",*polyGeom);
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(polyGeom);
|
||||
}
|
||||
|
||||
// create QUAD_STRIP
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
// note, first coord at top, second at bottom, reverse to that buggy OpenGL image..
|
||||
@@ -443,25 +443,25 @@ osg::Node* createScene()
|
||||
|
||||
printTriangles("Quads strip",*polyGeom);
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(polyGeom);
|
||||
}
|
||||
|
||||
// create TRIANGLES, TRIANGLE_STRIP and TRIANGLE_FAN all in one Geometry/
|
||||
{
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
// note, first coord at top, second at bottom, reverse to that buggy OpenGL image..
|
||||
osg::Vec3 myCoords[] =
|
||||
{
|
||||
// TRIANGLES 6 vertices, v0..v5
|
||||
// note in aniclockwise order.
|
||||
// note in anticlockwise order.
|
||||
osg::Vec3(-1.12056, -2.15188e-09, -0.840418),
|
||||
osg::Vec3(-0.95165, -2.15188e-09, -0.840418),
|
||||
osg::Vec3(-1.11644, 9.18133e-09, -0.716827),
|
||||
|
||||
// note in aniclockwise order.
|
||||
// note in anticlockwise order.
|
||||
osg::Vec3(-0.840418, 9.18133e-09, -0.778623),
|
||||
osg::Vec3(-0.622074, 9.18133e-09, -0.613835),
|
||||
osg::Vec3(-1.067, 9.18133e-09, -0.609715),
|
||||
@@ -478,7 +478,7 @@ osg::Node* createScene()
|
||||
osg::Vec3(0.280139, -2.15188e-09, -0.823939),
|
||||
|
||||
// TRIANGLE FAN 5 vertices, v12..v16
|
||||
// note defined in anticlockwsie order.
|
||||
// note defined in anticlockwise order.
|
||||
osg::Vec3(0.844538, 9.18133e-09, -0.712708),
|
||||
osg::Vec3(1.0258, 9.18133e-09, -0.799221),
|
||||
osg::Vec3(1.03816, -2.15188e-09, -0.692109),
|
||||
@@ -518,7 +518,7 @@ osg::Node* createScene()
|
||||
|
||||
printTriangles("Triangles/Strip/Fan",*polyGeom);
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(polyGeom);
|
||||
}
|
||||
|
||||
@@ -566,10 +566,10 @@ osg::Node* createBackground()
|
||||
if (!image) return NULL;
|
||||
|
||||
|
||||
// create Geometry object to store all the vetices and lines primtive.
|
||||
// create Geometry object to store all the vertices and lines primitive.
|
||||
osg::Geometry* polyGeom = new osg::Geometry();
|
||||
|
||||
// note, anticlockwsie ordering.
|
||||
// note, anticlockwise ordering.
|
||||
osg::Vec3 myCoords[] =
|
||||
{
|
||||
osg::Vec3(-1.22908f,0.0f,1.0f),
|
||||
@@ -620,9 +620,9 @@ osg::Node* createBackground()
|
||||
|
||||
int numIndices = sizeof(myIndices)/sizeof(unsigned short);
|
||||
|
||||
// Theere are three variants of the DrawElements osg::Primitive, UByteDrawElements which
|
||||
// contains unsigned char indicies, UShortDrawElements which contains unsigned short indices,
|
||||
// and UIntDrawElements whcih contains ... unsigned int indices.
|
||||
// There are three variants of the DrawElements osg::Primitive, UByteDrawElements which
|
||||
// contains unsigned char indices, UShortDrawElements which contains unsigned short indices,
|
||||
// and UIntDrawElements which contains ... unsigned int indices.
|
||||
// The first parameter to DrawElements is
|
||||
polyGeom->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::QUADS,numIndices,myIndices));
|
||||
|
||||
@@ -642,12 +642,12 @@ osg::Node* createBackground()
|
||||
// create the Geode (Geometry Node) to contain all our osg::Geometry objects.
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
|
||||
// add the points geomtry to the geode.
|
||||
// add the points geometry to the geode.
|
||||
geode->addDrawable(polyGeom);
|
||||
|
||||
//return geode;
|
||||
|
||||
// create a tranform to move the background back and forward with.
|
||||
// create a transform to move the background back and forward with.
|
||||
|
||||
osg::MatrixTransform* transform = new osg::MatrixTransform();
|
||||
transform->setUpdateCallback(new MyTransformCallback(1.0f));
|
||||
|
||||
@@ -106,7 +106,7 @@ void CreateHouses()
|
||||
// coordIndices
|
||||
osg::UByteArray* coordIndices = new osg::UByteArray(48,indices);
|
||||
|
||||
// share the primtive set.
|
||||
// share the primitive set.
|
||||
osg::PrimitiveSet* primitives = new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,48);
|
||||
|
||||
for (int q = 0; q < HOUSES_SIZE; q++)
|
||||
|
||||
@@ -179,7 +179,7 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb, const std::string& label,
|
||||
text->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
text->setCharacterSize((bb.zMax()-bb.zMin())*1.0f);
|
||||
text->setPosition(bb.center()-osg::Vec3((bb.xMax()-bb.xMin()),-(bb.yMax()-bb.yMin())*0.5f,(bb.zMax()-bb.zMin())*0.1f));
|
||||
//text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's orignal OSG colour
|
||||
//text->setColor(osg::Vec4(0.37f,0.48f,0.67f,1.0f)); // Neil's original OSG colour
|
||||
text->setColor(osg::Vec4(0.20f,0.45f,0.60f,1.0f)); // OGL logo colour
|
||||
text->setText(label);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::ImageStream> > ImageStreamList;
|
||||
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -454,7 +454,7 @@ int main(int argc, char** argv)
|
||||
// add the record camera path handler
|
||||
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -240,7 +240,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -676,7 +676,7 @@ int main( int argc, char **argv )
|
||||
// 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()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file [image_file]");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in sceonds between the display of successive image pairs when in auto advance mode.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in seconds between the display of successive image pairs when in auto advance mode.");
|
||||
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("--create <filename>","Create an photo archive of specified files");
|
||||
@@ -687,7 +687,7 @@ int main( int argc, char **argv )
|
||||
|
||||
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
|
||||
// register the handler to add keyboard and mosue handling.
|
||||
// register the handler to add keyboard and mouse handling.
|
||||
SlideEventHandler* seh = new SlideEventHandler();
|
||||
viewer.addEventHandler(seh);
|
||||
|
||||
@@ -711,7 +711,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -727,7 +727,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -149,7 +149,7 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// call back which cretes a deformation field to oscilate the model.
|
||||
// call back which creates a deformation field to oscillate the model.
|
||||
class MyGeometryCallback :
|
||||
public osg::Drawable::UpdateCallback,
|
||||
public osg::Drawable::AttributeFunctor
|
||||
@@ -323,7 +323,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi
|
||||
float znear = 1.0f*bs.radius();
|
||||
float zfar = 3.0f*bs.radius();
|
||||
|
||||
// 2:1 aspect ratio as per flag geomtry below.
|
||||
// 2:1 aspect ratio as per flag geometry below.
|
||||
float proj_top = 0.25f*znear;
|
||||
float proj_right = 0.5f*znear;
|
||||
|
||||
@@ -360,11 +360,11 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph, unsigned tex_width, unsi
|
||||
|
||||
// Rather than attach the texture directly to illustrate the texture's ability to
|
||||
// detect an image update and to subload the image onto the texture. You needn't
|
||||
// do this when using an Image for copying to, as a seperate camera->attach(..)
|
||||
// would suffice as well, but we'll do it the long way round here just for demonstation
|
||||
// do this when using an Image for copying to, as a separate camera->attach(..)
|
||||
// would suffice as well, but we'll do it the long way round here just for demonstration
|
||||
// purposes (long way round meaning we'll need to copy image to main memory, then
|
||||
// copy it back to the graphics card to the texture in one frame).
|
||||
// The long way round allows us to mannually modify the copied image via the callback
|
||||
// The long way round allows us to manually modify the copied image via the callback
|
||||
// and then let this modified image by reloaded back.
|
||||
texture->setImage(0, image);
|
||||
}
|
||||
@@ -397,11 +397,11 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--fbo","Use Frame Buffer Object for render to texture, where supported.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--fb","Use FrameBuffer for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Use Pixel Buffer for render to texture, where supported.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--window","Use a seperate Window for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--window","Use a separate Window for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--image","Render to an image, then apply a post draw callback to it, and use this image to update a texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--texture-rectangle","Use osg::TextureRectangle for doing the render to texure to.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--texture-rectangle","Use osg::TextureRectangle for doing the render to texture to.");
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
@@ -142,7 +142,7 @@ class UpdateCameraAndTexGenCallback : public osg::NodeCallback
|
||||
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
// first update subgraph to make sure objects are all moved into postion
|
||||
// first update subgraph to make sure objects are all moved into position
|
||||
traverse(node,nv);
|
||||
|
||||
// compute the position of the center of the reflector subgraph
|
||||
@@ -195,7 +195,7 @@ class TexMatCullCallback : public osg::NodeCallback
|
||||
|
||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
{
|
||||
// first update subgraph to make sure objects are all moved into postion
|
||||
// first update subgraph to make sure objects are all moved into position
|
||||
traverse(node,nv);
|
||||
|
||||
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
|
||||
@@ -303,7 +303,7 @@ int main(int argc, char** argv)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--fbo","Use Frame Buffer Object for render to texture, where supported.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--fb","Use FrameBuffer for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Use Pixel Buffer for render to texture, where supported.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--window","Use a seperate Window for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--window","Use a separate Window for render to texture.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture");
|
||||
|
||||
@@ -333,7 +333,7 @@ int main(int argc, char** argv)
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -350,7 +350,7 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -681,7 +681,7 @@ int main(int argc, char **argv)
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -459,7 +459,7 @@ int main( int argc, char **argv )
|
||||
// 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()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in sceonds between the display of successive image pairs when in auto advance mode.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in seconds between the display of successive image pairs when in auto advance mode.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images.");
|
||||
@@ -475,7 +475,7 @@ int main( int argc, char **argv )
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
// register the handler to add keyboard and mosue handling.
|
||||
// register the handler to add keyboard and mouse handling.
|
||||
SlideEventHandler* seh = new SlideEventHandler();
|
||||
viewer.addEventHandler(seh);
|
||||
|
||||
@@ -526,7 +526,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
@@ -559,7 +559,7 @@ int main( int argc, char **argv )
|
||||
float height = 2*radius*tan(osg::DegreesToRadians(fovy)*0.5f);
|
||||
float length = osg::PI*radius; // half a cylinder.
|
||||
|
||||
// use a texure matrix to control the placement of the image.
|
||||
// use a texture matrix to control the placement of the image.
|
||||
osg::TexMat* texmatLeft = new osg::TexMat;
|
||||
osg::TexMat* texmatRight = new osg::TexMat;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ osg::StateSet* create1DTextureStateToDecorate(osg::Node* loadedModel)
|
||||
|
||||
int noPixels = 1024;
|
||||
|
||||
// allocate the image data, noPixels x 1 x 1 with 4 rgba floats - equivilant to a Vec4!
|
||||
// allocate the image data, noPixels x 1 x 1 with 4 rgba floats - equivalent to a Vec4!
|
||||
image->allocateImage(noPixels,1,1,GL_RGBA,GL_FLOAT);
|
||||
image->setInternalTextureFormat(GL_RGBA);
|
||||
|
||||
|
||||
@@ -478,7 +478,7 @@ int main( int argc, char** argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
|
||||
@@ -262,7 +262,7 @@ struct ProcessRow
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// alpha luminiance sources..
|
||||
// alpha luminance sources..
|
||||
virtual void LA_to_A(unsigned int num, unsigned char* source, unsigned char* dest) const
|
||||
{
|
||||
for(unsigned int i=0;i<num;++i)
|
||||
@@ -757,7 +757,7 @@ osg::Node* createShaderModel(osg::ref_ptr<osg::Image>& image_3d, osg::ref_ptr<os
|
||||
// set up the 3d texture itself,
|
||||
// note, well set the filtering up so that mip mapping is disabled,
|
||||
// gluBuild3DMipsmaps doesn't do a very good job of handled the
|
||||
// inbalanced dimensions of the 256x256x4 texture.
|
||||
// imbalanced dimensions of the 256x256x4 texture.
|
||||
osg::Texture3D* texture3D = new osg::Texture3D;
|
||||
texture3D->setFilter(osg::Texture3D::MIN_FILTER,osg::Texture3D::LINEAR);
|
||||
texture3D->setFilter(osg::Texture3D::MAG_FILTER,osg::Texture3D::LINEAR);
|
||||
@@ -1138,7 +1138,7 @@ osg::Node* createModel(osg::ref_ptr<osg::Image>& image_3d, osg::ref_ptr<osg::Ima
|
||||
// set up the 3d texture itself,
|
||||
// note, well set the filtering up so that mip mapping is disabled,
|
||||
// gluBuild3DMipsmaps doesn't do a very good job of handled the
|
||||
// inbalanced dimensions of the 256x256x4 texture.
|
||||
// imbalanced dimensions of the 256x256x4 texture.
|
||||
osg::Texture3D* texture3D = new osg::Texture3D;
|
||||
texture3D->setFilter(osg::Texture3D::MIN_FILTER,osg::Texture3D::LINEAR);
|
||||
texture3D->setFilter(osg::Texture3D::MAG_FILTER,osg::Texture3D::LINEAR);
|
||||
@@ -1332,7 +1332,7 @@ osg::Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent
|
||||
{
|
||||
for(int t=0;t<sizeT;++t)
|
||||
{
|
||||
// reset the indices to begining
|
||||
// reset the indices to beginning
|
||||
readOp._pos = 0;
|
||||
writeOp._pos = 0;
|
||||
|
||||
@@ -1562,14 +1562,14 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occured when parsing the program aguments.
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// assume remaining argments are file names of textures.
|
||||
// assume remaining arguments are file names of textures.
|
||||
for(int pos=1;pos<arguments.argc() && !image_3d;++pos)
|
||||
{
|
||||
if (!arguments.isOption(pos))
|
||||
|
||||
Reference in New Issue
Block a user