SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SmCameraControlKit.h
1#ifndef SMALLCHANGE_SMCAMERACONTROLKIT_H
2#define SMALLCHANGE_SMCAMERACONTROLKIT_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/nodekits/SoSubKit.h>
37#include <Inventor/nodekits/SoBaseKit.h>
38#include <Inventor/fields/SoSFBool.h>
39#include <Inventor/fields/SoSFEnum.h>
40#include <Inventor/fields/SoSFFloat.h>
41#include <Inventor/fields/SoSFVec3f.h>
42#include <SmallChange/basic.h>
43
44class SmCameraControlKitP;
45class SoCamera;
46class SbMatrix;
47class SbViewportRegion;
48class SbRotation;
49class SoEvent;
50
51class SMALLCHANGE_DLL_API SmCameraControlKit : public SoBaseKit {
52 typedef SoBaseKit inherited;
53
54 SO_KIT_HEADER(SmCameraControlKit);
55
56 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
57 SO_KIT_CATALOG_ENTRY_HEADER(camera);
58 SO_KIT_CATALOG_ENTRY_HEADER(headlightNode);
59 SO_KIT_CATALOG_ENTRY_HEADER(scene);
60
61public:
63 static void initClass(void);
64
65 virtual void GLRender(SoGLRenderAction * action);
66 virtual void handleEvent(SoHandleEventAction * action);
67
68 enum AutoClippingStrategy {
69 VARIABLE_NEAR_PLANE,
70 CONSTANT_NEAR_PLANE
71 };
72
73 SbBool isAnimating(void);
74 SbBool isBusy(void) const;
75 SbBool seek(const SoEvent * event, const SbViewportRegion & vp);
76 SbBool seekToPoint(const SbVec3d & point,
77 const SbRotation & orientation,
78 const SbViewportRegion & vp);
79 void viewAll(const SbViewportRegion & vp, const float slack = 1.0f);
80 void pointDir(const SbVec3f & dir, const SbBool resetroll = TRUE);
81 void resetCameraRoll(void);
82
83 void resetCameraFocalDistance(const SbViewportRegion & vpr);
84
85protected:
86
87 virtual SbBool setAnyPart(const SbName & partname, SoNode * from,
88 SbBool anypart = TRUE);
89
90 virtual void notify(SoNotList * list);
91 virtual ~SmCameraControlKit();
92
93public:
94 SoSFBool headlight;
95 SoSFBool autoClipping;
96 SoSFEnum autoClippingStrategy;
97 SoSFFloat autoClippingValue;
98 SoSFNode eventHandler;
99 SoSFVec3f viewUp;
100 SoSFBool handleInheritedEventFirst;
101
102private:
103 void setClippingPlanes(void);
104 void getCameraCoordinateSystem(SoCamera * camera,
105 SoNode * root,
106 SbMatrix & matrix,
107 SbMatrix & inverse);
108
109 friend class SmCameraControlKitP;
110 SmCameraControlKitP * pimpl;
111};
112
113#endif // SMALLCHANGE_SMCAMERACONTROLKIT_H
Definition misc/SbList.h:69
The SmCameraControlKit class...
Definition SmCameraControlKit.h:51