Alembic: AbcGeom/XformSample.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
XformSample.h
1//-*****************************************************************************
2//
3// Copyright (c) 2009-2011,
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_XformSample_h
38#define Alembic_AbcGeom_XformSample_h
39
40#include <Alembic/Util/Export.h>
41#include <Alembic/AbcGeom/Foundation.h>
42
43#include <Alembic/AbcGeom/XformOp.h>
44
45namespace Alembic {
46namespace AbcGeom {
47namespace ALEMBIC_VERSION_NS {
48
49//-*****************************************************************************
50 class ALEMBIC_EXPORT XformSample
51{
52public:
53 XformSample();
54
55 // add translate or scale op
56 // returns the index of the op in its op-stack
57 std::size_t addOp( XformOp iTransOrScaleOp, const Abc::V3d &iVal );
58
59 // add rotate op
60 // returns the index of the op in its op-stack
61 std::size_t addOp( XformOp iRotateOp, const Abc::V3d &iAxis,
62 const double iAngleInDegrees );
63
64 // add matrix op
65 // returns the index of the op in its op-stack
66 std::size_t addOp( XformOp iMatrixOp, const Abc::M44d &iMatrix );
67
68 // add rotateX, rotateY, or rotateZ op
69 std::size_t addOp( XformOp iSingleRotateOp,
70 const double iSingleAxisRotationInDegrees );
71
72 // add an op with values already set on the op
73 std::size_t addOp( const XformOp &iOp );
74
75 XformOp getOp( const std::size_t iIndex ) const;
76
77 XformOp &operator[]( const std::size_t &iIndex );
78 const XformOp &operator[]( const std::size_t &iIndex ) const;
79
80 std::size_t getNumOps() const;
82 std::size_t getNumOpChannels() const;
83
86 void setInheritsXforms( bool iInherits );
87 bool getInheritsXforms() const;
88
89 // non-op-based methods; the getters will compute their return values
90 // from the ops under the hood, hence return-by-value.
91
98 void setTranslation( const Abc::V3d &iTrans );
99 Abc::V3d getTranslation() const;
100
101 void setRotation( const Abc::V3d &iAxis, const double iAngleInDegress );
102 Abc::V3d getAxis() const;
103 double getAngle() const;
104
105 void setXRotation( const double iAngleInDegrees );
106 double getXRotation() const;
107
108 void setYRotation( const double iAngleInDegrees );
109 double getYRotation() const;
110
111 void setZRotation( const double iAngleInDegrees );
112 double getZRotation() const;
113
114 void setScale( const Abc::V3d &iScale );
115 Abc::V3d getScale() const;
116
117 void setMatrix( const Abc::M44d &iMatrix );
118 Abc::M44d getMatrix() const;
119
121 bool isTopologyEqual( const XformSample & iSample );
122
124 bool getIsTopologyFrozen() const { return m_hasBeenRead; }
125
126 void reset();
127
128private:
129 friend class OXformSchema;
130 friend class IXformSchema;
131 void freezeTopology();
132 const std::vector<Alembic::Util::uint8_t> &getOpsArray() const;
133 void clear();
134
135
136private:
138 int32_t m_setWithOpStack;
139
140 std::vector<XformOp> m_ops;
141
142 bool m_inherits;
143
147 bool m_hasBeenRead;
148
149 size_t m_opIndex;
150};
151
152
153} // End namespace ALEMBIC_VERSION_NS
154
155using namespace ALEMBIC_VERSION_NS;
156
157} // End namespace AbcGeom
158} // End namespace Alembic
159
160#endif
Alembic::AbcGeom::ALEMBIC_VERSION_NS::IXformSchema
Definition IXform.h:52
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OXformSchema
Definition OXform.h:56
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformOp
Xform Operation This class holds the data about a particular transform operation, but does not hold t...
Definition XformOp.h:121
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample::isTopologyEqual
bool isTopologyEqual(const XformSample &iSample)
Tests whether this sample has the same topology as iSample.
Definition XformSample.cpp:697
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample::setInheritsXforms
void setInheritsXforms(bool iInherits)
Definition XformSample.cpp:290
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample::getNumOpChannels
std::size_t getNumOpChannels() const
The sum of the number of channels of all the ops in this Sample.
Definition XformSample.cpp:278
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample::setTranslation
void setTranslation(const Abc::V3d &iTrans)
Definition XformSample.cpp:302
Alembic::AbcGeom::ALEMBIC_VERSION_NS::XformSample::getIsTopologyFrozen
bool getIsTopologyFrozen() const
Has this Sample been used in a call to OXformSchema::set()
Definition XformSample.h:124
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39