Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-07 09:36:39

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