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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef _SO_CAMERA_
00051 #define _SO_CAMERA_
00052
00053 #include <Inventor/SbBox.h>
00054 #include <Inventor/SbViewportRegion.h>
00055 #include <Inventor/nodes/SoNode.h>
00056 #include <Inventor/fields/SoSFFloat.h>
00057 #include <Inventor/fields/SoSFRotation.h>
00058 #include <Inventor/fields/SoSFVec3f.h>
00059 #include <Inventor/fields/SoSFEnum.h>
00060 #include <Inventor/SbPImpl.h>
00061
00062 #ifdef _WIN32
00063 #pragma warning(push)
00064 #pragma warning(disable:4251)
00065 #endif
00066
00067 class SbViewportRegion;
00068 class SoState;
00069
00070
00071
00072
00073 class SoCamera ;
00074 typedef void SoCameraCB( SoCamera *camera, SoGLRenderAction* action );
00075
00077
00078
00079
00080
00081
00083
00084 SO_PIMPL_PUBLIC_DECLARATION(SoCamera)
00085
00086
00188 class SoCamera : public SoNode {
00189
00190 SO_NODE_ABSTRACT_HEADER(SoCamera);
00191 SO_PIMPL_PUBLIC_HEADER(SoCamera);
00192
00193 public:
00195 enum ViewportMapping {
00201 CROP_VIEWPORT_FILL_FRAME = 0,
00205 CROP_VIEWPORT_LINE_FRAME = 1,
00210 CROP_VIEWPORT_NO_FRAME = 2,
00211
00217 ADJUST_CAMERA = 3,
00221 LEAVE_ALONE = 4
00222 };
00223
00224
00225
00226
00227
00228
00229
00235 SoSFEnum viewportMapping;
00240 SoSFVec3f position;
00246 SoSFRotation orientation;
00252 SoSFFloat aspectRatio;
00257 SoSFFloat nearDistance;
00262 SoSFFloat farDistance;
00269 SoSFFloat focalDistance;
00270
00276 void pointAt(const SbVec3f &targetPoint);
00277
00283 virtual void scaleHeight(float scaleFactor) = 0;
00284
00346 virtual SbViewVolume getViewVolume(float useAspectRatio = 0.0) const = 0;
00347
00349 virtual SbViewVolume getViewVolume(float aspectRatio,
00350 float nearDist,
00351 float farDist,
00352 SbVec3f position,
00353 SbRotation rotation) const = 0;
00354
00379 void viewAll(SoNode *sceneRoot,
00380 const SbViewportRegion &vpRegion,
00381 float slack = 1.0);
00390 void viewAll(SoPath *path,
00391 const SbViewportRegion &vpRegion,
00392 float slack = 1.0);
00393
00401 void viewAll(const SbBox3f& bbox,
00402 const SbViewportRegion &vpRegion);
00403
00408 SbViewportRegion getViewportBounds(const SbViewportRegion ®ion) const;
00409
00410 #if 1 SoDEPRECATED
00418 virtual void setStereoAdjustment(float adjustment);
00419 SoDEPRECATED
00424 float getStereoAdjustment() const;
00425
00426 SoDEPRECATED
00468 virtual void setStereoAbsoluteAdjustments( SbBool absolute );
00469 SoDEPRECATED
00474 SbBool getStereoAbsoluteAdjustment() const;
00475
00476 SoDEPRECATED
00492 virtual void setBalanceAdjustment(float adjustment, SbBool nearFrac = false);
00493 SoDEPRECATED
00498 float getBalanceAdjustment() const;
00499
00500 SoDEPRECATED
00506 SbBool isBalanceAdjustmentNearFrac() const;
00507
00508 SoDEPRECATED
00513 virtual void allowStereo(SbBool);
00514
00515 #endif
00518 enum StereoMode {
00519
00522 MONOSCOPIC,
00526 LEFT_VIEW,
00530 RIGHT_VIEW
00531 };
00532
00539 void setStereoMode(StereoMode mode);
00540
00544 StereoMode getStereoMode() const;
00545
00546 private:
00547 virtual void doAction(SoAction *action);
00548 virtual void callback(SoCallbackAction *action);
00549 virtual void GLRender(SoGLRenderAction *action);
00550 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00551 virtual void handleEvent(SoHandleEventAction *action);
00552 virtual void rayPick(SoRayPickAction *action);
00553 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00554
00555 private:
00556 static void initClass();
00557 static void exitClass();
00558
00559
00560 static void setPostCallback( SoCameraCB *f ) ;
00561
00562 static SbVec3f fromObjectSpace(const SbVec3f &vector, const SbMatrix &matrix, const SbViewportRegion &vpr);
00563 static SbVec3f toObjectSpace(const SbVec3f &pixel, const SbMatrix &matrix, const SbViewportRegion &vpr);
00564
00566 SbViewVolume getViewVolume(SoState *state);
00567
00569 void setLightCamera(bool flag);
00570
00572 bool isLightCamera() const;
00573
00577 const SbViewportRegion &getLastViewportRegion() const;
00578
00580 SbVec3f getFocalPoint() const;
00581
00582 private:
00584 SoCamera();
00585
00587 virtual ~SoCamera();
00588 virtual float getEyeOffset( SoState* state = NULL );
00589 virtual void updateStereoAdjustments( SoState* state = NULL );
00590
00591
00598 virtual void viewBoundingBox(const SbBox3f &box, float aspect, float slack) = 0;
00599
00605 virtual void jitter(int numPasses, int curPass, const SbViewportRegion &vpReg, SbVec3f &jitterAmount) const;
00606
00607 private:
00608 void commonConstructor();
00609 };
00610
00612
00613
00614
00615
00616 #define SO_ASPECT_SQUARE 1.00
00617 #define SO_ASPECT_VIDEO 1.333333333
00618 #define SO_ASPECT_35mm_ACADEMY 1.371
00619 #define SO_ASPECT_16mm 1.369
00620 #define SO_ASPECT_35mm_FULL 1.33333
00621 #define SO_ASPECT_70mm 2.287
00622 #define SO_ASPECT_CINEMASCOPE 2.35
00623 #define SO_ASPECT_HDTV 1.777777777
00624 #define SO_ASPECT_PANAVISION 2.361
00625 #define SO_ASPECT_35mm 1.5
00626 #define SO_ASPECT_VISTAVISION 2.301
00627
00628
00629 #ifdef _WIN32
00630 #pragma warning(pop)
00631 #endif
00632
00633 #endif
00634
00635