Skip to content

Commit

Permalink
Adds BULB_TRACE_EPSILON
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed May 22, 2023
1 parent 4869ee4 commit ec05f6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/__BulbClassImage/__BulbClassImage.gml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function __BulbClassImage(_spriteIndex, _imageIndex) constructor
var _result = __BulbTraceBufferToEdgeArray(_buffer,
sprite_get_width(__spriteIndex) + 2, sprite_get_height(__spriteIndex) + 2, 2,
-1 - sprite_get_xoffset(__spriteIndex), -1 - sprite_get_yoffset(__spriteIndex),
false, true);
false, true, BULB_TRACE_EPSILON);

__edgeArray = _result.__edgeArray;
__radius = _result.__radius;
Expand Down
2 changes: 1 addition & 1 deletion scripts/__BulbClassTileset/__BulbClassTileset.gml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function __BulbClassTileset(_tileset, _checkForTag = true) constructor
//We'll likely need the hash later so we can save a bit of time by calculating it now
if (BULB_USE_DISK_CACHE && (__BULB_BUILD_TYPE == "run")) __GetHash(_buffer);

var _result = __BulbTraceBufferToEdgeArray(_buffer, __textureWidth, __textureHeight, 0, 0, 0, false, false, 1);
var _result = __BulbTraceBufferToEdgeArray(_buffer, __textureWidth, __textureHeight, 0, 0, 0, false, false, BULB_TRACE_EPSILON);
var _rawEdgeArray = _result.__edgeArray;

buffer_delete(_buffer);
Expand Down
5 changes: 5 additions & 0 deletions scripts/__BulbConfig/__BulbConfig.gml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
//Any value greater than or equal to this alpha threshold is considered "opaque"
#macro BULB_TRACE_ALPHA_THRESHOLD 0.1

//Bulb uses the Ramer–Douglas–Peucker algorithm algorithm to clean up sprite and tilemap tracings
//You'll only notice the impact of this macro when using a self-lighting renderer mode
//Increase this number to reduce the number of unnecessary shadows. Decrease this number if you seem to be missing shadows
#macro BULB_TRACE_EPSILON 4

//Whether to automatically trace tagged assets on boot, and what that tag should be
// N.B. In GameMaker LTS 2022.0.0.12, this feature will not work for tilesets due to an upstream GameMaker bug
#macro BULB_TRACE_TAGGED_ASSETS_ON_BOOT true
Expand Down

0 comments on commit ec05f6c

Please sign in to comment.