Open 3D Engine Terrain Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Terrain::ImageTileBuffer Class Reference

#include <MacroMaterialImageModification.h>

Public Member Functions

 ImageTileBuffer (uint32_t imageWidth, uint32_t imageHeight, AZ::EntityId imageGradientEntityId)
 
bool Empty () const
 Returns true if we don't have any pixel modifications, false if we do.
 
AZStd::pair< AZ::Color, float > GetOriginalPixelValueAndOpacity (const PixelIndex &pixelIndex)
 
void SetModifiedPixelValue (const PixelIndex &pixelIndex, AZ::Color modifiedValue, float opacity)
 Set a modified color value for the given pixel index.
 
void ApplyChangeBuffer (bool undo)
 For undo/redo operations, apply the buffer of changes back to the terrain macro texture.
 

Detailed Description

Tracks all of the image modifications for a single continuous paint stroke. Since most modifications will only affect a small portion of an image, this buffer divides the total image space into fixed-size tiles and only creates an individual tile buffer when at least one pixel in that tile's space is modified. While painting the paint stroke, this buffer caches all of the unmodified texture values and the modifications for each modified pixel. The buffer is used to create a special "stroke layer" that accumulates opacity for each stroke, which then combines with the stroke opacity, stroke color, and blend mode to blend back into the base layer. After the paint stroke finishes, the stroke buffer ownership is handed over to the undo/redo system so that it can be used to undo/redo each individual paint stroke.

Member Function Documentation

◆ GetOriginalPixelValueAndOpacity()

AZStd::pair< AZ::Color, float > Terrain::ImageTileBuffer::GetOriginalPixelValueAndOpacity ( const PixelIndex &  pixelIndex)

Get the original color value for the given pixel index. Since we "lazy-cache" our unmodified image as tiles, create it here the first time we request a pixel from a tile.


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