Created
January 4, 2026 00:31
-
-
Save lowercasebtw/4cc3a936fec18d8a7c4d91715c91bf45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public RenderPipeline.Snippet toSnippet(final RenderPipeline pipeline) { | |
| final RenderPipeline.Builder builder = RenderPipeline.builder(); | |
| builder.withVertexShader(pipeline.getVertexShader()); | |
| builder.withFragmentShader(pipeline.getFragmentShader()); | |
| for (var sampler : pipeline.getSamplers()) { | |
| builder.withSampler(sampler); | |
| } | |
| for (var uniform : pipeline.getUniforms()) { | |
| builder.withUniform(uniform.name(), uniform.type()); | |
| } | |
| for (var define : pipeline.getShaderDefines().flags()) { | |
| builder.withShaderDefine(define); | |
| } | |
| final Optional<BlendFunction> blendFunction = pipeline.getBlendFunction(); | |
| if (blendFunction.isPresent()) { | |
| builder.withBlend(blendFunction.get()); | |
| } else { | |
| builder.withoutBlend(); | |
| } | |
| builder.withDepthTestFunction(pipeline.getDepthTestFunction()); | |
| builder.withCull(pipeline.isCull()); | |
| builder.withColorLogic(pipeline.getColorLogic()); | |
| builder.withDepthWrite(pipeline.isWriteDepth()); | |
| builder.withColorWrite(pipeline.isWriteColor(), pipeline.isWriteAlpha()); | |
| builder.withVertexFormat(pipeline.getVertexFormat(), pipeline.getVertexFormatMode()); | |
| return builder.buildSnippet(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment