Refactored the old style .osg plugin support so that the DotOsgWrappers are placed in their own dedicated plugins found in src/osgWrappers/deprecated_osg
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
SET(TARGET_SRC
|
||||
ReaderWriter.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgAnimation )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osganimation)
|
||||
|
||||
|
||||
1088
src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp
Normal file
1088
src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp
Normal file
File diff suppressed because it is too large
Load Diff
15
src/osgWrappers/deprecated-dotosg/osgFX/CMakeLists.txt
Normal file
15
src/osgWrappers/deprecated-dotosg/osgFX/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
SET(TARGET_SRC
|
||||
IO_AnisotropicLighting.cpp
|
||||
IO_BumpMapping.cpp
|
||||
IO_Cartoon.cpp
|
||||
IO_Effect.cpp
|
||||
IO_MultiTextureControl.cpp
|
||||
IO_Outline.cpp
|
||||
IO_Scribe.cpp
|
||||
IO_SpecularHighlights.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgFX )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgfx)
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <osgFX/AnisotropicLighting>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool AnisotropicLighting_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AnisotropicLighting_Proxy
|
||||
(
|
||||
new osgFX::AnisotropicLighting,
|
||||
"osgFX::AnisotropicLighting",
|
||||
"Object Node Group osgFX::Effect osgFX::AnisotropicLighting",
|
||||
AnisotropicLighting_readLocalData,
|
||||
AnisotropicLighting_writeLocalData
|
||||
);
|
||||
|
||||
bool AnisotropicLighting_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::AnisotropicLighting &myobj = static_cast<osgFX::AnisotropicLighting &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("lightNumber")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setLightNumber(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("lightingMapFileName") && fr[1].isString()) {
|
||||
osg::Image *lmap = fr.readImage(fr[1].getStr());
|
||||
if (lmap) {
|
||||
myobj.setLightingMap(lmap);
|
||||
}
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool AnisotropicLighting_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::AnisotropicLighting &myobj = static_cast<const osgFX::AnisotropicLighting &>(obj);
|
||||
|
||||
fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
|
||||
|
||||
const osg::Image *lmap = myobj.getLightingMap();
|
||||
if (lmap) {
|
||||
if (!lmap->getFileName().empty()) {
|
||||
fw.indent() << "lightingMapFileName \"" << lmap->getFileName() << "\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
83
src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp
Normal file
83
src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include <osgFX/BumpMapping>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool BumpMapping_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool BumpMapping_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy BumpMapping_Proxy
|
||||
(
|
||||
new osgFX::BumpMapping,
|
||||
"osgFX::BumpMapping",
|
||||
"Object Node Group osgFX::Effect osgFX::BumpMapping",
|
||||
BumpMapping_readLocalData,
|
||||
BumpMapping_writeLocalData
|
||||
);
|
||||
|
||||
bool BumpMapping_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::BumpMapping &myobj = static_cast<osgFX::BumpMapping &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("lightNumber")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setLightNumber(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("diffuseUnit")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setDiffuseTextureUnit(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("normalMapUnit")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setNormalMapTextureUnit(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> diffuse_tex = static_cast<osg::Texture2D *>(fr.readObjectOfType(osgDB::type_wrapper<osg::Texture2D>()));
|
||||
if (diffuse_tex.valid()) {
|
||||
myobj.setOverrideDiffuseTexture(diffuse_tex.get());
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> normal_tex = static_cast<osg::Texture2D *>(fr.readObjectOfType(osgDB::type_wrapper<osg::Texture2D>()));
|
||||
if (normal_tex.valid()) {
|
||||
myobj.setOverrideNormalMapTexture(normal_tex.get());
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool BumpMapping_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::BumpMapping &myobj = static_cast<const osgFX::BumpMapping &>(obj);
|
||||
|
||||
fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
|
||||
fw.indent() << "diffuseUnit " << myobj.getDiffuseTextureUnit() << "\n";
|
||||
fw.indent() << "normalMapUnit " << myobj.getNormalMapTextureUnit() << "\n";
|
||||
|
||||
if (myobj.getOverrideDiffuseTexture()) {
|
||||
fw.writeObject(*myobj.getOverrideDiffuseTexture());
|
||||
}
|
||||
|
||||
if (myobj.getOverrideNormalMapTexture()) {
|
||||
fw.writeObject(*myobj.getOverrideNormalMapTexture());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
65
src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp
Normal file
65
src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include <osgFX/Cartoon>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool Cartoon_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Cartoon_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Cartoon_Proxy
|
||||
(
|
||||
new osgFX::Cartoon,
|
||||
"osgFX::Cartoon",
|
||||
"Object Node Group osgFX::Effect osgFX::Cartoon",
|
||||
Cartoon_readLocalData,
|
||||
Cartoon_writeLocalData
|
||||
);
|
||||
|
||||
bool Cartoon_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::Cartoon &myobj = static_cast<osgFX::Cartoon &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("lightNumber")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setLightNumber(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("outlineColor")) {
|
||||
osg::Vec4 w;
|
||||
if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) &&
|
||||
fr[3].getFloat(w.z()) && fr[4].getFloat(w.w())) {
|
||||
myobj.setOutlineColor(w);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("outlineLineWidth")) {
|
||||
float f;
|
||||
if (fr[1].getFloat(f)) {
|
||||
myobj.setOutlineLineWidth(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Cartoon_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::Cartoon &myobj = static_cast<const osgFX::Cartoon &>(obj);
|
||||
|
||||
fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
|
||||
fw.indent() << "outlineColor " << myobj.getOutlineColor() << "\n";
|
||||
fw.indent() << "outlineLineWidth " << myobj.getOutlineLineWidth() << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
65
src/osgWrappers/deprecated-dotosg/osgFX/IO_Effect.cpp
Normal file
65
src/osgWrappers/deprecated-dotosg/osgFX/IO_Effect.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include <osgFX/Effect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool Effect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Effect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Effect_Proxy
|
||||
(
|
||||
0,
|
||||
"osgFX::Effect",
|
||||
"Object Node Group osgFX::Effect",
|
||||
Effect_readLocalData,
|
||||
Effect_writeLocalData
|
||||
);
|
||||
|
||||
bool Effect_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::Effect &myobj = static_cast<osgFX::Effect &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("enabled")) {
|
||||
if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setEnabled(false);
|
||||
} else {
|
||||
myobj.setEnabled(true);
|
||||
}
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("selectedTechnique")) {
|
||||
if (fr[1].matchWord("AUTO_DETECT")) {
|
||||
myobj.selectTechnique(osgFX::Effect::AUTO_DETECT);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else {
|
||||
int i;
|
||||
if (fr[1].getInt(i)) {
|
||||
myobj.selectTechnique(i);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Effect_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::Effect &myobj = static_cast<const osgFX::Effect &>(obj);
|
||||
|
||||
fw.indent() << "enabled " << (myobj.getEnabled() ? "TRUE" : "FALSE") << "\n";
|
||||
fw.indent() << "selectedTechnique ";
|
||||
if (myobj.getSelectedTechnique() == osgFX::Effect::AUTO_DETECT) {
|
||||
fw << "AUTO_DETECT\n";
|
||||
} else {
|
||||
fw << myobj.getSelectedTechnique() << "\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include <osgFX/MultiTextureControl>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool MultiTextureControl_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool MultiTextureControl_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy MultiTextureControl_Proxy
|
||||
(
|
||||
new osgFX::MultiTextureControl,
|
||||
"osgFX::MultiTextureControl",
|
||||
"Object Node osgFX::MultiTextureControl Group",
|
||||
MultiTextureControl_readLocalData,
|
||||
MultiTextureControl_writeLocalData
|
||||
);
|
||||
|
||||
bool MultiTextureControl_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::MultiTextureControl &mtc = static_cast<osgFX::MultiTextureControl &>(obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
bool matchFirst = false;
|
||||
if ((matchFirst=fr.matchSequence("TextureWeights {")) || fr.matchSequence("TextureWeights %i {"))
|
||||
{
|
||||
|
||||
// set up coordinates.
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
if (matchFirst)
|
||||
{
|
||||
fr += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
fr += 3;
|
||||
}
|
||||
|
||||
float weight=0.0f;
|
||||
unsigned int i=0;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
if (fr[0].getFloat(weight))
|
||||
{
|
||||
mtc.setTextureWeight(i,weight);
|
||||
++fr;
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
|
||||
iteratorAdvanced = true;
|
||||
++fr;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool MultiTextureControl_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::MultiTextureControl &mtc = static_cast<const osgFX::MultiTextureControl &>(obj);
|
||||
|
||||
fw.indent() << "TextureWeights "<<mtc.getNumTextureWeights()<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
for(unsigned int i=0; i<mtc.getNumTextureWeights();++i)
|
||||
{
|
||||
fw.indent() << mtc.getTextureWeight(i)<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
79
src/osgWrappers/deprecated-dotosg/osgFX/IO_Outline.cpp
Normal file
79
src/osgWrappers/deprecated-dotosg/osgFX/IO_Outline.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
// -*-c++-*-
|
||||
|
||||
/*
|
||||
* OpenSceneGraph - Copyright (C) 1998-2009 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* osgFX::Outline - Copyright (C) 2004,2009 Ulrich Hertlein
|
||||
*/
|
||||
|
||||
#include <osgFX/Outline>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
|
||||
bool Outline_readLocalData(osg::Object& obj, osgDB::Input& fr);
|
||||
bool Outline_writeLocalData(const osg::Object& obj, osgDB::Output& fw);
|
||||
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Outline_Proxy
|
||||
(
|
||||
new osgFX::Outline,
|
||||
"osgFX::Outline",
|
||||
"Object Node Group osgFX::Effect osgFX::Outline",
|
||||
Outline_readLocalData,
|
||||
Outline_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool Outline_readLocalData(osg::Object& obj, osgDB::Input& fr)
|
||||
{
|
||||
osgFX::Outline& myobj = static_cast<osgFX::Outline&>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("outlineWidth")) {
|
||||
float w;
|
||||
if (fr[1].getFloat(w)) {
|
||||
myobj.setWidth(w);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("outlineColor")) {
|
||||
osg::Vec4 col;
|
||||
if (fr[1].getFloat(col.x()) && fr[2].getFloat(col.y()) &&
|
||||
fr[3].getFloat(col.z()) && fr[4].getFloat(col.w())) {
|
||||
myobj.setColor(col);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Outline_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgFX::Outline& myobj = static_cast<const osgFX::Outline&>(obj);
|
||||
|
||||
fw.indent() << "outlineWidth " << myobj.getWidth() << std::endl;
|
||||
fw.indent() << "outlineColor " << myobj.getColor() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
55
src/osgWrappers/deprecated-dotosg/osgFX/IO_Scribe.cpp
Normal file
55
src/osgWrappers/deprecated-dotosg/osgFX/IO_Scribe.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <osgFX/Scribe>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool Scribe_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Scribe_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Scribe_Proxy
|
||||
(
|
||||
new osgFX::Scribe,
|
||||
"osgFX::Scribe",
|
||||
"Object Node Group osgFX::Effect osgFX::Scribe",
|
||||
Scribe_readLocalData,
|
||||
Scribe_writeLocalData
|
||||
);
|
||||
|
||||
bool Scribe_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::Scribe &myobj = static_cast<osgFX::Scribe &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("wireframeColor")) {
|
||||
osg::Vec4 w;
|
||||
if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) &&
|
||||
fr[3].getFloat(w.z()) && fr[4].getFloat(w.w())) {
|
||||
myobj.setWireframeColor(w);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("wireframeLineWidth")) {
|
||||
float f;
|
||||
if (fr[1].getFloat(f)) {
|
||||
myobj.setWireframeLineWidth(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Scribe_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::Scribe &myobj = static_cast<const osgFX::Scribe &>(obj);
|
||||
|
||||
fw.indent() << "wireframeColor " << myobj.getWireframeColor() << "\n";
|
||||
fw.indent() << "wireframeLineWidth " << myobj.getWireframeLineWidth() << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#include <osgFX/SpecularHighlights>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool SpecularHighlights_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SpecularHighlights_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SpecularHighlights_Proxy
|
||||
(
|
||||
new osgFX::SpecularHighlights,
|
||||
"osgFX::SpecularHighlights",
|
||||
"Object Node Group osgFX::Effect osgFX::SpecularHighlights",
|
||||
SpecularHighlights_readLocalData,
|
||||
SpecularHighlights_writeLocalData
|
||||
);
|
||||
|
||||
bool SpecularHighlights_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgFX::SpecularHighlights &myobj = static_cast<osgFX::SpecularHighlights &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("lightNumber")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setLightNumber(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("textureUnit")) {
|
||||
int n;
|
||||
if (fr[1].getInt(n)) {
|
||||
myobj.setTextureUnit(n);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("specularColor")) {
|
||||
osg::Vec4 w;
|
||||
if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) &&
|
||||
fr[3].getFloat(w.z()) && fr[4].getFloat(w.w())) {
|
||||
myobj.setSpecularColor(w);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("specularExponent")) {
|
||||
float f;
|
||||
if (fr[1].getFloat(f)) {
|
||||
myobj.setSpecularExponent(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool SpecularHighlights_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgFX::SpecularHighlights &myobj = static_cast<const osgFX::SpecularHighlights &>(obj);
|
||||
|
||||
fw.indent() << "lightNumber " << myobj.getLightNumber() << "\n";
|
||||
fw.indent() << "textureUnit " << myobj.getTextureUnit() << "\n";
|
||||
fw.indent() << "specularColor " << myobj.getSpecularColor() << "\n";
|
||||
fw.indent() << "specularExponent " << myobj.getSpecularExponent() << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
37
src/osgWrappers/deprecated-dotosg/osgParticle/CMakeLists.txt
Normal file
37
src/osgWrappers/deprecated-dotosg/osgParticle/CMakeLists.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
SET(TARGET_SRC
|
||||
IO_AccelOperator.cpp
|
||||
IO_AngularAccelOperator.cpp
|
||||
IO_BoxPlacer.cpp
|
||||
IO_CenteredPlacer.cpp
|
||||
IO_ConnectedParticleSystem.cpp
|
||||
IO_ConstantRateCounter.cpp
|
||||
IO_Emitter.cpp
|
||||
IO_ExplosionDebrisEffect.cpp
|
||||
IO_ExplosionEffect.cpp
|
||||
IO_FireEffect.cpp
|
||||
IO_FluidFrictionOperator.cpp
|
||||
IO_FluidProgram.cpp
|
||||
IO_ForceOperator.cpp
|
||||
IO_LinearInterpolator.cpp
|
||||
IO_ModularEmitter.cpp
|
||||
IO_ModularProgram.cpp
|
||||
IO_MultiSegmentPlacer.cpp
|
||||
IO_Particle.cpp
|
||||
IO_ParticleEffect.cpp
|
||||
IO_ParticleProcessor.cpp
|
||||
IO_ParticleSystem.cpp
|
||||
IO_ParticleSystemUpdater.cpp
|
||||
IO_PointPlacer.cpp
|
||||
IO_Program.cpp
|
||||
IO_RadialShooter.cpp
|
||||
IO_RandomRateCounter.cpp
|
||||
IO_SectorPlacer.cpp
|
||||
IO_SegmentPlacer.cpp
|
||||
IO_SmokeEffect.cpp
|
||||
IO_SmokeTrailEffect.cpp
|
||||
IO_VariableRateCounter.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgParticle )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgparticle)
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
#include <osgParticle/AccelOperator>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool AccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool AccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AccelOperator_Proxy
|
||||
(
|
||||
new osgParticle::AccelOperator,
|
||||
"AccelOperator",
|
||||
"Object Operator AccelOperator",
|
||||
AccelOperator_readLocalData,
|
||||
AccelOperator_writeLocalData
|
||||
);
|
||||
|
||||
bool AccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::AccelOperator &aop = static_cast<osgParticle::AccelOperator &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 a;
|
||||
|
||||
if (fr[0].matchWord("acceleration")) {
|
||||
if (fr[1].getFloat(a.x()) && fr[2].getFloat(a.y()) && fr[3].getFloat(a.z())) {
|
||||
aop.setAcceleration(a);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool AccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::AccelOperator &aop = static_cast<const osgParticle::AccelOperator &>(obj);
|
||||
osg::Vec3 a = aop.getAcceleration();
|
||||
fw.indent() << "acceleration " << a.x() << " " << a.y() << " " << a.z() << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
#include <osgParticle/AngularAccelOperator>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool AngularAccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool AngularAccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AngularAccelOperator_Proxy
|
||||
(
|
||||
new osgParticle::AngularAccelOperator,
|
||||
"AngularAccelOperator",
|
||||
"Object Operator AngularAccelOperator",
|
||||
AngularAccelOperator_readLocalData,
|
||||
AngularAccelOperator_writeLocalData
|
||||
);
|
||||
|
||||
bool AngularAccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::AngularAccelOperator &aop = static_cast<osgParticle::AngularAccelOperator &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 a;
|
||||
|
||||
if (fr[0].matchWord("angularAcceleration")) {
|
||||
if (fr[1].getFloat(a.x()) && fr[2].getFloat(a.y()) && fr[3].getFloat(a.z())) {
|
||||
aop.setAngularAcceleration(a);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool AngularAccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::AngularAccelOperator &aop = static_cast<const osgParticle::AngularAccelOperator &>(obj);
|
||||
osg::Vec3 a = aop.getAngularAcceleration();
|
||||
fw.indent() << "angularAcceleration " << a.x() << " " << a.y() << " " << a.z() << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
|
||||
#include <osgParticle/BoxPlacer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool BoxPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool BoxPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy BoxPlacer_Proxy
|
||||
(
|
||||
new osgParticle::BoxPlacer,
|
||||
"BoxPlacer",
|
||||
"Object Placer CenteredPlacer BoxPlacer",
|
||||
BoxPlacer_readLocalData,
|
||||
BoxPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool BoxPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::BoxPlacer &myobj = static_cast<osgParticle::BoxPlacer &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::rangef r;
|
||||
if (fr[0].matchWord("xRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setXRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("yRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setYRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("zRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setZRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool BoxPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::BoxPlacer &myobj = static_cast<const osgParticle::BoxPlacer &>(obj);
|
||||
|
||||
osgParticle::rangef r;
|
||||
|
||||
r = myobj.getXRange();
|
||||
fw.indent() << "xRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
r = myobj.getYRange();
|
||||
fw.indent() << "yRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
r = myobj.getZRange();
|
||||
fw.indent() << "zRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
#include <osgParticle/CenteredPlacer>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool CenteredPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool CenteredPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy CenteredPlacer_Proxy
|
||||
(
|
||||
0,
|
||||
"CenteredPlacer",
|
||||
"Object Placer CenteredPlacer",
|
||||
CenteredPlacer_readLocalData,
|
||||
CenteredPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool CenteredPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::CenteredPlacer &myobj = static_cast<osgParticle::CenteredPlacer &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 v;
|
||||
if (fr[0].matchWord("center")) {
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.setCenter(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool CenteredPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::CenteredPlacer &myobj = static_cast<const osgParticle::CenteredPlacer &>(obj);
|
||||
|
||||
osg::Vec3 v = myobj.getCenter();
|
||||
fw.indent() << "center " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#include <osgParticle/ConnectedParticleSystem>
|
||||
|
||||
#include <osg/BoundingBox>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
extern bool read_particle(osgDB::Input &fr, osgParticle::Particle &P);
|
||||
extern void write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
|
||||
|
||||
bool ConnectedParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ConnectedParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ConnectedParticleSystem_Proxy
|
||||
(
|
||||
new osgParticle::ConnectedParticleSystem,
|
||||
"ConnectedParticleSystem",
|
||||
"Object Drawable ParticleSystem ConnectedParticleSystem",
|
||||
ConnectedParticleSystem_readLocalData,
|
||||
ConnectedParticleSystem_writeLocalData
|
||||
);
|
||||
|
||||
bool ConnectedParticleSystem_readLocalData(osg::Object&, osgDB::Input&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConnectedParticleSystem_writeLocalData(const osg::Object&, osgDB::Output&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#include <osgParticle/ConstantRateCounter>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool ConstantRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ConstantRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ConstantRateCounter_Proxy
|
||||
(
|
||||
new osgParticle::ConstantRateCounter,
|
||||
"ConstantRateCounter",
|
||||
"Object Counter ConstantRateCounter",
|
||||
ConstantRateCounter_readLocalData,
|
||||
ConstantRateCounter_writeLocalData
|
||||
);
|
||||
|
||||
bool ConstantRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ConstantRateCounter &myobj = static_cast<osgParticle::ConstantRateCounter &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("minimumNumberOfParticlesToCreate")) {
|
||||
int v;
|
||||
if (fr[1].getInt(v)) {
|
||||
myobj.setMinimumNumberOfParticlesToCreate(v);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("numberOfParticlesPerSecondToCreate")) {
|
||||
float v;
|
||||
if (fr[1].getFloat(v)) {
|
||||
myobj.setNumberOfParticlesPerSecondToCreate(v);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ConstantRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ConstantRateCounter &myobj = static_cast<const osgParticle::ConstantRateCounter &>(obj);
|
||||
|
||||
fw.indent() << "minimumNumberOfParticlesToCreate " << myobj.getMinimumNumberOfParticlesToCreate() << std::endl;
|
||||
fw.indent() << "numberOfParticlesPerSecondToCreate " << myobj.getNumberOfParticlesPerSecondToCreate() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
70
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Emitter.cpp
Normal file
70
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Emitter.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
#include <osgParticle/Emitter>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
extern bool read_particle(osgDB::Input &fr, osgParticle::Particle &P);
|
||||
extern void write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
|
||||
|
||||
bool Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Emitter_Proxy
|
||||
(
|
||||
0,
|
||||
"Emitter",
|
||||
"Object Node ParticleProcessor Emitter",
|
||||
Emitter_readLocalData,
|
||||
Emitter_writeLocalData
|
||||
);
|
||||
|
||||
bool Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::Emitter &myobj = static_cast<osgParticle::Emitter &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("useDefaultTemplate")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setUseDefaultTemplate(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setUseDefaultTemplate(false);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("particleTemplate")) {
|
||||
++fr;
|
||||
itAdvanced = true;
|
||||
osgParticle::Particle P;
|
||||
if (read_particle(fr, P)) {
|
||||
myobj.setParticleTemplate(P);
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::Emitter &myobj = static_cast<const osgParticle::Emitter &>(obj);
|
||||
|
||||
fw.indent() << "useDefaultTemplate ";
|
||||
if (!myobj.getUseDefaultTemplate()) {
|
||||
fw << "FALSE" << std::endl;
|
||||
fw.indent() << "particleTemplate ";
|
||||
write_particle(myobj.getParticleTemplate(), fw);
|
||||
fw << std::endl;
|
||||
} else {
|
||||
fw << "TRUE" << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/ExplosionDebrisEffect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool ExplosionDebrisEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ExplosionDebrisEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ExplosionDebrisEffect_Proxy
|
||||
(
|
||||
new osgParticle::ExplosionDebrisEffect(false),
|
||||
"ExplosionDebrisEffect",
|
||||
"Object Node ParticleEffect ExplosionDebrisEffect",
|
||||
ExplosionDebrisEffect_readLocalData,
|
||||
ExplosionDebrisEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool ExplosionDebrisEffect_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExplosionDebrisEffect_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/ExplosionEffect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool ExplosionEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ExplosionEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ExplosionEffect_Proxy
|
||||
(
|
||||
new osgParticle::ExplosionEffect(false),
|
||||
"ExplosionEffect",
|
||||
"Object Node ParticleEffect ExplosionEffect",
|
||||
ExplosionEffect_readLocalData,
|
||||
ExplosionEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool ExplosionEffect_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExplosionEffect_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/FireEffect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool FireEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool FireEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy FireEffect_Proxy
|
||||
(
|
||||
new osgParticle::FireEffect(false),
|
||||
"FireEffect",
|
||||
"Object Node ParticleEffect FireEffect",
|
||||
FireEffect_readLocalData,
|
||||
FireEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool FireEffect_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FireEffect_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
#include <osgParticle/FluidFrictionOperator>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool FluidFrictionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy FluidFrictionOperator_Proxy
|
||||
(
|
||||
new osgParticle::FluidFrictionOperator,
|
||||
"FluidFrictionOperator",
|
||||
"Object Operator FluidFrictionOperator",
|
||||
FluidFrictionOperator_readLocalData,
|
||||
FluidFrictionOperator_writeLocalData
|
||||
);
|
||||
|
||||
bool FluidFrictionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::FluidFrictionOperator &aop = static_cast<osgParticle::FluidFrictionOperator &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
float f;
|
||||
osg::Vec3 w;
|
||||
|
||||
if (fr[0].matchWord("fluidDensity")) {
|
||||
if (fr[1].getFloat(f)) {
|
||||
aop.setFluidDensity(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("fluidViscosity")) {
|
||||
if (fr[1].getFloat(f)) {
|
||||
aop.setFluidViscosity(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("overrideRadius")) {
|
||||
if (fr[1].getFloat(f)) {
|
||||
aop.setOverrideRadius(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("wind")) {
|
||||
if (fr[1].getFloat(w.x()) && fr[2].getFloat(w.y()) && fr[3].getFloat(w.z())) {
|
||||
aop.setWind(w);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::FluidFrictionOperator &aop = static_cast<const osgParticle::FluidFrictionOperator &>(obj);
|
||||
fw.indent() << "fluidDensity " << aop.getFluidDensity() << std::endl;
|
||||
fw.indent() << "fluidViscosity " << aop.getFluidViscosity() << std::endl;
|
||||
fw.indent() << "overrideRadius " << aop.getOverrideRadius() << std::endl;
|
||||
|
||||
osg::Vec3 w = aop.getWind();
|
||||
fw.indent() << "wind " << w << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
#include <osgParticle/FluidProgram>
|
||||
#include <osgParticle/Operator>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool FluidProgram_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool FluidProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy FluidProgram_Proxy
|
||||
(
|
||||
new osgParticle::FluidProgram,
|
||||
"FluidProgram",
|
||||
"Object Node ParticleProcessor osgParticle::Program FluidProgram",
|
||||
FluidProgram_readLocalData,
|
||||
FluidProgram_writeLocalData
|
||||
);
|
||||
|
||||
bool FluidProgram_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::FluidProgram &myobj = static_cast<osgParticle::FluidProgram &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 vec;
|
||||
float f;
|
||||
|
||||
if (fr[0].matchWord("acceleration")) {
|
||||
if (fr[1].getFloat(vec.x()) && fr[2].getFloat(vec.y()) && fr[3].getFloat(vec.z())) {
|
||||
myobj.setAcceleration(vec);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("viscosity")) {
|
||||
if (fr[1].getFloat(f)) {
|
||||
myobj.setFluidViscosity(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("density")) {
|
||||
if (fr[1].getFloat(f)) {
|
||||
myobj.setFluidDensity(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("wind")) {
|
||||
if (fr[1].getFloat(vec.x()) && fr[2].getFloat(vec.y()) && fr[3].getFloat(vec.z())) {
|
||||
myobj.setWind(vec);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool FluidProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::FluidProgram &myobj = static_cast<const osgParticle::FluidProgram &>(obj);
|
||||
|
||||
osg::Vec3 vec;
|
||||
float f;
|
||||
|
||||
vec = myobj.getAcceleration();
|
||||
fw.indent() << "acceleration " << vec << std::endl;
|
||||
|
||||
f = myobj.getFluidViscosity();
|
||||
fw.indent() << "viscosity " << f << std::endl;
|
||||
|
||||
f = myobj.getFluidDensity();
|
||||
fw.indent() << "density " << f << std::endl;
|
||||
|
||||
vec = myobj.getWind();
|
||||
fw.indent() << "wind " << vec << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
#include <osgParticle/ForceOperator>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool ForceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ForceOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ForceOperator_Proxy
|
||||
(
|
||||
new osgParticle::ForceOperator,
|
||||
"ForceOperator",
|
||||
"Object Operator ForceOperator",
|
||||
ForceOperator_readLocalData,
|
||||
ForceOperator_writeLocalData
|
||||
);
|
||||
|
||||
bool ForceOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ForceOperator &fop = static_cast<osgParticle::ForceOperator &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 f;
|
||||
|
||||
if (fr[0].matchWord("force")) {
|
||||
if (fr[1].getFloat(f.x()) && fr[2].getFloat(f.y()) && fr[3].getFloat(f.z())) {
|
||||
fop.setForce(f);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ForceOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ForceOperator &fop = static_cast<const osgParticle::ForceOperator &>(obj);
|
||||
osg::Vec3 f = fop.getForce();
|
||||
fw.indent() << "force " << f.x() << " " << f.y() << " " << f.z() << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/LinearInterpolator>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool LinearInterpolator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool LinearInterpolator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy LinearInterpolator_Proxy
|
||||
(
|
||||
new osgParticle::LinearInterpolator,
|
||||
"LinearInterpolator",
|
||||
"Object Interpolator LinearInterpolator",
|
||||
LinearInterpolator_readLocalData,
|
||||
LinearInterpolator_writeLocalData
|
||||
);
|
||||
|
||||
bool LinearInterpolator_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LinearInterpolator_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
#include <osgParticle/ModularEmitter>
|
||||
#include <osgParticle/Counter>
|
||||
#include <osgParticle/Placer>
|
||||
#include <osgParticle/Shooter>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool ModularEmitter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ModularEmitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ModularEmitter_Proxy
|
||||
(
|
||||
new osgParticle::ModularEmitter,
|
||||
"ModularEmitter",
|
||||
"Object Node ParticleProcessor Emitter ModularEmitter",
|
||||
ModularEmitter_readLocalData,
|
||||
ModularEmitter_writeLocalData
|
||||
);
|
||||
|
||||
bool ModularEmitter_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ModularEmitter &myobj = static_cast<osgParticle::ModularEmitter &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::Counter *counter = static_cast<osgParticle::Counter *>(fr.readObjectOfType(osgDB::type_wrapper<osgParticle::Counter>()));
|
||||
if (counter) {
|
||||
myobj.setCounter(counter);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
osgParticle::Placer *placer = static_cast<osgParticle::Placer *>(fr.readObjectOfType(osgDB::type_wrapper<osgParticle::Placer>()));
|
||||
if (placer) {
|
||||
myobj.setPlacer(placer);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
osgParticle::Shooter *shooter = static_cast<osgParticle::Shooter *>(fr.readObjectOfType(osgDB::type_wrapper<osgParticle::Shooter>()));
|
||||
if (shooter) {
|
||||
myobj.setShooter(shooter);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ModularEmitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ModularEmitter &myobj = static_cast<const osgParticle::ModularEmitter &>(obj);
|
||||
|
||||
if (myobj.getCounter()) fw.writeObject(*myobj.getCounter());
|
||||
if (myobj.getPlacer()) fw.writeObject(*myobj.getPlacer());
|
||||
if (myobj.getShooter()) fw.writeObject(*myobj.getShooter());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
#include <osgParticle/ModularProgram>
|
||||
#include <osgParticle/Operator>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool ModularProgram_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ModularProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ModularProgram_Proxy
|
||||
(
|
||||
new osgParticle::ModularProgram,
|
||||
"ModularProgram",
|
||||
"Object Node ParticleProcessor osgParticle::Program ModularProgram",
|
||||
ModularProgram_readLocalData,
|
||||
ModularProgram_writeLocalData
|
||||
);
|
||||
|
||||
bool ModularProgram_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ModularProgram &myobj = static_cast<osgParticle::ModularProgram &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::Operator *op = static_cast<osgParticle::Operator *>(fr.readObjectOfType(osgDB::type_wrapper<osgParticle::Operator>()));
|
||||
if (op) {
|
||||
myobj.addOperator(op);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ModularProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ModularProgram &myobj = static_cast<const osgParticle::ModularProgram &>(obj);
|
||||
|
||||
for (int i=0; i<myobj.numOperators(); ++i) {
|
||||
fw.writeObject(*myobj.getOperator(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
#include <osgParticle/MultiSegmentPlacer>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool MultiSegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool MultiSegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy MultiSegmentPlacer_Proxy
|
||||
(
|
||||
new osgParticle::MultiSegmentPlacer,
|
||||
"MultiSegmentPlacer",
|
||||
"Object Placer MultiSegmentPlacer",
|
||||
MultiSegmentPlacer_readLocalData,
|
||||
MultiSegmentPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool MultiSegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::MultiSegmentPlacer &myobj = static_cast<osgParticle::MultiSegmentPlacer &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 v;
|
||||
|
||||
if (fr[0].matchWord("vertex")) {
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.addVertex(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool MultiSegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::MultiSegmentPlacer &myobj = static_cast<const osgParticle::MultiSegmentPlacer &>(obj);
|
||||
|
||||
int n = myobj.numVertices();
|
||||
|
||||
for (int i=0; i<n; ++i) {
|
||||
const osg::Vec3 &v = myobj.getVertex(i);
|
||||
fw.indent() << "vertex " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
243
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp
Normal file
243
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
|
||||
#include <osgParticle/Particle>
|
||||
#include <osgParticle/Interpolator>
|
||||
#include <osgParticle/range>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Notify>
|
||||
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool read_particle(osgDB::Input &fr, osgParticle::Particle &P)
|
||||
{
|
||||
if (fr[0].matchString("{")) {
|
||||
++fr;
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
bool itAdvanced = true;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry && itAdvanced) {
|
||||
itAdvanced = false;
|
||||
if (fr[0].matchWord("shape")) {
|
||||
const char *ptstr = fr[1].getStr();
|
||||
if (ptstr) {
|
||||
if (std::string(ptstr) == "QUAD") {
|
||||
P.setShape(osgParticle::Particle::QUAD);
|
||||
} else if (std::string(ptstr) == "HEXAGON") {
|
||||
P.setShape(osgParticle::Particle::HEXAGON);
|
||||
} else if (std::string(ptstr) == "POINT") {
|
||||
P.setShape(osgParticle::Particle::POINT);
|
||||
} else if (std::string(ptstr) == "QUAD_TRIANGLESTRIP") {
|
||||
P.setShape(osgParticle::Particle::QUAD_TRIANGLESTRIP);
|
||||
} else if (std::string(ptstr) == "LINE") {
|
||||
P.setShape(osgParticle::Particle::LINE);
|
||||
} else {
|
||||
osg::notify(osg::WARN) << "Particle reader warning: invalid shape: " << ptstr << std::endl;
|
||||
}
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("lifeTime")) {
|
||||
float lt;
|
||||
if (fr[1].getFloat(lt)) {
|
||||
P.setLifeTime(lt);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("sizeRange")) {
|
||||
osgParticle::rangef r;
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
P.setSizeRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("alphaRange")) {
|
||||
osgParticle::rangef r;
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
P.setAlphaRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("colorRange")) {
|
||||
osgParticle::rangev4 r;
|
||||
if (fr[1].getFloat(r.minimum.x()) && fr[2].getFloat(r.minimum.y()) && fr[3].getFloat(r.minimum.z()) && fr[4].getFloat(r.minimum.w()) &&
|
||||
fr[5].getFloat(r.maximum.x()) && fr[6].getFloat(r.maximum.y()) && fr[7].getFloat(r.maximum.z()) && fr[8].getFloat(r.maximum.w())) {
|
||||
P.setColorRange(r);
|
||||
fr += 9;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("position")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
P.setPosition(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("velocity")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
P.setVelocity(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("angle")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
P.setAngle(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("angularVelocity")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
P.setAngularVelocity(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("radius")) {
|
||||
float f;
|
||||
if (fr[1].getFloat(f)) {
|
||||
P.setRadius(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("mass")) {
|
||||
float f;
|
||||
if (fr[1].getFloat(f)) {
|
||||
P.setMass(f);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("textureTile")) {
|
||||
int sTile,tTile,numTiles;
|
||||
if (fr[1].getInt(sTile) && fr[2].getInt(tTile) && fr[3].getInt(numTiles)) {
|
||||
P.setTextureTile(sTile,tTile,numTiles);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// interpolators
|
||||
|
||||
if (fr[0].matchWord("sizeInterpolator") && fr[1].matchString("{")) {
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
osgParticle::Interpolator *ip = dynamic_cast<osgParticle::Interpolator *>(fr.readObject());
|
||||
if (ip) {
|
||||
P.setSizeInterpolator(ip);
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
if (fr[0].matchWord("alphaInterpolator") && fr[1].matchString("{")) {
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
osgParticle::Interpolator *ip = dynamic_cast<osgParticle::Interpolator *>(fr.readObject());
|
||||
if (ip) {
|
||||
P.setAlphaInterpolator(ip);
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
if (fr[0].matchWord("colorInterpolator") && fr[1].matchString("{")) {
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
osgParticle::Interpolator *ip = dynamic_cast<osgParticle::Interpolator *>(fr.readObject());
|
||||
if (ip) {
|
||||
P.setColorInterpolator(ip);
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void write_particle(const osgParticle::Particle &P, osgDB::Output &fw)
|
||||
{
|
||||
fw << "{" << std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
fw.indent() << "shape ";
|
||||
switch (P.getShape())
|
||||
{
|
||||
case osgParticle::Particle::POINT: fw << "POINT" << std::endl; break;
|
||||
case osgParticle::Particle::HEXAGON: fw << "HEXAGON" << std::endl; break;
|
||||
case osgParticle::Particle::QUAD_TRIANGLESTRIP: fw << "QUAD_TRIANGLESTRIP" << std::endl; break;
|
||||
case osgParticle::Particle::QUAD: fw << "QUAD" << std::endl; break;
|
||||
case osgParticle::Particle::LINE:
|
||||
default: fw << "LINE" << std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent() << "lifeTime " << P.getLifeTime() << std::endl;
|
||||
|
||||
osgParticle::rangef rf = P.getSizeRange();
|
||||
fw.indent() << "sizeRange " << rf.minimum << " " << rf.maximum << std::endl;
|
||||
|
||||
rf = P.getAlphaRange();
|
||||
fw.indent() << "alphaRange " << rf.minimum << " " << rf.maximum << std::endl;
|
||||
|
||||
osgParticle::rangev4 rv4 = P.getColorRange();
|
||||
fw.indent() << "colorRange ";
|
||||
fw << rv4.minimum.x() << " " << rv4.minimum.y() << " " << rv4.minimum.z() << " " << rv4.minimum.w() << " ";
|
||||
fw << rv4.maximum.x() << " " << rv4.maximum.y() << " " << rv4.maximum.z() << " " << rv4.maximum.w() << std::endl;
|
||||
|
||||
osg::Vec3 v = P.getPosition();
|
||||
fw.indent() << "position ";
|
||||
fw << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
v = P.getVelocity();
|
||||
fw.indent() << "velocity ";
|
||||
fw << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
v = P.getAngle();
|
||||
fw.indent() << "angle ";
|
||||
fw << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
v = P.getAngularVelocity();
|
||||
fw.indent() << "angularVelocity ";
|
||||
fw << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
fw.indent() << "radius " << P.getRadius() << std::endl;
|
||||
fw.indent() << "mass " << P.getMass() << std::endl;
|
||||
fw.indent() << "textureTile " << P.getTileS() << " " << P.getTileT() << " " << P.getNumTiles() << std::endl;
|
||||
|
||||
// interpolators
|
||||
|
||||
fw.indent() << "sizeInterpolator {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*P.getSizeInterpolator());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
|
||||
fw.indent() << "alphaInterpolator {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*P.getAlphaInterpolator());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
|
||||
fw.indent() << "colorInterpolator {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*P.getColorInterpolator());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
#include <osgParticle/ParticleEffect>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
bool ParticleEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ParticleEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ParticleEffect_Proxy
|
||||
(
|
||||
0,
|
||||
"ParticleEffect",
|
||||
"Object Node ParticleEffect",
|
||||
ParticleEffect_readLocalData,
|
||||
ParticleEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool ParticleEffect_readLocalData(osg::Object& object, osgDB::Input& fr)
|
||||
{
|
||||
osgParticle::ParticleEffect& effect = static_cast<osgParticle::ParticleEffect&>(object);
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("textFileName %s"))
|
||||
{
|
||||
effect.setTextureFileName(fr[1].getStr());
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("position %f %f %f"))
|
||||
{
|
||||
osg::Vec3 position;
|
||||
fr[1].getFloat(position[0]);
|
||||
fr[2].getFloat(position[1]);
|
||||
fr[3].getFloat(position[2]);
|
||||
|
||||
effect.setPosition(position);
|
||||
|
||||
fr += 4;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("scale %f"))
|
||||
{
|
||||
float scale;
|
||||
fr[1].getFloat(scale);
|
||||
effect.setScale(scale);
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("intensity %f"))
|
||||
{
|
||||
float intensity;
|
||||
fr[1].getFloat(intensity);
|
||||
effect.setIntensity(intensity);
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("startTime %f"))
|
||||
{
|
||||
float startTime;
|
||||
fr[1].getFloat(startTime);
|
||||
effect.setStartTime(startTime);
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("emitterDuration %f"))
|
||||
{
|
||||
float emitterDuration;
|
||||
fr[1].getFloat(emitterDuration);
|
||||
effect.setEmitterDuration(emitterDuration);
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
osgParticle::Particle particle = effect.getDefaultParticleTemplate();
|
||||
bool particleSet = false;
|
||||
|
||||
if (fr.matchSequence("particleDuration %f"))
|
||||
{
|
||||
float particleDuration;
|
||||
fr[1].getFloat(particleDuration);
|
||||
particle.setLifeTime(particleDuration);
|
||||
particleSet = true;
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("particleSizeRange"))
|
||||
{
|
||||
osgParticle::rangef r;
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum))
|
||||
{
|
||||
particle.setSizeRange(r);
|
||||
particleSet = true;
|
||||
fr += 3;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("particleAlphaRange"))
|
||||
{
|
||||
osgParticle::rangef r;
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum))
|
||||
{
|
||||
particle.setAlphaRange(r);
|
||||
particleSet = true;
|
||||
fr += 3;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("particleColorRange"))
|
||||
{
|
||||
osgParticle::rangev4 r;
|
||||
if (fr[1].getFloat(r.minimum.x()) && fr[2].getFloat(r.minimum.y()) && fr[3].getFloat(r.minimum.z()) && fr[4].getFloat(r.minimum.w()) &&
|
||||
fr[5].getFloat(r.maximum.x()) && fr[6].getFloat(r.maximum.y()) && fr[7].getFloat(r.maximum.z()) && fr[8].getFloat(r.maximum.w()))
|
||||
{
|
||||
particle.setColorRange(r);
|
||||
particleSet = true;
|
||||
fr += 9;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (particleSet)
|
||||
{
|
||||
effect.setDefaultParticleTemplate(particle);
|
||||
}
|
||||
|
||||
|
||||
if (fr.matchSequence("wind %f %f %f"))
|
||||
{
|
||||
osg::Vec3 wind;
|
||||
fr[1].getFloat(wind[0]);
|
||||
fr[2].getFloat(wind[1]);
|
||||
fr[3].getFloat(wind[2]);
|
||||
|
||||
effect.setWind(wind);
|
||||
|
||||
fr += 4;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("useLocalParticleSystem"))
|
||||
{
|
||||
if (fr[1].matchWord("FALSE"))
|
||||
{
|
||||
effect.setUseLocalParticleSystem(false);
|
||||
fr+=2;
|
||||
itrAdvanced = true;
|
||||
|
||||
// now read the particle system that is shared with an node external to this particle effect
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgParticle::ParticleSystem>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
osgParticle::ParticleSystem* ps = static_cast<osgParticle::ParticleSystem*>(readObject.get());
|
||||
effect.setParticleSystem(ps);
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
else if (fr[1].matchWord("TRUE"))
|
||||
{
|
||||
effect.setUseLocalParticleSystem(true);
|
||||
fr+=2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!effect.getAutomaticSetup())
|
||||
{
|
||||
// since by default the clone of the ParticleEffect is done with automatic setup off to prevent premature loading of
|
||||
// imagery, we still want to make sure the ParticleEffect is properly built so we'll now mannually enable the automatic setup
|
||||
// run the buildEffect().
|
||||
effect.setAutomaticSetup(true);
|
||||
effect.buildEffect();
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool ParticleEffect_writeLocalData(const osg::Object& object, osgDB::Output& fw)
|
||||
{
|
||||
const osgParticle::ParticleEffect& effect = static_cast<const osgParticle::ParticleEffect&>(object);
|
||||
fw.indent()<<"textFileName "<<fw.wrapString(effect.getTextureFileName())<<std::endl;
|
||||
fw.indent()<<"position "<<effect.getPosition()<<std::endl;
|
||||
fw.indent()<<"scale "<<effect.getScale()<<std::endl;
|
||||
fw.indent()<<"intensity "<<effect.getIntensity()<<std::endl;
|
||||
fw.indent()<<"startTime "<<effect.getStartTime()<<std::endl;
|
||||
fw.indent()<<"emitterDuration "<<effect.getEmitterDuration()<<std::endl;
|
||||
fw.indent()<<"particleDuration "<<effect.getParticleDuration()<<std::endl;
|
||||
|
||||
osgParticle::rangef rf = effect.getDefaultParticleTemplate().getSizeRange();
|
||||
fw.indent() << "particleSizeRange " << rf.minimum << " " << rf.maximum << std::endl;
|
||||
|
||||
rf = effect.getDefaultParticleTemplate().getAlphaRange();
|
||||
fw.indent() << "particleAlphaRange " << rf.minimum << " " << rf.maximum << std::endl;
|
||||
|
||||
osgParticle::rangev4 rv4 = effect.getDefaultParticleTemplate().getColorRange();
|
||||
fw.indent() << "particleColorRange ";
|
||||
fw << rv4.minimum.x() << " " << rv4.minimum.y() << " " << rv4.minimum.z() << " " << rv4.minimum.w() << " ";
|
||||
fw << rv4.maximum.x() << " " << rv4.maximum.y() << " " << rv4.maximum.z() << " " << rv4.maximum.w() << std::endl;
|
||||
|
||||
fw.indent()<<"wind "<<effect.getWind()<<std::endl;
|
||||
|
||||
fw.indent()<<"useLocalParticleSystem ";
|
||||
if (effect.getUseLocalParticleSystem()) fw<<"TRUE"<<std::endl;
|
||||
else
|
||||
{
|
||||
fw<<"FALSE"<<std::endl;
|
||||
fw.writeObject(*effect.getParticleSystem());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
#include <osgParticle/ParticleProcessor>
|
||||
#include <osgParticle/ParticleSystem>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
extern bool read_particle(osgDB::Input &fr, osgParticle::Particle &P);
|
||||
extern void write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
|
||||
|
||||
bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ParticleProcessor_Proxy
|
||||
(
|
||||
0,
|
||||
"ParticleProcessor",
|
||||
"Object Node ParticleProcessor",
|
||||
ParticleProcessor_readLocalData,
|
||||
ParticleProcessor_writeLocalData
|
||||
);
|
||||
|
||||
bool ParticleProcessor_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ParticleProcessor &myobj = static_cast<osgParticle::ParticleProcessor &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osgParticle::ParticleSystem> ps_proto = new osgParticle::ParticleSystem;
|
||||
|
||||
osgParticle::ParticleSystem *ps = static_cast<osgParticle::ParticleSystem *>(fr.readObjectOfType(*ps_proto));
|
||||
if (ps) {
|
||||
myobj.setParticleSystem(ps);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("enabled")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setEnabled(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setEnabled(false);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("referenceFrame")) {
|
||||
if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::ABSOLUTE_RF);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) {
|
||||
myobj.setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("endless")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setEndless(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setEndless(false);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("lifeTime")) {
|
||||
float lt;
|
||||
if (fr[1].getFloat(lt)) {
|
||||
myobj.setLifeTime(lt);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("startTime")) {
|
||||
float st;
|
||||
if (fr[1].getFloat(st)) {
|
||||
myobj.setStartTime(st);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("currentTime")) {
|
||||
float ct;
|
||||
if (fr[1].getFloat(ct)) {
|
||||
myobj.setCurrentTime(ct);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("resetTime")) {
|
||||
float ct;
|
||||
if (fr[1].getFloat(ct)) {
|
||||
myobj.setResetTime(ct);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ParticleProcessor_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ParticleProcessor &myobj = static_cast<const osgParticle::ParticleProcessor &>(obj);
|
||||
|
||||
if (myobj.getParticleSystem()) fw.writeObject(*myobj.getParticleSystem());
|
||||
|
||||
fw.indent() << "enabled ";
|
||||
if (myobj.isEnabled())
|
||||
fw << "TRUE" << std::endl;
|
||||
else
|
||||
fw << "FALSE" << std::endl;
|
||||
|
||||
fw.indent() << "referenceFrame ";
|
||||
switch (myobj.getReferenceFrame())
|
||||
{
|
||||
case osgParticle::ParticleProcessor::ABSOLUTE_RF:
|
||||
fw << "ABSOLUTE" << std::endl;
|
||||
break;
|
||||
case osgParticle::ParticleProcessor::RELATIVE_RF:
|
||||
default:
|
||||
fw << "RELATIVE" << std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "endless ";
|
||||
if (myobj.isEndless())
|
||||
fw << "TRUE" << std::endl;
|
||||
else
|
||||
fw << "FALSE" << std::endl;
|
||||
|
||||
fw.indent() << "lifeTime " << myobj.getLifeTime() << std::endl;
|
||||
fw.indent() << "startTime " << myobj.getStartTime() << std::endl;
|
||||
fw.indent() << "currentTime " << myobj.getCurrentTime() << std::endl;
|
||||
fw.indent() << "resetTime " << myobj.getResetTime() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
|
||||
#include <osgParticle/ParticleSystem>
|
||||
|
||||
#include <osg/BoundingBox>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
extern bool read_particle(osgDB::Input &fr, osgParticle::Particle &P);
|
||||
extern void write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
|
||||
|
||||
bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ParticleSystem_Proxy
|
||||
(
|
||||
new osgParticle::ParticleSystem,
|
||||
"ParticleSystem",
|
||||
"Object Drawable ParticleSystem",
|
||||
ParticleSystem_readLocalData,
|
||||
ParticleSystem_writeLocalData
|
||||
);
|
||||
|
||||
bool ParticleSystem_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ParticleSystem &myobj = static_cast<osgParticle::ParticleSystem &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("particleAlignment")) {
|
||||
if (fr[1].matchWord("BILLBOARD")) {
|
||||
myobj.setParticleAlignment(osgParticle::ParticleSystem::BILLBOARD);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("FIXED")) {
|
||||
myobj.setParticleAlignment(osgParticle::ParticleSystem::FIXED);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("particleScaleReferenceFrame")) {
|
||||
if (fr[1].matchWord("LOCAL_COORDINATES")) {
|
||||
myobj.setParticleScaleReferenceFrame(osgParticle::ParticleSystem::LOCAL_COORDINATES);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
if (fr[1].matchWord("")) {
|
||||
myobj.setParticleScaleReferenceFrame(osgParticle::ParticleSystem::WORLD_COORDINATES);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("alignVectorX")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.setAlignVectorX(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("alignVectorY")) {
|
||||
osg::Vec3 v;
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.setAlignVectorY(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("doublePassRendering")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setDoublePassRendering(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setDoublePassRendering(false);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("frozen")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setFrozen(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setFrozen(false); // this might not be necessary
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("freezeOnCull")) {
|
||||
if (fr[1].matchWord("TRUE")) {
|
||||
myobj.setFreezeOnCull(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (fr[1].matchWord("FALSE")) {
|
||||
myobj.setFreezeOnCull(false);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("defaultBoundingBox")) {
|
||||
osg::BoundingBox bbox;
|
||||
if ( fr[1].getFloat(bbox.xMin()) &&
|
||||
fr[2].getFloat(bbox.yMin()) &&
|
||||
fr[3].getFloat(bbox.zMin()) &&
|
||||
fr[4].getFloat(bbox.xMax()) &&
|
||||
fr[5].getFloat(bbox.yMax()) &&
|
||||
fr[6].getFloat(bbox.zMax()) ) {
|
||||
myobj.setDefaultBoundingBox(bbox);
|
||||
fr += 7;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("particleTemplate")) {
|
||||
++fr;
|
||||
itAdvanced = true;
|
||||
osgParticle::Particle P;
|
||||
if (read_particle(fr, P)) {
|
||||
myobj.setDefaultParticleTemplate(P);
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ParticleSystem_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ParticleSystem &myobj = static_cast<const osgParticle::ParticleSystem &>(obj);
|
||||
|
||||
fw.indent() << "particleAlignment ";
|
||||
switch (myobj.getParticleAlignment()) {
|
||||
default:
|
||||
case osgParticle::ParticleSystem::BILLBOARD:
|
||||
fw << "BILLBOARD" << std::endl;
|
||||
break;
|
||||
case osgParticle::ParticleSystem::FIXED:
|
||||
fw << "FIXED" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
fw.indent() << "particleScaleReferenceFrame ";
|
||||
switch (myobj.getParticleScaleReferenceFrame()) {
|
||||
default:
|
||||
case osgParticle::ParticleSystem::LOCAL_COORDINATES:
|
||||
fw << "LOCAL_COORDINATES" << std::endl;
|
||||
break;
|
||||
case osgParticle::ParticleSystem::WORLD_COORDINATES:
|
||||
fw << "WORLD_COORDINATES" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
osg::Vec3 v = myobj.getAlignVectorX();
|
||||
fw.indent() << "alignVectorX " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
v = myobj.getAlignVectorY();
|
||||
fw.indent() << "alignVectorY " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
fw.indent() << "doublePassRendering ";
|
||||
if (myobj.getDoublePassRendering())
|
||||
fw << "TRUE" << std::endl;
|
||||
else
|
||||
fw << "FALSE" << std::endl;
|
||||
|
||||
fw.indent() << "frozen ";
|
||||
if (myobj.isFrozen())
|
||||
fw << "TRUE" << std::endl;
|
||||
else
|
||||
fw << "FALSE" << std::endl;
|
||||
|
||||
fw.indent() << "freezeOnCull ";
|
||||
if (myobj.getFreezeOnCull())
|
||||
fw << "TRUE" << std::endl;
|
||||
else
|
||||
fw << "FALSE" << std::endl;
|
||||
|
||||
osg::BoundingBox bbox = myobj.getDefaultBoundingBox();
|
||||
fw.indent() << "defaultBoundingBox ";
|
||||
fw << bbox.xMin() << " " << bbox.yMin() << " " << bbox.zMin() << " ";
|
||||
fw << bbox.xMax() << " " << bbox.yMax() << " " << bbox.zMax() << std::endl;
|
||||
|
||||
fw.indent() << "particleTemplate ";
|
||||
write_particle(myobj.getDefaultParticleTemplate(), fw);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
#include <osgParticle/ParticleSystemUpdater>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fr);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy PSU_Proxy
|
||||
(
|
||||
new osgParticle::ParticleSystemUpdater,
|
||||
"ParticleSystemUpdater",
|
||||
"Object Node ParticleSystemUpdater",
|
||||
PSU_readLocalData,
|
||||
PSU_writeLocalData
|
||||
);
|
||||
|
||||
bool PSU_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::ParticleSystemUpdater &myobj = static_cast<osgParticle::ParticleSystemUpdater &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osgParticle::ParticleSystem> proto = new osgParticle::ParticleSystem;
|
||||
osgParticle::ParticleSystem *ps = static_cast<osgParticle::ParticleSystem *>(fr.readObjectOfType(*proto));
|
||||
if (ps) {
|
||||
myobj.addParticleSystem(ps);
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool PSU_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::ParticleSystemUpdater &myobj = static_cast<const osgParticle::ParticleSystemUpdater &>(obj);
|
||||
|
||||
for (unsigned int i=0; i<myobj.getNumParticleSystems(); ++i) {
|
||||
fw.writeObject(*myobj.getParticleSystem(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/PointPlacer>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool PointPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool PointPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy PointPlacer_Proxy
|
||||
(
|
||||
new osgParticle::PointPlacer,
|
||||
"PointPlacer",
|
||||
"Object Placer CenteredPlacer PointPlacer",
|
||||
PointPlacer_readLocalData,
|
||||
PointPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool PointPlacer_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PointPlacer_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
28
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Program.cpp
Normal file
28
src/osgWrappers/deprecated-dotosg/osgParticle/IO_Program.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/Program>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool IOProgram_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool IOProgram_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_IOProgramProxy
|
||||
(
|
||||
0,
|
||||
"osgParticle::Program",
|
||||
"Object Node ParticleProcessor osgParticle::Program",
|
||||
IOProgram_readLocalData,
|
||||
IOProgram_writeLocalData
|
||||
);
|
||||
|
||||
bool IOProgram_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IOProgram_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
|
||||
#include <osgParticle/RadialShooter>
|
||||
#include <osgParticle/range>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool RadialShooter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool RadialShooter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy RadialShooter_Proxy
|
||||
(
|
||||
new osgParticle::RadialShooter,
|
||||
"RadialShooter",
|
||||
"Object Shooter RadialShooter",
|
||||
RadialShooter_readLocalData,
|
||||
RadialShooter_writeLocalData
|
||||
);
|
||||
|
||||
bool RadialShooter_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::RadialShooter &myobj = static_cast<osgParticle::RadialShooter &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::rangef r;
|
||||
|
||||
if (fr[0].matchWord("thetaRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setThetaRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("phiRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setPhiRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("initialSpeedRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setInitialSpeedRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("initialRotationalSpeedRange")) {
|
||||
osg::Vec3 r1;
|
||||
osg::Vec3 r2;
|
||||
if (fr[1].getFloat(r1.x()) && fr[2].getFloat(r1.y()) && fr[3].getFloat(r1.z()) && \
|
||||
fr[4].getFloat(r2.x()) && fr[5].getFloat(r2.y()) && fr[6].getFloat(r2.z())) {
|
||||
myobj.setInitialRotationalSpeedRange(r1,r2);
|
||||
fr += 7;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool RadialShooter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::RadialShooter &myobj = static_cast<const osgParticle::RadialShooter &>(obj);
|
||||
osgParticle::rangef r;
|
||||
|
||||
r = myobj.getThetaRange();
|
||||
fw.indent() << "thetaRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
r = myobj.getPhiRange();
|
||||
fw.indent() << "phiRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
r = myobj.getInitialSpeedRange();
|
||||
fw.indent() << "initialSpeedRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
|
||||
osgParticle::rangev3 rv = myobj.getInitialRotationalSpeedRange();
|
||||
osg::Vec3 v1 = rv.minimum;
|
||||
osg::Vec3 v2 = rv.maximum;
|
||||
fw.indent() << "initialRotationalSpeedRange ";
|
||||
fw << v1.x() << " " << v1.y() << " " << v1.z() << " ";
|
||||
fw << v2.x() << " " << v2.y() << " " << v2.z() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
#include <osgParticle/RandomRateCounter>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool RandomRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool RandomRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy RandomRateCounter_Proxy
|
||||
(
|
||||
new osgParticle::RandomRateCounter,
|
||||
"RandomRateCounter",
|
||||
"Object Counter VariableRateCounter RandomRateCounter",
|
||||
RandomRateCounter_readLocalData,
|
||||
RandomRateCounter_writeLocalData
|
||||
);
|
||||
|
||||
bool RandomRateCounter_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RandomRateCounter_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
#include <osgParticle/SectorPlacer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool SectorPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SectorPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SectorPlacer_Proxy
|
||||
(
|
||||
new osgParticle::SectorPlacer,
|
||||
"SectorPlacer",
|
||||
"Object Placer CenteredPlacer SectorPlacer",
|
||||
SectorPlacer_readLocalData,
|
||||
SectorPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool SectorPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::SectorPlacer &myobj = static_cast<osgParticle::SectorPlacer &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::rangef r;
|
||||
if (fr[0].matchWord("radiusRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setRadiusRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("phiRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setPhiRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool SectorPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::SectorPlacer &myobj = static_cast<const osgParticle::SectorPlacer &>(obj);
|
||||
|
||||
osgParticle::rangef r;
|
||||
|
||||
r = myobj.getRadiusRange();
|
||||
fw.indent() << "radiusRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
r = myobj.getPhiRange();
|
||||
fw.indent() << "phiRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
#include <osgParticle/SegmentPlacer>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osg/Vec3>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool SegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SegmentPlacer_Proxy
|
||||
(
|
||||
new osgParticle::SegmentPlacer,
|
||||
"SegmentPlacer",
|
||||
"Object Placer SegmentPlacer",
|
||||
SegmentPlacer_readLocalData,
|
||||
SegmentPlacer_writeLocalData
|
||||
);
|
||||
|
||||
bool SegmentPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::SegmentPlacer &myobj = static_cast<osgParticle::SegmentPlacer &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osg::Vec3 v;
|
||||
|
||||
if (fr[0].matchWord("vertex_A")) {
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.setVertexA(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("vertex_B")) {
|
||||
if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
|
||||
myobj.setVertexB(v);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool SegmentPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::SegmentPlacer &myobj = static_cast<const osgParticle::SegmentPlacer &>(obj);
|
||||
|
||||
osg::Vec3 v = myobj.getVertexA();
|
||||
fw.indent() << "vertex_A " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
v = myobj.getVertexB();
|
||||
fw.indent() << "vertex_B " << v.x() << " " << v.y() << " " << v.z() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/SmokeEffect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool SmokeEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SmokeEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SmokeEffect_Proxy
|
||||
(
|
||||
new osgParticle::SmokeEffect(false),
|
||||
"SmokeEffect",
|
||||
"Object Node ParticleEffect SmokeEffect",
|
||||
SmokeEffect_readLocalData,
|
||||
SmokeEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool SmokeEffect_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SmokeEffect_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
#include <osgParticle/SmokeTrailEffect>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool SmokeTrailEffect_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SmokeTrailEffect_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SmokeTrailEffect_Proxy
|
||||
(
|
||||
new osgParticle::SmokeTrailEffect(false),
|
||||
"SmokeTrailEffect",
|
||||
"Object Node ParticleEffect SmokeTrailEffect",
|
||||
SmokeTrailEffect_readLocalData,
|
||||
SmokeTrailEffect_writeLocalData
|
||||
);
|
||||
|
||||
bool SmokeTrailEffect_readLocalData(osg::Object &, osgDB::Input &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SmokeTrailEffect_writeLocalData(const osg::Object &, osgDB::Output &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#include <osgParticle/VariableRateCounter>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
bool VariableRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool VariableRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy VariableRateCounter_Proxy
|
||||
(
|
||||
0,
|
||||
"VariableRateCounter",
|
||||
"Object Counter VariableRateCounter",
|
||||
VariableRateCounter_readLocalData,
|
||||
VariableRateCounter_writeLocalData
|
||||
);
|
||||
|
||||
bool VariableRateCounter_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgParticle::VariableRateCounter &myobj = static_cast<osgParticle::VariableRateCounter &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
osgParticle::rangef r;
|
||||
if (fr[0].matchWord("rateRange")) {
|
||||
if (fr[1].getFloat(r.minimum) && fr[2].getFloat(r.maximum)) {
|
||||
myobj.setRateRange(r);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool VariableRateCounter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgParticle::VariableRateCounter &myobj = static_cast<const osgParticle::VariableRateCounter &>(obj);
|
||||
|
||||
osgParticle::rangef r = myobj.getRateRange();
|
||||
fw.indent() << "rateRange " << r.minimum << " " << r.maximum << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
12
src/osgWrappers/deprecated-dotosg/osgShadow/CMakeLists.txt
Normal file
12
src/osgWrappers/deprecated-dotosg/osgShadow/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
SET(TARGET_SRC
|
||||
ShadowedScene.cpp
|
||||
ShadowMap.cpp
|
||||
ShadowTechnique.cpp
|
||||
ShadowTexture.cpp
|
||||
ShadowVolume.cpp
|
||||
)
|
||||
SET(TARGET_ADDED_LIBRARIES osgShadow )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgshadow)
|
||||
40
src/osgWrappers/deprecated-dotosg/osgShadow/ShadowMap.cpp
Normal file
40
src/osgWrappers/deprecated-dotosg/osgShadow/ShadowMap.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <osgShadow/ShadowMap>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ShadowMap_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShadowMap_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShadowMap_Proxy
|
||||
(
|
||||
new osgShadow::ShadowMap,
|
||||
"ShadowMap",
|
||||
"Object ShadowTechnique ShadowMap",
|
||||
ShadowMap_readLocalData,
|
||||
ShadowMap_writeLocalData
|
||||
);
|
||||
|
||||
bool ShadowMap_readLocalData(osg::Object& /*obj*/, osgDB::Input &/*fr*/)
|
||||
{
|
||||
// osgShadow::ShadowMap& ss = static_cast<osgShadow::ShadowMap&>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ShadowMap_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
// const osgShadow::ShadowMap& ss = static_cast<const osgShadow::ShadowMap &>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgShadow/ShadowTechnique>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ShadowTechnique_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShadowTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShadowTechnique_Proxy
|
||||
(
|
||||
new osgShadow::ShadowTechnique,
|
||||
"ShadowTechnique",
|
||||
"Object ShadowTechnique ",
|
||||
ShadowTechnique_readLocalData,
|
||||
ShadowTechnique_writeLocalData
|
||||
);
|
||||
|
||||
bool ShadowTechnique_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/)
|
||||
{
|
||||
//osgShadow::ShadowTechnique& ss = static_cast<osgShadow::ShadowTechnique&>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ShadowTechnique_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
//const osgShadow::ShadowTechnique& ss = static_cast<const osgShadow::ShadowTechnique &>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgShadow/ShadowTexture>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ShadowTexture_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShadowTexture_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShadowTexture_Proxy
|
||||
(
|
||||
new osgShadow::ShadowTexture,
|
||||
"ShadowTexture",
|
||||
"Object ShadowTechnique ShadowTexture",
|
||||
ShadowTexture_readLocalData,
|
||||
ShadowTexture_writeLocalData
|
||||
);
|
||||
|
||||
bool ShadowTexture_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/)
|
||||
{
|
||||
// osgShadow::ShadowTexture& ss = static_cast<osgShadow::ShadowTexture&>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ShadowTexture_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
// const osgShadow::ShadowTexture& ss = static_cast<const osgShadow::ShadowTexture &>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
40
src/osgWrappers/deprecated-dotosg/osgShadow/ShadowVolume.cpp
Normal file
40
src/osgWrappers/deprecated-dotosg/osgShadow/ShadowVolume.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <osgShadow/ShadowVolume>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ShadowVolume_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShadowVolume_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShadowVolume_Proxy
|
||||
(
|
||||
new osgShadow::ShadowVolume,
|
||||
"ShadowVolume",
|
||||
"Object ShadowTechnique ShadowVolume",
|
||||
ShadowVolume_readLocalData,
|
||||
ShadowVolume_writeLocalData
|
||||
);
|
||||
|
||||
bool ShadowVolume_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/)
|
||||
{
|
||||
// osgShadow::ShadowVolume& ss = static_cast<osgShadow::ShadowVolume&>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool ShadowVolume_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
// const osgShadow::ShadowVolume& ss = static_cast<const osgShadow::ShadowVolume &>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include <osgShadow/ShadowedScene>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ShadowedScene_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShadowedScene_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShadowedScene_Proxy
|
||||
(
|
||||
new osgShadow::ShadowedScene,
|
||||
"ShadowedScene",
|
||||
"Object ShadowedScene Group ",
|
||||
ShadowedScene_readLocalData,
|
||||
ShadowedScene_writeLocalData
|
||||
);
|
||||
|
||||
bool ShadowedScene_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgShadow::ShadowedScene& ss = static_cast<osgShadow::ShadowedScene&>(obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> object=0;
|
||||
while((object=fr.readObject())!=0)
|
||||
{
|
||||
osgShadow::ShadowTechnique* st = dynamic_cast<osgShadow::ShadowTechnique*>(object.get());
|
||||
if (st) ss.setShadowTechnique(st);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ShadowedScene_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgShadow::ShadowedScene& ss = static_cast<const osgShadow::ShadowedScene &>(obj);
|
||||
|
||||
if (ss.getShadowTechnique())
|
||||
{
|
||||
fw.writeObject(*ss.getShadowTechnique());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
17
src/osgWrappers/deprecated-dotosg/osgSim/CMakeLists.txt
Normal file
17
src/osgWrappers/deprecated-dotosg/osgSim/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
SET(TARGET_SRC
|
||||
IO_ShapeAttribute.cpp
|
||||
IO_BlinkSequence.cpp
|
||||
IO_DOFTransform.cpp
|
||||
IO_Impostor.cpp
|
||||
IO_LightPoint.cpp
|
||||
IO_LightPointNode.cpp
|
||||
IO_MultiSwitch.cpp
|
||||
IO_OverlayNode.cpp
|
||||
IO_Sector.cpp
|
||||
IO_VisibilityGroup.cpp
|
||||
IO_ObjectRecordData.cpp
|
||||
)
|
||||
SET(TARGET_H IO_LightPoint.h )
|
||||
SET(TARGET_ADDED_LIBRARIES osgSim )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgsim)
|
||||
121
src/osgWrappers/deprecated-dotosg/osgSim/IO_BlinkSequence.cpp
Normal file
121
src/osgWrappers/deprecated-dotosg/osgSim/IO_BlinkSequence.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <osgSim/BlinkSequence>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osgSim;
|
||||
|
||||
bool BlinkSequence_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool BlinkSequence_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy BlinkSequence_Proxy
|
||||
(
|
||||
new BlinkSequence,
|
||||
"BlinkSequence",
|
||||
"Object BlinkSequence",
|
||||
&BlinkSequence_readLocalData,
|
||||
&BlinkSequence_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool BlinkSequence_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
BlinkSequence &seq = static_cast<BlinkSequence &>(obj);
|
||||
|
||||
if (fr.matchSequence("phaseShift %f"))
|
||||
{
|
||||
double ps;
|
||||
fr[1].getFloat(ps);
|
||||
fr += 2;
|
||||
seq.setPhaseShift(ps);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("pulse %f %f %f %f %f"))
|
||||
{
|
||||
double length;
|
||||
float r, g, b, a;
|
||||
fr[1].getFloat(length);
|
||||
fr[2].getFloat(r);
|
||||
fr[3].getFloat(g);
|
||||
fr[4].getFloat(b);
|
||||
fr[5].getFloat(a);
|
||||
fr += 6;
|
||||
|
||||
seq.addPulse(length, osg::Vec4(r, g, b, a));
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
SequenceGroup * sg = static_cast<SequenceGroup *>
|
||||
(fr.readObjectOfType(osgDB::type_wrapper<SequenceGroup>()));
|
||||
|
||||
if (sg) {
|
||||
seq.setSequenceGroup(sg);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool BlinkSequence_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const BlinkSequence &seq = static_cast<const BlinkSequence &>(obj);
|
||||
|
||||
fw.indent()<<"phaseShift "<< seq.getPhaseShift() << std::endl;
|
||||
|
||||
if (seq.getSequenceGroup() != NULL) {
|
||||
fw.writeObject(*seq.getSequenceGroup());
|
||||
}
|
||||
for (int i=0; i<seq.getNumPulses(); i++) {
|
||||
double length;
|
||||
osg::Vec4 color;
|
||||
seq.getPulse(i, length, color);
|
||||
fw.indent()<<"pulse " << length << " " << color << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************/
|
||||
|
||||
bool BlinkSequence_SequenceGroup_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool BlinkSequence_SequenceGroup_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy BlinkSequence_SequenceGroup_Proxy
|
||||
(
|
||||
new SequenceGroup,
|
||||
"SequenceGroup",
|
||||
"Object SequenceGroup",
|
||||
&BlinkSequence_SequenceGroup_readLocalData,
|
||||
&BlinkSequence_SequenceGroup_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool BlinkSequence_SequenceGroup_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
SequenceGroup &sg = static_cast<SequenceGroup &>(obj);
|
||||
|
||||
if (fr.matchSequence("baseTime %f"))
|
||||
{
|
||||
fr[1].getFloat(sg._baseTime);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool BlinkSequence_SequenceGroup_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const SequenceGroup &sg = static_cast<const SequenceGroup &>(obj);
|
||||
|
||||
fw.indent()<<"baseTime "<< sg._baseTime << std::endl;
|
||||
return true;
|
||||
}
|
||||
176
src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp
Normal file
176
src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp
Normal file
@@ -0,0 +1,176 @@
|
||||
#include "osgSim/DOFTransform"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgSim;
|
||||
using namespace osgDB;
|
||||
using namespace std;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool DOFTransform_readLocalData(Object& obj, Input& fr);
|
||||
bool DOFTransform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_DOFTransformProxy
|
||||
(
|
||||
new osgSim::DOFTransform,
|
||||
"DOFTransform",
|
||||
"Object Node Transform DOFTransform Group",
|
||||
&DOFTransform_readLocalData,
|
||||
&DOFTransform_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool DOFTransform_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
DOFTransform& dof = static_cast<DOFTransform&>(obj);
|
||||
|
||||
if (fr.matchSequence("PutMatrix {"))
|
||||
{
|
||||
fr += 2; // skip over "putMatrix {"
|
||||
iteratorAdvanced = true;
|
||||
|
||||
bool matched = true;
|
||||
for(int k=0;k<16 && matched;++k)
|
||||
{
|
||||
matched = fr[k].isFloat();
|
||||
}
|
||||
if (matched)
|
||||
{
|
||||
osg::Matrix matrix;
|
||||
int k=0;
|
||||
double v;
|
||||
for(int i=0;i<4;++i)
|
||||
{
|
||||
for(int j=0;j<4;++j)
|
||||
{
|
||||
fr[k].getFloat(v);
|
||||
matrix(i,j)=v;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
dof.setPutMatrix(matrix);
|
||||
dof.setInversePutMatrix(Matrix::inverse(matrix));
|
||||
}
|
||||
|
||||
fr.advanceToEndOfCurrentBlock();
|
||||
}
|
||||
|
||||
|
||||
#define ReadVec3(A,B) { \
|
||||
if (fr[0].matchWord(B) && \
|
||||
fr[1].getFloat(vec3[0]) && \
|
||||
fr[2].getFloat(vec3[1]) && \
|
||||
fr[3].getFloat(vec3[2])) \
|
||||
{ \
|
||||
dof.A(vec3); \
|
||||
fr+=4; \
|
||||
iteratorAdvanced = true; \
|
||||
} \
|
||||
}
|
||||
|
||||
Vec3 vec3;
|
||||
|
||||
ReadVec3(setMinHPR,"minHPR")
|
||||
ReadVec3(setMaxHPR,"maxHPR")
|
||||
ReadVec3(setIncrementHPR,"incrementHPR")
|
||||
ReadVec3(setCurrentHPR,"currentHPR")
|
||||
|
||||
ReadVec3(setMinTranslate,"minTranslate")
|
||||
ReadVec3(setMaxTranslate,"maxTranslate")
|
||||
ReadVec3(setIncrementTranslate,"incrementTranslate")
|
||||
ReadVec3(setCurrentTranslate,"currentTranslate")
|
||||
|
||||
ReadVec3(setMinScale,"minScale")
|
||||
ReadVec3(setMaxScale,"maxScale")
|
||||
ReadVec3(setIncrementScale,"incrementScale")
|
||||
ReadVec3(setCurrentScale,"currentScale")
|
||||
|
||||
if (fr[0].matchWord("multOrder"))
|
||||
{
|
||||
if (fr[1].matchWord("PRH")) dof.setHPRMultOrder(DOFTransform::PRH);
|
||||
else if(fr[1].matchWord("PHR")) dof.setHPRMultOrder(DOFTransform::PHR);
|
||||
else if(fr[1].matchWord("HPR")) dof.setHPRMultOrder(DOFTransform::HPR);
|
||||
else if(fr[1].matchWord("HRP")) dof.setHPRMultOrder(DOFTransform::HRP);
|
||||
else if(fr[1].matchWord("RHP")) dof.setHPRMultOrder(DOFTransform::RHP);
|
||||
else if(fr[1].matchWord("RPH")) dof.setHPRMultOrder(DOFTransform::RPH);
|
||||
}
|
||||
|
||||
|
||||
if (fr.matchSequence("limitationFlags %i"))
|
||||
{
|
||||
unsigned int flags;
|
||||
fr[1].getUInt(flags);
|
||||
dof.setLimitationFlags(flags);
|
||||
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("animationOn"))
|
||||
{
|
||||
|
||||
if (fr[1].matchWord("TRUE")) dof.setAnimationOn(true);
|
||||
else if (fr[1].matchWord("FALSE")) dof.setAnimationOn(false);
|
||||
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
#undef ReadVec3
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool DOFTransform_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const DOFTransform& transform = static_cast<const DOFTransform&>(obj);
|
||||
|
||||
const Matrix& matrix = transform.getPutMatrix();
|
||||
fw.indent()<<"PutMatrix {"<<std::endl;
|
||||
fw.moveIn();
|
||||
fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
|
||||
fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
|
||||
fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
|
||||
fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
|
||||
fw.indent() << "}" << std::endl;
|
||||
fw.moveOut();
|
||||
|
||||
|
||||
fw.indent()<<"minHPR "<<transform.getMinHPR()<<std::endl;
|
||||
fw.indent()<<"maxHPR "<<transform.getMaxHPR()<<std::endl;
|
||||
fw.indent()<<"incrementHPR "<<transform.getIncrementHPR()<<std::endl;
|
||||
fw.indent()<<"currentHPR "<<transform.getCurrentHPR()<<std::endl;
|
||||
|
||||
fw.indent()<<"minTranslate "<<transform.getMinTranslate()<<std::endl;
|
||||
fw.indent()<<"maxTranslate "<<transform.getMaxTranslate()<<std::endl;
|
||||
fw.indent()<<"incrementTranslate "<<transform.getIncrementTranslate()<<std::endl;
|
||||
fw.indent()<<"currentTranslate "<<transform.getCurrentTranslate()<<std::endl;
|
||||
|
||||
fw.indent()<<"minScale "<<transform.getMinScale()<<std::endl;
|
||||
fw.indent()<<"maxScale "<<transform.getMaxScale()<<std::endl;
|
||||
fw.indent()<<"incrementScale "<<transform.getIncrementScale()<<std::endl;
|
||||
fw.indent()<<"currentScale "<<transform.getCurrentScale()<<std::endl;
|
||||
|
||||
|
||||
const char* mOrderStr[] = {"PRH", "PHR", "HPR", "HRP", "RPH", "RHP"};
|
||||
fw.indent()<<"multOrder "<<mOrderStr[transform.getHPRMultOrder()]<<std::endl;
|
||||
|
||||
fw.indent()<<"limitationFlags 0x"<<hex<<transform.getLimitationFlags()<<dec<<std::endl;
|
||||
|
||||
fw.indent()<<"animationOn ";
|
||||
if (transform.getAnimationOn()) fw<<"TRUE"<<std::endl;
|
||||
else fw<<"FALSE"<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
51
src/osgWrappers/deprecated-dotosg/osgSim/IO_Impostor.cpp
Normal file
51
src/osgWrappers/deprecated-dotosg/osgSim/IO_Impostor.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "osgSim/Impostor"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osgSim;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Impostor_readLocalData(osg::Object& obj, Input& fr);
|
||||
bool Impostor_writeLocalData(const osg::Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ImpostorProxy
|
||||
(
|
||||
new osgSim::Impostor,
|
||||
"Impostor",
|
||||
"Object Node Impostor LOD Group",
|
||||
&Impostor_readLocalData,
|
||||
&Impostor_writeLocalData
|
||||
);
|
||||
|
||||
bool Impostor_readLocalData(osg::Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Impostor& impostor = static_cast<Impostor&>(obj);
|
||||
|
||||
if (fr.matchSequence("ImpostorThreshold %f"))
|
||||
{
|
||||
float threshold;
|
||||
fr[1].getFloat(threshold);
|
||||
impostor.setImpostorThreshold(threshold);
|
||||
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Impostor_writeLocalData(const osg::Object& obj, Output& fw)
|
||||
{
|
||||
const Impostor& impostor = static_cast<const Impostor&>(obj);
|
||||
|
||||
fw.indent() << "ImpostorThreshold "<< impostor.getImpostorThreshold() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
121
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.cpp
Normal file
121
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include "IO_LightPoint.h"
|
||||
|
||||
using namespace osgSim;
|
||||
|
||||
bool readLightPoint(LightPoint & lp, osgDB::Input &fr)
|
||||
{
|
||||
if (fr.matchSequence("lightPoint {"))
|
||||
{
|
||||
fr += 2;
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
bool itAdvanced = true;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry && itAdvanced) {
|
||||
itAdvanced = false;
|
||||
if (fr[0].matchWord("isOn")) {
|
||||
const char * ptstr = fr[1].getStr();
|
||||
if (ptstr) {
|
||||
if (std::string(ptstr) == "TRUE") {
|
||||
lp._on = true;
|
||||
} else if (std::string(ptstr) == "FALSE") {
|
||||
lp._on = false;
|
||||
} else {
|
||||
osg::notify(osg::WARN) << "osg::Sim reader warning: invalid isOn: " << ptstr << std::endl;
|
||||
}
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("position")) {
|
||||
float x, y, z;
|
||||
if (fr[1].getFloat(x) && fr[2].getFloat(y) && fr[3].getFloat(z)) {
|
||||
lp._position.set(x, y, z);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("color")) {
|
||||
float r, g, b, a;
|
||||
if (fr[1].getFloat(r) && fr[2].getFloat(g) && fr[3].getFloat(b) && fr[4].getFloat(a)) {
|
||||
lp._color.set(r, g, b, a);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("intensity")) {
|
||||
if (fr[1].getFloat(lp._intensity)) {
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("radius")) {
|
||||
if (fr[1].getFloat(lp._radius)) {
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
if (fr[0].matchWord("blendingMode")) {
|
||||
const char * ptstr = fr[1].getStr();
|
||||
if (ptstr) {
|
||||
if (std::string(ptstr) == "ADDITIVE") {
|
||||
lp._blendingMode = LightPoint::ADDITIVE;
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else if (std::string(ptstr) == "BLENDED") {
|
||||
lp._blendingMode = LightPoint::BLENDED;
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
} else {
|
||||
osg::notify(osg::WARN) << "osg::Sim reader warning: invalid blendingMode: " << ptstr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
Sector * sector = static_cast<Sector *>(fr.readObjectOfType(osgDB::type_wrapper<Sector>()));
|
||||
if (sector) {
|
||||
lp._sector = sector;
|
||||
itAdvanced = true;
|
||||
}
|
||||
BlinkSequence * seq = static_cast<BlinkSequence *>(fr.readObjectOfType(osgDB::type_wrapper<BlinkSequence>()));
|
||||
if (seq) {
|
||||
lp._blinkSequence = seq;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool writeLightPoint(const LightPoint & lp, osgDB::Output &fw)
|
||||
{
|
||||
fw.indent() << "lightPoint {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.indent() << "isOn " << ( lp._on ? "TRUE" : "FALSE") << std::endl;
|
||||
fw.indent() << "position " << lp._position << std::endl;
|
||||
fw.indent() << "color " << lp._color << std::endl;
|
||||
fw.indent() << "intensity " << lp._intensity << std::endl;
|
||||
fw.indent() << "radius " << lp._radius << std::endl;
|
||||
fw.indent() << "blendingMode ";
|
||||
switch (lp._blendingMode) {
|
||||
case LightPoint::ADDITIVE:
|
||||
fw << "ADDITIVE" << std::endl;
|
||||
break;
|
||||
case LightPoint::BLENDED:
|
||||
default :
|
||||
fw << "BLENDED" << std::endl;
|
||||
break;
|
||||
}
|
||||
if (lp._sector.valid()) {
|
||||
fw.writeObject(*lp._sector);
|
||||
}
|
||||
if (lp._blinkSequence.valid()) {
|
||||
fw.writeObject(*lp._blinkSequence);
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
return true;
|
||||
}
|
||||
11
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.h
Normal file
11
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef DOTOSGSIM_LIGHTPOINT
|
||||
#define DOTOSGSIM_LIGHTPOINT
|
||||
|
||||
#include <osgSim/LightPoint>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
extern bool readLightPoint(osgSim::LightPoint & lp, osgDB::Input &fr);
|
||||
extern bool writeLightPoint(const osgSim::LightPoint & lp, osgDB::Output &fw);
|
||||
|
||||
#endif
|
||||
116
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPointNode.cpp
Normal file
116
src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPointNode.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
#include <osgSim/LightPointNode>
|
||||
#include <osgSim/LightPoint>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include "IO_LightPoint.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osgSim;
|
||||
|
||||
bool LightPointNode_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool LightPointNode_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy LightPointNode_Proxy
|
||||
(
|
||||
new LightPointNode,
|
||||
"LightPointNode",
|
||||
"Object Node LightPointNode",
|
||||
&LightPointNode_readLocalData,
|
||||
&LightPointNode_writeLocalData
|
||||
);
|
||||
|
||||
bool LightPointNode_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
LightPointNode &lightpointnode = static_cast<LightPointNode &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("num_lightpoints %d")) {
|
||||
// Could allocate space for lightpoints here
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("minPixelSize %f")) {
|
||||
float size = 0.0f;
|
||||
fr[1].getFloat(size);
|
||||
lightpointnode.setMinPixelSize(size);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("maxPixelSize %f")) {
|
||||
float size = 30.0f;
|
||||
fr[1].getFloat(size);
|
||||
lightpointnode.setMaxPixelSize(size);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("maxVisibleDistance2 %f")) {
|
||||
float distance = FLT_MAX;
|
||||
fr[1].getFloat(distance);
|
||||
lightpointnode.setMaxVisibleDistance2(distance);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("pointSprite"))
|
||||
{
|
||||
if (fr[1].matchWord("FALSE"))
|
||||
{
|
||||
lightpointnode.setPointSprite(false);
|
||||
fr+=2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
else if (fr[1].matchWord("TRUE"))
|
||||
{
|
||||
lightpointnode.setPointSprite(true);
|
||||
fr+=2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("lightPoint")) {
|
||||
LightPoint lp;
|
||||
if (readLightPoint(lp, fr)) {
|
||||
lightpointnode.addLightPoint(lp);
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool LightPointNode_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const LightPointNode &lightpointnode = static_cast<const LightPointNode &>(obj);
|
||||
|
||||
fw.indent() << "num_lightpoints " << lightpointnode.getNumLightPoints() << std::endl;
|
||||
|
||||
fw.indent() << "minPixelSize " << lightpointnode.getMinPixelSize() << std::endl;
|
||||
|
||||
fw.indent() << "maxPixelSize " << lightpointnode.getMaxPixelSize() << std::endl;
|
||||
|
||||
fw.indent() << "maxVisibleDistance2 " << lightpointnode.getMaxVisibleDistance2() << std::endl;
|
||||
|
||||
fw.indent() << "pointSprite " << ( lightpointnode.getPointSprite() ? "TRUE" : "FALSE" ) << std::endl;
|
||||
|
||||
LightPointNode::LightPointList const lightpointlist = lightpointnode.getLightPointList();
|
||||
LightPointNode::LightPointList::const_iterator itr;
|
||||
|
||||
for (itr = lightpointlist.begin(); itr != lightpointlist.end(); itr++) {
|
||||
writeLightPoint((*itr), fw);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
125
src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp
Normal file
125
src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp
Normal file
@@ -0,0 +1,125 @@
|
||||
#include "osgSim/MultiSwitch"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgSim;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool MultiSwitch_readLocalData(Object& obj, Input& fr);
|
||||
bool MultiSwitch_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_simSwitchProxy
|
||||
(
|
||||
new osgSim::MultiSwitch,
|
||||
"MultiSwitch",
|
||||
"Object Node MultiSwitch Group",
|
||||
&MultiSwitch_readLocalData,
|
||||
&MultiSwitch_writeLocalData
|
||||
);
|
||||
|
||||
bool MultiSwitch_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
MultiSwitch& sw = static_cast<MultiSwitch&>(obj);
|
||||
|
||||
if (fr[0].matchWord("NewChildDefaultValue"))
|
||||
{
|
||||
if (fr[1].matchWord("TRUE"))
|
||||
{
|
||||
sw.setNewChildDefaultValue(true);
|
||||
iteratorAdvanced = true;
|
||||
fr += 2;
|
||||
}
|
||||
else if (fr[1].matchWord("FALSE"))
|
||||
{
|
||||
sw.setNewChildDefaultValue(false);
|
||||
iteratorAdvanced = true;
|
||||
fr += 2;
|
||||
}
|
||||
else if (fr[1].isInt())
|
||||
{
|
||||
int value;
|
||||
fr[1].getInt(value);
|
||||
sw.setNewChildDefaultValue(value!=0);
|
||||
iteratorAdvanced = true;
|
||||
fr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr.matchSequence("ActiveSwitchSet %i"))
|
||||
{
|
||||
unsigned int switchSet;
|
||||
fr[1].getUInt(switchSet);
|
||||
fr+=2;
|
||||
|
||||
sw.setActiveSwitchSet(switchSet);
|
||||
}
|
||||
|
||||
|
||||
if (fr.matchSequence("ValueList %i {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
unsigned int switchSet;
|
||||
fr[1].getUInt(switchSet);
|
||||
|
||||
// move inside the brakets.
|
||||
fr += 3;
|
||||
|
||||
unsigned int pos=0;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
int value;
|
||||
if (fr[0].getInt(value))
|
||||
{
|
||||
sw.setValue(switchSet, pos,value!=0);
|
||||
++pos;
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
|
||||
++fr;
|
||||
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool MultiSwitch_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const MultiSwitch& sw = static_cast<const MultiSwitch&>(obj);
|
||||
|
||||
|
||||
fw.indent()<<"NewChildDefaultValue "<<sw.getNewChildDefaultValue()<<std::endl;
|
||||
|
||||
fw.indent()<<"ActiveSwitchSet "<<sw.getActiveSwitchSet()<<std::endl;
|
||||
|
||||
unsigned int pos = 0;
|
||||
const osgSim::MultiSwitch::SwitchSetList& switchset = sw.getSwitchSetList();
|
||||
for(osgSim::MultiSwitch::SwitchSetList::const_iterator sitr=switchset.begin();
|
||||
sitr!=switchset.end();
|
||||
++sitr,++pos)
|
||||
{
|
||||
fw.indent()<<"ValueList "<<pos<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
const MultiSwitch::ValueList& values = *sitr;
|
||||
for(MultiSwitch::ValueList::const_iterator itr=values.begin();
|
||||
itr!=values.end();
|
||||
++itr)
|
||||
{
|
||||
fw.indent()<<*itr<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<< std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
109
src/osgWrappers/deprecated-dotosg/osgSim/IO_ObjectRecordData.cpp
Normal file
109
src/osgWrappers/deprecated-dotosg/osgSim/IO_ObjectRecordData.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include <osgSim/ObjectRecordData>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
//#include <map>
|
||||
|
||||
bool ObjectRecordData_readLocalData( osg::Object &obj, osgDB::Input &fr );
|
||||
bool ObjectRecordData_writeLocalData( const osg::Object &obj, osgDB::Output &fw );
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ObjectRecordData_Proxy
|
||||
(
|
||||
new osgSim::ObjectRecordData,
|
||||
"ObjectRecordData",
|
||||
"Object ObjectRecordData",
|
||||
&ObjectRecordData_readLocalData,
|
||||
&ObjectRecordData_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
#if 0
|
||||
// if deffing out as values are not used anywhere.
|
||||
static const int numBits( 6 );
|
||||
typedef std::pair< std::string, osgSim::ObjectRecordData::Flags> FlagBits;
|
||||
static FlagBits flagBits[numBits] = {
|
||||
FlagBits( std::string("DONT_DISPLAY_IN_DAYLIGHT"), osgSim::ObjectRecordData::DONT_DISPLAY_IN_DAYLIGHT ),
|
||||
FlagBits( "DONT_DISPLAY_AT_DUSK", osgSim::ObjectRecordData::DONT_DISPLAY_AT_DUSK ),
|
||||
FlagBits( "DONT_DISPLAY_AT_NIGHT", osgSim::ObjectRecordData::DONT_DISPLAY_AT_NIGHT ),
|
||||
FlagBits( "DONT_ILLUMINATE", osgSim::ObjectRecordData::DONT_ILLUMINATE ),
|
||||
FlagBits( "FLAT_SHADED", osgSim::ObjectRecordData::FLAT_SHADED ),
|
||||
FlagBits( "GROUPS_SHADOW_OBJECT", osgSim::ObjectRecordData::GROUPS_SHADOW_OBJECT )
|
||||
};
|
||||
#endif
|
||||
bool ObjectRecordData_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::ObjectRecordData &ord = static_cast<osgSim::ObjectRecordData&>(obj);
|
||||
|
||||
if (fr.matchSequence("flags %i"))
|
||||
{
|
||||
unsigned int flags;
|
||||
fr[1].getUInt( flags );
|
||||
ord._flags = flags;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("relativePriority %i"))
|
||||
{
|
||||
int relativePriority;
|
||||
fr[1].getInt( relativePriority );
|
||||
ord._relativePriority = (short) relativePriority;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("transparency %i"))
|
||||
{
|
||||
int transparency;
|
||||
fr[1].getInt( transparency );
|
||||
ord._transparency = (unsigned short) transparency;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("effectID1 %i"))
|
||||
{
|
||||
int effectID1;
|
||||
fr[1].getInt( effectID1 );
|
||||
ord._effectID1 = (short) effectID1;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("effectID2 %i"))
|
||||
{
|
||||
int effectID2;
|
||||
fr[1].getInt( effectID2 );
|
||||
ord._effectID2 = (short) effectID2;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("significance %i"))
|
||||
{
|
||||
int significance;
|
||||
fr[1].getInt( significance );
|
||||
ord._significance = (short) significance;
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ObjectRecordData_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgSim::ObjectRecordData &ord = static_cast<const osgSim::ObjectRecordData&>(obj);
|
||||
|
||||
fw.indent() << "flags " << ord._flags << std::endl;
|
||||
fw.indent() << "relativePriority " << ord._relativePriority << std::endl;
|
||||
fw.indent() << "transparency " << ord._transparency << std::endl;
|
||||
fw.indent() << "effectID1 " << ord._effectID1 << std::endl;
|
||||
fw.indent() << "effectID2 " << ord._effectID2 << std::endl;
|
||||
fw.indent() << "significance " << ord._significance << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
131
src/osgWrappers/deprecated-dotosg/osgSim/IO_OverlayNode.cpp
Normal file
131
src/osgWrappers/deprecated-dotosg/osgSim/IO_OverlayNode.cpp
Normal file
@@ -0,0 +1,131 @@
|
||||
#include <osgSim/OverlayNode>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
using namespace osgSim;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool OverlayNode_readLocalData(Object& obj, Input& fr);
|
||||
bool OverlayNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_OverlayNodeProxy
|
||||
(
|
||||
new OverlayNode,
|
||||
"OverlayNode",
|
||||
"Object Node OverlayNode Group",
|
||||
&OverlayNode_readLocalData,
|
||||
&OverlayNode_writeLocalData
|
||||
);
|
||||
|
||||
bool OverlayNode_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
OverlayNode& es = static_cast<OverlayNode&>(obj);
|
||||
|
||||
if (fr.matchSequence("technique"))
|
||||
{
|
||||
if (fr[1].matchWord("OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY"))
|
||||
{
|
||||
es.setOverlayTechnique(OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY);
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
else if (fr[1].matchWord("VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY"))
|
||||
{
|
||||
es.setOverlayTechnique(OverlayNode::VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY);
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
else if (fr[1].matchWord("VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY"))
|
||||
{
|
||||
es.setOverlayTechnique(OverlayNode::VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY);
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
}
|
||||
|
||||
osg::Vec4 vec4(0.0f,0.0f,0.0f,1.0f);
|
||||
|
||||
if (fr[0].matchWord("clear_color") &&
|
||||
fr[1].getFloat(vec4[0]) &&
|
||||
fr[2].getFloat(vec4[1]) &&
|
||||
fr[3].getFloat(vec4[2]) &&
|
||||
fr[4].getFloat(vec4[3]))
|
||||
{
|
||||
es.setOverlayClearColor(vec4);
|
||||
fr+=5;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("texture_size_hint"))
|
||||
{
|
||||
if (fr[1].isUInt())
|
||||
{
|
||||
unsigned int value=0;
|
||||
fr[1].getUInt(value);
|
||||
es.setOverlayTextureSizeHint(value);
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("texture_unit"))
|
||||
{
|
||||
if (fr[1].isUInt())
|
||||
{
|
||||
unsigned int value=0;
|
||||
fr[1].getUInt(value);
|
||||
es.setOverlayTextureUnit(value);
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("subgraph"))
|
||||
{
|
||||
fr+=1;
|
||||
es.setOverlaySubgraph(fr.readNode());
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool OverlayNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const OverlayNode& es = static_cast<const OverlayNode&>(obj);
|
||||
|
||||
fw.indent() << "technique ";
|
||||
if (es.getOverlayTechnique() == OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY)
|
||||
{
|
||||
fw<<"OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY"<< std::endl;
|
||||
}
|
||||
else if (es.getOverlayTechnique() == OverlayNode::VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY)
|
||||
{
|
||||
fw<<"VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY"<< std::endl;
|
||||
}
|
||||
else if (es.getOverlayTechnique() == OverlayNode::VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY)
|
||||
{
|
||||
fw<<"VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY"<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw<<"UNKNOWN"<< std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "clear_color "<<es.getOverlayClearColor()<< std::endl;
|
||||
fw.indent() << "texture_size_hint " << es.getOverlayTextureSizeHint() << std::endl;
|
||||
fw.indent() << "texture_unit " << es.getOverlayTextureUnit() << std::endl;
|
||||
fw.indent() << "subgraph " ;
|
||||
fw.writeObject(*es.getOverlaySubgraph());
|
||||
|
||||
return true;
|
||||
}
|
||||
290
src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp
Normal file
290
src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp
Normal file
@@ -0,0 +1,290 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool AzimSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool AzimSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AzimSector_Proxy
|
||||
(
|
||||
new osgSim::AzimSector,
|
||||
"AzimSector",
|
||||
"Object AzimSector",
|
||||
&AzimSector_readLocalData,
|
||||
&AzimSector_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool AzimSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::AzimSector §or = static_cast<osgSim::AzimSector &>(obj);
|
||||
|
||||
if (fr.matchSequence("azimuthRange %f %f %f"))
|
||||
{
|
||||
float minAzimuth;
|
||||
float maxAzimuth;
|
||||
float fadeRange;
|
||||
fr[1].getFloat(minAzimuth);
|
||||
fr[2].getFloat(maxAzimuth);
|
||||
fr[3].getFloat(fadeRange);
|
||||
fr += 4;
|
||||
sector.setAzimuthRange(minAzimuth, maxAzimuth, fadeRange);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool AzimSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
|
||||
const osgSim::AzimSector §or = static_cast<const osgSim::AzimSector &>(obj);
|
||||
sector.getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
fw.indent()<<"azimuthRange "<<minAzimuth<< " "<<maxAzimuth<< " "<<fadeAngle<<std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
bool ElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ElevationSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ElevationSector_Proxy
|
||||
(
|
||||
new osgSim::ElevationSector,
|
||||
"ElevationSector",
|
||||
"Object ElevationSector",
|
||||
&ElevationSector_readLocalData,
|
||||
&ElevationSector_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool ElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::ElevationSector §or = static_cast<osgSim::ElevationSector &>(obj);
|
||||
|
||||
if (fr.matchSequence("elevationRange %f %f %f"))
|
||||
{
|
||||
float minElevation;
|
||||
float maxElevation;
|
||||
float fadeAngle;
|
||||
|
||||
fr[1].getFloat(minElevation);
|
||||
fr[2].getFloat(maxElevation);
|
||||
fr[3].getFloat(fadeAngle);
|
||||
fr += 4;
|
||||
sector.setElevationRange(minElevation, maxElevation, fadeAngle);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ElevationSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
|
||||
const osgSim::ElevationSector §or = static_cast<const osgSim::ElevationSector &>(obj);
|
||||
|
||||
float minElevation = sector.getMinElevation();
|
||||
float maxElevation = sector.getMaxElevation();
|
||||
float fadeAngle = sector.getFadeAngle();
|
||||
fw.indent()<<"elevationRange "<<minElevation<< " "<<maxElevation<< " "<<fadeAngle<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
bool AzimElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool AzimElevationSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AzimElevationSector_Proxy
|
||||
(
|
||||
new osgSim::AzimElevationSector,
|
||||
"AzimElevationSector",
|
||||
"Object AzimElevationSector",
|
||||
&AzimElevationSector_readLocalData,
|
||||
&AzimElevationSector_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool AzimElevationSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::AzimElevationSector §or = static_cast<osgSim::AzimElevationSector &>(obj);
|
||||
|
||||
if (fr.matchSequence("azimuthRange %f %f %f"))
|
||||
{
|
||||
float minAzimuth;
|
||||
float maxAzimuth;
|
||||
float fadeAngle;
|
||||
fr[1].getFloat(minAzimuth);
|
||||
fr[2].getFloat(maxAzimuth);
|
||||
fr[3].getFloat(fadeAngle);
|
||||
fr += 4;
|
||||
sector.setAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("elevationRange %f %f %f"))
|
||||
{
|
||||
float minElevation;
|
||||
float maxElevation;
|
||||
float fadeAngle;
|
||||
|
||||
fr[1].getFloat(minElevation);
|
||||
fr[2].getFloat(maxElevation);
|
||||
fr[3].getFloat(fadeAngle);
|
||||
fr += 4;
|
||||
sector.setElevationRange(minElevation, maxElevation, fadeAngle);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool AzimElevationSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
|
||||
const osgSim::AzimElevationSector §or = static_cast<const osgSim::AzimElevationSector &>(obj);
|
||||
|
||||
float minElevation = sector.getMinElevation();
|
||||
float maxElevation = sector.getMaxElevation();
|
||||
float fadeAngle = sector.getFadeAngle();
|
||||
fw.indent()<<"elevationRange "<<minElevation<< " "<<maxElevation<< " "<<fadeAngle<<std::endl;
|
||||
|
||||
float minAzimuth, maxAzimuth;
|
||||
sector.getAzimuthRange(minAzimuth, maxAzimuth, fadeAngle);
|
||||
fw.indent()<<"azimuthRange "<<minAzimuth<< " "<<maxAzimuth<< " "<<fadeAngle<<std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
bool ConeSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ConeSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ConeSector_Proxy
|
||||
(
|
||||
new osgSim::ConeSector,
|
||||
"ConeSector",
|
||||
"Object ConeSector",
|
||||
&ConeSector_readLocalData,
|
||||
&ConeSector_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool ConeSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::ConeSector §or = static_cast<osgSim::ConeSector &>(obj);
|
||||
|
||||
if (fr.matchSequence("axis %f %f %f"))
|
||||
{
|
||||
float x, y, z;
|
||||
|
||||
fr[1].getFloat(x);
|
||||
fr[2].getFloat(y);
|
||||
fr[3].getFloat(z);
|
||||
fr += 4;
|
||||
sector.setAxis(osg::Vec3(x, y, z));
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("angle %f %f"))
|
||||
{
|
||||
float angle;
|
||||
float fadeangle;
|
||||
fr[1].getFloat(angle);
|
||||
fr[2].getFloat(fadeangle);
|
||||
fr += 3;
|
||||
sector.setAngle(angle, fadeangle);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ConeSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgSim::ConeSector §or = static_cast<const osgSim::ConeSector &>(obj);
|
||||
|
||||
const osg::Vec3& axis = sector.getAxis();
|
||||
fw.indent()<<"axis "<<axis<<std::endl;
|
||||
|
||||
float angle = sector.getAngle();
|
||||
float fadeangle = sector.getFadeAngle();
|
||||
fw.indent()<<"angle "<<angle<<" "<<fadeangle<<std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
bool DirectionalSector_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool DirectionalSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy DirectionalSector_Proxy
|
||||
(
|
||||
new osgSim::DirectionalSector,
|
||||
"DirectionalSector",
|
||||
"Object DirectionalSector",
|
||||
&DirectionalSector_readLocalData,
|
||||
&DirectionalSector_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool DirectionalSector_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
osgSim::DirectionalSector §or = static_cast<osgSim::DirectionalSector &>(obj);
|
||||
|
||||
if (fr.matchSequence("direction %f %f %f"))
|
||||
{
|
||||
float x, y, z;
|
||||
|
||||
fr[1].getFloat(x);
|
||||
fr[2].getFloat(y);
|
||||
fr[3].getFloat(z);
|
||||
fr += 4;
|
||||
sector.setDirection(osg::Vec3(x, y, z));
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
if (fr.matchSequence("angles %f %f %f %f"))
|
||||
{
|
||||
float horizangle;
|
||||
float vertangle;
|
||||
float rollangle;
|
||||
float fadeangle;
|
||||
fr[1].getFloat(horizangle);
|
||||
fr[2].getFloat(vertangle);
|
||||
fr[3].getFloat(rollangle);
|
||||
fr[4].getFloat(fadeangle);
|
||||
fr += 5;
|
||||
sector.setHorizLobeAngle(horizangle);
|
||||
sector.setVertLobeAngle(vertangle);
|
||||
sector.setLobeRollAngle(rollangle);
|
||||
sector.setFadeAngle(fadeangle);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool DirectionalSector_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgSim::DirectionalSector §or = static_cast<const osgSim::DirectionalSector &>(obj);
|
||||
|
||||
const osg::Vec3& axis = sector.getDirection();
|
||||
fw.indent()<<"direction "<<axis<<std::endl;
|
||||
|
||||
float horizangle = sector.getHorizLobeAngle();
|
||||
float vertangle = sector.getVertLobeAngle();
|
||||
float rollangle = sector.getLobeRollAngle();
|
||||
float fadeangle = sector.getFadeAngle();
|
||||
fw.indent()<<"angles "<<horizangle<<" "<<vertangle<<" "<<rollangle<<" "<<fadeangle<<std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#include <osgSim/ShapeAttribute>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
using namespace osgSim;
|
||||
|
||||
bool ShapeAttributeList_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ShapeAttributeList_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ShapeAttributeList_Proxy
|
||||
(
|
||||
new ShapeAttributeList,
|
||||
"ShapeAttributeList",
|
||||
"Object ShapeAttributeList",
|
||||
&ShapeAttributeList_readLocalData,
|
||||
&ShapeAttributeList_writeLocalData,
|
||||
osgDB::DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool ShapeAttributeList_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
ShapeAttributeList &sal = static_cast<ShapeAttributeList &>(obj);
|
||||
|
||||
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>=entry)
|
||||
{
|
||||
if (fr.matchSequence("string %s %s"))
|
||||
{
|
||||
sal.push_back(osgSim::ShapeAttribute(fr[1].getStr(), fr[2].getStr()));
|
||||
fr += 3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
else if (fr.matchSequence("double %s %f"))
|
||||
{
|
||||
double value;
|
||||
fr[2].getFloat(value);
|
||||
sal.push_back(osgSim::ShapeAttribute(fr[1].getStr(), value));
|
||||
fr += 3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
else if (fr.matchSequence("int %s %i"))
|
||||
{
|
||||
int value;
|
||||
fr[2].getInt(value);
|
||||
sal.push_back(osgSim::ShapeAttribute(fr[1].getStr(), value));
|
||||
fr += 3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
else ++fr;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool ShapeAttributeList_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const ShapeAttributeList &sal = static_cast<const ShapeAttributeList &>(obj);
|
||||
|
||||
for (ShapeAttributeList::const_iterator it = sal.begin(); it != sal.end(); ++it)
|
||||
{
|
||||
switch (it->getType())
|
||||
{
|
||||
case osgSim::ShapeAttribute::STRING:
|
||||
{
|
||||
fw.indent()<<"string "<< fw.wrapString(it->getName())<<" "<<fw.wrapString(it->getString()) << std::endl;
|
||||
break;
|
||||
}
|
||||
case osgSim::ShapeAttribute::INTEGER:
|
||||
{
|
||||
fw.indent()<<"int "<< fw.wrapString(it->getName())<<" "<<it->getInt() << std::endl;
|
||||
break;
|
||||
}
|
||||
case osgSim::ShapeAttribute::DOUBLE:
|
||||
{
|
||||
fw.indent()<<"double "<< fw.wrapString(it->getName())<<" "<<it->getDouble() << std::endl;
|
||||
break;
|
||||
}
|
||||
case osgSim::ShapeAttribute::UNKNOW:
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
#include "osgSim/VisibilityGroup"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgSim;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool VisibilityGroup_readLocalData(Object& obj, Input& fr);
|
||||
bool VisibilityGroup_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_VisibilityGroupProxy
|
||||
(
|
||||
new VisibilityGroup,
|
||||
"VisibilityGroup",
|
||||
"Object Node VisibilityGroup Group",
|
||||
&VisibilityGroup_readLocalData,
|
||||
&VisibilityGroup_writeLocalData
|
||||
);
|
||||
|
||||
bool VisibilityGroup_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
VisibilityGroup& vg = static_cast<VisibilityGroup&>(obj);
|
||||
|
||||
unsigned int mask = vg.getVolumeIntersectionMask();
|
||||
if (fr[0].matchWord("volumeIntersectionMask") && fr[1].getUInt(mask))
|
||||
{
|
||||
vg.setNodeMask(mask);
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("segmentLength"))
|
||||
{
|
||||
if (fr[1].isFloat())
|
||||
{
|
||||
float value;
|
||||
fr[1].getFloat(value);
|
||||
vg.setSegmentLength(value);
|
||||
iteratorAdvanced = true;
|
||||
fr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr.matchSequence("visibilityVolume"))
|
||||
{
|
||||
// int entry = fr[0].getNoNestedBrackets();
|
||||
++fr;
|
||||
Node* node = NULL;
|
||||
if((node=fr.readNode())!=NULL)
|
||||
{
|
||||
vg.setVisibilityVolume(node);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool VisibilityGroup_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const VisibilityGroup& vg = static_cast<const VisibilityGroup&>(obj);
|
||||
|
||||
fw.indent()<<"volumeIntersectionMask 0x"<<std::hex<<vg.getVolumeIntersectionMask()<<std::dec<<std::endl;
|
||||
fw.indent()<<"segmentLength "<<vg.getSegmentLength()<<std::endl;
|
||||
fw.indent()<<"visibilityVolume" <<std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*vg.getVisibilityVolume());
|
||||
fw.moveOut();
|
||||
|
||||
return true;
|
||||
}
|
||||
17
src/osgWrappers/deprecated-dotosg/osgTerrain/CMakeLists.txt
Normal file
17
src/osgWrappers/deprecated-dotosg/osgTerrain/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
SET(TARGET_SRC
|
||||
Locator.cpp
|
||||
ImageLayer.cpp
|
||||
HeightFieldLayer.cpp
|
||||
CompositeLayer.cpp
|
||||
SwitchLayer.cpp
|
||||
Layer.cpp
|
||||
Terrain.cpp
|
||||
TerrainTile.cpp
|
||||
GeometryTechnique.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgTerrain )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgterrain)
|
||||
|
||||
|
||||
173
src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp
Normal file
173
src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp
Normal file
@@ -0,0 +1,173 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 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 <osgTerrain/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool CompositeLayer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool CompositeLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy CompositeLayer_Proxy
|
||||
(
|
||||
new osgTerrain::CompositeLayer,
|
||||
"CompositeLayer",
|
||||
"Object CompositeLayer Layer",
|
||||
CompositeLayer_readLocalData,
|
||||
CompositeLayer_writeLocalData
|
||||
);
|
||||
|
||||
bool CompositeLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::CompositeLayer& layer = static_cast<osgTerrain::CompositeLayer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osgTerrain::Locator> locator = 0;
|
||||
|
||||
do
|
||||
{
|
||||
itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
|
||||
locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
unsigned int minLevel=0;
|
||||
if (fr.read("MinLevel",minLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
|
||||
if (fr.read("MaxLevel",maxLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("file %s") || fr.matchSequence("file %w") )
|
||||
{
|
||||
layer.addLayer(fr[1].getStr());
|
||||
fr += 2;
|
||||
|
||||
itrAdvanced = true;
|
||||
}
|
||||
else if (fr.matchSequence("ProxyLayer %s") || fr.matchSequence("ProxyLayer %w"))
|
||||
{
|
||||
std::string setname;
|
||||
std::string filename;
|
||||
osgTerrain::extractSetNameAndFileName(fr[1].getStr(),setname, filename);
|
||||
if (!filename.empty())
|
||||
{
|
||||
osgTerrain::ProxyLayer* proxyLayer = new osgTerrain::ProxyLayer;
|
||||
proxyLayer->setFileName(filename);
|
||||
proxyLayer->setName(setname);
|
||||
|
||||
if (locator.valid()) proxyLayer->setLocator(locator.get());
|
||||
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
|
||||
|
||||
|
||||
layer.addLayer(proxyLayer);
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
|
||||
itrAdvanced = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Layer>());
|
||||
osgTerrain::Layer* readLayer = dynamic_cast<osgTerrain::Layer*>(readObject.get());
|
||||
if (readLayer)
|
||||
{
|
||||
if (locator.valid())
|
||||
{
|
||||
readLayer->setLocator(locator.get());
|
||||
locator = 0;
|
||||
}
|
||||
|
||||
if (minLevel!=0) readLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
|
||||
|
||||
layer.addLayer(readLayer);
|
||||
}
|
||||
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
}
|
||||
|
||||
} while (itrAdvanced);
|
||||
|
||||
if (locator.valid()) layer.setLocator(locator.get());
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::CompositeLayer& layer = static_cast<const osgTerrain::CompositeLayer&>(obj);
|
||||
|
||||
for(unsigned int i=0; i<layer.getNumLayers();++i)
|
||||
{
|
||||
if (layer.getLayer(i))
|
||||
{
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(layer.getLayer(i));
|
||||
if (proxyLayer)
|
||||
{
|
||||
if (!proxyLayer->getFileName().empty())
|
||||
{
|
||||
const osgTerrain::Locator* locator = proxyLayer->getLocator();
|
||||
if (locator && !locator->getDefinedInFile())
|
||||
{
|
||||
fw.writeObject(*locator);
|
||||
}
|
||||
|
||||
if (proxyLayer->getMinLevel()!=0)
|
||||
{
|
||||
fw.indent()<<"MinLevel "<<proxyLayer->getMinLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (proxyLayer->getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
fw.indent()<<"MaxLevel "<<proxyLayer->getMaxLevel()<<std::endl;
|
||||
}
|
||||
|
||||
fw.indent()<<"ProxyLayer "<<proxyLayer->getCompoundName()<<std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.writeObject(*(layer.getLayer(i)));
|
||||
}
|
||||
}
|
||||
else if (!layer.getFileName(i).empty())
|
||||
{
|
||||
fw.indent()<<"file "<<layer.getCompoundName(i)<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgTerrain/GeometryTechnique>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool GeometryTechnique_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool GeometryTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy GeometryTechnique_Proxy
|
||||
(
|
||||
new osgTerrain::GeometryTechnique,
|
||||
"GeometryTechnique",
|
||||
"GeometryTechnique Object",
|
||||
GeometryTechnique_readLocalData,
|
||||
GeometryTechnique_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool GeometryTechnique_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
//osgTerrain::GeometryTechnique& gt = static_cast<osgTerrain::GeometryTechnique&>(obj);
|
||||
bool itrAdvanced = false;
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool GeometryTechnique_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
//const osgTerrain::GeometryTechnique& gt = static_cast<const osgTerrain::GeometryTechnique&>(obj);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
#include <osgTerrain/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool HeightFieldLayer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool HeightFieldLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy HeightFieldLayer_Proxy
|
||||
(
|
||||
new osgTerrain::HeightFieldLayer,
|
||||
"HeightFieldLayer",
|
||||
"Object Layer HeightFieldLayer",
|
||||
HeightFieldLayer_readLocalData,
|
||||
HeightFieldLayer_writeLocalData
|
||||
);
|
||||
|
||||
bool HeightFieldLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::HeightFieldLayer& layer = static_cast<osgTerrain::HeightFieldLayer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("file %w") || fr.matchSequence("file %s"))
|
||||
{
|
||||
std::string setname;
|
||||
std::string filename;
|
||||
osgTerrain::extractSetNameAndFileName(fr[1].getStr(),setname, filename);
|
||||
if (!filename.empty())
|
||||
{
|
||||
osg::ref_ptr<osg::HeightField> hf = osgDB::readHeightFieldFile(filename);
|
||||
if (hf.valid())
|
||||
{
|
||||
layer.setName(setname);
|
||||
layer.setFileName(filename);
|
||||
layer.setHeightField(hf.get());
|
||||
}
|
||||
}
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::HeightField>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osg::HeightField* hf = dynamic_cast<osg::HeightField*>(readObject.get());
|
||||
if (hf)
|
||||
{
|
||||
layer.setHeightField(hf);
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool HeightFieldLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::HeightFieldLayer& layer = static_cast<const osgTerrain::HeightFieldLayer&>(obj);
|
||||
|
||||
if (!layer.getFileName().empty())
|
||||
{
|
||||
std::string str = osgTerrain::createCompondSetNameAndFileName(layer.getName(), layer.getFileName());
|
||||
fw.indent()<<"file "<< str << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (layer.getHeightField())
|
||||
{
|
||||
fw.writeObject(*layer.getHeightField());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
85
src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp
Normal file
85
src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <osgTerrain/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
bool ImageLayer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ImageLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ImageLayer_Proxy
|
||||
(
|
||||
new osgTerrain::ImageLayer,
|
||||
"ImageLayer",
|
||||
"Object Layer ImageLayer",
|
||||
ImageLayer_readLocalData,
|
||||
ImageLayer_writeLocalData
|
||||
);
|
||||
|
||||
bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::ImageLayer& layer = static_cast<osgTerrain::ImageLayer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("file %w") || fr.matchSequence("file %s"))
|
||||
{
|
||||
std::string filename = fr[1].getStr();
|
||||
if (!filename.empty())
|
||||
{
|
||||
bool deferExternalLayerLoading = osgTerrain::TerrainTile::getTileLoadedCallback().valid() ?
|
||||
osgTerrain::TerrainTile::getTileLoadedCallback()->deferExternalLayerLoading() : false;
|
||||
|
||||
layer.setFileName(filename);
|
||||
|
||||
if (!deferExternalLayerLoading)
|
||||
{
|
||||
osg::ref_ptr<osg::Image> image = fr.readImage(filename.c_str());
|
||||
if (image.valid())
|
||||
{
|
||||
layer.setImage(image.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool ImageLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::ImageLayer& layer = static_cast<const osgTerrain::ImageLayer&>(obj);
|
||||
|
||||
std::string fileName = layer.getFileName();
|
||||
|
||||
if (fw.getOutputTextureFiles())
|
||||
{
|
||||
if (fileName.empty())
|
||||
{
|
||||
fileName = fw.getTextureFileNameForOutput();
|
||||
}
|
||||
osgDB::writeImageFile(*layer.getImage(), fileName);
|
||||
}
|
||||
if (!fileName.empty())
|
||||
{
|
||||
fw.indent()<<"file "<< fw.wrapString(fileName) << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
128
src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp
Normal file
128
src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
#include <osgTerrain/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
bool Layer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Layer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
bool Layer_matchFilterStr(const char* str, osg::Texture::FilterMode& filter);
|
||||
const char* Layer_getFilterStr(osg::Texture::FilterMode filter);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Layer_Proxy
|
||||
(
|
||||
new osgTerrain::Layer,
|
||||
"Layer",
|
||||
"Object Layer",
|
||||
Layer_readLocalData,
|
||||
Layer_writeLocalData
|
||||
);
|
||||
|
||||
bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::Layer& layer = static_cast<osgTerrain::Layer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
|
||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (locator) layer.setLocator(locator);
|
||||
|
||||
osg::Texture::FilterMode filter;
|
||||
if (fr[0].matchWord("MinFilter") && Layer_matchFilterStr(fr[1].getStr(),filter))
|
||||
{
|
||||
layer.setMinFilter(filter);
|
||||
fr+=2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if ((fr[0].matchWord("Filter") || fr[0].matchWord("MagFilter")) &&
|
||||
Layer_matchFilterStr(fr[1].getStr(),filter))
|
||||
{
|
||||
layer.setMagFilter(filter);
|
||||
fr+=2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
unsigned int minLevel=0;
|
||||
if (fr.read("MinLevel",minLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
layer.setMinLevel(minLevel);
|
||||
}
|
||||
|
||||
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
|
||||
if (fr.read("MaxLevel",maxLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
layer.setMaxLevel(maxLevel);
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Layer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::Layer& layer = static_cast<const osgTerrain::Layer&>(obj);
|
||||
|
||||
if (layer.getLocator() && !(layer.getLocator()->getDefinedInFile()))
|
||||
{
|
||||
fw.writeObject(*layer.getLocator());
|
||||
}
|
||||
|
||||
fw.indent()<<"MinFilter "<<Layer_getFilterStr(layer.getMinFilter())<<std::endl;
|
||||
fw.indent()<<"MagFilter "<<Layer_getFilterStr(layer.getMagFilter())<<std::endl;
|
||||
|
||||
if (layer.getMinLevel()!=0)
|
||||
{
|
||||
fw.indent()<<"MinLevel "<<layer.getMinLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (layer.getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
fw.indent()<<"MaxLevel "<<layer.getMaxLevel()<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Layer_matchFilterStr(const char* str, osg::Texture::FilterMode& filter)
|
||||
{
|
||||
if (strcmp(str,"NEAREST")==0) filter = osg::Texture::NEAREST;
|
||||
else if (strcmp(str,"LINEAR")==0) filter = osg::Texture::LINEAR;
|
||||
else if (strcmp(str,"NEAREST_MIPMAP_NEAREST")==0) filter = osg::Texture::NEAREST_MIPMAP_NEAREST;
|
||||
else if (strcmp(str,"LINEAR_MIPMAP_NEAREST")==0) filter = osg::Texture::LINEAR_MIPMAP_NEAREST;
|
||||
else if (strcmp(str,"NEAREST_MIPMAP_LINEAR")==0) filter = osg::Texture::NEAREST_MIPMAP_LINEAR;
|
||||
else if (strcmp(str,"LINEAR_MIPMAP_LINEAR")==0) filter = osg::Texture::LINEAR_MIPMAP_LINEAR;
|
||||
else if (strcmp(str,"ANISOTROPIC")==0) filter = osg::Texture::LINEAR;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const char* Layer_getFilterStr(osg::Texture::FilterMode filter)
|
||||
{
|
||||
switch(filter)
|
||||
{
|
||||
case(osg::Texture::NEAREST): return "NEAREST";
|
||||
case(osg::Texture::LINEAR): return "LINEAR";
|
||||
case(osg::Texture::NEAREST_MIPMAP_NEAREST): return "NEAREST_MIPMAP_NEAREST";
|
||||
case(osg::Texture::LINEAR_MIPMAP_NEAREST): return "LINEAR_MIPMAP_NEAREST";
|
||||
case(osg::Texture::NEAREST_MIPMAP_LINEAR): return "NEAREST_MIPMAP_LINEAR";
|
||||
case(osg::Texture::LINEAR_MIPMAP_LINEAR): return "LINEAR_MIPMAP_LINEAR";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
158
src/osgWrappers/deprecated-dotosg/osgTerrain/Locator.cpp
Normal file
158
src/osgWrappers/deprecated-dotosg/osgTerrain/Locator.cpp
Normal file
@@ -0,0 +1,158 @@
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Locator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Locator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Locator_Proxy
|
||||
(
|
||||
new osgTerrain::Locator,
|
||||
"Locator",
|
||||
"Object Locator",
|
||||
Locator_readLocalData,
|
||||
Locator_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool Locator_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::Locator& locator = static_cast<osgTerrain::Locator&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("Format %w") || fr.matchSequence("Format %s") )
|
||||
{
|
||||
locator.setFormat(fr[1].getStr());
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("CoordinateSystemType %w"))
|
||||
{
|
||||
if (fr[1].matchWord("GEOCENTRIC")) locator.setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
|
||||
else if (fr[1].matchWord("GEOGRAPHIC")) locator.setCoordinateSystemType(osgTerrain::Locator::GEOGRAPHIC);
|
||||
else locator.setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("CoordinateSystem %w") || fr.matchSequence("CoordinateSystem %s") )
|
||||
{
|
||||
locator.setCoordinateSystem(fr[1].getStr());
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("TransformScaledByResolution %w"))
|
||||
{
|
||||
locator.setTransformScaledByResolution(fr[1].matchWord("TRUE") || fr[1].matchWord("True") || fr[1].matchWord("true"));
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Transform {"))
|
||||
{
|
||||
int tansform_entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
int row=0;
|
||||
int col=0;
|
||||
double v;
|
||||
osg::Matrixd matrix;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>tansform_entry)
|
||||
{
|
||||
if (fr[0].getFloat(v))
|
||||
{
|
||||
matrix(row,col)=v;
|
||||
++col;
|
||||
if (col>=4)
|
||||
{
|
||||
col = 0;
|
||||
++row;
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
else fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
|
||||
locator.setTransform(matrix);
|
||||
|
||||
++fr;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
if (fr.matchSequence("Extents %f %f %f %f"))
|
||||
{
|
||||
double minX,minY,maxX,maxY;
|
||||
fr[1].getFloat(minX);
|
||||
fr[2].getFloat(minY);
|
||||
fr[3].getFloat(maxX);
|
||||
fr[4].getFloat(maxY);
|
||||
|
||||
locator.setTransformAsExtents(minX, minY, maxX, maxY);
|
||||
|
||||
fr += 5;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Locator_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::Locator& locator = static_cast<const osgTerrain::Locator&>(obj);
|
||||
|
||||
if (!locator.getFormat().empty()) fw.indent()<<"Format "<<fw.wrapString(locator.getFormat())<<std::endl;
|
||||
if (!locator.getCoordinateSystem().empty()) fw.indent()<<"CoordinateSystem "<<fw.wrapString(locator.getCoordinateSystem())<<std::endl;
|
||||
|
||||
fw.indent()<<"CoordinateSystemType ";
|
||||
switch(locator.getCoordinateSystemType())
|
||||
{
|
||||
case(osgTerrain::Locator::GEOCENTRIC):
|
||||
{
|
||||
fw<<"GEOCENTRIC"<<std::endl;
|
||||
break;
|
||||
}
|
||||
case(osgTerrain::Locator::GEOGRAPHIC):
|
||||
{
|
||||
fw<<"GEOGRAPHIC"<<std::endl;
|
||||
break;
|
||||
}
|
||||
case(osgTerrain::Locator::PROJECTED):
|
||||
{
|
||||
fw<<"PROJECTED"<<std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fw.indent()<<"TransformScaledByResolution " << (locator.getTransformScaledByResolution() ? "TRUE":"FALSE") <<std::endl;
|
||||
|
||||
const osg::Matrixd& matrix = locator.getTransform();
|
||||
fw.indent() << "Transform {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
|
||||
fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
|
||||
fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
|
||||
fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
64
src/osgWrappers/deprecated-dotosg/osgTerrain/SwitchLayer.cpp
Normal file
64
src/osgWrappers/deprecated-dotosg/osgTerrain/SwitchLayer.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 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 <osgTerrain/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool SwitchLayer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SwitchLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SwitchLayer_Proxy
|
||||
(
|
||||
new osgTerrain::SwitchLayer,
|
||||
"SwitchLayer",
|
||||
"Object SwitchLayer CompositeLayer Layer",
|
||||
SwitchLayer_readLocalData,
|
||||
SwitchLayer_writeLocalData
|
||||
);
|
||||
|
||||
bool SwitchLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::SwitchLayer& layer = static_cast<osgTerrain::SwitchLayer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
int i;
|
||||
if (fr.read("ActiveLayer",i))
|
||||
{
|
||||
layer.setActiveLayer(i);
|
||||
itrAdvanced = true;
|
||||
};
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool SwitchLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::SwitchLayer& layer = static_cast<const osgTerrain::SwitchLayer&>(obj);
|
||||
|
||||
fw.indent()<<"ActiveLayer "<<layer.getActiveLayer()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
42
src/osgWrappers/deprecated-dotosg/osgTerrain/Terrain.cpp
Normal file
42
src/osgWrappers/deprecated-dotosg/osgTerrain/Terrain.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "osgTerrain/Terrain"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Terrain_readLocalData(osg::Object& obj, osgDB::Input& fr);
|
||||
bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Terrain)
|
||||
(
|
||||
new osgTerrain::Terrain,
|
||||
"Terrain",
|
||||
"Object Node Terrain Group",
|
||||
&Terrain_readLocalData,
|
||||
&Terrain_writeLocalData
|
||||
);
|
||||
|
||||
bool Terrain_readLocalData(osg::Object& obj, osgDB::Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
osgTerrain::Terrain& terrain = static_cast<osgTerrain::Terrain&>(obj);
|
||||
|
||||
float value;
|
||||
if (fr.read("SampleRatio",value)) terrain.setSampleRatio(value);
|
||||
if (fr.read("VerticalScale",value)) terrain.setVerticalScale(value);
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::Terrain& terrain = static_cast<const osgTerrain::Terrain&>(obj);
|
||||
fw.indent()<<"SampleRatio "<<terrain.getSampleRatio()<<std::endl;
|
||||
fw.indent()<<"VerticalScale "<<terrain.getVerticalScale()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
297
src/osgWrappers/deprecated-dotosg/osgTerrain/TerrainTile.cpp
Normal file
297
src/osgWrappers/deprecated-dotosg/osgTerrain/TerrainTile.cpp
Normal file
@@ -0,0 +1,297 @@
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool TerrainTile_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool TerrainTile_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy TerrainTile_Proxy
|
||||
(
|
||||
new osgTerrain::TerrainTile,
|
||||
"TerrainTile",
|
||||
"Object Node TerrainTile Group",
|
||||
TerrainTile_readLocalData,
|
||||
TerrainTile_writeLocalData
|
||||
);
|
||||
|
||||
bool TerrainTile_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::TerrainTile& terrainTile = static_cast<osgTerrain::TerrainTile&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (locator) terrainTile.setLocator(locator);
|
||||
|
||||
if (fr.matchSequence("ElevationLayer {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool localAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
|
||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
|
||||
unsigned int minLevel=0;
|
||||
if (fr.read("MinLevel",minLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
|
||||
if (fr.read("MaxLevel",maxLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("ProxyLayer %s") || fr.matchSequence("ProxyLayer %w") )
|
||||
{
|
||||
osgTerrain::ProxyLayer* proxyLayer = new osgTerrain::ProxyLayer;
|
||||
proxyLayer->setFileName(fr[1].getStr());
|
||||
|
||||
if (locator) proxyLayer->setLocator(locator);
|
||||
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrainTile.setElevationLayer(proxyLayer);
|
||||
|
||||
fr += 2;
|
||||
|
||||
localAdvanced = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Layer>());
|
||||
osgTerrain::Layer* readLayer = dynamic_cast<osgTerrain::Layer*>(readObject.get());
|
||||
if (readLayer)
|
||||
{
|
||||
if (locator) readLayer->setLocator(locator);
|
||||
if (minLevel!=0) readLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrainTile.setElevationLayer(readLayer);
|
||||
}
|
||||
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
}
|
||||
|
||||
if (!localAdvanced) ++fr;
|
||||
}
|
||||
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
bool firstMatched = false;
|
||||
if ((firstMatched = fr.matchSequence("ColorLayer %i {")) || fr.matchSequence("ColorLayer {") )
|
||||
{
|
||||
unsigned int layerNum = 0;
|
||||
if (firstMatched)
|
||||
{
|
||||
fr[1].getUInt(layerNum);
|
||||
++fr;
|
||||
}
|
||||
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool localAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
|
||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
|
||||
unsigned int minLevel=0;
|
||||
if (fr.read("MinLevel",minLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
|
||||
if (fr.read("MaxLevel",maxLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("ProxyFile %s") || fr.matchSequence("ProxyFile %w") )
|
||||
{
|
||||
osg::ref_ptr<osg::Object> image = osgDB::readObjectFile(std::string(fr[1].getStr())+".gdal");
|
||||
osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<osgTerrain::ProxyLayer*>(image.get());
|
||||
if (proxyLayer)
|
||||
{
|
||||
if (locator) proxyLayer->setLocator(locator);
|
||||
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrainTile.setColorLayer(layerNum, proxyLayer);
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
|
||||
localAdvanced = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Layer>());
|
||||
osgTerrain::Layer* readLayer = dynamic_cast<osgTerrain::Layer*>(readObject.get());
|
||||
if (readLayer)
|
||||
{
|
||||
if (locator) readLayer->setLocator(locator);
|
||||
if (minLevel!=0) readLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrainTile.setColorLayer(layerNum, readLayer);
|
||||
}
|
||||
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
}
|
||||
|
||||
if (!localAdvanced) ++fr;
|
||||
}
|
||||
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::TerrainTechnique>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
terrainTile.setTerrainTechnique(dynamic_cast<osgTerrain::TerrainTechnique*>(readObject.get()));
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
if (osgTerrain::TerrainTile::getTileLoadedCallback().valid())
|
||||
osgTerrain::TerrainTile::getTileLoadedCallback()->loaded(&terrainTile, fr.getOptions());
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool TerrainTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::TerrainTile& terrainTile = static_cast<const osgTerrain::TerrainTile&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
|
||||
if (terrainTile.getLocator())
|
||||
{
|
||||
fw.writeObject(*terrainTile.getLocator());
|
||||
}
|
||||
|
||||
if (terrainTile.getElevationLayer())
|
||||
{
|
||||
fw.indent()<<"ElevationLayer {"<<std::endl;
|
||||
|
||||
fw.moveIn();
|
||||
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(terrainTile.getElevationLayer());
|
||||
if (proxyLayer)
|
||||
{
|
||||
if (!proxyLayer->getFileName().empty())
|
||||
{
|
||||
const osgTerrain::Locator* locator = proxyLayer->getLocator();
|
||||
if (locator && !locator->getDefinedInFile())
|
||||
{
|
||||
fw.writeObject(*locator);
|
||||
}
|
||||
|
||||
if (proxyLayer->getMinLevel()!=0)
|
||||
{
|
||||
fw.indent()<<"MinLevel "<<proxyLayer->getMinLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (proxyLayer->getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
fw.indent()<<"MaxLevel "<<proxyLayer->getMaxLevel()<<std::endl;
|
||||
}
|
||||
|
||||
fw.indent()<<"ProxyLayer "<<proxyLayer->getFileName()<<std::endl;
|
||||
}
|
||||
}
|
||||
else if (terrainTile.getElevationLayer())
|
||||
{
|
||||
fw.writeObject(*terrainTile.getElevationLayer());
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<terrainTile.getNumColorLayers(); ++i)
|
||||
{
|
||||
const osgTerrain::Layer* layer = terrainTile.getColorLayer(i);
|
||||
if (layer)
|
||||
{
|
||||
if (i>0)
|
||||
{
|
||||
fw.indent()<<"ColorLayer "<<i<<" {"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.indent()<<"ColorLayer {"<<std::endl;
|
||||
}
|
||||
|
||||
fw.moveIn();
|
||||
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(layer);
|
||||
if (proxyLayer)
|
||||
{
|
||||
const osgTerrain::Locator* locator = proxyLayer->getLocator();
|
||||
if (locator && !locator->getDefinedInFile())
|
||||
{
|
||||
fw.writeObject(*locator);
|
||||
}
|
||||
|
||||
if (proxyLayer->getMinLevel()!=0)
|
||||
{
|
||||
fw.indent()<<"MinLevel "<<proxyLayer->getMinLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (proxyLayer->getMaxLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
fw.indent()<<"MaxLevel "<<proxyLayer->getMaxLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (!proxyLayer->getFileName().empty()) fw.indent()<<"ProxyLayer "<<proxyLayer->getFileName()<<std::endl;
|
||||
}
|
||||
else if (layer)
|
||||
{
|
||||
fw.writeObject(*terrainTile.getColorLayer(i));
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (terrainTile.getTerrainTechnique())
|
||||
{
|
||||
fw.writeObject(*terrainTile.getTerrainTechnique());
|
||||
}
|
||||
|
||||
fw.precision(prec);
|
||||
|
||||
return true;
|
||||
}
|
||||
4
src/osgWrappers/deprecated-dotosg/osgText/CMakeLists.txt
Normal file
4
src/osgWrappers/deprecated-dotosg/osgText/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
SET(TARGET_SRC IO_TextBase.cpp IO_Text.cpp IO_Text3D.cpp )
|
||||
SET(TARGET_ADDED_LIBRARIES osgText )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgtext)
|
||||
310
src/osgWrappers/deprecated-dotosg/osgText/IO_Text.cpp
Normal file
310
src/osgWrappers/deprecated-dotosg/osgText/IO_Text.cpp
Normal file
@@ -0,0 +1,310 @@
|
||||
#include <osgText/Text>
|
||||
#include <osgText/Font>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Text_Proxy
|
||||
(
|
||||
new osgText::Text,
|
||||
"Text",
|
||||
"Object Drawable TextBase Text",
|
||||
Text_readLocalData,
|
||||
Text_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
osgText::Text::BackdropType convertBackdropTypeStringToEnum(std::string & str)
|
||||
{
|
||||
if (str=="DROP_SHADOW_BOTTOM_RIGHT") return osgText::Text::DROP_SHADOW_BOTTOM_RIGHT;
|
||||
else if (str=="DROP_SHADOW_CENTER_RIGHT") return osgText::Text::DROP_SHADOW_CENTER_RIGHT;
|
||||
else if (str=="DROP_SHADOW_TOP_RIGHT") return osgText::Text::DROP_SHADOW_TOP_RIGHT;
|
||||
else if (str=="DROP_SHADOW_BOTTOM_CENTER") return osgText::Text::DROP_SHADOW_BOTTOM_CENTER;
|
||||
else if (str=="DROP_SHADOW_TOP_CENTER") return osgText::Text::DROP_SHADOW_TOP_CENTER;
|
||||
else if (str=="DROP_SHADOW_BOTTOM_LEFT") return osgText::Text::DROP_SHADOW_BOTTOM_LEFT;
|
||||
else if (str=="DROP_SHADOW_CENTER_LEFT") return osgText::Text::DROP_SHADOW_CENTER_LEFT;
|
||||
else if (str=="DROP_SHADOW_TOP_LEFT") return osgText::Text::DROP_SHADOW_TOP_LEFT;
|
||||
else if (str=="OUTLINE") return osgText::Text::OUTLINE;
|
||||
else if (str=="NONE") return osgText::Text::NONE;
|
||||
else return static_cast<osgText::Text::BackdropType>(-1);
|
||||
}
|
||||
std::string convertBackdropTypeEnumToString(osgText::Text::BackdropType backdropType)
|
||||
{
|
||||
switch (backdropType)
|
||||
{
|
||||
case osgText::Text::DROP_SHADOW_BOTTOM_RIGHT: return "DROP_SHADOW_BOTTOM_RIGHT";
|
||||
case osgText::Text::DROP_SHADOW_CENTER_RIGHT: return "DROP_SHADOW_CENTER_RIGHT";
|
||||
case osgText::Text::DROP_SHADOW_TOP_RIGHT: return "DROP_SHADOW_TOP_RIGHT";
|
||||
case osgText::Text::DROP_SHADOW_BOTTOM_CENTER: return "DROP_SHADOW_BOTTOM_CENTER";
|
||||
case osgText::Text::DROP_SHADOW_TOP_CENTER: return "DROP_SHADOW_TOP_CENTER";
|
||||
case osgText::Text::DROP_SHADOW_BOTTOM_LEFT: return "DROP_SHADOW_BOTTOM_LEFT";
|
||||
case osgText::Text::DROP_SHADOW_CENTER_LEFT: return "DROP_SHADOW_CENTER_LEFT";
|
||||
case osgText::Text::DROP_SHADOW_TOP_LEFT: return "DROP_SHADOW_TOP_LEFT";
|
||||
case osgText::Text::OUTLINE: return "OUTLINE";
|
||||
case osgText::Text::NONE: return "NONE";
|
||||
default : return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
osgText::Text::BackdropImplementation convertBackdropImplementationStringToEnum(std::string & str)
|
||||
{
|
||||
if (str=="POLYGON_OFFSET") return osgText::Text::POLYGON_OFFSET;
|
||||
else if (str=="NO_DEPTH_BUFFER") return osgText::Text::NO_DEPTH_BUFFER;
|
||||
else if (str=="DEPTH_RANGE") return osgText::Text::DEPTH_RANGE;
|
||||
else if (str=="STENCIL_BUFFER") return osgText::Text::STENCIL_BUFFER;
|
||||
else return static_cast<osgText::Text::BackdropImplementation>(-1);
|
||||
}
|
||||
std::string convertBackdropImplementationEnumToString(osgText::Text::BackdropImplementation backdropImplementation)
|
||||
{
|
||||
switch (backdropImplementation)
|
||||
{
|
||||
case osgText::Text::POLYGON_OFFSET: return "POLYGON_OFFSET";
|
||||
case osgText::Text::NO_DEPTH_BUFFER: return "NO_DEPTH_BUFFER";
|
||||
case osgText::Text::DEPTH_RANGE: return "DEPTH_RANGE";
|
||||
case osgText::Text::STENCIL_BUFFER: return "STENCIL_BUFFER";
|
||||
default : return "";
|
||||
}
|
||||
}
|
||||
|
||||
osgText::Text::ColorGradientMode convertColorGradientModeStringToEnum(std::string & str)
|
||||
{
|
||||
if (str=="SOLID") return osgText::Text::SOLID;
|
||||
else if (str=="PER_CHARACTER") return osgText::Text::PER_CHARACTER;
|
||||
else if (str=="OVERALL") return osgText::Text::OVERALL;
|
||||
else return static_cast<osgText::Text::ColorGradientMode>(-1);
|
||||
}
|
||||
std::string convertColorGradientModeEnumToString(osgText::Text::ColorGradientMode colorGradientMode)
|
||||
{
|
||||
switch (colorGradientMode)
|
||||
{
|
||||
case osgText::Text::SOLID: return "SOLID";
|
||||
case osgText::Text::PER_CHARACTER: return "PER_CHARACTER";
|
||||
case osgText::Text::OVERALL: return "OVERALL";
|
||||
default : return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgText::Text &text = static_cast<osgText::Text &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
|
||||
if (fr.matchSequence("font %w"))
|
||||
{
|
||||
text.setFont(fr[1].getStr());
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
// color
|
||||
if (fr[0].matchWord("color"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
text.setColor(c);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// backdropType
|
||||
if (fr[0].matchWord("backdropType"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
osgText::Text::BackdropType backdropType = convertBackdropTypeStringToEnum(str);
|
||||
|
||||
if (backdropType != static_cast<osgText::Text::BackdropType>(-1))
|
||||
text.setBackdropType(backdropType);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
float backdropHorizontalOffset = text.getBackdropHorizontalOffset();
|
||||
float backdropVerticalOffset = text.getBackdropVerticalOffset();
|
||||
|
||||
// backdropHorizontalOffset
|
||||
if (fr[0].matchWord("backdropHorizontalOffset"))
|
||||
{
|
||||
if (fr[1].getFloat(backdropHorizontalOffset))
|
||||
{
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// backdropVerticalOffset
|
||||
if (fr[0].matchWord("backdropVerticalOffset"))
|
||||
{
|
||||
if (fr[1].getFloat(backdropVerticalOffset))
|
||||
{
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
text.setBackdropOffset(backdropHorizontalOffset, backdropVerticalOffset);
|
||||
|
||||
// backdropColor
|
||||
if (fr[0].matchWord("backdropColor"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
text.setBackdropColor(c);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// backdropImplementation
|
||||
if (fr[0].matchWord("backdropImplementation"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
osgText::Text::BackdropImplementation backdropImplementation = convertBackdropImplementationStringToEnum(str);
|
||||
|
||||
if (backdropImplementation != static_cast<osgText::Text::BackdropImplementation>(-1))
|
||||
text.setBackdropImplementation(backdropImplementation);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
// ColorGradientMode
|
||||
if (fr[0].matchWord("colorGradientMode"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
osgText::Text::ColorGradientMode colorGradientMode = convertColorGradientModeStringToEnum(str);
|
||||
|
||||
if (colorGradientMode != static_cast<osgText::Text::ColorGradientMode>(-1))
|
||||
text.setColorGradientMode(colorGradientMode);
|
||||
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
// ** get default value;
|
||||
osg::Vec4 colorGradientTopLeft = text.getColorGradientTopLeft();
|
||||
osg::Vec4 colorGradientBottomLeft = text.getColorGradientBottomLeft();
|
||||
osg::Vec4 colorGradientBottomRight = text.getColorGradientBottomRight();
|
||||
osg::Vec4 colorGradientTopRight = text.getColorGradientTopRight();
|
||||
|
||||
// colorGradientTopLeft
|
||||
if (fr[0].matchWord("colorGradientTopLeft"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
colorGradientTopLeft = c;
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// colorGradientBottomLeft
|
||||
if (fr[0].matchWord("colorGradientBottomLeft"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
colorGradientBottomLeft = c;
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// colorGradientBottomRight
|
||||
if (fr[0].matchWord("colorGradientBottomRight"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
colorGradientBottomRight = c;
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// colorGradientTopRight
|
||||
if (fr[0].matchWord("colorGradientTopRight"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
colorGradientTopRight = c;
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
text.setColorGradientCorners(colorGradientTopLeft, colorGradientBottomLeft, colorGradientBottomRight, colorGradientTopRight);
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgText::Text &text = static_cast<const osgText::Text &>(obj);
|
||||
|
||||
if (text.getFont())
|
||||
{
|
||||
fw.indent() << "font " << text.getFont()->getFileName() << std::endl;
|
||||
}
|
||||
|
||||
// color
|
||||
osg::Vec4 c = text.getColor();
|
||||
fw.indent() << "color " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// backdropType
|
||||
fw.indent() << "backdropType " << convertBackdropTypeEnumToString(text.getBackdropType()) << std::endl;
|
||||
|
||||
// backdropHorizontalOffset
|
||||
fw.indent() << "backdropHorizontalOffset " << text.getBackdropHorizontalOffset() << std::endl;
|
||||
|
||||
// backdropVerticalOffset
|
||||
fw.indent() << "backdropVerticalOffset " << text.getBackdropVerticalOffset() << std::endl;
|
||||
|
||||
// backdropColor
|
||||
c = text.getBackdropColor();
|
||||
fw.indent() << "backdropColor " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// backdropImplementation
|
||||
fw.indent() << "backdropImplementation " << convertBackdropImplementationEnumToString(text.getBackdropImplementation()) << std::endl;
|
||||
|
||||
// colorGradientMode
|
||||
fw.indent() << "colorGradientMode " << convertColorGradientModeEnumToString(text.getColorGradientMode()) << std::endl;
|
||||
|
||||
// colorGradientTopLeft
|
||||
c = text.getColorGradientTopLeft();
|
||||
fw.indent() << "colorGradientTopLeft " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// colorGradientBottomLeft
|
||||
c = text.getColorGradientBottomLeft();
|
||||
fw.indent() << "colorGradientBottomLeft " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// colorGradientBottomRight
|
||||
c = text.getColorGradientBottomRight();
|
||||
fw.indent() << "colorGradientBottomRight " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// colorGradientTopRight
|
||||
c = text.getColorGradientTopRight();
|
||||
fw.indent() << "colorGradientTopRight " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
99
src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp
Normal file
99
src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
#include <osgText/Text3D>
|
||||
#include <osgText/Font>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Text3D_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Text3D_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Text3D_Proxy
|
||||
(
|
||||
new osgText::Text3D,
|
||||
"Text3D",
|
||||
"Object Drawable TextBase Text3D",
|
||||
Text3D_readLocalData,
|
||||
Text3D_writeLocalData
|
||||
);
|
||||
|
||||
osgText::Text3D::RenderMode convertRenderModeStringToEnum(const std::string str)
|
||||
{
|
||||
if (str == "PER_GLYPH") return osgText::Text3D::PER_GLYPH;
|
||||
else if (str == "PER_FACE") return osgText::Text3D::PER_FACE;
|
||||
return static_cast<osgText::Text3D::RenderMode>(-1);
|
||||
}
|
||||
std::string convertRenderModeEnumToString(osgText::Text3D::RenderMode renderMode)
|
||||
{
|
||||
switch (renderMode)
|
||||
{
|
||||
case osgText::Text3D::PER_GLYPH: return "PER_GLYPH";
|
||||
case osgText::Text3D::PER_FACE: return "PER_FACE";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool Text3D_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgText::Text3D &text = static_cast<osgText::Text3D &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
// font
|
||||
if (fr.matchSequence("font %w"))
|
||||
{
|
||||
text.setFont(fr[1].getStr());
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
// characterDepth
|
||||
if (fr[0].matchWord("characterDepth"))
|
||||
{
|
||||
float depth;
|
||||
if (fr[1].getFloat(depth))
|
||||
{
|
||||
text.setCharacterDepth(depth);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// RenderMode
|
||||
if (fr[0].matchWord("renderMode"))
|
||||
{
|
||||
osgText::Text3D::RenderMode renderMode = convertRenderModeStringToEnum(fr[1].getStr());
|
||||
if (renderMode != static_cast<osgText::Text3D::RenderMode>(-1))
|
||||
{
|
||||
text.setRenderMode(renderMode);
|
||||
}
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
bool Text3D_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgText::Text3D &text = static_cast<const osgText::Text3D &>(obj);
|
||||
|
||||
if (text.getFont())
|
||||
{
|
||||
fw.indent() << "font " << text.getFont()->getFileName() << std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "characterDepth " << text.getCharacterDepth() << std::endl;
|
||||
|
||||
fw.indent() << "renderMode " << convertRenderModeEnumToString(text.getRenderMode()) << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
412
src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp
Normal file
412
src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp
Normal file
@@ -0,0 +1,412 @@
|
||||
#include <osgText/Text>
|
||||
#include <osgText/Font>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool TextBase_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy TextBase_Proxy
|
||||
(
|
||||
/*new osgText::Text*/NULL,
|
||||
"TextBase",
|
||||
"Object Drawable TextBase",
|
||||
TextBase_readLocalData,
|
||||
TextBase_writeLocalData
|
||||
);
|
||||
|
||||
bool TextBase_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgText::Text &text = static_cast<osgText::Text &>(obj);
|
||||
bool itAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord("fontResolution") || fr[0].matchWord("fontSize"))
|
||||
{
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
if (fr[1].getUInt(width) && fr[2].getUInt(height))
|
||||
{
|
||||
text.setFontResolution(width,height);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("characterSize"))
|
||||
{
|
||||
float height;
|
||||
float aspectRatio;
|
||||
if (fr[1].getFloat(height) && fr[2].getFloat(aspectRatio))
|
||||
{
|
||||
text.setCharacterSize(height,aspectRatio);
|
||||
fr += 3;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr.matchSequence("characterSizeMode %w"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
if (str=="OBJECT_COORDS") text.setCharacterSizeMode(osgText::Text::OBJECT_COORDS);
|
||||
else if (str=="SCREEN_COORDS") text.setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
|
||||
else if (str=="OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT") text.setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
||||
}
|
||||
|
||||
// maximum dimentsions of text box.
|
||||
if (fr[0].matchWord("maximumWidth"))
|
||||
{
|
||||
float width;
|
||||
if (fr[1].getFloat(width))
|
||||
{
|
||||
text.setMaximumWidth(width);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("maximumHeight"))
|
||||
{
|
||||
float height;
|
||||
if (fr[1].getFloat(height))
|
||||
{
|
||||
text.setMaximumHeight(height);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("lineSpacing"))
|
||||
{
|
||||
float height;
|
||||
if (fr[1].getFloat(height))
|
||||
{
|
||||
text.setLineSpacing(height);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr.matchSequence("alignment %w"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
if (str=="LEFT_TOP") text.setAlignment(osgText::Text::LEFT_TOP);
|
||||
else if (str=="LEFT_CENTER") text.setAlignment(osgText::Text::LEFT_CENTER);
|
||||
else if (str=="LEFT_BOTTOM") text.setAlignment(osgText::Text::LEFT_BOTTOM);
|
||||
else if (str=="CENTER_TOP") text.setAlignment(osgText::Text::CENTER_TOP);
|
||||
else if (str=="CENTER_CENTER") text.setAlignment(osgText::Text::CENTER_CENTER);
|
||||
else if (str=="CENTER_BOTTOM") text.setAlignment(osgText::Text::CENTER_BOTTOM);
|
||||
else if (str=="RIGHT_TOP") text.setAlignment(osgText::Text::RIGHT_TOP);
|
||||
else if (str=="RIGHT_CENTER") text.setAlignment(osgText::Text::RIGHT_CENTER);
|
||||
else if (str=="RIGHT_BOTTOM") text.setAlignment(osgText::Text::RIGHT_BOTTOM);
|
||||
else if (str=="LEFT_BASE_LINE") text.setAlignment(osgText::Text::LEFT_BASE_LINE);
|
||||
else if (str=="CENTER_BASE_LINE") text.setAlignment(osgText::Text::CENTER_BASE_LINE);
|
||||
else if (str=="RIGHT_BASE_LINE") text.setAlignment(osgText::Text::RIGHT_BASE_LINE);
|
||||
else if (str=="LEFT_BOTTOM_BASE_LINE") text.setAlignment(osgText::Text::LEFT_BOTTOM_BASE_LINE);
|
||||
else if (str=="CENTER_BOTTOM_BASE_LINE") text.setAlignment(osgText::Text::CENTER_BOTTOM_BASE_LINE);
|
||||
else if (str=="RIGHT_BOTTOM_BASE_LINE") text.setAlignment(osgText::Text::RIGHT_BOTTOM_BASE_LINE);
|
||||
else if (str=="BASE_LINE") text.setAlignment(osgText::Text::BASE_LINE);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("axisAlignment %w"))
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
if (str=="XY_PLANE") text.setAxisAlignment(osgText::Text::XY_PLANE);
|
||||
else if (str=="REVERSED_XY_PLANE") text.setAxisAlignment(osgText::Text::REVERSED_XY_PLANE);
|
||||
else if (str=="XZ_PLANE") text.setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
else if (str=="REVERSED_XZ_PLANE") text.setAxisAlignment(osgText::Text::REVERSED_XZ_PLANE);
|
||||
else if (str=="YZ_PLANE") text.setAxisAlignment(osgText::Text::YZ_PLANE);
|
||||
else if (str=="REVERSED_YZ_PLANE") text.setAxisAlignment(osgText::Text::REVERSED_YZ_PLANE);
|
||||
else if (str=="SCREEN") text.setAxisAlignment(osgText::Text::SCREEN);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("rotation"))
|
||||
{
|
||||
osg::Vec4 rotation;
|
||||
if (fr[1].getFloat(rotation.x()) && fr[2].getFloat(rotation.y()) && fr[3].getFloat(rotation.z()) && fr[4].getFloat(rotation.w()))
|
||||
{
|
||||
text.setRotation(rotation);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fr.matchSequence("autoRotateToScreen TRUE"))
|
||||
{
|
||||
text.setAutoRotateToScreen(true);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("autoScaleToLimitScreenSizeToFontResolution TRUE"))
|
||||
{
|
||||
text.setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("layout %w") && fr[1].getStr())
|
||||
{
|
||||
std::string str = fr[1].getStr();
|
||||
if (str=="LEFT_TO_RIGHT") text.setLayout(osgText::Text::LEFT_TO_RIGHT);
|
||||
else if (str=="RIGHT_TO_LEFT") text.setLayout(osgText::Text::RIGHT_TO_LEFT);
|
||||
else if (str=="VERTICAL") text.setLayout(osgText::Text::VERTICAL);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
// position
|
||||
if (fr[0].matchWord("position"))
|
||||
{
|
||||
osg::Vec3 p;
|
||||
if (fr[1].getFloat(p.x()) && fr[2].getFloat(p.y()) && fr[3].getFloat(p.z()))
|
||||
{
|
||||
text.setPosition(p);
|
||||
fr += 4;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// draw mode
|
||||
if (fr[0].matchWord("drawMode"))
|
||||
{
|
||||
int i;
|
||||
if (fr[1].getInt(i)) {
|
||||
text.setDrawMode(i);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// bounding box margin
|
||||
if (fr[0].matchWord("BoundingBoxMargin"))
|
||||
{
|
||||
float margin;
|
||||
if (fr[1].getFloat(margin)) {
|
||||
text.setBoundingBoxMargin(margin);
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// bounding box color
|
||||
if (fr[0].matchWord("BoundingBoxColor"))
|
||||
{
|
||||
osg::Vec4 c;
|
||||
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w()))
|
||||
{
|
||||
text.setBoundingBoxColor(c);
|
||||
fr += 5;
|
||||
itAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// text
|
||||
if (fr.matchSequence("text %s") && fr[1].getStr()) {
|
||||
text.setText(std::string(fr[1].getStr()));
|
||||
fr += 2;
|
||||
itAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("text %i {"))
|
||||
{
|
||||
// pre 0.9.3 releases..
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
int capacity;
|
||||
fr[1].getInt(capacity);
|
||||
|
||||
osgText::String str;
|
||||
str.reserve(capacity);
|
||||
|
||||
fr += 3;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
unsigned int c;
|
||||
if (fr[0].getUInt(c))
|
||||
{
|
||||
++fr;
|
||||
str.push_back(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
|
||||
text.setText(str);
|
||||
|
||||
itAdvanced = true;
|
||||
++fr;
|
||||
}
|
||||
|
||||
return itAdvanced;
|
||||
}
|
||||
|
||||
//osgText::Text::CharactereSizeMode convertCharactereSizeModeStringtoEnum(std::string & str)
|
||||
//{
|
||||
// if (str=="OBJECT_COORDS") return osgText::Text::OBJECT_COORDS;
|
||||
// else if (str=="SCREEN_COORDS") return osgText::Text::SCREEN_COORDS;
|
||||
// else if (str=="OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT") return osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT;
|
||||
// else return -1;
|
||||
//}
|
||||
//
|
||||
//std::string convertCharactereSizeModeStringtoEnum(osgText::Text::CharactereSizeMode charactereSizeMode)
|
||||
//{
|
||||
// switch(charactereSizeMode)
|
||||
// {
|
||||
// case osgText::Text::OBJECT_COORDS : return "OBJECT_COORDS";
|
||||
// case osgText::Text::SCREEN_COORDS : return "SCREEN_COORDS";
|
||||
// case osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT: return "OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT";
|
||||
// default : return "";
|
||||
// }
|
||||
//}
|
||||
|
||||
bool TextBase_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgText::Text &text = static_cast<const osgText::Text &>(obj);
|
||||
|
||||
// font resolution
|
||||
fw.indent() << "fontResolution " << text.getFontWidth() << " " << text.getFontHeight() << std::endl;
|
||||
|
||||
// charater size.
|
||||
fw.indent() << "characterSize " << text.getCharacterHeight() << " " << text.getCharacterAspectRatio() << std::endl;
|
||||
|
||||
fw.indent() << "characterSizeMode ";
|
||||
switch(text.getCharacterSizeMode())
|
||||
{
|
||||
case osgText::Text::OBJECT_COORDS : fw<<"OBJECT_COORDS"<<std::endl; break;
|
||||
case osgText::Text::SCREEN_COORDS : fw<<"SCREEN_COORDS"<<std::endl; break;
|
||||
case osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT: fw<<"OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT"<<std::endl; break;
|
||||
}
|
||||
|
||||
// maximum dimension of text box.
|
||||
if (text.getMaximumWidth()>0.0f)
|
||||
{
|
||||
fw.indent() << "maximumWidth " << text.getMaximumWidth() << std::endl;
|
||||
}
|
||||
|
||||
if (text.getMaximumHeight()>0.0f)
|
||||
{
|
||||
fw.indent() << "maximumHeight " << text.getMaximumHeight() << std::endl;
|
||||
}
|
||||
|
||||
if (text.getLineSpacing()>0.0f)
|
||||
{
|
||||
fw.indent() << "lineSpacing " << text.getLineSpacing() << std::endl;
|
||||
}
|
||||
|
||||
// alignment
|
||||
fw.indent() << "alignment ";
|
||||
switch(text.getAlignment())
|
||||
{
|
||||
case osgText::Text::LEFT_TOP: fw << "LEFT_TOP" << std::endl; break;
|
||||
case osgText::Text::LEFT_CENTER : fw << "LEFT_CENTER" << std::endl; break;
|
||||
case osgText::Text::LEFT_BOTTOM : fw << "LEFT_BOTTOM" << std::endl; break;
|
||||
|
||||
case osgText::Text::CENTER_TOP: fw << "CENTER_TOP" << std::endl; break;
|
||||
case osgText::Text::CENTER_CENTER: fw << "CENTER_CENTER" << std::endl; break;
|
||||
case osgText::Text::CENTER_BOTTOM: fw << "CENTER_BOTTOM" << std::endl; break;
|
||||
|
||||
case osgText::Text::RIGHT_TOP: fw << "RIGHT_TOP" << std::endl; break;
|
||||
case osgText::Text::RIGHT_CENTER: fw << "RIGHT_CENTER" << std::endl; break;
|
||||
case osgText::Text::RIGHT_BOTTOM: fw << "RIGHT_BOTTOM" << std::endl; break;
|
||||
|
||||
case osgText::Text::LEFT_BASE_LINE: fw << "LEFT_BASE_LINE" << std::endl; break;
|
||||
case osgText::Text::CENTER_BASE_LINE:fw << "CENTER_BASE_LINE" << std::endl; break;
|
||||
case osgText::Text::RIGHT_BASE_LINE: fw << "RIGHT_BASE_LINE" << std::endl; break;
|
||||
|
||||
case osgText::Text::LEFT_BOTTOM_BASE_LINE: fw << "LEFT_BOTTOM_BASE_LINE" << std::endl; break;
|
||||
case osgText::Text::CENTER_BOTTOM_BASE_LINE:fw << "CENTER_BOTTOM_BASE_LINE" << std::endl; break;
|
||||
case osgText::Text::RIGHT_BOTTOM_BASE_LINE: fw << "RIGHT_BOTTOM_BASE_LINE" << std::endl; break;
|
||||
};
|
||||
|
||||
|
||||
if (!text.getRotation().zeroRotation())
|
||||
{
|
||||
fw.indent() << "rotation " << text.getRotation() << std::endl;
|
||||
}
|
||||
|
||||
if (text.getAutoRotateToScreen())
|
||||
{
|
||||
fw.indent() << "autoRotateToScreen TRUE"<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
// layout
|
||||
fw.indent() << "layout ";
|
||||
switch(text.getLayout())
|
||||
{
|
||||
case osgText::Text::LEFT_TO_RIGHT: fw << "LEFT_TO_RIGHT" << std::endl; break;
|
||||
case osgText::Text::RIGHT_TO_LEFT: fw << "RIGHT_TO_LEFT" << std::endl; break;
|
||||
case osgText::Text::VERTICAL: fw << "VERTICAL" << std::endl; break;
|
||||
};
|
||||
|
||||
|
||||
// position
|
||||
osg::Vec3 p = text.getPosition();
|
||||
fw.indent() << "position " << p.x() << " " << p.y() << " " << p.z() << std::endl;
|
||||
|
||||
// color
|
||||
// osg::Vec4 c = text.getColor();
|
||||
// fw.indent() << "color " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
|
||||
|
||||
// draw mode
|
||||
fw.indent() << "drawMode " << text.getDrawMode() << std::endl;
|
||||
|
||||
// bounding box margin
|
||||
fw.indent() << "BoundingBoxMargin " << text.getBoundingBoxMargin() << std::endl;
|
||||
|
||||
// bounding box color
|
||||
osg::Vec4 bbc = text.getBoundingBoxColor();
|
||||
fw.indent() << "BoundingBoxColor " << bbc.x() << " " << bbc.y() << " " << bbc.z() << " " << bbc.w() << std::endl;
|
||||
|
||||
// text
|
||||
const osgText::String& textstring = text.getText();
|
||||
bool isACString = true;
|
||||
osgText::String::const_iterator itr;
|
||||
for(itr=textstring.begin();
|
||||
itr!=textstring.end() && isACString;
|
||||
++itr)
|
||||
{
|
||||
if (*itr==0 || *itr>256) isACString=false;
|
||||
}
|
||||
if (isACString)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
for(itr=textstring.begin();
|
||||
itr!=textstring.end();
|
||||
++itr)
|
||||
{
|
||||
str += (char)(*itr);
|
||||
}
|
||||
|
||||
//std::copy(textstring.begin(),textstring.end(),std::back_inserter(str));
|
||||
|
||||
fw.indent() << "text " << fw.wrapString(str) << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do it the hardway...output each character as an int
|
||||
fw.indent() << "text "<<textstring.size()<<std::endl;;
|
||||
osgDB::writeArray(fw,textstring.begin(),textstring.end());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
10
src/osgWrappers/deprecated-dotosg/osgViewer/CMakeLists.txt
Normal file
10
src/osgWrappers/deprecated-dotosg/osgViewer/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
SET(TARGET_SRC
|
||||
View.cpp
|
||||
Viewer.cpp
|
||||
CompositeViewer.cpp
|
||||
)
|
||||
SET(TARGET_ADDED_LIBRARIES osgViewer )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgviewer)
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgViewer/CompositeViewer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool CompositeViewer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool CompositeViewer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy CompositeViewer_Proxy
|
||||
(
|
||||
new osgViewer::CompositeViewer,
|
||||
"CompositeViewer",
|
||||
"Object CompositeViewer",
|
||||
CompositeViewer_readLocalData,
|
||||
CompositeViewer_writeLocalData
|
||||
);
|
||||
|
||||
bool CompositeViewer_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/)
|
||||
{
|
||||
// osgViewer::CompositeViewer* compositeViewer = dynamic_cast<osgViewer::CompositeViewer*>(&obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"CompositeViewer_readLocalData"<<std::endl;
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeViewer_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
// const osgViewer::CompositeViewer* compositeViewer = dynamic_cast<const osgViewer::CompositeViewer*>(&obj);
|
||||
|
||||
osg::notify(osg::NOTICE)<<"CompositeViewer_writeLocalData"<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
292
src/osgWrappers/deprecated-dotosg/osgViewer/View.cpp
Normal file
292
src/osgWrappers/deprecated-dotosg/osgViewer/View.cpp
Normal file
@@ -0,0 +1,292 @@
|
||||
#include <osgViewer/View>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool View_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy View_Proxy
|
||||
(
|
||||
new osgViewer::View,
|
||||
"View",
|
||||
"Object View",
|
||||
View_readLocalData,
|
||||
View_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
static bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
if (fr[0].matchWord(keyword) && fr[1].isOpenBracket())
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
int row=0;
|
||||
int col=0;
|
||||
double v;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
if (fr[0].getFloat(v))
|
||||
{
|
||||
matrix(row,col)=v;
|
||||
++col;
|
||||
if (col>=4)
|
||||
{
|
||||
col = 0;
|
||||
++row;
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
else fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool writeMatrix(const osg::Matrix& matrix, osgDB::Output& fw, const char* keyword)
|
||||
{
|
||||
fw.indent() << keyword <<" {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
|
||||
fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
|
||||
fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
|
||||
fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
osg::Image* readIntensityImage(osgDB::Input& fr, bool& itrAdvanced)
|
||||
{
|
||||
if (fr.matchSequence("intensityMap {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
|
||||
typedef std::map<float,float> IntensityMap;
|
||||
IntensityMap intensityMap;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
float position, intensity;
|
||||
if (fr.read(position,intensity))
|
||||
{
|
||||
intensityMap[position] = intensity;
|
||||
}
|
||||
else
|
||||
{
|
||||
++fr;
|
||||
}
|
||||
}
|
||||
++fr;
|
||||
|
||||
itrAdvanced = true;
|
||||
|
||||
if (!intensityMap.empty())
|
||||
{
|
||||
unsigned int numPixels = 256;
|
||||
|
||||
osg::Image* image = new osg::Image;
|
||||
image->allocateImage(1,numPixels,1,GL_LUMINANCE,GL_FLOAT);
|
||||
|
||||
float intensityMultiplier = 0.01f;
|
||||
float* ptr = reinterpret_cast<float*>(image->data());
|
||||
for(unsigned int i=0; i<numPixels; ++i)
|
||||
{
|
||||
float position = (1.0f - float(i)/float(numPixels-1)) * 180.0f;
|
||||
float intensity = 1.0f;
|
||||
if (position <= intensityMap.begin()->first)
|
||||
{
|
||||
intensity = intensityMap.begin()->second * intensityMultiplier;
|
||||
}
|
||||
else if (position>=intensityMap.rbegin()->first)
|
||||
{
|
||||
intensity = intensityMap.rbegin()->second * intensityMultiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
IntensityMap::iterator above_itr = intensityMap.lower_bound(position);
|
||||
if (above_itr != intensityMap.begin())
|
||||
{
|
||||
IntensityMap::iterator below_itr = above_itr;
|
||||
--below_itr;
|
||||
float r = (position - below_itr->first) / (above_itr->first - below_itr->first);
|
||||
intensity = (below_itr->second + (above_itr->second - below_itr->second) * r) * intensityMultiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
intensity = above_itr->second * intensityMultiplier;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*ptr++ = intensity;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool View_readLocalData(osg::Object &obj, osgDB::Input &fr)
|
||||
{
|
||||
osgViewer::View& view = dynamic_cast<osgViewer::View&>(obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
bool matchedFirst = false;
|
||||
if ((matchedFirst = fr.matchSequence("setUpViewFor3DSphericalDisplay {")) ||
|
||||
fr.matchSequence("setUpViewForPanoramicSphericalDisplay {"))
|
||||
{
|
||||
double radius = 1.0;
|
||||
double collar = 0.45;
|
||||
unsigned int screenNum = 0;
|
||||
unsigned int intensityFormat = 8;
|
||||
osg::Matrix matrix;
|
||||
std::string filename;
|
||||
osg::ref_ptr<osg::Image> intensityMap;
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool local_itrAdvanced = false;
|
||||
if (fr.read("radius",radius)) local_itrAdvanced = true;
|
||||
if (fr.read("collar",collar)) local_itrAdvanced = true;
|
||||
if (fr.read("screenNum",screenNum)) local_itrAdvanced = true;
|
||||
if (fr.read("intensityFile",filename)) local_itrAdvanced = true;
|
||||
if (fr.matchSequence("intensityMap {")) intensityMap = readIntensityImage(fr,local_itrAdvanced);
|
||||
if (fr.read("intensityFormat",intensityFormat)) local_itrAdvanced = true;
|
||||
if (readMatrix(matrix,fr,"projectorMatrix")) local_itrAdvanced = true;
|
||||
|
||||
if (!local_itrAdvanced) ++fr;
|
||||
}
|
||||
|
||||
// skip trailing '}'
|
||||
++fr;
|
||||
|
||||
iteratorAdvanced = true;
|
||||
|
||||
if (!filename.empty())
|
||||
{
|
||||
intensityMap = osgDB::readRefImageFile(filename);
|
||||
}
|
||||
|
||||
if (intensityMap.valid())
|
||||
{
|
||||
if (intensityFormat==16) intensityMap->setInternalTextureFormat(GL_LUMINANCE16F_ARB);
|
||||
else if (intensityFormat==32) intensityMap->setInternalTextureFormat(GL_LUMINANCE32F_ARB);
|
||||
// else intensityMap->setInternalTextureFormat(image->getPixelFormat());
|
||||
}
|
||||
|
||||
|
||||
if (matchedFirst) view.setUpViewFor3DSphericalDisplay(radius, collar, screenNum, intensityMap.get(), matrix);
|
||||
else view.setUpViewForPanoramicSphericalDisplay(radius, collar, screenNum, intensityMap.get(), matrix);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 128;
|
||||
int height = 1024;
|
||||
unsigned int screenNum = 0;
|
||||
|
||||
if (fr.read("setUpViewOnSingleScreen",screenNum))
|
||||
{
|
||||
view.setUpViewOnSingleScreen(screenNum);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.read("setUpViewAcrossAllScreens"))
|
||||
{
|
||||
view.setUpViewAcrossAllScreens();
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.read("setUpViewInWindow",x,y,width,height,screenNum))
|
||||
{
|
||||
view.setUpViewInWindow(x, y, width, height, screenNum);
|
||||
}
|
||||
|
||||
if (fr.read("setUpViewInWindow",x,y,width,height))
|
||||
{
|
||||
view.setUpViewInWindow(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject;
|
||||
while((readObject=fr.readObjectOfType(osgDB::type_wrapper<osg::Camera>())).valid())
|
||||
{
|
||||
view.setCamera(static_cast<osg::Camera*>(readObject.get()));
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Slaves {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::Camera>());
|
||||
if (readObject.valid()) view.addSlave(static_cast<osg::Camera*>(readObject.get()));
|
||||
else ++fr;
|
||||
}
|
||||
|
||||
// skip trailing '}'
|
||||
++fr;
|
||||
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool View_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
|
||||
{
|
||||
const osgViewer::View& view = dynamic_cast<const osgViewer::View&>(obj);
|
||||
|
||||
osg::notify(osg::NOTICE)<<"View_writeLocalData"<<std::endl;
|
||||
|
||||
if (view.getCamera())
|
||||
{
|
||||
fw.writeObject(*view.getCamera());
|
||||
}
|
||||
|
||||
if (view.getNumSlaves() != 0)
|
||||
{
|
||||
fw.indent()<<"Slaves {"<<std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
for(unsigned int i=0; i<view.getNumSlaves(); ++i)
|
||||
{
|
||||
const osg::Camera* camera = view.getSlave(i)._camera.get();
|
||||
if (camera)
|
||||
{
|
||||
fw.writeObject(*camera);
|
||||
}
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
35
src/osgWrappers/deprecated-dotosg/osgViewer/Viewer.cpp
Normal file
35
src/osgWrappers/deprecated-dotosg/osgViewer/Viewer.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Viewer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Viewer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Viewer_Proxy
|
||||
(
|
||||
new osgViewer::Viewer,
|
||||
"Viewer",
|
||||
"Object Viewer View",
|
||||
Viewer_readLocalData,
|
||||
Viewer_writeLocalData
|
||||
);
|
||||
|
||||
bool Viewer_readLocalData(osg::Object& /*obj*/, osgDB::Input& /*fr*/)
|
||||
{
|
||||
// osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool Viewer_writeLocalData(const osg::Object& /*obj*/, osgDB::Output& /*fw*/)
|
||||
{
|
||||
// const osgViewer::Viewer* viewer = dynamic_cast<const osgViewer::Viewer*>(&obj);
|
||||
return true;
|
||||
}
|
||||
22
src/osgWrappers/deprecated-dotosg/osgVolume/CMakeLists.txt
Normal file
22
src/osgWrappers/deprecated-dotosg/osgVolume/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
SET(TARGET_SRC
|
||||
Locator.cpp
|
||||
ImageLayer.cpp
|
||||
Layer.cpp
|
||||
Volume.cpp
|
||||
VolumeTile.cpp
|
||||
RayTracedTechnique.cpp
|
||||
FixedFunctionTechnique.cpp
|
||||
Property.cpp
|
||||
CompositeProperty.cpp
|
||||
SwitchProperty.cpp
|
||||
ScalarProperty.cpp
|
||||
TransferFunctionProperty.cpp
|
||||
PropertyAdjustmentCallback.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgVolume )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgvolume)
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool CompositeProperty_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool CompositeProperty_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy CompositeProperty_Proxy
|
||||
(
|
||||
new osgVolume::CompositeProperty,
|
||||
"CompositeProperty",
|
||||
"Object CompositeProperty",
|
||||
CompositeProperty_readLocalData,
|
||||
CompositeProperty_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool CompositeProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::CompositeProperty& cp = static_cast<osgVolume::CompositeProperty&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject;
|
||||
do
|
||||
{
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Property>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgVolume::Property* property = dynamic_cast<osgVolume::Property*>(readObject.get());
|
||||
if (property) cp.addProperty(property);
|
||||
|
||||
} while (readObject.valid());
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::CompositeProperty& cp = static_cast<const osgVolume::CompositeProperty&>(obj);
|
||||
|
||||
|
||||
for(unsigned int i=0; i<cp.getNumProperties(); ++i)
|
||||
{
|
||||
fw.writeObject(*cp.getProperty(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgVolume/FixedFunctionTechnique>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool FixedFunctionTechnique_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool FixedFunctionTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy FixedFunctionTechnique_Proxy
|
||||
(
|
||||
new osgVolume::FixedFunctionTechnique,
|
||||
"FixedFunctionTechnique",
|
||||
"FixedFunctionTechnique Object",
|
||||
FixedFunctionTechnique_readLocalData,
|
||||
FixedFunctionTechnique_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool FixedFunctionTechnique_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
//osgVolume::FixedFunctionTechnique& fft = static_cast<osgVolume::FixedFunctionTechnique&>(obj);
|
||||
bool itrAdvanced = false;
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool FixedFunctionTechnique_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
//const osgVolume::FixedFunctionTechnique& fft = static_cast<const osgVolume::FixedFunctionTechnique&>(obj);
|
||||
return true;
|
||||
}
|
||||
111
src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp
Normal file
111
src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
#include <osgVolume/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
bool ImageLayer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ImageLayer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ImageLayer_Proxy
|
||||
(
|
||||
new osgVolume::ImageLayer,
|
||||
"ImageLayer",
|
||||
"Object Layer ImageLayer",
|
||||
ImageLayer_readLocalData,
|
||||
ImageLayer_writeLocalData
|
||||
);
|
||||
|
||||
bool ImageLayer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::ImageLayer& layer = static_cast<osgVolume::ImageLayer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("file %w") || fr.matchSequence("file %s"))
|
||||
{
|
||||
std::string filename = fr[1].getStr();
|
||||
if (!filename.empty())
|
||||
{
|
||||
bool deferExternalLayerLoading = false;
|
||||
|
||||
layer.setFileName(filename);
|
||||
|
||||
if (!deferExternalLayerLoading)
|
||||
{
|
||||
|
||||
osgDB::FileType fileType = osgDB::fileType(filename);
|
||||
if (fileType == osgDB::FILE_NOT_FOUND)
|
||||
{
|
||||
filename = osgDB::findDataFile(filename, fr.getOptions());
|
||||
fileType = osgDB::fileType(filename);
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Image> image;
|
||||
if (fileType == osgDB::DIRECTORY)
|
||||
{
|
||||
image = osgDB::readRefImageFile(filename+".dicom");
|
||||
|
||||
}
|
||||
else if (fileType == osgDB::REGULAR_FILE)
|
||||
{
|
||||
image = osgDB::readRefImageFile( filename );
|
||||
}
|
||||
|
||||
|
||||
if (image.valid())
|
||||
{
|
||||
osg::notify(osg::INFO)<<"osgVolume::ImageLayer image read: "<<filename<<" pixelFormat "<<std::hex<<image->getPixelFormat()<<" textureFormat "<<image->getInternalTextureFormat()<<" dataType "<<image->getDataType()<<std::dec<<std::endl;
|
||||
|
||||
osg::ref_ptr<osgVolume::ImageDetails> details = dynamic_cast<osgVolume::ImageDetails*>(image->getUserData());
|
||||
osg::ref_ptr<osg::RefMatrix> matrix = details ? details->getMatrix() : dynamic_cast<osg::RefMatrix*>(image->getUserData());
|
||||
|
||||
layer.setImage(image.get());
|
||||
|
||||
if (details)
|
||||
{
|
||||
layer.setTexelOffset(details->getTexelOffset());
|
||||
layer.setTexelScale(details->getTexelScale());
|
||||
}
|
||||
if (matrix)
|
||||
{
|
||||
layer.setLocator(new osgVolume::Locator(*matrix));
|
||||
}
|
||||
|
||||
layer.rescaleToZeroToOneRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool ImageLayer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::ImageLayer& layer = static_cast<const osgVolume::ImageLayer&>(obj);
|
||||
|
||||
if (!layer.getFileName().empty())
|
||||
{
|
||||
fw.indent()<<"file "<< layer.getFileName() << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
67
src/osgWrappers/deprecated-dotosg/osgVolume/Layer.cpp
Normal file
67
src/osgWrappers/deprecated-dotosg/osgVolume/Layer.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <osgVolume/Layer>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
bool Layer_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Layer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
bool Layer_matchFilterStr(const char* str, osg::Texture::FilterMode& filter);
|
||||
const char* Layer_getFilterStr(osg::Texture::FilterMode filter);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Layer_Proxy
|
||||
(
|
||||
new osgVolume::Layer,
|
||||
"Layer",
|
||||
"Object Layer",
|
||||
Layer_readLocalData,
|
||||
Layer_writeLocalData
|
||||
);
|
||||
|
||||
bool Layer_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::Layer& layer = static_cast<osgVolume::Layer&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Locator>());
|
||||
osgVolume::Locator* locator = dynamic_cast<osgVolume::Locator*>(readObject.get());
|
||||
if (locator) layer.setLocator(locator);
|
||||
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Property>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgVolume::Property* property = dynamic_cast<osgVolume::Property*>(readObject.get());
|
||||
if (property) layer.addProperty(property);
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Layer_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::Layer& layer = static_cast<const osgVolume::Layer&>(obj);
|
||||
|
||||
if (layer.getLocator())
|
||||
{
|
||||
fw.writeObject(*layer.getLocator());
|
||||
}
|
||||
|
||||
if (layer.getProperty())
|
||||
{
|
||||
fw.writeObject(*layer.getProperty());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
85
src/osgWrappers/deprecated-dotosg/osgVolume/Locator.cpp
Normal file
85
src/osgWrappers/deprecated-dotosg/osgVolume/Locator.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Locator_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Locator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Locator_Proxy
|
||||
(
|
||||
new osgVolume::Locator,
|
||||
"Locator",
|
||||
"Object Locator",
|
||||
Locator_readLocalData,
|
||||
Locator_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool Locator_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::Locator& locator = static_cast<osgVolume::Locator&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("Transform {"))
|
||||
{
|
||||
int tansform_entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
|
||||
int row=0;
|
||||
int col=0;
|
||||
double v;
|
||||
osg::Matrixd matrix;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>tansform_entry)
|
||||
{
|
||||
if (fr[0].getFloat(v))
|
||||
{
|
||||
matrix(row,col)=v;
|
||||
++col;
|
||||
if (col>=4)
|
||||
{
|
||||
col = 0;
|
||||
++row;
|
||||
}
|
||||
++fr;
|
||||
}
|
||||
else fr.advanceOverCurrentFieldOrBlock();
|
||||
}
|
||||
|
||||
locator.setTransform(matrix);
|
||||
|
||||
++fr;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Locator_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::Locator& locator = static_cast<const osgVolume::Locator&>(obj);
|
||||
|
||||
const osg::Matrixd& matrix = locator.getTransform();
|
||||
fw.indent() << "Transform {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl;
|
||||
fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl;
|
||||
fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl;
|
||||
fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl;
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
54
src/osgWrappers/deprecated-dotosg/osgVolume/Property.cpp
Normal file
54
src/osgWrappers/deprecated-dotosg/osgVolume/Property.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Property_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Property_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Property_Proxy
|
||||
(
|
||||
new osgVolume::Property,
|
||||
"Property",
|
||||
"Object Property",
|
||||
Property_readLocalData,
|
||||
Property_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy MaximumImageProjectionProperty_Proxy
|
||||
(
|
||||
new osgVolume::MaximumIntensityProjectionProperty,
|
||||
"MaximumIntensityProjectionProperty",
|
||||
"Object MaximumIntensityProjectionProperty",
|
||||
Property_readLocalData,
|
||||
Property_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy LightingProperty_Proxy
|
||||
(
|
||||
new osgVolume::LightingProperty,
|
||||
"LightingProperty",
|
||||
"Object LightingProperty",
|
||||
Property_readLocalData,
|
||||
Property_writeLocalData
|
||||
);
|
||||
|
||||
bool Property_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Property_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool PropertyAdjustmentCallback_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool PropertyAdjustmentCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy PropertyAdjustmentCallback_Proxy
|
||||
(
|
||||
new osgVolume::PropertyAdjustmentCallback,
|
||||
"PropertyAdjustmentCallback",
|
||||
"Object NodeCallback PropertyAdjustmentCallback",
|
||||
PropertyAdjustmentCallback_readLocalData,
|
||||
PropertyAdjustmentCallback_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool PropertyAdjustmentCallback_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PropertyAdjustmentCallback_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#include <osgVolume/RayTracedTechnique>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool RayTracedTechnique_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool RayTracedTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy RayTracedTechnique_Proxy
|
||||
(
|
||||
new osgVolume::RayTracedTechnique,
|
||||
"RayTracedTechnique",
|
||||
"RayTracedTechnique Object",
|
||||
RayTracedTechnique_readLocalData,
|
||||
RayTracedTechnique_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool RayTracedTechnique_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
//osgVolume::RayTracedTechnique& st = static_cast<osgVolume::RayTracedTechnique&>(obj);
|
||||
bool itrAdvanced = false;
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool RayTracedTechnique_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
//const osgVolume::RayTracedTechnique& st = static_cast<const osgVolume::RayTracedTechnique&>(obj);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool ScalarProperty_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool ScalarProperty_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy ScalarProperty_Proxy
|
||||
(
|
||||
0,
|
||||
"ScalarProperty",
|
||||
"Object ScalarProperty",
|
||||
ScalarProperty_readLocalData,
|
||||
ScalarProperty_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy IsoSurfaceProperty_Proxy
|
||||
(
|
||||
new osgVolume::IsoSurfaceProperty,
|
||||
"IsoSurfaceProperty",
|
||||
"Object ScalarProperty",
|
||||
ScalarProperty_readLocalData,
|
||||
ScalarProperty_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy AlphaFuncProperty_Proxy
|
||||
(
|
||||
new osgVolume::AlphaFuncProperty,
|
||||
"AlphaFuncProperty",
|
||||
"Object AlphaFuncProperty",
|
||||
ScalarProperty_readLocalData,
|
||||
ScalarProperty_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SampleDensityProperty_Proxy
|
||||
(
|
||||
new osgVolume::SampleDensityProperty,
|
||||
"SampleDensityProperty",
|
||||
"Object SampleDensityProperty",
|
||||
ScalarProperty_readLocalData,
|
||||
ScalarProperty_writeLocalData
|
||||
);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy TransparencyProperty_Proxy
|
||||
(
|
||||
new osgVolume::TransparencyProperty,
|
||||
"TransparencyProperty",
|
||||
"Object TransparencyProperty",
|
||||
ScalarProperty_readLocalData,
|
||||
ScalarProperty_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
|
||||
bool ScalarProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::ScalarProperty& sp = static_cast<osgVolume::ScalarProperty&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
float value=0;
|
||||
if (fr.read("value",value))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
sp.setValue(value);
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool ScalarProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::ScalarProperty& sp = static_cast<const osgVolume::ScalarProperty&>(obj);
|
||||
|
||||
fw.indent()<<"value "<<sp.getValue()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool SwitchProperty_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool SwitchProperty_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy SwitchProperty_Proxy
|
||||
(
|
||||
new osgVolume::SwitchProperty,
|
||||
"SwitchProperty",
|
||||
"Object SwitchProperty CompositeProperty",
|
||||
SwitchProperty_readLocalData,
|
||||
SwitchProperty_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool SwitchProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::SwitchProperty& sp = static_cast<osgVolume::SwitchProperty&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
int value=0;
|
||||
if (fr.read("activeProperty",value))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
sp.setActiveProperty(value);
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool SwitchProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::SwitchProperty& sp = static_cast<const osgVolume::SwitchProperty&>(obj);
|
||||
|
||||
fw.indent()<<"activeProperty "<<sp.getActiveProperty()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <osgVolume/Property>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool TransferFunctionProperty_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool TransferFunctionProperty_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy TransferFunctionProperty_Proxy
|
||||
(
|
||||
new osgVolume::TransferFunctionProperty,
|
||||
"TransferFunctionProperty",
|
||||
"Object TransferFunctionProperty",
|
||||
TransferFunctionProperty_readLocalData,
|
||||
TransferFunctionProperty_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool TransferFunctionProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::TransferFunctionProperty& tfp = static_cast<osgVolume::TransferFunctionProperty&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::TransferFunction>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osg::TransferFunction* tf = dynamic_cast<osg::TransferFunction*>(readObject.get());
|
||||
if (tf) tfp.setTransferFunction(tf);
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool TransferFunctionProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::TransferFunctionProperty& tfp = static_cast<const osgVolume::TransferFunctionProperty&>(obj);
|
||||
|
||||
const osg::TransferFunction* tf = tfp.getTransferFunction();
|
||||
if (tf) fw.writeObject(*tf);
|
||||
|
||||
return true;
|
||||
}
|
||||
56
src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp
Normal file
56
src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <osgVolume/Volume>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Volume_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Volume_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Volume_Proxy
|
||||
(
|
||||
new osgVolume::Volume,
|
||||
"Volume",
|
||||
"Object Node Volume Group",
|
||||
Volume_readLocalData,
|
||||
Volume_writeLocalData
|
||||
);
|
||||
|
||||
bool Volume_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::Volume& volume = static_cast<osgVolume::Volume&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::VolumeTechnique>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
volume.setVolumeTechniquePrototype(dynamic_cast<osgVolume::VolumeTechnique*>(readObject.get()));
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Volume_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::Volume& volume = static_cast<const osgVolume::Volume&>(obj);
|
||||
|
||||
osg::notify(osg::NOTICE)<<"Volume write"<<std::endl;
|
||||
|
||||
if (volume.getVolumeTechniquePrototype())
|
||||
{
|
||||
fw.writeObject(*volume.getVolumeTechniquePrototype());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
83
src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp
Normal file
83
src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool VolumeTile_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool VolumeTile_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy VolumeTile_Proxy
|
||||
(
|
||||
new osgVolume::VolumeTile,
|
||||
"VolumeTile",
|
||||
"Object Node VolumeTile Group",
|
||||
VolumeTile_readLocalData,
|
||||
VolumeTile_writeLocalData
|
||||
);
|
||||
|
||||
bool VolumeTile_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::VolumeTile& volumeTile = static_cast<osgVolume::VolumeTile&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Locator>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgVolume::Locator* locator = dynamic_cast<osgVolume::Locator*>(readObject.get());
|
||||
if (locator) volumeTile.setLocator(locator);
|
||||
|
||||
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::Layer>());
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgVolume::Layer* readLayer = dynamic_cast<osgVolume::Layer*>(readObject.get());
|
||||
if (readLayer) volumeTile.setLayer(readLayer);
|
||||
|
||||
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::VolumeTechnique>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
volumeTile.setVolumeTechnique(dynamic_cast<osgVolume::VolumeTechnique*>(readObject.get()));
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool VolumeTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::VolumeTile& volumeTile = static_cast<const osgVolume::VolumeTile&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
|
||||
if (volumeTile.getLocator())
|
||||
{
|
||||
fw.writeObject(*volumeTile.getLocator());
|
||||
}
|
||||
|
||||
if (volumeTile.getLayer())
|
||||
{
|
||||
fw.writeObject(*volumeTile.getLayer());
|
||||
}
|
||||
|
||||
if (volumeTile.getVolumeTechnique())
|
||||
{
|
||||
fw.writeObject(*volumeTile.getVolumeTechnique());
|
||||
}
|
||||
|
||||
fw.precision(prec);
|
||||
|
||||
return true;
|
||||
}
|
||||
115
src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp
Normal file
115
src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: Box.cpp 50 2008-05-06 05:06:36Z cubicool $
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgWidget/Box>
|
||||
|
||||
bool osgWidget_Box_readData(osg::Object& /*obj*/, osgDB::Input& fr)
|
||||
{
|
||||
/*
|
||||
osgWidget::Box& box = static_cast<osgWidgegt::Box&>(obj);
|
||||
|
||||
if(fr[0].matchWord("skeleton") and fr[1].isString()) iter = loadFile(
|
||||
"skeleton",
|
||||
&osgCal::osgWidget_Box::loadSkeleton,
|
||||
model,
|
||||
fr
|
||||
);
|
||||
|
||||
if(fr[0].matchWord("animation") and fr[1].isString()) iter = loadFile(
|
||||
"animation",
|
||||
&osgCal::osgWidget_Box::loadAnimation,
|
||||
model,
|
||||
fr
|
||||
);
|
||||
|
||||
if(fr[0].matchWord("mesh") and fr[1].isString()) iter = loadFile(
|
||||
"mesh",
|
||||
&osgCal::osgWidget_Box::loadMesh,
|
||||
model,
|
||||
fr
|
||||
);
|
||||
|
||||
if(fr[0].matchWord("material") and fr[1].isString()) iter = loadFile(
|
||||
"material",
|
||||
&osgCal::osgWidget_Box::loadMaterial,
|
||||
model,
|
||||
fr
|
||||
);
|
||||
*/
|
||||
|
||||
osgWidget::warn() << "Box read" << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool osgWidget_Box_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
|
||||
{
|
||||
// const osgWidget::Box& model = static_cast<const osgWidget::Box&>(obj);
|
||||
|
||||
fw.indent() << fw.wrapString("Box stuff...") << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool Model_readData(osg::Object& obj, osgDB::Input& fr) {
|
||||
bool iter = false;
|
||||
|
||||
osgCal::Model& model = static_cast<osgCal::Model&>(obj);
|
||||
osgCal::osgWidget_Box* core = static_cast<osgCal::osgWidget_Box*>(
|
||||
fr.readObjectOfType(osgCal::osgWidget_Box("dummy"))
|
||||
);
|
||||
|
||||
if(core) {
|
||||
model.create(core);
|
||||
|
||||
iter = true;
|
||||
}
|
||||
|
||||
if(fr.matchSequence("StartAnimation")) {
|
||||
if(fr[1].isString()) {
|
||||
int animation = core->getAnimationId(fr[1].getStr());
|
||||
|
||||
if(animation >= 0) model.startLoop(animation, 1.0f, 0.0f);
|
||||
|
||||
else osg::notify(osg::WARN)
|
||||
<< "Couldn't start animation: " << fr[1].getStr()
|
||||
<< std::endl
|
||||
;
|
||||
|
||||
iter = true;
|
||||
fr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
bool Model_writeData(const osg::Object& obj, osgDB::Output& fw) {
|
||||
const osgCal::Model& model = static_cast<const osgCal::Model&>(obj);
|
||||
|
||||
fw.writeObject(*model.getosgWidget_Box());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_ModelProxy(
|
||||
new osgCal::Model,
|
||||
"Model",
|
||||
"Object Node Model",
|
||||
&Model_readData,
|
||||
&Model_writeData
|
||||
);
|
||||
*/
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_osgWidget_BoxProxy(
|
||||
new osgWidget::Box("unset"),
|
||||
"osgWidget::Box",
|
||||
"Object Node Group Transform MatrixTransform osgWidget::Box",
|
||||
&osgWidget_Box_readData,
|
||||
&osgWidget_Box_writeData
|
||||
);
|
||||
16
src/osgWrappers/deprecated-dotosg/osgWidget/CMakeLists.txt
Normal file
16
src/osgWrappers/deprecated-dotosg/osgWidget/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
SET(TARGET_SRC
|
||||
Box.cpp
|
||||
EmbeddedWindow.cpp
|
||||
Frame.cpp
|
||||
Input.cpp
|
||||
Label.cpp
|
||||
Table.cpp
|
||||
Widget.cpp
|
||||
WindowManager.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgwidget)
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: EmbeddedWindow.cpp 50 2008-05-06 05:06:36Z cubicool $
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgWidget/Window>
|
||||
|
||||
bool osgWidget_EmbeddedWindow_readData(osg::Object& /*obj*/, osgDB::Input& fr)
|
||||
{
|
||||
osgWidget::warn() << "EmbeddedWindow read" << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool osgWidget_EmbeddedWindow_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
|
||||
{
|
||||
// const osgWidget::Window::EmbeddedWindow& model = static_cast<const osgWidget::Window::EmbeddedWindow&>(obj);
|
||||
|
||||
fw.indent() << fw.wrapString("EmbeddedWindow stuff...") << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_osgWidget_EmbeddedWindowProxy(
|
||||
new osgWidget::Window::EmbeddedWindow("unset"),
|
||||
"osgWidget::Window::EmbeddedWindow",
|
||||
"Object Drawable Geometry osgWidget::Widget osgWidget::Window::EmbeddedWindow",
|
||||
&osgWidget_EmbeddedWindow_readData,
|
||||
&osgWidget_EmbeddedWindow_writeData
|
||||
);
|
||||
32
src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp
Normal file
32
src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: Frame.cpp 50 2008-05-06 05:06:36Z cubicool $
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgWidget/Frame>
|
||||
|
||||
bool osgWidget_Frame_readData(osg::Object& /*obj*/, osgDB::Input& fr)
|
||||
{
|
||||
osgWidget::warn() << "Frame read" << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool osgWidget_Frame_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
|
||||
{
|
||||
// const osgWidget::Frame& model = static_cast<const osgWidget::Frame&>(obj);
|
||||
|
||||
fw.indent() << fw.wrapString("Frame stuff...") << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_osgWidget_FrameProxy(
|
||||
new osgWidget::Frame("unset"),
|
||||
"osgWidget::Frame",
|
||||
"Object Node Group Transform MatrixTransform osgWidget::Table osgWidget::Frame",
|
||||
&osgWidget_Frame_readData,
|
||||
&osgWidget_Frame_writeData
|
||||
);
|
||||
32
src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp
Normal file
32
src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: Input.cpp 50 2008-05-06 05:06:36Z cubicool $
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgWidget/Input>
|
||||
|
||||
bool osgWidget_Input_readData(osg::Object& /*obj*/, osgDB::Input& fr)
|
||||
{
|
||||
osgWidget::warn() << "Input read" << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool osgWidget_Input_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
|
||||
{
|
||||
// const osgWidget::Input& model = static_cast<const osgWidget::Input&>(obj);
|
||||
|
||||
fw.indent() << fw.wrapString("Input stuff...") << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_osgWidget_InputProxy(
|
||||
new osgWidget::Input("unset"),
|
||||
"osgWidget::Input",
|
||||
"Object Drawable Geometry osgWidget::Widget osgWidget::Input",
|
||||
&osgWidget_Input_readData,
|
||||
&osgWidget_Input_writeData
|
||||
);
|
||||
32
src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp
Normal file
32
src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// -*-c++-*- osgWidget - Code by: Jeremy Moles (cubicool) 2007-2008
|
||||
// $Id: Label.cpp 50 2008-05-06 05:06:36Z cubicool $
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgWidget/Label>
|
||||
|
||||
bool osgWidget_Label_readData(osg::Object& /*obj*/, osgDB::Input& fr)
|
||||
{
|
||||
osgWidget::warn() << "Label read" << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool osgWidget_Label_writeData(const osg::Object& /*obj*/, osgDB::Output& fw)
|
||||
{
|
||||
// const osgWidget::Label& model = static_cast<const osgWidget::Label&>(obj);
|
||||
|
||||
fw.indent() << fw.wrapString("Label stuff...") << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy g_osgWidget_LabelProxy(
|
||||
new osgWidget::Label("unset"),
|
||||
"osgWidget::Label",
|
||||
"Object Drawable Geometry osgWidget::Widget osgWidget::Label",
|
||||
&osgWidget_Label_readData,
|
||||
&osgWidget_Label_writeData
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user