Week 3
Re-organizing the ray tracing procedure of BoT
Actually, the ray tracing of BoT is a good example to follow. So I read the code again and try to dig out more information about it. Basically, there are several related functions that are needed to be called, which are universe frameworks for most primitives, during the procedure. I will follow the function calling stack and list them step by step, and it would be much helpful for my thought and designing patterns for plate mode NURBS ray tracing.
- Preparation
- rt_bot_prep(...): check if the input data is a valid BoT and create bot_specific from internal bot data structure for ray tracing.
- rt_bot_prep_pieces(...): organize a number of triangles as each piece for supporting solid 'pieces'.
--------------------------------------------------
[PROBLEM] In g_bot_include.c(about line 332), there is a condition to decide if we need to prepare solid pieces showed as follows:
if (rt_bot_minpieces > 0 && bot_ip->num_faces > rt_bot_minpieces) { ... }
As far as I know, in the implementation of pieces generation, it collects 4(defined by rt_bot_tri_per_piece or RT_DEFAULT_TRIS_PER_PIECE) faces together to generate 1 piece, so is this condition a correct representation instead of:
if ( ... && bot_ip->num_faces > rt_bot_minpieces * rt_bot_tri_per_piece) { ... }
--------------------------------------------------
- Shooting rays
- rt_bot_piece_shot(...): intersect a ray with a list of "pieces" of a BoT.
- rt_bot_masksegs(...): make segments from an array of hits depending on the mode of the BoT.