1/****************************************************************************************
2
3 Copyright (C) 2015 Autodesk, Inc.
4 All rights reserved.
5
6 Use of this software is subject to the terms of the Autodesk license agreement
7 provided at the time of installation or download, or which otherwise accompanies
8 this software in either electronic or hard copy form.
9
10****************************************************************************************/
11
12//! \file fbxcamerastereo.h
13#ifndef _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_
14#define _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/scene/geometry/fbxcamera.h>
19
20#include <fbxsdk/fbxsdk_nsbegin.h>
21
22/** This node attribute contains methods for accessing the properties of a stereo camera.
23 * \nosubgrouping
24 * Generally, a set of stereoRig contains the center camera, the left camera and the right camera.
25 * FbxCameraStereo is used to represent the center camera. The left and right camera could be FbxCamera.
26 * FbxCameraStereo contains stereo properties.
27 * The left and right camera can also be get and set via related methods in FbxCameraStereo class.
28 * \see FbxCamera and FbxCameraSwitcher.
29 */
30class FBXSDK_DLL FbxCameraStereo : public FbxCamera
31{
32 FBXSDK_OBJECT_DECLARE(FbxCameraStereo, FbxCamera);
33
34public:
35 //! Return the type of node attribute which is EType::eCameraStereo.
36 virtual FbxNodeAttribute::EType GetAttributeType() const;
37
38 //! Reset the stereo camera to default values.
39 void Reset();
40
41 /** Types of Stereo camera.
42 */
43 enum EStereoType
44 {
45 eNone, //!< Disable the stereo effect.(Default value)
46 eConverged, //!< Computes the zero parallax plane by toeing in the cameras.
47 eOffAxis, //!< Computes the convergence plane by shifting the frustum using camera film back.
48 eParallel //!< A parallel camera setup where there is effectively no convergence plane.
49 };
50
51 /** Get the left camera which connect to property LeftCamera.
52 * \return A pointer to FbxCamera.
53 * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera.
54 * Use this method to get the left camera.
55 */
56 FbxCamera* GetLeftCamera() const;
57
58 /** Get the right camera which connect to property RightCamera.
59 * \return A pointer to FbxCamera.
60 * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera.
61 * Use this method to get the right camera.
62 */
63 FbxCamera* GetRightCamera() const;
64
65 /** Set the left camera, connect property LeftCamera to pCamera.
66 * \param pCamera The camera to set.
67 * \return \c true if it's successful, \c false otherwise.
68 * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera.
69 * Use this method to set the left camera.
70 */
71 bool SetLeftCamera(FbxCamera* pCamera);
72
73 /** Set the right camera, connect property RightCamera to pCamera.
74 * \param pCamera The camera to set.
75 * \return \c true if it's successful, \c false otherwise.
76 * \remarks Current FbxCameraStereo should work with two FbxCamera, left camera and right camera.
77 * Use this method to set the right camera.
78 */
79 bool SetRightCamera(FbxCamera* pCamera);
80
81 /** Get the local transformation matrix of left camera.
82 * \return The local transformation matrix of left camera.
83 * \remarks Use this method to reevaluate the local transformation of left camera.
84 */
85 FbxAMatrix GetLeftCameraLocalMatrix() const;
86
87 /** Get the global matrix of left camera.
88 * \return The global transformation matrix of left camera.
89 * \remarks Use this method to reevaluate the global transformation of left camera.
90 */
91 FbxAMatrix GetLeftCameraGlobalMatrix() const;
92
93 /** Get the local transformation matrix of right camera.
94 * \return The local transformation matrix of right camera..
95 * \remarks Use this method to reevaluate the local transformation of right camera.
96 */
97 FbxAMatrix GetRightCameraLocalMatrix() const;
98
99 /** Get the global transformation matrix of right camera.
100 * \return The global transformation matrix of right camera.
101 * \remarks Use this method to reevaluate the global transformation of right camera.
102 */
103 FbxAMatrix GetRightCameraGlobalMatrix() const;
104
105 /** Reevaluate the FilmOffsetX of left camera.
106 * It's computed through stereo camera properties.
107 * \return Current FilmOffsetX value.
108 * \remarks This method does not set the FilmOffsetX of left camera.
109 */
110 double ReevaluateLeftCameraFilmOffsetX() const;
111
112 /** Reevaluate the FilmOffsetX of right camera.
113 * It's computed through stereo camera properties.
114 * \return Current FilmOffsetX value.
115 * \remarks this method does not set the FilmOffsetX of right camera
116 */
117 double ReevaluateRightCameraFilmOffsetX() const;
118
119 //////////////////////////////////////////////////////////////////////////
120 //
121 // Properties
122 //
123 //////////////////////////////////////////////////////////////////////////
124
125 // -----------------------------------------------------------------------
126 // Stereo and Stereo Adjustments
127 // -----------------------------------------------------------------------
128
129 /** This property handles the types of Stereo camera.
130 *
131 * To access this property do: Stereo.Get().
132 * To set this property do: Stereo.Set(EStereoType).
133 *
134 * \remarks Default Value is eNone.
135 */
136 FbxPropertyT<EStereoType> Stereo;
137
138 /** This property handles the distance between left and right cameras.
139 *
140 * To access this property do: InteraxialSeparation.Get().
141 * To set this property do: InteraxialSeparation.Set(FbxDouble).
142 *
143 * \remarks Default Value is 0.0.
144 */
145 FbxPropertyT<FbxDouble> InteraxialSeparation;
146
147 /** This property handles the distance on the camera view axis where the zero parallax plane occurs.
148 *
149 * To access this property do: ZeroParallax.Get().
150 * To set this property do: ZeroParallax.Set(FbxDouble).
151 *
152 * \remarks Default Value is 0.0.
153 */
154 FbxPropertyT<FbxDouble> ZeroParallax;
155
156 /** This property is to offset the computed toe-in effect when it's in Converged mode.
157 *
158 * To access this property do: ToeInAdjust.Get().
159 * To set this property do: ToeInAdjust.Set(FbxDouble).
160 *
161 * \remarks Default Value is 0.0.
162 * This value is specified in degrees and acts as an offset to the computed toe-in.
163 * \see EStereoType.
164 */
165 FbxPropertyT<FbxDouble> ToeInAdjust;
166
167 /** This property handles the film offset for the right camera.
168 *
169 * To access this property do: FilmOffsetRightCam.Get().
170 * To set this property do: FilmOffsetRightCam.Set(FbxDouble).
171 *
172 * \remarks Default Value is 0.0.
173 */
174 FbxPropertyT<FbxDouble> FilmOffsetRightCam;
175
176 /** This property handles the film offset for the left camera.
177 *
178 * To access this property do: FilmOffsetLeftCam.Get().
179 * To set this property do: FilmOffsetLeftCam.Set(FbxDouble).
180 *
181 * \remarks Default Value is 0.0.
182 */
183 FbxPropertyT<FbxDouble> FilmOffsetLeftCam;
184
185 /** This property has the right camera connected to it.
186 *
187 * To access this property do: GetRightCamera().
188 * To set this property do: SetRightCamera(FbxCamera* pCamera).
189 *
190 * \remarks The right camera is connected as source object.
191 */
192 FbxPropertyT<FbxReference> RightCamera;
193
194 /** This property has the left camera connected to it.
195 *
196 * To access this property do: GetLeftCamera().
197 * To set this property do: SetLeftCamera(FbxCamera* pCamera).
198 *
199 * \remarks The left camera is connected as source object.
200 */
201 FbxPropertyT<FbxReference> LeftCamera;
202
203 /** This property handles the precomp file name
204 *
205 * To access this property do: PrecompFileName.Get().
206 * To set this property do: PrecompFileName.Set(FbxString).
207 *
208 * Default value is ""
209 */
210 FbxPropertyT<FbxString> PrecompFileName;
211
212 /** This property handles the relative precomp file name
213 *
214 * To access this property do: RelativePrecompFileName.Get().
215 * To set this property do: RelativePrecompFileName.Set(FbxString).
216 *
217 * Default value is ""
218 */
219 FbxPropertyT<FbxString> RelativePrecompFileName;
220
221 /** connect left and right camera property to stereo camera.
222 * \return true if it's successful, otherwise return false.
223 * \remarks It's used to connect the left/right camera property [FocalLength, FarPlane, NearPlane, FilmWidth,
224 * FilmHeight, FilmSqueezeRatio] to stereo camera.
225 * During FBX SDK reevaluating, if ConnectProperties is called,
226 * to get the newest FocalLength property of left camera, please use lLeft_Camera->FocalLength.GetSrcProperty();
227 */
228 bool ConnectProperties();
229
230/*****************************************************************************************************************************
231** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
232*****************************************************************************************************************************/
233#ifndef DOXYGEN_SHOULD_SKIP_THIS
234protected:
235 virtual void ConstructProperties(bool pForceSet);
236
237 virtual FbxStringList GetTypeFlags() const;
238#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
239};
240
241inline EFbxType FbxTypeOf(const FbxCameraStereo::EStereoType&){ return eFbxEnum; }
242
243#include <fbxsdk/fbxsdk_nsend.h>
244
245#endif /* _FBXSDK_SCENE_GEOMETRY_CAMERA_STEREO_H_ */
246