Open 3D Engine Terrain Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#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. | |
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.
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.