72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
#include "engine.h"
|
|
#include <input.h>
|
|
#include <scene.h>
|
|
#include <mesh.h>
|
|
#include <deferredpipeline.h>
|
|
#include <phongmaterial.h>
|
|
#include "resourcemanager.h"
|
|
#include "sparrowrenderer.h"
|
|
#include "scenetree.h"
|
|
|
|
#include "tools/graph.h"
|
|
#include "tools/pathfinder.h"
|
|
#include "tools/loader.h"
|
|
|
|
#include "sparrowshell.h"
|
|
|
|
int main(){
|
|
Engine engine;
|
|
|
|
// this creates the opengl context
|
|
// the opengl context must exist before any opengl class is used (texture, pipeline, etc..)
|
|
engine.createWindow("test");
|
|
SceneTree scene;
|
|
|
|
Mesh* mesh = new Mesh();
|
|
mesh->addRectangle2D(50,50,100,100);
|
|
PhongMaterial *mat = new PhongMaterial();
|
|
mat->diffuse = glm::vec3(1, 0.5, 0);
|
|
mesh->setMaterial(mat);
|
|
mesh->initGL();
|
|
|
|
SparrowShell *shell = new SparrowShell(engine.getWindow(),engine.getInput());
|
|
scene.addObject(scene.getRootObject(),shell);
|
|
|
|
// the pipeline needs to updates his shaders because the scene changed
|
|
// this should be handled somewhere else in the future
|
|
DeferredPipeline* pipeline = (DeferredPipeline*)scene.getPipeline();
|
|
pipeline->refreshScene(&scene);
|
|
|
|
engine.setScene(&scene);
|
|
engine.start();
|
|
|
|
/* GraphNode n1 = GraphNode();
|
|
n1.setValue(1);
|
|
GraphNode n2 = GraphNode();
|
|
n2.setValue(2);
|
|
GraphNode n3 = GraphNode();
|
|
n3.setValue(3);
|
|
GraphNode n4 = GraphNode();
|
|
n4.setValue(4);
|
|
GraphNode n5 = GraphNode();
|
|
n5.setValue(5);
|
|
|
|
n1.addNeighbours(&n2);
|
|
n1.addNeighbours(&n3);
|
|
n2.addNeighbours(&n4);
|
|
n3.addNeighbours(&n4);
|
|
n3.addNeighbours(&n2);
|
|
n3.addNeighbours(&n5);
|
|
|
|
std::vector<GraphNode*> path = PathFinder::a_star(&n1,&n4,true);
|
|
std::cout << "Path Size: " << path.size() << std::endl;
|
|
for(GraphNode* gn: path){
|
|
std::cout << gn->getValue() << std::endl;
|
|
}
|
|
|
|
Loader::setObjDirectory("../data/");
|
|
Loader::setMtlDirectory("../data/");
|
|
Loader::setTexDirectory("../data/");
|
|
std::vector<Mesh*> meshes = Loader::loadMesh("sword.obj");*/
|
|
}
|