Alembic Version 1.1
Loading...
Searching...
No Matches
ICurves.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_ICurves_h
38#define Alembic_AbcGeom_ICurves_h
39
40#include <Alembic/Util/Export.h>
47
48namespace Alembic {
49namespace AbcGeom {
50namespace ALEMBIC_VERSION_NS {
51
52//-*****************************************************************************
53class ALEMBIC_EXPORT ICurvesSchema : public IGeomBaseSchema<CurvesSchemaInfo>
54{
55public:
56 class Sample
57 {
58 public:
60
61 // Users don't ever create this data directly.
62 Sample() { reset(); }
63
64 Abc::P3fArraySamplePtr getPositions() const { return m_positions; }
65
66 std::size_t getNumCurves() const
67 {
68 if ( m_nVertices ) { return m_nVertices->size(); }
69 else { return 0; }
70 }
71
73 { return m_nVertices; }
74
75 CurveType getType() const { return m_type; }
76 CurvePeriodicity getWrap() const { return m_wrap; }
77 BasisType getBasis() const { return m_basis; }
78
79 // the should not be null if the curve type is kVariableOrder
80 Abc::UcharArraySamplePtr getOrders() const { return m_orders; }
81 Abc::FloatArraySamplePtr getKnots() const { return m_knots; }
82
83 // if this is NULL then the weight value of the position for each
84 // point is 1
86 { return m_positionWeights; }
87
88 Abc::Box3d getSelfBounds() const { return m_selfBounds; }
89 Abc::V3fArraySamplePtr getVelocities() const { return m_velocities; }
90
91 bool valid() const
92 {
93 return m_positions.get() != 0 &&
94 (m_type != kVariableOrder || m_orders);
95 }
96
97 void reset()
98 {
99 m_positions.reset();
100 m_nVertices.reset();
101 m_positionWeights.reset();
102
103 m_type = kCubic;
104 m_wrap = kNonPeriodic;
105 m_basis = kBezierBasis;
106
107 m_orders.reset();
108 m_knots.reset();
109
110 m_selfBounds.makeEmpty();
111 }
112
114
115 protected:
116 friend class ICurvesSchema;
120
121 Abc::Box3d m_selfBounds;
122
123 // type, wrap, and nVertices
127
131 };
132
133 //-*************************************************************************
134 // CURVE SCHEMA
135 //-*************************************************************************
136public:
140
142
143 //-*************************************************************************
144 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
145 //-*************************************************************************
146
150
158 const std::string &iName,
159 const Abc::Argument &iArg0 = Abc::Argument(),
160 const Abc::Argument &iArg1 = Abc::Argument() )
161 : IGeomBaseSchema<CurvesSchemaInfo>( iParent, iName, iArg0, iArg1 )
162 {
163 init( iArg0, iArg1 );
164 }
165
171 const Abc::Argument &iArg0 = Abc::Argument(),
172 const Abc::Argument &iArg1 = Abc::Argument() )
173 : IGeomBaseSchema<CurvesSchemaInfo>( iProp, iArg0, iArg1 )
174 {
175 init( iArg0, iArg1 );
176 }
177
179
181 : IGeomBaseSchema<CurvesSchemaInfo>()
182 {
183 *this = iCopy;
184 }
185
186 size_t getNumSamples() const
187 { return m_positionsProperty.getNumSamples(); }
188
192
195 bool isConstant() const
196 { return getTopologyVariance() == kConstantTopology; }
197
201 {
202 return m_positionsProperty.getTimeSampling();
203 }
204
205 //-*************************************************************************
206 void get( sample_type &oSample,
207 const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const;
208
210 Abc::ISampleSelector() ) const
211 {
212 sample_type smp;
213 get( smp, iSS );
214 return smp;
215 }
216
218 {
219 return m_velocitiesProperty;
220 }
221
223 {
224 return m_positionsProperty;
225 }
226
228 {
229 return m_nVerticesProperty;
230 }
231
232 // if this property is invalid then the weight for every point is 1
234 {
235 return m_positionWeightsProperty;
236 }
237
239 {
240 return m_uvsParam;
241 }
242
244 {
245 return m_normalsParam;
246 }
247
249 {
250 return m_widthsParam;
251 }
252
254 {
255 return m_ordersProperty;
256 }
257
259 {
260 return m_knotsProperty;
261 }
262
263 //-*************************************************************************
264 // ABC BASE MECHANISMS
265 // These functions are used by Abc to deal with errors, rewrapping,
266 // and so on.
267 //-*************************************************************************
268
271 void reset()
272 {
273 m_positionsProperty.reset();
274 m_velocitiesProperty.reset();
275 m_nVerticesProperty.reset();
276
277 m_positionWeightsProperty.reset();
278 m_ordersProperty.reset();
279 m_knotsProperty.reset();
280
281 m_uvsParam.reset();
282 m_normalsParam.reset();
283 m_widthsParam.reset();
284
285 m_basisAndTypeProperty.reset();
286
288 }
289
292 bool valid() const
293 {
295 m_positionsProperty.valid() && m_nVerticesProperty.valid() );
296 }
297
300 ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
301
302protected:
303 void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 );
304
308
309 // contains type, wrap, ubasis, and vbasis.
311
315
316 // optional
320};
321
322//-*****************************************************************************
324
325typedef Util::shared_ptr< ICurves > ICurvesPtr;
326
327} // End namespace ALEMBIC_VERSION_NS
328
329using namespace ALEMBIC_VERSION_NS;
330
331} // End namespace AbcGeom
332} // End namespace Alembic
333
334#endif
#define ALEMBIC_EXPORT
Definition Export.h:51
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
Abc::FloatArraySamplePtr getPositionWeights() const
Definition ICurves.h:85
Abc::Int32ArraySamplePtr getCurvesNumVertices() const
Definition ICurves.h:72
ICurvesSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition ICurves.h:170
Abc::IInt32ArrayProperty getNumVerticesProperty() const
Definition ICurves.h:227
void init(const Abc::Argument &iArg0, const Abc::Argument &iArg1)
Abc::IFloatArrayProperty getPositionWeightsProperty() const
Definition ICurves.h:233
ICurvesSchema(const ICurvesSchema &iCopy)
Default assignment operator used.
Definition ICurves.h:180
Abc::IFloatArrayProperty m_positionWeightsProperty
Definition ICurves.h:317
AbcA::TimeSamplingPtr getTimeSampling() const
Definition ICurves.h:200
Abc::IP3fArrayProperty getPositionsProperty() const
Definition ICurves.h:222
Abc::IV3fArrayProperty getVelocitiesProperty() const
Definition ICurves.h:217
MeshTopologyVariance getTopologyVariance() const
void get(sample_type &oSample, const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
sample_type getValue(const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition ICurves.h:209
ICurvesSchema(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition ICurves.h:157
Abc::IUcharArrayProperty getOrdersProperty() const
Definition ICurves.h:253
Abc::IFloatArrayProperty getKnotsProperty() const
Definition ICurves.h:258
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Util::shared_ptr< ICurves > ICurvesPtr
Definition ICurves.h:325
Alembic::Util::shared_ptr< FloatArraySample > FloatArraySamplePtr
Alembic::Util::shared_ptr< UcharArraySample > UcharArraySamplePtr
Alembic::Util::shared_ptr< Int32ArraySample > Int32ArraySamplePtr
Alembic::Util::shared_ptr< V3fArraySample > V3fArraySamplePtr
Alembic::Util::shared_ptr< P3fArraySample > P3fArraySamplePtr
Alembic namespace ...
Definition ArchiveInfo.h:46