Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created May 8, 2012 11:30
Show Gist options
  • Save WideWord/2634354 to your computer and use it in GitHub Desktop.
Save WideWord/2634354 to your computer and use it in GitHub Desktop.
#include "scene.h"
#include "gfx.h"
#include <iostream>
using namespace scene;
using namespace gfx;
using namespace math3d;
int main () {
RenderWindow* wnd = new RenderWindow(800,600,false);
Renderer* r = new Renderer(wnd);
Scene* scene = new Scene();
GameObject* obj = new GameObject(scene);
Transform* t = new Transform(obj);
t->pos.z = -5;
MeshRenderer* meshRenderer = new MeshRenderer(obj);
MeshData triangle;
triangle.verts = 3;
triangle.coor = new float[3 * 3];
triangle.nor = new float[3 * 3];
triangle.tex = new float[3 * 2];
triangle.faces = 1;
triangle.ind = new unsigned[3];
triangle.coor[0] = -1;triangle.coor[1] = 0;triangle.coor[2] = 0;
triangle.coor[3] = 1;triangle.coor[4] = 0;triangle.coor[5] = 0;
triangle.coor[6] = 0;triangle.coor[7] = 1;triangle.coor[8] = 0;
triangle.ind[0] = 0;triangle.ind[1] = 1;triangle.ind[2] = 2;
Mesh* mesh = new Mesh(triangle);
meshRenderer->meshes.push_back(mesh);
while(true) {
obj->update();
r->render();
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment