00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef CYBNODEC_H
00027 #define CYBNODEC_H
00028
00029 #include <math.h>
00030 #include <stdio.h>
00031 #include <fstream>
00032 #include <string.h>
00033 #include "oaw/misc/kettec.h"
00034 #include "oaw/misc/arrayc.h"
00035 #include "oaw/misc/stringc.h"
00036
00037 #include "oaw/misc/objectc.h"
00038 #include "oaw/misc/sharedobjectc.h"
00039 #include "oaw/pdtk/pdtkeventdesi.h"
00040 #include "oaw/misc/eventsrcc.h"
00041 #include "oaw/misc/eventpipec.h"
00042 #include "../oawconfig.h"
00043
00044 OAW_BEGIN_NAMESPACE
00045
00046
00047 class CybWorldC;
00048 class CybSensorC;
00049
00051
00052 #define CYBNT_BASE 1001
00053 #define CYBNT_WORLD 1002
00054 #define CYBNT_GROUP 1003
00055 #define CYBNT_TRANSFORM 1004
00056 #define CYBNT_SHAPE 1005
00057 #define CYBNT_APPEARANCE 1006
00058 #define CYBNT_GEOMETRY 1007
00059 #define CYBNT_SPHERE 1008
00060 #define CYBNT_CONE 1009
00061 #define CYBNT_INDEXEDFACESET 1010
00062 #define CYBNT_COORDINATE 1011
00063 #define CYBNT_NORMAL 1012
00064 #define CYBNT_MATERIAL 1013
00065 #define CYBNT_COLOR 1014
00066 #define CYBNT_BOX 1015
00067 #define CYBNT_CYLINDER 1016
00068 #define CYBNT_AUDIOCLIP 1017
00069 #define CYBNT_BACKGROUND 1018
00070 #define CYBNT_BILLBOARD 1019
00071 #define CYBNT_COLLISION 1021
00072 #define CYBNT_COLORINTERPOLATOR 1022
00073 #define CYBNT_COORDINATEINTERPOLATOR 1023
00074 #define CYBNT_CYLINDERSENSOR 1024
00075 #define CYBNT_DIRECTIONALLIGHT 1025
00076 #define CYBNT_ELEVATIONGRID 1026
00077 #define CYBNT_EXTRUSION 1027
00078 #define CYBNT_FOG 1028
00079 #define CYBNT_FONTSTYLE 1029
00080 #define CYBNT_INLINE 1030
00081 #define CYBNT_IMAGETEXTURE 1031
00082 #define CYBNT_LOD 1032
00083 #define CYBNT_INDEXEDLINESET 1033
00084 #define CYBNT_MOVIETEXTURE 1034
00085 #define CYBNT_NAVIGATIONINFO 1035
00086 #define CYBNT_NORMALINTERPOLATOR 1037
00087 #define CYBNT_ORIENTATIONINTERPOLATOR 1038
00088 #define CYBNT_PIXELTEXTURE 1039
00089 #define CYBNT_PLANESENSOR 1040
00090 #define CYBNT_POINTLIGHT 1041
00091 #define CYBNT_POINTSET 1042
00092 #define CYBNT_POSITIONINTERPOLATOR 1043
00093 #define CYBNT_PROXIMITYSENSOR 1044
00094 #define CYBNT_SCALARINTERPOLATOR 1045
00095 #define CYBNT_SCRIPT 1046
00096 #define CYBNT_SOUND 1047
00097 #define CYBNT_SPHERESENSOR 1048
00098 #define CYBNT_SPOTLIGHT 1049
00099 #define CYBNT_SWITCH 1050
00100 #define CYBNT_TEXT 1051
00101 #define CYBNT_TEXTURECOORDINATE 1052
00102 #define CYBNT_TEXTURETRANSFORM 1053
00103 #define CYBNT_TIMESENSOR 1054
00104 #define CYBNT_TOUCHSENSOR 1055
00105 #define CYBNT_VIEWPOINT 1056
00106 #define CYBNT_VISIBILITYSENSOR 1057
00107 #define CYBNT_WORLDINFO 1058
00108 #define CYBNT_ANCHOR 1059
00109 #define CYBNT_TEXTURE 1060
00110 #define CYBNT_SENSOR 1061
00111 #define CYBNT_VIEWPOINTSENSOR 1062
00112 #define CYBNT_INTERPOLATOR 1063
00113 #define CYBNT_INTERFACE 1064
00114 #define CYBNT_PROTO 1065
00115 #define CYBNT_EXTERNPROTO 1066
00116 #define CYBNT_POINTINGDEVICE 1067
00117 #define CYBNT_WATER 1068
00118 #define CYBNT_WEATHERBOX 1069
00119 #define CYBNT_SIXDOFMOUSESENSOR 1070
00120
00121 #define CYBMT_ENABLE_BLENDING 1
00122 #define CYBMT_DISABLE_BLENDING 2
00123 #define CYBMT_ENABLE_CULLING 3
00124 #define CYBMT_SOLID_GEOMETRY 4
00125 #define CYBMT_DISABLE_LOOP 5
00126 #define CYBMT_ENABLE_LOOP 6
00127 #define CYBMT_PITCH 7
00128 #define CYBMT_GEOMETRY_NOT_STATIC 8
00129 #define CYBMT_COORD_NOT_STATIC 9
00130 #define CYBMT_NORMAL_NOT_STATIC 10
00131 #define CYBMT_TEXCOORD_NOT_STATIC 11
00132 #define CYBMT_BBX_NOT_STATIC 12
00133 #define CYBMT_COORD_CHANGED 13
00134 #define CYBMT_NORMAL_CHANGED 14
00135 #define CYBMT_COLOR_CHANGED 15
00136 #define CYBMT_GEOMETRY_CHANGED 16
00137 #define CYBMT_APPEARANCE_CHANGED 17
00138 #define CYBMT_MATERIAL_CHANGED 18
00139 #define CYBMT_TEXTURE_CHANGED 19
00140 #define CYBMT_TEXCOORD_CHANGED 20
00141 #define CYBMT_BINFO_CHANGED 21
00142
00143 #define CYB_TRAV_APP 1
00144 #define CYB_TRAV_DRAW 2
00145 #define CYB_TRAV_SELECT 4
00146 #define CYB_TRAV_ISECTLINE 8
00147
00149
00150
00152
00153
00155
00157
00158 class CybAcoustetronAuralC;
00159 class CybChannelC;
00160 class CybProtoC;
00161 class CybBoxC;
00162
00163 typedef ArrayC<EventPipeC> PipeArray;
00164
00165 class OAW_DLLMAPPING CybBInfoC{
00166 public:
00167 CybBInfoC(){m_bsphereRadius=0.0;}
00168 VectorC m_bsphereCenter;
00169 double m_bsphereRadius;
00170 VectorC m_bbxCenter;
00171 VectorC m_bbxSize;
00172 };
00173
00174 class OAW_DLLMAPPING CybNodeI : public virtual SharedObjectI,
00175 public virtual PDTKEventDesI,
00176 public virtual EventSrcI
00177 {
00178 public:
00179 virtual const CybBInfoC& GetBInfo()=0;
00180 };
00181
00182 #ifdef _WIN32
00183 #pragma warning(disable:4250)
00184 #endif
00185
00186 class OAW_DLLMAPPING CybNodeC : public SharedObjectC,
00187 public virtual CybNodeI
00188 {
00189
00190 friend class CybGroupC;
00191
00192 public:
00193 CybNodeC(CybWorldC*);
00194 virtual ~CybNodeC();
00195 CybNodeC(const CybNodeC&);
00196 CybNodeC& operator = (const CybNodeC&);
00197 virtual void Copy(const CybNodeC*);
00198 virtual CybNodeC* CreateNew();
00199 virtual void SharedObjectDestroyed(SharedObjectC*);
00200
00201 virtual void* GetImpl(){return this;}
00202
00203 virtual void LoadVRML(char*&, const char*,long&);
00204 virtual int SetNode(CybNodeC*);
00205 virtual int AddSrc(CybNodeC*,const StringC&,const StringC&);
00206 virtual int AddDes(EventDesI*,const StringC&,long);
00207 virtual void AddIS(const StringC& a1,const StringC& a2);
00208
00209 virtual long GetFieldDataType(long);
00210 virtual short GetFieldData(long,void*){return 0;}
00211 virtual short GetBufFieldData(long,void*);
00212 virtual ArrayC<CybNodeC*> GetRouteList();
00213 virtual long GetFieldEventID(const char*);
00214 virtual long GetNumberOfFields(){return 10;}
00215
00216 virtual void ToChannel(CybChannelC*,long){}
00217
00218 virtual void FinishInit();
00219 virtual void EventCascadeBegin();
00220 virtual void EventCascadeEnd();
00221 virtual const CybBInfoC& GetBInfo(){return m_BInfo;}
00222
00223 virtual short SendingEventsToActPasIntfcs(){return m_bRoutesToActPasIntfcs;}
00224 virtual void SetEvent(long,const void*, BaseI*);
00225 virtual long BufEvent(long,const void*, BaseI*);
00226 virtual long GetEventBufMaxDataSize();
00227 virtual long GetEventBufMinDataSize();
00228 virtual short CopyEventBuf(AnyC&,long);
00229 virtual short SetEventBuf(AnyC&, BaseI*);
00230
00231 virtual void ProtoDestroyed(CybProtoC*);
00232
00233 void SetBlindChannel(CybChannelC* pC){m_pBlindChannel = pC;}
00234 CybWorldC* GetWorld(){return m_pWorld;}
00235 const long& GetNodeID() const {return m_nodeID;}
00236 const long& GetNodeIDProto() const {return m_nodeIDProto;}
00237 void FreeNodeID();
00238 short IsKindOf(int) const;
00239 Matrix4C GetGlobalTransformMatrix();
00240 int GetNodeType(short i){if(i<(short)m_nodeType.size()){return m_nodeType[i];}return -1;}
00241 int GetNodeTypeLast(){return m_nodeType.back();}
00242 const char* GetDefName() const {return m_defName.c_str();}
00243 void SetDefName(const StringC& s){m_defName = s;}
00244 CybProtoC* GetProto(){return m_pProto;}
00245 long GetNumParents();
00246 CybNodeC* GetParent(long);
00247 void AddParent(CybNodeC*);
00248 void RemoveParent(CybNodeC*);
00249
00250
00251 protected:
00252 void SetAndLoadNode(CybNodeC*,char*&, const char*,long&);
00253 virtual void CreateNewCopy(CybNodeC*);
00254 void RedirectEventPipe(EventPipeC& eventPipe);
00255
00256 short CheckEvent(long);
00257
00258 protected:
00259
00260 struct RouteS{
00261 RouteS(){m_lastTick=0;}
00262 PipeArray m_pipes;
00263 double m_lastTick;
00264 };
00265
00266 CybChannelC* m_pBlindChannel;
00267 long m_blindTrav;
00268
00269 ArrayC<int> m_nodeType;
00270 ArrayC<CybNodeC*> m_parents;
00271 CybWorldC* m_pWorld;
00272 StringC m_defName;
00273
00274 CybProtoC* m_pProto;
00275 CybBInfoC m_BInfo;
00276
00277 long m_nodeID;
00278 long m_nodeIDProto;
00279
00280 ArrayC<RouteS> m_routes;
00281 short m_bRoutesToActPasIntfcs;
00282
00283 ArrayC<long> m_bufEventIDs;
00284 ArrayC<void*> m_bufEventData;
00285 ArrayC<long> m_bufEventDataType;
00286
00287 ArrayC<long> m_setEventBufEIDs;
00288 ArrayC<long> m_setEventBufNIDs;
00289
00290 struct IsStruct{
00291 StringC m_fieldName;
00292 StringC m_isFieldName;
00293 };
00294
00295
00296 ArrayC<IsStruct> m_isFields;
00297
00298
00299 KetteC<StringC> m_defStack;
00300
00302 protected:
00303
00304 virtual void Load_PROTOInst(const StringC&, char*&,const char*,long&);
00305 virtual void Load_Node(long,char*&, const char*,long&);
00306 virtual void Load_field(const StringC&,char*&, const char*,long&);
00307
00308 virtual void Load_children(char*&, const char*,long&,short flag = 0);
00309 virtual void Load_bboxCenter(char*&, const char*,long&);
00310 virtual void Load_bboxSize(char*&, const char*,long&);
00311
00312 virtual void Load_axisOfRotation(char*&, const char*,long&);
00313
00314 virtual void Load_collide(char*&, const char*,long&);
00315 virtual void Load_proxy(char*&, const char*,long&);
00316
00317 virtual void Load_scaleOrientation (char*&, const char*,long&);
00318 virtual void Load_center (char*&, const char*,long&);
00319 virtual void Load_rotation (char*&, const char*,long&);
00320 virtual void Load_scale(char*&, const char*,long&);
00321 virtual void Load_translation (char*&, const char*,long&);
00322
00323 virtual void Load_choice(char*&, const char*,long&);
00324 virtual void Load_whichChoice (char*&, const char*,long&);
00325
00326 virtual void Load_url(char*&, const char*,long&);
00327
00328 virtual void Load_level(char*&, const char*,long&);
00329 virtual void Load_range (char*&, const char*,long&);
00330
00332
00333 virtual void Load_appearance(char*&, const char*,long&);
00334 virtual void Load_geometry(char*&, const char*,long&);
00335
00336 virtual void Load_material(char*&, const char*,long&);
00337 virtual void Load_texture(char*&, const char*,long&);
00338 virtual void Load_textureTransform(char*&, const char*,long&);
00339
00340 virtual void Load_family(char*&, const char*,long&);
00341 virtual void Load_horizontal(char*&, const char*,long&);
00342 virtual void Load_justify(char*&, const char*,long&);
00343 virtual void Load_language(char*&, const char*,long&);
00344 virtual void Load_leftToRight(char*&, const char*,long&);
00345 virtual void Load_spacing(char*&, const char*,long&);
00346 virtual void Load_style(char*&, const char*,long&);
00347 virtual void Load_topToBottom(char*&, const char*,long&);
00348
00349 virtual void Load_repeatS(char*&, const char*,long&);
00350 virtual void Load_repeatT(char*&, const char*,long&);
00351
00352 virtual void Load_diffuseColor(char*&, const char*,long&);
00353 virtual void Load_emissiveColor(char*&, const char*,long&);
00354 virtual void Load_specularColor(char*&, const char*,long&);
00355 virtual void Load_shininess(char*&, const char*,long&);
00356 virtual void Load_transparency(char*&, const char*,long&);
00357
00359
00360 virtual void Load_coord(char*&, const char*,long&);
00361 virtual void Load_normal(char*&, const char*,long&);
00362 virtual void Load_texCoord(char*&, const char*,long&);
00363 virtual void Load_color(char*&, const char*,long&);
00364 virtual void Load_colorIndex (char*&, const char*,long&);
00365 virtual void Load_convex (char*&, const char*,long&);
00366 virtual void Load_creaseAngle (char*&, const char*,long&);
00367 virtual void Load_coordIndex(char*&, const char*,long&);
00368 virtual void Load_normalIndex(char*&, const char*,long&);
00369 virtual void Load_texCoordIndex(char*&, const char*,long&);
00370 virtual void Load_colorPerVertex(char*&, const char*,long&);
00371 virtual void Load_normalPerVertex(char*&, const char*,long&);
00372 virtual void Load_solid(char*&, const char*,long&);
00373 virtual void Load_ccw (char*&, const char*,long&);
00374
00375 virtual void Load_xDimension(char*&, const char*,long&);
00376 virtual void Load_xSpacing(char*&, const char*,long&);
00377 virtual void Load_zDimension(char*&, const char*,long&);
00378 virtual void Load_zSpacing(char*&, const char*,long&);
00379
00380 virtual void Load_beginCap(char*&, const char*,long&);
00381 virtual void Load_crossSection(char*&, const char*,long&);
00382 virtual void Load_endCap(char*&, const char*,long&);
00383 virtual void Load_orientation (char*&, const char*,long&);
00384 virtual void Load_spine (char*&, const char*,long&);
00385
00387
00388 virtual void Load_speed(char*&, const char*,long&);
00389 virtual void Load_image(char*&, const char*,long&);
00390
00392
00393 virtual void Load_ambientIntensity(char*&, const char*,long&);
00394 virtual void Load_direction (char*&, const char*,long&);
00395 virtual void Load_intensity (char*&, const char*,long&);
00396 virtual void Load_on(char*&, const char*,long&);
00397
00398 virtual void Load_attenuation(char*&, const char*,long&);
00399 virtual void Load_location(char*&, const char*,long&);
00400 virtual void Load_radius(char*&, const char*,long&);
00401
00402 virtual void Load_beamWidth(char*&, const char*,long&);
00403 virtual void Load_cutOffAngle(char*&, const char*,long&);
00404
00406
00407 virtual void Load_description(char*&, const char*,long&);
00408 virtual void Load_loop(char*&, const char*,long&);
00409 virtual void Load_pitch(char*&, const char*,long&);
00410 virtual void Load_startTime(char*&, const char*,long&);
00411 virtual void Load_stopTime(char*&, const char*,long&);
00412
00413 virtual void Load_maxBack(char*&, const char*,long&);
00414 virtual void Load_maxFront(char*&, const char*,long&);
00415 virtual void Load_minBack(char*&, const char*,long&);
00416 virtual void Load_minFront(char*&, const char*,long&);
00417 virtual void Load_priority(char*&, const char*,long&);
00418 virtual void Load_source(char*&, const char*,long&);
00419 virtual void Load_spatialize(char*&, const char*,long&);
00420
00422
00423 virtual void Load_groundAngle(char*&, const char*,long&);
00424 virtual void Load_groundColor(char*&, const char*,long&);
00425 virtual void Load_backUrl(char*&, const char*,long&);
00426 virtual void Load_bottomUrl(char*&, const char*,long&);
00427 virtual void Load_frontUrl(char*&, const char*,long&);
00428 virtual void Load_leftUrl(char*&, const char*,long&);
00429 virtual void Load_rightUrl(char*&, const char*,long&);
00430 virtual void Load_topUrl(char*&, const char*,long&);
00431 virtual void Load_skyAngle(char*&, const char*,long&);
00432 virtual void Load_skyColor(char*&, const char*,long&);
00433
00434 virtual void Load_fogType(char*&, const char*,long&);
00435 virtual void Load_visibilityRange(char*&, const char*,long&);
00436
00437 virtual void Load_avatarSize(char*&, const char*,long&);
00438 virtual void Load_headLight(char*&, const char*,long&);
00439 virtual void Load_type (char*&, const char*,long&);
00440 virtual void Load_visibilityLimit(char*&, const char*,long&);
00441
00442 virtual void Load_string(char*&, const char*,long&);
00443 virtual void Load_fontStyle(char*&, const char*,long&);
00444 virtual void Load_length(char*&, const char*,long&);
00445 virtual void Load_maxExtent(char*&, const char*,long&);
00446
00447 virtual void Load_fielOfView(char*&, const char*,long&);
00448 virtual void Load_jump (char*&, const char*,long&);
00449
00451
00452 virtual void Load_key(char*&, const char*,long&);
00453 virtual void Load_keyValue(char*&, const char*,long&);
00454
00456
00457 virtual void Load_autoOffset(char*&, const char*,long&);
00458 virtual void Load_diskAngle(char*&, const char*,long&);
00459 virtual void Load_enabled (char*&, const char*,long&);
00460 virtual void Load_maxAngle(char*&, const char*,long&);
00461 virtual void Load_minAngle(char*&, const char*,long&);
00462 virtual void Load_offset (char*&, const char*,long&);
00463
00464 virtual void Load_maxPosition(char*&, const char*,long&);
00465 virtual void Load_minPosition(char*&, const char*,long&);
00466
00467
00468 virtual void Load_cycleInterval(char*&, const char*,long&);
00469 virtual void Load_cycleTime(char*&, const char*,long&);
00470
00472
00473 virtual void Load_coordinate(char*&, const char*,long&);
00474 virtual void Load_point(char*&, const char*,long&);
00475 virtual void Load_vector(char*&, const char*,long&);
00476
00478
00479 virtual void Load_attr_event(const char*, char*&,const char*, long&);
00480
00482
00483 virtual void Load_directOutput(char*&, const char*,long&);
00484 virtual void Load_mustEvaluate(char*&, const char*,long&);
00485 virtual void Load_fieldName(char*&, const char*,long&);
00486
00487 virtual void Load_info(char*&, const char*,long&);
00488 virtual void Load_title(char*&, const char*,long&);
00489
00490 virtual void Load_lineCreases(char*&, const char*,long&);
00491
00492 virtual void Load_DEF(char*&, const char*,long&);
00493 virtual void Load_USE(char*&, const char*,long&);
00494 virtual void Load_ROUTE(char*&, const char*,long&);
00495 virtual void Load_End(char*&, const char*,long&);
00496 virtual void Load_PROTO(char*&, const char*,long&);
00497 virtual void Load_EXTERNPROTO(char*&, const char*,long&);
00498 virtual void Load_IS(char*&, const char*,long&);
00499
00500 };
00501
00502
00503 OAW_END_NAMESPACE
00504
00505
00506 #endif
00507
00509
00510
00511
00512
00513
00514
00515
00516