=== modified file 'src/mesh.cpp'
@@ -140,10 +140,6 @@
void Mesh::build_vbo()
{
-#ifdef _DEBUG
- printf("Building vbo for mesh... ");
-#endif
-
float *vertex;
float *texel;
float *normal;
@@ -187,9 +183,6 @@
delete [] vertex;
delete [] texel;
delete [] normal;
-#ifdef _DEBUG
- printf("[ Done ]\n");
-#endif
}
void
=== modified file 'src/model.cpp'
@@ -23,6 +23,7 @@
*/
#include "model.h"
#include "vec.h"
+#include "log.h"
long filelength(int f)
{
@@ -47,9 +48,6 @@
void Model::convert_to_mesh(Mesh *pMesh)
{
-#ifdef _DEBUG
- printf("Converting model to mesh... ");
-#endif
pMesh->reset();
pMesh->mVertexQty = 3 * mPolygonQty;
@@ -72,17 +70,10 @@
pMesh->mVertex[i + 1].t = mVertex[mPolygon[i / 3].mB].t;
pMesh->mVertex[i + 2].t = mVertex[mPolygon[i / 3].mC].t;
}
-
-#ifdef _DEBUG
- printf("[ Done ]\n");
-#endif
}
void Model::calculate_normals()
{
-#ifdef _DEBUG
- printf("Calculating normals for model... ");
-#endif
LibMatrix::vec3 n;
for(unsigned i = 0; i < mPolygonQty; i++)
@@ -97,10 +88,6 @@
for(unsigned i = 0; i < mVertexQty; i++)
mVertex[i].n.normalize();
-
-#ifdef _DEBUG
- printf("[ Done ]\n");
-#endif
}
void Model::center()
@@ -142,16 +129,10 @@
unsigned short l_qty;
size_t nread;
-#ifdef _DEBUG
- printf("Loading model from 3ds file... ");
-#endif
+ Log::debug("Loading model from 3ds file '%s'\n", pFileName);
- if ((l_file=fopen (pFileName, "rb"))== NULL) {
-#ifdef _DEBUG
- printf("[ Fail ]\n");
-#else
- printf("Could not open 3ds file\n");
-#endif
+ if ((l_file = fopen (pFileName, "rb")) == NULL) {
+ Log::error("Could not open 3ds file '%s'\n", pFileName);
return 0;
}
@@ -269,12 +250,10 @@
}
fclose(l_file); // Closes the file stream
-#ifdef _DEBUG
- printf("[ Success ]\n");
- printf(" Model Information\n");
- printf(" Name: %s\n", mName);
- printf(" Vertex count: %d\n", mVertexQty);
- printf(" Polygon count: %d\n", mPolygonQty);
-#endif
+ Log::debug(" Model Information\n"
+ " Name: %s\n"
+ " Vertex count: %d\n"
+ " Polygon count: %d\n",
+ mName, mVertexQty, mPolygonQty);
return 1;
}
=== modified file 'src/screen-sdl-glesv2.cpp'
@@ -24,6 +24,7 @@
#include "screen-sdl-glesv2.h"
#include "sdlgles/SDL_gles.h"
#include "options.h"
+#include "log.h"
#include <fstream>
ScreenSDLGLESv2::ScreenSDLGLESv2(int pWidth, int pHeight, int pBpp, int pFullScreen, int pFlags)
@@ -52,25 +53,23 @@
return;
}
-#ifdef _DEBUG
- {
- int buf, red, green, blue, alpha, depth;
- SDL_GLES_GetAttribute(SDL_GLES_BUFFER_SIZE, &buf);
- SDL_GLES_GetAttribute(SDL_GLES_RED_SIZE, &red);
- SDL_GLES_GetAttribute(SDL_GLES_GREEN_SIZE, &green);
- SDL_GLES_GetAttribute(SDL_GLES_BLUE_SIZE, &blue);
- SDL_GLES_GetAttribute(SDL_GLES_ALPHA_SIZE, &alpha);
- SDL_GLES_GetAttribute(SDL_GLES_DEPTH_SIZE, &depth);
- printf("EGL chosen config:\n"
- " Buffer: %d bits\n"
- " Red: %d bits\n"
- " Green: %d bits\n"
- " Blue: %d bits\n"
- " Alpha: %d bits\n"
- " Depth: %d bits\n",
- buf, red, green, blue, alpha, depth);
+ if (Options::show_debug) {
+ int buf, red, green, blue, alpha, depth;
+ SDL_GLES_GetAttribute(SDL_GLES_BUFFER_SIZE, &buf);
+ SDL_GLES_GetAttribute(SDL_GLES_RED_SIZE, &red);
+ SDL_GLES_GetAttribute(SDL_GLES_GREEN_SIZE, &green);
+ SDL_GLES_GetAttribute(SDL_GLES_BLUE_SIZE, &blue);
+ SDL_GLES_GetAttribute(SDL_GLES_ALPHA_SIZE, &alpha);
+ SDL_GLES_GetAttribute(SDL_GLES_DEPTH_SIZE, &depth);
+ Log::debug("EGL chosen config:\n"
+ " Buffer: %d bits\n"
+ " Red: %d bits\n"
+ " Green: %d bits\n"
+ " Blue: %d bits\n"
+ " Alpha: %d bits\n"
+ " Depth: %d bits\n",
+ buf, red, green, blue, alpha, depth);
}
-#endif
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepthf(1.0f);
=== modified file 'src/screen-sdl.cpp'
@@ -22,6 +22,7 @@
* Alexandros Frantzis (glmark2)
*/
#include "screen-sdl.h"
+#include "log.h"
ScreenSDL::ScreenSDL(int pWidth, int pHeight, int pBpp, int pFullScreen, int pFlags)
{
@@ -33,12 +34,9 @@
if (mFullScreen)
pFlags |= SDL_FULLSCREEN;
-#ifdef _DEBUG
- printf("Initializing Screen... ");
-#endif
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
- fprintf(stderr, "[ Fail ] - Video initialization failed: %s\n", SDL_GetError());
+ Log::error("[ Fail ] - Video initialization failed: %s\n", SDL_GetError());
return;
}
@@ -55,7 +53,7 @@
if(SDL_SetVideoMode(mWidth, mHeight, mBpp, pFlags) == 0)
{
- fprintf(stderr, "[ Fail ] - Video mode set failed: %s\n", SDL_GetError());
+ Log::error("[ Fail ] - Video mode set failed: %s\n", SDL_GetError());
return;
}
@@ -63,11 +61,6 @@
mProjection = LibMatrix::Mat4::perspective(60.0, mWidth / (float)mHeight,
1.0, 1024.0);
-
-#ifdef _DEBUG
- mProjection.print();
-#endif
-
mInitSuccess = 1;
}