Conflicts:
	tools/assimp_cmd/ImageExtractor.cpp
pull/607/head
Kim Kulling 2015-07-08 00:40:35 +02:00
commit 36f0ccced1
16 changed files with 127 additions and 92 deletions

View File

@ -133,6 +133,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${C
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
FIND_PACKAGE( DirectX )
option ( ASSIMP_NO_EXPORT option ( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality." "Disable Assimp's export functionality."
OFF OFF
@ -242,9 +244,9 @@ option ( ASSIMP_BUILD_ASSIMP_TOOLS
ON ON
) )
IF ( ASSIMP_BUILD_ASSIMP_TOOLS ) IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( WIN32 ) IF ( WIN32 AND DirectX_FOUND )
ADD_SUBDIRECTORY( tools/assimp_view/ ) ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF ( WIN32 ) ENDIF ( WIN32 AND DirectX_FOUND )
ADD_SUBDIRECTORY( tools/assimp_cmd/ ) ADD_SUBDIRECTORY( tools/assimp_cmd/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )

View File

@ -620,7 +620,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
face.mIndices[i] = cur++; face.mIndices[i] = cur++;
// copy vertex positions // copy vertex positions
if ((vertices - mesh->mVertices) >= mesh->mNumVertices) { if (static_cast<unsigned>(vertices - mesh->mVertices) >= mesh->mNumVertices) {
throw DeadlyImportError("AC3D: Invalid number of vertices"); throw DeadlyImportError("AC3D: Invalid number of vertices");
} }
*vertices = object.vertices[entry.first] + object.translation; *vertices = object.vertices[entry.first] + object.translation;

View File

@ -333,8 +333,16 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
out->mAttenuationLinear = srcLight->mAttLinear; out->mAttenuationLinear = srcLight->mAttLinear;
out->mAttenuationQuadratic = srcLight->mAttQuadratic; out->mAttenuationQuadratic = srcLight->mAttQuadratic;
// collada doesn't differenciate between these color types
out->mColorDiffuse = out->mColorSpecular = out->mColorAmbient = srcLight->mColor*srcLight->mIntensity; out->mColorDiffuse = out->mColorSpecular = out->mColorAmbient = srcLight->mColor*srcLight->mIntensity;
if (out->mType == aiLightSource_AMBIENT) {
out->mColorDiffuse = out->mColorSpecular = aiColor3D(0, 0, 0);
out->mColorAmbient = srcLight->mColor*srcLight->mIntensity;
}
else {
// collada doesn't differentiate between these color types
out->mColorDiffuse = out->mColorSpecular = srcLight->mColor*srcLight->mIntensity;
out->mColorAmbient = aiColor3D(0, 0, 0);
}
// convert falloff angle and falloff exponent in our representation, if given // convert falloff angle and falloff exponent in our representation, if given
if (out->mType == aiLightSource_SPOT) { if (out->mType == aiLightSource_SPOT) {

View File

@ -84,29 +84,29 @@ const char* TokenTypeString(TokenType t)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset) std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset)
{ {
return static_cast<std::string>( (Formatter::format(),prefix," (offset 0x",std::hex,offset,") ",text) ); return static_cast<std::string>( (Formatter::format() << prefix << " (offset 0x" << std::hex << offset << ") " << text) );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string AddLineAndColumn(const std::string& prefix, const std::string& text, unsigned int line, unsigned int column) std::string AddLineAndColumn(const std::string& prefix, const std::string& text, unsigned int line, unsigned int column)
{ {
return static_cast<std::string>( (Formatter::format(),prefix," (line ",line,", col ",column,") ",text) ); return static_cast<std::string>( (Formatter::format() << prefix << " (line " << line << " << col " << column << ") " << text) );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string AddTokenText(const std::string& prefix, const std::string& text, const Token* tok) std::string AddTokenText(const std::string& prefix, const std::string& text, const Token* tok)
{ {
if(tok->IsBinary()) { if(tok->IsBinary()) {
return static_cast<std::string>( (Formatter::format(),prefix, return static_cast<std::string>( (Formatter::format() << prefix <<
" (",TokenTypeString(tok->Type()), " (" << TokenTypeString(tok->Type()) <<
", offset 0x", std::hex, tok->Offset(),") ", ", offset 0x" << std::hex << tok->Offset() << ") " <<
text) ); text) );
} }
return static_cast<std::string>( (Formatter::format(),prefix, return static_cast<std::string>( (Formatter::format() << prefix <<
" (",TokenTypeString(tok->Type()), " (" << TokenTypeString(tok->Type()) <<
", line ",tok->Line(), ", line " << tok->Line() <<
", col ",tok->Column(),") ", ", col " << tok->Column() << ") " <<
text) ); text) );
} }
@ -115,4 +115,3 @@ std::string AddTokenText(const std::string& prefix, const std::string& text, con
} // !Assimp } // !Assimp
#endif #endif

View File

@ -39,14 +39,14 @@ BEGIN_ODDLPARSER_NS
static const char *Version = "0.1.0"; static const char *Version = "0.1.0";
namespace Grammar { namespace Grammar {
static const char *OpenBracketToken = "{"; static const char * const OpenBracketToken = "{";
static const char *CloseBracketToken = "}"; static const char * const CloseBracketToken = "}";
static const char *OpenPropertyToken = "("; static const char * const OpenPropertyToken = "(";
static const char *ClosePropertyToken = ")"; static const char * const ClosePropertyToken = ")";
static const char *BoolTrue = "true"; static const char * const BoolTrue = "true";
static const char *BoolFalse = "false"; static const char * const BoolFalse = "false";
static const char *RefToken = "ref"; static const char * const RefToken = "ref";
static const char *CommaSeparator = ","; static const char * const CommaSeparator = ",";
static const char* PrimitiveTypeToken[ Value::ddl_types_max ] = { static const char* PrimitiveTypeToken[ Value::ddl_types_max ] = {
"bool", "bool",

View File

@ -652,13 +652,6 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t,
Triangle& ot = t->NeighborAcross(p); Triangle& ot = t->NeighborAcross(p);
Point& op = *ot.OppositePoint(*t, p); Point& op = *ot.OppositePoint(*t, p);
if (&ot == NULL) {
// If we want to integrate the fillEdgeEvent do it here
// With current implementation we should never get here
//throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
assert(0);
}
if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) { if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) {
// Lets rotate shared edge one vertex CW // Lets rotate shared edge one vertex CW
RotateTrianglePair(*t, p, ot, op); RotateTrianglePair(*t, p, ot, op);
@ -728,13 +721,6 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle&
Triangle& ot = t.NeighborAcross(p); Triangle& ot = t.NeighborAcross(p);
Point& op = *ot.OppositePoint(t, p); Point& op = *ot.OppositePoint(t, p);
if (&t.NeighborAcross(p) == NULL) {
// If we want to integrate the fillEdgeEvent do it here
// With current implementation we should never get here
//throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle");
assert(0);
}
if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) { if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) {
// flip with new edge op->eq // flip with new edge op->eq
FlipEdgeEvent(tcx, eq, op, &ot, op); FlipEdgeEvent(tcx, eq, op, &ot, op);

View File

@ -164,7 +164,7 @@ void SweepContext::RemoveFromMap(Triangle* triangle)
void SweepContext::MeshClean(Triangle& triangle) void SweepContext::MeshClean(Triangle& triangle)
{ {
if (&triangle != NULL && !triangle.IsInterior()) { if (!triangle.IsInterior()) {
triangle.IsInterior(true); triangle.IsInterior(true);
triangles_.push_back(&triangle); triangles_.push_back(&triangle);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View File

@ -1,6 +1,10 @@
FIND_PACKAGE(OpenGL) FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT) FIND_PACKAGE(GLUT)
find_library(M_LIB m) IF ( MSVC )
SET(M_LIB)
ELSE ( MSVC )
find_library(M_LIB m)
ENDIF ( MSVC )
IF ( NOT GLUT_FOUND ) IF ( NOT GLUT_FOUND )
IF ( MSVC ) IF ( MSVC )

View File

@ -14,7 +14,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#ifdef __APPLE__
#include <glut.h>
#else
#include <GL/glut.h> #include <GL/glut.h>
#endif
/* assimp include files. These three are usually needed. */ /* assimp include files. These three are usually needed. */
#include <assimp/cimport.h> #include <assimp/cimport.h>

View File

@ -69,6 +69,13 @@ limitations under the License.
<intensity>1.000000</intensity> <intensity>1.000000</intensity>
</technique> </technique>
</light> </light>
<light id="ambientLight-lib" name="ambientLight">
<technique_common>
<ambient>
<color>0.1 0.1 0.2</color>
</ambient>
</technique_common>
</light>
<light id="pointLightShape1-lib" name="pointLightShape1"> <light id="pointLightShape1-lib" name="pointLightShape1">
<technique_common> <technique_common>
<point> <point>
@ -175,6 +182,7 @@ limitations under the License.
<rotate sid="rotateY">0 1 0 0</rotate> <rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate> <rotate sid="rotateX">1 0 0 0</rotate>
<instance_light url="#light-lib"/> <instance_light url="#light-lib"/>
<instance_light url="#ambientLight-lib"/>
</node> </node>
<node id="Box" name="Box"> <node id="Box" name="Box">
<rotate sid="rotateZ">0 0 1 0</rotate> <rotate sid="rotateZ">0 0 1 0</rotate>

Binary file not shown.

View File

@ -191,7 +191,7 @@ void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxli
for(unsigned int i = 0; i < cnest; ++i) { for(unsigned int i = 0; i < cnest; ++i) {
printf("-- "); printf("-- ");
} }
printf("\'%s\', meshes: %i\n",root->mName.data,root->mNumMeshes); printf("\'%s\', meshes: %u\n",root->mName.data,root->mNumMeshes);
for (unsigned int i = 0; i < root->mNumChildren; ++i ) { for (unsigned int i = 0; i < root->mNumChildren; ++i ) {
PrintHierarchy(root->mChildren[i],maxnest,maxline,cline,cnest+1); PrintHierarchy(root->mChildren[i],maxnest,maxline,cline,cnest+1);
if(i == root->mNumChildren-1) { if(i == root->mNumChildren-1) {

View File

@ -677,16 +677,26 @@ void WriteBinaryDump(const aiScene* scene, FILE* _out, const char* src, const ch
Write<uint16_t>(compressed); Write<uint16_t>(compressed);
// == 20 bytes // == 20 bytes
char buff[256]; {
char buff[256] = { 0 };
strncpy(buff,src,256); strncpy(buff,src,256);
buff[255] = 0;
fwrite(buff,256,1,out); fwrite(buff,256,1,out);
}
{
char buff[128] = { 0 };
strncpy(buff,cmd,128); strncpy(buff,cmd,128);
buff[127] = 0;
fwrite(buff,128,1,out); fwrite(buff,128,1,out);
}
// leave 64 bytes free for future extensions // leave 64 bytes free for future extensions
{
char buff[64];
memset(buff,0xcd,64); memset(buff,0xcd,64);
fwrite(buff,64,1,out); fwrite(buff,64,1,out);
}
// == 435 bytes // == 435 bytes
// ==== total header size: 512 bytes // ==== total header size: 512 bytes
@ -748,17 +758,17 @@ void WriteNode(const aiNode* node, FILE* out, unsigned int depth)
prefix,m.d1,m.d2,m.d3,m.d4,prefix); prefix,m.d1,m.d2,m.d3,m.d4,prefix);
if (node->mNumMeshes) { if (node->mNumMeshes) {
fprintf(out, "%s\t<MeshRefs num=\"%i\">\n%s\t", fprintf(out, "%s\t<MeshRefs num=\"%u\">\n%s\t",
prefix,node->mNumMeshes,prefix); prefix,node->mNumMeshes,prefix);
for (unsigned int i = 0; i < node->mNumMeshes;++i) { for (unsigned int i = 0; i < node->mNumMeshes;++i) {
fprintf(out,"%i ",node->mMeshes[i]); fprintf(out,"%u ",node->mMeshes[i]);
} }
fprintf(out,"\n%s\t</MeshRefs>\n",prefix); fprintf(out,"\n%s\t</MeshRefs>\n",prefix);
} }
if (node->mNumChildren) { if (node->mNumChildren) {
fprintf(out,"%s\t<NodeList num=\"%i\">\n", fprintf(out,"%s\t<NodeList num=\"%u\">\n",
prefix,node->mNumChildren); prefix,node->mNumChildren);
for (unsigned int i = 0; i < node->mNumChildren;++i) { for (unsigned int i = 0; i < node->mNumChildren;++i) {
@ -853,13 +863,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
"<ASSIMP format_id=\"1\">\n\n" "<ASSIMP format_id=\"1\">\n\n"
"<!-- XML Model dump produced by assimp dump\n" "<!-- XML Model dump produced by assimp dump\n"
" Library version: %i.%i.%i\n" " Library version: %u.%u.%u\n"
" Source: %s\n" " Source: %s\n"
" Command line: %s\n" " Command line: %s\n"
" %s\n" " %s\n"
"-->" "-->"
" \n\n" " \n\n"
"<Scene flags=\"%i\" postprocessing=\"%i\">\n", "<Scene flags=\"%u\" postprocessing=\"%i\">\n",
aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),src,c.c_str(),asctime(p), aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),src,c.c_str(),asctime(p),
scene->mFlags, scene->mFlags,
@ -936,7 +946,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write textures // write textures
if (scene->mNumTextures) { if (scene->mNumTextures) {
fprintf(out,"<TextureList num=\"%i\">\n",scene->mNumTextures); fprintf(out,"<TextureList num=\"%u\">\n",scene->mNumTextures);
for (unsigned int i = 0; i < scene->mNumTextures;++i) { for (unsigned int i = 0; i < scene->mNumTextures;++i) {
aiTexture* tex = scene->mTextures[i]; aiTexture* tex = scene->mTextures[i];
bool compressed = (tex->mHeight == 0); bool compressed = (tex->mHeight == 0);
@ -947,7 +957,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
(compressed ? "true" : "false")); (compressed ? "true" : "false"));
if (compressed) { if (compressed) {
fprintf(out,"\t\t<Data length=\"%i\"> \n",tex->mWidth); fprintf(out,"\t\t<Data length=\"%u\"> \n",tex->mWidth);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < tex->mWidth;++n) { for (unsigned int n = 0; n < tex->mWidth;++n) {
@ -981,12 +991,12 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write materials // write materials
if (scene->mNumMaterials) { if (scene->mNumMaterials) {
fprintf(out,"<MaterialList num=\"%i\">\n",scene->mNumMaterials); fprintf(out,"<MaterialList num=\"%u\">\n",scene->mNumMaterials);
for (unsigned int i = 0; i< scene->mNumMaterials; ++i) { for (unsigned int i = 0; i< scene->mNumMaterials; ++i) {
const aiMaterial* mat = scene->mMaterials[i]; const aiMaterial* mat = scene->mMaterials[i];
fprintf(out,"\t<Material>\n"); fprintf(out,"\t<Material>\n");
fprintf(out,"\t\t<MatPropertyList num=\"%i\">\n",mat->mNumProperties); fprintf(out,"\t\t<MatPropertyList num=\"%u\">\n",mat->mNumProperties);
for (unsigned int n = 0; n < mat->mNumProperties;++n) { for (unsigned int n = 0; n < mat->mNumProperties;++n) {
const aiMaterialProperty* prop = mat->mProperties[n]; const aiMaterialProperty* prop = mat->mProperties[n];
@ -1004,7 +1014,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
sz = "binary_buffer"; sz = "binary_buffer";
} }
fprintf(out,"\t\t\t<MatProperty key=\"%s\" \n\t\t\ttype=\"%s\" tex_usage=\"%s\" tex_index=\"%i\"", fprintf(out,"\t\t\t<MatProperty key=\"%s\" \n\t\t\ttype=\"%s\" tex_usage=\"%s\" tex_index=\"%u\"",
prop->mKey.data, sz, prop->mKey.data, sz,
::TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex); ::TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex);
@ -1048,7 +1058,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write animations // write animations
if (scene->mNumAnimations) { if (scene->mNumAnimations) {
fprintf(out,"<AnimationList num=\"%i\">\n",scene->mNumAnimations); fprintf(out,"<AnimationList num=\"%u\">\n",scene->mNumAnimations);
for (unsigned int i = 0; i < scene->mNumAnimations;++i) { for (unsigned int i = 0; i < scene->mNumAnimations;++i) {
aiAnimation* anim = scene->mAnimations[i]; aiAnimation* anim = scene->mAnimations[i];
@ -1059,7 +1069,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write bone animation channels // write bone animation channels
if (anim->mNumChannels) { if (anim->mNumChannels) {
fprintf(out,"\t\t<NodeAnimList num=\"%i\">\n",anim->mNumChannels); fprintf(out,"\t\t<NodeAnimList num=\"%u\">\n",anim->mNumChannels);
for (unsigned int n = 0; n < anim->mNumChannels;++n) { for (unsigned int n = 0; n < anim->mNumChannels;++n) {
aiNodeAnim* nd = anim->mChannels[n]; aiNodeAnim* nd = anim->mChannels[n];
@ -1070,7 +1080,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
if (!shortened) { if (!shortened) {
// write position keys // write position keys
if (nd->mNumPositionKeys) { if (nd->mNumPositionKeys) {
fprintf(out,"\t\t\t\t<PositionKeyList num=\"%i\">\n",nd->mNumPositionKeys); fprintf(out,"\t\t\t\t<PositionKeyList num=\"%u\">\n",nd->mNumPositionKeys);
for (unsigned int a = 0; a < nd->mNumPositionKeys;++a) { for (unsigned int a = 0; a < nd->mNumPositionKeys;++a) {
aiVectorKey* vc = nd->mPositionKeys+a; aiVectorKey* vc = nd->mPositionKeys+a;
fprintf(out,"\t\t\t\t\t<PositionKey time=\"%e\">\n" fprintf(out,"\t\t\t\t\t<PositionKey time=\"%e\">\n"
@ -1082,7 +1092,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write scaling keys // write scaling keys
if (nd->mNumScalingKeys) { if (nd->mNumScalingKeys) {
fprintf(out,"\t\t\t\t<ScalingKeyList num=\"%i\">\n",nd->mNumScalingKeys); fprintf(out,"\t\t\t\t<ScalingKeyList num=\"%u\">\n",nd->mNumScalingKeys);
for (unsigned int a = 0; a < nd->mNumScalingKeys;++a) { for (unsigned int a = 0; a < nd->mNumScalingKeys;++a) {
aiVectorKey* vc = nd->mScalingKeys+a; aiVectorKey* vc = nd->mScalingKeys+a;
fprintf(out,"\t\t\t\t\t<ScalingKey time=\"%e\">\n" fprintf(out,"\t\t\t\t\t<ScalingKey time=\"%e\">\n"
@ -1094,7 +1104,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write rotation keys // write rotation keys
if (nd->mNumRotationKeys) { if (nd->mNumRotationKeys) {
fprintf(out,"\t\t\t\t<RotationKeyList num=\"%i\">\n",nd->mNumRotationKeys); fprintf(out,"\t\t\t\t<RotationKeyList num=\"%u\">\n",nd->mNumRotationKeys);
for (unsigned int a = 0; a < nd->mNumRotationKeys;++a) { for (unsigned int a = 0; a < nd->mNumRotationKeys;++a) {
aiQuatKey* vc = nd->mRotationKeys+a; aiQuatKey* vc = nd->mRotationKeys+a;
fprintf(out,"\t\t\t\t\t<RotationKey time=\"%e\">\n" fprintf(out,"\t\t\t\t\t<RotationKey time=\"%e\">\n"
@ -1115,13 +1125,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// write meshes // write meshes
if (scene->mNumMeshes) { if (scene->mNumMeshes) {
fprintf(out,"<MeshList num=\"%i\">\n",scene->mNumMeshes); fprintf(out,"<MeshList num=\"%u\">\n",scene->mNumMeshes);
for (unsigned int i = 0; i < scene->mNumMeshes;++i) { for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
aiMesh* mesh = scene->mMeshes[i]; aiMesh* mesh = scene->mMeshes[i];
// const unsigned int width = (unsigned int)log10((double)mesh->mNumVertices)+1; // const unsigned int width = (unsigned int)log10((double)mesh->mNumVertices)+1;
// mesh header // mesh header
fprintf(out,"\t<Mesh types=\"%s %s %s %s\" material_index=\"%i\">\n", fprintf(out,"\t<Mesh types=\"%s %s %s %s\" material_index=\"%u\">\n",
(mesh->mPrimitiveTypes & aiPrimitiveType_POINT ? "points" : ""), (mesh->mPrimitiveTypes & aiPrimitiveType_POINT ? "points" : ""),
(mesh->mPrimitiveTypes & aiPrimitiveType_LINE ? "lines" : ""), (mesh->mPrimitiveTypes & aiPrimitiveType_LINE ? "lines" : ""),
(mesh->mPrimitiveTypes & aiPrimitiveType_TRIANGLE ? "triangles" : ""), (mesh->mPrimitiveTypes & aiPrimitiveType_TRIANGLE ? "triangles" : ""),
@ -1130,7 +1140,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// bones // bones
if (mesh->mNumBones) { if (mesh->mNumBones) {
fprintf(out,"\t\t<BoneList num=\"%i\">\n",mesh->mNumBones); fprintf(out,"\t\t<BoneList num=\"%u\">\n",mesh->mNumBones);
for (unsigned int n = 0; n < mesh->mNumBones;++n) { for (unsigned int n = 0; n < mesh->mNumBones;++n) {
aiBone* bone = mesh->mBones[n]; aiBone* bone = mesh->mBones[n];
@ -1151,13 +1161,13 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
bone->mOffsetMatrix.d1,bone->mOffsetMatrix.d2,bone->mOffsetMatrix.d3,bone->mOffsetMatrix.d4); bone->mOffsetMatrix.d1,bone->mOffsetMatrix.d2,bone->mOffsetMatrix.d3,bone->mOffsetMatrix.d4);
if (!shortened && bone->mNumWeights) { if (!shortened && bone->mNumWeights) {
fprintf(out,"\t\t\t\t<WeightList num=\"%i\">\n",bone->mNumWeights); fprintf(out,"\t\t\t\t<WeightList num=\"%u\">\n",bone->mNumWeights);
// bone weights // bone weights
for (unsigned int a = 0; a < bone->mNumWeights;++a) { for (unsigned int a = 0; a < bone->mNumWeights;++a) {
aiVertexWeight* wght = bone->mWeights+a; aiVertexWeight* wght = bone->mWeights+a;
fprintf(out,"\t\t\t\t\t<Weight index=\"%i\">\n\t\t\t\t\t\t%f\n\t\t\t\t\t</Weight>\n", fprintf(out,"\t\t\t\t\t<Weight index=\"%u\">\n\t\t\t\t\t\t%f\n\t\t\t\t\t</Weight>\n",
wght->mVertexId,wght->mWeight); wght->mVertexId,wght->mWeight);
} }
fprintf(out,"\t\t\t\t</WeightList>\n"); fprintf(out,"\t\t\t\t</WeightList>\n");
@ -1169,14 +1179,14 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// faces // faces
if (!shortened && mesh->mNumFaces) { if (!shortened && mesh->mNumFaces) {
fprintf(out,"\t\t<FaceList num=\"%i\">\n",mesh->mNumFaces); fprintf(out,"\t\t<FaceList num=\"%u\">\n",mesh->mNumFaces);
for (unsigned int n = 0; n < mesh->mNumFaces; ++n) { for (unsigned int n = 0; n < mesh->mNumFaces; ++n) {
aiFace& f = mesh->mFaces[n]; aiFace& f = mesh->mFaces[n];
fprintf(out,"\t\t\t<Face num=\"%i\">\n" fprintf(out,"\t\t\t<Face num=\"%u\">\n"
"\t\t\t\t",f.mNumIndices); "\t\t\t\t",f.mNumIndices);
for (unsigned int j = 0; j < f.mNumIndices;++j) for (unsigned int j = 0; j < f.mNumIndices;++j)
fprintf(out,"%i ",f.mIndices[j]); fprintf(out,"%u ",f.mIndices[j]);
fprintf(out,"\n\t\t\t</Face>\n"); fprintf(out,"\n\t\t\t</Face>\n");
} }
@ -1185,7 +1195,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// vertex positions // vertex positions
if (mesh->HasPositions()) { if (mesh->HasPositions()) {
fprintf(out,"\t\t<Positions num=\"%i\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices); fprintf(out,"\t\t<Positions num=\"%u\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {
fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", fprintf(out,"\t\t%0 8f %0 8f %0 8f\n",
@ -1199,7 +1209,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// vertex normals // vertex normals
if (mesh->HasNormals()) { if (mesh->HasNormals()) {
fprintf(out,"\t\t<Normals num=\"%i\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices); fprintf(out,"\t\t<Normals num=\"%u\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {
fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", fprintf(out,"\t\t%0 8f %0 8f %0 8f\n",
@ -1215,7 +1225,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
// vertex tangents and bitangents // vertex tangents and bitangents
if (mesh->HasTangentsAndBitangents()) { if (mesh->HasTangentsAndBitangents()) {
fprintf(out,"\t\t<Tangents num=\"%i\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices); fprintf(out,"\t\t<Tangents num=\"%u\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {
fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", fprintf(out,"\t\t%0 8f %0 8f %0 8f\n",
@ -1226,7 +1236,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
} }
fprintf(out,"\t\t</Tangents>\n"); fprintf(out,"\t\t</Tangents>\n");
fprintf(out,"\t\t<Bitangents num=\"%i\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices); fprintf(out,"\t\t<Bitangents num=\"%u\" set=\"0\" num_components=\"3\"> \n",mesh->mNumVertices);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {
fprintf(out,"\t\t%0 8f %0 8f %0 8f\n", fprintf(out,"\t\t%0 8f %0 8f %0 8f\n",
@ -1243,7 +1253,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
if (!mesh->mTextureCoords[a]) if (!mesh->mTextureCoords[a])
break; break;
fprintf(out,"\t\t<TextureCoords num=\"%i\" set=\"%i\" num_components=\"%i\"> \n",mesh->mNumVertices, fprintf(out,"\t\t<TextureCoords num=\"%u\" set=\"%u\" num_components=\"%u\"> \n",mesh->mNumVertices,
a,mesh->mNumUVComponents[a]); a,mesh->mNumUVComponents[a]);
if (!shortened) { if (!shortened) {
@ -1270,7 +1280,7 @@ void WriteDump(const aiScene* scene, FILE* out, const char* src, const char* cmd
for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a) { for (unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; ++a) {
if (!mesh->mColors[a]) if (!mesh->mColors[a])
break; break;
fprintf(out,"\t\t<Colors num=\"%i\" set=\"%i\" num_components=\"4\"> \n",mesh->mNumVertices,a); fprintf(out,"\t\t<Colors num=\"%u\" set=\"%u\" num_components=\"4\"> \n",mesh->mNumVertices,a);
if (!shortened) { if (!shortened) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {
fprintf(out,"\t\t%0 8f %0 8f %0 8f %0 8f\n", fprintf(out,"\t\t%0 8f %0 8f %0 8f %0 8f\n",

View File

@ -169,7 +169,7 @@ int CDisplay::AddNodeToDisplayList(
iIndex += iDepth * 100; iIndex += iDepth * 100;
} }
else iIndex += iDepth * 10; else iIndex += iDepth * 10;
sprintf(chTemp,"Node %i",iIndex); sprintf(chTemp,"Node %u",iIndex);
} }
else { else {
sprintf(chTemp,"%s",pcNode->mName.data); sprintf(chTemp,"%s",pcNode->mName.data);
@ -222,7 +222,7 @@ int CDisplay::AddMeshToDisplayList(unsigned int iIndex, HTREEITEM hRoot)
char chTemp[MAXLEN]; char chTemp[MAXLEN];
if(0 == pcMesh->mName.length) { if(0 == pcMesh->mName.length) {
sprintf(chTemp,"Mesh %i",iIndex); sprintf(chTemp,"Mesh %u",iIndex);
} }
else { else {
sprintf(chTemp,"%s",pcMesh->mName.data); sprintf(chTemp,"%s",pcMesh->mName.data);
@ -1028,7 +1028,7 @@ int CDisplay::OnSetupTextureView(TextureInfo* pcNew)
sprintf(szTemp,"%i",(*pcNew->piTexture)->GetLevelCount()); sprintf(szTemp,"%i",(*pcNew->piTexture)->GetLevelCount());
SetWindowText(GetDlgItem(g_hDlg,IDC_ESHADER),szTemp); SetWindowText(GetDlgItem(g_hDlg,IDC_ESHADER),szTemp);
sprintf(szTemp,"%i",pcNew->iUV); sprintf(szTemp,"%u",pcNew->iUV);
SetWindowText(GetDlgItem(g_hDlg,IDC_EMAT),szTemp); SetWindowText(GetDlgItem(g_hDlg,IDC_EMAT),szTemp);
sprintf(szTemp,"%f",pcNew->fBlend); sprintf(szTemp,"%f",pcNew->fBlend);
@ -1320,8 +1320,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -1353,8 +1355,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),

View File

@ -168,8 +168,10 @@ void CLogWindow::Save()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),

View File

@ -474,8 +474,10 @@ void LoadBGTexture()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -597,8 +599,10 @@ void LoadSkybox()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -639,8 +643,10 @@ void SaveScreenshot()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -938,8 +944,10 @@ void OpenAsset()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
// get a list of all file extensions supported by ASSIMP // get a list of all file extensions supported by ASSIMP