Fixes to the inventor/vrml loader.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -20,24 +20,14 @@
|
||||
#ifndef __ATTRIBUTE_H__
|
||||
#define __ATTRIBUTE_H__
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/Referenced>
|
||||
|
||||
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); }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef __NODE_H__
|
||||
#define __NODE_H__
|
||||
|
||||
#include <osg/Referenced>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
@@ -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<MyNode> > MyNodeList;
|
||||
typedef std::map< const char*, osg::ref_ptr<Attribute>, 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
|
||||
|
||||
@@ -30,9 +30,9 @@ class TextureCoordinate;
|
||||
class Texture2;
|
||||
class Transform;
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/Referenced>
|
||||
|
||||
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"; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user