Commit 18fab39c authored by Scott Duensing's avatar Scott Duensing

Colored and solid objects on IIgs are working.

parent 99de9c6b
This diff is collapsed.
......@@ -68,6 +68,9 @@ typedef struct {
j3VertexT position; // Position of object in world
j3VertexT rotation; // Rotation of object in world
j3VertexT scale; // Scale of object in world
bool positionDirty; // Did the position change?
bool rotationDirty; // Did the rotation change?
bool scaleDirty; // Did the scale change?
} j3ObjectT;
typedef struct {
......@@ -93,32 +96,38 @@ typedef struct {
#define j3ObjectMove(ob, px, py, pz) \
ob.position.x += (px); \
ob.position.y += (py); \
ob.position.z += (pz)
ob.position.z += (pz); \
ob.positionDirty = true
#define j3ObjectMoveTo(ob, px, py, pz) \
ob.position.x = (px); \
ob.position.y = (py); \
ob.position.z = (pz)
ob.position.z = (pz); \
ob.positionDirty = true
#define j3ObjectRotate(ob, px, py, pz) \
ob.rotation.x += (px); j3MathWrapBounds(ob.rotation.x, 0, 360); \
ob.rotation.y += (py); j3MathWrapBounds(ob.rotation.y, 0, 360); \
ob.rotation.z += (pz); j3MathWrapBounds(ob.rotation.z, 0, 360)
ob.rotation.z += (pz); j3MathWrapBounds(ob.rotation.z, 0, 360); \
ob.rotationDirty = true
#define j3ObjectRotateTo(ob, px, py, pz) \
ob.rotation.x = (px); j3MathWrapBounds(ob.rotation.x, 0, 360); \
ob.rotation.y = (py); j3MathWrapBounds(ob.rotation.y, 0, 360); \
ob.rotation.z = (pz); j3MathWrapBounds(ob.rotation.z, 0, 360)
ob.rotation.z = (pz); j3MathWrapBounds(ob.rotation.z, 0, 360); \
ob.rotationDirty = true
#define j3ObjectScale(ob, px, py, pz) \
ob.scale.x += (px); \
ob.scale.y += (py); \
ob.scale.z += (pz)
ob.scale.z += (pz); \
ob.scaleDirty = true
#define j3ObjectScaleTo(ob, px, py, pz) \
ob.scale.x = (px); \
ob.scale.y = (py); \
ob.scale.z = (pz)
ob.scale.z = (pz); \
ob.scaleDirty = true
// Syntatic sugar
......@@ -149,6 +158,7 @@ void _j3DrawTriangleTop(jint16 x1, jint16 y1, jint16 x2,jint16 y2, jint16 x3, ji
void _j3DrawWireframePair(j3ObjectT *o, juint16 v1, juint16 v2);
void _j3DrawWireframe(j3ObjectT *o);
void _j3ObjectReset(j3ObjectT *o);
void _j3ObjectUpdateNormalLength(j3ObjectT *object, juint16 triangle);
void _j3ObjectUpdate(j3ObjectT *o);
bool _j3UtilClipLine(jint16 *x1, jint16 *y1, jint16 *x2, jint16 *y2);
void _j3WorldFree(j3WorldT **world);
......
......@@ -87,7 +87,7 @@ int main(void) {
c = 1;
for (x=0; x<world->objectCount; x++) {
for (y=0; y<world->objects[x].triangleCount; y++) {
world->objects[x].triangles->color = c++;
world->objects[x].triangles[y].color = c++;
if (c > 15) {
c = 1;
}
......@@ -137,8 +137,15 @@ int main(void) {
j3DrawSolid(world->objects[x]);
}
c = 0;
for (x=0; x<world->objects[0].triangleCount; x++) {
if (world->objects[0].triangles[x].visible) {
c++;
}
}
printAt(font, 1, 1, "Verticies: %d", world->objects[0].vertexCount);
printAt(font, 1, 2, "Triangles: %d", world->objects[0].triangleCount);
printAt(font, 1, 2, "Triangles: %d (%d visible) ", world->objects[0].triangleCount, c);
jlDisplayPresent();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment