ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Rasterizer Class Reference

Provides static methods for rasterizing 3D scenes into 2D camera views. More...

#include <Rasterizer.h>

Collaboration diagram for Rasterizer:

Static Public Member Functions

static void Rasterize (Scene *scene, CameraBase *camera)
 Rasterizes a 3D scene onto a 2D camera view.
 

Static Private Member Functions

static RGBColor CheckRasterPixel (Triangle2D **triangles, int numTriangles, Vector2D pixelRay)
 Determines the color of a pixel by checking which triangle it intersects.
 
static RGBColor CheckRasterPixelAccel (Triangle2D **triangles, int numTriangles, Vector2D pixelRay)
 Optimized version of CheckRasterPixel using acceleration structures.
 

Static Private Attributes

static Quaternion rayDirection
 Direction of the ray cast for rasterization.
 

Detailed Description

Provides static methods for rasterizing 3D scenes into 2D camera views.

Definition at line 27 of file Rasterizer.h.

Member Function Documentation

◆ CheckRasterPixel()

RGBColor CheckRasterPixel ( Triangle2D **  triangles,
int  numTriangles,
Vector2D  pixelRay 
)
staticprivate

Determines the color of a pixel by checking which triangle it intersects.

Parameters
trianglesArray of 2D triangles to check against.
numTrianglesNumber of triangles in the array.
pixelRayThe 2D pixel ray to test.
Returns
The color of the intersected triangle, or a default color if no intersection.

Definition at line 126 of file Rasterizer.cpp.

References Triangle2D::averageDepth, Triangle2D::GetMaterial(), Material::GetRGB(), Triangle2D::p1UV, Triangle2D::p2UV, Triangle2D::p3UV, Triangle2D::t3p1, Triangle2D::t3p3, Vector2D::X, Vector3D::X, Vector2D::Y, Vector3D::Y, and Vector3D::Z.

Referenced by Rasterize().

◆ CheckRasterPixelAccel()

RGBColor CheckRasterPixelAccel ( Triangle2D **  triangles,
int  numTriangles,
Vector2D  pixelRay 
)
staticprivate

Optimized version of CheckRasterPixel using acceleration structures.

Parameters
trianglesArray of 2D triangles to check against.
numTrianglesNumber of triangles in the array.
pixelRayThe 2D pixel ray to test.
Returns
The color of the intersected triangle, or a default color if no intersection.

Definition at line 5 of file Rasterizer.cpp.

References Triangle2D::averageDepth, Triangle2D::denominator, Triangle2D::GetMaterial(), Material::GetRGB(), Triangle2D::p1UV, Triangle2D::p1X, Triangle2D::p1Y, Triangle2D::p2UV, Triangle2D::p3UV, Triangle2D::t3p1, Triangle2D::t3p3, Triangle2D::v0X, Triangle2D::v0Y, Triangle2D::v1X, Triangle2D::v1Y, Vector2D::X, Vector3D::X, Vector2D::Y, Vector3D::Y, and Vector3D::Z.

◆ Rasterize()

Member Data Documentation

◆ rayDirection

Quaternion rayDirection
staticprivate

Direction of the ray cast for rasterization.

Definition at line 29 of file Rasterizer.h.

Referenced by Rasterize().


The documentation for this class was generated from the following files: