HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OCamera.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_OCamera_h
38 #define Alembic_AbcGeom_OCamera_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 OCameraSchema : public Abc::OSchema<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 constructor creates a new camera writer.
69  //! The first argument is the compound property to use as a parent
70  //! The remaining optional arguments are the parents ErrorHandlerPolicy,
71  //! an override to the ErrorHandlerPolicy, MetaData, and TimeSampling info.
73  const std::string &iName,
74 
75  const Abc::Argument &iArg0 = Abc::Argument(),
76  const Abc::Argument &iArg1 = Abc::Argument(),
77  const Abc::Argument &iArg2 = Abc::Argument(),
78  const Abc::Argument &iArg3 = Abc::Argument() )
79  : Abc::OSchema<CameraSchemaInfo>( iParent, iName,
80  iArg0, iArg1, iArg2, iArg3 )
81  {
82 
83  AbcA::TimeSamplingPtr tsPtr =
84  Abc::GetTimeSampling( iArg0, iArg1, iArg2, iArg3 );
85  uint32_t tsIndex =
86  Abc::GetTimeSamplingIndex( iArg0, iArg1, iArg2, iArg3 );
87 
88  // if we specified a valid TimeSamplingPtr, use it to determine the
89  // index otherwise we'll use the index, which defaults to the intrinsic
90  // 0 index
91  if (tsPtr)
92  {
93  tsIndex = iParent->getObject()->getArchive()->addTimeSampling(
94  *tsPtr);
95  }
96 
97  // Meta data and error handling are eaten up by
98  // the super type, so all that's left is time sampling.
99  init( tsIndex );
100  }
101 
102  //! Copy constructor.
104  : Abc::OSchema<CameraSchemaInfo>()
105  {
106  *this = iCopy;
107  }
108 
109  //! Default assignment operator used.
110 
111  //-*************************************************************************
112  // SCHEMA STUFF
113  //-*************************************************************************
114 
115  //! Return the time sampling.
117  { return m_coreProperties.getTimeSampling(); }
118 
119  //-*************************************************************************
120  // SAMPLE STUFF
121  //-*************************************************************************
122 
123  //! Get number of samples written so far.
124  //! ...
125  size_t getNumSamples()
126  { return m_coreProperties.getNumSamples(); }
127 
128  //! Set a sample
129  void set( const CameraSample &iSamp );
130 
131  //! Set from previous sample.
132  void setFromPrevious();
133 
134  void setTimeSampling( uint32_t iIndex );
135  void setTimeSampling( AbcA::TimeSamplingPtr iTime );
136 
137  Abc::OCompoundProperty getUserProperties();
138  Abc::OCompoundProperty getArbGeomParams();
139 
140  Abc::OBox3dProperty getChildBoundsProperty();
141 
142  //-*************************************************************************
143  // ABC BASE MECHANISMS
144  // These functions are used by Abc to deal with errors, validity,
145  // and so on.
146  //-*************************************************************************
147 
148  //! Reset returns this function set to an empty, default
149  //! state.
150  void reset()
151  {
152  m_coreProperties.reset();
153  m_childBoundsProperty.reset();
154  m_userProperties.reset();
155  m_arbGeomParams.reset();
156  m_bigFilmBackChannelsProperty.reset();
157  m_smallFilmBackChannelsProperty.reset();
159  }
160 
161  //! Returns whether this function set is valid.
162  bool valid() const
163  {
165  m_coreProperties.valid() );
166  }
167 
168  //! unspecified-bool-type operator overload.
169  //! ...
171 
172 protected:
173  void init( uint32_t iTsIdx );
174 
176 
178 
181 
183 
185 
186 private:
187  CameraSample m_initialSample;
188 
189 };
190 
191 //-*****************************************************************************
192 // SCHEMA OBJECT
193 //-*****************************************************************************
195 
196 typedef Util::shared_ptr< OCamera > OCameraPtr;
197 
198 } // End namespace ALEMBIC_VERSION_NS
199 
200 using namespace ALEMBIC_VERSION_NS;
201 
202 } // End namespace AbcGeom
203 } // End namespace Alembic
204 
205 #endif
Abc::ODoubleArrayProperty m_bigFilmBackChannelsProperty
Definition: OCamera.h:182
OCameraSchema(AbcA::CompoundPropertyWriterPtr iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument(), const Abc::Argument &iArg3=Abc::Argument())
Definition: OCamera.h:72
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
Abc::OSchemaObject< OCameraSchema > OCamera
Definition: OCamera.h:194
#define ALEMBIC_EXPORT
Definition: Export.h:51
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
#define ALEMBIC_OVERRIDE_OPERATOR_BOOL(PASS_COND)
Definition: OperatorBool.h:56
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:288
bool valid() const
Returns whether this function set is valid.
Definition: OCamera.h:162
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Definition: OCamera.h:116
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:303
OCameraSchema(const OCameraSchema &iCopy)
Copy constructor.
Definition: OCamera.h:103
Util::shared_ptr< OCamera > OCameraPtr
Definition: OCamera.h:196
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:88
Alembic::Util::shared_ptr< CompoundPropertyWriter > CompoundPropertyWriterPtr