Loading...
Searching...
No Matches
Foundation.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_Foundation_h
#define Alembic_AbcGeom_Foundation_h
#include <Alembic/Abc/All.h>
#include <ImathMatrixAlgo.h>
#include <ImathEuler.h>
namespace Alembic {
namespace AbcGeom {
namespace ALEMBIC_VERSION_NS {
namespace Abc = ::Alembic::Abc::ALEMBIC_VERSION_NS;
using namespace Abc;
//-*****************************************************************************
enum MeshTopologyVariance
{
kConstantTopology = 0,
kHomogenousTopology = 1,
kHomogeneousTopology = 1,
kHeterogenousTopology = 2,
kHeterogeneousTopology = 2
};
//-*****************************************************************************
enum XformOperationType
{
kScaleOperation = 0,
kTranslateOperation = 1,
kRotateOperation = 2,
kMatrixOperation = 3,
kRotateXOperation = 4,
kRotateYOperation = 5,
kRotateZOperation = 6
};
//-*****************************************************************************
enum FilmBackXformOperationType
{
kScaleFilmBackOperation = 0,
kTranslateFilmBackOperation = 1,
kMatrixFilmBackOperation = 2
};
//-*****************************************************************************
template <class PROP, class SAMP>
inline void SetPropUsePrevIfNull( PROP iProp, SAMP iSamp )
{
if ( iProp )
{
// really only valid with array properties
assert( iProp.isArray() );
if ( iSamp ) { iProp.set( iSamp ); }
else { iProp.setFromPrevious(); }
}
}
template <>
inline void SetPropUsePrevIfNull<Abc::OStringProperty, std::string>(
Abc::OStringProperty iProp, std::string iSamp )
{
if ( ! iProp ) { return; }
if ( iSamp != "" ) { iProp.set( iSamp ); }
else { iProp.setFromPrevious(); }
}
template <>
inline void SetPropUsePrevIfNull<Abc::OWstringProperty, Alembic::Util::wstring>(
Abc::OWstringProperty iProp, Alembic::Util::wstring iSamp )
{
if ( ! iProp ) { return; }
if ( iSamp != L"" ) { iProp.set( iSamp ); }
else { iProp.setFromPrevious(); }
}
template <>
inline void SetPropUsePrevIfNull<Abc::OBox3dProperty, Abc::Box3d>(
Abc::OBox3dProperty iProp, Abc::Box3d iSamp )
{
if ( ! iProp ) { return; }
if ( iSamp.hasVolume() ) { iProp.set( iSamp ); }
else { iProp.setFromPrevious(); }
}
//-*****************************************************************************
template <class ARRAYSAMP>
static Abc::Box3d ComputeBoundsFromPositions( const ARRAYSAMP &iSamp )
{
Abc::Box3d ret;
size_t size = iSamp.size();
for ( size_t i = 0 ; i < size ; ++i )
{
ret.extendBy( iSamp[i] );
}
return ret;
}
//-*****************************************************************************
inline double DegreesToRadians( double iDegrees )
{
return ( iDegrees * M_PI ) / 180.0;
}
inline double RadiansToDegrees( double iRadians )
{
return iRadians * ( 180.0 / M_PI );
}
//-*****************************************************************************
inline bool IsGeomParam( const AbcA::PropertyHeader &iHeader )
{
return iHeader.isArray() || ( iHeader.isCompound() &&
iHeader.getMetaData().get( "podName" ) != "" &&
iHeader.getMetaData().get( "podExtent" ) != "" );
}
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace AbcGeom
} // End namespace Alembic
#endif
All.h
ALEMBIC_VERSION_NS
#define ALEMBIC_VERSION_NS
Definition Foundation.h:105
Alembic::Abc::ALEMBIC_VERSION_NS::OScalarProperty::setFromPrevious
void setFromPrevious()
Alembic::Abc::ALEMBIC_VERSION_NS::OTypedScalarProperty::set
void set(const value_type &iVal)
Definition OTypedScalarProperty.h:173
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::kHomogeneousTopology
@ kHomogeneousTopology
Definition Foundation.h:62
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kHeterogeneousTopology
@ kHeterogeneousTopology
Definition Foundation.h:64
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kHeterogenousTopology
@ kHeterogenousTopology
Definition Foundation.h:63
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kHomogenousTopology
@ kHomogenousTopology
Definition Foundation.h:61
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kConstantTopology
@ kConstantTopology
Definition Foundation.h:60
Alembic::AbcGeom::ALEMBIC_VERSION_NS::DegreesToRadians
double DegreesToRadians(double iDegrees)
used in xform rotation conversion
Definition Foundation.h:153
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformOperationType
XformOperationType
Enum that indicates the type of transformational operation. This enum is used when encoding and decod...
Definition Foundation.h:71
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kScaleOperation
@ kScaleOperation
Definition Foundation.h:72
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kMatrixOperation
@ kMatrixOperation
Definition Foundation.h:75
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kTranslateOperation
@ kTranslateOperation
Definition Foundation.h:73
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kRotateOperation
@ kRotateOperation
Definition Foundation.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kRotateZOperation
@ kRotateZOperation
Definition Foundation.h:78
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kRotateXOperation
@ kRotateXOperation
Definition Foundation.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kRotateYOperation
@ kRotateYOperation
Definition Foundation.h:77
Alembic::AbcGeom::ALEMBIC_VERSION_NS::FilmBackXformOperationType
FilmBackXformOperationType
Enum that indicates the type of 2d operation for cameras. This enum is used when encoding and decodin...
Definition Foundation.h:86
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kScaleFilmBackOperation
@ kScaleFilmBackOperation
Definition Foundation.h:87
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kTranslateFilmBackOperation
@ kTranslateFilmBackOperation
Definition Foundation.h:88
Alembic::AbcGeom::ALEMBIC_VERSION_NS::kMatrixFilmBackOperation
@ kMatrixFilmBackOperation
Definition Foundation.h:89
Alembic::AbcGeom::ALEMBIC_VERSION_NS::RadiansToDegrees
double RadiansToDegrees(double iRadians)
Definition Foundation.h:158
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IsGeomParam
bool IsGeomParam(const AbcA::PropertyHeader &iHeader)
A couple simple tests for if something is a GeomParam.
Definition Foundation.h:166
Alembic::AbcGeom::ALEMBIC_VERSION_NS::SetPropUsePrevIfNull< Abc::OWstringProperty, Alembic::Util::wstring >
void SetPropUsePrevIfNull< Abc::OWstringProperty, Alembic::Util::wstring >(Abc::OWstringProperty iProp, Alembic::Util::wstring iSamp)
Definition Foundation.h:118
Alembic::AbcGeom::ALEMBIC_VERSION_NS::SetPropUsePrevIfNull< Abc::OBox3dProperty, Abc::Box3d >
void SetPropUsePrevIfNull< Abc::OBox3dProperty, Abc::Box3d >(Abc::OBox3dProperty iProp, Abc::Box3d iSamp)
Definition Foundation.h:127
Alembic::AbcGeom::ALEMBIC_VERSION_NS::ComputeBoundsFromPositions
static Abc::Box3d ComputeBoundsFromPositions(const ARRAYSAMP &iSamp)
Definition Foundation.h:139
Alembic::AbcGeom::ALEMBIC_VERSION_NS::SetPropUsePrevIfNull
void SetPropUsePrevIfNull(PROP iProp, SAMP iSamp)
Definition Foundation.h:96
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS
Definition ArchiveInfo.h:48
Alembic::Abc::ALEMBIC_VERSION_NS::OBox3dProperty
OTypedScalarProperty< Box3dTPTraits > OBox3dProperty
Definition OTypedScalarProperty.h:273
Alembic::Abc::ALEMBIC_VERSION_NS::OWstringProperty
OTypedScalarProperty< WstringTPTraits > OWstringProperty
Definition OTypedScalarProperty.h:243
Alembic::Abc::ALEMBIC_VERSION_NS::OStringProperty
OTypedScalarProperty< StringTPTraits > OStringProperty
Definition OTypedScalarProperty.h:242
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46