Skip to content

Commit f043cad

Browse files
committed
upgrade assimp to 5.2.4
use assimp to load mesh
1 parent 44c8f6d commit f043cad

22 files changed

+1363
-94
lines changed

cmake/FindASSIMP.cmake

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ FIND_PATH( ASSIMP_INCLUDE_DIR assimp/mesh.h
1010
/opt/local/include
1111
"${CMAKE_SOURCE_DIR}/include"
1212
)
13+
14+
15+
if(MSVC12)
16+
set(ASSIMP_MSVC_VERSION "vc120")
17+
elseif(MSVC14)
18+
set(ASSIMP_MSVC_VERSION "vc140")
19+
endif(MSVC12)
20+
1321
FIND_LIBRARY( ASSIMP_LIBRARY assimp
1422
/usr/lib64
1523
/usr/lib

dlls/assimp-vc142-mt.dll

5.33 MB
Binary file not shown.

dlls/assimp.dll

-5.27 MB
Binary file not shown.

include/assimp/Base64.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5050
namespace Assimp {
5151
namespace Base64 {
5252

53+
/// @brief Will encode the given
54+
/// @param in
55+
/// @param inLength
56+
/// @param out
5357
void Encode(const uint8_t *in, size_t inLength, std::string &out);
5458
void Encode(const std::vector<uint8_t>& in, std::string &out);
5559
std::string Encode(const std::vector<uint8_t>& in);

include/assimp/Bitmap.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ class ASSIMP_API Bitmap {
7878

7979
// We define the struct size because sizeof(Header) might return a wrong result because of structure padding.
8080
static constexpr std::size_t header_size =
81-
sizeof(type) +
82-
sizeof(size) +
83-
sizeof(reserved1) +
84-
sizeof(reserved2) +
85-
sizeof(offset);
81+
sizeof(uint16_t) +
82+
sizeof(uint32_t) +
83+
sizeof(uint16_t) +
84+
sizeof(uint16_t) +
85+
sizeof(uint32_t);
8686
};
8787

8888
struct DIB {
@@ -100,17 +100,17 @@ class ASSIMP_API Bitmap {
100100

101101
// We define the struct size because sizeof(DIB) might return a wrong result because of structure padding.
102102
static constexpr std::size_t dib_size =
103-
sizeof(size) +
104-
sizeof(width) +
105-
sizeof(height) +
106-
sizeof(planes) +
107-
sizeof(bits_per_pixel) +
108-
sizeof(compression) +
109-
sizeof(image_size) +
110-
sizeof(x_resolution) +
111-
sizeof(y_resolution) +
112-
sizeof(nb_colors) +
113-
sizeof(nb_important_colors);
103+
sizeof(uint32_t) +
104+
sizeof(int32_t) +
105+
sizeof(int32_t) +
106+
sizeof(uint16_t) +
107+
sizeof(uint16_t) +
108+
sizeof(uint32_t) +
109+
sizeof(uint32_t) +
110+
sizeof(int32_t) +
111+
sizeof(int32_t) +
112+
sizeof(uint32_t) +
113+
sizeof(uint32_t);
114114
};
115115

116116
static constexpr std::size_t mBytesPerPixel = 4;

include/assimp/Hash.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
44
55
Copyright (c) 2006-2022, assimp team
66
7-
87
All rights reserved.
98
109
Redistribution and use of this software in source and binary forms,
@@ -76,7 +75,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7675
inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) {
7776
uint32_t tmp;
7877
int rem;
79-
78+
size_t offset;
79+
8080
if (!data) return 0;
8181
if (!len)len = (uint32_t)::strlen(data);
8282

@@ -96,7 +96,11 @@ int rem;
9696
switch (rem) {
9797
case 3: hash += get16bits (data);
9898
hash ^= hash << 16;
99-
hash ^= data[sizeof (uint16_t)] << 18;
99+
offset = static_cast<size_t>(sizeof(uint16_t));
100+
if (offset < 0) {
101+
return 0;
102+
}
103+
hash ^= data[offset] << 18;
100104
hash += hash >> 11;
101105
break;
102106
case 2: hash += get16bits (data);

include/assimp/ObjMaterial.h

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
---------------------------------------------------------------------------
3+
Open Asset Import Library (assimp)
4+
---------------------------------------------------------------------------
5+
6+
Copyright (c) 2006-2022, assimp team
7+
8+
All rights reserved.
9+
10+
Redistribution and use of this software in source and binary forms,
11+
with or without modification, are permitted provided that the following
12+
conditions are met:
13+
14+
* Redistributions of source code must retain the above
15+
copyright notice, this list of conditions and the
16+
following disclaimer.
17+
18+
* Redistributions in binary form must reproduce the above
19+
copyright notice, this list of conditions and the
20+
following disclaimer in the documentation and/or other
21+
materials provided with the distribution.
22+
23+
* Neither the name of the assimp team, nor the names of its
24+
contributors may be used to endorse or promote products
25+
derived from this software without specific prior
26+
written permission of the assimp team.
27+
28+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39+
---------------------------------------------------------------------------
40+
*/
41+
42+
/** @file OBJMATERIAL.h
43+
* @brief Obj-specific material macros
44+
*
45+
*/
46+
47+
#ifndef AI_OBJMATERIAL_H_INC
48+
#define AI_OBJMATERIAL_H_INC
49+
50+
#ifdef __GNUC__
51+
# pragma GCC system_header
52+
#endif
53+
54+
#include <assimp/material.h>
55+
56+
// ---------------------------------------------------------------------------
57+
58+
// the original illum property
59+
#define AI_MATKEY_OBJ_ILLUM "$mat.illum", 0, 0
60+
61+
// ---------------------------------------------------------------------------
62+
63+
// ---------------------------------------------------------------------------
64+
// Pure key names for all obj texture-related properties
65+
//! @cond MATS_DOC_FULL
66+
67+
// support for bump -bm
68+
#define _AI_MATKEY_OBJ_BUMPMULT_BASE "$tex.bumpmult"
69+
//! @endcond
70+
71+
// ---------------------------------------------------------------------------
72+
#define AI_MATKEY_OBJ_BUMPMULT(type, N) _AI_MATKEY_OBJ_BUMPMULT_BASE, type, N
73+
74+
//! @cond MATS_DOC_FULL
75+
#define AI_MATKEY_OBJ_BUMPMULT_NORMALS(N) \
76+
AI_MATKEY_OBJ_BUMPMULT(aiTextureType_NORMALS, N)
77+
78+
#define AI_MATKEY_OBJ_BUMPMULT_HEIGHT(N) \
79+
AI_MATKEY_OBJ_BUMPMULT(aiTextureType_HEIGHT, N)
80+
81+
//! @endcond
82+
83+
84+
#endif

0 commit comments

Comments
 (0)