You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, it should be possible to translate Java classes to GLSL structs, but I'm not sure if JLSL can do this yet. This is a simple Java class with instance methods that can be converted to GLSL:
public class Rectangle{
public float width;
public float height;
public Rectangle(float width,float height){
this.width = width;
this.height = height;
}
public float area(){
return this.width*this.height;
}
public float perimeter(){
return (this.width+this.height)*2.0;
}
}
Then the JLSL compiler's output might look like this:
Alternatively, you could modify a tool like ShaderGen to generate GLSL source code. It takes C# source code as its input, so you would only need a few small modifications to make it work with Java.
It is probably easier to translate Java to HLSL than to GLSL, since HLSL supports classes and interfaces (and GLSL doesn't.)
The Slang shading language also supports classes, so it might be feasible to compile Java classes to Slang and then compile them to GLSL.
In some cases, it should be possible to translate Java classes to GLSL structs, but I'm not sure if JLSL can do this yet. This is a simple Java class with instance methods that can be converted to GLSL:
Then the JLSL compiler's output might look like this:
An instance of the class could also be initialized:
Would it be feasible to implement this feature in JLSL?
The text was updated successfully, but these errors were encountered: