252 bool backface_culling,
256 const Color &wireframe_color,
339 void shade_and_write(
int x,
int y,
float depth,
The Image — an RGBA pixel buffer with compositing and I/O operations.
glm::vec2 Vec2
2-component floating-point vector (xy).
glm::vec3 Vec3
3-component floating-point vector (xyz).
FogSpace
Coordinate space (and hence the unit) of the fog distances RenderOptions::fog_start and RenderOptions...
@ WORLD
World units: distance from the camera, measured along the camera's viewing direction.
constexpr Color TRANSPARENT_BLACK
A fully transparent black color (0, 0, 0, 0).
An RGBA color with floating-point components.
Low-level triangle rasterizer with depth buffering and lighting.
void rasterize_line(const Vec3 &screen_v0, const Color &color0, const Vec3 &screen_v1, const Color &color1, float width, bool lit, const Vec3 &normal, const Vec3 &light_direction, Image &output)
Rasterize a line segment with a screen-space width.
float ssao_radius
SSAO sample radius in pixels (default: 16).
void clear(float clear_depth=1.0f)
Clear the depth and normal buffers.
void rasterize_point(float screen_x, float screen_y, float depth, float radius, const Color &color, const Vec3 &normal, const Vec3 &light_direction, Image &output)
Rasterize a single point (filled circle) into the output image.
float fog_end
Distance where fog is fully opaque (default: 1).
Color fog_color
The fog color (what distant objects blend into).
bool fog_enabled
Enable depth fog (default: false).
FogSpace fog_space
The space (and unit) of fog_start / fog_end (default: FogSpace::WORLD).
float z_far
Far plane distance of the current projection (default: 10000.0).
float fog_depth_from_ndc(float z_ndc) const
Convert a depth-buffer value to a distance in world units.
float fog_start
Distance where fog begins (default: 0).
bool orthographic
Whether the current projection is orthographic (default: false).
void apply_ssao(Image &output, float z_near, float z_far)
Apply screen-space ambient occlusion to the output image.
int height
Output image height in pixels.
Image * active_texture
Optional texture image for textured meshes.
float ssao_intensity
SSAO darkening intensity (0.0–1.0, default: 0.8).
float ambient
Ambient light level (0.0–1.0, default: 0.3).
int width
Output image width in pixels.
void set_blend_mode(bool enabled)
Enable or disable alpha blending.
Color specular_color
Specular highlight color.
std::vector< Light > lights
Light sources for Blinn-Phong shading.
float shininess
Shininess exponent (Phong model).
void rasterize_triangle(const Vec3 &screen_v0, const Color &color0, const Vec3 &normal0, const Vec2 &uv0, const Vec3 &screen_v1, const Color &color1, const Vec3 &normal1, const Vec2 &uv1, const Vec3 &screen_v2, const Color &color2, const Vec3 &normal2, const Vec2 &uv2, bool backface_culling, bool smooth_shading, const Vec3 &light_direction, bool wireframe, const Color &wireframe_color, Image &output)
Rasterize a single triangle into the output image.
bool ssao_enabled
Enable SSAO (default: false).
float z_near
Near plane distance of the current projection (default: 0.1).
std::vector< float > z_buffer
Z-buffer (depth buffer), one float per pixel.
bool blend_mode
Enable alpha blending for transparent triangles (default: false).
float contrast
Contrast adjustment (1.0 = no change).
std::vector< Vec3 > normal_buffer
Normal buffer, one Vec3 per pixel.
int y
Top edge of the bitmap, in image pixels.
int x
Left edge of the bitmap, in image pixels.
Fundamental types used throughout the scimesh rendering engine.