A constructor defined in BBMOD_Cubemap.gml
Implements BBMOD_IDestructible, BBMOD_IRenderTarget
new BBMOD_Cubemap(_resolution)
Used for capturing surrounding scene at given position into a texture.
Name | Type | Description |
---|---|---|
_resolution | Real |
A resolution of single cubemap side. Must be power of 2! |
Name | Description |
---|---|
Format | The format of created surfaces. Use one of the surface_ constants. Default value is surface_rgba8unorm . |
Position | The position of the cubemap in the world space. |
Resolution | A resolution of single cubemap side. Must be power of two. |
Sides | An array of surfaces. |
Surface | A single surface containing all cubemap sides. This can be passed as uniform to a shader for cubemapping. |
SurfaceOctahedron | A surface with the cubemap converted into an octahedral map. |
ZFar | Distance to the far clipping plane used in the cubemap's projection matrix. Defaults to 8192 . |
ZNear | Distance to the near clipping plane used in the cubemap's projection matrix. Defaults to 0.1 . |
Name | Description |
---|---|
destroy | Frees memory used by the struct. |
draw_cross | Draws a cubemap cross at given position. |
get_projection_matrix | Creates a projection matrix for the cubemap. |
get_surface | Gets a surface for given cubemap side. If the surface is corrupted, then a new one is created. |
get_view_matrix | Creates a view matrix for given cubemap side. |
prefilter_ibl | Prefilters the cubemap for use with image based lighting. |
reset_target | Resets the render target. |
set_target | Sets next cubemap side surface as the render target and sets the current view and projection matrices appropriately. |
to_octahedron | Converts the cubmap into an octahedral map. |
to_single_surface | Puts all faces of the cubemap into a single surface. |
/// @desc Create event
// Create a renderer
renderer = new BBMOD_DefaultRenderer();
// Create a cubemap
cubemap = new BBMOD_Cubemap(128);
cubemap.Position = new BBMOD_Vec3(x, y, z);
/// @desc Draw event
// Draw the scene into the cubemap
while (cubemap.set_target())
{
draw_clear(c_black);
renderer.render();
cubemap.reset_target();
}
// Draw the scene into the app. surface
renderer.render();
/// @desc Clean Up event
cubemap = cubemap.destroy();
renderer = renderer.destroy();
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.