Minetest 5.10.0-dev
 
Loading...
Searching...
No Matches
TextureBuffer Class Reference

Texture buffer represents a framebuffer with a multiple attached textures. More...

#include <pipeline.h>

+ Inheritance diagram for TextureBuffer:
+ Collaboration diagram for TextureBuffer:

Classes

struct  TextureDefinition
 

Public Member Functions

virtual ~TextureBuffer () override
 
void setTexture (u8 index, core::dimension2du size, const std::string &name, video::ECOLOR_FORMAT format, bool clear=false)
 Configure fixed-size texture for the specific index.
 
void setTexture (u8 index, v2f scale_factor, const std::string &name, video::ECOLOR_FORMAT format, bool clear=false)
 Configure relative-size texture for the specific index.
 
virtual u8 getTextureCount () override
 Return the number of textures in the source.
 
virtual video::ITexture * getTexture (u8 index) override
 Get a texture by index.
 
virtual void reset (PipelineContext &context) override
 
void swapTextures (u8 texture_a, u8 texture_b)
 
- Public Member Functions inherited from RenderPipelineObject
virtual ~RenderPipelineObject ()=default
 

Private Member Functions

bool ensureTexture (video::ITexture **textureSlot, const TextureDefinition &definition, PipelineContext &context)
 Make sure the texture in the given slot matches the texture definition given the current context.
 

Private Attributes

video::IVideoDriver * m_driver { nullptr }
 
std::vector< TextureDefinitionm_definitions
 
core::array< video::ITexture * > m_textures
 

Static Private Attributes

static const u8 NO_DEPTH_TEXTURE = 255
 

Detailed Description

Texture buffer represents a framebuffer with a multiple attached textures.

Note
Use of TextureBuffer requires use of gl_FragData[] in the shader

Constructor & Destructor Documentation

◆ ~TextureBuffer()

TextureBuffer::~TextureBuffer ( )
overridevirtual

References m_driver, and m_textures.

Member Function Documentation

◆ ensureTexture()

bool TextureBuffer::ensureTexture ( video::ITexture ** textureSlot,
const TextureDefinition & definition,
PipelineContext & context )
private

Make sure the texture in the given slot matches the texture definition given the current context.

Parameters
textureSlotaddress of the texture pointer to verify and populate.
definitionlogical definition of the texture
contextcurrent context of the rendering pipeline
Returns
true if a new texture was created and put into the slot
false if the slot was not modified

References TextureBuffer::TextureDefinition::clear, TextureBuffer::TextureDefinition::dirty, TextureBuffer::TextureDefinition::fixed_size, TextureBuffer::TextureDefinition::format, m_driver, TextureBuffer::TextureDefinition::name, TextureBuffer::TextureDefinition::scale_factor, TextureBuffer::TextureDefinition::size, PipelineContext::target_size, and TextureBuffer::TextureDefinition::valid.

Referenced by reset().

+ Here is the caller graph for this function:

◆ getTexture()

video::ITexture * TextureBuffer::getTexture ( u8 index)
overridevirtual

Get a texture by index.

Returns nullptr is the texture does not exist.

Implements RenderSource.

References m_textures.

Referenced by TextureBufferOutput::activate(), and InitInterlacedMaskStep::run().

+ Here is the caller graph for this function:

◆ getTextureCount()

virtual u8 TextureBuffer::getTextureCount ( )
inlineoverridevirtual

Return the number of textures in the source.

Implements RenderSource.

References m_textures.

◆ reset()

void TextureBuffer::reset ( PipelineContext & context)
overridevirtual

Reimplemented from RenderPipelineObject.

References PipelineContext::device, ensureTexture(), m_definitions, m_driver, m_textures, and RenderPipelineObject::reset().

+ Here is the call graph for this function:

◆ setTexture() [1/2]

void TextureBuffer::setTexture ( u8 index,
core::dimension2du size,
const std::string & name,
video::ECOLOR_FORMAT format,
bool clear = false )

Configure fixed-size texture for the specific index.

Parameters
indexindex of the texture
sizewidth and height of the texture in pixels
heightheight of the texture in pixels
nameunique name of the texture
formatcolor format

References m_definitions, and NO_DEPTH_TEXTURE.

Referenced by addUpscaling(), populateInterlacedPipeline(), and populateSideBySidePipeline().

+ Here is the caller graph for this function:

◆ setTexture() [2/2]

void TextureBuffer::setTexture ( u8 index,
v2f scale_factor,
const std::string & name,
video::ECOLOR_FORMAT format,
bool clear = false )

Configure relative-size texture for the specific index.

Parameters
indexindex of the texture
scale_factorrelation of the texture dimensions to the screen dimensions
nameunique name of the texture
formatcolor format

References m_definitions, and NO_DEPTH_TEXTURE.

◆ swapTextures()

void TextureBuffer::swapTextures ( u8 texture_a,
u8 texture_b )

References m_definitions, and m_textures.

Referenced by SwapTexturesStep::run().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_definitions

std::vector<TextureDefinition> TextureBuffer::m_definitions
private

◆ m_driver

video::IVideoDriver* TextureBuffer::m_driver { nullptr }
private

◆ m_textures

core::array<video::ITexture *> TextureBuffer::m_textures
private

◆ NO_DEPTH_TEXTURE

const u8 TextureBuffer::NO_DEPTH_TEXTURE = 255
staticprivate

Referenced by setTexture(), and setTexture().


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