to debug : unknown segfault
This commit is contained in:
parent
5e82f3339f
commit
abde81c527
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
build*
|
build*
|
||||||
*.user
|
*.user
|
||||||
|
data/*
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#include "tools/graph.h"
|
#include "tools/graph.h"
|
||||||
#include "tools/pathfinder.h"
|
#include "tools/pathfinder.h"
|
||||||
|
#include "tools/loader.h"
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
CameraNode camera;
|
/* CameraNode camera;
|
||||||
RESOURCE_ADD(&camera, SceneNode, "camera");
|
RESOURCE_ADD(&camera, SceneNode, "camera");
|
||||||
|
|
||||||
Scene scene("testScene");
|
Scene scene("testScene");
|
||||||
@ -19,9 +20,9 @@ int main(){
|
|||||||
//engine.getRenderer()->setCamera(&camera);
|
//engine.getRenderer()->setCamera(&camera);
|
||||||
engine.createWindow("test");
|
engine.createWindow("test");
|
||||||
engine.setScene("testScene");
|
engine.setScene("testScene");
|
||||||
engine.start();
|
engine.start();*/
|
||||||
|
|
||||||
GraphNode n1 = GraphNode();
|
/* GraphNode n1 = GraphNode();
|
||||||
n1.setValue(1);
|
n1.setValue(1);
|
||||||
GraphNode n2 = GraphNode();
|
GraphNode n2 = GraphNode();
|
||||||
n2.setValue(2);
|
n2.setValue(2);
|
||||||
@ -43,5 +44,6 @@ int main(){
|
|||||||
std::cout << "Path Size: " << path.size() << std::endl;
|
std::cout << "Path Size: " << path.size() << std::endl;
|
||||||
for(GraphNode* gn: path){
|
for(GraphNode* gn: path){
|
||||||
std::cout << gn->getValue() << std::endl;
|
std::cout << gn->getValue() << std::endl;
|
||||||
}
|
}*/
|
||||||
|
std::vector<Mesh*> meshes = Loader::loadMesh("/data/Qt_workspace/sparrowengine/data/boulder.obj");
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
#include <SFML/Graphics/Image.hpp>
|
#include <SFML/Graphics/Image.hpp>
|
||||||
#include <meshbuilder.h>
|
#include <meshbuilder.h>
|
||||||
#include <phongmaterial.h>
|
#include <phongmaterial.h>
|
||||||
//#include <stdio.h>
|
|
||||||
#include "../sparrowrenderer/src/texture.h"
|
#include "../sparrowrenderer/src/texture.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
std::string* Loader::loadTextFile(const std::string &filename)
|
std::string* Loader::loadTextFile(const std::string &filename)
|
||||||
{
|
{
|
||||||
std::ifstream t(filename);
|
std::ifstream t(filename);
|
||||||
@ -48,16 +49,15 @@ Image* Loader::loadImage(const std::string &filename, bool hasAlpha)
|
|||||||
|
|
||||||
std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
||||||
std::vector<Mesh*> meshes;
|
std::vector<Mesh*> meshes;
|
||||||
//MeshLoader* loader = new MeshLoader(wavefrontFilename);
|
|
||||||
//loader->textureLoader.setTexturePath(fileInfo.absolutePath());
|
|
||||||
std::vector<glm::vec3> pos;
|
std::vector<glm::vec3> pos;
|
||||||
std::vector<glm::vec3> norm;
|
std::vector<glm::vec3> norm;
|
||||||
std::vector<glm::vec2> tex;
|
std::vector<glm::vec2> tex;
|
||||||
|
|
||||||
// char line[LINEBUFFER_LENGTH];
|
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
Material* defaultMat = RESOURCE_GET(Material, "default");
|
Material* defaultMat = RESOURCE_GET(Material, "default");
|
||||||
|
|
||||||
if(defaultMat == NULL)
|
if(defaultMat == NULL)
|
||||||
{
|
{
|
||||||
defaultMat = new PhongMaterial();
|
defaultMat = new PhongMaterial();
|
||||||
@ -150,8 +150,8 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
|||||||
break;
|
break;
|
||||||
case 'm': // mtllib
|
case 'm': // mtllib
|
||||||
{
|
{
|
||||||
std::string mat_filename;
|
char* mat_filename;
|
||||||
std::sscanf(line.c_str(),"m %s",mat_filename);
|
std::sscanf(line.c_str(),"mtllib %s",mat_filename);
|
||||||
loadMTL(mat_filename);
|
loadMTL(mat_filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -204,13 +204,15 @@ std::vector<std::string> split(const std::string &line, char sep){
|
|||||||
//load MTL
|
//load MTL
|
||||||
bool Loader::loadMTL(const std::string &filename)
|
bool Loader::loadMTL(const std::string &filename)
|
||||||
{
|
{
|
||||||
// char line[1024];
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
|
std::string foo = filename;
|
||||||
|
std::cout << foo;
|
||||||
|
|
||||||
if(!file.is_open())
|
if(!file.is_open())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "can't load %s.\n", filename.c_str());
|
std::wcout << "filename" << std::endl;
|
||||||
|
// fprintf(stderr, "can't load %s.\n", filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user