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