Loading...
Searching...
No Matches
IPolyMesh.h
Go to the documentation of this file.
//-*****************************************************************************
//
// Copyright (c) 2009-2012,
// Sony Pictures Imageworks Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Sony Pictures Imageworks, nor
// Industrial Light & Magic, nor the names of their contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//-*****************************************************************************
#ifndef Alembic_AbcGeom_IPolyMesh_h
#define Alembic_AbcGeom_IPolyMesh_h
#include <Alembic/Util/Export.h>
#include <Alembic/AbcGeom/Foundation.h>
#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
#include <Alembic/AbcGeom/IFaceSet.h>
#include <Alembic/AbcGeom/IGeomParam.h>
#include <Alembic/AbcGeom/IGeomBase.h>
namespace Alembic {
namespace AbcGeom {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
class ALEMBIC_EXPORT IPolyMeshSchema
: public IGeomBaseSchema<PolyMeshSchemaInfo>
{
public:
class Sample
{
public:
typedef Sample this_type;
// Users don't ever create this data directly.
Sample() { reset(); }
Abc::P3fArraySamplePtr getPositions() const { return m_positions; }
Abc::V3fArraySamplePtr getVelocities() const { return m_velocities; }
Abc::Int32ArraySamplePtr getFaceIndices() const { return m_indices; }
Abc::Int32ArraySamplePtr getFaceCounts() const { return m_counts; }
Abc::Box3d getSelfBounds() const { return m_selfBounds; }
bool valid() const
{
return m_positions && m_indices && m_counts;
}
void reset()
{
m_positions.reset();
m_velocities.reset();
m_indices.reset();
m_counts.reset();
m_selfBounds.makeEmpty();
}
ALEMBIC_OPERATOR_BOOL( valid() );
protected:
friend class IPolyMeshSchema;
Abc::P3fArraySamplePtr m_positions;
Abc::V3fArraySamplePtr m_velocities;
Abc::Int32ArraySamplePtr m_indices;
Abc::Int32ArraySamplePtr m_counts;
Abc::Box3d m_selfBounds;
};
//-*************************************************************************
// POLY MESH SCHEMA
//-*************************************************************************
public:
typedef IPolyMeshSchema this_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
IPolyMeshSchema() {}
IPolyMeshSchema( const ICompoundProperty &iParent,
const std::string &iName,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
: IGeomBaseSchema<PolyMeshSchemaInfo>( iParent, iName, iArg0, iArg1 )
{
init( iArg0, iArg1 );
}
IPolyMeshSchema( const ICompoundProperty &iProp,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument() )
: IGeomBaseSchema<PolyMeshSchemaInfo>( iProp, iArg0, iArg1 )
{
init( iArg0, iArg1 );
}
IPolyMeshSchema(const IPolyMeshSchema& iCopy)
: IGeomBaseSchema<PolyMeshSchemaInfo>()
{
*this = iCopy;
}
const IPolyMeshSchema & operator=(const IPolyMeshSchema & rhs);
size_t getNumSamples() const
{ return m_positionsProperty.getNumSamples(); }
MeshTopologyVariance getTopologyVariance() const;
bool isConstant() const { return getTopologyVariance() == kConstantTopology; }
AbcA::TimeSamplingPtr getTimeSampling() const
{
if ( m_positionsProperty.valid() )
{
return m_positionsProperty.getTimeSampling();
}
else
{
return getObject().getArchive().getTimeSampling( 0 );
}
}
//-*************************************************************************
void get( Sample &oSample,
const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const
{
ALEMBIC_ABC_SAFE_CALL_BEGIN( "IPolyMeshSchema::get()" );
m_positionsProperty.get( oSample.m_positions, iSS );
m_indicesProperty.get( oSample.m_indices, iSS );
m_countsProperty.get( oSample.m_counts, iSS );
m_selfBoundsProperty.get( oSample.m_selfBounds, iSS );
if ( m_velocitiesProperty && m_velocitiesProperty.getNumSamples() > 0 )
{
m_velocitiesProperty.get( oSample.m_velocities, iSS );
}
// Could error check here.
ALEMBIC_ABC_SAFE_CALL_END();
}
Sample getValue( const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const
{
Sample smp;
get( smp, iSS );
return smp;
}
IV2fGeomParam getUVsParam() const
{
return m_uvsParam;
}
IN3fGeomParam getNormalsParam() const
{
return m_normalsParam;
}
Abc::IInt32ArrayProperty getFaceCountsProperty() const
{
return m_countsProperty;
}
Abc::IInt32ArrayProperty getFaceIndicesProperty() const
{
return m_indicesProperty;
}
Abc::IP3fArrayProperty getPositionsProperty() const
{
return m_positionsProperty;
}
Abc::IV3fArrayProperty getVelocitiesProperty() const
{
return m_velocitiesProperty;
}
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, rewrapping,
// and so on.
//-*************************************************************************
void reset()
{
m_positionsProperty.reset();
m_velocitiesProperty.reset();
m_indicesProperty.reset();
m_countsProperty.reset();
m_uvsParam.reset();
m_normalsParam.reset();
IGeomBaseSchema<PolyMeshSchemaInfo>::reset();
}
bool valid() const
{
return ( IGeomBaseSchema<PolyMeshSchemaInfo>::valid() &&
m_positionsProperty.valid() &&
m_indicesProperty.valid() &&
m_countsProperty.valid() );
}
// FaceSet related
void getFaceSetNames (std::vector <std::string> & oFaceSetNames);
IFaceSet getFaceSet( const std::string &iFaceSetName );
bool hasFaceSet( const std::string &iFaceSetName );
ALEMBIC_OVERRIDE_OPERATOR_BOOL( IPolyMeshSchema::valid() );
protected:
void init( const Abc::Argument &iArg0,
const Abc::Argument &iArg1 );
Abc::IP3fArrayProperty m_positionsProperty;
Abc::IV3fArrayProperty m_velocitiesProperty;
Abc::IInt32ArrayProperty m_indicesProperty;
Abc::IInt32ArrayProperty m_countsProperty;
IV2fGeomParam m_uvsParam;
IN3fGeomParam m_normalsParam;
// FaceSets, this starts as empty until client
// code attempts to access facesets.
bool m_faceSetsLoaded;
std::map <std::string, IFaceSet> m_faceSets;
Alembic::Util::mutex m_faceSetsMutex;
void loadFaceSetNames();
};
//-*****************************************************************************
typedef Abc::ISchemaObject<IPolyMeshSchema> IPolyMesh;
typedef Util::shared_ptr< IPolyMesh > IPolyMeshPtr;
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace AbcGeom
} // End namespace Alembic
#endif
Foundation.h
SchemaInfoDeclarations.h
ALEMBIC_ABC_SAFE_CALL_END
#define ALEMBIC_ABC_SAFE_CALL_END()
Definition ErrorHandler.h:198
ALEMBIC_ABC_SAFE_CALL_BEGIN
#define ALEMBIC_ABC_SAFE_CALL_BEGIN(CONTEXT)
Definition ErrorHandler.h:172
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
IFaceSet.h
IGeomBase.h
IGeomParam.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::reset
virtual void reset()
Definition IGeomBase.h:147
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema< PolyMeshSchemaInfo >::m_selfBoundsProperty
Abc::IBox3dProperty m_selfBoundsProperty
Definition IGeomBase.h:183
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema::valid
virtual bool valid() const
Definition IGeomBase.h:156
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBaseSchema< PolyMeshSchemaInfo >::IGeomBaseSchema
IGeomBaseSchema()
Definition IGeomBase.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample
Definition IPolyMesh.h:57
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::this_type
Sample this_type
Definition IPolyMesh.h:59
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::m_selfBounds
Abc::Box3d m_selfBounds
Definition IPolyMesh.h:92
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::getSelfBounds
Abc::Box3d getSelfBounds() const
Definition IPolyMesh.h:68
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::valid
bool valid() const
Definition IPolyMesh.h:70
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::ALEMBIC_OPERATOR_BOOL
ALEMBIC_OPERATOR_BOOL(valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::m_positions
Abc::P3fArraySamplePtr m_positions
Definition IPolyMesh.h:88
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::m_indices
Abc::Int32ArraySamplePtr m_indices
Definition IPolyMesh.h:90
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::getPositions
Abc::P3fArraySamplePtr getPositions() const
Definition IPolyMesh.h:64
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::Sample
Sample()
Definition IPolyMesh.h:62
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::getFaceIndices
Abc::Int32ArraySamplePtr getFaceIndices() const
Definition IPolyMesh.h:66
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::getVelocities
Abc::V3fArraySamplePtr getVelocities() const
Definition IPolyMesh.h:65
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::getFaceCounts
Abc::Int32ArraySamplePtr getFaceCounts() const
Definition IPolyMesh.h:67
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::m_velocities
Abc::V3fArraySamplePtr m_velocities
Definition IPolyMesh.h:89
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::reset
void reset()
Definition IPolyMesh.h:75
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::IPolyMeshSchema
friend class IPolyMeshSchema
Definition IPolyMesh.h:87
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::Sample::m_counts
Abc::Int32ArraySamplePtr m_counts
Definition IPolyMesh.h:91
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_countsProperty
Abc::IInt32ArrayProperty m_countsProperty
Definition IPolyMesh.h:285
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::loadFaceSetNames
void loadFaceSetNames()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::IPolyMeshSchema
IPolyMeshSchema(const IPolyMeshSchema &iCopy)
Copy constructor.
Definition IPolyMesh.h:140
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_faceSets
std::map< std::string, IFaceSet > m_faceSets
Definition IPolyMesh.h:293
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_uvsParam
IV2fGeomParam m_uvsParam
Definition IPolyMesh.h:287
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getUVsParam
IV2fGeomParam getUVsParam() const
Definition IPolyMesh.h:207
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(IPolyMeshSchema::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getValue
Sample getValue(const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition IPolyMesh.h:200
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getTopologyVariance
MeshTopologyVariance getTopologyVariance() const
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_positionsProperty
Abc::IP3fArrayProperty m_positionsProperty
Definition IPolyMesh.h:282
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getFaceSetNames
void getFaceSetNames(std::vector< std::string > &oFaceSetNames)
Appends the names of any FaceSets for this PolyMesh.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getVelocitiesProperty
Abc::IV3fArrayProperty getVelocitiesProperty() const
Definition IPolyMesh.h:232
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Definition IPolyMesh.h:166
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::IPolyMeshSchema
IPolyMeshSchema()
Definition IPolyMesh.h:109
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getPositionsProperty
Abc::IP3fArrayProperty getPositionsProperty() const
Definition IPolyMesh.h:227
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::reset
void reset()
Definition IPolyMesh.h:245
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getFaceSet
IFaceSet getFaceSet(const std::string &iFaceSetName)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::IPolyMeshSchema
IPolyMeshSchema(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IPolyMesh.h:117
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getFaceIndicesProperty
Abc::IInt32ArrayProperty getFaceIndicesProperty() const
Definition IPolyMesh.h:222
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_faceSetsLoaded
bool m_faceSetsLoaded
Definition IPolyMesh.h:292
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::get
void get(Sample &oSample, const Abc::ISampleSelector &iSS=Abc::ISampleSelector()) const
Definition IPolyMesh.h:179
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::isConstant
bool isConstant() const
Definition IPolyMesh.h:161
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_faceSetsMutex
Alembic::Util::mutex m_faceSetsMutex
Definition IPolyMesh.h:294
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::init
void init(const Abc::Argument &iArg0, const Abc::Argument &iArg1)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::valid
bool valid() const
Definition IPolyMesh.h:260
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getFaceCountsProperty
Abc::IInt32ArrayProperty getFaceCountsProperty() const
Definition IPolyMesh.h:217
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::this_type
IPolyMeshSchema this_type
Definition IPolyMesh.h:101
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::hasFaceSet
bool hasFaceSet(const std::string &iFaceSetName)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_normalsParam
IN3fGeomParam m_normalsParam
Definition IPolyMesh.h:288
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getNormalsParam
IN3fGeomParam getNormalsParam() const
Definition IPolyMesh.h:212
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_indicesProperty
Abc::IInt32ArrayProperty m_indicesProperty
Definition IPolyMesh.h:284
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::IPolyMeshSchema
IPolyMeshSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition IPolyMesh.h:131
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::operator=
const IPolyMeshSchema & operator=(const IPolyMeshSchema &rhs)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::getNumSamples
size_t getNumSamples() const
Definition IPolyMesh.h:152
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshSchema::m_velocitiesProperty
Abc::IV3fArrayProperty m_velocitiesProperty
Definition IPolyMesh.h:283
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::IBasePropertyT< AbcA::CompoundPropertyReaderPtr >::getObject
IObject getObject() const
Definition IBaseProperty.h:207
Alembic::Abc::ALEMBIC_VERSION_NS::ICompoundProperty
Definition ICompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::ISampleSelector
Definition ISampleSelector.h:49
Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject
Definition ISchemaObject.h:56
Alembic::Util::ALEMBIC_VERSION_NS::mutex
Definition Foundation.h:250
Alembic::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom::ALEMBIC_VERSION_NS::MeshTopologyVariance
MeshTopologyVariance
Definition Foundation.h:59
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kConstantTopology
@ kConstantTopology
Definition Foundation.h:60
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IFaceSet
Abc::ISchemaObject< IFaceSetSchema > IFaceSet
Definition IFaceSet.h:239
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IN3fGeomParam
ITypedGeomParam< N3fTPTraits > IN3fGeomParam
Definition IGeomParam.h:567
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IV2fGeomParam
ITypedGeomParam< V2fTPTraits > IV2fGeomParam
Definition IGeomParam.h:520
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMesh
Abc::ISchemaObject< IPolyMeshSchema > IPolyMesh
Definition IPolyMesh.h:299
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IPolyMeshPtr
Util::shared_ptr< IPolyMesh > IPolyMeshPtr
Definition IPolyMesh.h:301
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::IP3fArrayProperty
ITypedArrayProperty< P3fTPTraits > IP3fArrayProperty
Definition ITypedArrayProperty.h:247
Alembic::Abc::ALEMBIC_VERSION_NS::IInt32ArrayProperty
ITypedArrayProperty< Int32TPTraits > IInt32ArrayProperty
Definition ITypedArrayProperty.h:221
Alembic::Abc::ALEMBIC_VERSION_NS::Int32ArraySamplePtr
Alembic::Util::shared_ptr< Int32ArraySample > Int32ArraySamplePtr
Definition TypedArraySample.h:224
Alembic::Abc::ALEMBIC_VERSION_NS::V3fArraySamplePtr
Alembic::Util::shared_ptr< V3fArraySample > V3fArraySamplePtr
Definition TypedArraySample.h:240
Alembic::Abc::ALEMBIC_VERSION_NS::IV3fArrayProperty
ITypedArrayProperty< V3fTPTraits > IV3fArrayProperty
Definition ITypedArrayProperty.h:237
Alembic::Abc::ALEMBIC_VERSION_NS::P3fArraySamplePtr
Alembic::Util::shared_ptr< P3fArraySample > P3fArraySamplePtr
Definition TypedArraySample.h:250
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46