Cortex  10.0.0-a4
CameraController.h
1 //
3 // Copyright (c) 2008-2013, Image Engine Design Inc. All rights reserved.
4 // Copyright (c) 2012, John Haddon. All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 //
17 // * Neither the name of Image Engine Design nor the names of any
18 // other contributors to this software may be used to endorse or
19 // promote products derived from this software without specific prior
20 // written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 //
35 
36 #ifndef IECORE_CAMERACONTROLLER_H
37 #define IECORE_CAMERACONTROLLER_H
38 
39 #include "IECore/Export.h"
40 #include "IECore/SimpleTypedData.h"
41 
42 #include "OpenEXR/ImathVec.h"
43 
44 namespace IECore
45 {
46 
47 IE_CORE_FORWARDDECLARE( Camera )
48 IE_CORE_FORWARDDECLARE( MatrixTransform )
49 
52 class IECORE_API CameraController : public boost::noncopyable
53 {
54 
55  public:
56 
57  CameraController( CameraPtr camera );
59 
60  void setCamera( CameraPtr camera );
61  CameraPtr getCamera();
62  ConstCameraPtr getCamera() const;
63 
65  void setCentreOfInterest( float centreOfInterest );
66  float getCentreOfInterest();
67 
69  {
75  ScaleScreenWindow
76  };
77 
80  void setResolution( const Imath::V2i &resolution );
83  void setResolution( const Imath::V2i &resolution, ScreenWindowAdjustment adjustment );
84  const Imath::V2i &getResolution() const;
85 
88  void frame( const Imath::Box3f &box );
91  void frame( const Imath::Box3f &box, const Imath::V3f &viewDirection,
92  const Imath::V3f &upVector = Imath::V3f( 0, 1, 0 ) );
93 
97  void unproject( const Imath::V2f rasterPosition, Imath::V3f &near, Imath::V3f &far );
99  Imath::V2f project( const Imath::V3f &worldPosition ) const;
100 
106 
107  enum MotionType
108  {
109  None,
110  Track,
111  Tumble,
112  Dolly
113  };
115  void motionStart( MotionType motion, const Imath::V2f &startPosition );
118  void motionUpdate( const Imath::V2f &newPosition );
120  void motionEnd( const Imath::V2f &endPosition );
122 
123  private:
124 
125  void track( const Imath::V2f &p );
126  void tumble( const Imath::V2f &p );
127  void dolly( const Imath::V2f &p );
128 
129  IE_CORE_FORWARDDECLARE( MemberData );
130 
131  MemberDataPtr m_data;
132 
133 };
134 
135 }
136 
137 #endif // IECORE_CAMERACONTROLLER_H
Definition: HalfTypeTraits.h:45
Definition: CameraController.h:52
ScreenWindowAdjustment
Definition: CameraController.h:68
Definition: CameraController.h:72
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43