HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IXform.h
Go to the documentation of this file.
1 //-*****************************************************************************
2 //
3 // Copyright (c) 2009-2012,
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_IXform_h
38 #define Alembic_AbcGeom_IXform_h
39 
40 #include <Alembic/Util/Export.h>
43 
45 
46 namespace Alembic {
47 namespace AbcGeom {
48 namespace ALEMBIC_VERSION_NS {
49 
50 //-*****************************************************************************
51 class ALEMBIC_EXPORT IXformSchema : public Abc::ISchema<XformSchemaInfo>
52 {
53  //-*************************************************************************
54  // XFORM SCHEMA
55  //-*************************************************************************
56 public:
57 
58  //! By convention we always define this_type in AbcGeom classes.
59  //! Used by unspecified-bool-type conversion below
63 
64  //-*************************************************************************
65  // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
66  //-*************************************************************************
67 
68  //! The default constructor creates an empty OPolyMeshSchema
69  //! ...
71  {
72  m_useArrayProp = false;
73  m_isConstant = true;
74  m_isConstantIdentity = true;
75  }
76 
77  //! This constructor creates a new xform reader.
78  //! The first argument is the parent ICompoundProperty, from which the
79  //! error handler policy for is derived. The second argument is the name
80  //! of the ICompoundProperty that contains this schemas properties. The
81  //! remaining optional arguments can be used to override the
82  //! ErrorHandlerPolicy and to specify schema interpretation matching.
84  const std::string &iName,
85  const Abc::Argument &iArg0 = Abc::Argument(),
86  const Abc::Argument &iArg1 = Abc::Argument() )
87  : Abc::ISchema<XformSchemaInfo>( iParent, iName, iArg0, iArg1 )
88  {
89  // Meta data and error handling are eaten up by
90  // the super type, so all that's left is SchemaInterpMatching.
91  init( iArg0, iArg1 );
92  }
93 
94  //! This constructor wraps an existing ICompoundProperty as the xform
95  //! reader, and the error handler policy is derived from it.
96  //! The remaining optional arguments can be used to override the
97  //! ErrorHandlerPolicy and to specify schema interpretation matching.
99  const Abc::Argument &iArg0 = Abc::Argument(),
100  const Abc::Argument &iArg1 = Abc::Argument() )
101  : Abc::ISchema<XformSchemaInfo>( iProp, iArg0, iArg1 )
102  {
103  init( iArg0, iArg1 );
104  }
105 
106  //! explicit copy constructor to work around Windows compiler bug
107  IXformSchema( const IXformSchema &iCopy )
108  : Abc::ISchema<XformSchemaInfo>()
109  {
110  *this = iCopy;
111  }
112 
113  AbcA::TimeSamplingPtr getTimeSampling() const;
114 
115  bool isConstant() const { return m_isConstant; }
116 
117  //! is this xform both constant and identity?
118  bool isConstantIdentity() const { return m_isConstantIdentity; }
119 
120  size_t getNumSamples() const;
121 
122  //! fill the supplied sample reference with values
123  void get( XformSample &oSamp,
124  const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) const;
125 
127  Abc::ISampleSelector() ) const;
128 
130  {
131  return m_childBoundsProperty;
132  }
133 
134  // lightweight get to avoid constructing a sample
135  // see XformSample.h for explanation of this property
136  bool getInheritsXforms( const Abc::ISampleSelector &iSS =
137  Abc::ISampleSelector() ) const;
138 
139  size_t getNumOps() const { return m_sample.getNumOps(); }
140 
141  //! Reset returns this function set to an empty, default
142  //! state.
143  void reset()
144  {
145  m_childBoundsProperty.reset();
146  m_sample = XformSample();
147  m_inheritsProperty.reset();
148  m_isConstant = true;
149  m_isConstantIdentity = true;
150 
151  m_arbGeomParams.reset();
152  m_userProperties.reset();
153 
155  }
156 
157  //! Valid returns whether this function set is valid.
158  bool valid() const
159  {
160  return ( super_type::valid() );
161  }
162 
163  ICompoundProperty getArbGeomParams() const { return m_arbGeomParams; }
164 
165  ICompoundProperty getUserProperties() const { return m_userProperties; }
166 
167  //! unspecified-bool-type operator overload.
168  //! ...
169  ALEMBIC_OVERRIDE_OPERATOR_BOOL( this_type::valid() );
170 
171 
172 protected:
174 
176 
178 
181 
183 
185 
187 
188 private:
189  void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 );
190 
191  // is m_vals an ArrayProperty, or a ScalarProperty?
192  bool m_useArrayProp;
193 
194  // fills m_valVec with data
195  void getChannelValues( const AbcA::index_t iSampleIndex,
196  XformSample & oSamp ) const;
197 };
198 
199 //-*****************************************************************************
200 // SCHEMA OBJECT
201 //-*****************************************************************************
203 
204 typedef Util::shared_ptr< IXform > IXformPtr;
205 
206 } // End namespace ALEMBIC_VERSION_NS
207 
208 using namespace ALEMBIC_VERSION_NS;
209 
210 } // End namespace AbcGeom
211 } // End namespace Alembic
212 
213 #endif
IXformSchema(const IXformSchema &iCopy)
explicit copy constructor to work around Windows compiler bug
Definition: IXform.h:107
Util::shared_ptr< IXform > IXformPtr
Definition: IXform.h:204
IXformSchema(const ICompoundProperty &iParent, const std::string &iName, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition: IXform.h:83
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
#define ALEMBIC_EXPORT
Definition: Export.h:51
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:5578
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
AbcA::BasePropertyReaderPtr m_valsProperty
Definition: IXform.h:175
GLboolean reset
Definition: glad.h:5138
IXformSchema(const ICompoundProperty &iProp, const Abc::Argument &iArg0=Abc::Argument(), const Abc::Argument &iArg1=Abc::Argument())
Definition: IXform.h:98
ICompoundProperty getUserProperties() const
Definition: IXform.h:165
#define ALEMBIC_OVERRIDE_OPERATOR_BOOL(PASS_COND)
Definition: OperatorBool.h:56
bool valid() const
Valid returns whether this function set is valid.
Definition: IXform.h:158
ICompoundProperty getArbGeomParams() const
Definition: IXform.h:163
Abc::ISchema< XformSchemaInfo > super_type
Definition: IXform.h:60
Abc::IBox3dProperty getChildBoundsProperty() const
Definition: IXform.h:129
bool isConstantIdentity() const
is this xform both constant and identity?
Definition: IXform.h:118
Abc::ISchemaObject< IXformSchema > IXform
Definition: IXform.h:202
Alembic::Util::shared_ptr< BasePropertyReader > BasePropertyReaderPtr
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:88