fixed valgrind error

This commit is contained in:
Lendemor 2016-06-14 18:58:49 +02:00
parent d2fe787cb1
commit cccacb047c
5 changed files with 17 additions and 26 deletions

View File

@ -1,6 +1,9 @@
project(SparrowEngine) project(SparrowEngine)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 1)
# choose source file # choose source file
file(GLOB LIB_SRC_LIST src/*.cpp src/tools/*.cpp) file(GLOB LIB_SRC_LIST src/*.cpp src/tools/*.cpp)
file(GLOB LIB_HEAD_LIST src/*.h src/tools/*.h) file(GLOB LIB_HEAD_LIST src/*.h src/tools/*.h)
@ -14,4 +17,6 @@ set(USE_INPUT True)
set(USE_BULLET True) set(USE_BULLET True)
set(SFML_MODULES audio graphics) set(SFML_MODULES audio graphics)
include(../cmaketemplate/template.cmake) set(CMAKE_TEMPLATE_PATH "../CMakeTemplate")
include(${CMAKE_TEMPLATE_PATH}/template.cmake)

View File

@ -21,7 +21,7 @@ void InputSystem::initInput(sf::Window *window){
void InputSystem::update(){ void InputSystem::update(){
int action; int action;
Message* message; Message* message;
while (action = m_input->getAction() != NO_ACTION){ while ((action = m_input->getAction()) != NO_ACTION){
message = new Message(std::to_string(action),SystemType::INPUT_SYSTEM); message = new Message(std::to_string(action),SystemType::INPUT_SYSTEM);
m_msgBus->postMessage(message); m_msgBus->postMessage(message);
} }

View File

@ -7,7 +7,7 @@
#include <SFML/Graphics/Image.hpp> #include <SFML/Graphics/Image.hpp>
#include <mesh.h> #include <mesh.h>
#include <phongmaterial.h> #include <phongmaterial.h>
#include "../sparrowrenderer/src/texture.h" #include "texture.h"
#include <iostream> #include <iostream>
@ -15,7 +15,6 @@ std::string Loader::obj_directory = "";
std::string Loader::mtl_directory = ""; std::string Loader::mtl_directory = "";
std::string Loader::tex_directory = ""; std::string Loader::tex_directory = "";
std::string* Loader::loadTextFile(const std::string &filename) std::string* Loader::loadTextFile(const std::string &filename)
{ {
std::ifstream t(filename); std::ifstream t(filename);
@ -319,17 +318,3 @@ void Loader::setMtlDirectory(std::string dir_){
void Loader::setTexDirectory(std::string dir_){ void Loader::setTexDirectory(std::string dir_){
tex_directory = dir_; tex_directory = dir_;
} }
/*
//glfinish
void temp_glfinish(){
for(std::size_t i=0; i<images.size(); ++i)
{
if(images[i]){
images[i]->initGL();
todos[i].target = images[i]->texture;
delete images[i];
}
}
}
*/

View File

@ -41,10 +41,10 @@ float Noise::PerlinNoise2D(float x, float z)
glm::vec2 grad[4]; glm::vec2 grad[4];
int idx[4]; int idx[4];
idx[0] = calculIdx2D(x0,z0); idx[0] = process2DIndex(x0,z0);
idx[1] = calculIdx2D(x1,z0); idx[1] = process2DIndex(x1,z0);
idx[2] = calculIdx2D(x0,z1); idx[2] = process2DIndex(x0,z1);
idx[3] = calculIdx2D(x1,z1); idx[3] = process2DIndex(x1,z1);
for(int i=0; i < 4; i++) for(int i=0; i < 4; i++)
grad[i] = gradient2[idx[i]]; grad[i] = gradient2[idx[i]];
@ -156,13 +156,13 @@ float Noise::OctavePerlinNoise(float nb_octave, float persistence, float x, floa
return total/maxAmplitude; return total/maxAmplitude;
} }
// NOT IMPLEMENTED
float Noise::SimplexNoise(float x, float y, float z){ float Noise::SimplexNoise(float x, float y, float z){
int x0, x1, y0, y1, z0, z1; // int x0, x1, y0, y1, z0, z1;
return 1.f; return 1.f;
} }
int Noise::calculIdx2D(int x, int z) int Noise::process2DIndex(int x, int z)
{ {
int u = x%ARBITRARY_VALUE; int u = x%ARBITRARY_VALUE;
u = u < 0 ? u + ARBITRARY_VALUE : u; u = u < 0 ? u + ARBITRARY_VALUE : u;

View File

@ -12,8 +12,9 @@ private:
static glm::vec2 gradient2[ARBITRARY_VALUE]; static glm::vec2 gradient2[ARBITRARY_VALUE];
static glm::vec3 gradient3[ARBITRARY_VALUE]; static glm::vec3 gradient3[ARBITRARY_VALUE];
static int permut[ARBITRARY_VALUE]; static int permut[ARBITRARY_VALUE];
//private function //private function
static int calculIdx2D(int x, int z); // TODO : remove french namings static int process2DIndex(int x, int z);
static int fastfloor(float v); static int fastfloor(float v);
static float lerp(float a, float b, float w); static float lerp(float a, float b, float w);