Gizmo3D

gzGeometryUtils.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzGeometryUtils.h
00003 // Module       : 
00004 // Description  : Class definition of the geometry utility classes
00005 // Author       : Anders Modén      
00006 // Product      : Gizmo3D 2.1.1
00007 //      
00008 // Copyright © 2003- Saab Training Systems AB, Sweden   
00009 //          
00010 // NOTE:    Gizmo3D is a high performance 3D Scene Graph and effect visualisation 
00011 //          C++ toolkit for Linux, Mac OS X, Windows (Win32) and IRIX® for  
00012 //          usage in Game or VisSim development.
00013 //
00014 //
00015 // Revision History...                          
00016 //                                  
00017 // Who  Date    Description                     
00018 //                                  
00019 // AMO  021213  Created file    
00020 //
00021 //******************************************************************************
00022 #ifndef __GZ_GEOMETRY_UTILS_H__
00023 #define __GZ_GEOMETRY_UTILS_H__
00024 
00031 #include "gzGeometry.h"
00032 #include "gzText.h"
00033 #include "gzIntersector.h"
00034 #include "gzShadowVolume.h"
00035 #include "gzRenderBase.h"
00036 
00037 //******************************************************************************
00038 // Class    : gzGeometryAxis
00039 //                                  
00040 // Purpose  : Coordinate Axis used in development to see local coordinates
00041 //                                  
00042 // Notes    : - 
00043 //                                  
00044 // Revision History...                          
00045 //                                  
00046 // Who  Date    Description                     
00047 //                                  
00048 // AMO  981122  Created 
00049 //                                  
00050 //******************************************************************************
00051 class gzGeometryAxis : public gzGeometry
00052 {
00053 public:
00054     GZ_GRAPH_EXPORT gzGeometryAxis(gzReal size , gzReal step , const gzVec4 &color=gzVec4(0.0,0.0,0.0,1.0),const gzString & name=GZ_EMPTY_STRING);
00055 
00056     GZ_GRAPH_EXPORT virtual ~gzGeometryAxis(){};
00057 
00058     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00059 
00060     // ---- util functions -------
00061 
00062     GZ_PROPERTY_EXPORT_(    gzReal  ,   Size    ,   GZ_GRAPH_EXPORT);
00063     GZ_PROPERTY_EXPORT_(    gzReal  ,   Step    ,   GZ_GRAPH_EXPORT);
00064 
00065 private:
00066 
00067     gzVoid createGeometryAxis();
00068 };
00069 
00070 //******************************************************************************
00071 // Class    : gzGeometrySphere
00072 //                                  
00073 // Purpose  : A Simple Sphere
00074 //                                  
00075 // Notes    : - 
00076 //                                  
00077 // Revision History...                          
00078 //                                  
00079 // Who  Date    Description                     
00080 //                                  
00081 // AMO  011011  Created 
00082 //                                  
00083 //******************************************************************************
00084 class gzGeometrySphere : public gzGeometry
00085 {
00086 public:
00087     GZ_GRAPH_EXPORT gzGeometrySphere(gzReal radius , gzInt sections=30 , const gzVec4 &color=gzVec4(1.0,1.0,1.0,1.0) , const gzString & name=GZ_EMPTY_STRING);
00088 
00089     GZ_GRAPH_EXPORT virtual ~gzGeometrySphere(){};
00090 
00091     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00092 
00093 };
00094 
00095 typedef  gzReal     (*gzEvalFunc_Tube_Radius)       (gzReal zero_to_one, gzReal angle);
00096 typedef  gzRealXY   (*gzEvalFunc_Tube_Displacement) (gzReal zero_to_one);
00097 
00098 //********************** Some sample evaluation functions **********************
00099 
00100 // --- Radius methods ----
00101 
00103 GZ_GRAPH_EXPORT gzReal GZ_TUBE_CONE(gzReal zero_to_one, gzReal angle);
00104 
00105 //******************************************************************************
00106 // Class    : gzGeometryTube
00107 //                                  
00108 // Purpose  : A Rather Simple Tube
00109 //                                  
00110 // Notes    : - 
00111 //                                  
00112 // Revision History...                          
00113 //                                  
00114 // Who  Date    Description                     
00115 //                                  
00116 // AMO  030315  Created 
00117 //                                  
00118 //******************************************************************************
00119 class gzGeometryTube : public gzGeometry
00120 {
00121 public:
00122 
00123     GZ_GRAPH_EXPORT gzGeometryTube(     gzFloat length=10,
00124                                         gzFloat width=1,
00125                                         gzULong lengthSamples=10,
00126                                         gzULong widthSamples=10,
00127                                         gzEvalFunc_Tube_Radius          evalRadiusFunc=NULL,
00128                                         gzEvalFunc_Tube_Displacement    evalDisplacementFunc=NULL,
00129                                         gzFloat texture_x_scale=1,
00130                                         gzFloat texture_y_scale=1,
00131                                         const gzVec4 &color=gzVec4(1.0,1.0,1.0,1.0) , 
00132                                         const gzString & name=GZ_EMPTY_STRING);
00133 
00134     GZ_GRAPH_EXPORT virtual ~gzGeometryTube(){};
00135 
00136     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00137 
00138 };
00139 
00140 
00141 enum gzViewPlaneAlign
00142 {
00143     GZ_VIEWPLANE_ALIGN_UPPER_LEFT,
00144     GZ_VIEWPLANE_ALIGN_UPPER_RIGHT,
00145     GZ_VIEWPLANE_ALIGN_BOTTOM_LEFT,
00146     GZ_VIEWPLANE_ALIGN_BOTTOM_RIGHT,
00147     GZ_VIEWPLANE_ALIGN_UPPER_CENTER,
00148     GZ_VIEWPLANE_ALIGN_BOTTOM_CENTER,
00149     GZ_VIEWPLANE_ALIGN_LEFT_CENTER,
00150     GZ_VIEWPLANE_ALIGN_RIGHT_CENTER
00151 };
00152 
00153 //******************************************************************************
00154 // Class    : gzViewPlane
00155 //                                  
00156 // Purpose  : Projects a HUD plane covering full screen at user defined distance
00157 //                                  
00158 // Notes    : - 
00159 //                                  
00160 // Revision History...                          
00161 //                                  
00162 // Who  Date    Description                     
00163 //                                  
00164 // AMO  020204  Created 
00165 //                                  
00166 //******************************************************************************
00167 class gzViewPlane : public gzBaseGeometry
00168 {
00169 public:
00170     GZ_GRAPH_EXPORT gzViewPlane(const gzReal &distance=-1,const gzVec4 &color=gzVec4(0.0,0.0,0.0,1.0),const gzString & name=GZ_EMPTY_STRING);
00171 
00172     GZ_GRAPH_EXPORT virtual ~gzViewPlane(){};
00173 
00174     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00175 
00176     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00177 
00178     // ---------- Common graph functions --------------------------------
00179 
00180     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00181 
00182     // ---------- No cloning of base - pure virtual ---------------------
00183 
00184     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00185 
00186     // ---------- ViewPlane methods -------------------------------------
00187 
00188     GZ_GRAPH_EXPORT gzVoid  setCoordinates(const gzVec2 & bottomLeftCoordinate, const gzVec2 & upperRightCoordinate);
00189 
00190     GZ_GRAPH_EXPORT gzVoid  setTexCoordinates(const gzVec2 & bottomLeftTexCoordinate, const gzVec2 & upperRightTexCoordinate);
00191 
00192     GZ_GRAPH_EXPORT gzVoid  setColor(const gzVec4 &color);
00193 
00194 
00197     GZ_GRAPH_EXPORT gzVoid  usePixelPosition(gzBool on);    // Use pixels and alignment. pos dep on alignment
00198 
00201     GZ_GRAPH_EXPORT gzVoid  setAlignment(gzViewPlaneAlign alignment);
00202 
00203     // ---------- Properties -------------------------------------------
00204 
00206     GZ_PROPERTY_EXPORT( gzBool          ,   UseIntersection         , GZ_GRAPH_EXPORT);
00207     
00208 private:
00209 
00210     gzReal  m_distance;
00211 
00212     gzVec4  m_color;
00213 
00214     gzVec2  m_bottomLeftCoordinate;     // default (-1,-1)  x-> right y-> up from bottom left
00215 
00216     gzVec2  m_upperRightCoordinate;     // default (0,0)
00217 
00218     gzVec2  m_bottomLeftTexCoordinate;
00219 
00220     gzVec2  m_upperRightTexCoordinate;
00221 
00222     gzViewPlaneAlign        m_align;    // Default upper left corner. Only for pixel positions
00223 
00224     gzBool  m_usePixelPosition;             // Default FALSE
00225 
00226 
00227 };
00228 
00229 // Declare smart pointer type
00230 GZ_DECLARE_REFPTR(gzViewPlane);
00231 
00233 enum gzAngleUnits
00234 {
00235     GZ_ANGLE_UNIT_DEGREES,
00236     GZ_ANGLE_UNIT_RADIANS,
00237     GZ_ANGLE_UNIT_MILS
00238 };
00239 
00240 //******************************************************************************
00241 // Class    : gzLineOfSight
00242 //                                  
00243 // Purpose  : Calculates and draws a LOS vector from start to stop with 
00244 //            measured values.
00245 //                                  
00246 // Notes    : - 
00247 //                                  
00248 // Revision History...                          
00249 //                                  
00250 // Who  Date    Description                     
00251 //                                  
00252 // AMO  021204  Created 
00253 //                                  
00254 //******************************************************************************
00255 class gzLineOfSight : public gzBaseGeometry
00256 {
00257 public:
00258     GZ_GRAPH_EXPORT gzLineOfSight(const gzVec3 & start=gzVec3(0,0,0) , const gzVec3 & stop=gzVec3(0,0,0) , const gzVec4 &color=gzVec4(1.0,1.0,1.0,1.0),const gzString & name=GZ_EMPTY_STRING);
00259 
00260     GZ_GRAPH_EXPORT virtual ~gzLineOfSight(){};
00261 
00262     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00263 
00264 
00265     // ---------- Common graph functions --------------------------------
00266 
00267     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00268 
00269     GZ_GRAPH_EXPORT virtual gzActionStage useActionStage( gzTraverseAction *actionclass , gzContext *context);
00270 
00271     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00272 
00273     // ---------- No cloning of base - pure virtual ---------------------
00274 
00275     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00276 
00277     // ---------- The control API ---------------------------------------
00278 
00279     GZ_GRAPH_EXPORT gzVoid  setStartPosition(const gzVec3 & start);
00280 
00281     GZ_GRAPH_EXPORT gzVoid  setStopPosition(const gzVec3 & stop);
00282 
00283     GZ_GRAPH_EXPORT gzVoid  setNodeTree(gzNode *tree);
00284 
00285     // ---------- Properties -------------------------------------------
00286 
00287     GZ_PROPERTY_EXPORT( gzVec3          ,   NorthVector             , GZ_GRAPH_EXPORT);
00288     GZ_PROPERTY_EXPORT( gzVec3          ,   EastVector              , GZ_GRAPH_EXPORT);
00289     GZ_PROPERTY_EXPORT( gzBool          ,   ShowBearing             , GZ_GRAPH_EXPORT);
00290     GZ_PROPERTY_EXPORT( gzAngleUnits    ,   BearingUnits            , GZ_GRAPH_EXPORT);
00291     GZ_PROPERTY_EXPORT( gzBool          ,   ShowTotalDistance       , GZ_GRAPH_EXPORT);
00292     GZ_PROPERTY_EXPORT( gzBool          ,   ShowLineOfSightDistance , GZ_GRAPH_EXPORT);
00293 
00294 
00295 
00296 private:
00297 
00298     gzVec4                  m_color;
00299 
00300     gzVec3                  m_start;
00301 
00302     gzVec3                  m_stop;
00303 
00304     gzDouble                m_animationTick;
00305 
00306     gzDouble                m_updateTick;
00307 
00308     gzUShort                m_stipple;
00309 
00310     gzNodePtr               m_nodeTree;
00311 
00312     gzIntersector           m_intersector;
00313 
00314     gzBool                  m_needUpdate;
00315 
00316     gzVec3                  m_hitPoint;
00317 
00318     gzText                  m_text;
00319 };
00320 
00321 // Declare smart pointer type
00322 GZ_DECLARE_REFPTR(gzLineOfSight);
00323 
00324 
00325 //******************************************************************************
00326 // Class    : gzVisualCoverage
00327 //                                  
00328 // Purpose  : Calculates and renders the visual coverage as seen from a certain
00329 //            point. The actual inverse of a shaodw
00330 //                                  
00331 // Notes    : - 
00332 //                                  
00333 // Revision History...                          
00334 //                                  
00335 // Who  Date    Description                     
00336 //                                  
00337 // AMO  021204  Created 
00338 //                                  
00339 //******************************************************************************
00340 class gzVisualCoverage : public gzShadowRender
00341 {
00342 public:
00343 
00344     GZ_GRAPH_EXPORT gzVisualCoverage(const gzString & name=GZ_EMPTY_STRING);
00345 
00346     GZ_GRAPH_EXPORT virtual ~gzVisualCoverage();
00347 
00348     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00349 
00350 
00351     // -- gzVisualCoverage interface -------------------------------------
00352 
00353     GZ_GRAPH_EXPORT gzVoid  setPosition(const gzVec3 &pos);
00354 
00355     GZ_GRAPH_EXPORT gzVoid  setNodeTree(gzNode *tree);
00356 
00357 private:
00358 
00359     gzRefPointer<gzNode>            m_nodeTree;
00360 
00361     gzRefPointer<gzLight>           m_light;
00362 
00363     gzRefList<gzShadowGenerator>    m_generators;
00364 
00365 };
00366 
00367 //******************************************************************************
00368 // Class    : gzVisualCovSample
00369 //                                  
00370 // Purpose  : Calculates and renders the visual coverage as sampled from a certain
00371 //            point. View position dependant.
00372 //                                  
00373 // Notes    : - 
00374 //                                  
00375 // Revision History...                          
00376 //                                  
00377 // Who  Date    Description                     
00378 //                                  
00379 // AMO  021204  Created 
00380 //                                  
00381 //******************************************************************************
00382 class gzVisualCovSample : public gzBaseGeometry
00383 {
00384 public:
00385 
00386     GZ_GRAPH_EXPORT gzVisualCovSample(gzImageRenderInterface *renderer , gzImage *image , const gzString & name=GZ_EMPTY_STRING);
00387 
00388     GZ_GRAPH_EXPORT virtual ~gzVisualCovSample();
00389 
00390     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00391 
00392     // ---------- Common graph functions --------------------------------
00393 
00394     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00395 
00396     GZ_GRAPH_EXPORT virtual gzActionStage useActionStage( gzTraverseAction *actionclass , gzContext *context);
00397 
00398     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00399 
00400     // ---------- No cloning of base - pure virtual ---------------------
00401 
00402     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00403 
00404 
00405     // -- gzVisualCovSample interface -------------------------------------
00406 
00407     GZ_GRAPH_EXPORT gzVoid  setPosition(const gzVec3 &pos,const gzDouble &maxRadius=10000);
00408 
00409     GZ_GRAPH_EXPORT gzVoid  lookAt(const gzVec3 &pos);
00410 
00411     GZ_GRAPH_EXPORT gzVoid  setNodeTree(gzNode *tree);
00412 
00413     GZ_GRAPH_EXPORT gzImage *getCoverageImage();
00414 
00415 private:
00416 
00417     gzVoid  generateGeometry();
00418 
00419     gzDynamicArray<gzVec3>                  m_geometry;
00420 
00421     gzRefPointer<gzImageRenderInterface>    m_imageRender;
00422 
00423     gzRefPointer<gzImage>                   m_image;
00424 
00425     gzMatrix4                               m_matrix;
00426 };
00427 
00428 enum gzSkyBoxLocation
00429 {
00430     GZ_SKYBOX_EAST  =0,
00431     GZ_SKYBOX_WEST  =1,
00432     GZ_SKYBOX_SOUTH =2,
00433     GZ_SKYBOX_NORTH =3,
00434     GZ_SKYBOX_GROUND=4,
00435     GZ_SKYBOX_SKY   =5
00436 };
00437 
00438 class gzQuadTexMapping
00439 {
00440 public:
00441 
00442     gzQuadTexMapping(gzVec2 _c1=gzVec2(0,0),gzVec2 _c2=gzVec2(1,0),gzVec2 _c3=gzVec2(1,1),gzVec2 _c4=gzVec2(0,1)):c1(_c1),c2(_c2),c3(_c3),c4(_c4){}
00443 
00444     gzVec2 center()
00445     {
00446         return (c1+c2+c3+c4)*0.25;
00447     }
00448     
00449     gzVec2  c1;
00450     gzVec2  c2;
00451     gzVec2  c3;
00452     gzVec2  c4;
00453 };
00454 
00455 //******************************************************************************
00456 // Class    : gzSkyBox
00457 //                                  
00458 // Purpose  : Calculates and renders a skybox around the viewer
00459 //            
00460 //                                  
00461 // Notes    : - 
00462 //                                  
00463 // Revision History...                          
00464 //                                  
00465 // Who  Date    Description                     
00466 //                                  
00467 // AMO  030328  Created 
00468 //                                  
00469 //******************************************************************************
00470 class gzSkyBox : public gzBaseGeometry
00471 {
00472 public:
00473 
00474     GZ_GRAPH_EXPORT gzSkyBox(const gzString & name=GZ_EMPTY_STRING);
00475 
00476     GZ_GRAPH_EXPORT virtual ~gzSkyBox();
00477 
00478     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00479 
00480     // ---------- Common graph functions --------------------------------
00481 
00482     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00483 
00484     GZ_GRAPH_EXPORT virtual gzActionStage useActionStage( gzTraverseAction *actionclass , gzContext *context);
00485 
00486     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00487 
00488     // ---------- No cloning of base - pure virtual ---------------------
00489 
00490     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00491 
00492     // ---------- Skybox methods ----------------------------------------
00493 
00494     GZ_GRAPH_EXPORT gzVoid      setOrientation(gzReal heading, gzReal pitch , gzReal roll);
00495 
00496     GZ_GRAPH_EXPORT gzVoid      setGroundPoint( gzReal x , gzReal y , gzReal z);
00497 
00498     GZ_GRAPH_EXPORT gzVoid      setStandardHeight(gzReal height);
00499 
00500     GZ_GRAPH_EXPORT gzVoid      setHorizonAngle(gzReal angle);
00501 
00502     GZ_GRAPH_EXPORT gzVoid      useFixedHeight(gzBool on=FALSE);
00503 
00504     GZ_GRAPH_EXPORT gzVoid      setImageSide(gzSkyBoxLocation side, gzImage *image,gzQuadTexMapping mapping=gzQuadTexMapping());
00505 
00506     // --------- Special acess methods for expert users ----------------
00507 
00508     GZ_GRAPH_EXPORT gzState *   getState(gzSkyBoxLocation side);
00509 
00510 private:
00511 
00512     gzMatrix4   m_transform;
00513 
00514     gzVec3      m_groundPoint;
00515 
00516     gzReal      m_height_y;
00517 
00518     gzReal      m_horiz_angle;
00519 
00520     gzArray<gzRefPointer<gzState> >     m_texSides;
00521     gzArray<gzQuadTexMapping>           m_texMapping;
00522 
00523     gzBool      m_useFixedHeight:1;
00524     gzBool      m_hasDefinedSides:1;
00525 };
00526 
00527 // Declare smart pointer type
00528 GZ_DECLARE_REFPTR(gzSkyBox);
00529 
00530 //******************************************************************************
00531 // Class    : gzSkyLayer
00532 //                                  
00533 // Purpose  : renders layers of sky data
00534 //            
00535 //                                  
00536 // Notes    : - 
00537 //                                  
00538 // Revision History...                          
00539 //                                  
00540 // Who  Date    Description                     
00541 //                                  
00542 // AMO  030328  Created 
00543 //                                  
00544 //******************************************************************************
00545 class gzSkyLayer : public gzBaseGeometry
00546 {
00547 public:
00548 
00549     GZ_GRAPH_EXPORT gzSkyLayer(const gzString & name=GZ_EMPTY_STRING);
00550 
00551     GZ_GRAPH_EXPORT virtual ~gzSkyLayer();
00552 
00553     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00554 
00555     // ---------- Common graph functions --------------------------------
00556 
00557     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00558 
00559     GZ_GRAPH_EXPORT virtual gzActionStage useActionStage( gzTraverseAction *actionclass , gzContext *context);
00560 
00561     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00562 
00563     // ---------- No cloning of base - pure virtual ---------------------
00564 
00565     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00566 
00567     // ---------- Skybox methods ----------------------------------------
00568 
00569     GZ_GRAPH_EXPORT gzVoid  setOrientation(gzReal heading, gzReal pitch , gzReal roll);
00570 
00571     GZ_GRAPH_EXPORT gzVoid  setGroundPoint( gzReal x , gzReal y , gzReal z);
00572 
00573     GZ_GRAPH_EXPORT gzVoid  setStandardHeight(gzReal height);
00574 
00575     GZ_GRAPH_EXPORT gzVoid  setHorizonAngle(gzReal angle);
00576 
00577     GZ_GRAPH_EXPORT gzVoid  setLayerImage(gzImage *image , gzReal width , gzReal length , gzReal heightAboveGround , gzReal northSpeed=0, gzReal eastSpeed=0);
00578 
00579     GZ_GRAPH_EXPORT gzVoid  useFixedHeight(gzBool on=FALSE);
00580 
00581 private:
00582 
00583     gzMatrix4   m_transform;
00584 
00585     gzVec3      m_groundPoint;
00586 
00587     gzReal      m_height_y;
00588 
00589     gzReal      m_horiz_angle;
00590 
00591     gzRefPointer<gzState>   m_skyLayer;
00592 
00593     gzReal      m_heightAboveGround;
00594 
00595     gzReal      m_width;
00596 
00597     gzReal      m_length;
00598 
00599     gzReal      m_northSpeed;
00600 
00601     gzReal      m_eastSpeed;
00602 
00603     gzBool      m_useFixedHeight:1;
00604 
00605 };
00606 
00607 // Declare smart pointer type
00608 GZ_DECLARE_REFPTR(gzSkyLayer);
00609 
00610 
00611 //******************************************************************************
00612 // Class    : gzIBRIndexSets
00613 //                                  
00614 // Purpose  : IBR index data
00615 //            
00616 //                                  
00617 // Notes    : - 
00618 //                                  
00619 // Revision History...                          
00620 //                                  
00621 // Who  Date    Description                     
00622 //                                  
00623 // AMO  030714  Created 
00624 //                                  
00625 //******************************************************************************
00626 class gzIBRIndexSets : public gzReference
00627 {
00628 public:
00629 
00630     GZ_GRAPH_EXPORT static gzIBRIndexSets * getIndexSet(gzULong width,gzULong height);
00631 
00632     GZ_GRAPH_EXPORT virtual ~gzIBRIndexSets(){};
00633 
00634 private:
00635 
00636     friend class gzIBRGeometry;
00637 
00638     gzIBRIndexSets(gzULong width , gzULong height);
00639 
00640     static gzRefList<gzIBRIndexSets>    s_indexStorage;
00641 
00642     gzULong             m_width;
00643     gzULong             m_height;
00644 
00645     gzArray<gzULong>    m_index;
00646     gzArray<gzShortXY>  m_xy;
00647 
00648 
00649     gzUInt              m_bufIndexID;
00650 
00651 };
00652 
00653 
00654 //******************************************************************************
00655 // Class    : gzIBRGeometry
00656 //                                  
00657 // Purpose  : IBR geometry
00658 //            
00659 //                                  
00660 // Notes    : - 
00661 //                                  
00662 // Revision History...                          
00663 //                                  
00664 // Who  Date    Description                     
00665 //                                  
00666 // AMO  030714  Created 
00667 //                                  
00668 //******************************************************************************
00669 class gzIBRGeometry : public gzBaseGeometry
00670 {
00671 public:
00672 
00673     GZ_DECLARE_TYPE_INTERFACE;      // provide RTTI typed interface
00674 
00675     GZ_GRAPH_EXPORT gzIBRGeometry(const gzString & name="gzIBRGeometry");
00676 
00677     GZ_GRAPH_EXPORT virtual ~gzIBRGeometry(){};
00678     
00679     // ---------- Clone interface ---------------------------------------
00680 
00681     GZ_GRAPH_EXPORT virtual gzReference* clone() const; // Provide a clone method for factories
00682     
00683     // ---------- Action Interface --------------------------------------
00684 
00685     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00686     
00687     GZ_GRAPH_EXPORT virtual gzVoid postTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00688     
00689     GZ_GRAPH_EXPORT virtual gzActionStage useActionStage( gzTraverseAction *actionclass , gzContext *context);
00690     
00691     GZ_GRAPH_EXPORT virtual gzVoid updateNode();
00692 
00693     // ---------- IBR Interface ----------------------------------------
00694     
00695     GZ_GRAPH_EXPORT gzVoid setSize(gzULong size_x, gzULong size_y);
00696     
00697     GZ_GRAPH_EXPORT gzVoid setDepthMap(gzImage *image);
00698     
00699     GZ_GRAPH_EXPORT gzVoid setColorMap(gzImage *image);
00700     
00701     GZ_GRAPH_EXPORT gzVoid setTransform(const gzMatrix4 &matrix);
00702     
00703     GZ_GRAPH_EXPORT gzVoid filterSideGeometry(gzReal stepVal=0.0001);
00704     
00705 private:
00706 
00707     gzBool isDiscreteJump(gzLong width,gzLong height,gzReal max);
00708     
00709     gzFloat getDepth(gzLong width,gzLong height);
00710 
00711     gzULong                                         m_width;
00712 
00713     gzULong                                         m_height;
00714 
00715     gzRefPointer<gzIBRIndexSets>                    m_indexSet;
00716 
00717     gzRefPointer<gzImage>                           m_depthMap;
00718 
00719     gzRefPointer<gzImage>                           m_colorMap;
00720 
00721     gzRefPointer<gzGFXProgram>                      m_program;
00722 
00723     gzMatrix4                                       m_transform;
00724 
00725     gzRefPointer<gzTexture>                         m_texture;  
00726     
00727     gzBool                                          m_rebindIndex;
00728 
00729     gzBool                                          m_rebindDepth;
00730 
00731     gzUInt                                          m_bufID;
00732 };
00733 
00734 //******************************************************************************
00735 // Geometry calculation utilities
00736 //******************************************************************************
00737 
00738 GZ_GRAPH_EXPORT gzBool gzIntersect(const gzVec3 &origin, const gzVec3 &direction, const gzVec3 &v0, const gzVec3 &v1 ,const gzVec3 &v2 , gzVec3 &p);
00739 
00740 GZ_GRAPH_EXPORT gzVoid gzUVMap(const gzVec3 &v0, const gzVec3 &v1 ,const gzVec3 &v2 , const gzVec3 &p , gzFloat &u , gzFloat &v);
00741 
00742 //******************************************************************************
00743 // Render utilities
00744 //******************************************************************************
00745 
00746 gzVoid GZ_GRAPH_EXPORT gzDrawBoundingSphere(gzNode *node,gzContext *context);
00747 
00748 #endif
00749 

Documentation for Gizmo3D generated at Wed Feb 20 11:54:05 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond