Architecture: Decoupling Renderer and Scene
I utilized the **Abstract Factory Pattern** (through the `CGrRenderer` base class) and the **Composite Pattern** (through the `CGrObject` Scene Graph) to define all geometric elements and their materials independently of the rendering method.
The Scene Graph handled hierarchical transformations (translations, rotations), ensuring that every polygon's vertices and normals were correctly transformed into **World Space** before being submitted to the ray tracing kernel. This separation was crucial for debugging and future feature expansion.
Technical Insight: The Transformation Stack
The `CMyRaytraceRenderer` maintained a transformation matrix stack, mirroring OpenGL's functionality. This stack was used within the `RendererEndPolygon()` method to apply the full composite transform to every vertex and normal, guaranteeing accurate intersection testing.