From 74f5cbe16a8ee992fede023ad4c3b75b495e16d2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 27 Jul 2002 21:35:21 +0000 Subject: [PATCH] Fixes to the inventor/vrml loader. --- src/osgPlugins/iv/atrfloat.h | 2 -- src/osgPlugins/iv/atrstring.h | 2 -- src/osgPlugins/iv/atrvec.h | 3 --- src/osgPlugins/iv/attribute.h | 14 ++--------- src/osgPlugins/iv/main.cpp | 2 +- src/osgPlugins/iv/mynode.h | 19 ++++----------- src/osgPlugins/iv/mynodevisitor.h | 13 ++-------- src/osgPlugins/iv/osgvisitor.cpp | 4 ++-- src/osgPlugins/iv/osgvisitor.h | 3 --- src/osgPlugins/iv/parser.cpp.h | 40 ------------------------------- 10 files changed, 11 insertions(+), 91 deletions(-) delete mode 100644 src/osgPlugins/iv/parser.cpp.h diff --git a/src/osgPlugins/iv/atrfloat.h b/src/osgPlugins/iv/atrfloat.h index 90a726ef0..3ffd56c51 100644 --- a/src/osgPlugins/iv/atrfloat.h +++ b/src/osgPlugins/iv/atrfloat.h @@ -28,8 +28,6 @@ public: AtrFloat(char *name, float val):Attribute(name) { value=val; } virtual char *type() { return "AtrFloat"; } float getValue() { return value; } - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const { return new AtrFloat(name,value); } }; #endif diff --git a/src/osgPlugins/iv/atrstring.h b/src/osgPlugins/iv/atrstring.h index b6037edb5..963ee046b 100644 --- a/src/osgPlugins/iv/atrstring.h +++ b/src/osgPlugins/iv/atrstring.h @@ -29,8 +29,6 @@ public: ~AtrString() { free (value); } virtual char *type() { return "AtrString"; } char *getValue() { return value; } - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const { return new AtrString(name,value); } }; #endif diff --git a/src/osgPlugins/iv/atrvec.h b/src/osgPlugins/iv/atrvec.h index 5f7823a04..52a752f93 100644 --- a/src/osgPlugins/iv/atrvec.h +++ b/src/osgPlugins/iv/atrvec.h @@ -47,9 +47,6 @@ public: float getValCut(int pos) { return values[pos]>0?values[pos]:0.0f; } int getSize() { return values.size(); } virtual char *type() { return "AtrVec"; } - - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const { return new AtrVec(name); } }; diff --git a/src/osgPlugins/iv/attribute.h b/src/osgPlugins/iv/attribute.h index 3003233e0..f0a7aaf00 100644 --- a/src/osgPlugins/iv/attribute.h +++ b/src/osgPlugins/iv/attribute.h @@ -20,24 +20,14 @@ #ifndef __ATTRIBUTE_H__ #define __ATTRIBUTE_H__ -#include +#include -class SG_EXPORT Attribute: public osg::Object { +class Attribute: public osg::Referenced { public: char *name; virtual char *type()=0; char *getName() { return name; } - // OSG Object API - - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const =0; - /** return a clone of a node, with Object* return type.*/ - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return cloneType(); } - /** return the name of the node's library.*/ - virtual const char* libraryName() const { return "osgdb_wrl"; } - /** return the name of the node's class type.*/ - virtual const char* className() const { return "Attribute"; } protected: Attribute(char *name) {this->name=strdup(name); } ~Attribute() {free(name); } diff --git a/src/osgPlugins/iv/main.cpp b/src/osgPlugins/iv/main.cpp index 40a55b66c..442028274 100644 --- a/src/osgPlugins/iv/main.cpp +++ b/src/osgPlugins/iv/main.cpp @@ -34,7 +34,7 @@ extern int yydebug; extern MyNode *getRoot(); extern FILE *yyin; -int isatty(int t) { return 0; } +int isatty(int) { return 0; } osg::Node *readVRMLNode(const char *file) { yydebug=0; diff --git a/src/osgPlugins/iv/mynode.h b/src/osgPlugins/iv/mynode.h index 4cc769d90..570505903 100644 --- a/src/osgPlugins/iv/mynode.h +++ b/src/osgPlugins/iv/mynode.h @@ -20,6 +20,9 @@ #ifndef __NODE_H__ #define __NODE_H__ +#include +#include + #include #include #include @@ -31,7 +34,7 @@ # pragma warning (disable:4786) #endif -class MyNode : public osg::Object { +class MyNode : public osg::Referenced { public: typedef std::vector< osg::ref_ptr > MyNodeList; typedef std::map< const char*, osg::ref_ptr, ltstr > AttributeMap; @@ -69,20 +72,6 @@ public: void setTwoSided() { two_sided=true; } bool getTwoSided() { return two_sided; } virtual void accept(MyNodeVisitor *v) { v->applyMyNode(this); } - - // OSG Object API - - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const { return new MyNode(); } - /** return a clone of a node, with Object* return type.*/ - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MyNode(this); } - /** return the name of the node's library.*/ - virtual const char* libraryName() const { return "osgdb_wrl"; } - /** return the name of the node's class type.*/ - virtual const char* className() const { return "MyNode"; } - - - }; #endif diff --git a/src/osgPlugins/iv/mynodevisitor.h b/src/osgPlugins/iv/mynodevisitor.h index 87c56b94f..4db570154 100644 --- a/src/osgPlugins/iv/mynodevisitor.h +++ b/src/osgPlugins/iv/mynodevisitor.h @@ -30,9 +30,9 @@ class TextureCoordinate; class Texture2; class Transform; -#include +#include -class MyNodeVisitor: public osg::Object { +class MyNodeVisitor: public osg::Referenced { public: virtual void applyMyNode(MyNode *node)=0; virtual void applyMaterial(Material *material)=0; @@ -43,15 +43,6 @@ public: virtual void applyTextureCoordinate(TextureCoordinate *texc)=0; virtual void applyTexture2(Texture2 *tex)=0; virtual void applyTransform(Transform *trans)=0; - - /** clone the an object of the same type as the node.*/ - virtual osg::Object* cloneType() const = 0; - /** return a clone of a node, with Object* return type.*/ - virtual osg::Object* clone(const osg::CopyOp& copyop) const { return cloneType(); } - /** return the name of the node's library.*/ - virtual const char* libraryName() const { return "osgdb_wrl"; } - /** return the name of the node's class type.*/ - virtual const char* className() const { return "MyNodeVisitor"; } }; diff --git a/src/osgPlugins/iv/osgvisitor.cpp b/src/osgPlugins/iv/osgvisitor.cpp index eee3073fa..98fe55b81 100644 --- a/src/osgPlugins/iv/osgvisitor.cpp +++ b/src/osgPlugins/iv/osgvisitor.cpp @@ -66,7 +66,7 @@ class CacheObjetos { static TextureMap textures; static NodeMap nodos; public: - static osg::Node* getMyNode(MyNode* _node) { + static osg::Node* getMyNode(MyNode*) { return 0; } @@ -127,7 +127,7 @@ OSGVisitor::OSGVisitor(MyNode *nodo) { std::cout << "Model of " << total_vert << " vertices" << std::endl; } -void OSGVisitor::applyMyNode(MyNode *nodo) { +void OSGVisitor::applyMyNode(MyNode *) { } void OSGVisitor::applyMaterial(Material *material) { diff --git a/src/osgPlugins/iv/osgvisitor.h b/src/osgPlugins/iv/osgvisitor.h index 04d0037aa..c97a7a2fe 100644 --- a/src/osgPlugins/iv/osgvisitor.h +++ b/src/osgPlugins/iv/osgvisitor.h @@ -45,9 +45,6 @@ public: virtual void applyTexture2(Texture2 *tex); virtual void applyTransform(Transform *trans); osg::Node* getRoot(); - - virtual osg::Object* cloneType() const { return new OSGVisitor(0); } - }; #endif diff --git a/src/osgPlugins/iv/parser.cpp.h b/src/osgPlugins/iv/parser.cpp.h deleted file mode 100644 index 50572229b..000000000 --- a/src/osgPlugins/iv/parser.cpp.h +++ /dev/null @@ -1,40 +0,0 @@ -typedef union { - char *s_value; - float f_value; - MyNode *nodo; - Attribute *attribute; - VertexList *vlist; - VertexIndexList *vindex; - TextureCoordList *tcoord; - PolygonList *plist; - Matrix matrix; - int i_value; -} YYSTYPE; -#define STRING 257 -#define QUOTED_STRING 258 -#define FLOAT 259 -#define INT 260 -#define SEPARATOR 261 -#define DEF 262 -#define UN_MATERIAL 263 -#define DIFFUSE_COLOR 264 -#define COORDINATE3 265 -#define INDEXED_FACE_SET 266 -#define A_POINT 267 -#define COORD_INDEX 268 -#define TEXTURE_COORD_INDEX 269 -#define NORMAL_INDEX 270 -#define TEXTURE_COORDINATE 271 -#define TEXTURE2 272 -#define MATRIX_TRANSFORM 273 -#define MATRIX 274 -#define LISTA_VACIA 275 -#define FINPOLY 276 -#define DOBLE_CARA 277 -#define VECTOR 278 -#define VRML_HEADER 279 -#define TRANSFORM 280 -#define USE 281 - - -extern YYSTYPE yylval;