Skip to content

Commit

Permalink
Fixed get_proj_mat on HTML5
Browse files Browse the repository at this point in the history
  • Loading branch information
kraifpatrik committed Jan 26, 2022
1 parent afc9969 commit 6dcedc0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion BBMOD_GML/BBMOD.yyp

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

2 changes: 1 addition & 1 deletion BBMOD_GML/rooms/RmDemo/RmDemo.yy

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

29 changes: 21 additions & 8 deletions BBMOD_GML/scripts/BBMOD_Camera/BBMOD_Camera.gml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,27 @@ function BBMOD_Camera() constructor
return _retval;
};

/// @func get_proj_mat()
/// @desc Retrieves camera's projection matrix.
/// @return {real[16]} The projection matrix.
static get_proj_mat = function () {
gml_pragma("forceinline");

if (os_browser == browser_not_a_browser)
{
// This returns a struct in HTML5 for some reason...
return camera_get_proj_mat(Raw);
}

var _view = matrix_get(matrix_view);
var _proj = matrix_get(matrix_projection);
camera_apply(Raw);
var _retval = matrix_get(matrix_projection);
matrix_set(matrix_view, _view);
matrix_set(matrix_projection, _proj);
return _retval;
};

/// @func get_right()
/// @desc Retrieves a vector pointing right relative to the camera's
/// direction.
Expand Down Expand Up @@ -337,14 +358,6 @@ function BBMOD_Camera() constructor
);
};

/// @func get_proj_mat()
/// @desc Retrieves camera's projection matrix.
/// @return {real[16]} The projection matrix.
static get_proj_mat = function () {
gml_pragma("forceinline");
return camera_get_proj_mat(Raw);
};

/// @func apply()
/// @desc Applies the camera.
/// @return {BBMOD_Camera} Returns `self`.
Expand Down
2 changes: 2 additions & 0 deletions docs_src/Changelog/Changelog3.1.8.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog 3.1.8
This is a small hotfix release that patches the camera module, which caused errors on YYC and HTML5 platforms.

## GML API:
### Camera module
* Fixed a bug where Windows YYC (and possibly other YYC targets) did not work if `_positionHandler` argument was not passed to `BBMOD_Camera.update`.
* Fixed method `BBMOD_Camera.get_proj_mat`, which did not work in HTML5.

0 comments on commit 6dcedc0

Please sign in to comment.