Alembic Version 1.1

Loading...
Searching...
No Matches
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>
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
47 namespace Alembic {
48 namespace AbcGeom {
49 namespace ALEMBIC_VERSION_NS {
50
51//-*****************************************************************************
52 class ALEMBIC_EXPORT OFaceSetSchema : public OGeomBaseSchema<FaceSetSchemaInfo>
53{
54 public:
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 //-*************************************************************************
109 public:
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 OFaceSetSchema(const OFaceSetSchema& iCopy)
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 );
172 void setTimeSampling( AbcA::TimeSamplingPtr iTime );
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
188 OGeomBaseSchema<FaceSetSchemaInfo>::reset();
189 }
190
192 bool valid() const
193 {
194 return ( OGeomBaseSchema<FaceSetSchemaInfo>::valid() &&
195 m_facesProperty.valid()
196 );
197 }
198
201 ALEMBIC_OVERRIDE_OPERATOR_BOOL( OFaceSetSchema::valid() );
202
203 protected:
204 void _recordExclusivityHint();
205
206 void init( AbcA::CompoundPropertyWriterPtr iParent,
207 const Abc::Argument &iArg0, const Abc::Argument &iArg1,
208 const Abc::Argument &iArg2, const Abc::Argument &iArg3 );
209
210 Abc::OInt32ArrayProperty m_facesProperty;
211
212 Abc::OUInt32Property m_facesExclusiveProperty;
213 FaceSetExclusivity m_facesExclusive;
214};
215
216
217//-*****************************************************************************
218// Nice to use typedef for users of this class.
219//-*****************************************************************************
220 typedef Abc::OSchemaObject<OFaceSetSchema> OFaceSet;
221
222 typedef Util::shared_ptr< OFaceSet > OFaceSetPtr;
223
224Abc::Box3d computeBoundsFromPositionsByFaces (const Int32ArraySample & faces,
225 const Int32ArraySample & meshFaceCounts,
226 const Int32ArraySample & vertexIndices,
227 const P3fArraySample & meshP);
228
229} // End namespace ALEMBIC_VERSION_NS
230
231 using namespace ALEMBIC_VERSION_NS;
232
233} // End namespace AbcGeom
234} // End namespace Alembic
235
236#endif
Foundation.h
SchemaInfoDeclarations.h
Export.h
ALEMBIC_EXPORT
#define ALEMBIC_EXPORT
Definition Export.h:51
FaceSetExclusivity.h
OGeomBase.h
OGeomParam.h
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample
Definition OFaceSet.h:59
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::m_selfBounds
Abc::Box3d m_selfBounds
Definition OFaceSet.h:102
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::this_type
Sample this_type
Definition OFaceSet.h:61
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::Sample
Sample(const Abc::Int32ArraySample &iFaceNums)
Definition OFaceSet.h:76
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::setFaces
void setFaces(const Abc::Int32ArraySample &iFaces)
Definition OFaceSet.h:83
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::reset
void reset()
Definition OFaceSet.h:91
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::getSelfBounds
const Abc::Box3d & getSelfBounds() const
Definition OFaceSet.h:87
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::setSelfBounds
void setSelfBounds(const Abc::Box3d &iBnds)
Definition OFaceSet.h:88
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::m_faces
Abc::Int32ArraySample m_faces
Definition OFaceSet.h:99
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::Sample
Sample()
Definition OFaceSet.h:65
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::Sample::getFaces
const Abc::Int32ArraySample & getFaces() const
Definition OFaceSet.h:82
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::m_facesProperty
Abc::OInt32ArrayProperty m_facesProperty
Definition OFaceSet.h:210
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::setFaceExclusivity
void setFaceExclusivity(FaceSetExclusivity iFacesExclusive)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::OFaceSetSchema
OFaceSetSchema()
Definition OFaceSet.h:119
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::m_facesExclusive
FaceSetExclusivity m_facesExclusive
Definition OFaceSet.h:213
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::setTimeSampling
void setTimeSampling(uint32_t iTimeSamplingID)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::getNumSamples
size_t getNumSamples() const
Default assignment operator used.
Definition OFaceSet.h:165
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::this_type
OFaceSetSchema this_type
Definition OFaceSet.h:112
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::getFaceExclusivity
FaceSetExclusivity getFaceExclusivity()
Definition OFaceSet.h:175
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::OFaceSetSchema
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())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::init
void init(AbcA::CompoundPropertyWriterPtr iParent, const Abc::Argument &iArg0, const Abc::Argument &iArg1, const Abc::Argument &iArg2, const Abc::Argument &iArg3)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::setTimeSampling
void setTimeSampling(AbcA::TimeSamplingPtr iTime)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::OFaceSetSchema
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())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::set
void set(const Sample &iSamp)
Set a sample! First sample must have the list of faces in the faceset.
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::_recordExclusivityHint
void _recordExclusivityHint()
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::valid
bool valid() const
Valid returns whether this instance holds real data.
Definition OFaceSet.h:192
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::reset
void reset()
Definition OFaceSet.h:184
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::ALEMBIC_OVERRIDE_OPERATOR_BOOL
ALEMBIC_OVERRIDE_OPERATOR_BOOL(OFaceSetSchema::valid())
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::OFaceSetSchema
OFaceSetSchema(const OFaceSetSchema &iCopy)
Copy constructor.
Definition OFaceSet.h:147
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetSchema::m_facesExclusiveProperty
Abc::OUInt32Property m_facesExclusiveProperty
Definition OFaceSet.h:212
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema< FaceSetSchemaInfo >::OGeomBaseSchema
OGeomBaseSchema()
Definition OGeomBase.h:74
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::reset
virtual void reset()
Definition OGeomBase.h:110
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OGeomBaseSchema::valid
virtual bool valid() const
Definition OGeomBase.h:119
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::AbcGeom::ALEMBIC_VERSION_NS
Definition ArchiveBounds.h:45
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSet
Abc::OSchemaObject< OFaceSetSchema > OFaceSet
Definition OFaceSet.h:220
Alembic::AbcGeom::ALEMBIC_VERSION_NS::computeBoundsFromPositionsByFaces
Abc::Box3d computeBoundsFromPositionsByFaces(const Int32ArraySample &faces, const Int32ArraySample &meshFaceCounts, const Int32ArraySample &vertexIndices, const P3fArraySample &meshP)
Alembic::AbcGeom::ALEMBIC_VERSION_NS::OFaceSetPtr
Util::shared_ptr< OFaceSet > OFaceSetPtr
Definition OFaceSet.h:222
Alembic::AbcGeom::ALEMBIC_VERSION_NS::FaceSetExclusivity
FaceSetExclusivity
Hint to indicate face membership is mutally exclusive. Some structures that group faces only allow a ...
Definition FaceSetExclusivity.h:49
Alembic::AbcGeom
Definition ArchiveBounds.h:44
Alembic::Abc::ALEMBIC_VERSION_NS::OInt32ArrayProperty
OTypedArrayProperty< Int32TPTraits > OInt32ArrayProperty
Definition OTypedArrayProperty.h:249
Alembic::Abc::ALEMBIC_VERSION_NS::P3fArraySample
TypedArraySample< P3fTPTraits > P3fArraySample
Definition TypedArraySample.h:181
Alembic::Abc::ALEMBIC_VERSION_NS::Int32ArraySample
TypedArraySample< Int32TPTraits > Int32ArraySample
Definition TypedArraySample.h:155
Alembic::Abc::ALEMBIC_VERSION_NS::OUInt32Property
OTypedScalarProperty< Uint32TPTraits > OUInt32Property
Definition OTypedScalarProperty.h:235
Alembic
Alembic namespace ...
Definition ArchiveInfo.h:46