From 6dcedc0d1323bd555652789ec8744990f3f952af Mon Sep 17 00:00:00 2001 From: Patrik Kraif Date: Wed, 26 Jan 2022 11:50:47 +0100 Subject: [PATCH] Fixed get_proj_mat on HTML5 --- BBMOD_GML/BBMOD.yyp | 2 +- BBMOD_GML/rooms/RmDemo/RmDemo.yy | 2 +- .../scripts/BBMOD_Camera/BBMOD_Camera.gml | 29 ++++++++++++++----- docs_src/Changelog/Changelog3.1.8.md | 2 ++ 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/BBMOD_GML/BBMOD.yyp b/BBMOD_GML/BBMOD.yyp index 9897a46e..bf5aeb15 100644 --- a/BBMOD_GML/BBMOD.yyp +++ b/BBMOD_GML/BBMOD.yyp @@ -236,7 +236,7 @@ {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL+60.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL+70.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL+5.png","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL-15.png","resourceType":"GMIncludedFile",}, + {"CopyToMask":3035461389054378222,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL-15.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL+50.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"IBL+80.png","resourceType":"GMIncludedFile",}, {"CopyToMask":-1,"filePath":"datafiles/Data/BBMOD/Skies","resourceVersion":"1.0","name":"Sky+15.png","resourceType":"GMIncludedFile",}, diff --git a/BBMOD_GML/rooms/RmDemo/RmDemo.yy b/BBMOD_GML/rooms/RmDemo/RmDemo.yy index 64076e65..d1a78247 100644 --- a/BBMOD_GML/rooms/RmDemo/RmDemo.yy +++ b/BBMOD_GML/rooms/RmDemo/RmDemo.yy @@ -27,9 +27,9 @@ "inheritCode": false, "instanceCreationOrder": [ {"name":"inst_498721B7","path":"rooms/RmDemo/RmDemo.yy",}, - {"name":"inst_5897D947","path":"rooms/RmDemo/RmDemo.yy",}, {"name":"inst_15A6E850","path":"rooms/RmDemo/RmDemo.yy",}, {"name":"inst_21FC6344","path":"rooms/RmDemo/RmDemo.yy",}, + {"name":"inst_5897D947","path":"rooms/RmDemo/RmDemo.yy",}, ], "inheritCreationOrder": false, "sequenceId": null, diff --git a/BBMOD_GML/scripts/BBMOD_Camera/BBMOD_Camera.gml b/BBMOD_GML/scripts/BBMOD_Camera/BBMOD_Camera.gml index 43aee051..29a496ac 100644 --- a/BBMOD_GML/scripts/BBMOD_Camera/BBMOD_Camera.gml +++ b/BBMOD_GML/scripts/BBMOD_Camera/BBMOD_Camera.gml @@ -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. @@ -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`. diff --git a/docs_src/Changelog/Changelog3.1.8.md b/docs_src/Changelog/Changelog3.1.8.md index ff2767d6..c59a7df3 100644 --- a/docs_src/Changelog/Changelog3.1.8.md +++ b/docs_src/Changelog/Changelog3.1.8.md @@ -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.