commit
b1410f8455
|
@ -439,11 +439,11 @@ void TokenizeBinary(TokenList& output_tokens, const char* input, unsigned int le
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cursor = input + 18;
|
const char* cursor = input + 18;
|
||||||
const uint8_t unknown_1 = ReadByte(input, cursor, input + length);
|
/*Result ignored*/ ReadByte(input, cursor, input + length);
|
||||||
const uint8_t unknown_2 = ReadByte(input, cursor, input + length);
|
/*Result ignored*/ ReadByte(input, cursor, input + length);
|
||||||
const uint8_t unknown_3 = ReadByte(input, cursor, input + length);
|
/*Result ignored*/ ReadByte(input, cursor, input + length);
|
||||||
const uint8_t unknown_4 = ReadByte(input, cursor, input + length);
|
/*Result ignored*/ ReadByte(input, cursor, input + length);
|
||||||
const uint8_t unknown_5 = ReadByte(input, cursor, input + length);
|
/*Result ignored*/ ReadByte(input, cursor, input + length);
|
||||||
const uint32_t version = ReadWord(input, cursor, input + length);
|
const uint32_t version = ReadWord(input, cursor, input + length);
|
||||||
const bool is64bits = version >= 7500;
|
const bool is64bits = version >= 7500;
|
||||||
while (cursor < input + length)
|
while (cursor < input + length)
|
||||||
|
|
|
@ -126,16 +126,16 @@ struct Header {
|
||||||
int32_t version;
|
int32_t version;
|
||||||
|
|
||||||
//! scale factors for each axis
|
//! scale factors for each axis
|
||||||
aiVector3D scale;
|
ai_real scale[3];
|
||||||
|
|
||||||
//! translation factors for each axis
|
//! translation factors for each axis
|
||||||
aiVector3D translate;
|
ai_real translate[3];
|
||||||
|
|
||||||
//! bounding radius of the mesh
|
//! bounding radius of the mesh
|
||||||
float boundingradius;
|
float boundingradius;
|
||||||
|
|
||||||
//! Position of the viewer's exe. Ignored
|
//! Position of the viewer's exe. Ignored
|
||||||
aiVector3D vEyePos;
|
ai_real vEyePos[3];
|
||||||
|
|
||||||
//! Number of textures
|
//! Number of textures
|
||||||
int32_t num_skins;
|
int32_t num_skins;
|
||||||
|
|
|
@ -118,7 +118,7 @@ void MMDImporter::InternReadFile(const std::string &file, aiScene *pScene,
|
||||||
|
|
||||||
// Get the file-size and validate it, throwing an exception when fails
|
// Get the file-size and validate it, throwing an exception when fails
|
||||||
fileStream.seekg(0, fileStream.end);
|
fileStream.seekg(0, fileStream.end);
|
||||||
size_t fileSize = fileStream.tellg();
|
size_t fileSize = static_cast<size_t>(fileStream.tellg());
|
||||||
fileStream.seekg(0, fileStream.beg);
|
fileStream.seekg(0, fileStream.beg);
|
||||||
|
|
||||||
if (fileSize < sizeof(pmx::PmxModel)) {
|
if (fileSize < sizeof(pmx::PmxModel)) {
|
||||||
|
|
|
@ -741,7 +741,7 @@ void glTF2Exporter::MergeMeshes()
|
||||||
for (unsigned int n = 0; n < mAsset->nodes.Size(); ++n) {
|
for (unsigned int n = 0; n < mAsset->nodes.Size(); ++n) {
|
||||||
Ref<Node> node = mAsset->nodes.Get(n);
|
Ref<Node> node = mAsset->nodes.Get(n);
|
||||||
|
|
||||||
unsigned int nMeshes = node->meshes.size();
|
unsigned int nMeshes = static_cast<unsigned int>(node->meshes.size());
|
||||||
|
|
||||||
//skip if it's 1 or less meshes per node
|
//skip if it's 1 or less meshes per node
|
||||||
if (nMeshes > 1) {
|
if (nMeshes > 1) {
|
||||||
|
|
|
@ -60,6 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||||||
|
#endif
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* A node in the imported hierarchy.
|
* A node in the imported hierarchy.
|
||||||
|
@ -163,6 +168,9 @@ struct ASSIMP_API aiNode
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,11 @@ IF ( NOT GLUT_FOUND )
|
||||||
ENDIF ( MSVC )
|
ENDIF ( MSVC )
|
||||||
ENDIF ( NOT GLUT_FOUND )
|
ENDIF ( NOT GLUT_FOUND )
|
||||||
|
|
||||||
|
if ( MSVC )
|
||||||
|
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
|
||||||
|
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||||
|
endif ( MSVC )
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${Assimp_SOURCE_DIR}/include
|
${Assimp_SOURCE_DIR}/include
|
||||||
${Assimp_SOURCE_DIR}/code
|
${Assimp_SOURCE_DIR}/code
|
||||||
|
|
|
@ -11,6 +11,11 @@ IF ( NOT GLUT_FOUND )
|
||||||
ENDIF ( MSVC )
|
ENDIF ( MSVC )
|
||||||
ENDIF ( NOT GLUT_FOUND )
|
ENDIF ( NOT GLUT_FOUND )
|
||||||
|
|
||||||
|
if ( MSVC )
|
||||||
|
ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
|
||||||
|
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||||
|
endif ( MSVC )
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${Assimp_SOURCE_DIR}/include
|
${Assimp_SOURCE_DIR}/include
|
||||||
${Assimp_SOURCE_DIR}/code
|
${Assimp_SOURCE_DIR}/code
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
// http://nehe.gamedev.net/
|
// http://nehe.gamedev.net/
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <shellapi.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
@ -666,7 +667,7 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||||
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
||||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||||
bits, // Select Our Color Depth
|
BYTE(bits), // Select Our Color Depth
|
||||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||||
0, // No Alpha Buffer
|
0, // No Alpha Buffer
|
||||||
0, // Shift Bit Ignored
|
0, // Shift Bit Ignored
|
||||||
|
|
|
@ -39,6 +39,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
-------------------------------------------------------------------------*/
|
-------------------------------------------------------------------------*/
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "TestIOStream.h"
|
#include "TestIOStream.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define TMP_PATH "/tmp/"
|
||||||
|
void MakeTmpFilePath(char* tmplate)
|
||||||
|
{
|
||||||
|
auto err = mkstemp(tmplate);
|
||||||
|
ASSERT_NE(err, -1);
|
||||||
|
}
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#include <io.h>
|
||||||
|
#define TMP_PATH "./"
|
||||||
|
void MakeTmpFilePath(char* tmplate)
|
||||||
|
{
|
||||||
|
auto pathtemplate = _mktemp(tmplate);
|
||||||
|
ASSERT_NE(pathtemplate, nullptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace ::Assimp;
|
using namespace ::Assimp;
|
||||||
|
|
||||||
|
@ -46,16 +66,30 @@ class utDefaultIOStream : public ::testing::Test {
|
||||||
// empty
|
// empty
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F( utDefaultIOStream, FileSizeTest ) {
|
|
||||||
char buffer[ L_tmpnam ];
|
|
||||||
tmpnam( buffer );
|
|
||||||
std::FILE *fs( std::fopen( buffer, "w+" ) );
|
|
||||||
size_t written( std::fwrite( buffer, 1, sizeof( char ) * L_tmpnam, fs ) );
|
|
||||||
EXPECT_NE( 0U, written );
|
|
||||||
std::fflush( fs );
|
|
||||||
|
|
||||||
TestDefaultIOStream myStream( fs, buffer );
|
|
||||||
|
const char data[]{"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Qui\
|
||||||
|
sque luctus sem diam, ut eleifend arcu auctor eu. Vestibulum id est vel nulla l\
|
||||||
|
obortis malesuada ut sed turpis. Nulla a volutpat tortor. Nunc vestibulum portt\
|
||||||
|
itor sapien ornare sagittis volutpat."};
|
||||||
|
|
||||||
|
TEST_F( utDefaultIOStream, FileSizeTest ) {
|
||||||
|
const auto dataSize = sizeof(data);
|
||||||
|
const auto dataCount = dataSize / sizeof(*data);
|
||||||
|
|
||||||
|
char fpath[] = { TMP_PATH"rndfp.XXXXXX" };
|
||||||
|
MakeTmpFilePath(fpath);
|
||||||
|
|
||||||
|
auto *fs = std::fopen(fpath, "w+" );
|
||||||
|
ASSERT_NE(fs, nullptr);
|
||||||
|
auto written = std::fwrite(data, sizeof(*data), dataCount, fs );
|
||||||
|
EXPECT_NE( 0U, written );
|
||||||
|
auto vflush = std::fflush( fs );
|
||||||
|
ASSERT_EQ(vflush, 0);
|
||||||
|
|
||||||
|
TestDefaultIOStream myStream( fs, fpath);
|
||||||
size_t size = myStream.FileSize();
|
size_t size = myStream.FileSize();
|
||||||
EXPECT_EQ( size, sizeof( char ) * L_tmpnam );
|
EXPECT_EQ( size, dataSize);
|
||||||
remove( buffer );
|
remove(fpath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define _WIN32_IE 0x0600 // Ändern Sie dies in den geeigneten Wert für andere Versionen von IE.
|
#define _WIN32_IE 0x0600 // Ändern Sie dies in den geeigneten Wert für andere Versionen von IE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Selten verwendete Teile der Windows-Header nicht einbinden.
|
|
||||||
// Windows-Headerdateien:
|
// Windows-Headerdateien:
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue