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>
41#include <Alembic/AbcGeom/Foundation.h>
42#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
43#include <Alembic/AbcGeom/CameraSample.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:
58 typedef OCameraSchema this_type;
59
60 //-*************************************************************************
61 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
62 //-*************************************************************************
63
66 OCameraSchema() {}
67
72 OCameraSchema( AbcA::CompoundPropertyWriterPtr iParent,
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
103 OCameraSchema(const OCameraSchema& iCopy)
104 : Abc::OSchema<CameraSchemaInfo>()
105 {
106 *this = iCopy;
107 }
108
110
111 //-*************************************************************************
112 // SCHEMA STUFF
113 //-*************************************************************************
114
116 AbcA::TimeSamplingPtr getTimeSampling() const
117 { return m_coreProperties.getTimeSampling(); }
118
119 //-*************************************************************************
120 // SAMPLE STUFF
121 //-*************************************************************************
122
125 size_t getNumSamples()
126 { return m_coreProperties.getNumSamples(); }
127
129 void set( const CameraSample &iSamp );
130
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
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();
158 Abc::OSchema<CameraSchemaInfo>::reset();
159 }
160
162 bool valid() const
163 {
164 return ( Abc::OSchema<CameraSchemaInfo>::valid() &&
165 m_coreProperties.valid() );
166 }
167
170 ALEMBIC_OVERRIDE_OPERATOR_BOOL( OCameraSchema::valid() );
171
172 protected:
173 void init( uint32_t iTsIdx );
174
175 Abc::OScalarProperty m_coreProperties;
176
177 Abc::OBox3dProperty m_childBoundsProperty;
178
179 Abc::OCompoundProperty m_userProperties;
180 Abc::OCompoundProperty m_arbGeomParams;
181
182 Abc::ODoubleArrayProperty m_bigFilmBackChannelsProperty;
183
184 Abc::OScalarProperty m_smallFilmBackChannelsProperty;
185
186 private:
187 CameraSample m_initialSample;
188
189};
190
191//-*****************************************************************************
192// SCHEMA OBJECT
193//-*****************************************************************************
194 typedef Abc::OSchemaObject<OCameraSchema> OCamera;
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
Foundation.h
SchemaInfoDeclarations.h
CameraSample.h
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition: Export.h:51
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::OCameraSchema
Definition: OCamera.h:51
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_arbGeomParams
Abc::OCompoundProperty m_arbGeomParams
Definition: OCamera.h:180
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::valid
bool valid() const
Returns whether this function set is valid.
Definition: OCamera.h:162
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::setTimeSampling
void setTimeSampling(uint32_t iIndex)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(OCameraSchema::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::this_type
OCameraSchema this_type
Definition: OCamera.h:58
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::OCameraSchema
OCameraSchema()
Definition: OCamera.h:66
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::getChildBoundsProperty
Abc::OBox3dProperty getChildBoundsProperty()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_smallFilmBackChannelsProperty
Abc::OScalarProperty m_smallFilmBackChannelsProperty
Definition: OCamera.h:184
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_userProperties
Abc::OCompoundProperty m_userProperties
Definition: OCamera.h:179
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_childBoundsProperty
Abc::OBox3dProperty m_childBoundsProperty
Definition: OCamera.h:177
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::getNumSamples
size_t getNumSamples()
Definition: OCamera.h:125
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Definition: OCamera.h:116
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_coreProperties
Abc::OScalarProperty m_coreProperties
Definition: OCamera.h:175
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::setTimeSampling
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::init
void init(uint32_t iTsIdx)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::reset
void reset()
Definition: OCamera.h:150
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::set
void set(const CameraSample &iSamp)
Set a sample.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::m_bigFilmBackChannelsProperty
Abc::ODoubleArrayProperty m_bigFilmBackChannelsProperty
Definition: OCamera.h:182
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::OCameraSchema
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
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::getArbGeomParams
Abc::OCompoundProperty getArbGeomParams()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::OCameraSchema
OCameraSchema(const OCameraSchema &iCopy)
Copy constructor.
Definition: OCamera.h:103
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::getUserProperties
Abc::OCompoundProperty getUserProperties()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraSchema::setFromPrevious
void setFromPrevious()
Set from previous sample.
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition: Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT< AbcA::CompoundPropertyWriterPtr >::reset
void reset()
Definition: OBaseProperty.h:166
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT::valid
bool valid() const
Definition: OBaseProperty.h:170
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition: OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OScalarProperty
Definition: OScalarProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject
Definition: OSchemaObject.h:54
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema
Definition: OSchema.h:119
Alembic::Abc::ALEMBIC_VERSION_NS::OTypedArrayProperty< Float64TPTraits >
Alembic::Abc::ALEMBIC_VERSION_NS::OTypedScalarProperty< Box3dTPTraits >
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::CompoundPropertyWriterPtr
Alembic::Util::shared_ptr< CompoundPropertyWriter > CompoundPropertyWriterPtr
Definition: ForwardDeclarations.h:83
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::TimeSamplingPtr
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCameraPtr
Util::shared_ptr< OCamera > OCameraPtr
Definition: OCamera.h:196
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OCamera
Abc::OSchemaObject< OCameraSchema > OCamera
Definition: OCamera.h:194
Alembic::Abc::ALEMBIC_VERSION_NS
Definition: ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::GetTimeSampling
AbcA::TimeSamplingPtr GetTimeSampling(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:288
Alembic::Abc::ALEMBIC_VERSION_NS::GetTimeSamplingIndex
uint32_t GetTimeSamplingIndex(const Argument &iArg0, const Argument &iArg1=Argument(), const Argument &iArg2=Argument(), const Argument &iArg3=Argument())
Definition: Argument.h:303
Alembic
Alembic namespace ...
Definition: ArchiveInfo.h:46