Skip to content

ImplicitConversion

final class ImplicitConversion
Package: dev.joid.lib.bridge.render.shader.source · Module: core · Source: ImplicitConversion.java

Rewrites the integer literals of a GLSL body as float literals where a float is expected, for the dialects whose compiler does not convert them.

GLSL 1.10 and GLSL ES refuse float x = 1; and need 1.0. The shaders of JOID are written for GLSL 1.20, which converts on its own, so GlslShaderTranslator runs this rewrite for the dialects without GlslDialect.hasImplicitConversions. An integer variable used as a float still needs float(...) in the source.

ReturnsSignatureSummary
Stringapply(String body, List variables) staticReturns the body with .0 after each integer literal that sits where a float is expected.

String apply(String body, List<ShaderVariable> variables) static

Returns the body with .0 after each integer literal that sits where a float is expected. A literal stays an integer inside brackets, in the arguments of an integer constructor or of an integer variable, after case, next to an operator whose other side is an integer variable, and on a preprocessor line. variables lists the declared variables whose integer type marks their names; the integer declarations of the body add to them.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page