This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="jsKart.js"></script> | |
| </head> | |
| <body onload="Init()"> | |
| <center> | |
| <canvas id="screen" width="640" height="480" style="border:solid 1px;"></canvas><br> | |
| <canvas id="track" width="1448" height="1448" style="display: none;"></canvas><br> | |
| </center> | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FF = front face (relative to split plane) | |
| BF = back face (also rtsp) | |
| bad split face = face given to split face function was already bad | |
| bad split faces = generated faces are bad (this log ommits bad faces created from a face already bad) | |
| in DZZD, ZDDZ, etc: D = default, Z = zero, M = minus, P = plus | |
| Default = vertex added was not intersection | |
| Zero = vertex was not considered too close to either end of edge | |
| Minus = vertex was too close to point A of edge | |
| Plus = vertex was too close to point B of edge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void rvface_fromsplitbox(const mplane *plane, const vec3 *min, const vec3 *max, rvface *out) | |
| { | |
| int i; | |
| out->num_verts = 0; | |
| for(i = 0; i < 8; i++){ | |
| //Calc an edge parallel to either X axis or Y axis | |
| vec3 a = { | |
| (i & 3) ? min->x : (i & 1) ? min->x : max->x, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void rvface_boxslice(const mplane *plane, const vec3 *min, const vec3 *max, rvface *out) | |
| { | |
| int potato[256] = {0}; | |
| int i, j, k, l; | |
| int potato2[256] = {0}; | |
| /* | |
| Bitfield representing planes on which each edge lies | |
| +Z-Z+Y-Y+X-X | |
| b5b4b3b2b1b0 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Basic plane equation | |
| P . n + d = 0 | |
| //Therefore, 3 plane equations | |
| X * n1x + Y * n1y + Z * n1z + d1 = 0 | |
| X * n2x + Y * n2y + Z * n2z + d2 = 0 | |
| X * n3x + Y * n3y + Z * n3z + d3 = 0 | |
| //Isolate X in 1st eq | |
| Y * n1y + Z * n1z + d1 = -X * n1x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This function works in the following manner: | |
| -Find any 4 planes with which splitting plane is not parallel | |
| -Always generate a quad with those 4 planes as sides | |
| -Split quad using rvface_split and all other planes | |
| */ | |
| void rvface_boxslice(const mplane *plane, const vec3 *min, const vec3 *max, rvface *out) | |
| { | |
| //Planes for the box | |
| //Note max_planes don't point inside the box |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <allegro.h> | |
| #include <stdio.h> | |
| int main(int argc, char ** argv) | |
| { | |
| char lin[1024] = "v 0.123 0.456 -0.789"; | |
| float x, y, z; | |
| allegro_init(); | |
| if(argc > 1) install_keyboard(); | |
| sscanf(lin, "%*s %f %f %f", &x, &y, &z); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Generic dynamic array implementation | |
| Usage example: | |
| foo_arr.h | |
| 001 #ifndef FOO_ARR_H | |
| 002 #define FOO_ARR_H | |
| 003 #define ARR_STRUCT_NAME foo_arr | |
| 004 #define ARR_TYPE foo | |
| 005 #define ARR_ADD_PREFIX(t) foo_arr_ ## t | |
| 006 #include "arr.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <allegro.h> | |
| #include <math.h> | |
| #include <stdio.h> | |
| #include "raster.h" | |
| /* | |
| Illustration of the two subtriangles | |
| -verts[0] -vs[0]=ve[0] |