00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _Alembic_AbcGeom_ICurves_h_
00038 #define _Alembic_AbcGeom_ICurves_h_
00039
00040 #include <Alembic/AbcGeom/Foundation.h>
00041 #include <Alembic/AbcGeom/Basis.h>
00042 #include <Alembic/AbcGeom/CurveType.h>
00043 #include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
00044 #include <Alembic/AbcGeom/IGeomParam.h>
00045 #include <Alembic/AbcGeom/IGeomBase.h>
00046
00047 namespace Alembic {
00048 namespace AbcGeom {
00049 namespace ALEMBIC_VERSION_NS {
00050
00051
00052 class ICurvesSchema : public IGeomBaseSchema<CurvesSchemaInfo>
00053 {
00054 public:
00055 class Sample
00056 {
00057 public:
00058 typedef Sample this_type;
00059
00060
00061 Sample() { reset(); }
00062
00063 Abc::P3fArraySamplePtr getPositions() const { return m_positions; }
00064
00065 std::size_t getNumCurves() const
00066 {
00067 if ( m_nVertices ) { return m_nVertices->size(); }
00068 else { return 0; }
00069 }
00070
00071 Abc::Int32ArraySamplePtr getCurvesNumVertices() const
00072 { return m_nVertices; }
00073
00074 CurveType getType() const { return m_type; }
00075 CurvePeriodicity getWrap() const { return m_wrap; }
00076 BasisType getBasis() const { return m_basis; }
00077
00078 Abc::Box3d getSelfBounds() const { return m_selfBounds; }
00079 Abc::Box3d getChildBounds() const { return m_childBounds; }
00080 Abc::V3fArraySamplePtr getVelocities() const { return m_velocities; }
00081
00082 bool valid() const
00083 {
00084 return m_positions;
00085 }
00086
00087 void reset()
00088 {
00089 m_positions.reset();
00090 m_nVertices.reset();
00091
00092 m_type = kCubic;
00093 m_wrap = kNonPeriodic;
00094 m_basis = kBezierBasis;
00095
00096 m_selfBounds.makeEmpty();
00097 m_childBounds.makeEmpty();
00098 }
00099
00100 ALEMBIC_OPERATOR_BOOL( valid() );
00101
00102 protected:
00103 friend class ICurvesSchema;
00104 Abc::P3fArraySamplePtr m_positions;
00105 Abc::V3fArraySamplePtr m_velocities;
00106
00107 Abc::Box3d m_selfBounds;
00108 Abc::Box3d m_childBounds;
00109
00110
00111 Abc::Int32ArraySamplePtr m_nVertices;
00112
00113 CurveType m_type;
00114 BasisType m_basis;
00115 CurvePeriodicity m_wrap;
00116 };
00117
00118
00119
00120
00121 public:
00122
00123
00124 typedef ICurvesSchema this_type;
00125
00126 typedef ICurvesSchema::Sample sample_type;
00127
00128
00129
00130
00131
00132
00133
00134 ICurvesSchema() {}
00135
00136
00137
00138
00139
00140
00141
00142
00143 template <class CPROP_PTR>
00144 ICurvesSchema( CPROP_PTR iParent,
00145 const std::string &iName,
00146 const Abc::Argument &iArg0 = Abc::Argument(),
00147 const Abc::Argument &iArg1 = Abc::Argument() )
00148 : IGeomBaseSchema<CurvesSchemaInfo>( iParent, iName, iArg0, iArg1 )
00149 {
00150 init( iArg0, iArg1 );
00151 }
00152
00153
00154
00155 template <class CPROP_PTR>
00156 explicit ICurvesSchema( CPROP_PTR iParent,
00157 const Abc::Argument &iArg0 = Abc::Argument(),
00158 const Abc::Argument &iArg1 = Abc::Argument() )
00159 : IGeomBaseSchema<CurvesSchemaInfo>( iParent, iArg0, iArg1 )
00160 {
00161 init( iArg0, iArg1 );
00162 }
00163
00164
00165 template <class CPROP_PTR>
00166 ICurvesSchema( CPROP_PTR iThis,
00167 Abc::WrapExistingFlag iFlag,
00168 const Abc::Argument &iArg0 = Abc::Argument(),
00169 const Abc::Argument &iArg1 = Abc::Argument() )
00170 : IGeomBaseSchema<CurvesSchemaInfo>( iThis, iFlag, iArg0, iArg1 )
00171 {
00172 init( iArg0, iArg1 );
00173 }
00174
00175
00176
00177 ICurvesSchema( const ICurvesSchema &iCopy )
00178 : IGeomBaseSchema<CurvesSchemaInfo>()
00179 {
00180 *this = iCopy;
00181 }
00182
00183 size_t getNumSamples() const
00184 { return m_positionsProperty.getNumSamples(); }
00185
00186
00187
00188 MeshTopologyVariance getTopologyVariance() const;
00189
00190
00191
00192 bool isConstant() const
00193 { return getTopologyVariance() == kConstantTopology; }
00194
00195
00196
00197 AbcA::TimeSamplingPtr getTimeSampling() const
00198 {
00199 return m_positionsProperty.getTimeSampling();
00200 }
00201
00202
00203 void get( sample_type &oSample,
00204 const Abc::ISampleSelector &iSS = Abc::ISampleSelector() );
00205
00206 sample_type getValue( const Abc::ISampleSelector &iSS =
00207 Abc::ISampleSelector() )
00208 {
00209 sample_type smp;
00210 get( smp, iSS );
00211 return smp;
00212 }
00213
00214 Abc::IV3fArrayProperty getVelocitiesProperty() const
00215 {
00216 return m_velocitiesProperty;
00217 }
00218
00219 Abc::IP3fArrayProperty getPositionsProperty() const
00220 {
00221 return m_positionsProperty;
00222 }
00223
00224 Abc::IInt32ArrayProperty getNumVerticesProperty() const
00225 {
00226 return m_nVerticesProperty;
00227 }
00228
00229 IV2fGeomParam &getUVsParam() { return m_uvsParam; }
00230 IN3fGeomParam &getNormalsParam() { return m_normalsParam; }
00231 IFloatGeomParam &getWidthsParam() { return m_widthsParam; }
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 void reset()
00244 {
00245 m_positionsProperty.reset();
00246 m_velocitiesProperty.reset();
00247 m_nVerticesProperty.reset();
00248
00249 m_uvsParam.reset();
00250 m_normalsParam.reset();
00251 m_widthsParam.reset();
00252
00253 m_basisAndTypeProperty.reset();
00254
00255 IGeomBaseSchema<CurvesSchemaInfo>::reset();
00256 }
00257
00258
00259
00260 bool valid() const
00261 {
00262 return ( IGeomBaseSchema<CurvesSchemaInfo>::valid() &&
00263 m_positionsProperty.valid() && m_nVerticesProperty.valid() );
00264 }
00265
00266
00267
00268 ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
00269
00270 protected:
00271 void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 );
00272
00273 Abc::IP3fArrayProperty m_positionsProperty;
00274 Abc::IV3fArrayProperty m_velocitiesProperty;
00275 Abc::IInt32ArrayProperty m_nVerticesProperty;
00276
00277
00278 Abc::IScalarProperty m_basisAndTypeProperty;
00279
00280 IFloatGeomParam m_widthsParam;
00281 IV2fGeomParam m_uvsParam;
00282 IN3fGeomParam m_normalsParam;
00283 };
00284
00285
00286 typedef Abc::ISchemaObject<ICurvesSchema> ICurves;
00287
00288 }
00289
00290 using namespace ALEMBIC_VERSION_NS;
00291
00292 }
00293 }
00294
00295 #endif