Fixed pfb loader so that it works for both Linux and IRix with dynamic

libraries, and provides support to load (almost) all that Performer loads.
This commit is contained in:
Don BURNS 2001-10-23 22:59:54 +00:00
parent a4e26d447b
commit 6316d19df8
5 changed files with 103 additions and 31 deletions

View File

@ -6,29 +6,23 @@ OBJS = $(C++FILES:.cpp=.o) $(CFILES:.c=.o) $(YACCFILES:.y=.o) $(LEXFILES:.l=.o)
DEPFILES = $(OBJS:.o=.d) DEPFILES = $(OBJS:.o=.d)
C++ = g++ C++ = g++
YFLAGS = -d YFLAGS = -d
LCINCS += -I/usr/X11R6/include LCINCS += -I/usr/X11R6/include
LC++INCS += ${LCINCS} LC++INCS += ${LCINCS}
CFLAGS = -O2 -W -Wall $(LCINCS) CFLAGS = -O2 -W -Wall $(LCINCS)
#CFLAGS = -g -W -Wall $(LCINCS) #CFLAGS = -g -W -Wall $(LCINCS)
C++FLAGS = ${CFLAGS} C++FLAGS = ${CFLAGS}
CPPFLAGS = ${CFLAGS} CPPFLAGS = ${CFLAGS}
LDFLAGS = -O2 -W -Wall -L/usr/X11R6/lib LDFLAGS = -O2 -W -Wall -L/usr/X11R6/lib
#LDFLAGS = -g -W -Wall -L/usr/X11R6/lib #LDFLAGS = -g -W -Wall -L/usr/X11R6/lib
DYNAMICLIBRARYLIB = -ldl DYNAMICLIBRARYLIB = -ldl
PFLIBS = \ PFLOADERPATH = /usr/lib/libpfdb
/usr/lib/Performer/Static/libpfdb/libpfpfb.a\
/usr/lib/Performer/Static/libpfdu.a\
/usr/lib/Performer/Static/libpfutil.a\
/usr/lib/Performer/Static/libpf.a\
GLUTLIB = -lglut GLUTLIB = -lglut
# #
# TARGET_DIRS are directories that would not exist on the system except # TARGET_DIRS are directories that would not exist on the system except
# for the presence of OpenSceneGraph. 'make instclean' removes these # for the presence of OpenSceneGraph. 'make instclean' removes these

View File

@ -34,7 +34,7 @@ $(MAKEDEPEND) : $(C++FILES) $(CFILES)
$(C++) $(C++FLAGS) -c $*.cpp -o $*.o $(C++) $(C++FLAGS) -c $*.cpp -o $*.o
%.o : %.c %.o : %.c
$(C++) $(C++FLAGS) -c $*.c -o $*.o $(CC) $(C++FLAGS) -c $*.c -o $*.o
docs: docs:
[ "$(TARGET_BASENAME)" != "" ] && \ [ "$(TARGET_BASENAME)" != "" ] && \

View File

@ -8,9 +8,6 @@ TARGET = ../../../bin/sgv
TARGET_BIN_FILES = sgv TARGET_BIN_FILES = sgv
#note, use this library list when using the Performer osgPlugin.
#LIBS = ${PFLIBS} -losgGLUT -losgUtil -losgDB -losg $(GLUTLIB) -lGLU -lGL -lm -lXmu -lX11 -lXi
#note, standard library list. #note, standard library list.
LIBS = -losgGLUT -losgUtil -losgDB -losg $(GLUTLIB) -lGLU -lGL -lm -lXmu -lX11 -lXi LIBS = -losgGLUT -losgUtil -losgDB -losg $(GLUTLIB) -lGLU -lGL -lm -lXmu -lX11 -lXi

View File

@ -2,6 +2,7 @@
include ../../../Make/makedefs include ../../../Make/makedefs
CFILES = \ CFILES = \
stat.c\
C++FILES = \ C++FILES = \
ConvertFromPerformer.cpp\ ConvertFromPerformer.cpp\
@ -10,21 +11,42 @@ C++FILES = \
LIB = ../../../lib/osgPlugins/osgdb_pfb.so LIB = ../../../lib/osgPlugins/osgdb_pfb.so
LIBS = -losg -losgDB $(PFLIBS) LIBS = -losg -losgDB \
-lpf3ds\
-lpfdem\
-lpfdted\
-lpfdwb\
-lpfdxf\
-lpfevt\
-lpfflt\
-lpfgds\
-lpfgfo\
-lpfim\
-lpflsa\
-lpflsb\
-lpfnff\
-lpfobj\
-lpfpegg\
-lpfpfb\
-lpfphd\
-lpfpts\
-lpfrot\
-lpfscale\
-lpfsgf\
-lpfsgo\
-lpfsphere\
-lpfsv\
-lpftri\
-lpfunc\
-lpfvct\
-lpfdu -lpfutil -lpf
TARGET_LOADER_FILES = osgPlugins/osgdb_pfb.so TARGET_LOADER_FILES = osgPlugins/osgdb_pfb.so
C++FLAGS += -g -I../../../include C++FLAGS += -g -I../../../include
LDFLAGS += -g -L../../../lib -L/usr/X11R6/lib LDFLAGS += -g -L../../../lib -L$(PFLOADERPATH) -Xlinker -rpath $(PFLOADERPATH)
PREREQUISITES = preq
include ../../../Make/makerules include ../../../Make/makerules
preq :
[ -f /usr/lib/blah ] || exit 1

View File

@ -30,7 +30,70 @@ class ReaderWriterPFB : public osgDB::ReaderWriter
void initPerformer(); void initPerformer();
virtual const char* className() { return "Performer Reader/Writer"; } virtual const char* className() { return "Performer Reader/Writer"; }
virtual bool acceptsExtension(const std::string& extension) { return extension=="pfb"; } virtual bool acceptsExtension(const std::string& extension)
{
return
extension=="3ds" ? true :
extension=="arcinfo" ? true :
extension=="bin" ? true :
extension=="bpoly" ? true :
extension=="bw" ? true :
extension=="byu" ? true :
extension=="closest" ? true :
extension=="csb" ? true :
extension=="ct" ? true :
extension=="dem" ? true :
extension=="doublerot" ? true :
extension=="doublescale" ? true :
extension=="doubletrans" ? true :
extension=="dted" ? true :
extension=="dwb" ? true :
extension=="dxf" ? true :
extension=="evt" ? true :
extension=="flt" ? true :
extension=="gds" ? true :
extension=="gfo" ? true :
extension=="im" ? true :
extension=="irtp" ? true :
extension=="iv20" ? true :
extension=="iv" ? true :
extension=="lodfix" ? true :
extension=="lsa" ? true :
extension=="lsb" ? true :
extension=="medit" ? true :
extension=="m" ? true :
extension=="nff" ? true :
extension=="obj" ? true :
extension=="pegg" ? true :
extension=="pfb" ? true :
extension=="pfs" ? true :
extension=="phd" ? true :
extension=="poly" ? true :
extension=="post" ? true :
extension=="proc" ? true :
extension=="projtex" ? true :
extension=="pts" ? true :
extension=="rot" ? true :
extension=="scale" ? true :
extension=="sgf" ? true :
extension=="sgo" ? true :
extension=="so" ? true :
extension=="spf" ? true :
extension=="spherepatch3" ? true :
extension=="spherepatch" ? true :
extension=="sphere" ? true :
extension=="sponge" ? true :
extension=="star" ? true :
extension=="stla" ? true :
extension=="stlb" ? true :
extension=="substclip" ? true :
extension=="sv" ? true :
extension=="trans" ? true :
extension=="tri" ? true :
extension=="unc" ? true :
extension=="vct" ? true :
false;
}
virtual osg::Image* readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*) virtual osg::Image* readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{ {
@ -79,11 +142,7 @@ class ReaderWriterPFB : public osgDB::ReaderWriter
initPerformer(); initPerformer();
#ifdef __sgi
pfNode* root = pfdLoadFile(fileName.c_str()); pfNode* root = pfdLoadFile(fileName.c_str());
#else
pfNode* root = pfdLoadFile_pfb(fileName.c_str());
#endif
ConvertFromPerformer converter; ConvertFromPerformer converter;
return converter.convert(root); return converter.convert(root);
@ -102,7 +161,7 @@ class ReaderWriterPFB : public osgDB::ReaderWriter
pfNode* root = converter.convert(&node); pfNode* root = converter.convert(&node);
if (root) if (root)
{ {
return pfdStoreFile_pfb(root,fileName.c_str())!=0; return pfdStoreFile(root,fileName.c_str())!=0;
} }
else else
{ {