1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class QuadTreeTerrain!
50 *****************************************************************************
51 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
65 #include "OSGImage.h" // HeightData Class
66 #include "OSGGeoVectorProperty.h" // HeightVertices Class
68 #include "OSGQuadTreeTerrainBase.h"
69 #include "OSGQuadTreeTerrain.h"
71 #include <boost/bind.hpp>
75 /***************************************************************************\
77 \***************************************************************************/
79 /*! \class OSG::QuadTreeTerrain
83 /***************************************************************************\
84 * Field Documentation *
85 \***************************************************************************/
87 /*! \var Image * QuadTreeTerrainBase::_sfHeightData
88 Terrain height as image, must be of size 2^n+1 x 2^n+1.
91 /*! \var Real32 QuadTreeTerrainBase::_sfHeightScale
92 Scale factor for terrain height.
95 /*! \var Real32 QuadTreeTerrainBase::_mfHeightError
99 /*! \var Real32 QuadTreeTerrainBase::_mfHeightQuad
100 Vertex indices used in current tesselation (encoding terrain quadtree).
103 /*! \var Int32 QuadTreeTerrainBase::_sfWidth
104 Width and height of dataset.
107 /*! \var Int32 QuadTreeTerrainBase::_sfLevel
108 Levels of terrain quadtree.
111 /*! \var Real32 QuadTreeTerrainBase::_sfDetail
112 Detail of terrain tesselation.
115 /*! \var Int32 QuadTreeTerrainBase::_sfBorderDetail
116 Detail for borders (0: determined by height data, positive: borders at
120 /*! \var Real32 QuadTreeTerrainBase::_sfVertexSpacing
121 Spacing to horizontal and vertical neighbour vertices.
124 /*! \var GeoVectorProperty * QuadTreeTerrainBase::_sfHeightVertices
125 Precomputed terrain vertices.
128 /*! \var bool QuadTreeTerrainBase::_sfGeoMorphing
132 /*! \var Pnt3f QuadTreeTerrainBase::_sfBoundMin
136 /*! \var Pnt3f QuadTreeTerrainBase::_sfBoundMax
140 /*! \var Pnt3f QuadTreeTerrainBase::_sfEyePoint
141 Eye point of this frame.
144 /*! \var Real32 QuadTreeTerrainBase::_sfEyeHeight
145 Height of eye point above terrain.
148 /*! \var bool QuadTreeTerrainBase::_sfEyePointValid
149 Eye point set externally, otherwise it is computed internally.
152 /*! \var Real32 QuadTreeTerrainBase::_sfOriginX
153 X-component of terrain lower left point.
156 /*! \var Real32 QuadTreeTerrainBase::_sfOriginY
157 Y-component of terrain lower left point.
160 /*! \var Real32 QuadTreeTerrainBase::_sfOriginTexX
161 Texture X-component of terrain lower left point.
164 /*! \var Real32 QuadTreeTerrainBase::_sfOriginTexY
165 Texture Y-component of terrain lower left point.
168 /*! \var Real32 QuadTreeTerrainBase::_sfTexSpacing
169 Spacing of texture coordinates for horizontal (and vertical) neighbour
173 /*! \var Real32 QuadTreeTerrainBase::_sfTexYSpacing
174 Spacing of texture coordinates for vertical neighbour vertices.
177 /*! \var bool QuadTreeTerrainBase::_sfUpdateTerrain
178 Update terrain in next frame.
181 /*! \var bool QuadTreeTerrainBase::_sfPerPixelLighting
182 Do per-pixel lighting with normalmap; otherwise generate per-vertex normals.
186 /***************************************************************************\
187 * FieldType/FieldTrait Instantiation *
188 \***************************************************************************/
190 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
191 PointerType FieldTraits
<QuadTreeTerrain
*, nsOSG
>::_type(
192 "QuadTreeTerrainPtr",
194 QuadTreeTerrain::getClassType(),
198 OSG_FIELDTRAITS_GETTYPE_NS(QuadTreeTerrain
*, nsOSG
)
200 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
204 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
208 /***************************************************************************\
209 * Field Description *
210 \***************************************************************************/
212 void QuadTreeTerrainBase::classDescInserter(TypeObject
&oType
)
214 FieldDescriptionBase
*pDesc
= NULL
;
217 pDesc
= new SFUnrecImagePtr::Description(
218 SFUnrecImagePtr::getClassType(),
220 "Terrain height as image, must be of size 2^n+1 x 2^n+1.\n",
221 HeightDataFieldId
, HeightDataFieldMask
,
223 (Field::SFDefaultFlags
| Field::FStdAccess
),
224 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleHeightData
),
225 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleHeightData
));
227 oType
.addInitialDesc(pDesc
);
229 pDesc
= new SFReal32::Description(
230 SFReal32::getClassType(),
232 "Scale factor for terrain height.\n",
233 HeightScaleFieldId
, HeightScaleFieldMask
,
235 (Field::SFDefaultFlags
| Field::FStdAccess
),
236 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleHeightScale
),
237 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleHeightScale
));
239 oType
.addInitialDesc(pDesc
);
241 pDesc
= new MFReal32::Description(
242 MFReal32::getClassType(),
245 HeightErrorFieldId
, HeightErrorFieldMask
,
247 (Field::MFDefaultFlags
| Field::FStdAccess
),
248 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleHeightError
),
249 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleHeightError
));
251 oType
.addInitialDesc(pDesc
);
253 pDesc
= new MFReal32::Description(
254 MFReal32::getClassType(),
256 "Vertex indices used in current tesselation (encoding terrain quadtree).\n",
257 HeightQuadFieldId
, HeightQuadFieldMask
,
259 (Field::MFDefaultFlags
| Field::FStdAccess
),
260 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleHeightQuad
),
261 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleHeightQuad
));
263 oType
.addInitialDesc(pDesc
);
265 pDesc
= new SFInt32::Description(
266 SFInt32::getClassType(),
268 "Width and height of dataset.\n",
269 WidthFieldId
, WidthFieldMask
,
271 (Field::SFDefaultFlags
| Field::FStdAccess
),
272 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleWidth
),
273 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleWidth
));
275 oType
.addInitialDesc(pDesc
);
277 pDesc
= new SFInt32::Description(
278 SFInt32::getClassType(),
280 "Levels of terrain quadtree.\n",
281 LevelFieldId
, LevelFieldMask
,
283 (Field::SFDefaultFlags
| Field::FStdAccess
),
284 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleLevel
),
285 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleLevel
));
287 oType
.addInitialDesc(pDesc
);
289 pDesc
= new SFReal32::Description(
290 SFReal32::getClassType(),
292 "Detail of terrain tesselation.\n",
293 DetailFieldId
, DetailFieldMask
,
295 (Field::SFDefaultFlags
| Field::FStdAccess
),
296 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleDetail
),
297 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleDetail
));
299 oType
.addInitialDesc(pDesc
);
301 pDesc
= new SFInt32::Description(
302 SFInt32::getClassType(),
304 "Detail for borders (0: determined by height data, positive: borders at\n"
305 "level borderDetail). \n",
306 BorderDetailFieldId
, BorderDetailFieldMask
,
308 (Field::SFDefaultFlags
| Field::FStdAccess
),
309 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleBorderDetail
),
310 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleBorderDetail
));
312 oType
.addInitialDesc(pDesc
);
314 pDesc
= new SFReal32::Description(
315 SFReal32::getClassType(),
317 "Spacing to horizontal and vertical neighbour vertices.\n",
318 VertexSpacingFieldId
, VertexSpacingFieldMask
,
320 (Field::SFDefaultFlags
| Field::FStdAccess
),
321 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleVertexSpacing
),
322 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleVertexSpacing
));
324 oType
.addInitialDesc(pDesc
);
326 pDesc
= new SFUnrecGeoVectorPropertyPtr::Description(
327 SFUnrecGeoVectorPropertyPtr::getClassType(),
329 "Precomputed terrain vertices.\n",
330 HeightVerticesFieldId
, HeightVerticesFieldMask
,
332 (Field::SFDefaultFlags
| Field::FStdAccess
),
333 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleHeightVertices
),
334 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleHeightVertices
));
336 oType
.addInitialDesc(pDesc
);
338 pDesc
= new SFBool::Description(
339 SFBool::getClassType(),
342 GeoMorphingFieldId
, GeoMorphingFieldMask
,
344 (Field::SFDefaultFlags
| Field::FStdAccess
),
345 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleGeoMorphing
),
346 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleGeoMorphing
));
348 oType
.addInitialDesc(pDesc
);
350 pDesc
= new SFPnt3f::Description(
351 SFPnt3f::getClassType(),
353 "Min vertex of AABB.\n",
354 BoundMinFieldId
, BoundMinFieldMask
,
356 (Field::SFDefaultFlags
| Field::FStdAccess
),
357 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleBoundMin
),
358 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleBoundMin
));
360 oType
.addInitialDesc(pDesc
);
362 pDesc
= new SFPnt3f::Description(
363 SFPnt3f::getClassType(),
365 "Max vertex of AABB.\n",
366 BoundMaxFieldId
, BoundMaxFieldMask
,
368 (Field::SFDefaultFlags
| Field::FStdAccess
),
369 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleBoundMax
),
370 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleBoundMax
));
372 oType
.addInitialDesc(pDesc
);
374 pDesc
= new SFPnt3f::Description(
375 SFPnt3f::getClassType(),
377 "Eye point of this frame.\n",
378 EyePointFieldId
, EyePointFieldMask
,
380 (Field::SFDefaultFlags
| Field::FStdAccess
),
381 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleEyePoint
),
382 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleEyePoint
));
384 oType
.addInitialDesc(pDesc
);
386 pDesc
= new SFReal32::Description(
387 SFReal32::getClassType(),
389 "Height of eye point above terrain.\n",
390 EyeHeightFieldId
, EyeHeightFieldMask
,
392 (Field::SFDefaultFlags
| Field::FStdAccess
),
393 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleEyeHeight
),
394 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleEyeHeight
));
396 oType
.addInitialDesc(pDesc
);
398 pDesc
= new SFBool::Description(
399 SFBool::getClassType(),
401 "Eye point set externally, otherwise it is computed internally.\n",
402 EyePointValidFieldId
, EyePointValidFieldMask
,
404 (Field::SFDefaultFlags
| Field::FStdAccess
),
405 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleEyePointValid
),
406 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleEyePointValid
));
408 oType
.addInitialDesc(pDesc
);
410 pDesc
= new SFReal32::Description(
411 SFReal32::getClassType(),
413 "X-component of terrain lower left point.\n",
414 OriginXFieldId
, OriginXFieldMask
,
416 (Field::SFDefaultFlags
| Field::FStdAccess
),
417 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleOriginX
),
418 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleOriginX
));
420 oType
.addInitialDesc(pDesc
);
422 pDesc
= new SFReal32::Description(
423 SFReal32::getClassType(),
425 "Y-component of terrain lower left point.\n",
426 OriginYFieldId
, OriginYFieldMask
,
428 (Field::SFDefaultFlags
| Field::FStdAccess
),
429 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleOriginY
),
430 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleOriginY
));
432 oType
.addInitialDesc(pDesc
);
434 pDesc
= new SFReal32::Description(
435 SFReal32::getClassType(),
437 "Texture X-component of terrain lower left point.\n",
438 OriginTexXFieldId
, OriginTexXFieldMask
,
440 (Field::SFDefaultFlags
| Field::FStdAccess
),
441 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleOriginTexX
),
442 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleOriginTexX
));
444 oType
.addInitialDesc(pDesc
);
446 pDesc
= new SFReal32::Description(
447 SFReal32::getClassType(),
449 "Texture Y-component of terrain lower left point.\n",
450 OriginTexYFieldId
, OriginTexYFieldMask
,
452 (Field::SFDefaultFlags
| Field::FStdAccess
),
453 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleOriginTexY
),
454 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleOriginTexY
));
456 oType
.addInitialDesc(pDesc
);
458 pDesc
= new SFReal32::Description(
459 SFReal32::getClassType(),
461 "Spacing of texture coordinates for horizontal (and vertical) neighbour\n"
463 TexSpacingFieldId
, TexSpacingFieldMask
,
465 (Field::SFDefaultFlags
| Field::FStdAccess
),
466 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleTexSpacing
),
467 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleTexSpacing
));
469 oType
.addInitialDesc(pDesc
);
471 pDesc
= new SFReal32::Description(
472 SFReal32::getClassType(),
474 "Spacing of texture coordinates for vertical neighbour vertices.\n",
475 TexYSpacingFieldId
, TexYSpacingFieldMask
,
477 (Field::SFDefaultFlags
| Field::FStdAccess
),
478 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleTexYSpacing
),
479 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleTexYSpacing
));
481 oType
.addInitialDesc(pDesc
);
483 pDesc
= new SFBool::Description(
484 SFBool::getClassType(),
486 "Update terrain in next frame.\n",
487 UpdateTerrainFieldId
, UpdateTerrainFieldMask
,
489 (Field::SFDefaultFlags
| Field::FStdAccess
),
490 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandleUpdateTerrain
),
491 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandleUpdateTerrain
));
493 oType
.addInitialDesc(pDesc
);
495 pDesc
= new SFBool::Description(
496 SFBool::getClassType(),
498 "Do per-pixel lighting with normalmap; otherwise generate per-vertex normals.\n",
499 PerPixelLightingFieldId
, PerPixelLightingFieldMask
,
501 (Field::SFDefaultFlags
| Field::FStdAccess
),
502 static_cast<FieldEditMethodSig
>(&QuadTreeTerrain::editHandlePerPixelLighting
),
503 static_cast<FieldGetMethodSig
>(&QuadTreeTerrain::getHandlePerPixelLighting
));
505 oType
.addInitialDesc(pDesc
);
509 QuadTreeTerrainBase::TypeObject
QuadTreeTerrainBase::_type(
510 QuadTreeTerrainBase::getClassname(),
511 Inherited::getClassname(),
514 reinterpret_cast<PrototypeCreateF
>(&QuadTreeTerrainBase::createEmptyLocal
),
515 reinterpret_cast<InitContainerF
>(&QuadTreeTerrain::initMethod
),
516 reinterpret_cast<ExitContainerF
>(&QuadTreeTerrain::exitMethod
),
517 reinterpret_cast<InitalInsertDescFunc
>(
518 reinterpret_cast<void *>(&QuadTreeTerrain::classDescInserter
)),
521 "<?xml version=\"1.0\"?>\n"
524 " name=\"QuadTreeTerrain\"\n"
525 " parent=\"Geometry\"\n"
526 " library=\"Drawable\"\n"
527 " pointerfieldtypes=\"both\"\n"
528 " structure=\"concrete\"\n"
529 " systemcomponent=\"true\"\n"
530 " parentsystemcomponent=\"true\"\n"
531 " decoratable=\"false\"\n"
532 " useLocalIncludes=\"false\"\n"
533 " docGroupBase=\"GrpDrawablesTerrain\"\n"
535 " Terrain node core.\n"
537 "\t name=\"heightData\"\n"
538 "\t type=\"ImagePtr\"\n"
539 "\t cardinality=\"single\"\n"
540 "\t visibility=\"external\"\n"
541 "\t access=\"public\"\n"
543 "\tTerrain height as image, must be of size 2^n+1 x 2^n+1.\n"
546 "\t name=\"heightScale\"\n"
547 "\t type=\"Real32\"\n"
548 "\t cardinality=\"single\"\n"
549 "\t visibility=\"external\"\n"
550 "\t defaultValue=\"1.0f\"\n"
551 "\t access=\"public\"\n"
553 "\tScale factor for terrain height.\n"
556 "\t name=\"heightError\"\n"
557 "\t type=\"Real32\"\n"
558 "\t cardinality=\"multi\"\n"
559 "\t visibility=\"internal\"\n"
560 "\t access=\"public\"\n"
565 "\t name=\"heightQuad\"\n"
566 "\t type=\"Real32\"\n"
567 "\t cardinality=\"multi\"\n"
568 "\t visibility=\"internal\"\n"
569 "\t access=\"public\"\n"
571 "\tVertex indices used in current tesselation (encoding terrain quadtree).\n"
574 "\t name=\"width\"\n"
575 "\t type=\"Int32\"\n"
576 "\t cardinality=\"single\"\n"
577 "\t visibility=\"internal\"\n"
578 "\t defaultValue=\"0\"\n"
579 "\t access=\"protected\"\n"
581 "\tWidth and height of dataset.\n"
584 "\t name=\"level\"\n"
585 "\t type=\"Int32\"\n"
586 "\t cardinality=\"single\"\n"
587 "\t visibility=\"internal\"\n"
588 "\t defaultValue=\"1\"\n"
589 "\t access=\"protected\"\n"
591 "\tLevels of terrain quadtree.\n"
594 "\t name=\"detail\"\n"
595 "\t type=\"Real32\"\n"
596 "\t cardinality=\"single\"\n"
597 "\t visibility=\"external\"\n"
598 "\t defaultValue=\"22.0f\"\n"
599 "\t access=\"public\"\n"
601 "\tDetail of terrain tesselation.\n"
604 "\t name=\"borderDetail\"\n"
605 "\t type=\"Int32\"\n"
606 "\t cardinality=\"single\"\n"
607 "\t visibility=\"external\"\n"
608 "\t defaultValue=\"0\"\n"
609 "\t access=\"public\"\n"
611 "\tDetail for borders (0: determined by height data, positive: borders at\n"
612 "\tlevel borderDetail). \n"
615 "\t name=\"vertexSpacing\"\n"
616 "\t type=\"Real32\"\n"
617 "\t cardinality=\"single\"\n"
618 "\t visibility=\"external\"\n"
619 "\t defaultValue=\"0.1f\"\n"
620 "\t access=\"public\"\n"
622 "\tSpacing to horizontal and vertical neighbour vertices.\n"
625 "\t name=\"heightVertices\"\n"
626 "\t type=\"GeoVectorPropertyPtr\"\n"
627 "\t cardinality=\"single\"\n"
628 "\t visibility=\"internal\"\n"
629 "\t access=\"protected\"\n"
631 "\tPrecomputed terrain vertices.\n"
634 "\t name=\"geoMorphing\"\n"
636 "\t cardinality=\"single\"\n"
637 "\t visibility=\"external\"\n"
638 "\t defaultValue=\"false\"\n"
639 "\t access=\"public\"\n"
643 "\t name=\"boundMin\"\n"
644 "\t type=\"Pnt3f\"\n"
645 "\t cardinality=\"single\"\n"
646 "\t visibility=\"internal\"\n"
647 "\t access=\"protected\"\n"
649 "\tMin vertex of AABB.\n"
652 "\t name=\"boundMax\"\n"
653 "\t type=\"Pnt3f\"\n"
654 "\t cardinality=\"single\"\n"
655 "\t visibility=\"internal\"\n"
656 "\t access=\"protected\"\n"
658 "\tMax vertex of AABB.\n"
661 "\t name=\"eyePoint\"\n"
662 "\t type=\"Pnt3f\"\n"
663 "\t cardinality=\"single\"\n"
664 "\t visibility=\"external\"\n"
665 "\t access=\"public\"\n"
667 "\tEye point of this frame.\n"
670 "\t name=\"eyeHeight\"\n"
671 "\t type=\"Real32\"\n"
672 "\t cardinality=\"single\"\n"
673 "\t visibility=\"internal\"\n"
674 "\t defaultValue=\"0.0f\"\n"
675 "\t access=\"protected\"\n"
677 "\tHeight of eye point above terrain.\n"
680 "\t name=\"eyePointValid\"\n"
682 "\t cardinality=\"single\"\n"
683 "\t visibility=\"external\"\n"
684 "\t defaultValue=\"false\"\n"
685 "\t access=\"public\"\n"
687 "\tEye point set externally, otherwise it is computed internally.\n"
690 "\t name=\"originX\"\n"
691 "\t type=\"Real32\"\n"
692 "\t cardinality=\"single\"\n"
693 "\t visibility=\"external\"\n"
694 "\t defaultValue=\"0.0f\"\n"
695 "\t access=\"public\"\n"
697 "\tX-component of terrain lower left point.\n"
700 "\t name=\"originY\"\n"
701 "\t type=\"Real32\"\n"
702 "\t cardinality=\"single\"\n"
703 "\t visibility=\"external\"\n"
704 "\t defaultValue=\"0.0f\"\n"
705 "\t access=\"public\"\n"
707 "\tY-component of terrain lower left point.\n"
710 "\t name=\"originTexX\"\n"
711 "\t type=\"Real32\"\n"
712 "\t cardinality=\"single\"\n"
713 "\t visibility=\"external\"\n"
714 "\t defaultValue=\"0.0f\"\n"
715 "\t access=\"public\"\n"
717 "\tTexture X-component of terrain lower left point.\n"
720 "\t name=\"originTexY\"\n"
721 "\t type=\"Real32\"\n"
722 "\t cardinality=\"single\"\n"
723 "\t visibility=\"external\"\n"
724 "\t defaultValue=\"0.0f\"\n"
725 "\t access=\"public\"\n"
727 "\tTexture Y-component of terrain lower left point.\n"
730 "\t name=\"texSpacing\"\n"
731 "\t type=\"Real32\"\n"
732 "\t cardinality=\"single\"\n"
733 "\t visibility=\"external\"\n"
734 "\t defaultValue=\"1.0f\"\n"
735 "\t access=\"public\"\n"
737 "\tSpacing of texture coordinates for horizontal (and vertical) neighbour\n"
741 "\t name=\"texYSpacing\"\n"
742 "\t type=\"Real32\"\n"
743 "\t cardinality=\"single\"\n"
744 "\t visibility=\"external\"\n"
745 "\t defaultValue=\"1.0f\"\n"
746 "\t access=\"public\"\n"
748 "\tSpacing of texture coordinates for vertical neighbour vertices.\n"
751 "\t name=\"updateTerrain\"\n"
753 "\t cardinality=\"single\"\n"
754 "\t visibility=\"external\"\n"
755 "\t defaultValue=\"true\"\n"
756 "\t access=\"public\"\n"
758 "\tUpdate terrain in next frame.\n"
761 "\t name=\"perPixelLighting\"\n"
763 "\t cardinality=\"single\"\n"
764 "\t visibility=\"external\"\n"
765 "\t defaultValue=\"true\"\n"
766 "\t access=\"public\"\n"
768 "\tDo per-pixel lighting with normalmap; otherwise generate per-vertex normals.\n"
770 "</FieldContainer>\n",
771 "Terrain node core.\n"
774 /*------------------------------ get -----------------------------------*/
776 FieldContainerType
&QuadTreeTerrainBase::getType(void)
781 const FieldContainerType
&QuadTreeTerrainBase::getType(void) const
786 UInt32
QuadTreeTerrainBase::getContainerSize(void) const
788 return sizeof(QuadTreeTerrain
);
791 /*------------------------- decorator get ------------------------------*/
794 //! Get the QuadTreeTerrain::_sfHeightData field.
795 const SFUnrecImagePtr
*QuadTreeTerrainBase::getSFHeightData(void) const
797 return &_sfHeightData
;
800 SFUnrecImagePtr
*QuadTreeTerrainBase::editSFHeightData (void)
802 editSField(HeightDataFieldMask
);
804 return &_sfHeightData
;
807 //! Get the value of the QuadTreeTerrain::_sfHeightData field.
808 Image
* QuadTreeTerrainBase::getHeightData(void) const
810 return _sfHeightData
.getValue();
813 //! Set the value of the QuadTreeTerrain::_sfHeightData field.
814 void QuadTreeTerrainBase::setHeightData(Image
* const value
)
816 editSField(HeightDataFieldMask
);
818 _sfHeightData
.setValue(value
);
822 SFReal32
*QuadTreeTerrainBase::editSFHeightScale(void)
824 editSField(HeightScaleFieldMask
);
826 return &_sfHeightScale
;
829 const SFReal32
*QuadTreeTerrainBase::getSFHeightScale(void) const
831 return &_sfHeightScale
;
835 MFReal32
*QuadTreeTerrainBase::editMFHeightError(void)
837 editMField(HeightErrorFieldMask
, _mfHeightError
);
839 return &_mfHeightError
;
842 const MFReal32
*QuadTreeTerrainBase::getMFHeightError(void) const
844 return &_mfHeightError
;
848 MFReal32
*QuadTreeTerrainBase::editMFHeightQuad(void)
850 editMField(HeightQuadFieldMask
, _mfHeightQuad
);
852 return &_mfHeightQuad
;
855 const MFReal32
*QuadTreeTerrainBase::getMFHeightQuad(void) const
857 return &_mfHeightQuad
;
861 SFInt32
*QuadTreeTerrainBase::editSFWidth(void)
863 editSField(WidthFieldMask
);
868 const SFInt32
*QuadTreeTerrainBase::getSFWidth(void) const
874 SFInt32
*QuadTreeTerrainBase::editSFLevel(void)
876 editSField(LevelFieldMask
);
881 const SFInt32
*QuadTreeTerrainBase::getSFLevel(void) const
887 SFReal32
*QuadTreeTerrainBase::editSFDetail(void)
889 editSField(DetailFieldMask
);
894 const SFReal32
*QuadTreeTerrainBase::getSFDetail(void) const
900 SFInt32
*QuadTreeTerrainBase::editSFBorderDetail(void)
902 editSField(BorderDetailFieldMask
);
904 return &_sfBorderDetail
;
907 const SFInt32
*QuadTreeTerrainBase::getSFBorderDetail(void) const
909 return &_sfBorderDetail
;
913 SFReal32
*QuadTreeTerrainBase::editSFVertexSpacing(void)
915 editSField(VertexSpacingFieldMask
);
917 return &_sfVertexSpacing
;
920 const SFReal32
*QuadTreeTerrainBase::getSFVertexSpacing(void) const
922 return &_sfVertexSpacing
;
926 //! Get the QuadTreeTerrain::_sfHeightVertices field.
927 const SFUnrecGeoVectorPropertyPtr
*QuadTreeTerrainBase::getSFHeightVertices(void) const
929 return &_sfHeightVertices
;
932 SFUnrecGeoVectorPropertyPtr
*QuadTreeTerrainBase::editSFHeightVertices (void)
934 editSField(HeightVerticesFieldMask
);
936 return &_sfHeightVertices
;
939 //! Get the value of the QuadTreeTerrain::_sfHeightVertices field.
940 GeoVectorProperty
* QuadTreeTerrainBase::getHeightVertices(void) const
942 return _sfHeightVertices
.getValue();
945 //! Set the value of the QuadTreeTerrain::_sfHeightVertices field.
946 void QuadTreeTerrainBase::setHeightVertices(GeoVectorProperty
* const value
)
948 editSField(HeightVerticesFieldMask
);
950 _sfHeightVertices
.setValue(value
);
954 SFBool
*QuadTreeTerrainBase::editSFGeoMorphing(void)
956 editSField(GeoMorphingFieldMask
);
958 return &_sfGeoMorphing
;
961 const SFBool
*QuadTreeTerrainBase::getSFGeoMorphing(void) const
963 return &_sfGeoMorphing
;
967 SFPnt3f
*QuadTreeTerrainBase::editSFBoundMin(void)
969 editSField(BoundMinFieldMask
);
974 const SFPnt3f
*QuadTreeTerrainBase::getSFBoundMin(void) const
980 SFPnt3f
*QuadTreeTerrainBase::editSFBoundMax(void)
982 editSField(BoundMaxFieldMask
);
987 const SFPnt3f
*QuadTreeTerrainBase::getSFBoundMax(void) const
993 SFPnt3f
*QuadTreeTerrainBase::editSFEyePoint(void)
995 editSField(EyePointFieldMask
);
1000 const SFPnt3f
*QuadTreeTerrainBase::getSFEyePoint(void) const
1002 return &_sfEyePoint
;
1006 SFReal32
*QuadTreeTerrainBase::editSFEyeHeight(void)
1008 editSField(EyeHeightFieldMask
);
1010 return &_sfEyeHeight
;
1013 const SFReal32
*QuadTreeTerrainBase::getSFEyeHeight(void) const
1015 return &_sfEyeHeight
;
1019 SFBool
*QuadTreeTerrainBase::editSFEyePointValid(void)
1021 editSField(EyePointValidFieldMask
);
1023 return &_sfEyePointValid
;
1026 const SFBool
*QuadTreeTerrainBase::getSFEyePointValid(void) const
1028 return &_sfEyePointValid
;
1032 SFReal32
*QuadTreeTerrainBase::editSFOriginX(void)
1034 editSField(OriginXFieldMask
);
1039 const SFReal32
*QuadTreeTerrainBase::getSFOriginX(void) const
1045 SFReal32
*QuadTreeTerrainBase::editSFOriginY(void)
1047 editSField(OriginYFieldMask
);
1052 const SFReal32
*QuadTreeTerrainBase::getSFOriginY(void) const
1058 SFReal32
*QuadTreeTerrainBase::editSFOriginTexX(void)
1060 editSField(OriginTexXFieldMask
);
1062 return &_sfOriginTexX
;
1065 const SFReal32
*QuadTreeTerrainBase::getSFOriginTexX(void) const
1067 return &_sfOriginTexX
;
1071 SFReal32
*QuadTreeTerrainBase::editSFOriginTexY(void)
1073 editSField(OriginTexYFieldMask
);
1075 return &_sfOriginTexY
;
1078 const SFReal32
*QuadTreeTerrainBase::getSFOriginTexY(void) const
1080 return &_sfOriginTexY
;
1084 SFReal32
*QuadTreeTerrainBase::editSFTexSpacing(void)
1086 editSField(TexSpacingFieldMask
);
1088 return &_sfTexSpacing
;
1091 const SFReal32
*QuadTreeTerrainBase::getSFTexSpacing(void) const
1093 return &_sfTexSpacing
;
1097 SFReal32
*QuadTreeTerrainBase::editSFTexYSpacing(void)
1099 editSField(TexYSpacingFieldMask
);
1101 return &_sfTexYSpacing
;
1104 const SFReal32
*QuadTreeTerrainBase::getSFTexYSpacing(void) const
1106 return &_sfTexYSpacing
;
1110 SFBool
*QuadTreeTerrainBase::editSFUpdateTerrain(void)
1112 editSField(UpdateTerrainFieldMask
);
1114 return &_sfUpdateTerrain
;
1117 const SFBool
*QuadTreeTerrainBase::getSFUpdateTerrain(void) const
1119 return &_sfUpdateTerrain
;
1123 SFBool
*QuadTreeTerrainBase::editSFPerPixelLighting(void)
1125 editSField(PerPixelLightingFieldMask
);
1127 return &_sfPerPixelLighting
;
1130 const SFBool
*QuadTreeTerrainBase::getSFPerPixelLighting(void) const
1132 return &_sfPerPixelLighting
;
1140 /*------------------------------ access -----------------------------------*/
1142 SizeT
QuadTreeTerrainBase::getBinSize(ConstFieldMaskArg whichField
)
1144 SizeT returnValue
= Inherited::getBinSize(whichField
);
1146 if(FieldBits::NoField
!= (HeightDataFieldMask
& whichField
))
1148 returnValue
+= _sfHeightData
.getBinSize();
1150 if(FieldBits::NoField
!= (HeightScaleFieldMask
& whichField
))
1152 returnValue
+= _sfHeightScale
.getBinSize();
1154 if(FieldBits::NoField
!= (HeightErrorFieldMask
& whichField
))
1156 returnValue
+= _mfHeightError
.getBinSize();
1158 if(FieldBits::NoField
!= (HeightQuadFieldMask
& whichField
))
1160 returnValue
+= _mfHeightQuad
.getBinSize();
1162 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1164 returnValue
+= _sfWidth
.getBinSize();
1166 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
1168 returnValue
+= _sfLevel
.getBinSize();
1170 if(FieldBits::NoField
!= (DetailFieldMask
& whichField
))
1172 returnValue
+= _sfDetail
.getBinSize();
1174 if(FieldBits::NoField
!= (BorderDetailFieldMask
& whichField
))
1176 returnValue
+= _sfBorderDetail
.getBinSize();
1178 if(FieldBits::NoField
!= (VertexSpacingFieldMask
& whichField
))
1180 returnValue
+= _sfVertexSpacing
.getBinSize();
1182 if(FieldBits::NoField
!= (HeightVerticesFieldMask
& whichField
))
1184 returnValue
+= _sfHeightVertices
.getBinSize();
1186 if(FieldBits::NoField
!= (GeoMorphingFieldMask
& whichField
))
1188 returnValue
+= _sfGeoMorphing
.getBinSize();
1190 if(FieldBits::NoField
!= (BoundMinFieldMask
& whichField
))
1192 returnValue
+= _sfBoundMin
.getBinSize();
1194 if(FieldBits::NoField
!= (BoundMaxFieldMask
& whichField
))
1196 returnValue
+= _sfBoundMax
.getBinSize();
1198 if(FieldBits::NoField
!= (EyePointFieldMask
& whichField
))
1200 returnValue
+= _sfEyePoint
.getBinSize();
1202 if(FieldBits::NoField
!= (EyeHeightFieldMask
& whichField
))
1204 returnValue
+= _sfEyeHeight
.getBinSize();
1206 if(FieldBits::NoField
!= (EyePointValidFieldMask
& whichField
))
1208 returnValue
+= _sfEyePointValid
.getBinSize();
1210 if(FieldBits::NoField
!= (OriginXFieldMask
& whichField
))
1212 returnValue
+= _sfOriginX
.getBinSize();
1214 if(FieldBits::NoField
!= (OriginYFieldMask
& whichField
))
1216 returnValue
+= _sfOriginY
.getBinSize();
1218 if(FieldBits::NoField
!= (OriginTexXFieldMask
& whichField
))
1220 returnValue
+= _sfOriginTexX
.getBinSize();
1222 if(FieldBits::NoField
!= (OriginTexYFieldMask
& whichField
))
1224 returnValue
+= _sfOriginTexY
.getBinSize();
1226 if(FieldBits::NoField
!= (TexSpacingFieldMask
& whichField
))
1228 returnValue
+= _sfTexSpacing
.getBinSize();
1230 if(FieldBits::NoField
!= (TexYSpacingFieldMask
& whichField
))
1232 returnValue
+= _sfTexYSpacing
.getBinSize();
1234 if(FieldBits::NoField
!= (UpdateTerrainFieldMask
& whichField
))
1236 returnValue
+= _sfUpdateTerrain
.getBinSize();
1238 if(FieldBits::NoField
!= (PerPixelLightingFieldMask
& whichField
))
1240 returnValue
+= _sfPerPixelLighting
.getBinSize();
1246 void QuadTreeTerrainBase::copyToBin(BinaryDataHandler
&pMem
,
1247 ConstFieldMaskArg whichField
)
1249 Inherited::copyToBin(pMem
, whichField
);
1251 if(FieldBits::NoField
!= (HeightDataFieldMask
& whichField
))
1253 _sfHeightData
.copyToBin(pMem
);
1255 if(FieldBits::NoField
!= (HeightScaleFieldMask
& whichField
))
1257 _sfHeightScale
.copyToBin(pMem
);
1259 if(FieldBits::NoField
!= (HeightErrorFieldMask
& whichField
))
1261 _mfHeightError
.copyToBin(pMem
);
1263 if(FieldBits::NoField
!= (HeightQuadFieldMask
& whichField
))
1265 _mfHeightQuad
.copyToBin(pMem
);
1267 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1269 _sfWidth
.copyToBin(pMem
);
1271 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
1273 _sfLevel
.copyToBin(pMem
);
1275 if(FieldBits::NoField
!= (DetailFieldMask
& whichField
))
1277 _sfDetail
.copyToBin(pMem
);
1279 if(FieldBits::NoField
!= (BorderDetailFieldMask
& whichField
))
1281 _sfBorderDetail
.copyToBin(pMem
);
1283 if(FieldBits::NoField
!= (VertexSpacingFieldMask
& whichField
))
1285 _sfVertexSpacing
.copyToBin(pMem
);
1287 if(FieldBits::NoField
!= (HeightVerticesFieldMask
& whichField
))
1289 _sfHeightVertices
.copyToBin(pMem
);
1291 if(FieldBits::NoField
!= (GeoMorphingFieldMask
& whichField
))
1293 _sfGeoMorphing
.copyToBin(pMem
);
1295 if(FieldBits::NoField
!= (BoundMinFieldMask
& whichField
))
1297 _sfBoundMin
.copyToBin(pMem
);
1299 if(FieldBits::NoField
!= (BoundMaxFieldMask
& whichField
))
1301 _sfBoundMax
.copyToBin(pMem
);
1303 if(FieldBits::NoField
!= (EyePointFieldMask
& whichField
))
1305 _sfEyePoint
.copyToBin(pMem
);
1307 if(FieldBits::NoField
!= (EyeHeightFieldMask
& whichField
))
1309 _sfEyeHeight
.copyToBin(pMem
);
1311 if(FieldBits::NoField
!= (EyePointValidFieldMask
& whichField
))
1313 _sfEyePointValid
.copyToBin(pMem
);
1315 if(FieldBits::NoField
!= (OriginXFieldMask
& whichField
))
1317 _sfOriginX
.copyToBin(pMem
);
1319 if(FieldBits::NoField
!= (OriginYFieldMask
& whichField
))
1321 _sfOriginY
.copyToBin(pMem
);
1323 if(FieldBits::NoField
!= (OriginTexXFieldMask
& whichField
))
1325 _sfOriginTexX
.copyToBin(pMem
);
1327 if(FieldBits::NoField
!= (OriginTexYFieldMask
& whichField
))
1329 _sfOriginTexY
.copyToBin(pMem
);
1331 if(FieldBits::NoField
!= (TexSpacingFieldMask
& whichField
))
1333 _sfTexSpacing
.copyToBin(pMem
);
1335 if(FieldBits::NoField
!= (TexYSpacingFieldMask
& whichField
))
1337 _sfTexYSpacing
.copyToBin(pMem
);
1339 if(FieldBits::NoField
!= (UpdateTerrainFieldMask
& whichField
))
1341 _sfUpdateTerrain
.copyToBin(pMem
);
1343 if(FieldBits::NoField
!= (PerPixelLightingFieldMask
& whichField
))
1345 _sfPerPixelLighting
.copyToBin(pMem
);
1349 void QuadTreeTerrainBase::copyFromBin(BinaryDataHandler
&pMem
,
1350 ConstFieldMaskArg whichField
)
1352 Inherited::copyFromBin(pMem
, whichField
);
1354 if(FieldBits::NoField
!= (HeightDataFieldMask
& whichField
))
1356 editSField(HeightDataFieldMask
);
1357 _sfHeightData
.copyFromBin(pMem
);
1359 if(FieldBits::NoField
!= (HeightScaleFieldMask
& whichField
))
1361 editSField(HeightScaleFieldMask
);
1362 _sfHeightScale
.copyFromBin(pMem
);
1364 if(FieldBits::NoField
!= (HeightErrorFieldMask
& whichField
))
1366 editMField(HeightErrorFieldMask
, _mfHeightError
);
1367 _mfHeightError
.copyFromBin(pMem
);
1369 if(FieldBits::NoField
!= (HeightQuadFieldMask
& whichField
))
1371 editMField(HeightQuadFieldMask
, _mfHeightQuad
);
1372 _mfHeightQuad
.copyFromBin(pMem
);
1374 if(FieldBits::NoField
!= (WidthFieldMask
& whichField
))
1376 editSField(WidthFieldMask
);
1377 _sfWidth
.copyFromBin(pMem
);
1379 if(FieldBits::NoField
!= (LevelFieldMask
& whichField
))
1381 editSField(LevelFieldMask
);
1382 _sfLevel
.copyFromBin(pMem
);
1384 if(FieldBits::NoField
!= (DetailFieldMask
& whichField
))
1386 editSField(DetailFieldMask
);
1387 _sfDetail
.copyFromBin(pMem
);
1389 if(FieldBits::NoField
!= (BorderDetailFieldMask
& whichField
))
1391 editSField(BorderDetailFieldMask
);
1392 _sfBorderDetail
.copyFromBin(pMem
);
1394 if(FieldBits::NoField
!= (VertexSpacingFieldMask
& whichField
))
1396 editSField(VertexSpacingFieldMask
);
1397 _sfVertexSpacing
.copyFromBin(pMem
);
1399 if(FieldBits::NoField
!= (HeightVerticesFieldMask
& whichField
))
1401 editSField(HeightVerticesFieldMask
);
1402 _sfHeightVertices
.copyFromBin(pMem
);
1404 if(FieldBits::NoField
!= (GeoMorphingFieldMask
& whichField
))
1406 editSField(GeoMorphingFieldMask
);
1407 _sfGeoMorphing
.copyFromBin(pMem
);
1409 if(FieldBits::NoField
!= (BoundMinFieldMask
& whichField
))
1411 editSField(BoundMinFieldMask
);
1412 _sfBoundMin
.copyFromBin(pMem
);
1414 if(FieldBits::NoField
!= (BoundMaxFieldMask
& whichField
))
1416 editSField(BoundMaxFieldMask
);
1417 _sfBoundMax
.copyFromBin(pMem
);
1419 if(FieldBits::NoField
!= (EyePointFieldMask
& whichField
))
1421 editSField(EyePointFieldMask
);
1422 _sfEyePoint
.copyFromBin(pMem
);
1424 if(FieldBits::NoField
!= (EyeHeightFieldMask
& whichField
))
1426 editSField(EyeHeightFieldMask
);
1427 _sfEyeHeight
.copyFromBin(pMem
);
1429 if(FieldBits::NoField
!= (EyePointValidFieldMask
& whichField
))
1431 editSField(EyePointValidFieldMask
);
1432 _sfEyePointValid
.copyFromBin(pMem
);
1434 if(FieldBits::NoField
!= (OriginXFieldMask
& whichField
))
1436 editSField(OriginXFieldMask
);
1437 _sfOriginX
.copyFromBin(pMem
);
1439 if(FieldBits::NoField
!= (OriginYFieldMask
& whichField
))
1441 editSField(OriginYFieldMask
);
1442 _sfOriginY
.copyFromBin(pMem
);
1444 if(FieldBits::NoField
!= (OriginTexXFieldMask
& whichField
))
1446 editSField(OriginTexXFieldMask
);
1447 _sfOriginTexX
.copyFromBin(pMem
);
1449 if(FieldBits::NoField
!= (OriginTexYFieldMask
& whichField
))
1451 editSField(OriginTexYFieldMask
);
1452 _sfOriginTexY
.copyFromBin(pMem
);
1454 if(FieldBits::NoField
!= (TexSpacingFieldMask
& whichField
))
1456 editSField(TexSpacingFieldMask
);
1457 _sfTexSpacing
.copyFromBin(pMem
);
1459 if(FieldBits::NoField
!= (TexYSpacingFieldMask
& whichField
))
1461 editSField(TexYSpacingFieldMask
);
1462 _sfTexYSpacing
.copyFromBin(pMem
);
1464 if(FieldBits::NoField
!= (UpdateTerrainFieldMask
& whichField
))
1466 editSField(UpdateTerrainFieldMask
);
1467 _sfUpdateTerrain
.copyFromBin(pMem
);
1469 if(FieldBits::NoField
!= (PerPixelLightingFieldMask
& whichField
))
1471 editSField(PerPixelLightingFieldMask
);
1472 _sfPerPixelLighting
.copyFromBin(pMem
);
1476 //! create a new instance of the class
1477 QuadTreeTerrainTransitPtr
QuadTreeTerrainBase::createLocal(BitVector bFlags
)
1479 QuadTreeTerrainTransitPtr fc
;
1481 if(getClassType().getPrototype() != NULL
)
1483 FieldContainerTransitPtr tmpPtr
=
1484 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
1486 fc
= dynamic_pointer_cast
<QuadTreeTerrain
>(tmpPtr
);
1492 //! create a new instance of the class, copy the container flags
1493 QuadTreeTerrainTransitPtr
QuadTreeTerrainBase::createDependent(BitVector bFlags
)
1495 QuadTreeTerrainTransitPtr fc
;
1497 if(getClassType().getPrototype() != NULL
)
1499 FieldContainerTransitPtr tmpPtr
=
1500 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
1502 fc
= dynamic_pointer_cast
<QuadTreeTerrain
>(tmpPtr
);
1508 //! create a new instance of the class
1509 QuadTreeTerrainTransitPtr
QuadTreeTerrainBase::create(void)
1511 QuadTreeTerrainTransitPtr fc
;
1513 if(getClassType().getPrototype() != NULL
)
1515 FieldContainerTransitPtr tmpPtr
=
1516 getClassType().getPrototype()-> shallowCopy();
1518 fc
= dynamic_pointer_cast
<QuadTreeTerrain
>(tmpPtr
);
1524 QuadTreeTerrain
*QuadTreeTerrainBase::createEmptyLocal(BitVector bFlags
)
1526 QuadTreeTerrain
*returnValue
;
1528 newPtr
<QuadTreeTerrain
>(returnValue
, bFlags
);
1530 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1535 //! create an empty new instance of the class, do not copy the prototype
1536 QuadTreeTerrain
*QuadTreeTerrainBase::createEmpty(void)
1538 QuadTreeTerrain
*returnValue
;
1540 newPtr
<QuadTreeTerrain
>(returnValue
, Thread::getCurrentLocalFlags());
1542 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
1543 ~Thread::getCurrentLocalFlags();
1549 FieldContainerTransitPtr
QuadTreeTerrainBase::shallowCopyLocal(
1550 BitVector bFlags
) const
1552 QuadTreeTerrain
*tmpPtr
;
1554 newPtr(tmpPtr
, dynamic_cast<const QuadTreeTerrain
*>(this), bFlags
);
1556 FieldContainerTransitPtr
returnValue(tmpPtr
);
1558 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
1563 FieldContainerTransitPtr
QuadTreeTerrainBase::shallowCopyDependent(
1564 BitVector bFlags
) const
1566 QuadTreeTerrain
*tmpPtr
;
1568 newPtr(tmpPtr
, dynamic_cast<const QuadTreeTerrain
*>(this), ~bFlags
);
1570 FieldContainerTransitPtr
returnValue(tmpPtr
);
1572 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1577 FieldContainerTransitPtr
QuadTreeTerrainBase::shallowCopy(void) const
1579 QuadTreeTerrain
*tmpPtr
;
1582 dynamic_cast<const QuadTreeTerrain
*>(this),
1583 Thread::getCurrentLocalFlags());
1585 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
1587 FieldContainerTransitPtr
returnValue(tmpPtr
);
1595 /*------------------------- constructors ----------------------------------*/
1597 QuadTreeTerrainBase::QuadTreeTerrainBase(void) :
1599 _sfHeightData (NULL
),
1600 _sfHeightScale (Real32(1.0f
)),
1603 _sfWidth (Int32(0)),
1604 _sfLevel (Int32(1)),
1605 _sfDetail (Real32(22.0f
)),
1606 _sfBorderDetail (Int32(0)),
1607 _sfVertexSpacing (Real32(0.1f
)),
1608 _sfHeightVertices (NULL
),
1609 _sfGeoMorphing (bool(false)),
1613 _sfEyeHeight (Real32(0.0f
)),
1614 _sfEyePointValid (bool(false)),
1615 _sfOriginX (Real32(0.0f
)),
1616 _sfOriginY (Real32(0.0f
)),
1617 _sfOriginTexX (Real32(0.0f
)),
1618 _sfOriginTexY (Real32(0.0f
)),
1619 _sfTexSpacing (Real32(1.0f
)),
1620 _sfTexYSpacing (Real32(1.0f
)),
1621 _sfUpdateTerrain (bool(true)),
1622 _sfPerPixelLighting (bool(true))
1626 QuadTreeTerrainBase::QuadTreeTerrainBase(const QuadTreeTerrainBase
&source
) :
1628 _sfHeightData (NULL
),
1629 _sfHeightScale (source
._sfHeightScale
),
1630 _mfHeightError (source
._mfHeightError
),
1631 _mfHeightQuad (source
._mfHeightQuad
),
1632 _sfWidth (source
._sfWidth
),
1633 _sfLevel (source
._sfLevel
),
1634 _sfDetail (source
._sfDetail
),
1635 _sfBorderDetail (source
._sfBorderDetail
),
1636 _sfVertexSpacing (source
._sfVertexSpacing
),
1637 _sfHeightVertices (NULL
),
1638 _sfGeoMorphing (source
._sfGeoMorphing
),
1639 _sfBoundMin (source
._sfBoundMin
),
1640 _sfBoundMax (source
._sfBoundMax
),
1641 _sfEyePoint (source
._sfEyePoint
),
1642 _sfEyeHeight (source
._sfEyeHeight
),
1643 _sfEyePointValid (source
._sfEyePointValid
),
1644 _sfOriginX (source
._sfOriginX
),
1645 _sfOriginY (source
._sfOriginY
),
1646 _sfOriginTexX (source
._sfOriginTexX
),
1647 _sfOriginTexY (source
._sfOriginTexY
),
1648 _sfTexSpacing (source
._sfTexSpacing
),
1649 _sfTexYSpacing (source
._sfTexYSpacing
),
1650 _sfUpdateTerrain (source
._sfUpdateTerrain
),
1651 _sfPerPixelLighting (source
._sfPerPixelLighting
)
1656 /*-------------------------- destructors ----------------------------------*/
1658 QuadTreeTerrainBase::~QuadTreeTerrainBase(void)
1662 void QuadTreeTerrainBase::onCreate(const QuadTreeTerrain
*source
)
1664 Inherited::onCreate(source
);
1668 QuadTreeTerrain
*pThis
= static_cast<QuadTreeTerrain
*>(this);
1670 pThis
->setHeightData(source
->getHeightData());
1672 pThis
->setHeightVertices(source
->getHeightVertices());
1676 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleHeightData (void) const
1678 SFUnrecImagePtr::GetHandlePtr
returnValue(
1679 new SFUnrecImagePtr::GetHandle(
1681 this->getType().getFieldDesc(HeightDataFieldId
),
1682 const_cast<QuadTreeTerrainBase
*>(this)));
1687 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleHeightData (void)
1689 SFUnrecImagePtr::EditHandlePtr
returnValue(
1690 new SFUnrecImagePtr::EditHandle(
1692 this->getType().getFieldDesc(HeightDataFieldId
),
1695 returnValue
->setSetMethod(
1696 boost::bind(&QuadTreeTerrain::setHeightData
,
1697 static_cast<QuadTreeTerrain
*>(this), _1
));
1699 editSField(HeightDataFieldMask
);
1704 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleHeightScale (void) const
1706 SFReal32::GetHandlePtr
returnValue(
1707 new SFReal32::GetHandle(
1709 this->getType().getFieldDesc(HeightScaleFieldId
),
1710 const_cast<QuadTreeTerrainBase
*>(this)));
1715 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleHeightScale (void)
1717 SFReal32::EditHandlePtr
returnValue(
1718 new SFReal32::EditHandle(
1720 this->getType().getFieldDesc(HeightScaleFieldId
),
1724 editSField(HeightScaleFieldMask
);
1729 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleHeightError (void) const
1731 MFReal32::GetHandlePtr
returnValue(
1732 new MFReal32::GetHandle(
1734 this->getType().getFieldDesc(HeightErrorFieldId
),
1735 const_cast<QuadTreeTerrainBase
*>(this)));
1740 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleHeightError (void)
1742 MFReal32::EditHandlePtr
returnValue(
1743 new MFReal32::EditHandle(
1745 this->getType().getFieldDesc(HeightErrorFieldId
),
1749 editMField(HeightErrorFieldMask
, _mfHeightError
);
1754 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleHeightQuad (void) const
1756 MFReal32::GetHandlePtr
returnValue(
1757 new MFReal32::GetHandle(
1759 this->getType().getFieldDesc(HeightQuadFieldId
),
1760 const_cast<QuadTreeTerrainBase
*>(this)));
1765 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleHeightQuad (void)
1767 MFReal32::EditHandlePtr
returnValue(
1768 new MFReal32::EditHandle(
1770 this->getType().getFieldDesc(HeightQuadFieldId
),
1774 editMField(HeightQuadFieldMask
, _mfHeightQuad
);
1779 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleWidth (void) const
1781 SFInt32::GetHandlePtr
returnValue(
1782 new SFInt32::GetHandle(
1784 this->getType().getFieldDesc(WidthFieldId
),
1785 const_cast<QuadTreeTerrainBase
*>(this)));
1790 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleWidth (void)
1792 SFInt32::EditHandlePtr
returnValue(
1793 new SFInt32::EditHandle(
1795 this->getType().getFieldDesc(WidthFieldId
),
1799 editSField(WidthFieldMask
);
1804 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleLevel (void) const
1806 SFInt32::GetHandlePtr
returnValue(
1807 new SFInt32::GetHandle(
1809 this->getType().getFieldDesc(LevelFieldId
),
1810 const_cast<QuadTreeTerrainBase
*>(this)));
1815 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleLevel (void)
1817 SFInt32::EditHandlePtr
returnValue(
1818 new SFInt32::EditHandle(
1820 this->getType().getFieldDesc(LevelFieldId
),
1824 editSField(LevelFieldMask
);
1829 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleDetail (void) const
1831 SFReal32::GetHandlePtr
returnValue(
1832 new SFReal32::GetHandle(
1834 this->getType().getFieldDesc(DetailFieldId
),
1835 const_cast<QuadTreeTerrainBase
*>(this)));
1840 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleDetail (void)
1842 SFReal32::EditHandlePtr
returnValue(
1843 new SFReal32::EditHandle(
1845 this->getType().getFieldDesc(DetailFieldId
),
1849 editSField(DetailFieldMask
);
1854 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleBorderDetail (void) const
1856 SFInt32::GetHandlePtr
returnValue(
1857 new SFInt32::GetHandle(
1859 this->getType().getFieldDesc(BorderDetailFieldId
),
1860 const_cast<QuadTreeTerrainBase
*>(this)));
1865 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleBorderDetail (void)
1867 SFInt32::EditHandlePtr
returnValue(
1868 new SFInt32::EditHandle(
1870 this->getType().getFieldDesc(BorderDetailFieldId
),
1874 editSField(BorderDetailFieldMask
);
1879 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleVertexSpacing (void) const
1881 SFReal32::GetHandlePtr
returnValue(
1882 new SFReal32::GetHandle(
1884 this->getType().getFieldDesc(VertexSpacingFieldId
),
1885 const_cast<QuadTreeTerrainBase
*>(this)));
1890 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleVertexSpacing (void)
1892 SFReal32::EditHandlePtr
returnValue(
1893 new SFReal32::EditHandle(
1895 this->getType().getFieldDesc(VertexSpacingFieldId
),
1899 editSField(VertexSpacingFieldMask
);
1904 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleHeightVertices (void) const
1906 SFUnrecGeoVectorPropertyPtr::GetHandlePtr
returnValue(
1907 new SFUnrecGeoVectorPropertyPtr::GetHandle(
1909 this->getType().getFieldDesc(HeightVerticesFieldId
),
1910 const_cast<QuadTreeTerrainBase
*>(this)));
1915 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleHeightVertices (void)
1917 SFUnrecGeoVectorPropertyPtr::EditHandlePtr
returnValue(
1918 new SFUnrecGeoVectorPropertyPtr::EditHandle(
1920 this->getType().getFieldDesc(HeightVerticesFieldId
),
1923 returnValue
->setSetMethod(
1924 boost::bind(&QuadTreeTerrain::setHeightVertices
,
1925 static_cast<QuadTreeTerrain
*>(this), _1
));
1927 editSField(HeightVerticesFieldMask
);
1932 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleGeoMorphing (void) const
1934 SFBool::GetHandlePtr
returnValue(
1935 new SFBool::GetHandle(
1937 this->getType().getFieldDesc(GeoMorphingFieldId
),
1938 const_cast<QuadTreeTerrainBase
*>(this)));
1943 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleGeoMorphing (void)
1945 SFBool::EditHandlePtr
returnValue(
1946 new SFBool::EditHandle(
1948 this->getType().getFieldDesc(GeoMorphingFieldId
),
1952 editSField(GeoMorphingFieldMask
);
1957 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleBoundMin (void) const
1959 SFPnt3f::GetHandlePtr
returnValue(
1960 new SFPnt3f::GetHandle(
1962 this->getType().getFieldDesc(BoundMinFieldId
),
1963 const_cast<QuadTreeTerrainBase
*>(this)));
1968 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleBoundMin (void)
1970 SFPnt3f::EditHandlePtr
returnValue(
1971 new SFPnt3f::EditHandle(
1973 this->getType().getFieldDesc(BoundMinFieldId
),
1977 editSField(BoundMinFieldMask
);
1982 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleBoundMax (void) const
1984 SFPnt3f::GetHandlePtr
returnValue(
1985 new SFPnt3f::GetHandle(
1987 this->getType().getFieldDesc(BoundMaxFieldId
),
1988 const_cast<QuadTreeTerrainBase
*>(this)));
1993 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleBoundMax (void)
1995 SFPnt3f::EditHandlePtr
returnValue(
1996 new SFPnt3f::EditHandle(
1998 this->getType().getFieldDesc(BoundMaxFieldId
),
2002 editSField(BoundMaxFieldMask
);
2007 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleEyePoint (void) const
2009 SFPnt3f::GetHandlePtr
returnValue(
2010 new SFPnt3f::GetHandle(
2012 this->getType().getFieldDesc(EyePointFieldId
),
2013 const_cast<QuadTreeTerrainBase
*>(this)));
2018 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleEyePoint (void)
2020 SFPnt3f::EditHandlePtr
returnValue(
2021 new SFPnt3f::EditHandle(
2023 this->getType().getFieldDesc(EyePointFieldId
),
2027 editSField(EyePointFieldMask
);
2032 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleEyeHeight (void) const
2034 SFReal32::GetHandlePtr
returnValue(
2035 new SFReal32::GetHandle(
2037 this->getType().getFieldDesc(EyeHeightFieldId
),
2038 const_cast<QuadTreeTerrainBase
*>(this)));
2043 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleEyeHeight (void)
2045 SFReal32::EditHandlePtr
returnValue(
2046 new SFReal32::EditHandle(
2048 this->getType().getFieldDesc(EyeHeightFieldId
),
2052 editSField(EyeHeightFieldMask
);
2057 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleEyePointValid (void) const
2059 SFBool::GetHandlePtr
returnValue(
2060 new SFBool::GetHandle(
2062 this->getType().getFieldDesc(EyePointValidFieldId
),
2063 const_cast<QuadTreeTerrainBase
*>(this)));
2068 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleEyePointValid (void)
2070 SFBool::EditHandlePtr
returnValue(
2071 new SFBool::EditHandle(
2073 this->getType().getFieldDesc(EyePointValidFieldId
),
2077 editSField(EyePointValidFieldMask
);
2082 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleOriginX (void) const
2084 SFReal32::GetHandlePtr
returnValue(
2085 new SFReal32::GetHandle(
2087 this->getType().getFieldDesc(OriginXFieldId
),
2088 const_cast<QuadTreeTerrainBase
*>(this)));
2093 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleOriginX (void)
2095 SFReal32::EditHandlePtr
returnValue(
2096 new SFReal32::EditHandle(
2098 this->getType().getFieldDesc(OriginXFieldId
),
2102 editSField(OriginXFieldMask
);
2107 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleOriginY (void) const
2109 SFReal32::GetHandlePtr
returnValue(
2110 new SFReal32::GetHandle(
2112 this->getType().getFieldDesc(OriginYFieldId
),
2113 const_cast<QuadTreeTerrainBase
*>(this)));
2118 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleOriginY (void)
2120 SFReal32::EditHandlePtr
returnValue(
2121 new SFReal32::EditHandle(
2123 this->getType().getFieldDesc(OriginYFieldId
),
2127 editSField(OriginYFieldMask
);
2132 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleOriginTexX (void) const
2134 SFReal32::GetHandlePtr
returnValue(
2135 new SFReal32::GetHandle(
2137 this->getType().getFieldDesc(OriginTexXFieldId
),
2138 const_cast<QuadTreeTerrainBase
*>(this)));
2143 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleOriginTexX (void)
2145 SFReal32::EditHandlePtr
returnValue(
2146 new SFReal32::EditHandle(
2148 this->getType().getFieldDesc(OriginTexXFieldId
),
2152 editSField(OriginTexXFieldMask
);
2157 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleOriginTexY (void) const
2159 SFReal32::GetHandlePtr
returnValue(
2160 new SFReal32::GetHandle(
2162 this->getType().getFieldDesc(OriginTexYFieldId
),
2163 const_cast<QuadTreeTerrainBase
*>(this)));
2168 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleOriginTexY (void)
2170 SFReal32::EditHandlePtr
returnValue(
2171 new SFReal32::EditHandle(
2173 this->getType().getFieldDesc(OriginTexYFieldId
),
2177 editSField(OriginTexYFieldMask
);
2182 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleTexSpacing (void) const
2184 SFReal32::GetHandlePtr
returnValue(
2185 new SFReal32::GetHandle(
2187 this->getType().getFieldDesc(TexSpacingFieldId
),
2188 const_cast<QuadTreeTerrainBase
*>(this)));
2193 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleTexSpacing (void)
2195 SFReal32::EditHandlePtr
returnValue(
2196 new SFReal32::EditHandle(
2198 this->getType().getFieldDesc(TexSpacingFieldId
),
2202 editSField(TexSpacingFieldMask
);
2207 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleTexYSpacing (void) const
2209 SFReal32::GetHandlePtr
returnValue(
2210 new SFReal32::GetHandle(
2212 this->getType().getFieldDesc(TexYSpacingFieldId
),
2213 const_cast<QuadTreeTerrainBase
*>(this)));
2218 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleTexYSpacing (void)
2220 SFReal32::EditHandlePtr
returnValue(
2221 new SFReal32::EditHandle(
2223 this->getType().getFieldDesc(TexYSpacingFieldId
),
2227 editSField(TexYSpacingFieldMask
);
2232 GetFieldHandlePtr
QuadTreeTerrainBase::getHandleUpdateTerrain (void) const
2234 SFBool::GetHandlePtr
returnValue(
2235 new SFBool::GetHandle(
2237 this->getType().getFieldDesc(UpdateTerrainFieldId
),
2238 const_cast<QuadTreeTerrainBase
*>(this)));
2243 EditFieldHandlePtr
QuadTreeTerrainBase::editHandleUpdateTerrain (void)
2245 SFBool::EditHandlePtr
returnValue(
2246 new SFBool::EditHandle(
2248 this->getType().getFieldDesc(UpdateTerrainFieldId
),
2252 editSField(UpdateTerrainFieldMask
);
2257 GetFieldHandlePtr
QuadTreeTerrainBase::getHandlePerPixelLighting (void) const
2259 SFBool::GetHandlePtr
returnValue(
2260 new SFBool::GetHandle(
2261 &_sfPerPixelLighting
,
2262 this->getType().getFieldDesc(PerPixelLightingFieldId
),
2263 const_cast<QuadTreeTerrainBase
*>(this)));
2268 EditFieldHandlePtr
QuadTreeTerrainBase::editHandlePerPixelLighting(void)
2270 SFBool::EditHandlePtr
returnValue(
2271 new SFBool::EditHandle(
2272 &_sfPerPixelLighting
,
2273 this->getType().getFieldDesc(PerPixelLightingFieldId
),
2277 editSField(PerPixelLightingFieldMask
);
2283 #ifdef OSG_MT_CPTR_ASPECT
2284 void QuadTreeTerrainBase::execSyncV( FieldContainer
&oFrom
,
2285 ConstFieldMaskArg whichField
,
2286 AspectOffsetStore
&oOffsets
,
2287 ConstFieldMaskArg syncMode
,
2288 const UInt32 uiSyncInfo
)
2290 QuadTreeTerrain
*pThis
= static_cast<QuadTreeTerrain
*>(this);
2292 pThis
->execSync(static_cast<QuadTreeTerrain
*>(&oFrom
),
2301 #ifdef OSG_MT_CPTR_ASPECT
2302 FieldContainer
*QuadTreeTerrainBase::createAspectCopy(
2303 const FieldContainer
*pRefAspect
) const
2305 QuadTreeTerrain
*returnValue
;
2307 newAspectCopy(returnValue
,
2308 dynamic_cast<const QuadTreeTerrain
*>(pRefAspect
),
2309 dynamic_cast<const QuadTreeTerrain
*>(this));
2315 void QuadTreeTerrainBase::resolveLinks(void)
2317 Inherited::resolveLinks();
2319 static_cast<QuadTreeTerrain
*>(this)->setHeightData(NULL
);
2321 static_cast<QuadTreeTerrain
*>(this)->setHeightVertices(NULL
);
2323 #ifdef OSG_MT_CPTR_ASPECT
2324 AspectOffsetStore oOffsets
;
2326 _pAspectStore
->fillOffsetArray(oOffsets
, this);
2329 #ifdef OSG_MT_CPTR_ASPECT
2330 _mfHeightError
.terminateShare(Thread::getCurrentAspect(),
2333 #ifdef OSG_MT_CPTR_ASPECT
2334 _mfHeightQuad
.terminateShare(Thread::getCurrentAspect(),