Loading...
Searching...
No Matches
OPoints.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_OPoints_h
#define Alembic_AbcGeom_OPoints_h
#include <Alembic/Util/Export.h>
#include <Alembic/AbcGeom/Foundation.h>
#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
#include <Alembic/AbcGeom/OGeomParam.h>
#include <Alembic/AbcGeom/OGeomBase.h>
namespace Alembic {
namespace AbcGeom {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
class ALEMBIC_EXPORT OPointsSchema : public OGeomBaseSchema<PointsSchemaInfo>
{
public:
//-*************************************************************************
// POINTS SCHEMA SAMPLE TYPE
//-*************************************************************************
class Sample
{
public:
Sample() { reset(); }
Sample( const Abc::P3fArraySample &iPos,
const Abc::V3fArraySample &iVelocities = Abc::V3fArraySample(),
const OFloatGeomParam::Sample &iWidths = \
OFloatGeomParam::Sample() )
: m_positions( iPos )
, m_velocities( iVelocities )
, m_widths( iWidths )
{}
Sample( const Abc::P3fArraySample &iPos,
const Abc::UInt64ArraySample &iId,
const Abc::V3fArraySample &iVelocities = Abc::V3fArraySample(),
const OFloatGeomParam::Sample &iWidths = \
OFloatGeomParam::Sample() )
: m_positions( iPos )
, m_velocities( iVelocities )
, m_ids( iId )
, m_widths( iWidths )
{}
// positions accessor
const Abc::P3fArraySample &getPositions() const { return m_positions; }
void setPositions( const Abc::P3fArraySample &iSmp )
{ m_positions = iSmp; }
// ids accessor
const Abc::UInt64ArraySample &getIds() const { return m_ids; }
void setIds( const Abc::UInt64ArraySample &iSmp )
{ m_ids = iSmp; }
// velocities accessor
const Abc::V3fArraySample &getVelocities() const { return m_velocities; }
void setVelocities( const Abc::V3fArraySample &iVelocities )
{ m_velocities = iVelocities; }
// widths accessor
const OFloatGeomParam::Sample &getWidths() const { return m_widths; }
void setWidths( const OFloatGeomParam::Sample &iWidths )
{ m_widths = iWidths; }
const Abc::Box3d &getSelfBounds() const { return m_selfBounds; }
void setSelfBounds( const Abc::Box3d &iBnds )
{ m_selfBounds = iBnds; }
void reset()
{
m_positions.reset();
m_velocities.reset();
m_ids.reset();
m_widths.reset();
m_selfBounds.makeEmpty();
}
bool isPartialSample() const
{
if( !m_positions.getData() )
{
return true;
}
return false;
}
protected:
Abc::P3fArraySample m_positions;
Abc::V3fArraySample m_velocities;
Abc::UInt64ArraySample m_ids;
OFloatGeomParam::Sample m_widths;
Abc::Box3d m_selfBounds;
};
//-*************************************************************************
// POINTS SCHEMA
//-*************************************************************************
public:
typedef OPointsSchema this_type;
//-*************************************************************************
// CONSTRUCTION, DESTRUCTION, ASSIGNMENT
//-*************************************************************************
OPointsSchema()
{
m_selectiveExport = false;
m_numSamples = 0;
m_timeSamplingIndex = 0;
}
OPointsSchema( 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() );
OPointsSchema( Abc::OCompoundProperty iParent,
const std::string &iName,
const Abc::Argument &iArg0 = Abc::Argument(),
const Abc::Argument &iArg1 = Abc::Argument(),
const Abc::Argument &iArg2 = Abc::Argument() );
OPointsSchema(const OPointsSchema& iCopy)
: OGeomBaseSchema<PointsSchemaInfo>()
{
*this = iCopy;
}
//-*************************************************************************
// SCHEMA STUFF
//-*************************************************************************
AbcA::TimeSamplingPtr getTimeSampling() const
{
if( m_positionsProperty.valid() )
{
return m_positionsProperty.getTimeSampling();
}
else
{
return getObject().getArchive().getTimeSampling( 0 );
}
}
//-*************************************************************************
// SAMPLE STUFF
//-*************************************************************************
size_t getNumSamples() const { return m_numSamples; }
void set( const Sample &iSamp );
void setFromPrevious( );
void setTimeSampling( uint32_t iIndex );
void setTimeSampling( AbcA::TimeSamplingPtr iTime );
//-*************************************************************************
// ABC BASE MECHANISMS
// These functions are used by Abc to deal with errors, validity,
// and so on.
//-*************************************************************************
void reset()
{
m_positionsProperty.reset();
m_idsProperty.reset();
m_velocitiesProperty.reset();
m_widthsParam.reset();
OGeomBaseSchema<PointsSchemaInfo>::reset();
}
bool valid() const
{
return ( ( OGeomBaseSchema<PointsSchemaInfo>::valid() &&
m_positionsProperty.valid() &&
m_idsProperty.valid() )
|| m_selectiveExport );
}
ALEMBIC_OVERRIDE_OPERATOR_BOOL( OPointsSchema::valid() );
private:
void init( uint32_t iTsIdx, bool isSparse );
void selectiveSet( const Sample &iSamp );
void createPositionProperty();
void createIdProperty();
void createVelocityProperty();
void createWidthsProperty( const Sample &iSamp );
Abc::OP3fArrayProperty m_positionsProperty;
Abc::OUInt64ArrayProperty m_idsProperty;
Abc::OV3fArrayProperty m_velocitiesProperty;
OFloatGeomParam m_widthsParam;
// Write out only some properties (UVs, normals).
// This is to export data to layer into another file later.
bool m_selectiveExport;
// Number of times OPolyMeshSchema::set() has been called
size_t m_numSamples;
uint32_t m_timeSamplingIndex;
};
//-*****************************************************************************
// SCHEMA OBJECT
//-*****************************************************************************
typedef Abc::OSchemaObject<OPointsSchema> OPoints;
typedef Util::shared_ptr< OPoints > OPointsPtr;
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace AbcGeom
} // End namespace Alembic
#endif
Foundation.h
SchemaInfoDeclarations.h
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
OGeomBase.h
OGeomParam.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema< PointsSchemaInfo >::OGeomBaseSchema
OGeomBaseSchema()
Definition OGeomBase.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::reset
virtual void reset()
Definition OGeomBase.h:110
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::valid
virtual bool valid() const
Definition OGeomBase.h:119
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample
Definition OPoints.h:58
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::getSelfBounds
const Abc::Box3d & getSelfBounds() const
Definition OPoints.h:109
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::setWidths
void setWidths(const OFloatGeomParam::Sample &iWidths)
Definition OPoints.h:106
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::isPartialSample
bool isPartialSample() const
Definition OPoints.h:123
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::getWidths
const OFloatGeomParam::Sample & getWidths() const
Definition OPoints.h:105
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::m_positions
Abc::P3fArraySample m_positions
Definition OPoints.h:134
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::Sample
Sample()
Definition OPoints.h:62
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::getVelocities
const Abc::V3fArraySample & getVelocities() const
Definition OPoints.h:100
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::reset
void reset()
Definition OPoints.h:113
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::Sample
Sample(const Abc::P3fArraySample &iPos, const Abc::UInt64ArraySample &iId, const Abc::V3fArraySample &iVelocities=Abc::V3fArraySample(), const OFloatGeomParam::Sample &iWidths=OFloatGeomParam::Sample())
Definition OPoints.h:78
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::m_selfBounds
Abc::Box3d m_selfBounds
Definition OPoints.h:139
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::setSelfBounds
void setSelfBounds(const Abc::Box3d &iBnds)
Definition OPoints.h:110
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::m_widths
OFloatGeomParam::Sample m_widths
Definition OPoints.h:137
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::m_velocities
Abc::V3fArraySample m_velocities
Definition OPoints.h:135
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::Sample
Sample(const Abc::P3fArraySample &iPos, const Abc::V3fArraySample &iVelocities=Abc::V3fArraySample(), const OFloatGeomParam::Sample &iWidths=OFloatGeomParam::Sample())
Definition OPoints.h:66
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::setIds
void setIds(const Abc::UInt64ArraySample &iSmp)
Definition OPoints.h:96
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::getPositions
const Abc::P3fArraySample & getPositions() const
Definition OPoints.h:90
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::m_ids
Abc::UInt64ArraySample m_ids
Definition OPoints.h:136
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::getIds
const Abc::UInt64ArraySample & getIds() const
Definition OPoints.h:95
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::setPositions
void setPositions(const Abc::P3fArraySample &iSmp)
Definition OPoints.h:91
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::Sample::setVelocities
void setVelocities(const Abc::V3fArraySample &iVelocities)
Definition OPoints.h:101
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::OPointsSchema
OPointsSchema()
Definition OPoints.h:156
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(OPointsSchema::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::setTimeSampling
void setTimeSampling(uint32_t iIndex)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::set
void set(const Sample &iSamp)
Set a sample.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::this_type
OPointsSchema this_type
Definition OPoints.h:148
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::getNumSamples
size_t getNumSamples() const
Definition OPoints.h:220
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::valid
bool valid() const
Definition OPoints.h:252
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::getTimeSampling
AbcA::TimeSamplingPtr getTimeSampling() const
Default assignment operator used.
Definition OPoints.h:202
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::setFromPrevious
void setFromPrevious()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::OPointsSchema
OPointsSchema(const OPointsSchema &iCopy)
Copy constructor.
Definition OPoints.h:189
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::OPointsSchema
OPointsSchema(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())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::reset
void reset()
Definition OPoints.h:240
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::OPointsSchema
OPointsSchema(Abc::OCompoundProperty iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument(), const Abc::Argument &iArg2=Abc::Argument())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsSchema::setTimeSampling
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OBasePropertyT< AbcA::CompoundPropertyWriterPtr >::getObject
OObject getObject() const
Definition OBaseProperty.h:225
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject
Definition OSchemaObject.h:54
Alembic::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPointsPtr
Util::shared_ptr< OPoints > OPointsPtr
Definition OPoints.h:298
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFloatGeomParam
OTypedGeomParam< Float32TPTraits > OFloatGeomParam
Definition OGeomParam.h:389
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OPoints
Abc::OSchemaObject< OPointsSchema > OPoints
Definition OPoints.h:296
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::V3fArraySample
TypedArraySample< V3fTPTraits > V3fArraySample
Definition TypedArraySample.h:171
Alembic::Abc::ALEMBIC_VERSION_NS::UInt64ArraySample
TypedArraySample< Uint64TPTraits > UInt64ArraySample
Definition TypedArraySample.h:156
Alembic::Abc::ALEMBIC_VERSION_NS::P3fArraySample
TypedArraySample< P3fTPTraits > P3fArraySample
Definition TypedArraySample.h:181
Alembic::Abc::ALEMBIC_VERSION_NS::OUInt64ArrayProperty
OTypedArrayProperty< Uint64TPTraits > OUInt64ArrayProperty
Definition OTypedArrayProperty.h:250
Alembic::Abc::ALEMBIC_VERSION_NS::OP3fArrayProperty
OTypedArrayProperty< P3fTPTraits > OP3fArrayProperty
Definition OTypedArrayProperty.h:275
Alembic::Abc::ALEMBIC_VERSION_NS::OV3fArrayProperty
OTypedArrayProperty< V3fTPTraits > OV3fArrayProperty
Definition OTypedArrayProperty.h:265
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46