Added default implementations of new SceneGraphBuilder class
This commit is contained in:
parent
b2ead391b3
commit
a26bdd9446
96
include/osgUtil/SceneGraphBuilder
Normal file
96
include/osgUtil/SceneGraphBuilder
Normal file
@ -0,0 +1,96 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* 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
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGUTIL_SCENEGRAPHBUILDER
|
||||
#define OSGUTIL_SCENEGRAPHBUILDER 1
|
||||
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#include <osgUtil/Export>
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
/** A simplifier for reducing the number of traingles in osg::Geometry.
|
||||
*/
|
||||
class OSGUTIL_EXPORT SceneGraphBuilder
|
||||
{
|
||||
public:
|
||||
|
||||
SceneGraphBuilder();
|
||||
|
||||
void glPushMatrix();
|
||||
void glPopMatrix();
|
||||
void glLoadIdentity();
|
||||
void glLoadMatrixd(const GLdouble* m);
|
||||
void glMultMatrixd(const GLdouble* m);
|
||||
void glTranslated(GLdouble x, GLdouble y, GLdouble z);
|
||||
void glScaled(GLdouble x, GLdouble y, GLdouble z);
|
||||
void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
|
||||
|
||||
void glBlendFunc(GLenum srcFactor, GLenum dstFactor);
|
||||
void glCullFace(GLenum mode);
|
||||
void glDepthFunc(GLenum mode);
|
||||
void glFrontFace(GLenum mode);
|
||||
void glLineStipple(GLint factor, GLushort pattern);
|
||||
void glLineWidth(GLfloat lineWidth);
|
||||
void glPointSize(GLfloat pointSize);
|
||||
void glPolygonMode(GLenum face, GLenum mode);
|
||||
void glPolygonOffset(GLfloat factor, GLfloat units);
|
||||
void glPolygonStipple(GLubyte* mask);
|
||||
void glShadeModel(GLenum mode);
|
||||
|
||||
void glEnable(GLenum mode);
|
||||
void glDisable(GLenum mode);
|
||||
|
||||
void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
void glVertex3f(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glNormal3f(GLfloat x, GLfloat y, GLfloat z);
|
||||
|
||||
void glTexCoord1f(GLfloat x);
|
||||
void glTexCoord2f(GLfloat x, GLfloat y);
|
||||
void glTexCoord3f(GLfloat x, GLfloat y, GLfloat z);
|
||||
void glTexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
|
||||
void glBegin(GLenum mode);
|
||||
void glEnd();
|
||||
|
||||
osg::Node* getScene();
|
||||
osg::Node* takeScene();
|
||||
|
||||
protected:
|
||||
|
||||
typedef std::vector<osg::Matrixd> Matrices;
|
||||
|
||||
void newGeometry();
|
||||
|
||||
Matrices _matrixStack;
|
||||
osg::ref_ptr<osg::StateSet> _stateSet;
|
||||
|
||||
osg::Vec3f _normal;
|
||||
osg::Vec4f _color;
|
||||
osg::Vec4f _texCoord;
|
||||
|
||||
osg::ref_ptr<osg::Geometry> _currentGeometry;
|
||||
osg::ref_ptr<osg::Geode> _currentGeode;
|
||||
osg::ref_ptr<osg::MatrixTransform> _currentTransform;
|
||||
osg::ref_ptr<osg::Group> _group;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -34,6 +34,7 @@ SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/RenderStage
|
||||
${HEADER_PATH}/ReversePrimitiveFunctor
|
||||
${HEADER_PATH}/SceneView
|
||||
${HEADER_PATH}/SceneGraphBuilder
|
||||
${HEADER_PATH}/Simplifier
|
||||
${HEADER_PATH}/SmoothingVisitor
|
||||
${HEADER_PATH}/StateGraph
|
||||
@ -73,6 +74,7 @@ ADD_LIBRARY(${LIB_NAME}
|
||||
SceneView.cpp
|
||||
Simplifier.cpp
|
||||
SmoothingVisitor.cpp
|
||||
SceneGraphBuilder.cpp
|
||||
StateGraph.cpp
|
||||
Statistics.cpp
|
||||
TangentSpaceGenerator.cpp
|
||||
|
165
src/osgUtil/SceneGraphBuilder.cpp
Normal file
165
src/osgUtil/SceneGraphBuilder.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* 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
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#include <osgUtil/SceneGraphBuilder>
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osg/GLExtensions>
|
||||
#include <osg/GLObjects>
|
||||
#include <osg/Notify>
|
||||
#include <osg/Texture>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/ColorMatrix>
|
||||
#include <osg/LightModel>
|
||||
#include <osg/CollectOccludersVisitor>
|
||||
|
||||
#include <osg/GLU>
|
||||
|
||||
using namespace osgUtil;
|
||||
|
||||
SceneGraphBuilder::SceneGraphBuilder():
|
||||
_normal(0.0f,0.0f,1.0f),
|
||||
_color(1.0f,1.0f,1.0f,1.0f),
|
||||
_texCoord(0.f,0.0f,0.0f,0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPushMatrix()
|
||||
{
|
||||
if (_matrixStack.empty()) _matrixStack.push_back(osg::Matrixd());
|
||||
else _matrixStack.push_back(_matrixStack.back());
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPopMatrix()
|
||||
{
|
||||
if (!_matrixStack.empty()) _matrixStack.pop_back();
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glLoadIdentity()
|
||||
{
|
||||
if (_matrixStack.empty()) _matrixStack.push_back(osg::Matrixd());
|
||||
|
||||
_matrixStack.back().makeIdentity();
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glLoadMatrixd(const GLdouble* m)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glMultMatrixd(const GLdouble* m)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glTranslated(GLdouble x, GLdouble y, GLdouble z)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glScaled(GLdouble x, GLdouble y, GLdouble z)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
|
||||
{
|
||||
}
|
||||
void SceneGraphBuilder::glBlendFunc(GLenum srcFactor, GLenum dstFactor)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glCullFace(GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glDepthFunc(GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glFrontFace(GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glLineStipple(GLint factor, GLushort pattern)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glLineWidth(GLfloat lineWidth)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPointSize(GLfloat pointSize)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPolygonMode(GLenum face, GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPolygonOffset(GLfloat factor, GLfloat units)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glPolygonStipple(GLubyte* mask)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glShadeModel(GLenum mode)
|
||||
{
|
||||
}
|
||||
void SceneGraphBuilder::glEnable(GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glDisable(GLenum mode)
|
||||
{
|
||||
}
|
||||
void SceneGraphBuilder::glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glVertex3f(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glNormal3f(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
}
|
||||
void SceneGraphBuilder::glTexCoord1f(GLfloat x)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glTexCoord2f(GLfloat x, GLfloat y)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glTexCoord3f(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glTexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
{
|
||||
}
|
||||
void SceneGraphBuilder::glBegin(GLenum mode)
|
||||
{
|
||||
}
|
||||
|
||||
void SceneGraphBuilder::glEnd()
|
||||
{
|
||||
}
|
||||
|
||||
osg::Node* SceneGraphBuilder::getScene()
|
||||
{
|
||||
}
|
||||
|
||||
osg::Node* SceneGraphBuilder::takeScene()
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user