forked from Mirrorlandia_minetest/minetest
Clear exposure compensation state textures on creation (#13151)
This commit is contained in:
parent
cf5add1472
commit
6f5703baf1
@ -40,7 +40,7 @@ video::ITexture *TextureBuffer::getTexture(u8 index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextureBuffer::setTexture(u8 index, core::dimension2du size, const std::string &name, video::ECOLOR_FORMAT format)
|
void TextureBuffer::setTexture(u8 index, core::dimension2du size, const std::string &name, video::ECOLOR_FORMAT format, bool clear)
|
||||||
{
|
{
|
||||||
assert(index != NO_DEPTH_TEXTURE);
|
assert(index != NO_DEPTH_TEXTURE);
|
||||||
|
|
||||||
@ -54,9 +54,10 @@ void TextureBuffer::setTexture(u8 index, core::dimension2du size, const std::str
|
|||||||
definition.size = size;
|
definition.size = size;
|
||||||
definition.name = name;
|
definition.name = name;
|
||||||
definition.format = format;
|
definition.format = format;
|
||||||
|
definition.clear = clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureBuffer::setTexture(u8 index, v2f scale_factor, const std::string &name, video::ECOLOR_FORMAT format)
|
void TextureBuffer::setTexture(u8 index, v2f scale_factor, const std::string &name, video::ECOLOR_FORMAT format, bool clear)
|
||||||
{
|
{
|
||||||
assert(index != NO_DEPTH_TEXTURE);
|
assert(index != NO_DEPTH_TEXTURE);
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ void TextureBuffer::setTexture(u8 index, v2f scale_factor, const std::string &na
|
|||||||
definition.scale_factor = scale_factor;
|
definition.scale_factor = scale_factor;
|
||||||
definition.name = name;
|
definition.name = name;
|
||||||
definition.format = format;
|
definition.format = format;
|
||||||
|
definition.clear = clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureBuffer::reset(PipelineContext &context)
|
void TextureBuffer::reset(PipelineContext &context)
|
||||||
@ -135,10 +137,20 @@ bool TextureBuffer::ensureTexture(video::ITexture **texture, const TextureDefini
|
|||||||
if (*texture)
|
if (*texture)
|
||||||
m_driver->removeTexture(*texture);
|
m_driver->removeTexture(*texture);
|
||||||
|
|
||||||
if (definition.valid)
|
if (definition.valid) {
|
||||||
*texture = m_driver->addRenderTargetTexture(size, definition.name.c_str(), definition.format);
|
if (definition.clear) {
|
||||||
else
|
video::IImage *image = m_driver->createImage(definition.format, size);
|
||||||
|
image->fill(0u);
|
||||||
|
*texture = m_driver->addTexture(definition.name.c_str(), image);
|
||||||
|
image->drop();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*texture = m_driver->addRenderTargetTexture(size, definition.name.c_str(), definition.format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
*texture = nullptr;
|
*texture = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
* @param name unique name of the texture
|
* @param name unique name of the texture
|
||||||
* @param format color format
|
* @param format color format
|
||||||
*/
|
*/
|
||||||
void setTexture(u8 index, core::dimension2du size, const std::string& name, video::ECOLOR_FORMAT format);
|
void setTexture(u8 index, core::dimension2du size, const std::string& name, video::ECOLOR_FORMAT format, bool clear = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure relative-size texture for the specific index
|
* Configure relative-size texture for the specific index
|
||||||
@ -136,7 +136,7 @@ public:
|
|||||||
* @param name unique name of the texture
|
* @param name unique name of the texture
|
||||||
* @param format color format
|
* @param format color format
|
||||||
*/
|
*/
|
||||||
void setTexture(u8 index, v2f scale_factor, const std::string& name, video::ECOLOR_FORMAT format);
|
void setTexture(u8 index, v2f scale_factor, const std::string& name, video::ECOLOR_FORMAT format, bool clear = false);
|
||||||
|
|
||||||
virtual u8 getTextureCount() override { return m_textures.size(); }
|
virtual u8 getTextureCount() override { return m_textures.size(); }
|
||||||
virtual video::ITexture *getTexture(u8 index) override;
|
virtual video::ITexture *getTexture(u8 index) override;
|
||||||
@ -150,6 +150,7 @@ private:
|
|||||||
bool valid { false };
|
bool valid { false };
|
||||||
bool fixed_size { false };
|
bool fixed_size { false };
|
||||||
bool dirty { false };
|
bool dirty { false };
|
||||||
|
bool clear { false };
|
||||||
v2f scale_factor;
|
v2f scale_factor;
|
||||||
core::dimension2du size;
|
core::dimension2du size;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -121,8 +121,8 @@ RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep
|
|||||||
static const u8 TEXTURE_BLOOM_UP = 20;
|
static const u8 TEXTURE_BLOOM_UP = 20;
|
||||||
|
|
||||||
buffer->setTexture(TEXTURE_COLOR, scale, "3d_render", color_format);
|
buffer->setTexture(TEXTURE_COLOR, scale, "3d_render", color_format);
|
||||||
buffer->setTexture(TEXTURE_EXPOSURE_1, core::dimension2du(1,1), "exposure_1", color_format);
|
buffer->setTexture(TEXTURE_EXPOSURE_1, core::dimension2du(1,1), "exposure_1", color_format, /*clear:*/ true);
|
||||||
buffer->setTexture(TEXTURE_EXPOSURE_2, core::dimension2du(1,1), "exposure_2", color_format);
|
buffer->setTexture(TEXTURE_EXPOSURE_2, core::dimension2du(1,1), "exposure_2", color_format, /*clear:*/ true);
|
||||||
buffer->setTexture(TEXTURE_DEPTH, scale, "3d_depthmap", depth_format);
|
buffer->setTexture(TEXTURE_DEPTH, scale, "3d_depthmap", depth_format);
|
||||||
|
|
||||||
// attach buffer to the previous step
|
// attach buffer to the previous step
|
||||||
|
Loading…
Reference in New Issue
Block a user