Alembic Version 1.1
Loading...
Searching...
No Matches
CameraSample.h
Go to the documentation of this file.
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2011,
4// Sony Pictures Imageworks, Inc. and
5// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
6//
7// All rights reserved.
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12// * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14// * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18// * Neither the name of Sony Pictures Imageworks, nor
19// Industrial Light & Magic nor the names of their contributors may be used
20// to endorse or promote products derived from this software without specific
21// 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// OWNER 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
37#ifndef Alembic_AbcGeom_CameraSample_h
38#define Alembic_AbcGeom_CameraSample_h
39
40#include <Alembic/Util/Export.h>
43
44namespace Alembic {
45namespace AbcGeom {
46namespace ALEMBIC_VERSION_NS {
47
48//-*****************************************************************************
50{
51public:
52
54 CameraSample() { reset(); }
55
58 CameraSample( double iTop, double iBottom, double iLeft, double iRight );
59
60 void getScreenWindow( double & oTop, double & oBottom, double & oLeft,
61 double & oRight );
62
64 double getFocalLength() const { return m_focalLength; }
65
67 void setFocalLength( double iVal ) { m_focalLength = iVal; }
68
70 double getHorizontalAperture() const { return m_horizontalAperture; }
71
73 void setHorizontalAperture( double iVal ) { m_horizontalAperture = iVal; }
74
76 double getHorizontalFilmOffset() const { return m_horizontalFilmOffset; }
77
79 void setHorizontalFilmOffset( double iVal )
80 { m_horizontalFilmOffset = iVal; }
81
83 double getVerticalAperture() const { return m_verticalAperture; }
84
86 void setVerticalAperture( double iVal ) { m_verticalAperture = iVal; }
87
89 double getVerticalFilmOffset() const { return m_verticalFilmOffset; }
90
92 void setVerticalFilmOffset( double iVal ) { m_verticalFilmOffset = iVal; }
93
96 double getLensSqueezeRatio() const { return m_lensSqueezeRatio; }
97
100 void setLensSqueezeRatio( double iVal )
101 { m_lensSqueezeRatio = iVal; }
102
105 double getOverScanLeft() { return m_overscanLeft; }
106
109 void setOverScanLeft( double iVal ) { m_overscanLeft = iVal; }
110
113 double getOverScanRight() const { return m_overscanRight; }
114
117 void setOverScanRight( double iVal ) { m_overscanRight = iVal; }
118
121 double getOverScanTop() const { return m_overscanTop; }
122
125 void setOverScanTop( double iVal ) { m_overscanTop = iVal; }
126
129 double getOverScanBottom() const { return m_overscanBottom; }
130
133 void setOverScanBottom( double iVal ) { m_overscanBottom = iVal; }
134
136 double getFStop() const { return m_fStop; }
137
139 void setFStop( double iVal ) { m_fStop = iVal; }
140
143 double getFocusDistance() const { return m_focusDistance; }
144
147 void setFocusDistance( double iVal ) { m_focusDistance = iVal; }
148
150 double getShutterOpen() const { return m_shutterOpen; }
151
153 void setShutterOpen( double iVal ) { m_shutterOpen = iVal; }
154
156 double getShutterClose() const { return m_shutterClose; }
157
159 void setShutterClose( double iVal ) { m_shutterClose = iVal; }
160
163 double getNearClippingPlane() const { return m_nearClippingPlane; }
164
167 void setNearClippingPlane( double iVal ) { m_nearClippingPlane = iVal; }
168
171 double getFarClippingPlane() const { return m_farClippingPlane; }
172
175 void setFarClippingPlane( double iVal ) { m_farClippingPlane = iVal; }
176
177 Abc::Box3d getChildBounds() const { return m_childBounds; }
178 void setChildBounds( const Abc::Box3d & iBounds )
179 { m_childBounds = iBounds; }
180
181
182 // helper function for getting one of the 16 core, non film back xform op
183 // related values
184 double getCoreValue( std::size_t iIndex ) const;
185
186 // calculated the field of view in degrees
187 double getFieldOfView() const;;
188
189 // add an op and return the index of the op in its op-stack
190 std::size_t addOp( FilmBackXformOp iOp );
191
192 FilmBackXformOp getOp( std::size_t iIndex ) const;
193 FilmBackXformOp &operator[]( const std::size_t &iIndex );
194 const FilmBackXformOp &operator[]( const std::size_t &iIndex ) const;
195
197 Abc::M33d getFilmBackMatrix () const;
198
199 std::size_t getNumOps() const;
200 std::size_t getNumOpChannels() const;
201
202 void reset()
203 {
204 // in mm
205 m_focalLength = 35.0;
206
207 // in cm
208 m_horizontalAperture = 3.6;
209 m_horizontalFilmOffset = 0.0;
210 m_verticalAperture = 2.4;
211 m_verticalFilmOffset = 0.0;
212
213 // width/height lens aspect ratio
214 m_lensSqueezeRatio = 1.0;
215
216 m_overscanLeft = 0.0;
217 m_overscanRight = 0.0;
218 m_overscanTop = 0.0;
219 m_overscanBottom = 0.0;
220
221 // optical property of the lens, focal length divided by
222 // "effective" lens diameter
223 m_fStop = 5.6;
224
225 m_focusDistance = 5.0;
226 m_shutterOpen = 0.0;
227 m_shutterClose = 0.020833333333333332;
228
229 m_nearClippingPlane = 0.1;
230 m_farClippingPlane = 100000.0;
231
232 m_childBounds.makeEmpty();
233 m_ops.clear();
234 }
235
236private:
237 double m_focalLength;
238 double m_horizontalAperture;
239 double m_horizontalFilmOffset;
240 double m_verticalAperture;
241 double m_verticalFilmOffset;
242 double m_lensSqueezeRatio;
243
244 double m_overscanLeft;
245 double m_overscanRight;
246 double m_overscanTop;
247 double m_overscanBottom;
248
249 double m_fStop;
250 double m_focusDistance;
251 double m_shutterOpen;
252 double m_shutterClose;
253
254 double m_nearClippingPlane;
255 double m_farClippingPlane;
256
257 Abc::Box3d m_childBounds;
258
259 std::vector<FilmBackXformOp> m_ops;
260};
261
262} // End namespace ALEMBIC_VERSION_NS
263
264using namespace ALEMBIC_VERSION_NS;
265
266} // End namespace AbcGeom
267} // End namespace Alembic
268
269#endif
#define ALEMBIC_EXPORT
Definition Export.h:51
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
double getFocalLength() const
get the camera focal length in millimeters.
Abc::M33d getFilmBackMatrix() const
Returns the concatenated 3x3 film back matrix.
double getCoreValue(std::size_t iIndex) const
CameraSample(double iTop, double iBottom, double iLeft, double iRight)
double getVerticalFilmOffset() const
get the vertical film back offset in centimeters
void setHorizontalAperture(double iVal)
set the horizontal camera film back in centimeters
double getShutterOpen() const
get the frame relative shutter open time in seconds.
std::size_t addOp(FilmBackXformOp iOp)
const FilmBackXformOp & operator[](const std::size_t &iIndex) const
FilmBackXformOp & operator[](const std::size_t &iIndex)
CameraSample()
Creates a default sample with a bunch of defaults set.
double getShutterClose() const
get the frame relative shutter close time in seconds.
FilmBackXformOp getOp(std::size_t iIndex) const
void setChildBounds(const Abc::Box3d &iBounds)
double getHorizontalAperture() const
get the horizontal camera film back in centimeters
double getHorizontalFilmOffset() const
get the horizontal film back offset in centimeters
void setShutterClose(double iVal)
set the frame relative shutter open time in seconds.
void getScreenWindow(double &oTop, double &oBottom, double &oLeft, double &oRight)
void setHorizontalFilmOffset(double iVal)
set the horizontal film back offset in centimeters
void setFStop(double iVal)
set the f-stop (focal length divided by "effective" lens diameter)
void setFocalLength(double iVal)
set the camera focal length in millimeters.
void setShutterOpen(double iVal)
set the frame relative shutter open time in seconds.
void setVerticalAperture(double iVal)
set the vertical camera film back in centimeters
double getFStop() const
get the f-stop (focal length divided by "effective" lens diameter)
double getVerticalAperture() const
get the vertical camera film back in centimeters
void setVerticalFilmOffset(double iVal)
set the vertical film back offset in centimeters
FilmBack Xform Operation This class holds the data about a particular transform operation,...
Alembic namespace ...
Definition ArchiveInfo.h:46