mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 21:33:59 +02:00
- updated line endings to unix style characters to fix Bug #3085838
This commit is contained in:
12
mk/linux/formatTextFiles.sh
Executable file
12
mk/linux/formatTextFiles.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd ../../
|
||||
find -name "*\.cpp" -exec fromdos -d {} \;
|
||||
find -name "*\.c" -exec fromdos -d {} \;
|
||||
find -name "*\.h" -exec fromdos -d {} \;
|
||||
find -name "*\.txt" -exec fromdos -d {} \;
|
||||
find -name "*\.lng" -exec fromdos -d {} \;
|
||||
find -name "*\.xml" -exec fromdos -d {} \;
|
||||
find -name "*\.ini" -exec fromdos -d {} \;
|
||||
find -name "*\.sh" -exec fromdos -d {} \;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@
|
||||
<Option type="3" />
|
||||
<Option compiler="mingw32_compiler" />
|
||||
<Option createDefFile="1" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
<Add option="-D_WIN32" />
|
||||
@@ -121,6 +122,7 @@
|
||||
<Option type="3" />
|
||||
<Option compiler="mingw32_compiler" />
|
||||
<Option createDefFile="1" />
|
||||
<Option createStaticLib="1" />
|
||||
<Compiler>
|
||||
<Add option="-D_WIN32" />
|
||||
<Add option="-DWIN32" />
|
||||
@@ -476,6 +478,8 @@
|
||||
</Unit>
|
||||
<Unit filename="../../source/shared_lib/include/platform/sdl/window.h" />
|
||||
<Unit filename="../../source/shared_lib/include/platform/sdl/window_gl.h" />
|
||||
<Unit filename="../../source/shared_lib/include/sound/openal/sound_factory_openal.h" />
|
||||
<Unit filename="../../source/shared_lib/include/sound/openal/sound_player_openal.h" />
|
||||
<Unit filename="../../source/shared_lib/include/sound/sound.h" />
|
||||
<Unit filename="../../source/shared_lib/include/sound/sound_factory.h" />
|
||||
<Unit filename="../../source/shared_lib/include/sound/sound_file_loader.h" />
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1670,6 +1670,16 @@ void Renderer::renderMessageBox(const GraphicMessageBox *messageBox) {
|
||||
|
||||
// ==================== complex rendering ====================
|
||||
|
||||
class SurfaceData {
|
||||
public:
|
||||
SurfaceData(){};
|
||||
int textureHandle;
|
||||
vector<Vec2f> texCoords;
|
||||
vector<Vec2f> texCoordsSurface;
|
||||
vector<Vec3f> vertices;
|
||||
vector<Vec3f> normals;
|
||||
};
|
||||
|
||||
void Renderer::renderSurface(const int renderFps) {
|
||||
IF_DEBUG_EDITION(
|
||||
if (getDebugRenderer().willRenderSurface()) {
|
||||
@@ -1721,6 +1731,10 @@ void Renderer::renderSurface(const int renderFps) {
|
||||
|
||||
VisibleQuadContainerCache &qCache = getQuadCache();
|
||||
if(qCache.visibleScaledCellList.size() > 0) {
|
||||
|
||||
bool legacyRendering = true;
|
||||
|
||||
if(legacyRendering) {
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
@@ -1784,6 +1798,178 @@ void Renderer::renderSurface(const int renderFps) {
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::vector<SurfaceData> surface;
|
||||
for(int visibleIndex = 0;
|
||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||
|
||||
SurfaceCell *tc00= map->getSurfaceCell(pos.x, pos.y);
|
||||
SurfaceCell *tc10= map->getSurfaceCell(pos.x+1, pos.y);
|
||||
SurfaceCell *tc01= map->getSurfaceCell(pos.x, pos.y+1);
|
||||
SurfaceCell *tc11= map->getSurfaceCell(pos.x+1, pos.y+1);
|
||||
|
||||
if(tc00 == NULL) {
|
||||
throw runtime_error("tc00 == NULL");
|
||||
}
|
||||
if(tc10 == NULL) {
|
||||
throw runtime_error("tc10 == NULL");
|
||||
}
|
||||
if(tc01 == NULL) {
|
||||
throw runtime_error("tc01 == NULL");
|
||||
}
|
||||
if(tc11 == NULL) {
|
||||
throw runtime_error("tc11 == NULL");
|
||||
}
|
||||
|
||||
triangleCount+= 2;
|
||||
pointCount+= 4;
|
||||
|
||||
//set texture
|
||||
if(tc00->getSurfaceTexture() == NULL) {
|
||||
throw runtime_error("tc00->getSurfaceTexture() == NULL");
|
||||
}
|
||||
currTex= static_cast<const Texture2DGl*>(tc00->getSurfaceTexture())->getHandle();
|
||||
|
||||
int surfaceDataIndex = -1;
|
||||
for(int i = 0; i < surface.size(); ++i) {
|
||||
SurfaceData &data = surface[i];
|
||||
if(data.textureHandle == currTex) {
|
||||
surfaceDataIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(surfaceDataIndex < 0) {
|
||||
SurfaceData newData;
|
||||
newData.textureHandle = currTex;
|
||||
surface.push_back(newData);
|
||||
|
||||
surfaceDataIndex = surface.size()-1;
|
||||
}
|
||||
|
||||
const Vec2f &surfCoord= tc00->getSurfTexCoord();
|
||||
|
||||
//int dataIndex = surface[surfaceDataIndex].texCoords.size();
|
||||
surface[surfaceDataIndex].texCoords.push_back(tc01->getFowTexCoord());
|
||||
surface[surfaceDataIndex].texCoordsSurface.push_back(Vec2f(surfCoord.x, surfCoord.y + coordStep));
|
||||
surface[surfaceDataIndex].vertices.push_back(tc01->getVertex());
|
||||
surface[surfaceDataIndex].normals.push_back(tc01->getNormal());
|
||||
|
||||
surface[surfaceDataIndex].texCoords.push_back(tc00->getFowTexCoord());
|
||||
surface[surfaceDataIndex].texCoordsSurface.push_back(Vec2f(surfCoord.x, surfCoord.y));
|
||||
surface[surfaceDataIndex].vertices.push_back(tc00->getVertex());
|
||||
surface[surfaceDataIndex].normals.push_back(tc00->getNormal());
|
||||
|
||||
surface[surfaceDataIndex].texCoords.push_back(tc11->getFowTexCoord());
|
||||
surface[surfaceDataIndex].texCoordsSurface.push_back(Vec2f(surfCoord.x+coordStep, surfCoord.y+coordStep));
|
||||
surface[surfaceDataIndex].vertices.push_back(tc11->getVertex());
|
||||
surface[surfaceDataIndex].normals.push_back(tc11->getNormal());
|
||||
|
||||
surface[surfaceDataIndex].texCoords.push_back(tc10->getFowTexCoord());
|
||||
surface[surfaceDataIndex].texCoordsSurface.push_back(Vec2f(surfCoord.x+coordStep, surfCoord.y));
|
||||
surface[surfaceDataIndex].vertices.push_back(tc10->getVertex());
|
||||
surface[surfaceDataIndex].normals.push_back(tc10->getNormal());
|
||||
}
|
||||
|
||||
for(int i = 0; i < surface.size(); ++i) {
|
||||
//for(int i = surface.size()-1; i >= 0; --i) {
|
||||
SurfaceData &data = surface[i];
|
||||
|
||||
//Vec2f *texCoords = &data.texCoords[0];
|
||||
//Vec2f *texCoordsSurface = &data.texCoordsSurface[0];
|
||||
//Vec3f *vertices = &data.vertices[0];
|
||||
//Vec3f *normals = &data.normals[0];
|
||||
|
||||
Vec2f *texCoords = new Vec2f[data.texCoords.size()];
|
||||
Vec2f *texCoordsSurface = new Vec2f[data.texCoordsSurface.size()];
|
||||
Vec3f *vertices = new Vec3f[data.vertices.size()];
|
||||
Vec3f *normals = new Vec3f[data.normals.size()];
|
||||
for(int j = 0; j < data.texCoords.size(); ++j) {
|
||||
texCoords[j] = data.texCoords[j];
|
||||
texCoordsSurface[j] = data.texCoordsSurface[j];
|
||||
vertices[j] = data.vertices[j];
|
||||
normals[j] = data.normals[j];
|
||||
}
|
||||
//memcpy( texCoords, &data.texCoords[0], sizeof( Vec2f ) * data.texCoords.size() );
|
||||
//memcpy( texCoordsSurface, &data.texCoordsSurface[0], sizeof( Vec2f ) * data.texCoordsSurface.size() );
|
||||
//memcpy( vertices, &data.vertices[0], sizeof( Vec3f ) * data.vertices.size() );
|
||||
//memcpy( normals, &data.normals[0], sizeof( Vec3f ) * data.normals.size() );
|
||||
|
||||
|
||||
assertGl();
|
||||
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
|
||||
assertGl();
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
assertGl();
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
assertGl();
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
assertGl();
|
||||
|
||||
//glActiveTexture(baseTexUnit);
|
||||
|
||||
//glBindTexture(GL_TEXTURE_2D, fowTexUnit);
|
||||
//glActiveTexture(GL_TEXTURE0 + 1);
|
||||
|
||||
// glActiveTexture(fowTexUnit);
|
||||
// assertGl();
|
||||
// glEnable(GL_TEXTURE_2D);
|
||||
// assertGl();
|
||||
// glBindTexture(GL_TEXTURE_2D, static_cast<const Texture2DGl*>(fowTex)->getHandle());
|
||||
// assertGl();
|
||||
// glClientActiveTexture(fowTexUnit);
|
||||
// assertGl();
|
||||
// glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
// assertGl();
|
||||
// glTexCoordPointer(2, GL_FLOAT, 0,texCoords);
|
||||
// assertGl();
|
||||
|
||||
glActiveTexture(baseTexUnit);
|
||||
assertGl();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
assertGl();
|
||||
glBindTexture(GL_TEXTURE_2D, data.textureHandle);
|
||||
assertGl();
|
||||
glClientActiveTexture(baseTexUnit);
|
||||
assertGl();
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
assertGl();
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, texCoordsSurface);
|
||||
assertGl();
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
assertGl();
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices);
|
||||
assertGl();
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
assertGl();
|
||||
glNormalPointer(GL_FLOAT, 0, normals);
|
||||
assertGl();
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, data.vertices.size());
|
||||
assertGl();
|
||||
|
||||
// glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
// assertGl();
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
assertGl();
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
assertGl();
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
assertGl();
|
||||
|
||||
//glPopAttrib();
|
||||
assertGl();
|
||||
glPopClientAttrib();
|
||||
assertGl();
|
||||
|
||||
delete [] texCoords; texCoords = NULL;
|
||||
delete [] texCoordsSurface; texCoordsSurface = NULL;
|
||||
delete [] vertices; vertices = NULL;
|
||||
delete [] normals; normals = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Restore
|
||||
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(false);
|
||||
|
Reference in New Issue
Block a user