I've been struggling with implementing a couple things that relate to SGL. All of my attempts to play with said things have not gone well. Any help would be appreciated.
Back-Face CullingFirst, I've had a short conversation on my Youtube channel with XL2 about back-face culling. If I understand correctly, I have to implement this on a quad by quad basis. My confusion is to how, since the documentation doesn't paint much of a picture on how to play with SGL. I am loading an object like so:
jo_vertice metal_crate_1_v[] = JO_3D_CUBE_VERTICES(32);
jo_3d_quad metal_crate_1_q[6];
int metal_crate_1_nq;
// Load Texture
jo_sprite_add_tga(JO_ROOT_DIR, "BOX.TGA", JO_COLOR_Transparent);
// Write textures
jo_3d_create_cube(metal_crate_1_q, metal_crate_1_v);
metal_crate_1_nq = 6;
for (int i = 0; i < metal_crate_1_nq; ++i)
{
jo_3d_set_texture(&metal_crate_1_q[i], 0);
}
Drawing it:
// Perform matrix manipulations and draw
jo_3d_push_matrix();
{
jo_3d_translate_matrix(x, y, z);
jo_3d_rotate_matrix(rx, ry, rz);
jo_3d_draw_array(quads, num_quad);
}
// Restore default matrix
jo_3d_pop_matrix()
If I understand correctly, the flag is an attribute under pdata. Should I be writing this line while writing textures for every quad I want culled? (excuse the bad C, I don't quite know what I'm doing):
quad->data->attbl->flag = 0;
Camera ClippingSecond, I've just encountered some trouble while implementing collision. It appears that quads just in front of the camera's position do not get rendered. Is there a way to change the camera's drawing plane (i.e. move the projection surface closer to the camera's position?) I believe this is controlled by a property called ScreenDist in SGL, but I am unsure where to implement said change.