Skip to content

Commit

Permalink
Update Assimp to 5.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SaiyansKing committed Dec 3, 2021
1 parent 9980c13 commit 8116e90
Show file tree
Hide file tree
Showing 88 changed files with 4,645 additions and 2,426 deletions.
Binary file modified D3D11Engine/assimp-vc142-mt.lib
Binary file not shown.
219 changes: 100 additions & 119 deletions D3D11Engine/include/assimp/BaseImporter.h

Large diffs are not rendered by default.

56 changes: 30 additions & 26 deletions D3D11Engine/include/assimp/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2020, assimp team
Copyright (c) 2006-2021, assimp team
All rights reserved.
Expand Down Expand Up @@ -55,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif

#include "defs.h"
#include <stdint.h>
#include <cstdint>
#include <cstddef>

struct aiTexture;
Expand All @@ -64,6 +62,10 @@ namespace Assimp {

class IOStream;

// ---------------------------------------------------------------------------
/**
* This class is used to store and write bitmap information.
*/
class ASSIMP_API Bitmap {
protected:

Expand All @@ -75,13 +77,12 @@ class ASSIMP_API Bitmap {
uint32_t offset;

// We define the struct size because sizeof(Header) might return a wrong result because of structure padding.
// Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field).
static const std::size_t header_size =
sizeof(uint16_t) + // type
sizeof(uint32_t) + // size
sizeof(uint16_t) + // reserved1
sizeof(uint16_t) + // reserved2
sizeof(uint32_t); // offset
static constexpr std::size_t header_size =
sizeof(type) +
sizeof(size) +
sizeof(reserved1) +
sizeof(reserved2) +
sizeof(offset);
};

struct DIB {
Expand All @@ -98,25 +99,28 @@ class ASSIMP_API Bitmap {
uint32_t nb_important_colors;

// We define the struct size because sizeof(DIB) might return a wrong result because of structure padding.
// Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field).
static const std::size_t dib_size =
sizeof(uint32_t) + // size
sizeof(int32_t) + // width
sizeof(int32_t) + // height
sizeof(uint16_t) + // planes
sizeof(uint16_t) + // bits_per_pixel
sizeof(uint32_t) + // compression
sizeof(uint32_t) + // image_size
sizeof(int32_t) + // x_resolution
sizeof(int32_t) + // y_resolution
sizeof(uint32_t) + // nb_colors
sizeof(uint32_t); // nb_important_colors
static constexpr std::size_t dib_size =
sizeof(size) +
sizeof(width) +
sizeof(height) +
sizeof(planes) +
sizeof(bits_per_pixel) +
sizeof(compression) +
sizeof(image_size) +
sizeof(x_resolution) +
sizeof(y_resolution) +
sizeof(nb_colors) +
sizeof(nb_important_colors);
};

static const std::size_t mBytesPerPixel = 4;
static constexpr std::size_t mBytesPerPixel = 4;

public:
static void Save(aiTexture* texture, IOStream* file);
/// @brief Will save an aiTexture instance as a bitmap.
/// @param texture The pointer to the texture instance
/// @param file The filename to save into.
/// @return true if successfully saved, false if not.
static bool Save(aiTexture* texture, IOStream* file);

protected:
static void WriteHeader(Header& header, IOStream* file);
Expand Down
Loading

0 comments on commit 8116e90

Please sign in to comment.