A constructor defined in BBMOD_Cubemap.gml

Extends BBMOD_Class
Implements 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
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.

Inherited methods

Name Description
destroy Frees resources used by the struct from memory.
implement Implements an interface into the struct.
implements Checks whether the struct implements an interface.
is_instance Checks if the struct inherits from given class.


/// @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 the scene into the app. surface

/// @desc Clean Up event
cubemap = cubemap.destroy();
renderer = renderer.destroy();
Do you find this page helpful?

Copyright © 2023, BlueBurn. Built on May 02, 2023 using GMDoc.