Skip to content

Commit 8c9f3f7

Browse files
committed
Update documentation for 0.3.0;
1 parent 949e594 commit 8c9f3f7

File tree

6 files changed

+126
-2
lines changed

6 files changed

+126
-2
lines changed

docs/Texture.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include `.png`, `.jpg`, `.tga`, and `.bmp`.
1111
<table>
1212
<tr>
1313
<td class="pre">lovr.graphics.newTexture</td>
14-
<td>Create a new Texture from an image file.</td>
14+
<td>Create a new Texture.</td>
1515
</tr>
1616

1717
<tr>
@@ -39,6 +39,11 @@ include `.png`, `.jpg`, `.tga`, and `.bmp`.
3939
<td>Get the current <code>WrapMode</code> of the Texture.</td>
4040
</tr>
4141

42+
<tr>
43+
<td class="pre">Texture:renderTo</td>
44+
<td>Render to a Texture using a function.</td>
45+
</tr>
46+
4247
<tr>
4348
<td class="pre">Texture:setFilter</td>
4449
<td>Set the <code>FilterMode</code> of the Texture, used to control upsampling and downsampling.</td>

docs/Texture:renderTo.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
category: reference
3+
-->
4+
5+
Texture:renderTo
6+
===
7+
8+
Render to a texture using a function.
9+
10+
texture:renderTo(callback)
11+
12+
### Arguments
13+
14+
- `function callback` The function used to render to the texture. Normal `lovr.graphics` functions
15+
can be used inside the callback to change the contents of the texture.
16+
17+
### Returns
18+
19+
Nothing
20+
21+
Notes
22+
---
23+
24+
1. Textures created from an image can't be rendered to. See `lovr.graphics.newTexture` for details on
25+
creating an empty texture with a width and height.
26+
1. Make sure you clear the contents of the texture before rendering using `lovr.graphics.clear`.
27+
Otherwise there might be garbage data in the texture.

docs/TextureProjection.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
category: reference
3+
-->
4+
5+
TextureProjection
6+
===
7+
8+
When creating Textures to be used as render targets, they can be created in either "2d" or "3d"
9+
mode. 2D mode is good for 2D user interfaces or postprocessing, whereas 3d is useful for portals,
10+
weapon scopes, mirrors, and other situations where 3D content needs to be rendered.
11+
12+
Values
13+
---
14+
15+
- `2d` Optimize the texture for rendering 2d content using an orthographic projection.
16+
- `3d` Optimize the texture for rendering 3d content using a perspective projection.

docs/lovr.graphics.cube.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,25 @@ Draws a cube with a given position, size, and orientation.
2424
### Returns
2525

2626
Nothing
27+
28+
---
29+
30+
Draw a textured cube
31+
32+
lovr.graphics.cube(texture, x, y, z, size, angle, ax, ay, az)
33+
34+
### Arguments
35+
36+
- `Texture texture` The Texture to apply to the cube.
37+
- `number x (0)` The x coordinate of the center of the cube.
38+
- `number y (0)` The y coordinate of the center of the cube.
39+
- `number z (0)` The z coordinate of the center of the cube.
40+
- `number size (1.0)` The z coordinate of the center of the cube.
41+
- `number angle (0)` The rotation of the cube around its rotation axis, in radians.
42+
- `number ax (0)` The x coordinate of the cube's axis of rotation.
43+
- `number ay (1)` The y coordinate of the cube's axis of rotation.
44+
- `number az (0)` The z coordinate of the cube's axis of rotation.
45+
46+
### Returns
47+
48+
Nothing

docs/lovr.graphics.newTexture.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ category: reference
55
lovr.graphics.newTexture
66
===
77

8-
Creates a new texture from an image file.
8+
Creates a new texture. The texture can be loaded from an image file, or it can be created as an
9+
empty render target.
10+
11+
---
912

1013
texture = lovr.graphics.newTexture(filename)
1114

@@ -16,3 +19,19 @@ Creates a new texture from an image file.
1619
### Returns
1720

1821
- `Texture texture` The new Texture.
22+
23+
---
24+
25+
texture = lovr.graphics.newTexture(width, height, projection, msaa)
26+
27+
### Arguments
28+
29+
- `number width` The width of the texture, in pixels.
30+
- `number height` The height of the texture, in pixels.
31+
- `TextureProjection projection (3d)` The type of the projection to use for the Texture.
32+
- `number msaa (0)` The number of samples to use for multisample antialiasing. A higher number will
33+
make things look prettier at the cost of performance. Set to 0 to disable antialiasing.
34+
35+
### Returns
36+
37+
- `Texture texture` The new Texture. To render to it, use `Texture:renderTo`.

docs/lovr.graphics.plane.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,38 @@ Draws a plane with a given position, size, and orientation.
2323
### Returns
2424

2525
Nothing
26+
27+
---
28+
29+
Draw a textured plane
30+
31+
lovr.graphics.plane(texture, x, y, z, size, nx, ny, nz)
32+
33+
### Arguments
34+
35+
- `Texture texture` The Texture to apply to the plane.
36+
- `number x (0)` The x coordinate of the center of the plane.
37+
- `number y (0)` The y coordinate of the center of the plane.
38+
- `number z (0)` The z coordinate of the center of the plane.
39+
- `number size (1.0)` The size of the plane, in meters.
40+
- `number nx (0.0)` The x coordinate of the normal vector of the plane.
41+
- `number ny (1.0)` The y coordinate of the normal vector of the plane.
42+
- `number nz (0.0)` The z coordinate of the normal vector of the plane.
43+
44+
### Returns
45+
46+
Nothing
47+
48+
---
49+
50+
Draw a textured plane that takes up the whole screen
51+
52+
lovr.graphics.plane(texture)
53+
54+
### Arguments
55+
56+
- `Texture texture` The texture to use.
57+
58+
### Returns
59+
60+
Nothing

0 commit comments

Comments
 (0)