Alembic 1.8.11
Loading...
Searching...
No Matches
OCamera.h
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
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
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
104 //-*************************************************************************
105 // SCHEMA STUFF
106 //-*************************************************************************
107
109 AbcA::TimeSamplingPtr getTimeSampling() const
110 { return m_coreProperties.getTimeSampling(); }
111
112 //-*************************************************************************
113 // SAMPLE STUFF
114 //-*************************************************************************
115
119 { return m_coreProperties.getNumSamples(); }
120
122 void set( const CameraSample &iSamp );
123
125 void setFromPrevious();
126
127 void setTimeSampling( uint32_t iIndex );
128 void setTimeSampling( AbcA::TimeSamplingPtr iTime );
129
130 Abc::OCompoundProperty getUserProperties();
131 Abc::OCompoundProperty getArbGeomParams();
132
133 Abc::OBox3dProperty getChildBoundsProperty();
134
135 //-*************************************************************************
136 // ABC BASE MECHANISMS
137 // These functions are used by Abc to deal with errors, validity,
138 // and so on.
139 //-*************************************************************************
140
143 void reset()
144 {
145 m_coreProperties.reset();
146 m_childBoundsProperty.reset();
147 m_userProperties.reset();
148 m_arbGeomParams.reset();
149 m_bigFilmBackChannelsProperty.reset();
150 m_smallFilmBackChannelsProperty.reset();
152 }
153
155 bool valid() const
156 {
158 m_coreProperties.valid() );
159 }
160
164
165protected:
166 void init( uint32_t iTsIdx );
167
168 Abc::OScalarProperty m_coreProperties;
169
170 Abc::OBox3dProperty m_childBoundsProperty;
171
172 Abc::OCompoundProperty m_userProperties;
173 Abc::OCompoundProperty m_arbGeomParams;
174
175 Abc::ODoubleArrayProperty m_bigFilmBackChannelsProperty;
176
177 Abc::OScalarProperty m_smallFilmBackChannelsProperty;
178
179private:
180 CameraSample m_initialSample;
181
182};
183
184//-*****************************************************************************
185// SCHEMA OBJECT
186//-*****************************************************************************
188
189typedef Util::shared_ptr< OCamera > OCameraPtr;
190
191} // End namespace ALEMBIC_VERSION_NS
192
193using namespace ALEMBIC_VERSION_NS;
194
195} // End namespace AbcGeom
196} // End namespace Alembic
197
198#endif
bool valid() const
Definition OBaseProperty.h:170
bool valid() const
Returns whether this function set is valid.
Definition OCamera.h:155
OCameraSchema this_type
Definition OCamera.h:58
size_t getNumSamples()
Definition OCamera.h:118
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment and copy operator used.
Definition OCamera.h:109
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 namespace ...
Definition ArchiveInfo.cpp:39