Class Light

java.lang.Object
com.codename1.gpu.Light

public final class Light extends Object
A single directional light plus a global ambient term, consumed by lit materials (Material.Type.LAMBERT and Material.Type.PHONG). The direction is the direction the light travels, in world space. Set the active light on the device with GraphicsDevice.setLight(Light).
  • Constructor Details

    • Light

      public Light()
  • Method Details

    • setDirection

      public Light setDirection(float x, float y, float z)

      Sets the world space direction the light travels.

      Parameters
      • x: the x component

      • y: the y component

      • z: the z component

      Returns

      this light for chaining

    • getDirectionX

      public float getDirectionX()
      Returns the x component of the light direction.
    • getDirectionY

      public float getDirectionY()
      Returns the y component of the light direction.
    • getDirectionZ

      public float getDirectionZ()
      Returns the z component of the light direction.
    • getColor

      public int getColor()
      Returns the light color as a packed ARGB integer.
    • setColor

      public Light setColor(int argb)

      Sets the light color as a packed ARGB integer.

      Parameters
      • argb: the packed ARGB color
      Returns

      this light for chaining

    • getAmbientColor

      public int getAmbientColor()
      Returns the ambient color as a packed ARGB integer.
    • setAmbientColor

      public Light setAmbientColor(int argb)

      Sets the ambient color as a packed ARGB integer.

      Parameters
      • argb: the packed ARGB color
      Returns

      this light for chaining