raytracer
Parallel Ray Tracer written from scratch (no graphics API).
Loading...
Searching...
No Matches
raytracer::raytracer::Cubemap Class Reference

#include <cubemap.h>

Public Member Functions

 Cubemap (const std::string &path, int face_width, int face_height, int color_channels, bool is_grayscale)
 Cubemap (common::Image _top, common::Image _left, common::Image _front, common::Image _right, common::Image _back, common::Image _bottom)
common::Vec3 get_color_at_point (const common::Vec3 &normal) const

Detailed Description

A texture made of six images, one for each face of a cube, which is sampled using a direction vector.

Constructor & Destructor Documentation

◆ Cubemap() [1/2]

raytracer::raytracer::Cubemap::Cubemap ( const std::string & path,
int face_width,
int face_height,
int color_channels,
bool is_grayscale )

Loads a cubemap from a bitmap on disk, with the faces laid out in a 4x3 cross.

Exceptions
std::runtime_errorIf the file cannot be opened or read, or if it is too small for the face dimensions.
Parameters
pathThe path to the bitmap file.
face_widthThe width of each face in pixels.
face_heightThe height of each face in pixels.
color_channelsThe number of color channels of each face.
is_grayscaleWhether the faces are grayscale (scalar color instead of RGB).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Cubemap() [2/2]

raytracer::raytracer::Cubemap::Cubemap ( common::Image _top,
common::Image _left,
common::Image _front,
common::Image _right,
common::Image _back,
common::Image _bottom )

Creates a cubemap from six existing images.

Parameters
_topThe top face.
_leftThe left face.
_frontThe front face.
_rightThe right face.
_backThe back face.
_bottomThe bottom face.
Here is the call graph for this function:

Member Function Documentation

◆ get_color_at_point()

common::Vec3 raytracer::raytracer::Cubemap::get_color_at_point ( const common::Vec3 & normal) const
nodiscard

Calculates the texture color at a point on the sphere, given the normal.

Parameters
normalThe normal to the sphere surface at that point.
Returns
A vector representing the color at that point.
Here is the call graph for this function:
Here is the caller graph for this function:

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