Skip to content

Commit 77f47e5

Browse files
authored
Merge pull request #378 from Luracasmus/main
Add missing API items & details and fix broken links
2 parents cd7db0f + 03cfd36 commit 77f47e5

17 files changed

Lines changed: 260 additions & 110 deletions

File tree

src/content/docs/current/Guides/Your First Shaderpack/4_shadows.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ float shadow = step(shadowScreenPos.z, texture(shadowtex0, shadowScreenPos.xy).r
323323

324324
with
325325

326-
```
326+
```glsl
327327
vec3 shadow = getShadow(shadowScreenPos);
328328
```
329329

src/content/docs/current/How To/coordinate_spaces.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ It is also worth noting that in third person mode, view bobbing is disabled, and
4949
## Shadow Space
5050
"Shadow Space" can refer to a number of different coordinate spaces, all of which are used for the [shadow pass](/current/reference/programs/shadow/). As such, the "shadow" versions of coordinate spaces are generally equivalent to their normal versions but from the perspective of the shadow camera (the sun/moon). The shadow spaces include **shadow view space**, **shadow clip space**, **shadow NDC space**, and **shadow screen space**.
5151

52-
In the [shadow pass](/current/reference/programs/shadow/), the same base matrices are used ([`modelViewMatrix`](/current/reference/uniforms/matrices/#modelviewmatrix), [`projectionMatrix`](/current/reference/uniforms/matrices/#projectionmatrix), etc), or the `shadow` matrix uniforms (e.g. [`shadowModelView`](/current/reference/uniforms/matrices/#shadowmodelview), [`shadowProjection`](/current/reference/uniforms/matrices/#shadowprojection)) can be used from any program. When sampling the shadow map, positions can be transformed into **player space**, and from there back into *shadow screen space*.
52+
In the [shadow pass](/current/reference/programs/shadow/), the same base matrices are used ([`gl_ModelViewMatrix`](/current/reference/uniforms/matrices/#gl_modelviewmatrix), [`gl_ProjectionMatrix`](/current/reference/uniforms/matrices/#gl_projectionmatrix), etc), or the `shadow` matrix uniforms (e.g. [`shadowModelView`](/current/reference/uniforms/matrices/#shadowmodelview), [`shadowProjection`](/current/reference/uniforms/matrices/#shadowprojection)) can be used from any program. When sampling the shadow map, positions can be transformed into **player space**, and from there back into *shadow screen space*.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: ftransform
3+
description: The vertex position in clip space.
4+
sidebar:
5+
label: ftransform
6+
order: 2
7+
---
8+
9+
### `ftransform`
10+
11+
**Valid Programs**: `*.vsh`
12+
13+
---
14+
15+
Function returning the vertex position in clip space.
16+
17+
```glsl
18+
/*
19+
vec3 model_pos = gl_Vertex.xyz;
20+
vec4 view_pos = gl_ModelViewMatrix * vec4(model_pos, 1.0);
21+
vec4 clip_pos = gl_ProjectionMatrix * view_pos;
22+
*/
23+
24+
vec4 clip_pos = ftransform(); // Equivalent to the above, not accounting for possible rounding differences.
25+
26+
gl_Position = clip_pos;
27+
```

src/content/docs/current/Reference/Attributes/gl_Color.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ The vertex color attribute.
1616

1717
The color attribute is often used to apply tints to colored blocks such as leaves, grass, water, etc. It also contains the [vanilla ambient occlusion](/current/reference/constants/ambientocclusionlevel/) and, if enabled, the [old lighting](/current/reference/shadersproperties/features/#oldlighting).
1818

19-
Enabling [`separateAo`](/current/reference/shadersproperties/features/#separateao) will move the ambient occlusion from the `rgb` components of `gl_Color` to the `a` component, which can be applied later like this:
19+
Enabling [`separateAo`](/current/reference/shadersproperties/features/#separateao) will move the ambient occlusion from the `rgb` components of `gl_Color` to the `a` component in terrain programs, which can be applied later like this:
2020

2121
```glsl
2222
vec3 color = gl_Color.rgb * gl_Color.a;
2323
```
2424

25+
The `a` component includes tint for alpha in some non-terrain programs.
26+
2527
### `in vec4 vaColor;`
2628

2729
:::danger

src/content/docs/current/Reference/Attributes/mc_chunkFade.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ The fade-in progress of the geometry. This value is a `float` automatically decl
2121

2222
In `gbuffers_terrain.vsh`, the value will be a float in the range 0-1. In all other gbuffers programs, it will be declared as `const float mc_chunkFade = -1.0;`.
2323

24-
The variable will not be declared if the `FADE_VARIABLE` [feature flag](/current/reference/shadersproperties/flags/) is not available. You should check if the feature is available when using the variable.
24+
The variable will not be declared if the `FADE_VARIABLE` [feature flag](/current/reference/shadersproperties/flags/) is not available. You should check if the feature is available when using the variable.

src/content/docs/current/Reference/Buffers/ssbo.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ SSBOs require OpenGL 4.3 support, which macOS does not have. For more informatio
2525
### Fixed Size SSBOs
2626
To define the SSBO with a fixed size, put the following in [`shaders.properties`](/current/reference/shadersproperties/overview/) and replace `<totalByteSize>` with the total size of the SSBO in bytes and replace `<index>` with a unique value from 0 to 8.
2727

28-
```
28+
```properties
2929
bufferObject.<index> = <byteSize>
3030
```
3131

3232
### Screen-Sized SSBOs
3333
SSBOs can also be defined as screen-sized (Iris 1.6.6 and later), where their size is relative to the screen dimensions. This is useful for storing data per-pixel. To use this, put the following in [`shaders.properties`](/current/reference/shadersproperties/overview/).
3434

35-
```
35+
```properties
3636
bufferObject.<index> = <byteSize> <isRelative> <scaleX> <scaleY>
3737
```
3838

@@ -73,4 +73,4 @@ void main() {
7373

7474
## Initialization Data File (Iris 1.8+)
7575
### `bufferObject.<index> = <byteSize> <filePath>`
76-
Iris 1.8 adds support for initializing an SSBO with data from a binary file. Simply append the file path to the end of the SSBO declaration in [`shaders.properties`](/current/reference/shadersproperties/overview/). The value is be initialized at on shader load/reload. This works with only fixed sized SSBOs, and if the size of the file is bigger than the SSBO Iris will throw an error. If the file is smaller than the SSBO, the remaining data in the SSBO will be uninitialized (and is likely to be garbage data).
76+
Iris 1.8 adds support for initializing an SSBO with data from a binary file. Simply append the file path to the end of the SSBO declaration in [`shaders.properties`](/current/reference/shadersproperties/overview/). The value is be initialized at on shader load/reload. This works with only fixed sized SSBOs, and if the size of the file is bigger than the SSBO Iris will throw an error. If the file is smaller than the SSBO, the remaining data in the SSBO will be uninitialized (and is likely to be garbage data).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: MAX_COLOR_BUFFERS
3+
description: Maximum colortex texture count.
4+
sidebar:
5+
label: MAX_COLOR_BUFFERS
6+
order: 2
7+
badge:
8+
text: Iris Only (1.10.5+)
9+
variant: tip
10+
---
11+
12+
### `MAX_COLOR_BUFFERS`
13+
14+
The maximum number of [colortex](/current/reference/buffers/colortex/) textures that a shader pack can use.

src/content/docs/current/Reference/Macros/MC_GLSL_VERSION.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ sidebar:
88

99
### `MC_GLSL_VERSION`
1010

11-
The maximum GLSL version supported by the system. For example: 120, 330, 460, etc.
11+
The maximum GLSL version supported by the system. For example: 120, 330, 460, etc.

src/content/docs/current/Reference/Macros/MC_GL_VERSION.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ The maximum OpenGL version supported by the system, encoded in an integer format
1313
For example:
1414
- OpenGL 2.1 -> 210
1515
- OpenGL 3.3 -> 330
16-
- OpenGL 4.6 -> 460
16+
- OpenGL 4.6 -> 460

src/content/docs/current/Reference/Macros/MC_HAND_DEPTH.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ sidebar:
1010

1111
The clip space depth multiplier applied to geometry in [`gbuffers_hand`](/current/reference/programs/gbuffers/) and [`gbuffers_hand_water`](/current/reference/programs/gbuffers/).
1212

13-
The multiplier is applied in clip space automatically through the [projection matrix](/current/reference/uniforms/matrices/#projectionMatrix). When working backwards from the depth buffer, the multiplier should be applied in NDC space rather than screen space to produce the correct result, for example:
13+
The multiplier is applied in clip space automatically through the [projection matrix](/current/reference/uniforms/matrices/#gl_projectionMatrix). When working backwards from the depth buffer, the multiplier should be applied in NDC space rather than screen space to produce the correct result, for example:
1414

1515
```glsl
1616
float screenDepth = textureLod(depthtex0, texcoord, 0.0).r;
1717
float ndcDepth = (screenDepth * 2.0 - 1.0) / MC_HAND_DEPTH;
18-
```
18+
```

0 commit comments

Comments
 (0)