Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:10

0001 /*
0002 Open Asset Import Library (assimp)
0003 ----------------------------------------------------------------------
0004 
0005 Copyright (c) 2006-2024, assimp team
0006 
0007 
0008 All rights reserved.
0009 
0010 Redistribution and use of this software in source and binary forms,
0011 with or without modification, are permitted provided that the
0012 following conditions are met:
0013 
0014 * Redistributions of source code must retain the above
0015   copyright notice, this list of conditions and the
0016   following disclaimer.
0017 
0018 * Redistributions in binary form must reproduce the above
0019   copyright notice, this list of conditions and the
0020   following disclaimer in the documentation and/or other
0021   materials provided with the distribution.
0022 
0023 * Neither the name of the assimp team, nor the names of its
0024   contributors may be used to endorse or promote products
0025   derived from this software without specific prior
0026   written permission of the assimp team.
0027 
0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0039 
0040 ----------------------------------------------------------------------
0041 */
0042 
0043 /** @file Defines the helper data structures for importing 3DS files.
0044 http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */
0045 
0046 #pragma once
0047 #ifndef AI_SMOOTHINGGROUPS_H_INC
0048 #define AI_SMOOTHINGGROUPS_H_INC
0049 
0050 #ifdef __GNUC__
0051 #   pragma GCC system_header
0052 #endif
0053 
0054 #include <assimp/vector3.h>
0055 
0056 #include <stdint.h>
0057 #include <vector>
0058 
0059 // ---------------------------------------------------------------------------
0060 /** Helper structure representing a face with smoothing groups assigned */
0061 struct FaceWithSmoothingGroup {
0062     FaceWithSmoothingGroup() AI_NO_EXCEPT
0063     : mIndices()
0064     , iSmoothGroup(0) {
0065         // in debug builds set all indices to a common magic value
0066 #ifdef ASSIMP_BUILD_DEBUG
0067         this->mIndices[0] = 0xffffffff;
0068         this->mIndices[1] = 0xffffffff;
0069         this->mIndices[2] = 0xffffffff;
0070 #endif
0071     }
0072 
0073 
0074     //! Indices. .3ds is using uint16. However, after
0075     //! an unique vertex set has been generated,
0076     //! individual index values might exceed 2^16
0077     uint32_t mIndices[3];
0078 
0079     //! specifies to which smoothing group the face belongs to
0080     uint32_t iSmoothGroup;
0081 };
0082 
0083 // ---------------------------------------------------------------------------
0084 /** Helper structure representing a mesh whose faces have smoothing
0085     groups assigned. This allows us to reuse the code for normal computations
0086     from smoothings groups for several loaders (3DS, ASE). All of them
0087     use face structures which inherit from #FaceWithSmoothingGroup,
0088     but as they add extra members and need to be copied by value we
0089     need to use a template here.
0090     */
0091 template <class T>
0092 struct MeshWithSmoothingGroups
0093 {
0094     //! Vertex positions
0095     std::vector<aiVector3D> mPositions;
0096 
0097     //! Face lists
0098     std::vector<T> mFaces;
0099 
0100     //! List of normal vectors
0101     std::vector<aiVector3D> mNormals;
0102 };
0103 
0104 // ---------------------------------------------------------------------------
0105 /** Computes normal vectors for the mesh
0106  */
0107 template <class T>
0108 void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh);
0109 
0110 
0111 // include implementations
0112 #include "SmoothingGroups.inl"
0113 
0114 #endif // !! AI_SMOOTHINGGROUPS_H_INC