![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/GL/OrderIndependentTransparency.h>
Helper class to consolidate functionality for implementing order-independent transparency of rendered geometry. More...
Helper class to consolidate functionality for implementing order-independent transparency of rendered geometry.
Instances of this class hold all OpenGL entities needed for storing a per-pixel lists of semi-transparent fragments that can be correctly blended in a second stage. Multiple actors collaborate in order to implement the functionality:
oit_addFragment()
: In the ImFusion view framework, Steps 1 and 3 will be implemented by a GlVolumeView. Step 2 is implemented by selected GlObjects. Since the hosting GlView is passed to GlObject::draw() it can access the view's OrderIndependentTransparency object in order to support order-independent transparency.
Public Member Functions | |
OrderIndependentTransparency () | |
Instantiate a new OrderIndependentTransparency instance. | |
void | reset (const vec2i &viewportSize, bool shrinkToFit=false) |
Initializes and resets all OIT data structures for the given viewport size. | |
void | setIncludeArguments (Program &program) const |
Bind all OIT data structures to the given shader so that you can use the OIT shader include. | |
void | renderBlendedFragments (const Texture &backgroundColor, const Texture &backgroundDepth) |
Render the correctly blended fragments to the currently attached framebuffer. | |
Static Public Member Functions | |
static bool | isSupported () |
Checks whether the current platform supports OIT. | |
Instantiate a new OrderIndependentTransparency instance.
std::runtime_error | if no OpenGL 4.4 is available |
void reset | ( | const vec2i & | viewportSize, |
bool | shrinkToFit = false ) |
Initializes and resets all OIT data structures for the given viewport size.
This function must be called every time at the beginning of the render loop. To avoid expensive reallocation the internal textures and buffers are only recreated if needed (i.e. viewportSize has increased compared to before). If shrinkToFit is true
memory will also be reallocated if the viewport size has decreased.
void setIncludeArguments | ( | Program & | program | ) | const |
Bind all OIT data structures to the given shader so that you can use the OIT shader include.
Render the correctly blended fragments to the currently attached framebuffer.
The pixel data stored in backgroundColor and backgroundDepth will be integrated into the scene. Their size is expected to match the viewport size passed during clear().