Skip to content

Commit

Permalink
Updated BBMOD to 3.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kraifpatrik committed Apr 16, 2024
1 parent f2a490b commit 93a37a7
Show file tree
Hide file tree
Showing 51 changed files with 417 additions and 392 deletions.
461 changes: 231 additions & 230 deletions BBMOD-Zombie-Demo.resource_order

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion BBMOD-Zombie-Demo.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/BBMOD_CameraHTML5/BBMOD_CameraHTML5.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/amazonfire/options_amazonfire.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/android/options_android.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/html5/options_html5.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/ios/options_ios.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/linux/options_linux.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/mac/options_mac.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/operagx/options_operagx.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/tvos/options_tvos.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options/windows/options_windows.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

209 changes: 109 additions & 100 deletions scripts/BBMOD_BaseRenderer/BBMOD_BaseRenderer.gml
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ function BBMOD_BaseRenderer() constructor
/// blurred. Defaults to 2.
SSAOBlurDepthRange = 2.0;

/// @var {Id.Camera}
/// @private
__camera2D = camera_create();

/// @var {Id.Camera}
/// @private
__camera2D = camera_create();

/// @func get_width()
///
/// @desc Retrieves the width of the renderer on the screen.
Expand Down Expand Up @@ -805,8 +805,8 @@ function BBMOD_BaseRenderer() constructor
///
/// @desc Renders gizmo and instance IDs into dedicated surfaces.
///
/// @param {Bool} _hdr Whether HDR rendering is enabled.
///
/// @param {Bool} _hdr Whether HDR rendering is enabled.
///
/// @private
static __render_gizmo_and_instance_ids = function (_hdr)
{
Expand Down Expand Up @@ -922,28 +922,28 @@ function BBMOD_BaseRenderer() constructor
// Gizmo
bbmod_render_pass_set(BBMOD_ERenderPass.Forward);

__surGizmo = bbmod_surface_check(__surGizmo, _renderWidth, _renderHeight,
__surGizmo = bbmod_surface_check(__surGizmo, _renderWidth, _renderHeight,
_hdr ? surface_rgba16float : surface_rgba8unorm, true);


surface_set_target(__surGizmo);
draw_clear_alpha(0, 0.0);
matrix_set(matrix_view, _view);
matrix_set(matrix_projection, _projection);

var _hdrPrev = bbmod_shader_get_global(BBMOD_U_HDR);
bbmod_shader_set_global_f(BBMOD_U_HDR, _hdr ? 1.0 : 0.0);


var _hdrPrev = bbmod_shader_get_global(BBMOD_U_HDR);
bbmod_shader_set_global_f(BBMOD_U_HDR, _hdr ? 1.0 : 0.0);

Gizmo.submit();

if (_hdrPrev != undefined)
{
bbmod_shader_set_global_f(BBMOD_U_HDR, _hdrPrev);
}
else
{
bbmod_shader_unset_global(BBMOD_U_HDR);
}


if (_hdrPrev != undefined)
{
bbmod_shader_set_global_f(BBMOD_U_HDR, _hdrPrev);
}
else
{
bbmod_shader_unset_global(BBMOD_U_HDR);
}

bbmod_material_reset();
surface_reset_target();
}
Expand All @@ -954,62 +954,62 @@ function BBMOD_BaseRenderer() constructor
}
};

/// @private
static __overlay_gizmo_and_instance_highlight = function ()
{
if (!EditMode || !Gizmo || ds_list_empty(Gizmo.Selected))
{
return;
}

gpu_push_state();
gpu_set_blendenable(true);

var _world = matrix_get(matrix_world);
var _view = matrix_get(matrix_view);
var _projection = matrix_get(matrix_projection);
var _width = get_render_width();
var _height = get_render_height();
var _texelWidth = 1.0 / _width;
var _texelHeight = 1.0 / _height;

camera_set_view_size(__camera2D, _width, _height);
camera_apply(__camera2D);

////////////////////////////////////////////////////////////////
// Highlighted instances
if (!ds_list_empty(Gizmo.Selected)
&& surface_exists(__surInstanceHighlight))
{
var _shader = BBMOD_ShInstanceHighlight;
shader_set(_shader);
bbmod_shader_set_globals(_shader);
shader_set_uniform_f(shader_get_uniform(_shader, "u_vTexel"),
_texelWidth, _texelHeight);
shader_set_uniform_f(shader_get_uniform(_shader, "u_vColor"),
InstanceHighlightColor.Red / 255.0,
InstanceHighlightColor.Green / 255.0,
InstanceHighlightColor.Blue / 255.0,
InstanceHighlightColor.Alpha);
draw_surface_stretched(__surInstanceHighlight, 0, 0, _width, _height);
shader_reset();
}

////////////////////////////////////////////////////////////////
// Gizmo
if (surface_exists(__surGizmo))
{
draw_surface_stretched(__surGizmo, 0, 0, _width, _height);
}

matrix_set(matrix_world, _world);
matrix_set(matrix_view, _view);
matrix_set(matrix_projection, _projection);

gpu_pop_state();
};

/// @private
/// @private
static __overlay_gizmo_and_instance_highlight = function ()
{
if (!EditMode || !Gizmo || ds_list_empty(Gizmo.Selected))
{
return;
}

gpu_push_state();
gpu_set_blendenable(true);

var _world = matrix_get(matrix_world);
var _view = matrix_get(matrix_view);
var _projection = matrix_get(matrix_projection);
var _width = get_render_width();
var _height = get_render_height();
var _texelWidth = 1.0 / _width;
var _texelHeight = 1.0 / _height;

camera_set_view_size(__camera2D, _width, _height);
camera_apply(__camera2D);

////////////////////////////////////////////////////////////////
// Highlighted instances
if (!ds_list_empty(Gizmo.Selected)
&& surface_exists(__surInstanceHighlight))
{
var _shader = BBMOD_ShInstanceHighlight;
shader_set(_shader);
bbmod_shader_set_globals(_shader);
shader_set_uniform_f(shader_get_uniform(_shader, "u_vTexel"),
_texelWidth, _texelHeight);
shader_set_uniform_f(shader_get_uniform(_shader, "u_vColor"),
InstanceHighlightColor.Red / 255.0,
InstanceHighlightColor.Green / 255.0,
InstanceHighlightColor.Blue / 255.0,
InstanceHighlightColor.Alpha);
draw_surface_stretched(__surInstanceHighlight, 0, 0, _width, _height);
shader_reset();
}

////////////////////////////////////////////////////////////////
// Gizmo
if (surface_exists(__surGizmo))
{
draw_surface_stretched(__surGizmo, 0, 0, _width, _height);
}

matrix_set(matrix_world, _world);
matrix_set(matrix_view, _view);
matrix_set(matrix_projection, _projection);

gpu_pop_state();
};

/// @private
static __render_ssao = function (_surDepth, _projection)
{
if (EnableSSAO)
Expand Down Expand Up @@ -1113,23 +1113,23 @@ function BBMOD_BaseRenderer() constructor
bbmod_render_queues_clear();
}
bbmod_material_reset();

////////////////////////////////////////////////////////////////////////
//
// Draw gizmo and highlight selected instances
//
__overlay_gizmo_and_instance_highlight();


////////////////////////////////////////////////////////////////////////
//
// Draw gizmo and highlight selected instances
//
__overlay_gizmo_and_instance_highlight();

////////////////////////////////////////////////////////////////////////

// Reset render pass back to Forward at the end!
bbmod_render_pass_set(BBMOD_ERenderPass.Forward);

matrix_set(matrix_world, _world);

// Unset in case it gets destroyed when the room changes etc.
bbmod_shader_unset_global(BBMOD_U_SHADOWMAP);

// Unset in case it gets destroyed when the room changes etc.
bbmod_shader_unset_global(BBMOD_U_SHADOWMAP);

return self;
};

Expand All @@ -1146,17 +1146,26 @@ function BBMOD_BaseRenderer() constructor
static present = function ()
{
global.__bbmodRendererCurrent = self;

if (UseAppSurface
&& PostProcessor != undefined
&& PostProcessor.Enabled)
{
var _world = matrix_get(matrix_world);
matrix_set(matrix_world, matrix_build_identity());
PostProcessor.draw(application_surface, X, Y);
matrix_set(matrix_world, _world);

if (UseAppSurface)
{
var _world = matrix_get(matrix_world);
matrix_set(matrix_world, matrix_build_identity());
if (PostProcessor != undefined
&& PostProcessor.Enabled)
{
PostProcessor.draw(application_surface, X, Y);
}
else
{
gpu_push_state();
gpu_set_blendenable(false);
draw_surface(application_surface, X, Y);
gpu_pop_state();
}
matrix_set(matrix_world, _world);
}


return self;
};

Expand Down Expand Up @@ -1236,8 +1245,8 @@ function BBMOD_BaseRenderer() constructor
}
ds_map_destroy(__shadowmapCubes);

camera_destroy(__camera2D);

camera_destroy(__camera2D);

return undefined;
};
}
Loading

0 comments on commit 93a37a7

Please sign in to comment.