diff --git a/hello_cube/hello_cube.c b/hello_cube/hello_cube.c index cbad93f..0550f65 100644 --- a/hello_cube/hello_cube.c +++ b/hello_cube/hello_cube.c @@ -16,7 +16,7 @@ #include #include // Sample vector model -#include "../includes/cube.c" +#include "cube.c" #define VMODE 0 #define SCREENXRES 320 #define SCREENYRES 240 @@ -81,7 +81,7 @@ int main() { int AutoRotate=1; long t, p, OTz, Flag; // t == vertex count, p == depth cueing interpolation value, OTz == value to create Z-ordered OT, Flag == see LibOver47.pdf, p.143 POLY_G3 *poly = {0}; // pointer to a POLY_G4 - SVECTOR Rotate={ 0 }; // Rotation coordinates + SVECTOR Rotate={ 232, 232, 0, 0 }; // Rotation coordinates VECTOR Trans={ 0, 0, CENTERX * 3, 0 }; // Translation coordinates // Scaling coordinates VECTOR Scale={ ONE/2, ONE/2, ONE/2, 0 }; // ONE == 4096 @@ -124,8 +124,8 @@ int main() { TPressed = 0; } if (AutoRotate) { - Rotate.vy += 8; // Pan - Rotate.vx += 8; // Tilt + Rotate.vy += 28; // Pan + Rotate.vx += 28; // Tilt //~ Rotate.vz += 8; // Roll } // Clear the current OT diff --git a/hello_light/cube.c b/hello_light/cube.c new file mode 100644 index 0000000..12dd65c --- /dev/null +++ b/hello_light/cube.c @@ -0,0 +1,167 @@ +SVECTOR modelCube_mesh[] = { + { -128,128,128 }, + { 128,128,128 }, + { 128,128,-128 }, + { -128,128,-128 }, + { -128,-128,128 }, + { 128,-128,128 }, + { 128,-128,-128 }, + { -128,-128,-128 } +}; + +SVECTOR modelCube_normal[] = { + 2365,-2365,-2365, 0, + -2365,-2365,-2365, 0, + -2365,-2365,2365, 0, + 2365,-2365,2365, 0, + 2365,2365,-2365, 0, + -2365,2365,-2365, 0, + -2365,2365,2365, 0, + 2365,2365,2365, 0 +}; + +CVECTOR modelCube_color[] = { + 255,237,0, 0, + 255,235,0, 0, + 255,236,0, 0, + 255,2,0, 0, + 254,3,0, 0, + 255,8,0, 0, + 229,0,255, 0, + 229,0,255, 0, + 229,0,255, 0, + 5,16,250, 0, + 0,12,255, 0, + 0,12,255, 0, + 4,251,25, 0, + 0,255,26, 0, + 0,255,26, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0, + 255,237,0, 0, + 255,237,0, 0, + 255,235,0, 0, + 255,2,0, 0, + 255,6,2, 0, + 254,3,0, 0, + 229,0,255, 0, + 232,21,232, 0, + 229,0,255, 0, + 5,16,250, 0, + 2,13,253, 0, + 0,12,255, 0, + 4,251,25, 0, + 0,255,26, 0, + 0,255,26, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0 +}; + +int modelCube_index[] = { + 0,2,3, + 7,5,4, + 4,1,0, + 5,2,1, + 2,7,3, + 0,7,4, + 0,1,2, + 7,6,5, + 4,5,1, + 5,6,2, + 2,6,7, + 0,3,7 +}; + +TMESH modelCube = { + modelCube_mesh, + modelCube_normal, + 0, + modelCube_color, + 12 +}; + +SVECTOR modelCube1_mesh[] = { + { -128,128,128 }, + { 128,128,128 }, + { 128,128,-128 }, + { -128,128,-128 }, + { -128,-128,128 }, + { 128,-128,128 }, + { 128,-128,-128 }, + { -128,-128,-128 } +}; + +SVECTOR modelCube1_normal[] = { + 2365,-2365,-2365, 0, + -2365,-2365,-2365, 0, + -2365,-2365,2365, 0, + 2365,-2365,2365, 0, + 2365,2365,-2365, 0, + -2365,2365,-2365, 0, + -2365,2365,2365, 0, + 2365,2365,2365, 0 +}; + +CVECTOR modelCube1_color[] = { + 255,237,0, 0, + 255,235,0, 0, + 255,236,0, 0, + 255,2,0, 0, + 254,3,0, 0, + 255,8,0, 0, + 229,0,255, 0, + 229,0,255, 0, + 229,0,255, 0, + 5,16,250, 0, + 0,12,255, 0, + 0,12,255, 0, + 4,251,25, 0, + 0,255,26, 0, + 0,255,26, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0, + 255,237,0, 0, + 255,237,0, 0, + 255,235,0, 0, + 255,2,0, 0, + 255,6,2, 0, + 254,3,0, 0, + 229,0,255, 0, + 232,21,232, 0, + 229,0,255, 0, + 5,16,250, 0, + 2,13,253, 0, + 0,12,255, 0, + 4,251,25, 0, + 0,255,26, 0, + 0,255,26, 0, + 0,248,255, 0, + 0,248,255, 0, + 0,248,255, 0 +}; + +int modelCube1_index[] = { + 0,2,3, + 7,5,4, + 4,1,0, + 5,2,1, + 2,7,3, + 0,7,4, + 0,1,2, + 7,6,5, + 4,5,1, + 5,6,2, + 2,6,7, + 0,3,7 +}; + +TMESH modelCube1 = { + modelCube1_mesh, + modelCube1_normal, + 0, + modelCube1_color, + 12 +}; diff --git a/hello_light/hello_light.c b/hello_light/hello_light.c index 896b927..f25e995 100644 --- a/hello_light/hello_light.c +++ b/hello_light/hello_light.c @@ -16,7 +16,7 @@ #include #include // Sample vector model -#include "../includes/cube.c" +#include "cube.c" #define VMODE 0 #define SCREENXRES 320 @@ -201,7 +201,7 @@ int main() { t+=3; } // Find and apply light rotation matrix - //~ // Find rotmat from light angles + // Find rotmat from light angles RotMatrix_gte(&lgtang, &rotlgt); // Find rotmat from cube angles RotMatrix_gte(&Rotate, &rotcube);