Skip to content

Commit

Permalink
Fix tesselation
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Dec 24, 2023
1 parent dc3a064 commit dbbb3de
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void attachToProgram() {
}

@Override
public void iris$createGeometryShader(ResourceProvider factory, String name) throws IOException {
public void iris$createExtraShaders(ResourceProvider factory, String name) throws IOException {
factory.getResource(new ResourceLocation("minecraft", name + "_geometry.gsh")).ifPresent(geometry -> {
try {
this.geometry = Program.compileShader(IrisProgramTypes.GEOMETRY, name, geometry.open(), geometry.sourcePackId(), new GlslPreprocessor() {
Expand All @@ -273,6 +273,32 @@ public String applyImport(boolean bl, String string) {
e.printStackTrace();
}
});
factory.getResource(new ResourceLocation("minecraft", name + "_tessControl.tcs")).ifPresent(tessControl -> {
try {
this.tessControl = Program.compileShader(IrisProgramTypes.TESS_CONTROL, name, tessControl.open(), tessControl.sourcePackId(), new GlslPreprocessor() {
@Nullable
@Override
public String applyImport(boolean bl, String string) {
return null;
}
});
} catch (IOException e) {
e.printStackTrace();
}
});
factory.getResource(new ResourceLocation("minecraft", name + "_tessEval.tes")).ifPresent(tessEval -> {
try {
this.tessEval = Program.compileShader(IrisProgramTypes.TESS_EVAL, name, tessEval.open(), tessEval.sourcePackId(), new GlslPreprocessor() {
@Nullable
@Override
public String applyImport(boolean bl, String string) {
return null;
}
});
} catch (IOException e) {
e.printStackTrace();
}
});
}

public Program getGeometry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ public Optional<Resource> getResource(ResourceLocation id) {
return Optional.empty();
}
return Optional.of(new StringResource(id, geometry));
} else if (path.endsWith("tcs")) {
if (tessControl == null) {
return Optional.empty();
}
return Optional.of(new StringResource(id, tessControl));
} else if (path.endsWith("tes")) {
if (tessEval == null) {
return Optional.empty();
}
return Optional.of(new StringResource(id, tessEval));
} else if (path.endsWith("fsh")) {
return Optional.of(new StringResource(id, fragment));
}
Expand Down

0 comments on commit dbbb3de

Please sign in to comment.