1 /* 2 * NodeInline.h 3 * 4 * Copyright (C) 1999 Stephen F. White 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (see the file "COPYING" for details); if 18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave, 19 * Cambridge, MA 02139, USA. 20 */ 21 22 #pragma once 23 24 #include "Node.h" 25 #include "ProtoMacros.h" 26 #include "Proto.h" 27 #include "SFMFTypes.h" 28 29 class NodeList; 30 31 class NodeInlineLoadControl; 32 33 class ProtoInline : public WonderlandExportProto { 34 public: 35 ProtoInline(Scene *scene); 36 ProtoInline(Scene *scene, const char *name); 37 virtual Node *create(Scene *scene); 38 getType()39 virtual int getType() const { return VRML_INLINE; } getNodeClass()40 virtual int getNodeClass() const 41 { return CHILD_NODE | URL_NODE | INLINE_NODE; } 42 hasX3domOnclick(void)43 virtual bool hasX3domOnclick(void) { return true; } 44 45 void addElements(void); 46 47 FieldIndex load; 48 FieldIndex url; 49 FieldIndex bboxCenter; 50 FieldIndex bboxSize; 51 FieldIndex children; 52 FieldIndex mapDEFToID; 53 FieldIndex nameSpaceName; 54 FieldIndex render; 55 }; 56 57 class NodeInline : public Node { 58 public: 59 NodeInline(Scene *scene, Proto *proto); 60 NodeInline(NodeInlineLoadControl *inlineLoadControl); 61 62 virtual int getProfile(void) const; 63 virtual int getComponentLevel(void) const; 64 virtual const char *getComponentName(void) const; getX3dVersion(void)65 virtual int getX3dVersion(void) const { return 0; } copy()66 virtual Node *copy() const { return new NodeInline(*this); } 67 virtual void addFieldNodeList(int index, NodeList *childList, 68 int containerField = -1); 69 setUnitLength(double f)70 void setUnitLength(double f) { m_unitLength = f; } 71 72 virtual int countPolygons(void); 73 virtual int countPrimitives(void); 74 75 virtual int countPolygons1Sided(void); 76 virtual int countPolygons2Sided(void); 77 78 virtual void preDraw(void); 79 virtual void draw(int pass); 80 virtual void setField(int index, FieldValue *value, int cf = -1); 81 82 virtual int writeXml(int filedes, int indent, int containerField = -1, 83 bool avoidUse = false); 84 85 virtual bool canWriteAc3d(); 86 virtual int writeAc3d(int filedes, int indent); 87 virtual void handleAc3dMaterial(ac3dMaterialCallback callback, 88 Scene* scene); 89 virtual bool canWriteCattGeo(); 90 virtual int writeCattGeo(int filedes, int indent); 91 alreadyLoaded(void)92 bool alreadyLoaded(void) { return m_loadedNodes != NULL; } getLoadedNodes(void)93 virtual NodeList *getLoadedNodes(void) { return m_loadedNodes; } 94 95 virtual void addToConvertedNodes(int writeFlags); 96 97 fieldMacros(SFBool, load, ProtoInline) 98 fieldMacros(MFString, url, ProtoInline) 99 fieldMacros(SFVec3f, bboxCenter, ProtoInline) 100 fieldMacros(SFVec3f, bboxSize, ProtoInline) 101 fieldMacros(MFNode, children, ProtoInline) 102 fieldMacros(SFBool, mapDEFToID, ProtoInline) 103 fieldMacros(MFString, nameSpaceName, ProtoInline) 104 fieldMacros(SFBool, render, ProtoInline) 105 106 protected: 107 NodeList *m_loadedNodes; 108 double m_unitLength; 109 }; 110