Alembic Version 1.1

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>
41#include <Alembic/AbcGeom/Foundation.h>
42#include <Alembic/AbcGeom/FilmBackXformOp.h>
43
44 namespace Alembic {
45 namespace AbcGeom {
46 namespace ALEMBIC_VERSION_NS {
47
48//-*****************************************************************************
49 class ALEMBIC_EXPORT CameraSample
50{
51 public:
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
236 private:
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
264 using namespace ALEMBIC_VERSION_NS;
265
266} // End namespace AbcGeom
267} // End namespace Alembic
268
269#endif
Foundation.h
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition: Export.h:51
FilmBackXformOp.h
ALEMBIC_VERSION_NS
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:105
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample
Definition: CameraSample.h:50
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFocalLength
double getFocalLength() const
get the camera focal length in millimeters.
Definition: CameraSample.h:64
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getChildBounds
Abc::Box3d getChildBounds() const
Definition: CameraSample.h:177
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFilmBackMatrix
Abc::M33d getFilmBackMatrix() const
Returns the concatenated 3x3 film back matrix.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setOverScanRight
void setOverScanRight(double iVal)
Definition: CameraSample.h:117
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getCoreValue
double getCoreValue(std::size_t iIndex) const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFocusDistance
double getFocusDistance() const
Definition: CameraSample.h:143
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getNumOpChannels
std::size_t getNumOpChannels() const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::CameraSample
CameraSample(double iTop, double iBottom, double iLeft, double iRight)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getVerticalFilmOffset
double getVerticalFilmOffset() const
get the vertical film back offset in centimeters
Definition: CameraSample.h:89
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setHorizontalAperture
void setHorizontalAperture(double iVal)
set the horizontal camera film back in centimeters
Definition: CameraSample.h:73
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getShutterOpen
double getShutterOpen() const
get the frame relative shutter open time in seconds.
Definition: CameraSample.h:150
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getLensSqueezeRatio
double getLensSqueezeRatio() const
Definition: CameraSample.h:96
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setOverScanBottom
void setOverScanBottom(double iVal)
Definition: CameraSample.h:133
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::addOp
std::size_t addOp(FilmBackXformOp iOp)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFarClippingPlane
double getFarClippingPlane() const
Definition: CameraSample.h:171
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::operator[]
const FilmBackXformOp & operator[](const std::size_t &iIndex) const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getOverScanLeft
double getOverScanLeft()
Definition: CameraSample.h:105
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::operator[]
FilmBackXformOp & operator[](const std::size_t &iIndex)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::CameraSample
CameraSample()
Creates a default sample with a bunch of defaults set.
Definition: CameraSample.h:54
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getShutterClose
double getShutterClose() const
get the frame relative shutter close time in seconds.
Definition: CameraSample.h:156
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getOp
FilmBackXformOp getOp(std::size_t iIndex) const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setChildBounds
void setChildBounds(const Abc::Box3d &iBounds)
Definition: CameraSample.h:178
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getHorizontalAperture
double getHorizontalAperture() const
get the horizontal camera film back in centimeters
Definition: CameraSample.h:70
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getNearClippingPlane
double getNearClippingPlane() const
Definition: CameraSample.h:163
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setNearClippingPlane
void setNearClippingPlane(double iVal)
Definition: CameraSample.h:167
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setFarClippingPlane
void setFarClippingPlane(double iVal)
Definition: CameraSample.h:175
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getOverScanRight
double getOverScanRight() const
Definition: CameraSample.h:113
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setOverScanTop
void setOverScanTop(double iVal)
Definition: CameraSample.h:125
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getHorizontalFilmOffset
double getHorizontalFilmOffset() const
get the horizontal film back offset in centimeters
Definition: CameraSample.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setShutterClose
void setShutterClose(double iVal)
set the frame relative shutter open time in seconds.
Definition: CameraSample.h:159
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getScreenWindow
void getScreenWindow(double &oTop, double &oBottom, double &oLeft, double &oRight)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setHorizontalFilmOffset
void setHorizontalFilmOffset(double iVal)
set the horizontal film back offset in centimeters
Definition: CameraSample.h:79
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setFStop
void setFStop(double iVal)
set the f-stop (focal length divided by "effective" lens diameter)
Definition: CameraSample.h:139
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::reset
void reset()
Definition: CameraSample.h:202
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getOverScanTop
double getOverScanTop() const
Definition: CameraSample.h:121
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setFocalLength
void setFocalLength(double iVal)
set the camera focal length in millimeters.
Definition: CameraSample.h:67
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFieldOfView
double getFieldOfView() const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setShutterOpen
void setShutterOpen(double iVal)
set the frame relative shutter open time in seconds.
Definition: CameraSample.h:153
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getNumOps
std::size_t getNumOps() const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setLensSqueezeRatio
void setLensSqueezeRatio(double iVal)
Definition: CameraSample.h:100
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setVerticalAperture
void setVerticalAperture(double iVal)
set the vertical camera film back in centimeters
Definition: CameraSample.h:86
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setFocusDistance
void setFocusDistance(double iVal)
Definition: CameraSample.h:147
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getFStop
double getFStop() const
get the f-stop (focal length divided by "effective" lens diameter)
Definition: CameraSample.h:136
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getVerticalAperture
double getVerticalAperture() const
get the vertical camera film back in centimeters
Definition: CameraSample.h:83
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::getOverScanBottom
double getOverScanBottom() const
Definition: CameraSample.h:129
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setOverScanLeft
void setOverScanLeft(double iVal)
Definition: CameraSample.h:109
Alembic::AbcGeom::ALEMBIC_VERSION_NS::CameraSample::setVerticalFilmOffset
void setVerticalFilmOffset(double iVal)
set the vertical film back offset in centimeters
Definition: CameraSample.h:92
Alembic::AbcGeom::ALEMBIC_VERSION_NS::FilmBackXformOp
FilmBack Xform Operation This class holds the data about a particular transform operation,...
Definition: FilmBackXformOp.h:54
Alembic
Alembic namespace ...
Definition: ArchiveInfo.h:46