diff --git a/mk/windows/group-binaries.bat b/mk/windows/group-binaries.bat
index ba556fb8f..727ab1f6a 100644
--- a/mk/windows/group-binaries.bat
+++ b/mk/windows/group-binaries.bat
@@ -16,20 +16,20 @@ copy /y ..\shared\glestkeys.ini bin\vs2015\glestkeys.ini
copy /y ..\shared\glestkeys.ini bin\vs2017\glestkeys.ini
-copy /y vs2015-32\g3d_viewerWin32\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-32.exe
-copy /y vs2017-32\g3d_viewerWin32\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-32.exe
+copy /y vs2015-32\g3d_viewer\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-32.exe
+copy /y vs2017-32\g3d_viewer\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-32.exe
-copy /y vs2015-32\map_editorWin32\Release\map_editor.exe bin\vs2015\map_editor-32.exe
-copy /y vs2017-32\map_editorWin32\Release\map_editor.exe bin\vs2017\map_editor-32.exe
+copy /y vs2015-32\map_editor\Release\map_editor.exe bin\vs2015\map_editor-32.exe
+copy /y vs2017-32\map_editor\Release\map_editor.exe bin\vs2017\map_editor-32.exe
copy /y vs2015-32\zetaglest\zetaglest.exe bin\vs2015\zetaglest-32.exe
copy /y vs2017-32\zetaglest\zetaglest.exe bin\vs2017\zetaglest-32.exe
-copy /y vs2015-64\g3d_viewerx64\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-64.exe
-copy /y vs2017-64\g3d_viewerx64\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-64.exe
+copy /y vs2015-64\g3d_viewer\Release\g3d_viewer.exe bin\vs2015\g3d_viewer-64.exe
+copy /y vs2017-64\g3d_viewer\Release\g3d_viewer.exe bin\vs2017\g3d_viewer-64.exe
-copy /y vs2015-64\map_editorx64\Release\map_editor.exe bin\vs2015\map_editor-64.exe
-copy /y vs2017-64\map_editorx64\Release\map_editor.exe bin\vs2017\map_editor-64.exe
+copy /y vs2015-64\map_editor\Release\map_editor.exe bin\vs2015\map_editor-64.exe
+copy /y vs2017-64\map_editor\Release\map_editor.exe bin\vs2017\map_editor-64.exe
copy /y vs2015-64\zetaglest\zetaglest.exe bin\vs2015\zetaglest-64.exe
copy /y vs2017-64\zetaglest\zetaglest.exe bin\vs2017\zetaglest-64.exe
\ No newline at end of file
diff --git a/mk/windows/vs2015-32/g3d_viewer.vcxproj b/mk/windows/vs2015-32/g3d_viewer.vcxproj
index 350b8aad9..7ed1e1626 100644
--- a/mk/windows/vs2015-32/g3d_viewer.vcxproj
+++ b/mk/windows/vs2015-32/g3d_viewer.vcxproj
@@ -82,7 +82,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
true
true
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2015-32/libzetaglest.vcxproj b/mk/windows/vs2015-32/libzetaglest.vcxproj
index 42bedbaf2..93203cf54 100644
--- a/mk/windows/vs2015-32/libzetaglest.vcxproj
+++ b/mk/windows/vs2015-32/libzetaglest.vcxproj
@@ -140,7 +140,7 @@
libzetaglest
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
MultiThreadedDLL
diff --git a/mk/windows/vs2015-32/map_editor.vcxproj b/mk/windows/vs2015-32/map_editor.vcxproj
index ee70caf8f..55491a26c 100644
--- a/mk/windows/vs2015-32/map_editor.vcxproj
+++ b/mk/windows/vs2015-32/map_editor.vcxproj
@@ -83,7 +83,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
true
true
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2015-64/g3d_viewer.vcxproj b/mk/windows/vs2015-64/g3d_viewer.vcxproj
index 328153887..d78dce566 100644
--- a/mk/windows/vs2015-64/g3d_viewer.vcxproj
+++ b/mk/windows/vs2015-64/g3d_viewer.vcxproj
@@ -101,7 +101,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2015-64/libzetaglest.vcxproj b/mk/windows/vs2015-64/libzetaglest.vcxproj
index a1f8c7a2f..d5c30282c 100644
--- a/mk/windows/vs2015-64/libzetaglest.vcxproj
+++ b/mk/windows/vs2015-64/libzetaglest.vcxproj
@@ -113,7 +113,7 @@
libzetaglest
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
MultiThreadedDLL
diff --git a/mk/windows/vs2015-64/map_editor.vcxproj b/mk/windows/vs2015-64/map_editor.vcxproj
index 323f86a39..8f2ed9f19 100644
--- a/mk/windows/vs2015-64/map_editor.vcxproj
+++ b/mk/windows/vs2015-64/map_editor.vcxproj
@@ -98,7 +98,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2017-32/g3d_viewer.vcxproj b/mk/windows/vs2017-32/g3d_viewer.vcxproj
index bd9c67bfa..259d4a7a9 100644
--- a/mk/windows/vs2017-32/g3d_viewer.vcxproj
+++ b/mk/windows/vs2017-32/g3d_viewer.vcxproj
@@ -82,7 +82,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
true
true
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2017-32/libzetaglest.vcxproj b/mk/windows/vs2017-32/libzetaglest.vcxproj
index a664ae029..2008b28e0 100644
--- a/mk/windows/vs2017-32/libzetaglest.vcxproj
+++ b/mk/windows/vs2017-32/libzetaglest.vcxproj
@@ -140,7 +140,7 @@
libzetaglest
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
MultiThreadedDLL
diff --git a/mk/windows/vs2017-32/map_editor.vcxproj b/mk/windows/vs2017-32/map_editor.vcxproj
index 108c6ef16..fbc72f8e6 100644
--- a/mk/windows/vs2017-32/map_editor.vcxproj
+++ b/mk/windows/vs2017-32/map_editor.vcxproj
@@ -83,7 +83,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
true
true
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2017-64/g3d_viewer.vcxproj b/mk/windows/vs2017-64/g3d_viewer.vcxproj
index 6f575d431..67ae06e2b 100644
--- a/mk/windows/vs2017-64/g3d_viewer.vcxproj
+++ b/mk/windows/vs2017-64/g3d_viewer.vcxproj
@@ -101,7 +101,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/mk/windows/vs2017-64/libzetaglest.vcxproj b/mk/windows/vs2017-64/libzetaglest.vcxproj
index 0def2229f..8aedaae81 100644
--- a/mk/windows/vs2017-64/libzetaglest.vcxproj
+++ b/mk/windows/vs2017-64/libzetaglest.vcxproj
@@ -113,7 +113,7 @@
libzetaglest
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
MultiThreadedDLL
diff --git a/mk/windows/vs2017-64/map_editor.vcxproj b/mk/windows/vs2017-64/map_editor.vcxproj
index df01204c7..80c86b641 100644
--- a/mk/windows/vs2017-64/map_editor.vcxproj
+++ b/mk/windows/vs2017-64/map_editor.vcxproj
@@ -98,7 +98,7 @@
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
- $(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\
+ $(SolutionDir)\$(TargetName)\
$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\
diff --git a/source/shared_lib/include/graphics/model.h b/source/shared_lib/include/graphics/model.h
index e5fc863e5..56dc4f898 100644
--- a/source/shared_lib/include/graphics/model.h
+++ b/source/shared_lib/include/graphics/model.h
@@ -46,9 +46,9 @@ namespace Shared {
class Mesh {
private:
//mesh data
- Texture2D * textures[meshTextureCount];
- bool texturesOwned[meshTextureCount];
- string texturePaths[meshTextureCount];
+ Texture2D * textures[MESH_TEXTURE_COUNT];
+ bool texturesOwned[MESH_TEXTURE_COUNT];
+ string texturePaths[MESH_TEXTURE_COUNT];
string name;
//vertex data counts
@@ -61,7 +61,6 @@ namespace Shared {
Vec3f *vertices;
Vec3f *normals;
Vec2f *texCoords;
- Vec3f *tangents;
uint32 *indices;
//material data
@@ -143,9 +142,6 @@ namespace Shared {
const Vec2f *getTexCoords() const {
return texCoords;
}
- const Vec3f *getTangents() const {
- return tangents;
- }
const uint32 *getIndices() const {
return indices;
}
@@ -227,7 +223,7 @@ namespace Shared {
private:
string findAlternateTexture(vector conversionList, string textureFile);
- void computeTangents();
+ //void computeTangents();
};
diff --git a/source/shared_lib/include/graphics/model_header.h b/source/shared_lib/include/graphics/model_header.h
index c18323ad3..479c96f05 100644
--- a/source/shared_lib/include/graphics/model_header.h
+++ b/source/shared_lib/include/graphics/model_header.h
@@ -22,7 +22,6 @@ using Shared::Platform::float32;
namespace Shared {
namespace Graphics {
-
#pragma pack(push, 1)
struct FileHeader {
@@ -48,17 +47,15 @@ namespace Shared {
mpfGlow = 8
};
- enum MeshTexture {
- mtDiffuse,
- mtSpecular,
- mtNormal,
- mtReflection,
- mtColorMask,
+ static const int MESH_TEXTURE_COUNT = 3;
- meshTextureCount
+ enum MeshTexture {
+ mtDiffuse = 1,
+ mtSpecular = 2,
+ mtNormal = 4
};
- const int meshTextureChannelCount[] = { -1, 1, 3, 1, 1 };
+ const int meshTextureChannelCount[] = { 4, 1, 3 };
const uint32 meshNameSize = 64;
const uint32 mapPathSize = 64;
diff --git a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp
index 8462c70bd..3b806a286 100644
--- a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp
+++ b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp
@@ -297,7 +297,7 @@ namespace Shared {
}
//texture state
- const Texture2DGl *texture = static_cast(mesh->getTexture(mtDiffuse));
+ const Texture2DGl *texture = static_cast(mesh->getTexture(0));
if (texture != NULL && renderTextures) {
if (lastTexture != texture->getHandle()) {
//assert(glIsTexture(texture->getHandle()));
@@ -351,7 +351,7 @@ namespace Shared {
assertGl();
//tex coords
- if (renderTextures && mesh->getTexture(mtDiffuse) != NULL) {
+ if (renderTextures && mesh->getTexture(0) != NULL) {
if (duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
@@ -392,7 +392,7 @@ namespace Shared {
assertGl();
//tex coords
- if (renderTextures && mesh->getTexture(mtDiffuse) != NULL) {
+ if (renderTextures && mesh->getTexture(0) != NULL) {
if (duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp
index 64dfba056..62cdba71e 100644
--- a/source/shared_lib/sources/graphics/model.cpp
+++ b/source/shared_lib/sources/graphics/model.cpp
@@ -214,11 +214,10 @@ namespace Shared {
vertices = NULL;
normals = NULL;
texCoords = NULL;
- tangents = NULL;
indices = NULL;
interpolationData = NULL;
- for (int i = 0; i < meshTextureCount; ++i) {
+ for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
textures[i] = NULL;
texturesOwned[i] = false;
}
@@ -283,15 +282,13 @@ namespace Shared {
normals = NULL;
delete[] texCoords;
texCoords = NULL;
- delete[] tangents;
- tangents = NULL;
delete[] indices;
indices = NULL;
cleanupInterpolationData();
if (textureManager != NULL) {
- for (int i = 0; i < meshTextureCount; ++i) {
+ for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if (texturesOwned[i] == true && textures[i] != NULL) {
//printf("Deleting Texture [%s] i = %d\n",textures[i]->getPath().c_str(),i);
textureManager->endTexture(textures[i]);
@@ -457,17 +454,17 @@ namespace Shared {
//texture
if (meshHeader.hasTexture && textureManager != NULL) {
- texturePaths[mtDiffuse] = toLower(reinterpret_cast(meshHeader.texName));
+ texturePaths[0] = toLower(reinterpret_cast(meshHeader.texName));
string texPath = dir;
if (texPath != "") {
endPathWithSlash(texPath);
}
- texPath += texturePaths[mtDiffuse];
+ texPath += texturePaths[0];
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] v2 model texture [%s] meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshIndex, modelFile.c_str());
- textures[mtDiffuse] = dynamic_cast(textureManager->getTexture(texPath));
- if (textures[mtDiffuse] == NULL) {
+ textures[0] = dynamic_cast(textureManager->getTexture(texPath));
+ if (textures[0] == NULL) {
if (fileExists(texPath) == false) {
vector conversionList;
conversionList.push_back("png");
@@ -479,15 +476,15 @@ namespace Shared {
if (fileExists(texPath) == true) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] v2 model texture [%s] meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshIndex, modelFile.c_str());
- textures[mtDiffuse] = textureManager->newTexture2D();
- textures[mtDiffuse]->load(texPath);
+ textures[0] = textureManager->newTexture2D();
+ textures[0]->load(texPath);
if (loadedFileList) {
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader));
}
- texturesOwned[mtDiffuse] = true;
- textures[mtDiffuse]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
+ texturesOwned[0] = true;
+ textures[0]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
if (deletePixMapAfterLoad == true) {
- textures[mtDiffuse]->deletePixels();
+ textures[0]->deletePixels();
}
} else {
SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error v2 model is missing texture [%s] meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshIndex, modelFile.c_str());
@@ -512,7 +509,7 @@ namespace Shared {
}
fromEndianVecArray(normals, frameCount*vertexCount);
- if (textureFlags & (1 << mtDiffuse)) {
+ if ((textureFlags & mtDiffuse) == mtDiffuse) {
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
if (readBytes != 1 && vertexCount != 0) {
char szBuf[8096] = "";
@@ -598,18 +595,18 @@ namespace Shared {
//texture
if ((meshHeader.properties & mp3NoTexture) != mp3NoTexture && textureManager != NULL) {
- texturePaths[mtDiffuse] = toLower(reinterpret_cast(meshHeader.texName));
+ texturePaths[0] = toLower(reinterpret_cast(meshHeader.texName));
string texPath = dir;
if (texPath != "") {
endPathWithSlash(texPath);
}
- texPath += texturePaths[mtDiffuse];
+ texPath += texturePaths[0];
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] v3 model texture [%s] meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshIndex, modelFile.c_str());
- textures[mtDiffuse] = dynamic_cast(textureManager->getTexture(texPath));
- if (textures[mtDiffuse] == NULL) {
+ textures[0] = dynamic_cast(textureManager->getTexture(texPath));
+ if (textures[0] == NULL) {
if (fileExists(texPath) == false) {
vector conversionList;
conversionList.push_back("png");
@@ -622,16 +619,16 @@ namespace Shared {
if (fileExists(texPath) == true) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] v3 model texture [%s] meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshIndex, modelFile.c_str());
- textures[mtDiffuse] = textureManager->newTexture2D();
- textures[mtDiffuse]->load(texPath);
+ textures[0] = textureManager->newTexture2D();
+ textures[0]->load(texPath);
if (loadedFileList) {
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader));
}
- texturesOwned[mtDiffuse] = true;
- textures[mtDiffuse]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
+ texturesOwned[0] = true;
+ textures[0]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
if (deletePixMapAfterLoad == true) {
- textures[mtDiffuse]->deletePixels();
+ textures[0]->deletePixels();
}
} else {
SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error v3 model is missing texture [%s] meshHeader.properties = %d meshIndex = %d modelFile [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, texPath.c_str(), meshHeader.properties, meshIndex, modelFile.c_str());
@@ -656,7 +653,7 @@ namespace Shared {
}
fromEndianVecArray(normals, frameCount*vertexCount);
- if (textureFlags & (1 << mtDiffuse)) {
+ if ((textureFlags & mtDiffuse) == mtDiffuse) {
for (unsigned int i = 0; i < meshHeader.texCoordFrameCount; ++i) {
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
if (readBytes != 1 && vertexCount != 0) {
@@ -800,7 +797,7 @@ namespace Shared {
//maps
uint32 flag = 1;
- for (int i = 0; i < meshTextureCount; ++i) {
+ for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if (meshHeader.textures & flag) {
uint8 cMapPath[mapPathSize + 1];
memset(&cMapPath[0], 0, mapPathSize + 1);
@@ -826,8 +823,7 @@ namespace Shared {
}
mapFullPath += mapPath;
if (textureManager) {
- textures[i] = loadMeshTexture(meshIndex, i, textureManager, mapFullPath,
- meshTextureChannelCount[i], texturesOwned[i],
+ textures[i] = loadMeshTexture(meshIndex, i, textureManager, mapFullPath, meshTextureChannelCount[i], texturesOwned[i],
deletePixMapAfterLoad, loadedFileList, sourceLoader, modelFile);
}
}
@@ -869,9 +865,9 @@ namespace Shared {
Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount);
//tangents
- if (textures[mtNormal] != NULL) {
+ /*if (textures[mtNormal] != NULL) {
computeTangents();
- }
+ }*/
}
void Mesh::save(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
@@ -909,11 +905,11 @@ namespace Shared {
meshHeader.textures = textureFlags;
fwrite(&meshHeader, sizeof(MeshHeader), 1, f);
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Save, this = %p, Found meshTextureCount = %d, meshHeader.textures = %d meshIndex = %d\n", this, meshTextureCount, meshHeader.textures, meshIndex);
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Save, this = %p, Found meshTextureCount = %d, meshHeader.textures = %d meshIndex = %d\n", this, MESH_TEXTURE_COUNT, meshHeader.textures, meshIndex);
//maps
uint32 flag = 1;
- for (int i = 0; i < meshTextureCount; ++i) {
+ for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if ((meshHeader.textures & flag)) {
uint8 cMapPath[mapPathSize];
memset(&cMapPath[0], 0, mapPathSize);
@@ -1019,7 +1015,7 @@ namespace Shared {
fwrite(indices, sizeof(uint32)*indexCount, 1, f);
}
- void Mesh::computeTangents() {
+ /*void Mesh::computeTangents() {
delete[] tangents;
try {
tangents = new Vec3f[vertexCount];
@@ -1058,14 +1054,12 @@ namespace Shared {
}
for (unsigned int i = 0; i < vertexCount; ++i) {
- /*Vec3f binormal= normals[i].cross(tangents[i]);
- tangents[i]+= binormal.cross(normals[i]);*/
tangents[i].normalize();
}
- }
+ }*/
void Mesh::deletePixels() {
- for (int i = 0; i < meshTextureCount; ++i) {
+ for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if (textures[i] != NULL) {
textures[i]->deletePixels();
}
@@ -1446,7 +1440,7 @@ namespace Shared {
void Mesh::copyInto(Mesh *dest, bool ignoreInterpolationData,
bool destinationOwnsTextures) {
- for (int index = 0; index < meshTextureCount; ++index) {
+ for (int index = 0; index < MESH_TEXTURE_COUNT; ++index) {
dest->textures[index] = this->textures[index];
dest->texturesOwned[index] = this->texturesOwned[index];
dest->texturePaths[index] = this->texturePaths[index];
@@ -1491,15 +1485,6 @@ namespace Shared {
memcpy(&dest->texCoords[0], &this->texCoords[0], this->vertexCount * sizeof(Vec2f));
}
- if (dest->tangents != NULL) {
- delete[] dest->tangents;
- dest->tangents = NULL;
- }
- if (this->tangents != NULL) {
- dest->tangents = new Vec3f[this->vertexCount];
- memcpy(&dest->tangents[0], &this->tangents[0], this->vertexCount * sizeof(Vec3f));
- }
-
if (dest->indices != NULL) {
delete[] dest->indices;
dest->indices = NULL;
diff --git a/source/tools/g3d_support.py b/source/tools/g3d_support.py
index efa6ce364..0ae781602 100644
--- a/source/tools/g3d_support.py
+++ b/source/tools/g3d_support.py
@@ -75,28 +75,32 @@
#vertexCount: number of vertices in each frame
#indexCount: number of indices in this mesh (the number of triangles is indexCount/3)
#diffuseColor: RGB diffuse color
-#specularColor: RGB specular color (currently unused)
-#specularPower: specular power (currently unused)
+#specularColor: RGB specular color
+#specularPower: specular power
##properties: property flags
#Code:
#enum MeshPropertyFlag{
# mpfCustomColor= 1,
# mpfTwoSided= 2,
-# mpfNoSelect= 4
+# mpfNoSelect= 4,
+# mpfGlow= 8
#};
-#mpfTwoSided: meshes in this mesh are rendered by both sides, if this flag is not present only "counter clockwise" faces are rendered
+#The last 8 bits of properties are used for teamcolor transparency, where 0 is opaque, and 255 is fully transparent team color. The value is inverted for compatibility with megaglest
+#mpfTwoSided: meshes in this mesh are rendered by both sides, if this flag is not present only "counter clockwise" faces are rendered (culling)
#mpfCustomColor: alpha in this model is replaced by a custom color, usually the player color
+#mpfNoSelect: whether the model is selectable
+#mpfGlow: whether the model has a glow effect
#textures: texture flags
#Code:
#enum MeshTexture{
-# diffuse = 1,
-# specular = 2,
-# normal = 4
+# mtDiffuse = 1,
+# mtSpecular = 2,
+# mtNormal = 4
#};
#================================
#4. TEXTURE NAMES
#================================
-#A list of uint8[64] texture name values. One for each texture in the mesh. If there are no textures in the mesh no texture names are present.
+#A list of (max 3) uint8[64] texture name values. One for each corresponding texture flag in the mesh. If there are no textures in the mesh, no texture names are present.
#================================
#5. MESH DATA
#================================
@@ -179,7 +183,7 @@ class G3DMeshHeaderv3: #Read Meshheader
temp = fileID.read(struct.calcsize(self.binary_format))
data = struct.unpack(self.binary_format,temp)
self.framecount = data[0] #Framecount = Number of Animationsteps
- self.normalframecount= data[1] #Number of Normal Frames actualli equal to Framecount
+ self.normalframecount= data[1] #Number of Normal Frames actually equal to Framecount
self.texturecoordframecount= data[2]#Number of Frames of Texturecoordinates seems everytime to be 1
self.colorframecount= data[3] #Number of Frames of Colors seems everytime to be 1
self.vertexcount= data[4] #Number of Vertices in each Frame
@@ -227,8 +231,8 @@ class G3DMeshHeaderv4: #Read Meshheader
self.istwosided = bool(self.properties & 2)
self.noselect = bool(self.properties & 4)
self.glow = bool(self.properties & 8)
- # Get last 8 bits for teamcolor transparency.
- # The value is inverted for compatibility with megaglest.
+ # Get last 8 bits for teamcolor transparency
+ # The value is inverted for compatibility with megaglest
self.teamcoloralpha = 255 - (self.properties >> 24)