Alembic Version 1.1
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
45namespace Alembic {
46namespace AbcGeom {
47namespace ALEMBIC_VERSION_NS {
48
49//-*****************************************************************************
50class ALEMBIC_EXPORT OCameraSchema : public Abc::OSchema<CameraSchemaInfo>
51{
52 //-*************************************************************************
53 // CAMERA SCHEMA
54 //-*************************************************************************
55public:
59
60 //-*************************************************************************
61 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
62 //-*************************************************************************
63
67
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
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
104 : Abc::OSchema<CameraSchemaInfo>()
105 {
106 *this = iCopy;
107 }
108
110
111 //-*************************************************************************
112 // SCHEMA STUFF
113 //-*************************************************************************
114
117 { return m_coreProperties.getTimeSampling(); }
118
119 //-*************************************************************************
120 // SAMPLE STUFF
121 //-*************************************************************************
122
126 { return m_coreProperties.getNumSamples(); }
127
129 void set( const CameraSample &iSamp );
130
133
134 void setTimeSampling( uint32_t iIndex );
136
139
141
142 //-*************************************************************************
143 // ABC BASE MECHANISMS
144 // These functions are used by Abc to deal with errors, validity,
145 // and so on.
146 //-*************************************************************************
147
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
162 bool valid() const
163 {
165 m_coreProperties.valid() );
166 }
167
171
172protected:
173 void init( uint32_t iTsIdx );
174
176
178
181
183
185
186private:
187 CameraSample m_initialSample;
188
189};
190
191//-*****************************************************************************
192// SCHEMA OBJECT
193//-*****************************************************************************
195
196typedef Util::shared_ptr< OCamera > OCameraPtr;
197
198} // End namespace ALEMBIC_VERSION_NS
199
200using namespace ALEMBIC_VERSION_NS;
201
202} // End namespace AbcGeom
203} // End namespace Alembic
204
205#endif
#define ALEMBIC_EXPORT
Definition: Export.h:51
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:105
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
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
void set(const CameraSample &iSamp)
Set a sample.
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
OCameraSchema(const OCameraSchema &iCopy)
Copy constructor.
Definition: OCamera.h:103
void setFromPrevious()
Set from previous sample.
Alembic::Util::shared_ptr< CompoundPropertyWriter > CompoundPropertyWriterPtr
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
Util::shared_ptr< OCamera > OCameraPtr
Definition: OCamera.h:196
Abc::OSchemaObject< OCameraSchema > OCamera
Definition: OCamera.h:194
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:288
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:303
Alembic namespace ...
Definition: ArchiveInfo.h:46