00001 //-***************************************************************************** 00002 // 00003 // Copyright (c) 2009-2011, 00004 // Sony Pictures Imageworks, Inc. and 00005 // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. 00006 // 00007 // All rights reserved. 00008 // 00009 // Redistribution and use in source and binary forms, with or without 00010 // modification, are permitted provided that the following conditions are 00011 // met: 00012 // * Redistributions of source code must retain the above copyright 00013 // notice, this list of conditions and the following disclaimer. 00014 // * Redistributions in binary form must reproduce the above 00015 // copyright notice, this list of conditions and the following disclaimer 00016 // in the documentation and/or other materials provided with the 00017 // distribution. 00018 // * Neither the name of Sony Pictures Imageworks, nor 00019 // Industrial Light & Magic nor the names of their contributors may be used 00020 // to endorse or promote products derived from this software without specific 00021 // prior written permission. 00022 // 00023 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 // 00035 //-***************************************************************************** 00036 00037 #ifndef _Alembic_AbcGeom_IFaceSet_h_ 00038 #define _Alembic_AbcGeom_IFaceSet_h_ 00039 00040 #include <Alembic/AbcGeom/Foundation.h> 00041 #include <Alembic/AbcGeom/SchemaInfoDeclarations.h> 00042 #include <Alembic/AbcGeom/IGeomParam.h> 00043 #include <Alembic/AbcGeom/FaceSetExclusivity.h> 00044 #include <Alembic/AbcGeom/IGeomBase.h> 00045 00046 namespace Alembic { 00047 namespace AbcGeom { 00048 namespace ALEMBIC_VERSION_NS { 00049 00050 //-***************************************************************************** 00051 class IFaceSetSchema : public IGeomBaseSchema<FaceSetSchemaInfo> 00052 { 00053 public: 00054 //-************************************************************************* 00055 // FACESET MESH SCHEMA SAMPLE TYPE 00056 //-************************************************************************* 00057 class Sample 00058 { 00059 public: 00060 typedef Sample this_type; 00061 00062 //! Users never create this data directly 00063 Sample() { reset(); } 00064 00065 // main stuff 00066 Abc::Int32ArraySamplePtr getFaces() const { return m_faces; } 00067 00068 // bounds 00069 Abc::Box3d getSelfBounds() const { return m_selfBounds; } 00070 Abc::Box3d getChildBounds() const { return m_childBounds; } 00071 00072 bool valid() const 00073 { 00074 return m_faces; 00075 } 00076 00077 void reset() 00078 { 00079 m_faces.reset(); 00080 00081 m_selfBounds.makeEmpty(); 00082 m_childBounds.makeEmpty(); 00083 } 00084 00085 ALEMBIC_OPERATOR_BOOL( valid() ); 00086 00087 protected: 00088 friend class IFaceSetSchema; 00089 00090 Abc::Int32ArraySamplePtr m_faces; 00091 00092 00093 // bounds 00094 Abc::Box3d m_selfBounds; 00095 Abc::Box3d m_childBounds; 00096 00097 }; // end IFaceSetSchema::Sample 00098 00099 //-************************************************************************* 00100 // FACESET SCHEMA 00101 //-************************************************************************* 00102 public: 00103 //! By convention we always define this_type in AbcGeom classes. 00104 //! Used by unspecified-bool-type conversion below 00105 typedef IFaceSetSchema this_type; 00106 00107 //-************************************************************************* 00108 // CONSTRUCTION, DESTRUCTION, ASSIGNMENT 00109 //-************************************************************************* 00110 00111 //! The default constructor creates an empty IFaceSetSchema 00112 //! ... 00113 IFaceSetSchema() {} 00114 00115 //! This templated, primary constructor creates a new faceset reader. 00116 //! The first argument is any Abc (or AbcCoreAbstract) object 00117 //! which can intrusively be converted to an CompoundPropertyWriterPtr 00118 //! to use as a parent, from which the error handler policy for 00119 //! inheritance is also derived. The remaining optional arguments 00120 //! can be used to override the ErrorHandlerPolicy and to specify 00121 //! schema interpretation matching. 00122 template <class CPROP_PTR> 00123 IFaceSetSchema( CPROP_PTR iParent, 00124 const std::string &iName, 00125 00126 const Abc::Argument &iArg0 = Abc::Argument(), 00127 const Abc::Argument &iArg1 = Abc::Argument() ) 00128 : IGeomBaseSchema<FaceSetSchemaInfo>( iParent, iName, 00129 iArg0, iArg1 ) 00130 { 00131 init( iArg0, iArg1 ); 00132 } 00133 00134 //! Same constructor as above, but use the default schema name, ie, 00135 //! ".geom". 00136 template <class CPROP_PTR> 00137 explicit IFaceSetSchema( CPROP_PTR iParent, 00138 const Abc::Argument &iArg0 = Abc::Argument(), 00139 const Abc::Argument &iArg1 = Abc::Argument() ) 00140 : IGeomBaseSchema<FaceSetSchemaInfo>( iParent, 00141 iArg0, iArg1 ) 00142 { 00143 init( iArg0, iArg1 ); 00144 } 00145 00146 //! wrap an existing schema object 00147 template <class CPROP_PTR> 00148 IFaceSetSchema( CPROP_PTR iThis, 00149 Abc::WrapExistingFlag iFlag, 00150 00151 const Abc::Argument &iArg0 = Abc::Argument(), 00152 const Abc::Argument &iArg1 = Abc::Argument() ) 00153 : IGeomBaseSchema<FaceSetSchemaInfo>( iThis, iFlag, iArg0, iArg1 ) 00154 { 00155 init( iArg0, iArg1 ); 00156 } 00157 00158 //! Copy constructor. (explicit copy ctor for msvc bug workaround) 00159 IFaceSetSchema(const IFaceSetSchema& iCopy) 00160 : IGeomBaseSchema<FaceSetSchemaInfo>() 00161 { 00162 *this = iCopy; 00163 } 00164 00165 //! Default assignment operator used. 00166 00167 //-************************************************************************* 00168 // SCHEMA STUFF 00169 //-************************************************************************* 00170 00171 00172 //! if isConstant() is true, the mesh contains no time-varying values 00173 bool isConstant() { return (m_facesProperty.isConstant ()); } 00174 00175 //-************************************************************************* 00176 // SAMPLE STUFF 00177 //-************************************************************************* 00178 00179 //! Get number of samples written so far. 00180 //! ... 00181 size_t getNumSamples(); 00182 00183 //! Return the time sampling 00184 AbcA::TimeSamplingPtr getTimeSampling() 00185 { 00186 if ( m_facesProperty.valid() ) 00187 return m_facesProperty.getTimeSampling(); 00188 return getObject().getArchive().getTimeSampling(0); 00189 } 00190 00191 void get( Sample &iSamp, 00192 const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ); 00193 00194 Sample getValue( const Abc::ISampleSelector &iSS = Abc::ISampleSelector() ) 00195 { 00196 Sample smp; 00197 get( smp, iSS ); 00198 return smp; 00199 } 00200 00201 FaceSetExclusivity getFaceExclusivity(); 00202 00203 //-************************************************************************* 00204 // ABC BASE MECHANISMS 00205 // These functions are used by Abc to deal with errors, rewrapping, 00206 // and so on. 00207 //-************************************************************************* 00208 00209 //! Reset returns this function set to an empty, default 00210 //! state. 00211 void reset() 00212 { 00213 m_facesProperty.reset(); 00214 00215 IGeomBaseSchema<FaceSetSchemaInfo>::reset(); 00216 } 00217 00218 //! Valid returns whether this function set is 00219 //! valid. 00220 bool valid() const 00221 { 00222 return ( IGeomBaseSchema<FaceSetSchemaInfo>::valid() && 00223 m_facesProperty.valid() ); 00224 } 00225 00226 //! unspecified-bool-type operator overload. 00227 //! ... 00228 ALEMBIC_OVERRIDE_OPERATOR_BOOL( IFaceSetSchema::valid() ); 00229 00230 protected: 00231 void init( const Abc::Argument &iArg0, const Abc::Argument &iArg1 ); 00232 00233 Abc::IInt32ArrayProperty m_facesProperty; 00234 }; 00235 00236 //-***************************************************************************** 00237 // SCHEMA OBJECT 00238 //-***************************************************************************** 00239 typedef Abc::ISchemaObject<IFaceSetSchema> IFaceSet; 00240 00241 } // End namespace ALEMBIC_VERSION_NS 00242 00243 using namespace ALEMBIC_VERSION_NS; 00244 00245 } // End namespace AbcGeom 00246 } // End namespace Alembic 00247 00248 #endif
1.5.9