Added missing osgFX files.
This commit is contained in:
18
src/osgPlugins/osgFX/GNUmakefile
Normal file
18
src/osgPlugins/osgFX/GNUmakefile
Normal file
@@ -0,0 +1,18 @@
|
||||
TOPDIR = ../../..
|
||||
include $(TOPDIR)/Make/makedefs
|
||||
|
||||
CXXFILES =\
|
||||
IO_AnisotropicLighting.cpp\
|
||||
IO_Cartoon.cpp\
|
||||
IO_Scribe.cpp\
|
||||
IO_SpecularHighlights.cpp\
|
||||
IO_Effect.cpp\
|
||||
|
||||
|
||||
LIBS += -losgFX $(OSG_LIBS) $(OTHER_LIBS)
|
||||
|
||||
TARGET_BASENAME = osgFX
|
||||
include $(TOPDIR)/Make/cygwin_plugin_def
|
||||
PLUGIN = $(PLUGIN_PREFIX)$(TARGET_BASENAME).$(PLUGIN_EXT)
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
59
src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp
Normal file
59
src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp
Normal file
@@ -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 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;
|
||||
}
|
||||
64
src/osgPlugins/osgFX/IO_Cartoon.cpp
Normal file
64
src/osgPlugins/osgFX/IO_Cartoon.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <osgFX/Cartoon>
|
||||
|
||||
#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 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;
|
||||
}
|
||||
71
src/osgPlugins/osgFX/IO_Effect.cpp
Normal file
71
src/osgPlugins/osgFX/IO_Effect.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#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 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> node = static_cast<osg::Node *>(fr.readObjectOfType(osgDB::type_wrapper<osg::Node>()));
|
||||
if (node.valid()) {
|
||||
myobj.setChild(node.get());
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
fw.writeObject(*myobj.getChild());
|
||||
|
||||
return true;
|
||||
}
|
||||
54
src/osgPlugins/osgFX/IO_Scribe.cpp
Normal file
54
src/osgPlugins/osgFX/IO_Scribe.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include <osgFX/Scribe>
|
||||
|
||||
#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 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;
|
||||
}
|
||||
75
src/osgPlugins/osgFX/IO_SpecularHighlights.cpp
Normal file
75
src/osgPlugins/osgFX/IO_SpecularHighlights.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <osgFX/SpecularHighlights>
|
||||
|
||||
#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 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;
|
||||
}
|
||||
Reference in New Issue
Block a user