Fixed errors in G3D spec and documentation

This commit is contained in:
mathusummut
2018-09-30 10:30:08 +02:00
parent aadf4c5e41
commit 6feb343eb3
18 changed files with 80 additions and 98 deletions

View File

@@ -16,20 +16,20 @@ copy /y ..\shared\glestkeys.ini bin\vs2015\glestkeys.ini
copy /y ..\shared\glestkeys.ini bin\vs2017\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 vs2015-32\g3d_viewer\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 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 vs2015-32\map_editor\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 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 vs2015-32\zetaglest\zetaglest.exe bin\vs2015\zetaglest-32.exe
copy /y vs2017-32\zetaglest\zetaglest.exe bin\vs2017\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 vs2015-64\g3d_viewer\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 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 vs2015-64\map_editor\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 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 vs2015-64\zetaglest\zetaglest.exe bin\vs2015\zetaglest-64.exe
copy /y vs2017-64\zetaglest\zetaglest.exe bin\vs2017\zetaglest-64.exe copy /y vs2017-64\zetaglest\zetaglest.exe bin\vs2017\zetaglest-64.exe

View File

@@ -82,7 +82,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -140,7 +140,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>libzetaglest</TargetName> <TargetName>libzetaglest</TargetName>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</PropertyGroup> </PropertyGroup>

View File

@@ -83,7 +83,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -101,7 +101,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -113,7 +113,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>libzetaglest</TargetName> <TargetName>libzetaglest</TargetName>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</PropertyGroup> </PropertyGroup>

View File

@@ -98,7 +98,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -82,7 +82,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -140,7 +140,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>libzetaglest</TargetName> <TargetName>libzetaglest</TargetName>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</PropertyGroup> </PropertyGroup>

View File

@@ -83,7 +83,7 @@
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -101,7 +101,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -113,7 +113,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>libzetaglest</TargetName> <TargetName>libzetaglest</TargetName>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</PropertyGroup> </PropertyGroup>

View File

@@ -98,7 +98,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)\$(TargetName)$(Platform)\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)\$(TargetName)\</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
<IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)\$(TargetName)$(Platform)_obj\$(Configuration)\</IntDir>

View File

@@ -46,9 +46,9 @@ namespace Shared {
class Mesh { class Mesh {
private: private:
//mesh data //mesh data
Texture2D * textures[meshTextureCount]; Texture2D * textures[MESH_TEXTURE_COUNT];
bool texturesOwned[meshTextureCount]; bool texturesOwned[MESH_TEXTURE_COUNT];
string texturePaths[meshTextureCount]; string texturePaths[MESH_TEXTURE_COUNT];
string name; string name;
//vertex data counts //vertex data counts
@@ -61,7 +61,6 @@ namespace Shared {
Vec3f *vertices; Vec3f *vertices;
Vec3f *normals; Vec3f *normals;
Vec2f *texCoords; Vec2f *texCoords;
Vec3f *tangents;
uint32 *indices; uint32 *indices;
//material data //material data
@@ -143,9 +142,6 @@ namespace Shared {
const Vec2f *getTexCoords() const { const Vec2f *getTexCoords() const {
return texCoords; return texCoords;
} }
const Vec3f *getTangents() const {
return tangents;
}
const uint32 *getIndices() const { const uint32 *getIndices() const {
return indices; return indices;
} }
@@ -227,7 +223,7 @@ namespace Shared {
private: private:
string findAlternateTexture(vector<string> conversionList, string textureFile); string findAlternateTexture(vector<string> conversionList, string textureFile);
void computeTangents(); //void computeTangents();
}; };

View File

@@ -22,7 +22,6 @@ using Shared::Platform::float32;
namespace Shared { namespace Shared {
namespace Graphics { namespace Graphics {
#pragma pack(push, 1) #pragma pack(push, 1)
struct FileHeader { struct FileHeader {
@@ -48,17 +47,15 @@ namespace Shared {
mpfGlow = 8 mpfGlow = 8
}; };
enum MeshTexture { static const int MESH_TEXTURE_COUNT = 3;
mtDiffuse,
mtSpecular,
mtNormal,
mtReflection,
mtColorMask,
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 meshNameSize = 64;
const uint32 mapPathSize = 64; const uint32 mapPathSize = 64;

View File

@@ -297,7 +297,7 @@ namespace Shared {
} }
//texture state //texture state
const Texture2DGl *texture = static_cast<const Texture2DGl*>(mesh->getTexture(mtDiffuse)); const Texture2DGl *texture = static_cast<const Texture2DGl*>(mesh->getTexture(0));
if (texture != NULL && renderTextures) { if (texture != NULL && renderTextures) {
if (lastTexture != texture->getHandle()) { if (lastTexture != texture->getHandle()) {
//assert(glIsTexture(texture->getHandle())); //assert(glIsTexture(texture->getHandle()));
@@ -351,7 +351,7 @@ namespace Shared {
assertGl(); assertGl();
//tex coords //tex coords
if (renderTextures && mesh->getTexture(mtDiffuse) != NULL) { if (renderTextures && mesh->getTexture(0) != NULL) {
if (duplicateTexCoords) { if (duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit); glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
@@ -392,7 +392,7 @@ namespace Shared {
assertGl(); assertGl();
//tex coords //tex coords
if (renderTextures && mesh->getTexture(mtDiffuse) != NULL) { if (renderTextures && mesh->getTexture(0) != NULL) {
if (duplicateTexCoords) { if (duplicateTexCoords) {
glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit); glActiveTexture(GL_TEXTURE0 + secondaryTexCoordUnit);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);

View File

@@ -214,11 +214,10 @@ namespace Shared {
vertices = NULL; vertices = NULL;
normals = NULL; normals = NULL;
texCoords = NULL; texCoords = NULL;
tangents = NULL;
indices = NULL; indices = NULL;
interpolationData = NULL; interpolationData = NULL;
for (int i = 0; i < meshTextureCount; ++i) { for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
textures[i] = NULL; textures[i] = NULL;
texturesOwned[i] = false; texturesOwned[i] = false;
} }
@@ -283,15 +282,13 @@ namespace Shared {
normals = NULL; normals = NULL;
delete[] texCoords; delete[] texCoords;
texCoords = NULL; texCoords = NULL;
delete[] tangents;
tangents = NULL;
delete[] indices; delete[] indices;
indices = NULL; indices = NULL;
cleanupInterpolationData(); cleanupInterpolationData();
if (textureManager != NULL) { 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) { if (texturesOwned[i] == true && textures[i] != NULL) {
//printf("Deleting Texture [%s] i = %d\n",textures[i]->getPath().c_str(),i); //printf("Deleting Texture [%s] i = %d\n",textures[i]->getPath().c_str(),i);
textureManager->endTexture(textures[i]); textureManager->endTexture(textures[i]);
@@ -457,17 +454,17 @@ namespace Shared {
//texture //texture
if (meshHeader.hasTexture && textureManager != NULL) { if (meshHeader.hasTexture && textureManager != NULL) {
texturePaths[mtDiffuse] = toLower(reinterpret_cast<char*>(meshHeader.texName)); texturePaths[0] = toLower(reinterpret_cast<char*>(meshHeader.texName));
string texPath = dir; string texPath = dir;
if (texPath != "") { if (texPath != "") {
endPathWithSlash(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()); 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<Texture2D*>(textureManager->getTexture(texPath)); textures[0] = dynamic_cast<Texture2D*>(textureManager->getTexture(texPath));
if (textures[mtDiffuse] == NULL) { if (textures[0] == NULL) {
if (fileExists(texPath) == false) { if (fileExists(texPath) == false) {
vector<string> conversionList; vector<string> conversionList;
conversionList.push_back("png"); conversionList.push_back("png");
@@ -479,15 +476,15 @@ namespace Shared {
if (fileExists(texPath) == true) { 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()); 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[0] = textureManager->newTexture2D();
textures[mtDiffuse]->load(texPath); textures[0]->load(texPath);
if (loadedFileList) { if (loadedFileList) {
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader)); (*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader));
} }
texturesOwned[mtDiffuse] = true; texturesOwned[0] = true;
textures[mtDiffuse]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy()); textures[0]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
if (deletePixMapAfterLoad == true) { if (deletePixMapAfterLoad == true) {
textures[mtDiffuse]->deletePixels(); textures[0]->deletePixels();
} }
} else { } 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()); 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<Vec3f>(normals, frameCount*vertexCount); fromEndianVecArray<Vec3f>(normals, frameCount*vertexCount);
if (textureFlags & (1 << mtDiffuse)) { if ((textureFlags & mtDiffuse) == mtDiffuse) {
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f); readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
if (readBytes != 1 && vertexCount != 0) { if (readBytes != 1 && vertexCount != 0) {
char szBuf[8096] = ""; char szBuf[8096] = "";
@@ -598,18 +595,18 @@ namespace Shared {
//texture //texture
if ((meshHeader.properties & mp3NoTexture) != mp3NoTexture && textureManager != NULL) { if ((meshHeader.properties & mp3NoTexture) != mp3NoTexture && textureManager != NULL) {
texturePaths[mtDiffuse] = toLower(reinterpret_cast<char*>(meshHeader.texName)); texturePaths[0] = toLower(reinterpret_cast<char*>(meshHeader.texName));
string texPath = dir; string texPath = dir;
if (texPath != "") { if (texPath != "") {
endPathWithSlash(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()); 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<Texture2D*>(textureManager->getTexture(texPath)); textures[0] = dynamic_cast<Texture2D*>(textureManager->getTexture(texPath));
if (textures[mtDiffuse] == NULL) { if (textures[0] == NULL) {
if (fileExists(texPath) == false) { if (fileExists(texPath) == false) {
vector<string> conversionList; vector<string> conversionList;
conversionList.push_back("png"); conversionList.push_back("png");
@@ -622,16 +619,16 @@ namespace Shared {
if (fileExists(texPath) == true) { 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()); 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[0] = textureManager->newTexture2D();
textures[mtDiffuse]->load(texPath); textures[0]->load(texPath);
if (loadedFileList) { if (loadedFileList) {
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader)); (*loadedFileList)[texPath].push_back(make_pair(sourceLoader, sourceLoader));
} }
texturesOwned[mtDiffuse] = true; texturesOwned[0] = true;
textures[mtDiffuse]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy()); textures[0]->init(textureManager->getTextureFilter(), textureManager->getMaxAnisotropy());
if (deletePixMapAfterLoad == true) { if (deletePixMapAfterLoad == true) {
textures[mtDiffuse]->deletePixels(); textures[0]->deletePixels();
} }
} else { } 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()); 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<Vec3f>(normals, frameCount*vertexCount); fromEndianVecArray<Vec3f>(normals, frameCount*vertexCount);
if (textureFlags & (1 << mtDiffuse)) { if ((textureFlags & mtDiffuse) == mtDiffuse) {
for (unsigned int i = 0; i < meshHeader.texCoordFrameCount; ++i) { for (unsigned int i = 0; i < meshHeader.texCoordFrameCount; ++i) {
readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f); readBytes = fread(texCoords, sizeof(Vec2f)*vertexCount, 1, f);
if (readBytes != 1 && vertexCount != 0) { if (readBytes != 1 && vertexCount != 0) {
@@ -800,7 +797,7 @@ namespace Shared {
//maps //maps
uint32 flag = 1; uint32 flag = 1;
for (int i = 0; i < meshTextureCount; ++i) { for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if (meshHeader.textures & flag) { if (meshHeader.textures & flag) {
uint8 cMapPath[mapPathSize + 1]; uint8 cMapPath[mapPathSize + 1];
memset(&cMapPath[0], 0, mapPathSize + 1); memset(&cMapPath[0], 0, mapPathSize + 1);
@@ -826,8 +823,7 @@ namespace Shared {
} }
mapFullPath += mapPath; mapFullPath += mapPath;
if (textureManager) { if (textureManager) {
textures[i] = loadMeshTexture(meshIndex, i, textureManager, mapFullPath, textures[i] = loadMeshTexture(meshIndex, i, textureManager, mapFullPath, meshTextureChannelCount[i], texturesOwned[i],
meshTextureChannelCount[i], texturesOwned[i],
deletePixMapAfterLoad, loadedFileList, sourceLoader, modelFile); deletePixMapAfterLoad, loadedFileList, sourceLoader, modelFile);
} }
} }
@@ -869,9 +865,9 @@ namespace Shared {
Shared::PlatformByteOrder::fromEndianTypeArray<uint32>(indices, indexCount); Shared::PlatformByteOrder::fromEndianTypeArray<uint32>(indices, indexCount);
//tangents //tangents
if (textures[mtNormal] != NULL) { /*if (textures[mtNormal] != NULL) {
computeTangents(); computeTangents();
} }*/
} }
void Mesh::save(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager, void Mesh::save(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
@@ -909,11 +905,11 @@ namespace Shared {
meshHeader.textures = textureFlags; meshHeader.textures = textureFlags;
fwrite(&meshHeader, sizeof(MeshHeader), 1, f); 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 //maps
uint32 flag = 1; uint32 flag = 1;
for (int i = 0; i < meshTextureCount; ++i) { for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if ((meshHeader.textures & flag)) { if ((meshHeader.textures & flag)) {
uint8 cMapPath[mapPathSize]; uint8 cMapPath[mapPathSize];
memset(&cMapPath[0], 0, mapPathSize); memset(&cMapPath[0], 0, mapPathSize);
@@ -1019,7 +1015,7 @@ namespace Shared {
fwrite(indices, sizeof(uint32)*indexCount, 1, f); fwrite(indices, sizeof(uint32)*indexCount, 1, f);
} }
void Mesh::computeTangents() { /*void Mesh::computeTangents() {
delete[] tangents; delete[] tangents;
try { try {
tangents = new Vec3f[vertexCount]; tangents = new Vec3f[vertexCount];
@@ -1058,14 +1054,12 @@ namespace Shared {
} }
for (unsigned int i = 0; i < vertexCount; ++i) { for (unsigned int i = 0; i < vertexCount; ++i) {
/*Vec3f binormal= normals[i].cross(tangents[i]);
tangents[i]+= binormal.cross(normals[i]);*/
tangents[i].normalize(); tangents[i].normalize();
} }
} }*/
void Mesh::deletePixels() { void Mesh::deletePixels() {
for (int i = 0; i < meshTextureCount; ++i) { for (int i = 0; i < MESH_TEXTURE_COUNT; ++i) {
if (textures[i] != NULL) { if (textures[i] != NULL) {
textures[i]->deletePixels(); textures[i]->deletePixels();
} }
@@ -1446,7 +1440,7 @@ namespace Shared {
void Mesh::copyInto(Mesh *dest, bool ignoreInterpolationData, void Mesh::copyInto(Mesh *dest, bool ignoreInterpolationData,
bool destinationOwnsTextures) { 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->textures[index] = this->textures[index];
dest->texturesOwned[index] = this->texturesOwned[index]; dest->texturesOwned[index] = this->texturesOwned[index];
dest->texturePaths[index] = this->texturePaths[index]; dest->texturePaths[index] = this->texturePaths[index];
@@ -1491,15 +1485,6 @@ namespace Shared {
memcpy(&dest->texCoords[0], &this->texCoords[0], this->vertexCount * sizeof(Vec2f)); 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) { if (dest->indices != NULL) {
delete[] dest->indices; delete[] dest->indices;
dest->indices = NULL; dest->indices = NULL;

View File

@@ -75,28 +75,32 @@
#vertexCount: number of vertices in each frame #vertexCount: number of vertices in each frame
#indexCount: number of indices in this mesh (the number of triangles is indexCount/3) #indexCount: number of indices in this mesh (the number of triangles is indexCount/3)
#diffuseColor: RGB diffuse color #diffuseColor: RGB diffuse color
#specularColor: RGB specular color (currently unused) #specularColor: RGB specular color
#specularPower: specular power (currently unused) #specularPower: specular power
##properties: property flags ##properties: property flags
#Code: #Code:
#enum MeshPropertyFlag{ #enum MeshPropertyFlag{
# mpfCustomColor= 1, # mpfCustomColor= 1,
# mpfTwoSided= 2, # 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 #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 #textures: texture flags
#Code: #Code:
#enum MeshTexture{ #enum MeshTexture{
# diffuse = 1, # mtDiffuse = 1,
# specular = 2, # mtSpecular = 2,
# normal = 4 # mtNormal = 4
#}; #};
#================================ #================================
#4. TEXTURE NAMES #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 #5. MESH DATA
#================================ #================================
@@ -179,7 +183,7 @@ class G3DMeshHeaderv3: #Read Meshheader
temp = fileID.read(struct.calcsize(self.binary_format)) temp = fileID.read(struct.calcsize(self.binary_format))
data = struct.unpack(self.binary_format,temp) data = struct.unpack(self.binary_format,temp)
self.framecount = data[0] #Framecount = Number of Animationsteps 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.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.colorframecount= data[3] #Number of Frames of Colors seems everytime to be 1
self.vertexcount= data[4] #Number of Vertices in each Frame 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.istwosided = bool(self.properties & 2)
self.noselect = bool(self.properties & 4) self.noselect = bool(self.properties & 4)
self.glow = bool(self.properties & 8) self.glow = bool(self.properties & 8)
# Get last 8 bits for teamcolor transparency. # Get last 8 bits for teamcolor transparency
# The value is inverted for compatibility with megaglest. # The value is inverted for compatibility with megaglest
self.teamcoloralpha = 255 - (self.properties >> 24) self.teamcoloralpha = 255 - (self.properties >> 24)