Module gl1

Class GLSLCurveLight

All Implemented Interfaces:
GLSLOpenGLObject

public class GLSLCurveLight extends GLSLLightShader
GL4/GLSL deferred-shading light shader for CurveLight.

Approximates the tube as the straight line segment between its two endpoints (correct for straight-tube CurveLights; a reasonable centroid approximation for curved ones). At each fragment the closest point on that segment is found, then the Phong-cosine emission lobe is evaluated: BSDF = (n+2)·sinTheta^(n+1) / (2π), where sinTheta is the sine of the angle between the tube axis and the direction from the fragment to the closest point.

The formula matches the GPU Flux kernel (samplelight.h, LIGHT_CURVE case) and the CPU CurveLight.computeBSDF implementation.

Author:
MH at YNL 2026
  • Field Details

    • ep1

      protected String ep1
      Tube endpoint 1 in eye space.
    • ep2

      protected String ep2
      Tube endpoint 2 in eye space.
    • cl_exponent

      protected String cl_exponent
    • col0

      protected String col0
    • radientPower

      protected String radientPower
  • Constructor Details

    • GLSLCurveLight

      public GLSLCurveLight()
  • Method Details

    • getLightFunction

      public String getLightFunction()
      Description copied from class: GLSLLightShader
      Sets middle part of a light shader (after properties have been extracted from deferred-shading-textures
      Overrides:
      getLightFunction in class GLSLLightShader
      Returns:
    • getFragmentShader

      public String[] getFragmentShader(Object sh)
      Specified by:
      getFragmentShader in class GLSLShader
      Returns:
    • needsRecompilation

      public boolean needsRecompilation(Object data)
      Description copied from class: GLSLShader
      Return false if Shader depends only on Uniforms
      Overrides:
      needsRecompilation in class GLSLShader
      Returns:
      true, if Sourcecode needs to be regenerated and recompiled
    • instanceFor

      public Class instanceFor()
      Overrides:
      instanceFor in class GLSLShader
      Returns:
      Class represented by this Shader
    • getInstance

      public GLSLShader getInstance()
      Description copied from class: GLSLShader
      For "hardcompiled" Shaders this method should return a new instance
      Overrides:
      getInstance in class GLSLShader
      Returns:
    • setupShader

      protected void setupShader(javax.media.opengl.GL gl, GLSLDisplay disp, Object data)
      Overrides:
      setupShader in class GLSLLightShader
      Parameters:
      gl -
      disp -
    • setupDynamicUniforms

      public void setupDynamicUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, Object data, int shaderNo)
      Description copied from class: GLSLShader
      Function that loads uniforms of the represented Shader.
      Overrides:
      setupDynamicUniforms in class GLSLLightShader
      Parameters:
      gl -
      disp - GLSLDisplay that tries using this shader
      data - The GroIMP-Shader-Object represented by this shader.