Move glEnable call to main

This is where this stuff tends to go anyway.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add object names and lookup

We now have something to identify nodes in the hierarchy.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Load PNGs inverted

OpenGL's coordinate system is inverse compared to PNGs. That's why I'd had to
flip the PNG texture. It seems like the too coordinate systems are always
flipped thus, so just always load PNGs upside down. Other formats might support
multiple coordinate systems, so that's something to watch for.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Pass path to image format handlers

This makes error messages a bit clearer and libTIFF is going to want it.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add TIFF image format handler

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add new vec_expand and vec_contract utilities

These nicely bundle up my auto-array algorithm in a general-purpose way.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Rename object_add_child to object_reparent

This is shorter and more consistent with object_unparent.

Also we now check for an existing parent and remove it.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Don't forget to reassign the result when using vec_contract

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add object cursor system

This is a system of iterators for moving about a tree of objects. It should
remove some of the recursive functions we accumulated.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Multiple fragment programs for main.c

This lets us test vertex color and textures separately.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Load canopy texture

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Unparent objects as we free them in object_destroy

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Add object_foreach_pre and helper-friends

We now have a simple abstraction for pre-order object tree traversal.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make draw_queue use vec_expand where appropriate

One of many roll-your-owns that I'll be tracking down.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make camera export a normal transform matrix

This converts to camera-space, but does not transform.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Primitive lighting

This patch modifies draw queues to expose the camera's new normal transform
space to shaders. We modify the demo shaders to perform some simple lighting,
with one light source positioned at the camera.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Make interval.c use vec_expand where appropriate

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Remove last roll-your-own vec from draw_queue.c

Everything that can use vec_expand now should.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Fix lighting in texmap shader

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
Polymorph object_t

Objects previously just represented meshes, or nothing. We now allow them to
represent lights or cameras, though we don't implement those two
representations just yet. Basically this is just the plumbing commit to make
multiple object types possible.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>