![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8FxUG0PTayOUrBszpTA_5SIcxmFBIl97PPJsg73Mvsw-sYBeF_ZBDYRYtZGRVTnuPDaxQlY3hCDWlXJ3zd1kp9B3Fe4Z7Fx94u5Bcb8YwTS49LYgfUBBBWmER7bu_xvTT6rw0G9FXAyM/s320/c_ray_tracer.png)
Basic features of SRT include the following:
- Raycasting support for multiple shapes, including spheres, 3D planar polygons, and oriented bounding boxes (OBBs)
- Support for typical 3D transformations, vector, and matrix operations. The "Projection" and "ModelView" matrices can be translated, rotated, and scaled.
- Material and lighting support, with full RGBA channels for ambient, diffuse, and specular colors. Materials also include scalar values for reflectivity and transmission (transparency). Phong illumination included by default.
- Optional support for super sampling, control over recursive depth and other parameters for scene lighting.
- Although only tested on Windows, should support all the platforms and resolutions that SDL supports.
- Typedefs and macros provide support for single or double floating point precision, and assertions which can be omitted from "release" code.
- Future releases will hopefully support multiple light sources, orthographic projections, manipulation of the matrix stack, texture mapping, and thread support.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidgk0MysDH24ah89AUWIvurDVbKVdwxE0lfH7lLCSmB_A4po7z-7EsXrk83PqqYYnvaNp2TDHR6b9Ggjfjcf2VrX4-eI5ybg8EH2NWt0rakmjA35cBe2rHgGut4goRiFmY0J5f_6v0myI/s320/c_ray_tracer3.png)
srtCreateWindow(800, 600, "SRT: SDL Ray Tracer");
srtPerspective(45.0, 800.0 / 600.0, 1.0);
-- Draw Function--
/* clear buffer */
srtClearColor3(0.05f, 0.05f, 0.05f);
srtClear();
srtBeginScene();
/* move camera 4.5 units backs */
srtMatrixMode(SRT_PROJECTION);
srtTranslate(0.0, 0.0, 4.5);
/* load identity modelview */
srtMatrixMode(SRT_MODELVIEW);
srtLoadIdentity();
/* setup a light */
srtLightAmbient4(0.065f, 0.065f, 0.065f, 0.15f);
srtLightDiffuse4(0.35, 0.35, 0.35, 0.35);
srtLightSpecular4(0.25, 0.25, 0.25, 0.85);
srtLightPosition3(-1.0, 1.1, -0.75);
/* setup a material */
srtMatAmbient4(1.0, 0.0, 0.0, 1.0);
srtMatDiffuse4(0.45, 0.45, 0.45, 0.75);
srtMatSpecular4(0.3, 0.3, 0.3, 0.35);
srtMatShininess(2.8);
srtMatReflectivity(0.45);
/* sphere: x, y, z, radius */
srtCreateSphere4(1.1, -0.85, -4.5, 0.65);
/* finish the scene */
srtEndScene();
srtPaintBuffer();
srtFlip();