NDEVR
API Documentation
MaterialRaster

Stores information for painting pixels at a time into a 2D texture. More...

Inheritance diagram for MaterialRaster:
[legend]
Collaboration diagram for MaterialRaster:
[legend]

Public Member Functions

 MaterialRaster (const String &image_id, const RasterInfo &raster_info)
 Constructs a MaterialRaster with a given image identifier and raster configuration.
virtual void addImageBuffer (const Buffer< uint01 > &pixels, const Vector< 2, uint04 > &size, const Matrix< fltp08 > &camera_matrix) override
 Adds an entire image buffer to the raster, mapping pixels through a camera matrix.
void addPixelInfo (const RGBColor &pixel, const Vector< 2, fltp08 > &location, uint04 weight) override
 Adds pixel color data at a normalized floating-point location with a given weight.
void addPixelInfo (const RGBColor &pixel, const Vector< 2, uint04 > &location, uint08 weight) override
 Adds pixel color data at an integer pixel location with a given weight.
void addPixelInfo (const Vector< 4, fltp04 > &pixel, const Vector< 2, fltp08 > &location, uint08 weight) override
 Adds pixel color data (as normalized floats) at a normalized location with a weight.
void addPixelInfo (const Vector< 4, fltp04 > &pixel, const Vector< 2, uint04 > &location, uint08 weight) override
 Adds pixel color data (as normalized floats) at an integer pixel location with a weight.
virtual void clearRaster ()
 Resets all accumulated color channel data and average counts to zero.
Vector< 2, uint04convertLocation (const Vector< 2, fltp08 > &location) const
 Converts a normalized [0,1] floating-point location to an integer pixel coordinate, handling wrapping around the Y and X axes for spherical-style textures.
uint04 convertToIndex (const Vector< 2, uint04 > &location) const
 Converts a 2D pixel coordinate to a linear buffer index.
StringView imageID () const override
 Returns the image identifier for this raster.
virtual void setUnsetColor (RGBColor color)
 Sets a fallback color for all pixels within the update bounds that have not received any pixel data (i.e., have zero contribution count).
virtual void updateImage () override
 Commits accumulated pixel data to the image by averaging color channels, then uploads the result to the ImageFactory.
Public Member Functions inherited from MaterialRasterBase
 MaterialRasterBase (const RasterInfo &raster_info)
 Constructs the base raster with the given raster configuration.

Static Public Member Functions

static uint04 Weight (const Vertex< 2, fltp08 > &location, fltp08 y_dist)
 Computes a pixel contribution weight based on distance from the raster center.

Protected Attributes

Buffer< uint08m_color_channel_average_count
 Total accumulated weight per pixel (divisor for averaging).
Buffer< Vector< 3, uint08 > > m_color_channels
 Accumulated weighted RGB color values per pixel (used for averaging).
String m_image_id
 The unique identifier for this raster's image resource.
Buffer< uint01m_pixels
 Raw RGBA pixel buffer (4 bytes per pixel) uploaded to the ImageFactory.
Bounds< 2, uint04m_update_bounds
 Bounding box of pixels that have been modified since the last update.
Protected Attributes inherited from MaterialRasterBase
RasterInfo m_raster_info
 The raster configuration settings.

Detailed Description

Stores information for painting pixels at a time into a 2D texture.


Definition at line 109 of file MaterialRaster.h.

Constructor & Destructor Documentation

◆ MaterialRaster()

MaterialRaster::MaterialRaster ( const String & image_id,
const RasterInfo & raster_info )
inline

Constructs a MaterialRaster with a given image identifier and raster configuration.

Allocates internal buffers and registers the image with the default ImageFactory.

Parameters
[in]image_idThe unique identifier for the raster image resource.
[in]raster_infoThe raster configuration specifying pixel size and other settings.

Definition at line 117 of file MaterialRaster.h.

References MaterialRasterBase::MaterialRasterBase(), ImageFactory::addImageUncompressed(), ImageFactory::DefaultFactory(), m_color_channel_average_count, m_color_channels, m_image_id, m_pixels, m_update_bounds, and RasterInfo::pixel_size.

Member Function Documentation

◆ addImageBuffer()

virtual void MaterialRaster::addImageBuffer ( const Buffer< uint01 > & pixels,
const Vector< 2, uint04 > & size,
const Matrix< fltp08 > & camera_matrix )
overridevirtual

Adds an entire image buffer to the raster, mapping pixels through a camera matrix.

Parameters
[in]pixelsRaw pixel data buffer.
[in]sizeWidth and height of the source image in pixels.
[in]camera_matrixThe camera projection/view matrix used to map source pixels onto the raster.

Implements MaterialRasterBase.

◆ addPixelInfo() [1/4]

void MaterialRaster::addPixelInfo ( const RGBColor & pixel,
const Vector< 2, fltp08 > & location,
uint04 weight )
inlineoverridevirtual

Adds pixel color data at a normalized floating-point location with a given weight.

Converts the location to a pixel coordinate and delegates to the integer-location overload.

Parameters
[in]pixelThe color to add.
[in]locationThe normalized [0,1] texture coordinate.
[in]weightThe contribution weight for this pixel.

Implements MaterialRasterBase.

Definition at line 219 of file MaterialRaster.h.

References addPixelInfo(), and convertLocation().

Referenced by addPixelInfo(), and addPixelInfo().

◆ addPixelInfo() [2/4]

void MaterialRaster::addPixelInfo ( const RGBColor & pixel,
const Vector< 2, uint04 > & location,
uint08 weight )
inlineoverridevirtual

Adds pixel color data at an integer pixel location with a given weight.

Accumulates weighted color values and updates the dirty bounds.

Parameters
[in]pixelThe color to add.
[in]locationThe pixel coordinate on the raster texture.
[in]weightThe contribution weight for this pixel.

Implements MaterialRasterBase.

Definition at line 232 of file MaterialRaster.h.

References Vector< t_dims, t_type >::as(), convertToIndex(), m_color_channel_average_count, m_color_channels, and m_update_bounds.

◆ addPixelInfo() [3/4]

void MaterialRaster::addPixelInfo ( const Vector< 4, fltp04 > & pixel,
const Vector< 2, fltp08 > & location,
uint08 weight )
inlineoverridevirtual

Adds pixel color data (as normalized floats) at a normalized location with a weight.

Converts the location and delegates to the integer-location overload.

Parameters
[in]pixelThe RGBA color as floats in [0,1] range.
[in]locationThe normalized [0,1] texture coordinate.
[in]weightThe contribution weight for this pixel.

Implements MaterialRasterBase.

Definition at line 249 of file MaterialRaster.h.

References addPixelInfo(), and convertLocation().

◆ addPixelInfo() [4/4]

void MaterialRaster::addPixelInfo ( const Vector< 4, fltp04 > & pixel,
const Vector< 2, uint04 > & location,
uint08 weight )
inlineoverridevirtual

Adds pixel color data (as normalized floats) at an integer pixel location with a weight.

If weight is max uint08, the pixel overwrites rather than accumulates.

Parameters
[in]pixelThe RGBA color as floats in [0,1] range.
[in]locationThe pixel coordinate on the raster texture.
[in]weightThe contribution weight. If Constant<uint08>::Max, the pixel value is set directly instead of being accumulated.

Implements MaterialRasterBase.

Definition at line 261 of file MaterialRaster.h.

References convertToIndex(), m_color_channel_average_count, m_color_channels, and m_update_bounds.

◆ convertLocation()

Vector< 2, uint04 > MaterialRaster::convertLocation ( const Vector< 2, fltp08 > & location) const

Converts a normalized [0,1] floating-point location to an integer pixel coordinate, handling wrapping around the Y and X axes for spherical-style textures.

Parameters
[in]locationThe normalized texture coordinate in [0,1] range.
Returns
The corresponding integer pixel coordinate on the raster.

Referenced by addPixelInfo(), and addPixelInfo().

◆ convertToIndex()

uint04 MaterialRaster::convertToIndex ( const Vector< 2, uint04 > & location) const
inline

Converts a 2D pixel coordinate to a linear buffer index.

Parameters
[in]locationThe 2D pixel coordinate (x, y).
Returns
The linear index into the pixel buffer.

Definition at line 209 of file MaterialRaster.h.

References MaterialRasterBase::m_raster_info.

Referenced by addPixelInfo(), addPixelInfo(), setUnsetColor(), and updateImage().

◆ imageID()

StringView MaterialRaster::imageID ( ) const
inlineoverridevirtual

Returns the image identifier for this raster.

Returns
A StringView containing the image ID.

Implements MaterialRasterBase.

Definition at line 130 of file MaterialRaster.h.

References m_image_id.

◆ setUnsetColor()

virtual void MaterialRaster::setUnsetColor ( RGBColor color)
inlinevirtual

Sets a fallback color for all pixels within the update bounds that have not received any pixel data (i.e., have zero contribution count).

Parameters
[in]colorThe fallback color to apply to unset pixels.

Definition at line 144 of file MaterialRaster.h.

References RGBColor::b_pos, convertToIndex(), RGBColor::g_pos, m_color_channel_average_count, m_pixels, m_update_bounds, and RGBColor::r_pos.

◆ Weight()

uint04 MaterialRaster::Weight ( const Vertex< 2, fltp08 > & location,
fltp08 y_dist )
inlinestatic

Computes a pixel contribution weight based on distance from the raster center.

Parameters
[in]locationThe 2D position used to compute the weight (distance from center).
[in]y_distA distance scaling factor (purpose unclear; may relate to vertical spread or sampling density).
Returns
A weight value inversely proportional to distance, clamped to at least 1.
Note
The exact meaning of y_dist is unclear from context alone; it may represent a vertical distance metric or a depth-related scaling factor.

Definition at line 188 of file MaterialRaster.h.

References cast(), getMax(), and Vector< t_dims, t_type >::magnitudeSquared().


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