Skip to content

Commit

Permalink
Updates 22.0 docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Sep 25, 2024
1 parent 4219abc commit b607e98
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
18 changes: 18 additions & 0 deletions docs/22.0/BulbApplyLightingToSurface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# BulbDrawLitSurface

 

`BulbApplyLightingToSurface(renderer, surface)`

**Returns:** N/A (`undefined`)

|Argument |Datatype|Purpose |
|----------|--------|------------------------------------|
|`renderer`|renderer|Renderer to use to light the surface|
|`surface` |surface |Surface to affect with lighting |

Applies a Bulb renderer's lighting directly to a surface. Typically, this would be `application_surface`.

Bulb uses gamma correct lighting and, as such, works in a slightly different way to most other GameMaker lighting systems. Instead of multiplying the light on top of a source surface (typically the application surface), Bulb instead combines the source surface with the lighting in a special shader called a "tonemapping" shader. This process is complex, especially for HDR lighting and bloom, so it is wrapped up inside this helper function.

!> This function is substantially slower than the preferred `BulbDrawLitSurface()` function. It is provided as an easier alternative to apply lighting without having to reprogram other parts of your rendering pipeline. If you are concerned about performance, you should swap to using `BulbDrawLitSurface()`.
25 changes: 0 additions & 25 deletions docs/22.0/BulbDrawLitApplicationSurface.md

This file was deleted.

24 changes: 24 additions & 0 deletions docs/22.0/BulbDrawLitSurface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# BulbDrawLitSurface

 

`BulbDrawLitSurface(renderer, surface, [x], [y], [width], [height], [textureFiltering], [alphaBlend=false])`

**Returns:** N/A (`undefined`)

|Argument |Datatype|Purpose |
|--------------------|--------|---------------------------------------------------------------------------------------------------------------------------|
|`renderer` |renderer|Renderer to use to draw the surface |
|`surface` |surface |Surface to draw with lighting |
|`[x]` |number |x position to draw the surface at. If not specified, the position returned by `application_get_position()` will be used |
|`[y]` |number |y position to draw the surface at. If not specified, the position returned by `application_get_position()` will be used |
|`[width]` |number |width to draw the surface. If not specified, the width returned by `application_get_position()` will be used |
|`[height]` |number |heighr to draw the surface. If not specified, the height returned by `application_get_position()` will be used |
|`[textureFiltering]`|boolean |Whether to use texture filtering when drawing the surface. If not specified, the texture filter setting will not be changed|
|`[alphaBlend]` |boolean |Whether to use texture filtering when drawing the surface. If not specified, alpha blending will be disabled |

Draws a surface with lighting applied from a Bulb renderer. Typically, you would draw `application_surface`. You'll probably want to call `application_surface_draw_enable(false)` at the start of your game if you're using this function. This function should typically be called in the Post Draw event as a replacement for native automatic drawing or other manual drawing (`draw_surface_stretched(application_surface, ...)` etc.) of the application surface.

Bulb uses gamma correct lighting and, as such, works in a slightly different way to most other GameMaker lighting systems. Instead of multiplying the light on top of a source surface (typically the application surface), Bulb instead combines the source surface with the lighting in a special shader called a "tonemapping" shader. This process is complex, especially for HDR lighting and bloom, so it is wrapped up inside this helper function.

!> Do not call this function in a Draw Begin, Draw, or Draw End event. This will end up with the application surface being drawn to itself which will usually cause a rendering error. Instead use the Post Draw event or one of the Draw GUI events.
3 changes: 2 additions & 1 deletion docs/22.0/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
- [BulbAmbienceSprite](BulbAmbienceSprite)
- [BulbShadowOverlay](BulbShadowOverlay)
- [BulbLightOverlay](BulbLightOverlay)
- [BulbDrawLitApplicationSurface](BulbDrawLitApplicationSurface)
- [BulbApplyLightingToSurface](BulbApplyLightingToSurface)
- [BulbDrawLitSurface](BulbDrawLitSurface)
- [Normal Map Functions](NormalMapFunctions)

0 comments on commit b607e98

Please sign in to comment.