Added mechanism for registering proxy objects in the .osg plugin in a way that is compatible with static linking.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
USE_OSGPLUGIN(ive);
|
||||
USE_OSGPLUGIN(freetype);
|
||||
USE_OSGPLUGIN(osg);
|
||||
USE_OSGPLUGIN(rgb);
|
||||
USE_OSGPLUGIN(OpenFlight);
|
||||
|
||||
// include the platform specific GraphicsWindow implementation.
|
||||
|
||||
@@ -697,6 +697,15 @@ struct PluginFunctionProxy
|
||||
extern "C" void osgdb_##ext(void) {} \
|
||||
static osgDB::RegisterReaderWriterProxy<classname> g_proxy_##classname;
|
||||
|
||||
|
||||
#define USE_DOTOSGWRAPPER(classname) \
|
||||
extern "C" void dotosgwrapper_##classname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_dotosgwrapper_##classname(dotosgwrapper_##classname);
|
||||
|
||||
#define REGISTER_DOTOSGWRAPPER(classname) \
|
||||
extern "C" void dotosgwrapper_##classname(void) {} \
|
||||
static osgDB::RegisterDotOsgWrapperProxy dotosgwrapper_proxy_##classname
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ bool AlphaFunc_matchFuncStr(const char* str,AlphaFunc::ComparisonFunction& func)
|
||||
const char* AlphaFunc_getFuncStr(AlphaFunc::ComparisonFunction func);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_AlphaFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(AlphaFunc)
|
||||
(
|
||||
new osg::AlphaFunc,
|
||||
"AlphaFunc",
|
||||
|
||||
@@ -17,7 +17,7 @@ bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
osgDB::RegisterDotOsgWrapperProxy AnimationPath_Proxy
|
||||
REGISTER_DOTOSGWRAPPER(AnimationPath)
|
||||
(
|
||||
new osg::AnimationPath,
|
||||
"AnimationPath",
|
||||
|
||||
@@ -13,7 +13,7 @@ bool AutoTransform_readLocalData(Object& obj, Input& fr);
|
||||
bool AutoTransform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_AutoTransformProxy
|
||||
REGISTER_DOTOSGWRAPPER(AutoTransform)
|
||||
(
|
||||
new osg::AutoTransform,
|
||||
"AutoTransform",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Billboard_readLocalData(Object& obj, Input& fr);
|
||||
bool Billboard_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_BillboardProxy
|
||||
REGISTER_DOTOSGWRAPPER(Billboard)
|
||||
(
|
||||
new osg::Billboard,
|
||||
"Billboard",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool BlendColor_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
|
||||
RegisterDotOsgWrapperProxy g_BlendColorProxy
|
||||
REGISTER_DOTOSGWRAPPER(BlendColor)
|
||||
(
|
||||
new osg::BlendColor,
|
||||
"BlendColor",
|
||||
|
||||
@@ -15,7 +15,7 @@ bool BlendEquation_matchModeStr(const char* str,int& mode);
|
||||
const char* BlendEquation_getModeStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_BlendEquationProxy
|
||||
REGISTER_DOTOSGWRAPPER(BlendEquation)
|
||||
(
|
||||
new osg::BlendEquation,
|
||||
"BlendEquation",
|
||||
|
||||
@@ -16,7 +16,7 @@ const char* BlendFunc_getModeStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
|
||||
RegisterDotOsgWrapperProxy g_TransparencyProxy
|
||||
REGISTER_DOTOSGWRAPPER(Transparency)
|
||||
(
|
||||
new osg::BlendFunc,
|
||||
"Transparency",
|
||||
@@ -25,7 +25,7 @@ RegisterDotOsgWrapperProxy g_TransparencyProxy
|
||||
&BlendFunc_writeLocalData
|
||||
);
|
||||
|
||||
RegisterDotOsgWrapperProxy g_BlendFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(BlendFunc)
|
||||
(
|
||||
new osg::BlendFunc,
|
||||
"BlendFunc",
|
||||
|
||||
81
src/osgPlugins/osg/Box.cpp
Normal file
81
src/osgPlugins/osg/Box.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Box_readLocalData(Object& obj, Input& fr);
|
||||
bool Box_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Box)
|
||||
(
|
||||
new osg::Box,
|
||||
"Box",
|
||||
"Object Box",
|
||||
&Box_readLocalData,
|
||||
&Box_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Box_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Box& box = static_cast<Box&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
box.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("HalfLengths %f %f %f"))
|
||||
{
|
||||
osg::Vec3 lenghts;
|
||||
fr[1].getFloat(lenghts.x());
|
||||
fr[2].getFloat(lenghts.y());
|
||||
fr[3].getFloat(lenghts.z());
|
||||
box.setHalfLengths(lenghts);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
box.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Box_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Box& box = static_cast<const Box&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<box.getCenter()<<std::endl;
|
||||
fw.indent()<<"HalfLengths "<<box.getHalfLengths()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<box.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2,86 +2,92 @@
|
||||
|
||||
|
||||
SET(TARGET_SRC
|
||||
AlphaFunc.cpp
|
||||
AnimationPath.cpp
|
||||
AutoTransform.cpp
|
||||
Billboard.cpp
|
||||
BlendColor.cpp
|
||||
BlendFunc.cpp
|
||||
BlendEquation.cpp
|
||||
Camera.cpp
|
||||
CameraView.cpp
|
||||
ClearNode.cpp
|
||||
ClipNode.cpp
|
||||
ClipPlane.cpp
|
||||
ClusterCullingCallback.cpp
|
||||
ColorMask.cpp
|
||||
ColorMatrix.cpp
|
||||
ConvexPlanarOccluder.cpp
|
||||
CoordinateSystemNode.cpp
|
||||
CullFace.cpp
|
||||
Depth.cpp
|
||||
Drawable.cpp
|
||||
EllipsoidModel.cpp
|
||||
Fog.cpp
|
||||
FragmentProgram.cpp
|
||||
FrontFace.cpp
|
||||
Geode.cpp
|
||||
Geometry.cpp
|
||||
Group.cpp
|
||||
Image.cpp
|
||||
ImageSequence.cpp
|
||||
LOD.cpp
|
||||
Light.cpp
|
||||
LightModel.cpp
|
||||
LightSource.cpp
|
||||
LineStipple.cpp
|
||||
LineWidth.cpp
|
||||
Material.cpp
|
||||
Matrix.cpp
|
||||
MatrixTransform.cpp
|
||||
Node.cpp
|
||||
NodeCallback.cpp
|
||||
Object.cpp
|
||||
OccluderNode.cpp
|
||||
OcclusionQueryNode.cpp
|
||||
PagedLOD.cpp
|
||||
Point.cpp
|
||||
PointSprite.cpp
|
||||
PolygonMode.cpp
|
||||
PolygonOffset.cpp
|
||||
PositionAttitudeTransform.cpp
|
||||
Program.cpp
|
||||
Projection.cpp
|
||||
ProxyNode.cpp
|
||||
ReaderWriterOSG.cpp
|
||||
Scissor.cpp
|
||||
Sequence.cpp
|
||||
ShadeModel.cpp
|
||||
Shader.cpp
|
||||
Shape.cpp
|
||||
ShapeDrawable.cpp
|
||||
StateAttribute.cpp
|
||||
StateSet.cpp
|
||||
Stencil.cpp
|
||||
Switch.cpp
|
||||
TessellationHints.cpp
|
||||
TexEnv.cpp
|
||||
TexEnvCombine.cpp
|
||||
TexEnvFilter.cpp
|
||||
TexGen.cpp
|
||||
TexGenNode.cpp
|
||||
TexMat.cpp
|
||||
Texture.cpp
|
||||
Texture1D.cpp
|
||||
Texture2D.cpp
|
||||
Texture3D.cpp
|
||||
TextureCubeMap.cpp
|
||||
TextureRectangle.cpp
|
||||
Transform.cpp
|
||||
Uniform.cpp
|
||||
VertexProgram.cpp
|
||||
Viewport.cpp
|
||||
AlphaFunc.cpp
|
||||
AnimationPath.cpp
|
||||
AutoTransform.cpp
|
||||
Billboard.cpp
|
||||
BlendColor.cpp
|
||||
BlendEquation.cpp
|
||||
BlendFunc.cpp
|
||||
Box.cpp
|
||||
Camera.cpp
|
||||
CameraView.cpp
|
||||
Capsule.cpp
|
||||
ClearNode.cpp
|
||||
ClipNode.cpp
|
||||
ClipPlane.cpp
|
||||
ClusterCullingCallback.cpp
|
||||
ColorMask.cpp
|
||||
ColorMatrix.cpp
|
||||
CompositeShape.cpp
|
||||
Cone.cpp
|
||||
ConvexPlanarOccluder.cpp
|
||||
CoordinateSystemNode.cpp
|
||||
Cylinder.cpp
|
||||
CullFace.cpp
|
||||
Depth.cpp
|
||||
Drawable.cpp
|
||||
EllipsoidModel.cpp
|
||||
Fog.cpp
|
||||
FragmentProgram.cpp
|
||||
FrontFace.cpp
|
||||
Geode.cpp
|
||||
Geometry.cpp
|
||||
Group.cpp
|
||||
HeightField.cpp
|
||||
Image.cpp
|
||||
ImageSequence.cpp
|
||||
Light.cpp
|
||||
LightModel.cpp
|
||||
LightSource.cpp
|
||||
LineStipple.cpp
|
||||
LineWidth.cpp
|
||||
LOD.cpp
|
||||
Material.cpp
|
||||
Matrix.cpp
|
||||
MatrixTransform.cpp
|
||||
NodeCallback.cpp
|
||||
Node.cpp
|
||||
Object.cpp
|
||||
OccluderNode.cpp
|
||||
OcclusionQueryNode.cpp
|
||||
PagedLOD.cpp
|
||||
Point.cpp
|
||||
PointSprite.cpp
|
||||
PolygonMode.cpp
|
||||
PolygonOffset.cpp
|
||||
PositionAttitudeTransform.cpp
|
||||
Program.cpp
|
||||
Projection.cpp
|
||||
ProxyNode.cpp
|
||||
ReaderWriterOSG.cpp
|
||||
Scissor.cpp
|
||||
Sequence.cpp
|
||||
ShadeModel.cpp
|
||||
Shader.cpp
|
||||
ShapeDrawable.cpp
|
||||
Sphere.cpp
|
||||
StateAttribute.cpp
|
||||
StateSet.cpp
|
||||
Stencil.cpp
|
||||
Switch.cpp
|
||||
TessellationHints.cpp
|
||||
TexEnvCombine.cpp
|
||||
TexEnv.cpp
|
||||
TexEnvFilter.cpp
|
||||
TexGen.cpp
|
||||
TexGenNode.cpp
|
||||
TexMat.cpp
|
||||
Texture1D.cpp
|
||||
Texture2D.cpp
|
||||
Texture3D.cpp
|
||||
Texture.cpp
|
||||
TextureCubeMap.cpp
|
||||
TextureRectangle.cpp
|
||||
Transform.cpp
|
||||
Uniform.cpp
|
||||
VertexProgram.cpp
|
||||
Viewport.cpp
|
||||
)
|
||||
SET(TARGET_H Matrix.h )
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const char* Camera_getBufferComponentStr(Camera::BufferComponent buffer);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CameraProxy
|
||||
REGISTER_DOTOSGWRAPPER(Camera)
|
||||
(
|
||||
new osg::Camera,
|
||||
"Camera",
|
||||
@@ -31,7 +31,7 @@ RegisterDotOsgWrapperProxy g_CameraProxy
|
||||
);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CameraNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(CameraNode)
|
||||
(
|
||||
new osg::Camera,
|
||||
"CameraNode",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool CameraView_readLocalData(Object& obj, Input& fr);
|
||||
bool CameraView_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CameraViewProxy
|
||||
REGISTER_DOTOSGWRAPPER(CameraView)
|
||||
(
|
||||
new osg::CameraView,
|
||||
"CameraView",
|
||||
|
||||
91
src/osgPlugins/osg/Capsule.cpp
Normal file
91
src/osgPlugins/osg/Capsule.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Capsule_readLocalData(Object& obj, Input& fr);
|
||||
bool Capsule_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Capsule)
|
||||
(
|
||||
new osg::Capsule,
|
||||
"Capsule",
|
||||
"Object Capsule",
|
||||
&Capsule_readLocalData,
|
||||
&Capsule_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Capsule_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Capsule& capsule = static_cast<Capsule&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
capsule.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
capsule.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
capsule.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
capsule.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Capsule_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Capsule& capsule = static_cast<const Capsule&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<capsule.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<capsule.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<capsule.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<capsule.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ bool ClearNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
|
||||
RegisterDotOsgWrapperProxy g_EarthSkyProxy
|
||||
REGISTER_DOTOSGWRAPPER(EarthSky)
|
||||
(
|
||||
new osg::ClearNode,
|
||||
"EarthSky",
|
||||
@@ -23,7 +23,7 @@ RegisterDotOsgWrapperProxy g_EarthSkyProxy
|
||||
&ClearNode_writeLocalData
|
||||
);
|
||||
|
||||
RegisterDotOsgWrapperProxy g_ClearNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(ClearNode)
|
||||
(
|
||||
new osg::ClearNode,
|
||||
"ClearNode",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool ClipNode_readLocalData(Object& obj, Input& fr);
|
||||
bool ClipNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ClipNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(ClipNode)
|
||||
(
|
||||
new osg::ClipNode,
|
||||
"ClipNode",
|
||||
|
||||
@@ -17,7 +17,7 @@ bool ClipPlane_readLocalData(Object& obj, Input& fr);
|
||||
bool ClipPlane_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ClipPlaneProxy
|
||||
REGISTER_DOTOSGWRAPPER(ClipPlane)
|
||||
(
|
||||
new osg::ClipPlane,
|
||||
"ClipPlane",
|
||||
|
||||
@@ -11,7 +11,7 @@ using namespace osgDB;
|
||||
bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); // register the read and write functions with the osgDB::Registry.
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ClusterCullingCallback_Proxy
|
||||
REGISTER_DOTOSGWRAPPER(ClusterCullingCallback)
|
||||
(
|
||||
new ClusterCullingCallback,
|
||||
"ClusterCullingCallback",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool ColorMask_matchModeStr(const char* str,bool& mode);
|
||||
const char* ColorMask_getModeStr(bool mode);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ColorMaskProxy
|
||||
REGISTER_DOTOSGWRAPPER(ColorMask)
|
||||
(
|
||||
new osg::ColorMask,
|
||||
"ColorMask",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool ColorMatrix_readLocalData(Object& obj, Input& fr);
|
||||
bool ColorMatrix_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ColorMatrixProxy
|
||||
REGISTER_DOTOSGWRAPPER(ColorMatrix)
|
||||
(
|
||||
new osg::ColorMatrix,
|
||||
"ColorMatrix",
|
||||
|
||||
75
src/osgPlugins/osg/CompositeShape.cpp
Normal file
75
src/osgPlugins/osg/CompositeShape.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool CompositeShape_readLocalData(Object& obj, Input& fr);
|
||||
bool CompositeShape_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(CompositeShape)
|
||||
(
|
||||
new osg::CompositeShape,
|
||||
"CompositeShape",
|
||||
"Object CompositeShape",
|
||||
&CompositeShape_readLocalData,
|
||||
&CompositeShape_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool CompositeShape_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
CompositeShape& composite = static_cast<CompositeShape&>(obj);
|
||||
|
||||
ref_ptr<Object> readObject;
|
||||
if (fr[0].matchWord("Shape"))
|
||||
{
|
||||
readObject = fr.readObject();
|
||||
if (readObject.valid())
|
||||
{
|
||||
osg::Shape* shape = dynamic_cast<osg::Shape*>(readObject.get());
|
||||
if (shape) composite.setShape(shape);
|
||||
else notify(WARN)<<"Warning:: "<<readObject->className()<<" loaded but cannot not be attached to Drawable."<<std::endl;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
while((readObject=fr.readObjectOfType(type_wrapper<osg::Shape>())).valid())
|
||||
{
|
||||
osg::Shape* shape = static_cast<osg::Shape*>(readObject.get());
|
||||
composite.addChild(shape);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeShape_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const CompositeShape& composite = static_cast<const CompositeShape&>(obj);
|
||||
|
||||
if (composite.getShape())
|
||||
{
|
||||
fw.indent() << "Shape ";
|
||||
fw.writeObject(*composite.getShape());
|
||||
}
|
||||
|
||||
for(unsigned int i=0;i<composite.getNumChildren();++i)
|
||||
{
|
||||
fw.writeObject(*composite.getChild(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
89
src/osgPlugins/osg/Cone.cpp
Normal file
89
src/osgPlugins/osg/Cone.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Cone_readLocalData(Object& obj, Input& fr);
|
||||
bool Cone_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Cone)
|
||||
(
|
||||
new osg::Cone,
|
||||
"Cone",
|
||||
"Object Cone",
|
||||
&Cone_readLocalData,
|
||||
&Cone_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Cone_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Cone& cone = static_cast<Cone&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
cone.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
cone.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
cone.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
cone.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Cone_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Cone& cone = static_cast<const Cone&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cone.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cone.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cone.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cone.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ bool ConvexPlanarOccluder_readLocalData(Object& obj, Input& fr);
|
||||
bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ConvexPlanarOccluderFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(ConvexPlanarOccluder)
|
||||
(
|
||||
new osg::ConvexPlanarOccluder,
|
||||
"ConvexPlanarOccluder",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool CoordinateSystemNode_readLocalData(Object& obj, Input& fr);
|
||||
bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CoordinateSystemNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(CoordinateSystemNode)
|
||||
(
|
||||
new osg::CoordinateSystemNode,
|
||||
"CoordinateSystemNode",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool CullFace_readLocalData(Object& obj, Input& fr);
|
||||
bool CullFace_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CullFaceFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(CullFace)
|
||||
(
|
||||
new osg::CullFace,
|
||||
"CullFace",
|
||||
|
||||
89
src/osgPlugins/osg/Cylinder.cpp
Normal file
89
src/osgPlugins/osg/Cylinder.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Cylinder_readLocalData(Object& obj, Input& fr);
|
||||
bool Cylinder_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Cylinder)
|
||||
(
|
||||
new osg::Cylinder,
|
||||
"Cylinder",
|
||||
"Object Cylinder",
|
||||
&Cylinder_readLocalData,
|
||||
&Cylinder_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Cylinder_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Cylinder& cylinder = static_cast<Cylinder&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
cylinder.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
cylinder.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
cylinder.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
cylinder.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Cylinder_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Cylinder& cylinder = static_cast<const Cylinder&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cylinder.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cylinder.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cylinder.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cylinder.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ const char* Depth_getFuncStr(Depth::Function func);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_DepthProxy
|
||||
REGISTER_DOTOSGWRAPPER(Depth)
|
||||
(
|
||||
new osg::Depth,
|
||||
"Depth",
|
||||
|
||||
@@ -13,9 +13,8 @@ bool Drawable_readLocalData(Object& obj, Input& fr);
|
||||
bool Drawable_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_DrawableFuncProxy
|
||||
(
|
||||
/*new osg::Drawable*/NULL,
|
||||
REGISTER_DOTOSGWRAPPER(Drawable)
|
||||
( NULL,
|
||||
"Drawable",
|
||||
"Object Drawable",
|
||||
&Drawable_readLocalData,
|
||||
|
||||
@@ -13,7 +13,7 @@ bool EllipsoidModel_readLocalData(Object& obj, Input& fr);
|
||||
bool EllipsoidModel_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_EllipsoidModelFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(EllipsoidModel)
|
||||
(
|
||||
new osg::EllipsoidModel,
|
||||
"EllipsoidModel",
|
||||
|
||||
@@ -19,7 +19,7 @@ bool Fog_matchModeStr(const char* str,Fog::Mode& mode);
|
||||
const char* Fog_getModeStr(Fog::Mode mode);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_FogProxy
|
||||
REGISTER_DOTOSGWRAPPER(Fog)
|
||||
(
|
||||
new osg::Fog,
|
||||
"Fog",
|
||||
|
||||
@@ -19,7 +19,7 @@ bool FragmentProgram_readLocalData(Object& obj, Input& fr);
|
||||
bool FragmentProgram_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_FragmentProgramProxy
|
||||
REGISTER_DOTOSGWRAPPER(FragmentProgram)
|
||||
(
|
||||
new osg::FragmentProgram,
|
||||
"FragmentProgram",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool FrontFace_readLocalData(Object& obj, Input& fr);
|
||||
bool FrontFace_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_FrontFaceProxy
|
||||
REGISTER_DOTOSGWRAPPER(FrontFace)
|
||||
(
|
||||
new osg::FrontFace,
|
||||
"FrontFace",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Geode_readLocalData(Object& obj, Input& fr);
|
||||
bool Geode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_GeodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(Geode)
|
||||
(
|
||||
new osg::Geode,
|
||||
"Geode",
|
||||
|
||||
@@ -24,7 +24,7 @@ Array* Array_readLocalData(Input& fr);
|
||||
bool Primitive_readLocalData(Input& fr,osg::Geometry& geom);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_GeometryFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(Geometry)
|
||||
(
|
||||
new osg::Geometry,
|
||||
"Geometry",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Group_readLocalData(Object& obj, Input& fr);
|
||||
bool Group_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_GroupProxy
|
||||
REGISTER_DOTOSGWRAPPER(Group)
|
||||
(
|
||||
new osg::Group,
|
||||
"Group",
|
||||
|
||||
183
src/osgPlugins/osg/HeightField.cpp
Normal file
183
src/osgPlugins/osg/HeightField.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool HeightField_readLocalData(Object& obj, Input& fr);
|
||||
bool HeightField_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(HeightField)
|
||||
(
|
||||
new osg::HeightField,
|
||||
"HeightField",
|
||||
"Object HeightField",
|
||||
&HeightField_readLocalData,
|
||||
&HeightField_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Grid)
|
||||
(
|
||||
new osg::HeightField,
|
||||
"Grid",
|
||||
"Object HeightField",
|
||||
0,
|
||||
0,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool HeightField_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
HeightField& heightfield = static_cast<HeightField&>(obj);
|
||||
|
||||
if (fr.matchSequence("Origin %f %f %f"))
|
||||
{
|
||||
osg::Vec3 origin;
|
||||
fr[1].getFloat(origin.x());
|
||||
fr[2].getFloat(origin.y());
|
||||
fr[3].getFloat(origin.z());
|
||||
heightfield.setOrigin(origin);
|
||||
fr+=4;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("XInterval %f"))
|
||||
{
|
||||
float interval;
|
||||
fr[1].getFloat(interval);
|
||||
heightfield.setXInterval(interval);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("YInterval %f"))
|
||||
{
|
||||
float interval;
|
||||
fr[1].getFloat(interval);
|
||||
heightfield.setYInterval(interval);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("SkirtHeight %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
heightfield.setSkirtHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("BorderWidth %i"))
|
||||
{
|
||||
unsigned int width;
|
||||
fr[1].getUInt(width);
|
||||
heightfield.setBorderWidth(width);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
heightfield.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("NumColumnsAndRows %i %i"))
|
||||
{
|
||||
int numcolumns,numrows;
|
||||
fr[1].getInt(numcolumns);
|
||||
fr[2].getInt(numrows);
|
||||
heightfield.allocate(numcolumns,numrows);
|
||||
fr+=3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Heights {"))
|
||||
{
|
||||
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
float height;
|
||||
unsigned int row = 0;
|
||||
unsigned int column = 0;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
if (fr.readSequence(height))
|
||||
{
|
||||
heightfield.setHeight(column,row,height);
|
||||
++column;
|
||||
if (column>=heightfield.getNumColumns())
|
||||
{
|
||||
column = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
|
||||
iteratorAdvanced = true;
|
||||
++fr;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool HeightField_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const HeightField& heightfield = static_cast<const HeightField&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
fw.indent()<<"Origin "<<heightfield.getOrigin().x()<<" "<<heightfield.getOrigin().y()<<" "<<heightfield.getOrigin().z()<<std::endl;
|
||||
fw.indent()<<"XInterval "<<heightfield.getXInterval()<<std::endl;
|
||||
fw.indent()<<"YInterval "<<heightfield.getYInterval()<<std::endl;
|
||||
fw.indent()<<"SkirtHeight "<<heightfield.getSkirtHeight()<<std::endl;
|
||||
fw.indent()<<"BorderWidth "<<heightfield.getBorderWidth()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<heightfield.getRotation()<<std::endl;
|
||||
fw.precision(prec);
|
||||
|
||||
fw.indent()<<"NumColumnsAndRows "<<heightfield.getNumColumns()<<" "<<heightfield.getNumRows()<<std::endl;
|
||||
|
||||
fw.indent()<<"Heights"<<std::endl;
|
||||
|
||||
ParameterOutput po(fw);
|
||||
po.begin();
|
||||
for(unsigned int row=0;row<heightfield.getNumRows();++row)
|
||||
{
|
||||
for(unsigned int column=0;column<heightfield.getNumColumns();++column)
|
||||
{
|
||||
po.write(heightfield.getHeight(column,row));
|
||||
}
|
||||
po.newLine();
|
||||
}
|
||||
po.end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Image_readLocalData(Object& obj, Input& fr);
|
||||
bool Image_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ImageFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(Image)
|
||||
(
|
||||
new osg::Image,
|
||||
"Image",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool ImageSequence_readLocalData(Object& obj, Input& fr);
|
||||
bool ImageSequence_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ImageSequenceProxy
|
||||
REGISTER_DOTOSGWRAPPER(ImageSequence)
|
||||
(
|
||||
new osg::ImageSequence,
|
||||
"ImageSequence",
|
||||
|
||||
@@ -13,7 +13,7 @@ bool LOD_readLocalData(Object& obj, Input& fr);
|
||||
bool LOD_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LODProxy
|
||||
REGISTER_DOTOSGWRAPPER(LOD)
|
||||
(
|
||||
new osg::LOD,
|
||||
"LOD",
|
||||
|
||||
@@ -17,7 +17,7 @@ bool Light_readLocalData(Object& obj, Input& fr);
|
||||
bool Light_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LightProxy
|
||||
REGISTER_DOTOSGWRAPPER(Light)
|
||||
(
|
||||
new osg::Light,
|
||||
"Light",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool LightModel_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LightModelProxy
|
||||
REGISTER_DOTOSGWRAPPER(LightModel)
|
||||
(
|
||||
new osg::LightModel,
|
||||
"LightModel",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool LightSource_readLocalData(Object& obj, Input& fr);
|
||||
bool LightSource_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LightSourceProxy
|
||||
REGISTER_DOTOSGWRAPPER(LightSource)
|
||||
(
|
||||
new osg::LightSource,
|
||||
"LightSource",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool LineStipple_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LineStippleProxy
|
||||
REGISTER_DOTOSGWRAPPER(LineStipple)
|
||||
(
|
||||
new osg::LineStipple,
|
||||
"LineStipple",
|
||||
|
||||
@@ -16,7 +16,7 @@ bool LineWidth_readLocalData(Object& obj, Input& fr);
|
||||
bool LineWidth_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_LineWidthProxy
|
||||
REGISTER_DOTOSGWRAPPER(LineWidth)
|
||||
(
|
||||
new osg::LineWidth,
|
||||
"LineWidth",
|
||||
|
||||
@@ -18,7 +18,7 @@ bool Material_writeLocalData(const Object& obj, Output& fw);
|
||||
bool Material_matchFaceAndColor(Input& fr,const char* name,Material::Face& mf,Vec4& color);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_MaterialProxy
|
||||
REGISTER_DOTOSGWRAPPER(Material)
|
||||
(
|
||||
new osg::Material,
|
||||
"Material",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool MatrixTransform_readLocalData(Object& obj, Input& fr);
|
||||
bool MatrixTransform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_MatrixTransformProxy
|
||||
REGISTER_DOTOSGWRAPPER(MatrixTransform)
|
||||
(
|
||||
new osg::MatrixTransform,
|
||||
"MatrixTransform",
|
||||
@@ -25,7 +25,7 @@ RegisterDotOsgWrapperProxy g_MatrixTransformProxy
|
||||
);
|
||||
|
||||
// register old style 'DCS' read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_DCSProxy
|
||||
REGISTER_DOTOSGWRAPPER(DCS)
|
||||
(
|
||||
new osg::MatrixTransform,
|
||||
"DCS",
|
||||
|
||||
@@ -14,7 +14,8 @@ bool Node_readLocalData(Object& obj, Input& fr);
|
||||
bool Node_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_NodeProxy
|
||||
//REGISTER_DOTOSGWRAPPER(Node)
|
||||
REGISTER_DOTOSGWRAPPER(Node)
|
||||
(
|
||||
new osg::Node,
|
||||
"Node",
|
||||
|
||||
@@ -12,7 +12,7 @@ using namespace osgDB;
|
||||
bool NodeCallback_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool NodeCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); // register the read and write functions with the osgDB::Registry.
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy NodeCallback_Proxy
|
||||
REGISTER_DOTOSGWRAPPER(NodeCallback)
|
||||
(
|
||||
new NodeCallback,
|
||||
"NodeCallback",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool Object_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
// note, Object doesn't currently require any read and write.
|
||||
RegisterDotOsgWrapperProxy g_ObjectProxy
|
||||
REGISTER_DOTOSGWRAPPER(Object)
|
||||
(
|
||||
/*new osg::Object*/NULL,
|
||||
"Object",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool OccluderNode_readLocalData(Object& obj, Input& fr);
|
||||
bool OccluderNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_OccluderNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(OccluderNode)
|
||||
(
|
||||
new osg::OccluderNode,
|
||||
"OccluderNode",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
bool OQN_readLocalData( osg::Object &obj, osgDB::Input &fr );
|
||||
bool OQN_writeLocalData( const osg::Object &obj, osgDB::Output &fw );
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy OcclusionQueryNode_Proxy
|
||||
REGISTER_DOTOSGWRAPPER(OcclusionQueryNode)
|
||||
(
|
||||
new osg::OcclusionQueryNode,
|
||||
"OcclusionQueryNode",
|
||||
|
||||
@@ -13,7 +13,7 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr);
|
||||
bool PagedLOD_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PagedLODProxy
|
||||
REGISTER_DOTOSGWRAPPER(PagedLOD)
|
||||
(
|
||||
new osg::PagedLOD,
|
||||
"PagedLOD",
|
||||
|
||||
@@ -17,7 +17,7 @@ bool Point_readLocalData(Object& obj, Input& fr);
|
||||
bool Point_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PointProxy
|
||||
REGISTER_DOTOSGWRAPPER(Point)
|
||||
(
|
||||
new osg::Point,
|
||||
"Point",
|
||||
|
||||
@@ -16,7 +16,7 @@ bool PointSprite_readLocalData(Object& obj, Input& fr);
|
||||
bool PointSprite_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PointSpriteProxy
|
||||
REGISTER_DOTOSGWRAPPER(PointSprite)
|
||||
(
|
||||
new osg::PointSprite,
|
||||
"PointSprite",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool PolygonMode_readLocalData(Object& obj, Input& fr);
|
||||
bool PolygonMode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PolygonModeProxy
|
||||
REGISTER_DOTOSGWRAPPER(PolygonMode)
|
||||
(
|
||||
new osg::PolygonMode,
|
||||
"PolygonMode",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool PolygonOffset_readLocalData(Object& obj, Input& fr);
|
||||
bool PolygonOffset_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PolygonOffsetProxy
|
||||
REGISTER_DOTOSGWRAPPER(PolygonOffset)
|
||||
(
|
||||
new osg::PolygonOffset,
|
||||
"PolygonOffset",
|
||||
|
||||
@@ -13,7 +13,7 @@ bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr);
|
||||
bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_PositionAttitudeTransformProxy
|
||||
REGISTER_DOTOSGWRAPPER(PositionAttitudeTransform)
|
||||
(
|
||||
new osg::PositionAttitudeTransform,
|
||||
"PositionAttitudeTransform",
|
||||
|
||||
@@ -17,7 +17,7 @@ bool Program_readLocalData(Object& obj, Input& fr);
|
||||
bool Program_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ProgramProxy
|
||||
REGISTER_DOTOSGWRAPPER(Program)
|
||||
(
|
||||
new osg::Program,
|
||||
"Program",
|
||||
|
||||
@@ -15,7 +15,7 @@ bool Projection_readLocalData(Object& obj, Input& fr);
|
||||
bool Projection_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ProjectionProxy
|
||||
REGISTER_DOTOSGWRAPPER(Projection)
|
||||
(
|
||||
new osg::Projection,
|
||||
"Projection",
|
||||
|
||||
@@ -18,7 +18,7 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr);
|
||||
bool ProxyNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ProxyNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(ProxyNode)
|
||||
(
|
||||
new osg::ProxyNode,
|
||||
"ProxyNode",
|
||||
|
||||
@@ -14,6 +14,92 @@
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// pull in symbols from individual .o's to enable the static build to work
|
||||
USE_DOTOSGWRAPPER(AlphaFunc)
|
||||
USE_DOTOSGWRAPPER(AnimationPath)
|
||||
USE_DOTOSGWRAPPER(AutoTransform)
|
||||
USE_DOTOSGWRAPPER(Billboard)
|
||||
USE_DOTOSGWRAPPER(BlendColor)
|
||||
USE_DOTOSGWRAPPER(BlendEquation)
|
||||
USE_DOTOSGWRAPPER(BlendFunc)
|
||||
USE_DOTOSGWRAPPER(Camera)
|
||||
USE_DOTOSGWRAPPER(CameraView)
|
||||
USE_DOTOSGWRAPPER(ClearNode)
|
||||
USE_DOTOSGWRAPPER(ClipNode)
|
||||
USE_DOTOSGWRAPPER(ClipPlane)
|
||||
USE_DOTOSGWRAPPER(ClusterCullingCallback)
|
||||
USE_DOTOSGWRAPPER(ColorMask)
|
||||
USE_DOTOSGWRAPPER(ColorMatrix)
|
||||
USE_DOTOSGWRAPPER(ConvexPlanarOccluder)
|
||||
USE_DOTOSGWRAPPER(CoordinateSystemNode)
|
||||
USE_DOTOSGWRAPPER(CullFace)
|
||||
USE_DOTOSGWRAPPER(Depth)
|
||||
USE_DOTOSGWRAPPER(Drawable)
|
||||
USE_DOTOSGWRAPPER(EllipsoidModel)
|
||||
USE_DOTOSGWRAPPER(Fog)
|
||||
USE_DOTOSGWRAPPER(FragmentProgram)
|
||||
USE_DOTOSGWRAPPER(FrontFace)
|
||||
USE_DOTOSGWRAPPER(Geode)
|
||||
USE_DOTOSGWRAPPER(Geometry)
|
||||
USE_DOTOSGWRAPPER(Group)
|
||||
USE_DOTOSGWRAPPER(Image)
|
||||
USE_DOTOSGWRAPPER(ImageSequence)
|
||||
USE_DOTOSGWRAPPER(Light)
|
||||
USE_DOTOSGWRAPPER(LightModel)
|
||||
USE_DOTOSGWRAPPER(LightSource)
|
||||
USE_DOTOSGWRAPPER(LineStipple)
|
||||
USE_DOTOSGWRAPPER(LineWidth)
|
||||
USE_DOTOSGWRAPPER(LOD)
|
||||
USE_DOTOSGWRAPPER(Material)
|
||||
USE_DOTOSGWRAPPER(MatrixTransform)
|
||||
USE_DOTOSGWRAPPER(NodeCallback)
|
||||
USE_DOTOSGWRAPPER(Node)
|
||||
USE_DOTOSGWRAPPER(Object)
|
||||
USE_DOTOSGWRAPPER(OccluderNode)
|
||||
USE_DOTOSGWRAPPER(OcclusionQueryNode)
|
||||
USE_DOTOSGWRAPPER(PagedLOD)
|
||||
USE_DOTOSGWRAPPER(Point)
|
||||
USE_DOTOSGWRAPPER(PointSprite)
|
||||
USE_DOTOSGWRAPPER(PolygonMode)
|
||||
USE_DOTOSGWRAPPER(PolygonOffset)
|
||||
USE_DOTOSGWRAPPER(PositionAttitudeTransform)
|
||||
USE_DOTOSGWRAPPER(Program)
|
||||
USE_DOTOSGWRAPPER(Projection)
|
||||
USE_DOTOSGWRAPPER(ProxyNode)
|
||||
USE_DOTOSGWRAPPER(Scissor)
|
||||
USE_DOTOSGWRAPPER(Sequence)
|
||||
USE_DOTOSGWRAPPER(ShadeModel)
|
||||
USE_DOTOSGWRAPPER(Shader)
|
||||
USE_DOTOSGWRAPPER(Sphere)
|
||||
USE_DOTOSGWRAPPER(Cone)
|
||||
USE_DOTOSGWRAPPER(Capsule)
|
||||
USE_DOTOSGWRAPPER(Box)
|
||||
USE_DOTOSGWRAPPER(HeightField)
|
||||
USE_DOTOSGWRAPPER(CompositeShape)
|
||||
USE_DOTOSGWRAPPER(Cylinder)
|
||||
USE_DOTOSGWRAPPER(ShapeDrawable)
|
||||
USE_DOTOSGWRAPPER(StateAttribute)
|
||||
USE_DOTOSGWRAPPER(StateSet)
|
||||
USE_DOTOSGWRAPPER(Stencil)
|
||||
USE_DOTOSGWRAPPER(Switch)
|
||||
USE_DOTOSGWRAPPER(TessellationHints)
|
||||
USE_DOTOSGWRAPPER(TexEnvCombine)
|
||||
USE_DOTOSGWRAPPER(TexEnv)
|
||||
USE_DOTOSGWRAPPER(TexEnvFilter)
|
||||
USE_DOTOSGWRAPPER(TexGen)
|
||||
USE_DOTOSGWRAPPER(TexGenNode)
|
||||
USE_DOTOSGWRAPPER(TexMat)
|
||||
USE_DOTOSGWRAPPER(Texture1D)
|
||||
USE_DOTOSGWRAPPER(Texture2D)
|
||||
USE_DOTOSGWRAPPER(Texture3D)
|
||||
USE_DOTOSGWRAPPER(Texture)
|
||||
USE_DOTOSGWRAPPER(TextureCubeMap)
|
||||
USE_DOTOSGWRAPPER(TextureRectangle)
|
||||
USE_DOTOSGWRAPPER(Transform)
|
||||
USE_DOTOSGWRAPPER(Uniform)
|
||||
USE_DOTOSGWRAPPER(VertexProgram)
|
||||
USE_DOTOSGWRAPPER(Viewport)
|
||||
|
||||
class OSGReaderWriter : public ReaderWriter
|
||||
{
|
||||
public:
|
||||
@@ -92,7 +178,7 @@ class OSGReaderWriter : public ReaderWriter
|
||||
virtual ReadResult readNode(const std::string& file, const Options* opt) const
|
||||
{
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
||||
|
||||
|
||||
if (equalCaseInsensitive(ext,"osgs"))
|
||||
{
|
||||
std::istringstream fin(osgDB::getNameLessExtension(file));
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Scissor_readLocalData(Object& obj, Input& fr);
|
||||
bool Scissor_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ScissorProxy
|
||||
REGISTER_DOTOSGWRAPPER(Scissor)
|
||||
(
|
||||
new osg::Scissor,
|
||||
"Scissor",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Sequence_readLocalData(Object& obj, Input& fr);
|
||||
bool Sequence_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_SequenceProxy
|
||||
REGISTER_DOTOSGWRAPPER(Sequence)
|
||||
(
|
||||
new osg::Sequence,
|
||||
"Sequence",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool ShadeModel_readLocalData(Object& obj, Input& fr);
|
||||
bool ShadeModel_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ShadeModelFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(ShadeModel)
|
||||
(
|
||||
new osg::ShadeModel,
|
||||
"ShadeModel",
|
||||
|
||||
@@ -19,7 +19,7 @@ bool Shader_readLocalData(Object& obj, Input& fr);
|
||||
bool Shader_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ShaderProxy
|
||||
REGISTER_DOTOSGWRAPPER(Shader)
|
||||
(
|
||||
new osg::Shader,
|
||||
"Shader",
|
||||
|
||||
@@ -1,717 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Sphere_readLocalData(Object& obj, Input& fr);
|
||||
bool Sphere_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_SphereFuncProxy
|
||||
(
|
||||
new osg::Sphere,
|
||||
"Sphere",
|
||||
"Object Sphere",
|
||||
&Sphere_readLocalData,
|
||||
&Sphere_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Sphere_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Sphere& sphere = static_cast<Sphere&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
sphere.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
sphere.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Sphere_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Sphere& sphere = static_cast<const Sphere&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<sphere.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<sphere.getRadius()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Box_readLocalData(Object& obj, Input& fr);
|
||||
bool Box_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_BoxFuncProxy
|
||||
(
|
||||
new osg::Box,
|
||||
"Box",
|
||||
"Object Box",
|
||||
&Box_readLocalData,
|
||||
&Box_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Box_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Box& box = static_cast<Box&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
box.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("HalfLengths %f %f %f"))
|
||||
{
|
||||
osg::Vec3 lenghts;
|
||||
fr[1].getFloat(lenghts.x());
|
||||
fr[2].getFloat(lenghts.y());
|
||||
fr[3].getFloat(lenghts.z());
|
||||
box.setHalfLengths(lenghts);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
box.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Box_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Box& box = static_cast<const Box&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<box.getCenter()<<std::endl;
|
||||
fw.indent()<<"HalfLengths "<<box.getHalfLengths()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<box.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Cone_readLocalData(Object& obj, Input& fr);
|
||||
bool Cone_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ConeFuncProxy
|
||||
(
|
||||
new osg::Cone,
|
||||
"Cone",
|
||||
"Object Cone",
|
||||
&Cone_readLocalData,
|
||||
&Cone_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Cone_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Cone& cone = static_cast<Cone&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
cone.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
cone.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
cone.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
cone.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Cone_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Cone& cone = static_cast<const Cone&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cone.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cone.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cone.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cone.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Cylinder_readLocalData(Object& obj, Input& fr);
|
||||
bool Cylinder_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CylinderFuncProxy
|
||||
(
|
||||
new osg::Cylinder,
|
||||
"Cylinder",
|
||||
"Object Cylinder",
|
||||
&Cylinder_readLocalData,
|
||||
&Cylinder_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Cylinder_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Cylinder& cylinder = static_cast<Cylinder&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
cylinder.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
cylinder.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
cylinder.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
cylinder.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Cylinder_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Cylinder& cylinder = static_cast<const Cylinder&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cylinder.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cylinder.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cylinder.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cylinder.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool Capsule_readLocalData(Object& obj, Input& fr);
|
||||
bool Capsule_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CapsuleFuncProxy
|
||||
(
|
||||
new osg::Capsule,
|
||||
"Capsule",
|
||||
"Object Capsule",
|
||||
&Capsule_readLocalData,
|
||||
&Capsule_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Capsule_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Capsule& capsule = static_cast<Capsule&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
capsule.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
capsule.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Height %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
capsule.setHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
capsule.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Capsule_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Capsule& capsule = static_cast<const Capsule&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<capsule.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<capsule.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<capsule.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<capsule.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool HeightField_readLocalData(Object& obj, Input& fr);
|
||||
bool HeightField_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_HeightFieldFuncProxy
|
||||
(
|
||||
new osg::HeightField,
|
||||
"HeightField",
|
||||
"Object HeightField",
|
||||
&HeightField_readLocalData,
|
||||
&HeightField_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_GridFuncProxy
|
||||
(
|
||||
new osg::HeightField,
|
||||
"Grid",
|
||||
"Object HeightField",
|
||||
0,
|
||||
0,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool HeightField_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
HeightField& heightfield = static_cast<HeightField&>(obj);
|
||||
|
||||
if (fr.matchSequence("Origin %f %f %f"))
|
||||
{
|
||||
osg::Vec3 origin;
|
||||
fr[1].getFloat(origin.x());
|
||||
fr[2].getFloat(origin.y());
|
||||
fr[3].getFloat(origin.z());
|
||||
heightfield.setOrigin(origin);
|
||||
fr+=4;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("XInterval %f"))
|
||||
{
|
||||
float interval;
|
||||
fr[1].getFloat(interval);
|
||||
heightfield.setXInterval(interval);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("YInterval %f"))
|
||||
{
|
||||
float interval;
|
||||
fr[1].getFloat(interval);
|
||||
heightfield.setYInterval(interval);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("SkirtHeight %f"))
|
||||
{
|
||||
float height;
|
||||
fr[1].getFloat(height);
|
||||
heightfield.setSkirtHeight(height);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("BorderWidth %i"))
|
||||
{
|
||||
unsigned int width;
|
||||
fr[1].getUInt(width);
|
||||
heightfield.setBorderWidth(width);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Rotation %f %f %f %f"))
|
||||
{
|
||||
osg::Quat rotation;
|
||||
fr[1].getFloat(rotation.x());
|
||||
fr[2].getFloat(rotation.y());
|
||||
fr[3].getFloat(rotation.z());
|
||||
fr[4].getFloat(rotation.w());
|
||||
heightfield.setRotation(rotation);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("NumColumnsAndRows %i %i"))
|
||||
{
|
||||
int numcolumns,numrows;
|
||||
fr[1].getInt(numcolumns);
|
||||
fr[2].getInt(numrows);
|
||||
heightfield.allocate(numcolumns,numrows);
|
||||
fr+=3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Heights {"))
|
||||
{
|
||||
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
float height;
|
||||
unsigned int row = 0;
|
||||
unsigned int column = 0;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
if (fr.readSequence(height))
|
||||
{
|
||||
heightfield.setHeight(column,row,height);
|
||||
++column;
|
||||
if (column>=heightfield.getNumColumns())
|
||||
{
|
||||
column = 0;
|
||||
++row;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
|
||||
iteratorAdvanced = true;
|
||||
++fr;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool HeightField_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const HeightField& heightfield = static_cast<const HeightField&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
fw.indent()<<"Origin "<<heightfield.getOrigin().x()<<" "<<heightfield.getOrigin().y()<<" "<<heightfield.getOrigin().z()<<std::endl;
|
||||
fw.indent()<<"XInterval "<<heightfield.getXInterval()<<std::endl;
|
||||
fw.indent()<<"YInterval "<<heightfield.getYInterval()<<std::endl;
|
||||
fw.indent()<<"SkirtHeight "<<heightfield.getSkirtHeight()<<std::endl;
|
||||
fw.indent()<<"BorderWidth "<<heightfield.getBorderWidth()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<heightfield.getRotation()<<std::endl;
|
||||
fw.precision(prec);
|
||||
|
||||
fw.indent()<<"NumColumnsAndRows "<<heightfield.getNumColumns()<<" "<<heightfield.getNumRows()<<std::endl;
|
||||
|
||||
fw.indent()<<"Heights"<<std::endl;
|
||||
|
||||
ParameterOutput po(fw);
|
||||
po.begin();
|
||||
for(unsigned int row=0;row<heightfield.getNumRows();++row)
|
||||
{
|
||||
for(unsigned int column=0;column<heightfield.getNumColumns();++column)
|
||||
{
|
||||
po.write(heightfield.getHeight(column,row));
|
||||
}
|
||||
po.newLine();
|
||||
}
|
||||
po.end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// forward declare functions to use later.
|
||||
bool CompositeShape_readLocalData(Object& obj, Input& fr);
|
||||
bool CompositeShape_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_CompositeShapeFuncProxy
|
||||
(
|
||||
new osg::CompositeShape,
|
||||
"CompositeShape",
|
||||
"Object CompositeShape",
|
||||
&CompositeShape_readLocalData,
|
||||
&CompositeShape_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool CompositeShape_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
CompositeShape& composite = static_cast<CompositeShape&>(obj);
|
||||
|
||||
ref_ptr<Object> readObject;
|
||||
if (fr[0].matchWord("Shape"))
|
||||
{
|
||||
readObject = fr.readObject();
|
||||
if (readObject.valid())
|
||||
{
|
||||
osg::Shape* shape = dynamic_cast<osg::Shape*>(readObject.get());
|
||||
if (shape) composite.setShape(shape);
|
||||
else notify(WARN)<<"Warning:: "<<readObject->className()<<" loaded but cannot not be attached to Drawable."<<std::endl;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
while((readObject=fr.readObjectOfType(type_wrapper<osg::Shape>())).valid())
|
||||
{
|
||||
osg::Shape* shape = static_cast<osg::Shape*>(readObject.get());
|
||||
composite.addChild(shape);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeShape_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const CompositeShape& composite = static_cast<const CompositeShape&>(obj);
|
||||
|
||||
if (composite.getShape())
|
||||
{
|
||||
fw.indent() << "Shape ";
|
||||
fw.writeObject(*composite.getShape());
|
||||
}
|
||||
|
||||
for(unsigned int i=0;i<composite.getNumChildren();++i)
|
||||
{
|
||||
fw.writeObject(*composite.getChild(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// // forward declare functions to use later.
|
||||
// bool InfinitePlane_readLocalData(Object& obj, Input& fr);
|
||||
// bool InfinitePlane_writeLocalData(const Object& obj, Output& fw);
|
||||
//
|
||||
// //register the read and write functions with the osgDB::Registry.
|
||||
// RegisterDotOsgWrapperProxy g_InfinitePlaneFuncProxy
|
||||
// (
|
||||
// new osg::InfinitePlane,
|
||||
// "InfinitePlane",
|
||||
// "Object InfinitePlane",
|
||||
// &InfinitePlane_readLocalData,
|
||||
// &InfinitePlane_writeLocalData,
|
||||
// DotOsgWrapper::READ_AND_WRITE
|
||||
// );
|
||||
//
|
||||
// bool InfinitePlane_readLocalData(Object& obj, Input& fr)
|
||||
// {
|
||||
// bool iteratorAdvanced = false;
|
||||
//
|
||||
// //InfinitePlane& infplane = static_cast<InfinitePlane&>(obj);
|
||||
//
|
||||
// return iteratorAdvanced;
|
||||
// }
|
||||
//
|
||||
// bool InfinitePlane_writeLocalData(const Object& obj, Output& fw)
|
||||
// {
|
||||
// //const InfinitePlane& infplane = static_cast<const InfinitePlane&>(obj);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// // forward declare functions to use later.
|
||||
// bool TriangleMesh_readLocalData(Object& obj, Input& fr);
|
||||
// bool TriangleMesh_writeLocalData(const Object& obj, Output& fw);
|
||||
//
|
||||
// //register the read and write functions with the osgDB::Registry.
|
||||
// RegisterDotOsgWrapperProxy g_TriangleMeshFuncProxy
|
||||
// (
|
||||
// new osg::TriangleMesh,
|
||||
// "TriangleMesh",
|
||||
// "Object ",
|
||||
// &TriangleMesh_readLocalData,
|
||||
// &TriangleMesh_writeLocalData,
|
||||
// DotOsgWrapper::READ_AND_WRITE
|
||||
// );
|
||||
//
|
||||
// bool TriangleMesh_readLocalData(Object& obj, Input& fr)
|
||||
// {
|
||||
// bool iteratorAdvanced = false;
|
||||
//
|
||||
// // TriangleMesh& mesh = static_cast<TriangleMesh&>(obj);
|
||||
//
|
||||
// return iteratorAdvanced;
|
||||
// }
|
||||
//
|
||||
// bool TriangleMesh_writeLocalData(const Object& obj, Output& fw)
|
||||
// {
|
||||
// // const TriangleMesh& mesh = static_cast<const TriangleMesh&>(obj);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// // forward declare functions to use later.
|
||||
// bool ConvexHull_readLocalData(Object& obj, Input& fr);
|
||||
// bool ConvexHull_writeLocalData(const Object& obj, Output& fw);
|
||||
//
|
||||
// //register the read and write functions with the osgDB::Registry.
|
||||
// RegisterDotOsgWrapperProxy g_ConvexHullFuncProxy
|
||||
// (
|
||||
// new osg::ConvexHull,
|
||||
// "ConvexHull",
|
||||
// "Object ",
|
||||
// &ConvexHull_readLocalData,
|
||||
// &ConvexHull_writeLocalData,
|
||||
// DotOsgWrapper::READ_AND_WRITE
|
||||
// );
|
||||
//
|
||||
// bool ConvexHull_readLocalData(Object& obj, Input& fr)
|
||||
// {
|
||||
// bool iteratorAdvanced = false;
|
||||
//
|
||||
// // ConvexHull& geom = static_cast<ConvexHull&>(obj);
|
||||
//
|
||||
// return iteratorAdvanced;
|
||||
// }
|
||||
//
|
||||
// bool ConvexHull_writeLocalData(const Object& obj, Output& fw)
|
||||
// {
|
||||
// // const ConvexHull& geom = static_cast<const ConvexHull&>(obj);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace osgDB;
|
||||
bool ShapeDrawable_readLocalData(Object& obj, Input& fr);
|
||||
bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(ShapeDrawable)
|
||||
(
|
||||
new osg::ShapeDrawable,
|
||||
"ShapeDrawable",
|
||||
|
||||
69
src/osgPlugins/osg/Sphere.cpp
Normal file
69
src/osgPlugins/osg/Sphere.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Sphere_readLocalData(Object& obj, Input& fr);
|
||||
bool Sphere_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
//register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Sphere)
|
||||
(
|
||||
new osg::Sphere,
|
||||
"Sphere",
|
||||
"Object Sphere",
|
||||
&Sphere_readLocalData,
|
||||
&Sphere_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Sphere_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Sphere& sphere = static_cast<Sphere&>(obj);
|
||||
|
||||
if (fr.matchSequence("Center %f %f %f"))
|
||||
{
|
||||
osg::Vec3 center;
|
||||
fr[1].getFloat(center.x());
|
||||
fr[2].getFloat(center.y());
|
||||
fr[3].getFloat(center.z());
|
||||
sphere.setCenter(center);
|
||||
fr+=4;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Radius %f"))
|
||||
{
|
||||
float radius;
|
||||
fr[1].getFloat(radius);
|
||||
sphere.setRadius(radius);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Sphere_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Sphere& sphere = static_cast<const Sphere&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<sphere.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<sphere.getRadius()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ bool StateAttribute_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
osg::StateAttribute* g_stateAttribute = 0;
|
||||
RegisterDotOsgWrapperProxy g_StateAttributeProxy
|
||||
REGISTER_DOTOSGWRAPPER(StateAttribute)
|
||||
(
|
||||
g_stateAttribute, // no instance, osg::StateAttribute is an abstract class.
|
||||
"StateAttribute",
|
||||
|
||||
@@ -26,7 +26,7 @@ bool StateSet_matchRenderBinModeStr(const char* str,StateSet::RenderBinMode& mod
|
||||
const char* StateSet_getRenderBinModeStr(StateSet::RenderBinMode mode);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_StateSetFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(StateSet)
|
||||
(
|
||||
new osg::StateSet,
|
||||
"StateSet",
|
||||
@@ -37,7 +37,7 @@ RegisterDotOsgWrapperProxy g_StateSetFuncProxy
|
||||
);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_GeoStateFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(GeoState)
|
||||
(
|
||||
new osg::StateSet,
|
||||
"GeoState",
|
||||
|
||||
@@ -19,7 +19,7 @@ const char* Stencil_getOperationStr(Stencil::Operation op);
|
||||
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_StencilProxy
|
||||
REGISTER_DOTOSGWRAPPER(Stencil)
|
||||
(
|
||||
new osg::Stencil,
|
||||
"Stencil",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Switch_readLocalData(Object& obj, Input& fr);
|
||||
bool Switch_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_SwitchProxy
|
||||
REGISTER_DOTOSGWRAPPER(Switch)
|
||||
(
|
||||
new osg::Switch,
|
||||
"Switch",
|
||||
|
||||
@@ -12,7 +12,7 @@ using namespace osgDB;
|
||||
bool TessellationHints_readLocalData(Object& obj, Input& fr);
|
||||
bool TessellationHints_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
RegisterDotOsgWrapperProxy g_TessellationHintsFuncProxy
|
||||
REGISTER_DOTOSGWRAPPER(TessellationHints)
|
||||
(
|
||||
new osg::TessellationHints,
|
||||
"TessellationHints",
|
||||
|
||||
@@ -15,7 +15,7 @@ bool TexEnv_matchModeStr(const char* str,TexEnv::Mode& mode);
|
||||
const char* TexEnv_getModeStr(TexEnv::Mode mode);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexEnvProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexEnv)
|
||||
(
|
||||
new osg::TexEnv,
|
||||
"TexEnv",
|
||||
|
||||
@@ -22,7 +22,7 @@ bool TexEnvCombine_matchOperandParamStr(const char* str,GLint& value);
|
||||
const char* TexEnvCombine_getOperandParamStr(GLint value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexEnvCombineProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexEnvCombine)
|
||||
(
|
||||
new osg::TexEnvCombine,
|
||||
"TexEnvCombine",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool TexEnvFilter_readLocalData(Object& obj, Input& fr);
|
||||
bool TexEnvFilter_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexEnvFilterProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexEnvFilter)
|
||||
(
|
||||
new TexEnvFilter,
|
||||
"TexEnvFilter",
|
||||
|
||||
@@ -19,7 +19,7 @@ bool TexGen_matchModeStr(const char* str,TexGen::Mode& mode);
|
||||
const char* TexGen_getModeStr(TexGen::Mode mode);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexGenProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexGen)
|
||||
(
|
||||
new osg::TexGen,
|
||||
"TexGen",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool TexGenNode_readLocalData(Object& obj, Input& fr);
|
||||
bool TexGenNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexGenNodeProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexGenNode)
|
||||
(
|
||||
new osg::TexGenNode,
|
||||
"TexGenNode",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool TexMat_readLocalData(Object& obj, Input& fr);
|
||||
bool TexMat_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TexMatProxy
|
||||
REGISTER_DOTOSGWRAPPER(TexMat)
|
||||
(
|
||||
new osg::TexMat,
|
||||
"TexMat",
|
||||
|
||||
@@ -25,7 +25,7 @@ bool Texture_matchSourceTypeStr(const char* str,int& value);
|
||||
const char* Texture_getSourceTypeStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TextureProxy
|
||||
REGISTER_DOTOSGWRAPPER(Texture)
|
||||
(
|
||||
0,
|
||||
"TextureBase",
|
||||
|
||||
@@ -23,7 +23,7 @@ bool Texture1D_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* Texture1D_getInternalFormatStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_Texture1DProxy
|
||||
REGISTER_DOTOSGWRAPPER(Texture1D)
|
||||
(
|
||||
new osg::Texture1D,
|
||||
"Texture1D",
|
||||
|
||||
@@ -22,7 +22,7 @@ const char* Texture2D_getInternalFormatModeStr(Texture2D::InternalFormatMode mod
|
||||
bool Texture2D_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* Texture2D_getInternalFormatStr(int value);
|
||||
|
||||
RegisterDotOsgWrapperProxy g_OldTextureProxy
|
||||
REGISTER_DOTOSGWRAPPER(OldTexture)
|
||||
(
|
||||
new osg::Texture2D,
|
||||
"Texture",
|
||||
@@ -32,7 +32,7 @@ RegisterDotOsgWrapperProxy g_OldTextureProxy
|
||||
);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_Texture2DProxy
|
||||
REGISTER_DOTOSGWRAPPER(Texture2D)
|
||||
(
|
||||
new osg::Texture2D,
|
||||
"Texture2D",
|
||||
|
||||
@@ -23,7 +23,7 @@ bool Texture3D_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* Texture3D_getInternalFormatStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_Texture3DProxy
|
||||
REGISTER_DOTOSGWRAPPER(Texture3D)
|
||||
(
|
||||
new osg::Texture3D,
|
||||
"Texture3D",
|
||||
|
||||
@@ -14,7 +14,7 @@ bool TextureCubeMap_readLocalData(Object& obj, Input& fr);
|
||||
bool TextureCubeMap_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TextureCubeMapProxy
|
||||
REGISTER_DOTOSGWRAPPER(TextureCubeMap)
|
||||
(
|
||||
new osg::TextureCubeMap,
|
||||
"TextureCubeMap",
|
||||
|
||||
@@ -23,7 +23,7 @@ bool TextureRectangle_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* TextureRectangle_getInternalFormatStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TextureRectangleProxy
|
||||
REGISTER_DOTOSGWRAPPER(TextureRectangle)
|
||||
(
|
||||
new osg::TextureRectangle,
|
||||
"TextureRectangle",
|
||||
|
||||
@@ -15,7 +15,7 @@ bool Transform_readLocalData(Object& obj, Input& fr);
|
||||
bool Transform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_TransformProxy
|
||||
REGISTER_DOTOSGWRAPPER(Transform)
|
||||
(
|
||||
new osg::Transform,
|
||||
"Transform",
|
||||
|
||||
@@ -24,7 +24,7 @@ bool Uniform_readLocalData(Object& obj, Input& fr);
|
||||
bool Uniform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_UniformProxy
|
||||
REGISTER_DOTOSGWRAPPER(Uniform)
|
||||
(
|
||||
new osg::Uniform,
|
||||
"Uniform",
|
||||
|
||||
@@ -19,7 +19,7 @@ bool VertexProgram_readLocalData(Object& obj, Input& fr);
|
||||
bool VertexProgram_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_VertexProgramProxy
|
||||
REGISTER_DOTOSGWRAPPER(VertexProgram)
|
||||
(
|
||||
new osg::VertexProgram,
|
||||
"VertexProgram",
|
||||
|
||||
@@ -12,7 +12,7 @@ bool Viewport_readLocalData(Object& obj, Input& fr);
|
||||
bool Viewport_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ViewportProxy
|
||||
REGISTER_DOTOSGWRAPPER(Viewport)
|
||||
(
|
||||
new osg::Viewport,
|
||||
"Viewport",
|
||||
|
||||
Reference in New Issue
Block a user