Skip to content

Commit

Permalink
Update BulbRenderer.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Nov 6, 2023
1 parent 94bd269 commit b1f293a
Showing 1 changed file with 97 additions and 11 deletions.
108 changes: 97 additions & 11 deletions docs/20.4/BulbRenderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

A renderer struct will allocate three vertex buffers and a surface for its use.

**Remember to call the `.Free()` method when discarding a renderer struct otherwise you will create a memory leak.**

**You must free and recreate your renderer when changing rooms.**
!> Remember to call the `.Free()` method when discarding a renderer struct otherwise you will create a memory leak. You must free and recreate your renderer when changing rooms.

The `BULB_MODE` enum contains the following elements:

Expand Down Expand Up @@ -62,6 +60,39 @@ Sets the ambient light colour.
 
</details>

<details><summary><code>.SetSurfaceDimensions(width, height)</code></summary>
&nbsp;

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

|Name |Datatype|Purpose |
|------|--------|--------------------------------|
|width |integer |Width of the surface, in pixels |
|height|integer |Height of the surface, in pixels|

Sets the size of the light surface and clipping surface to the provided width and height.

?> This function is optional and is provided to force a surface resolution for e.g. improving performance by reducing lighting accuracy.

&nbsp;
</details>

<details><summary><code>.SetSurfaceDimensionsFromCamera(camera)</code></summary>
&nbsp;

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

|Name|Datatype|Purpose|
|----|--------|-------|
|camera|[camera index](https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/cameras%20and%20display/cameras/index.html)|Camera to use to define the surface dimensions|

Sets the size of the light surface and clipping surface to the dimensions of the specified camera.

?> This function is optional and is provided to force a surface resolution.

&nbsp;
</details>

<details><summary><code>.Update(viewLeft, viewTop, viewWidth, viewHeight)</code></summary>
&nbsp;

Expand Down Expand Up @@ -128,21 +159,21 @@ Draws the lighting/shadow surface on the given camera. Intended to be used along
&nbsp;
</details>

<details><summary><code>.GetSurface()</code></summary>
<details><summary><code>.RefreshStaticOccluders()</code></summary>
&nbsp;

**Returns:** Surface, the lighting surface currently being used by this renderer
**Returns:** N/A (`undefined`)

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

This function may return `undefined` if no surface exists for the renderer.
Refreshes this renderer's [static occluders](GML-Functions#bulbstaticoccluderrenderer-constructor), causing the renderer's output to reflect any changes made to its static occluders.

&nbsp;
</details>

<details><summary><code>.RefreshStaticOccluders()</code></summary>
<details><summary><code>.Free()</code></summary>
&nbsp;

**Returns:** N/A (`undefined`)
Expand All @@ -151,21 +182,21 @@ This function may return `undefined` if no surface exists for the renderer.
|----|--------|-------|
|None| | |

Refreshes this renderer's [static occluders](GML-Functions#bulbstaticoccluderrenderer-constructor), causing the renderer's output to reflect any changes made to its static occluders.
Frees memory associated with the renderer struct (vertex buffers and a surface).

&nbsp;
</details>

<details><summary><code>.Free()</code></summary>
<details><summary><code>.GetSurface()</code></summary>
&nbsp;

**Returns:** N/A (`undefined`)
**Returns:** Surface, the lighting surface currently being used by this renderer

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

Frees memory associated with the renderer struct (vertex buffers and a surface).
This function may return `undefined` if no surface exists for the renderer.

&nbsp;
</details>
Expand Down Expand Up @@ -208,3 +239,58 @@ If you sample a colour outside the view, this function will return black (`0`).

&nbsp;
</details>

<details><summary><code>.SetClippingSurface(clipisShadow, clipAlpha, clipInvert, hsvValueToAlpha)</code></summary>
&nbsp;

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

|Name |Datatype|Purpose|
|-------------------|--------|-------|
|clipisShadow |boolean |Whether the clipped areas should be rendered as shadow. Setting this to value will adjust the alpha value of clipped pixels instead|
|clipAlpha |number |The strength of the clipping effect. A value of `0` will perform no clipping, a value of `1` will maximise clipping|
|\[clipInvert\] |boolean |Whether to invert clipping such that high alpha areas remove light. Defaults to `false`|
|\[hsvValueToAlpha\]|boolean |Whether to use the HSV value component as the masking factor. Defaults to `false` |

&nbsp;
</details>

<details><summary><code>.GetClippingSurface()</code></summary>
&nbsp;

**Returns:** Surface, the clipping surface currently being used by this renderer

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

This function may return `undefined` if no clipping surface exists for the renderer.

&nbsp;
</details>

<details><summary><code>.CopyClippingSurface(surface)</code></summary>
&nbsp;

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

|Name |Datatype|Purpose |
|-------|--------|--------------------------------------|
|surface|surface |Surface to copy the clipping data from|

&nbsp;
</details>

<details><summary><code>.RemoveClippingSurface()</code></summary>
&nbsp;

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

|Name|Datatype|Purpose|
|----|--------|-------|
|None| | |

Removes the clipping surface from the renderer.

&nbsp;
</details>

0 comments on commit b1f293a

Please sign in to comment.