Removed pfb plugin as the Perform dependency it relies upon has long since disappeared
This commit is contained in:
@@ -139,10 +139,6 @@ IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE)
|
|||||||
IF(INVENTOR_FOUND)
|
IF(INVENTOR_FOUND)
|
||||||
ADD_SUBDIRECTORY(Inventor)
|
ADD_SUBDIRECTORY(Inventor)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(PERFORMER_FOUND)
|
|
||||||
ADD_SUBDIRECTORY(pfb)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(OPENVRML_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
|
IF(OPENVRML_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
INCLUDE_DIRECTORIES( ${PERFORMER_INCLUDE_DIR} ${PERFORMER_INCLUDE_DIR}/Performer )
|
|
||||||
|
|
||||||
SET(TARGET_SRC
|
|
||||||
ReaderWriterPFB.cpp
|
|
||||||
ConvertFromPerformer.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(TARGET_H
|
|
||||||
ConvertFromPerformer.h
|
|
||||||
)
|
|
||||||
|
|
||||||
IF(MSVC)
|
|
||||||
SET(TARGET_EXTERNAL_LIBRARIES
|
|
||||||
libpfdu-util
|
|
||||||
)
|
|
||||||
ELSE()
|
|
||||||
SET(TARGET_EXTERNAL_LIBRARIES
|
|
||||||
pfdu pfutil
|
|
||||||
)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(TARGET_LIBRARIES_VARS PERFORMER_LIBRARY )
|
|
||||||
|
|
||||||
#### end var setup ###
|
|
||||||
SETUP_PLUGIN(pfb)
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,71 +0,0 @@
|
|||||||
// -*-c++-*-
|
|
||||||
|
|
||||||
#ifndef __CONVERTFROMPERFORMER_H
|
|
||||||
#define __CONVERTFROMPERFORMER_H
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
// Open Scene Graph includes.
|
|
||||||
#include <osg/Node>
|
|
||||||
#include <osg/Group>
|
|
||||||
#include <osg/StateSet>
|
|
||||||
#include <osg/Geometry>
|
|
||||||
#include <osg/Texture2D>
|
|
||||||
#include <osg/Material>
|
|
||||||
|
|
||||||
// Performer includes.
|
|
||||||
#include <Performer/pf/pfNode.h>
|
|
||||||
|
|
||||||
class ConvertFromPerformer {
|
|
||||||
public:
|
|
||||||
|
|
||||||
ConvertFromPerformer();
|
|
||||||
~ConvertFromPerformer();
|
|
||||||
|
|
||||||
osg::Node* convert(pfNode* node);
|
|
||||||
|
|
||||||
void setSaveImageDirectory(const std::string& directory) { _saveImageDirectory = directory; }
|
|
||||||
void setSaveImagesAsRGB(bool b) { _saveImagesAsRGB=b; }
|
|
||||||
void setSaveAbsoluteImagePath(bool b) { _saveAbsoluteImagePath = b; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
osg::Object* getOsgObject(pfObject* pfObj);
|
|
||||||
void registerPfObjectForOsgObject(pfObject* pfObj,osg::Object* osgObj);
|
|
||||||
|
|
||||||
osg::Node* visitNode(osg::Group* osgParent,pfNode* node);
|
|
||||||
osg::Node* visitScene(osg::Group* osgParent,pfScene* scene);
|
|
||||||
osg::Node* visitGroup(osg::Group* osgParent,pfGroup* group);
|
|
||||||
osg::Node* visitDCS(osg::Group* osgParent,pfDCS* dcs);
|
|
||||||
osg::Node* visitLOD(osg::Group* osgParent,pfLOD* lod);
|
|
||||||
osg::Node* visitSwitch(osg::Group* osgParent,pfSwitch* switchNode);
|
|
||||||
osg::Node* visitSequence(osg::Group* osgParent,pfSequence* sequence);
|
|
||||||
osg::Node* visitSCS(osg::Group* osgParent,pfSCS* scs);
|
|
||||||
osg::Node* visitGeode(osg::Group* osgParent,pfGeode* geode);
|
|
||||||
osg::Node* visitBillboard(osg::Group* osgParent,pfBillboard* billboard);
|
|
||||||
|
|
||||||
int getNumVerts(pfGeoSet *gset);
|
|
||||||
osg::Drawable* visitGeoSet(osg::Geode* osgParent,pfGeoSet* geoset);
|
|
||||||
osg::StateSet* visitGeoState(osg::Drawable* osgDrawble,pfGeoState* geostate);
|
|
||||||
osg::Material* visitMaterial(osg::StateSet* osgStateSet,pfMaterial* front_mat,pfMaterial* back_mat);
|
|
||||||
osg::Texture2D* visitTexture(osg::StateSet* osgStateSet,pfTexture* tex);
|
|
||||||
|
|
||||||
typedef std::map<int,deprecated_osg::Geometry::AttributeBinding> GSetBindingMap;
|
|
||||||
|
|
||||||
GSetBindingMap _gsetBindMap;
|
|
||||||
|
|
||||||
bool _saveImagesAsRGB;
|
|
||||||
bool _saveAbsoluteImagePath;
|
|
||||||
std::string _saveImageDirectory;
|
|
||||||
|
|
||||||
typedef std::map<pfObject*,osg::Object*> PfObjectToOsgObjectMap;
|
|
||||||
PfObjectToOsgObjectMap _pfToOsgMap;
|
|
||||||
|
|
||||||
osg::Node* _osgRoot;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
Features and issues with Performer plugin
|
|
||||||
=========================================
|
|
||||||
|
|
||||||
Issues
|
|
||||||
------
|
|
||||||
After compiling the Peformer plugin you can run sgv and it will
|
|
||||||
pick up the library osgPlugins/osgdb_pfb correctly, so you'll now be
|
|
||||||
able to type something like :
|
|
||||||
|
|
||||||
cd /usr/share/Performer/data
|
|
||||||
sgv iris.pfb
|
|
||||||
|
|
||||||
Unfortunately this then results in the following error message :
|
|
||||||
|
|
||||||
DynamicLibrary::failed loading /home/robert/OpenSceneGraph-0.8/lib/osgPlugins/osgdb_pfb.so
|
|
||||||
DynamicLibrary::error /usr/lib/libpr.so: undefined symbol: __ucmpdi2
|
|
||||||
|
|
||||||
An attempt to fixing the undefined symbol by including -lgcc did not fix the
|
|
||||||
problem, have a look at src/osgPlugins/pfb/Makefile, for the link lines
|
|
||||||
tested. Suggestions welcome.
|
|
||||||
|
|
||||||
This error disappears if you link sgv with Performer, you can do this by
|
|
||||||
simply swapping the #comment around in src/Viewier/Makefile so that :
|
|
||||||
|
|
||||||
LIBS = -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi
|
|
||||||
#LIBS = ${PFLIBS} -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi
|
|
||||||
|
|
||||||
is edited to become:
|
|
||||||
|
|
||||||
#LIBS = -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi
|
|
||||||
LIBS = ${PFLIBS} -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi
|
|
||||||
|
|
||||||
Not an ideal solution but it does work. Now try :
|
|
||||||
|
|
||||||
cd /usr/share/Performer/data
|
|
||||||
sgv town_ogl_pfi.pfb
|
|
||||||
|
|
||||||
|
|
||||||
Features
|
|
||||||
--------
|
|
||||||
You can also use osgdb_pfb.so as a Performer plugin, by linking/copying the
|
|
||||||
osgPlugins/osgdb_pfb.so to libpfosg.so. Try something like :
|
|
||||||
|
|
||||||
cd OpenSceneGraph-0.8/lib
|
|
||||||
ln -s osgPlugins/osgdb_pfb.so libpfosg.so
|
|
||||||
|
|
||||||
then
|
|
||||||
|
|
||||||
perfly turtle.osg
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
pfconv /usr/share/Performer/data/iris.pfb iris.osg
|
|
||||||
sgv iris.osg
|
|
||||||
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osg/Group>
|
|
||||||
#include <osg/Notify>
|
|
||||||
|
|
||||||
#include <osgDB/Registry>
|
|
||||||
#include <osgDB/FileNameUtils>
|
|
||||||
#include <osgDB/FileUtils>
|
|
||||||
|
|
||||||
#include "ConvertFromPerformer.h"
|
|
||||||
|
|
||||||
#include <Performer/pfdu.h>
|
|
||||||
#include <Performer/pr/pfTexture.h>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
extern pfNode *pfdLoadFile_pfb( const char *);
|
|
||||||
extern int pfdStoreFile_pfb( pfNode *, const char *);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ReaderWriterPFB : public osgDB::ReaderWriter
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ReaderWriterPFB();
|
|
||||||
~ReaderWriterPFB();
|
|
||||||
|
|
||||||
void initPerformer();
|
|
||||||
|
|
||||||
virtual const char* className() const { return "Performer Reader/Writer"; }
|
|
||||||
|
|
||||||
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
|
|
||||||
{
|
|
||||||
std::string fileName = osgDB::findDataFile( file, options );
|
|
||||||
if (fileName.empty()) fileName = file; // let Peformer see if it can file the filep
|
|
||||||
|
|
||||||
OSG_INFO<<"ReaderWriterPFB::readImage( "<<fileName.c_str()<<" )\n";
|
|
||||||
//initPerformer();
|
|
||||||
|
|
||||||
pfTexture* tex = new pfTexture;
|
|
||||||
tex->ref();
|
|
||||||
if (tex->loadFile(fileName.c_str()))
|
|
||||||
{
|
|
||||||
int s=0;
|
|
||||||
int t=0;
|
|
||||||
int r=0;
|
|
||||||
int comp=0;
|
|
||||||
unsigned int* imageData = NULL;
|
|
||||||
|
|
||||||
tex->getImage(&imageData,&comp,&s,&t,&r);
|
|
||||||
|
|
||||||
int internalFormat = comp;
|
|
||||||
|
|
||||||
unsigned int pixelFormat =
|
|
||||||
comp == 1 ? GL_LUMINANCE :
|
|
||||||
comp == 2 ? GL_LUMINANCE_ALPHA :
|
|
||||||
comp == 3 ? GL_RGB :
|
|
||||||
comp == 4 ? GL_RGBA : (GLenum)-1;
|
|
||||||
|
|
||||||
unsigned int dataType = GL_UNSIGNED_BYTE;
|
|
||||||
|
|
||||||
// copy image data
|
|
||||||
int size = s * t * r * comp;
|
|
||||||
unsigned char* data = (unsigned char*) malloc(size);
|
|
||||||
memcpy(data, imageData, size);
|
|
||||||
|
|
||||||
osg::Image* image = new osg::Image;
|
|
||||||
image->setFileName(fileName.c_str());
|
|
||||||
image->setImage(s,t,r,
|
|
||||||
internalFormat,
|
|
||||||
pixelFormat,
|
|
||||||
dataType,data,
|
|
||||||
osg::Image::USE_MALLOC_FREE);
|
|
||||||
|
|
||||||
// free texture & image data
|
|
||||||
tex->unrefDelete();
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
// free texture & image data
|
|
||||||
tex->unrefDelete();
|
|
||||||
|
|
||||||
return ReadResult::FILE_NOT_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const
|
|
||||||
{
|
|
||||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
|
||||||
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
|
|
||||||
|
|
||||||
std::string fileName = osgDB::findDataFile( file, options );
|
|
||||||
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
|
|
||||||
|
|
||||||
OSG_INFO<<"ReaderWriterPFB::readNode( "<<fileName.c_str()<<" )\n";
|
|
||||||
//initPerformer();
|
|
||||||
|
|
||||||
pfNode* root = pfdLoadFile(fileName.c_str());
|
|
||||||
if (root)
|
|
||||||
{
|
|
||||||
ConvertFromPerformer converter;
|
|
||||||
if (options) {
|
|
||||||
const std::string option = options->getOptionString();
|
|
||||||
if (option.find("saveImagesAsRGB") != std::string::npos)
|
|
||||||
converter.setSaveImagesAsRGB(true);
|
|
||||||
if (option.find("saveAbsoluteImagePath") != std::string::npos)
|
|
||||||
converter.setSaveAbsoluteImagePath(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
root->ref();
|
|
||||||
osg::Node* node = converter.convert(root);
|
|
||||||
root->unrefDelete();
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ReadResult::FILE_NOT_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
bool _performerInitialised;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
ReaderWriterPFB::ReaderWriterPFB()
|
|
||||||
{
|
|
||||||
supportsExtension("3ds","");
|
|
||||||
supportsExtension("arcinfo","");
|
|
||||||
supportsExtension("bin","");
|
|
||||||
supportsExtension("bpoly","");
|
|
||||||
supportsExtension("bw","");
|
|
||||||
supportsExtension("byu","");
|
|
||||||
supportsExtension("closest","");
|
|
||||||
supportsExtension("csb","");
|
|
||||||
supportsExtension("ct","");
|
|
||||||
supportsExtension("dem","");
|
|
||||||
supportsExtension("doublerot","");
|
|
||||||
supportsExtension("doublescale","");
|
|
||||||
supportsExtension("doubletrans","");
|
|
||||||
supportsExtension("dted","");
|
|
||||||
supportsExtension("dwb","");
|
|
||||||
supportsExtension("dxf","");
|
|
||||||
supportsExtension("evt","");
|
|
||||||
supportsExtension("flt","");
|
|
||||||
supportsExtension("gds","");
|
|
||||||
supportsExtension("gfo","");
|
|
||||||
supportsExtension("im","");
|
|
||||||
supportsExtension("irtp","");
|
|
||||||
supportsExtension("iv20","");
|
|
||||||
supportsExtension("iv","");
|
|
||||||
supportsExtension("lodfix","");
|
|
||||||
supportsExtension("lsa","");
|
|
||||||
supportsExtension("lsb","");
|
|
||||||
supportsExtension("medit","");
|
|
||||||
supportsExtension("m","");
|
|
||||||
supportsExtension("nff","");
|
|
||||||
supportsExtension("obj","");
|
|
||||||
supportsExtension("pegg","");
|
|
||||||
supportsExtension("pfb","");
|
|
||||||
supportsExtension("pfs","");
|
|
||||||
supportsExtension("phd","");
|
|
||||||
supportsExtension("poly","");
|
|
||||||
supportsExtension("post","");
|
|
||||||
supportsExtension("proc","");
|
|
||||||
supportsExtension("projtex","");
|
|
||||||
supportsExtension("pts","");
|
|
||||||
supportsExtension("rot","");
|
|
||||||
supportsExtension("scale","");
|
|
||||||
supportsExtension("sgf","");
|
|
||||||
supportsExtension("sgo","");
|
|
||||||
supportsExtension("so","");
|
|
||||||
supportsExtension("spf","");
|
|
||||||
supportsExtension("spherepatch3","");
|
|
||||||
supportsExtension("spherepatch","");
|
|
||||||
supportsExtension("sphere","");
|
|
||||||
supportsExtension("sponge","");
|
|
||||||
supportsExtension("star","");
|
|
||||||
supportsExtension("stla","");
|
|
||||||
supportsExtension("stlb","");
|
|
||||||
supportsExtension("substclip","");
|
|
||||||
supportsExtension("sv","");
|
|
||||||
supportsExtension("trans","");
|
|
||||||
supportsExtension("tri","");
|
|
||||||
supportsExtension("unc","");
|
|
||||||
supportsExtension("vct","");
|
|
||||||
|
|
||||||
_performerInitialised = false;
|
|
||||||
initPerformer();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ReaderWriterPFB::~ReaderWriterPFB()
|
|
||||||
{
|
|
||||||
if (_performerInitialised)
|
|
||||||
pfExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ReaderWriterPFB::initPerformer()
|
|
||||||
{
|
|
||||||
if (_performerInitialised) return;
|
|
||||||
|
|
||||||
_performerInitialised = true;
|
|
||||||
|
|
||||||
pfInit();
|
|
||||||
|
|
||||||
pfMultiprocess(0);
|
|
||||||
|
|
||||||
// FileList::iterator itr;
|
|
||||||
// for(itr=filelist.begin();itr!=filelist.end();++itr)
|
|
||||||
// {
|
|
||||||
// pfdInitConverter((*itr).c_str());
|
|
||||||
// }
|
|
||||||
pfdInitConverter(".pfb");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tell Performer to look in OSG search path
|
|
||||||
*/
|
|
||||||
const osgDB::FilePathList& filePath = osgDB::Registry::instance()->getDataFilePathList();
|
|
||||||
std::string path = "";
|
|
||||||
for (unsigned int i = 0; i < filePath.size(); i++) {
|
|
||||||
if (i != 0)
|
|
||||||
path += ":";
|
|
||||||
path += filePath[i];
|
|
||||||
}
|
|
||||||
pfFilePath(path.c_str());
|
|
||||||
|
|
||||||
pfConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// now register with sgRegistry to instantiate the above
|
|
||||||
// reader/writer.
|
|
||||||
REGISTER_OSGPLUGIN(pfb, ReaderWriterPFB)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#ifdef __linux
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
int stat(const char *file_name, struct stat *buf)
|
|
||||||
{
|
|
||||||
return __xstat( 3, file_name, buf );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user