HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ICamera.h
Go to the documentation of this file.
1 //-*****************************************************************************
2 //
3 // Copyright (c) 2009-2012,
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_ICamera_h_
38 #define _Alembic_AbcGeom_ICamera_h_
39 
40 #include <Alembic/Util/Export.h>
44 
45 namespace Alembic {
46 namespace AbcGeom {
47 namespace ALEMBIC_VERSION_NS {
48 
49 //-*****************************************************************************
50 class ALEMBIC_EXPORT ICameraSchema : public Abc::ISchema<CameraSchemaInfo>
51 {
52  //-*************************************************************************
53  // CAMERA SCHEMA
54  //-*************************************************************************
55 public:
56  //! By convention we always define this_type in AbcGeom classes.
57  //! Used by unspecified-bool-type conversion below
59 
60  //-*************************************************************************
61  // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
62  //-*************************************************************************
63 
64  //! The default constructor creates an empty OCameraMeshSchema
65  //! ...
67 
68  //! This templated, primary constructor creates a new camera writer.
69  //! The first argument is any Abc (or AbcCoreAbstract) object
70  //! which can intrusively be converted to an CompoundPropertyWriterPtr
71  //! to use as a parent, from which the error handler policy for
72  //! inheritance is also derived. The remaining optional arguments
73  //! can be used to override the ErrorHandlerPolicy, to specify
74  //! MetaData, and to set TimeSampling.
75  template <class CPROP_PTR>
76  ICameraSchema( CPROP_PTR iParent,
77  const std::string &iName,
78 
79  const Abc::Argument &iArg0 = Abc::Argument(),
80  const Abc::Argument &iArg1 = Abc::Argument() )
81  : Abc::ISchema<CameraSchemaInfo>( iParent, iName, iArg0, iArg1 )
82  {
83  init( iArg0, iArg1 );
84  }
85 
86  template <class CPROP_PTR>
87  explicit ICameraSchema( CPROP_PTR iParent,
88  const Abc::Argument &iArg0 = Abc::Argument(),
89  const Abc::Argument &iArg1 = Abc::Argument() )
90  : Abc::ISchema<CameraSchemaInfo>( iParent, iArg0, iArg1 )
91  {
92  init( iArg0, iArg1 );
93  }
94 
95 
96  //! Copy constructor.
98  : Abc::ISchema<CameraSchemaInfo>()
99  {
100  *this = iCopy;
101  }
102 
103  //! Default assignment operator used.
104 
105  //! Return the time sampling.
107  { return m_coreProperties.getTimeSampling(); }
108 
109  //! Return the number of samples contained in the property.
110  //! This can be any number, including zero.
111  //! This returns the number of samples that were written, independently
112  //! of whether or not they were constant.
113  size_t getNumSamples() const
114  { return m_coreProperties.getNumSamples(); }
115 
116  //! Ask if we're constant - no change in value amongst samples,
117  //! regardless of the time sampling.
118  bool isConstant() const;
119 
120  void get( CameraSample &oSample,
121  const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const;
122 
124  const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const
125  {
126  CameraSample smp;
127  get( smp, iSS );
128  return smp;
129  }
130 
131  // compound property to use as parent for any arbitrary GeomParams
132  // underneath it
133  ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; }
134  ICompoundProperty getUserProperties() const { return m_userProperties; }
135 
136  Abc::IBox3dProperty getChildBoundsProperty() const { return m_childBoundsProperty; }
137 
138  //! Reset returns this function set to an empty, default
139  //! state.
140  void reset()
141  {
142  m_coreProperties.reset();
143  m_childBoundsProperty.reset();
144  m_arbGeomParams.reset();
145  m_userProperties.reset();
146  m_ops.clear();
148  }
149 
150  //! Returns whether this function set is valid.
151  bool valid() const
152  {
154  m_coreProperties.valid() );
155  }
156 
157  //! unspecified-bool-type operator overload.
158  //! ...
160 
161 protected:
162  void init( const Abc::Argument &iArg0,
163  const Abc::Argument &iArg1 );
164 
166 
168 
171 
174 
175 private:
176  std::vector < FilmBackXformOp > m_ops;
177 
178 };
179 
180 //-*****************************************************************************
181 // SCHEMA OBJECT
182 //-*****************************************************************************
184 
185 typedef Util::shared_ptr< ICamera > ICameraPtr;
186 
187 } // End namespace ALEMBIC_VERSION_NS
188 
189 using namespace ALEMBIC_VERSION_NS;
190 
191 } // End namespace AbcGeom
192 } // End namespace Alembic
193 
194 #endif
ICompoundProperty getUserProperties() const
Definition: ICamera.h:134
Abc::IBox3dProperty getChildBoundsProperty() const
Definition: ICamera.h:136
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
ICameraSchema(const ICameraSchema &iCopy)
Copy constructor.
Definition: ICamera.h:97
Abc::ISchemaObject< ICameraSchema > ICamera
Definition: ICamera.h:183
ICameraSchema(CPROP_PTR iParent, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition: ICamera.h:87
#define ALEMBIC_OVERRIDE_OPERATOR_BOOL(PASS_COND)
Definition: OperatorBool.h:56
ICameraSchema(CPROP_PTR iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition: ICamera.h:76
CameraSample getValue(const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition: ICamera.h:123
Abc::IDoubleArrayProperty m_largeFilmBackChannels
Definition: ICamera.h:173
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Definition: ICamera.h:106
bool valid() const
Returns whether this function set is valid.
Definition: ICamera.h:151
#define ALEMBIC_EXPORT
Definition: Export.h:51
ICompoundProperty getArbGeomParams() const
Definition: ICamera.h:133
Util::shared_ptr< ICamera > ICameraPtr
Definition: ICamera.h:185
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:104