fix loader to compat with new renderer
This commit is contained in:
parent
dac18364aa
commit
174dc59732
@ -5,7 +5,7 @@
|
|||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include "../resourcemanager.h"
|
#include "../resourcemanager.h"
|
||||||
#include <SFML/Graphics/Image.hpp>
|
#include <SFML/Graphics/Image.hpp>
|
||||||
#include <meshbuilder.h>
|
#include <mesh.h>
|
||||||
#include <phongmaterial.h>
|
#include <phongmaterial.h>
|
||||||
#include "../sparrowrenderer/src/texture.h"
|
#include "../sparrowrenderer/src/texture.h"
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
|||||||
return meshes;
|
return meshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshBuilder* currentMesh = new MeshBuilder();
|
Mesh* currentMesh = new Mesh();
|
||||||
meshes.push_back(currentMesh);
|
meshes.push_back(currentMesh);
|
||||||
currentMesh->setMaterial(currentMat);
|
currentMesh->setMaterial(currentMat);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
|||||||
std::sscanf(line.c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d",tab,tab+1,tab+2,tab+3,tab+4,tab+5,tab+6,tab+7,tab+8);
|
std::sscanf(line.c_str(),"f %d/%d/%d %d/%d/%d %d/%d/%d",tab,tab+1,tab+2,tab+3,tab+4,tab+5,tab+6,tab+7,tab+8);
|
||||||
//TODO: check sscanf success
|
//TODO: check sscanf success
|
||||||
|
|
||||||
int nb_vertices = currentMesh->positions.size();
|
int nb_vertices = currentMesh->positions3D.size();
|
||||||
|
|
||||||
currentMesh->addTriangle(nb_vertices, nb_vertices+1, nb_vertices+2);
|
currentMesh->addTriangle(nb_vertices, nb_vertices+1, nb_vertices+2);
|
||||||
for(int i=0; i<3; ++i)
|
for(int i=0; i<3; ++i)
|
||||||
@ -133,7 +133,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
|||||||
if(norm.size() == 0)
|
if(norm.size() == 0)
|
||||||
{
|
{
|
||||||
if(tex.size() == 0)
|
if(tex.size() == 0)
|
||||||
currentMesh->addPosition(pos[tab[i]-1]);
|
currentMesh->addVertex(pos[tab[i]-1]);
|
||||||
else
|
else
|
||||||
currentMesh->addVertex(pos[tab[i]-1], tex[tab[i+1]-1]);
|
currentMesh->addVertex(pos[tab[i]-1], tex[tab[i+1]-1]);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ std::vector<Mesh*> Loader::loadMesh(const std::string &filename){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
currentMesh = new MeshBuilder();
|
currentMesh = new Mesh();
|
||||||
meshes.push_back(currentMesh);
|
meshes.push_back(currentMesh);
|
||||||
currentMesh->setMaterial(currentMat);
|
currentMesh->setMaterial(currentMat);
|
||||||
break;
|
break;
|
||||||
|
@ -66,7 +66,7 @@ std::vector<GraphNode*> PathFinder::a_star(GraphNode* start, GraphNode* goal, bo
|
|||||||
return backtrack_path(start,goal,pred);
|
return backtrack_path(start,goal,pred);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<GraphNode*> PathFinder::a_star_min_max(GraphNode* start,GraphNode* goal,bool debug = false)
|
std::vector<GraphNode*> PathFinder::a_star_min_max(GraphNode* start,GraphNode* goal,bool debug)
|
||||||
{
|
{
|
||||||
std::priority_queue<GraphNode*,std::vector<GraphNode*>,ComparePriority> frontier = std::priority_queue<GraphNode*,std::vector<GraphNode*>,ComparePriority>();
|
std::priority_queue<GraphNode*,std::vector<GraphNode*>,ComparePriority> frontier = std::priority_queue<GraphNode*,std::vector<GraphNode*>,ComparePriority>();
|
||||||
std::map<GraphNode*, float> cost = std::map<GraphNode*, float>(); //cost of visited node
|
std::map<GraphNode*, float> cost = std::map<GraphNode*, float>(); //cost of visited node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user