86 lines
2.4 KiB
C++
86 lines
2.4 KiB
C++
#include <XRA3D/debug.h>
|
|
#include <XRA3D/render.h>
|
|
#include <XRA3D/object.h>
|
|
#include <XRA3D/ressource.h>
|
|
#include <XRA3D/mesh.h>
|
|
#include <XRA3D/texture.h>
|
|
#include <XRA3D/scene.h>
|
|
#include <XRA3D/material.h>
|
|
#include <XRA3D/camera.h>
|
|
#include <XRA3D/event.h>
|
|
|
|
#include "event.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
Xr_Renderer::getInstance()->init(1280, 640, false, 60);
|
|
|
|
Xr_Material *material1 = new Xr_Material;
|
|
Xr_Material *material2 = new Xr_Material;
|
|
|
|
material1->attachTexture((Xr_Texture*) Xr_RessourceManager::getInstance()->get(xr_texture_type, "tex1.jpg"));
|
|
material2->attachTexture((Xr_Texture*) Xr_RessourceManager::getInstance()->get(xr_texture_type, "tex1.jpg"));
|
|
|
|
Xr_Camera *camera = new Xr_Camera;
|
|
camera->setPos(0, 2, 5);
|
|
camera->setAngle(90, 0);
|
|
|
|
myEventProfil *profil = new myEventProfil;
|
|
profil->input(camera);
|
|
Xr_EventManager::getInstance()->setProfil((Xr_EventProfil*) profil);
|
|
|
|
Xr_Scene *scene = new Xr_Scene;
|
|
scene->attachCamera(camera);
|
|
|
|
//Xr_Object* obj_list[200];
|
|
|
|
/*for(int i = 0; i < 100; i++) {
|
|
obj_list[i] = new Xr_Object;
|
|
obj_list[i]->attachMesh((Xr_Mesh*) Xr_RessourceManager::getInstance()->get(xr_mesh_type, "duck.obj"));
|
|
obj_list[i]->attachMaterial(material1);
|
|
obj_list[i]->loadToServer();
|
|
obj_list[i]->setPos(i * 2, 0, 0);
|
|
scene->addObject(obj_list[i]);
|
|
}*/
|
|
|
|
/*for(int i = 100; i < 200; i++) {
|
|
obj_list[i] = new Xr_Object;
|
|
obj_list[i]->attachMesh((Xr_Mesh*) Xr_RessourceManager::getInstance()->get(xr_mesh_type, "plan.obj"));
|
|
obj_list[i]->attachMaterial(material2);
|
|
obj_list[i]->loadToServer();
|
|
obj_list[i]->setPos(0, -3, (i - 100) * 5);
|
|
scene->addObject(obj_list[i]);
|
|
}*/
|
|
|
|
Xr_Object *object1 = new Xr_Object;
|
|
object1->attachMesh((Xr_Mesh*) Xr_RessourceManager::getInstance()->get(xr_mesh_type, "car.obj"));
|
|
object1->attachMaterial(material1);
|
|
object1->loadToServer();
|
|
|
|
/*Xr_Object *object2 = new Xr_Object;
|
|
object2->attachMesh((Xr_Mesh*) Xr_RessourceManager::getInstance()->get(xr_mesh_type, "duck.obj"));
|
|
object2->attachMaterial(material2);
|
|
object2->loadToServer();
|
|
object2->setPos(0, -3, 0);*/
|
|
|
|
scene->addObject(object1);
|
|
//scene->addObject(object2);
|
|
|
|
Xr_Renderer::getInstance()->setScene(scene);
|
|
Xr_Renderer::getInstance()->mainLoop();
|
|
|
|
delete scene;
|
|
delete camera;
|
|
/*for(int i = 0; i < 200; i++) {
|
|
delete obj_list[i];
|
|
}*/
|
|
delete object1;
|
|
//delete object2;
|
|
delete material1;
|
|
delete material2;
|
|
|
|
Xr_Renderer::quitInstance();
|
|
|
|
return 0;
|
|
}
|