Alembic 1.8.11

Loading...
Searching...
No Matches
OXform.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_OXform_h
38#define Alembic_AbcGeom_OXform_h
39
40#include <Alembic/Util/Export.h>
41#include <Alembic/AbcGeom/Foundation.h>
42#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
43
44#include <Alembic/AbcGeom/XformSample.h>
45
46 namespace Alembic {
47 namespace AbcGeom {
48 namespace ALEMBIC_VERSION_NS {
49
52 static const double kXFORM_DELTA_TOLERANCE = 1.0e-12;
53
54//-*****************************************************************************
55 class ALEMBIC_EXPORT OXformSchema : public Abc::OSchema<XformSchemaInfo>
56{
57 //-*************************************************************************
58 // XFORM SCHEMA
59 //-*************************************************************************
60 public:
61
64 typedef Abc::OSchema<XformSchemaInfo> super_type;
65 typedef OXformSchema this_type;
66 typedef XformSample sample_type;
67
68 //-*************************************************************************
69 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
70 //-*************************************************************************
71
74 OXformSchema()
75 {
76 m_numChannels = 0;
77 m_numOps = 0;
78 m_useArrayProp = false;
79 m_isIdentity = true;
80 }
81
88 OXformSchema( AbcA::CompoundPropertyWriterPtr iParent,
89 const std::string &iName,
90 const Abc::Argument &iArg0 = Abc::Argument(),
91 const Abc::Argument &iArg1 = Abc::Argument(),
92 const Abc::Argument &iArg2 = Abc::Argument(),
93 const Abc::Argument &iArg3 = Abc::Argument() );
94
101 OXformSchema( Abc::OCompoundProperty iParent,
102 const std::string &iName,
103 const Abc::Argument &iArg0 = Abc::Argument(),
104 const Abc::Argument &iArg1 = Abc::Argument(),
105 const Abc::Argument &iArg2 = Abc::Argument() );
106
108
109 //-*************************************************************************
110 // SCHEMA STUFF
111 //-*************************************************************************
112
113 AbcA::TimeSamplingPtr getTimeSampling() const;
114
115 //-*************************************************************************
116 // SAMPLE STUFF
117 //-*************************************************************************
118
121 size_t getNumSamples() const;
122
125 void set( XformSample &ioSamp );
126
128 void setFromPrevious();
129
130 void setTimeSampling( uint32_t iIndex );
131 void setTimeSampling( AbcA::TimeSamplingPtr iTime );
132
133 Abc::OCompoundProperty getArbGeomParams();
134 Abc::OCompoundProperty getUserProperties();
135 Abc::OBox3dProperty getChildBoundsProperty();
136
137 //-*************************************************************************
138 // ABC BASE MECHANISMS
139 // These functions are used by Abc to deal with errors, validity,
140 // and so on.
141 //-*************************************************************************
142
145 void reset()
146 {
147 m_childBoundsProperty.reset();
148 m_inheritsProperty.reset();
149 m_opsPWPtr.reset();
150 m_valsPWPtr.reset();
151 m_protoSample.reset();
152 m_data.reset();
153
154 m_arbGeomParams.reset();
155 m_userProperties.reset();
156
157 m_useArrayProp = false;
158 m_isIdentity = true;
159
160 super_type::reset();
161 }
162
164 bool valid() const
165 {
166 return ( super_type::valid() );
167 }
168
171 ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
172
173
174 private:
175 void init( const AbcA::index_t iTSIndex );
176
177 // not technically needed as the m_protoSample can return this info
178 std::size_t m_numChannels;
179 std::size_t m_numOps;
180
181 // should we store are channel values in an ArrayProperty,
182 // or in a ScalarProperty with some Dimension > 0 and < MAX_SCALAR_CHANS
183 bool m_useArrayProp{false};
184
185 AbcA::DataType m_arrayValuesDataType;
186 Alembic::Util::Dimensions m_arraySampleDimensions;
187
188 void setChannelValues( const std::vector<double> &iVals );
189
190 protected:
191
192 Abc::OBox3dProperty m_childBoundsProperty;
193
194 AbcA::ScalarPropertyWriterPtr m_opsPWPtr;
195
196 AbcA::BasePropertyWriterPtr m_valsPWPtr;
197
198 Abc::OBoolProperty m_inheritsProperty;
199
200 Abc::OBoolProperty m_isNotConstantIdentityProperty;
201
202 // ensure that our sample's topology is unchanging between
203 // calls to set; see usage in OXformSchema::set()
204 XformSample m_protoSample;
205
206 bool m_isIdentity{true};
207
208 Abc::OCompoundProperty m_arbGeomParams;
209
210 Abc::OCompoundProperty m_userProperties;
211
212 class Data;
213
214 // shared and not scoped because we want this to be shared across copies
215 Util::shared_ptr< Data > m_data;
216};
217
218//-*****************************************************************************
219// SCHEMA OBJECT
220//-*****************************************************************************
221 typedef Abc::OSchemaObject<OXformSchema> OXform;
222
223 typedef Util::shared_ptr< OXform > OXformPtr;
224
225} // End namespace ALEMBIC_VERSION_NS
226
227 using namespace ALEMBIC_VERSION_NS;
228
229} // End namespace AbcGeom
230} // End namespace Alembic
231
232#endif
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchema
Definition OSchema.h:119
Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject
Definition OSchemaObject.h:54
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema
Definition OXform.h:56
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::valid
bool valid() const
Valid returns whether this function set is valid.
Definition OXform.h:164
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::super_type
Abc::OSchema< XformSchemaInfo > super_type
Definition OXform.h:64
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::OXformSchema
OXformSchema()
Definition OXform.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(this_type::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema::reset
void reset()
Definition OXform.h:145
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample
Definition XformSample.h:51
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39