This is what I have been working on lately, download the source code from my github: https://github.com/V...3d-engine-casio
the matrix and vector classes in mathlib.cpp is a direct port of the euclid.py python library.
To use this in your programs you will need to first download all of the source code from my github and since I made it in C++, you will have to put extern "C" around the main function and any other C code.
e.g
extern "C"{ int AddIn_main(int isAppli, unsigned short OptionNum) { main(); return 1; } }
You will also need to put the extern C braces around any function from the fxlib library as that library was made in C.
Then include the engine.h file and you're ready to go.
#include "engine.h"
The 3d engine is object oriented so here is how to set it up:
Engine eng = Engine(); //create the engine class Camera cam = Camera(); //create the camera class Mesh meshes[20]; //create an array that will store all the meshes Mesh mesh; //creating an example mesh //here are the vertices and faces for a 3d cube mesh.vertices[0] = Vector3(-1, 1, 1); mesh.vertices[1] = Vector3(1, 1, 1); mesh.vertices[2] = Vector3(-1,-1,1); mesh.vertices[3] = Vector3(1,-1,1); mesh.vertices[4] = Vector3(-1, 1, -1); mesh.vertices[5] = Vector3(1,1,-1); mesh.vertices[6] = Vector3(1,-1,-1); mesh.vertices[7] = Vector3(-1,-1,-1); mesh.faces[0] = Face(0, 1, 2); mesh.faces[1] = Face(1, 2, 3); mesh.faces[2] = Face(1, 3, 6); mesh.faces[3] = Face(1, 5, 6); mesh.faces[4] = Face(0, 1, 4); mesh.faces[5] = Face(1, 4, 5); mesh.faces[6] = Face(2, 3, 7); mesh.faces[7] = Face(3, 6, 7); mesh.faces[8] = Face(0, 2, 7); mesh.faces[9] = Face(0, 4, 7); mesh.faces[10]= Face(4, 5, 6); mesh.faces[11]= Face(4, 6, 7); meshes[0] = mesh; //add the mesh to the meshes array while(true){ eng.clear(); //clear the screen meshes.rotation.x += 0.02; meshes.rotation.y += 0.02; //rotate cube around x and y axis meshes[0] = mesh; //update the mesh in the meshes array eng.render(cam, meshes); //render all of the meshes from the cameras point of view eng.present(); //display the pixels }
That is a simple demo program for making a rotating cube as shown above.
This is still a work in progress, I will continue to add a lot more things soon such as:
-rasterization
-different render modes
-loading .obj files and other 3d formats
-adding grayscale
and I will also be making some games using this, starting off with a simple game like bloxorz
Edited by Viliami, 03 July 2016 - 08:32 AM.