00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __INLINE_H__
00030 #define __INLINE_H__
00031
00032 #include "X3DChildNode.h"
00033 #include "X3DUrlObject.h"
00034 #include "X3DBoundedObject.h"
00035 #include "H3DDisplayListObject.h"
00036 #include "Group.h"
00037 #include "DEFNodes.h"
00038
00039 namespace H3D {
00040
00096 class H3DAPI_API Inline :
00097 public X3DChildNode,
00098 public X3DBoundedObject,
00099 public X3DUrlObject,
00100 public H3DDisplayListObject {
00101 public:
00102
00109 class LoadedScene:
00110 public TypedField< DependentMFNode< Group,
00111 FieldRef< H3DDisplayListObject,
00112 H3DDisplayListObject::DisplayList,
00113 &H3DDisplayListObject::displayList >,
00114 true >,
00115 Types< SFBool, MFString > > {
00116 public:
00120 ~LoadedScene() {
00121 clear( ownerId() );
00122 }
00123
00124 protected:
00125 typedef TypedField< DependentMFNode< Group,
00126 FieldRef< H3DDisplayListObject,
00127 H3DDisplayListObject::DisplayList,
00128 &H3DDisplayListObject::displayList >,
00129 true >,
00130 Types< SFBool, MFString > > LoadedSceneBase;
00132 virtual void update();
00133
00135 virtual void onAdd( Node *n );
00136
00138 virtual void onRemove( Node *n );
00139
00140 };
00141
00151 class H3DAPI_API SFBound:
00152 public TypedField< X3DBoundedObject::SFBound,
00153 void,
00154 AnyNumber< X3DBoundedObject::SFBound > > {
00157 virtual void update();
00158 };
00159
00161 Inline( Inst< SFNode > _metadata = 0,
00162 Inst< DisplayList > _displayList = 0,
00163 Inst< MFString > _url = 0,
00164 Inst< SFBound > _bound = 0,
00165 Inst< SFVec3f > _bboxCenter = 0,
00166 Inst< SFVec3f > _bboxSize = 0,
00167 Inst< SFBool > _load = 0,
00168 Inst< LoadedScene > _loadedScene = 0 );
00169
00170 virtual ~Inline() {
00171 exported_nodes.clear();
00172 }
00173
00179 virtual void initialize() {
00180 const Vec3f &size = bboxSize->getValue();
00181 if( size.x == -1 && size.y == -1 && size.z == -1 ) {
00182 NodeVector children_nodes = loadedScene->getValue();
00183 use_union_bound = true;
00184
00185
00186 loadedScene->setValue( children_nodes, id );
00187 } else {
00188 use_union_bound = false;
00189 BoxBound *bb = new BoxBound();
00190 bb->center->setValue( bboxCenter->getValue() );
00191 bb->size->setValue( bboxSize->getValue() );
00192 bound->setValue( bb );
00193 }
00194 X3DChildNode::initialize();
00195 }
00196
00198 virtual void render();
00199
00200 #ifdef USE_HAPTICS
00201
00202 virtual void traverseSG( TraverseInfo &ti );
00203 #endif
00204
00208 auto_ptr< SFBool > load;
00209
00211 auto_ptr< LoadedScene > loadedScene;
00212
00213
00214
00215 bool use_union_bound;
00216
00218 static H3DNodeDatabase database;
00219
00222 X3D::DEFNodes exported_nodes;
00223 };
00224 }
00225
00226 #endif