Alembic: AbcGeom/OFaceSet.h Source File

Alembic 1.8.11

Loading...
Searching...
No Matches
OFaceSet.h
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>
41#include <Alembic/AbcGeom/Foundation.h>
42#include <Alembic/AbcGeom/SchemaInfoDeclarations.h>
43#include <Alembic/AbcGeom/OGeomParam.h>
44#include <Alembic/AbcGeom/FaceSetExclusivity.h>
45#include <Alembic/AbcGeom/OGeomBase.h>
46
47namespace Alembic {
48namespace AbcGeom {
49namespace ALEMBIC_VERSION_NS {
50
51//-*****************************************************************************
52 class ALEMBIC_EXPORT OFaceSetSchema : public OGeomBaseSchema<FaceSetSchemaInfo>
53{
54public:
55 //-*************************************************************************
56 // Parition SAMPLE
57 //-*************************************************************************
58 class Sample
59 {
60 public:
61 typedef Sample this_type;
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:
99 Abc::Int32ArraySample m_faces;
100
101 // bounds
102 Abc::Box3d m_selfBounds;
103 }; // end OFaceSetSchema::Sample
104
105
106 //-*************************************************************************
107 // FaceSet SCHEMA
108 //-*************************************************************************
109public:
112 typedef OFaceSetSchema this_type;
113
114 //-*************************************************************************
115 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT
116 //-*************************************************************************
119 OFaceSetSchema() {}
120
127 OFaceSetSchema( AbcA::CompoundPropertyWriterPtr iParent,
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
140 OFaceSetSchema( Abc::OCompoundProperty iParent,
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
147
148 //-*************************************************************************
149 // SCHEMA STUFF
150 //-*************************************************************************
151
152 //-*************************************************************************
153 // SAMPLE STUFF
154 //-*************************************************************************
155
158 size_t getNumSamples() const
159 { return m_facesProperty.getNumSamples(); }
160
162 void set( const Sample &iSamp );
163
164 void setTimeSampling( uint32_t iTimeSamplingID );
165 void setTimeSampling( AbcA::TimeSamplingPtr iTime );
166
167 void setFaceExclusivity( FaceSetExclusivity iFacesExclusive );
168 FaceSetExclusivity getFaceExclusivity() { return m_facesExclusive; }
169 //-*************************************************************************
170 // ABC BASE MECHANISMS
171 // These functions are used by Abc to deal with errors, validity,
172 // and so on.
173 //-*************************************************************************
174
177 void reset()
178 {
179 m_facesProperty.reset();
180
181 OGeomBaseSchema<FaceSetSchemaInfo>::reset();
182 }
183
185 bool valid() const
186 {
187 return ( OGeomBaseSchema<FaceSetSchemaInfo>::valid() &&
188 m_facesProperty.valid()
189 );
190 }
191
194 ALEMBIC_OVERRIDE_OPERATOR_BOOL( OFaceSetSchema::valid() );
195
196protected:
197 void _recordExclusivityHint();
198
199 void init( AbcA::CompoundPropertyWriterPtr iParent,
200 const Abc::Argument &iArg0, const Abc::Argument &iArg1,
201 const Abc::Argument &iArg2, const Abc::Argument &iArg3 );
202
203 Abc::OInt32ArrayProperty m_facesProperty;
204
205 Abc::OUInt32Property m_facesExclusiveProperty;
206 FaceSetExclusivity m_facesExclusive;
207};
208
209
210//-*****************************************************************************
211// Nice to use typedef for users of this class.
212//-*****************************************************************************
213typedef Abc::OSchemaObject<OFaceSetSchema> OFaceSet;
214
215typedef Util::shared_ptr< OFaceSet > OFaceSetPtr;
216
217Abc::Box3d computeBoundsFromPositionsByFaces (const Int32ArraySample & faces,
218 const Int32ArraySample & meshFaceCounts,
219 const Int32ArraySample & vertexIndices,
220 const P3fArraySample & meshP);
221
222} // End namespace ALEMBIC_VERSION_NS
223
224using namespace ALEMBIC_VERSION_NS;
225
226} // End namespace AbcGeom
227} // End namespace Alembic
228
229#endif
Alembic::Abc::ALEMBIC_VERSION_NS::Argument
Definition Argument.h:120
Alembic::Abc::ALEMBIC_VERSION_NS::OCompoundProperty
Definition OCompoundProperty.h:53
Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject
Definition OSchemaObject.h:54
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::ArraySample::reset
void reset()
Definition ArraySample.h:119
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::Sample
Sample(const Abc::Int32ArraySample &iFaceNums)
Definition OFaceSet.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::Sample
Sample()
Definition OFaceSet.h:65
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema
Definition OFaceSet.h:53
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::OFaceSetSchema
OFaceSetSchema()
Definition OFaceSet.h:119
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::getNumSamples
size_t getNumSamples() const
Default assignment and copy operator used.
Definition OFaceSet.h:158
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::this_type
OFaceSetSchema this_type
Definition OFaceSet.h:112
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::valid
bool valid() const
Valid returns whether this instance holds real data.
Definition OFaceSet.h:185
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::reset
void reset()
Definition OFaceSet.h:177
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(OFaceSetSchema::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema< FaceSetSchemaInfo >::OGeomBaseSchema
OGeomBaseSchema()
Definition OGeomBase.h:74
Alembic
Alembic namespace ...
Definition ArchiveInfo.cpp:39