Alembic Version 1.1
OFaceSet.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_OFaceSet_h
38#define Alembic_AbcGeom_OFaceSet_h
39
40#include <Alembic/Util/Export.h>
46
47namespace Alembic {
48namespace AbcGeom {
49namespace ALEMBIC_VERSION_NS {
50
51//-*****************************************************************************
52class ALEMBIC_EXPORT OFaceSetSchema : public OGeomBaseSchema<FaceSetSchemaInfo>
53{
54public:
55 //-*************************************************************************
56 // Parition SAMPLE
57 //-*************************************************************************
58 class Sample
59 {
60 public:
62
65 Sample() { reset(); }
66
76 Sample( const Abc::Int32ArraySample &iFaceNums)
77 : m_faces( iFaceNums )
78 {}
79
80 /* main accessors */
81 // Faces
82 const Abc::Int32ArraySample &getFaces() const { return m_faces; }
83 void setFaces( const Abc::Int32ArraySample &iFaces)
84 { m_faces = iFaces; }
85
86 // Bounding boxes
87 const Abc::Box3d &getSelfBounds() const { return m_selfBounds; }
88 void setSelfBounds( const Abc::Box3d &iBnds )
89 { m_selfBounds = iBnds; }
90
91 void reset()
92 {
93 m_faces.reset();
94
95 m_selfBounds.makeEmpty();
96 }
97
98 protected:
100
101 // bounds
102 Abc::Box3d m_selfBounds;
103 }; // end OFaceSetSchema::Sample
104
105
106 //-*************************************************************************
107 // FaceSet SCHEMA
108 //-*************************************************************************
109public:
113
114 //-*************************************************************************
115 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
116 //-*************************************************************************
120
128 const std::string &iName,
129 const Abc::Argument &iArg0 = Abc::Argument(),
130 const Abc::Argument &iArg1 = Abc::Argument(),
131 const Abc::Argument &iArg2 = Abc::Argument(),
132 const Abc::Argument &iArg3 = Abc::Argument() );
133
141 const std::string &iName,
142 const Abc::Argument &iArg0 = Abc::Argument(),
143 const Abc::Argument &iArg1 = Abc::Argument(),
144 const Abc::Argument &iArg2 = Abc::Argument() );
145
148 : OGeomBaseSchema<FaceSetSchemaInfo>()
149 {
150 *this = iCopy;
151 }
152
154
155 //-*************************************************************************
156 // SCHEMA STUFF
157 //-*************************************************************************
158
159 //-*************************************************************************
160 // SAMPLE STUFF
161 //-*************************************************************************
162
165 size_t getNumSamples() const
166 { return m_facesProperty.getNumSamples(); }
167
169 void set( const Sample &iSamp );
170
171 void setTimeSampling( uint32_t iTimeSamplingID );
173
174 void setFaceExclusivity( FaceSetExclusivity iFacesExclusive );
175 FaceSetExclusivity getFaceExclusivity() { return m_facesExclusive; }
176 //-*************************************************************************
177 // ABC BASE MECHANISMS
178 // These functions are used by Abc to deal with errors, validity,
179 // and so on.
180 //-*************************************************************************
181
184 void reset()
185 {
186 m_facesProperty.reset();
187
189 }
190
192 bool valid() const
193 {
195 m_facesProperty.valid()
196 );
197 }
198
202
203protected:
205
207 const Abc::Argument &iArg0, const Abc::Argument &iArg1,
208 const Abc::Argument &iArg2, const Abc::Argument &iArg3 );
209
211
214};
215
216
217//-*****************************************************************************
218// Nice to use typedef for users of this class.
219//-*****************************************************************************
221
222typedef Util::shared_ptr< OFaceSet > OFaceSetPtr;
223
225 const Int32ArraySample & meshFaceCounts,
226 const Int32ArraySample & vertexIndices,
227 const P3fArraySample & meshP);
228
229} // End namespace ALEMBIC_VERSION_NS
230
231using namespace ALEMBIC_VERSION_NS;
232
233} // End namespace AbcGeom
234} // End namespace Alembic
235
236#endif
#define ALEMBIC_EXPORT
Definition: Export.h:51
#define ALEMBIC_VERSION_NS
Definition: Foundation.h:105
Sample(const Abc::Int32ArraySample &iFaceNums)
Definition: OFaceSet.h:76
void setFaces(const Abc::Int32ArraySample &iFaces)
Definition: OFaceSet.h:83
const Abc::Int32ArraySample & getFaces() const
Definition: OFaceSet.h:82
void setFaceExclusivity(FaceSetExclusivity iFacesExclusive)
void setTimeSampling(uint32_t iTimeSamplingID)
size_t getNumSamples() const
Default assignment operator used.
Definition: OFaceSet.h:165
OFaceSetSchema(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())
void init(AbcA::CompoundPropertyWriterPtr iParent, const Abc::Argument &iArg0, const Abc::Argument &iArg1, const Abc::Argument &iArg2, const Abc::Argument &iArg3)
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
OFaceSetSchema(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())
void set(const Sample &iSamp)
Set a sample! First sample must have the list of faces in the faceset.
bool valid() const
Valid returns whether this instance holds real data.
Definition: OFaceSet.h:192
OFaceSetSchema(const OFaceSetSchema &iCopy)
Copy constructor.
Definition: OFaceSet.h:147
Alembic::Util::shared_ptr< CompoundPropertyWriter > CompoundPropertyWriterPtr
Alembic::Util::shared_ptr< TimeSampling > TimeSamplingPtr
Definition: TimeSampling.h:137
Abc::OSchemaObject< OFaceSetSchema > OFaceSet
Definition: OFaceSet.h:220
Abc::Box3d computeBoundsFromPositionsByFaces(const Int32ArraySample &faces, const Int32ArraySample &meshFaceCounts, const Int32ArraySample &vertexIndices, const P3fArraySample &meshP)
Util::shared_ptr< OFaceSet > OFaceSetPtr
Definition: OFaceSet.h:222
FaceSetExclusivity
Hint to indicate face membership is mutally exclusive. Some structures that group faces only allow a ...
Alembic namespace ...
Definition: ArchiveInfo.h:46