Skip to content

Commit

Permalink
✨ Shader changes from 24w34a
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Oct 8, 2024
1 parent c4c7fe5 commit 0a2101b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 14 deletions.
2 changes: 1 addition & 1 deletion java/assets/lang.mcdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dispatch minecraft:resource[lang] to struct Lang {
[#[id="translation_key"] string]: string,
[#[translation_key(definition=true)] string]: string,
}
57 changes: 48 additions & 9 deletions java/assets/shader/post.mcdoc
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
dispatch minecraft:resource["shader/post"] to struct ShaderPost {
targets?: [(string | Target)],
dispatch minecraft:resource["post_effect"] to struct PostEffect {
targets?: (
#[until="1.21.2"] [(string | OldTarget)] |
#[since="1.21.2"] Targets |
),
passes?: [Pass],
}

struct Target {
struct OldTarget {
name: string,
width?: int,
height?: int,
}

struct Pass {
name: string,
intarget: string,
outtarget: string,
auxtargets?: [AuxTarget],
uniforms?: [Uniform],
struct Targets {
[#[id="shader_target"] string]: (FixedSizedTarget | FullScreenTarget),
}

struct FixedSizedTarget {
width: int,
height: int,
}

struct FullScreenTarget {}

type Pass = (
#[until="1.21.2"] struct {
name: string,
intarget: string,
outtarget: string,
auxtargets?: [AuxTarget],
use_linear_filter?: boolean,
uniforms?: [Uniform],
} |
#[since="1.21.2"] struct {
program: #[id="shader"] string,
inputs?: [(TargetInput | TextureInput)],
output?: #[id="shader_target"] string,
uniforms?: [Uniform],
} |
)

struct AuxTarget {
name: string,
id: string,
Expand All @@ -25,6 +48,22 @@ struct AuxTarget {
bilinear?: boolean,
}

struct TargetInput {
sampler_name: string,
location: string,
width: int @ 1..,
height: int @ 1..,
bilinear?: boolean,
}

struct TextureInput {
sampler_name: string,
target: #[id="shader_target"] string,
width: int @ 1..,
height: int @ 1..,
bilinear?: boolean,
}

struct Uniform {
name: string,
values: [float] @ 0..4,
Expand Down
31 changes: 28 additions & 3 deletions java/assets/shader/program.mcdoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
dispatch minecraft:resource["shader/program"] to struct ShaderProgram {
vertex: string,
fragement: string,
dispatch minecraft:resource["shader"] to struct ShaderProgram {
// The vertex shader, referencing a file ending with `.vsh`.
vertex: (
#[until="1.21.2"] string |
#[since="1.21.2"] #[id="shader/vertex"] string |
),
// The fragment shader, referencing a file ending with `.fsh`.
fragement: (
#[until="1.21.2"] string |
#[since="1.21.2"] #[id="shader/fragment"] string |
),
samplers?: [Sampler],
#[until="1.21.2"]
attributes?: [string],
uniforms: [Uniform],
/// Unused.
#[until="1.21.2"]
blend?: BlendMode,
#[until="1.21.2"]
cull?: boolean,
/// Defines GLSL directives to be injected into the shader source.
#[since="1.21.2"]
defines: Defines,
}

struct Sampler {
name: string,
#[until="1.21.2"]
file?: string,
}

Expand Down Expand Up @@ -59,3 +75,12 @@ enum(string) BlendFactor {
DstAlpha = "dstalpha",
OneDstAlpha = "1-dstalpha",
}

struct Defines {
/// Values that will be injected as `#define <key> <value>` at the top of the file.
values?: struct DefinesValues {
[string]: string,
},
/// Flags that will be injected as `#define <key>` at the top of the file.
flags?: [string],
}
2 changes: 1 addition & 1 deletion java/server/util/text.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type TextObject = (
...TextBase,
} |
struct TranslatedText {
translate: string, // TODO
translate: #[translation_key] string,
with?: [Text],
#[since="1.19.4"]
fallback?: Text,
Expand Down

0 comments on commit 0a2101b

Please sign in to comment.