Class UserConstant

  • All Implemented Interfaces:
    java.io.Serializable

    public class UserConstant
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      UserConstant​(java.lang.String kProgramName, java.lang.String rkName, int iBaseRegister, int iRegisterQuantity, int iNumFloats)
      Construction and destruction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Delete memory.
      int GetBaseRegister()
      Member access.
      float[] GetData()
      Member access.
      float GetData​(int iPos)
      The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded.
      int GetDataSize()
      Get the number of floats.
      java.lang.String GetName()
      Return name of this UserConstant.
      int GetRegisterQuantity()
      Member access.
      void SetData​(int iPos, float fValue)
      The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded.
      void SetDataSource​(float[] afData)
      The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_kName

        private java.lang.String m_kName
        UserConstant name.
      • m_iBaseRegister

        private int m_iBaseRegister
        Base register (nonnegative)
      • m_iRegisterQuantity

        private int m_iRegisterQuantity
        Register quantity (positive)
      • m_afData

        private float[] m_afData
        Data
      • m_iNumFloats

        private int m_iNumFloats
        Data size.
    • Constructor Detail

      • UserConstant

        public UserConstant​(java.lang.String kProgramName,
                            java.lang.String rkName,
                            int iBaseRegister,
                            int iRegisterQuantity,
                            int iNumFloats)
        Construction and destruction. The base register must be nonnegative. The register quantity must be positive. Each register represents four floating-point values.
        Parameters:
        kProgramName - the name of the program the UserConstant belogs to.
        rkName - the name of the UserConstant
        iBaseRegister - (nonnegative)
        iRegisterQuantity - (positive)
        iNumFloats - the number of floats represented by this parameter.
    • Method Detail

      • dispose

        public void dispose()
        Delete memory.
      • GetBaseRegister

        public final int GetBaseRegister()
        Member access. The renderer will use these to set the registers with the appropriate values.
        Returns:
        base register value.
      • GetData

        public final float[] GetData()
        Member access. The renderer will use these to set the registers with the appropriate values.
        Returns:
        UserConstant data values.
      • GetData

        public float GetData​(int iPos)
        The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded. However, Shader-derived classes may provide their own storage and set the float pointer accordingly. Such derived classes are responsible for deallocating the storage if it was dynamically allocated.
        Parameters:
        iPos - position in data array to read.
        Returns:
        value at iPos.
      • GetDataSize

        public final int GetDataSize()
        Get the number of floats.
        Returns:
        UserConstant data size.
      • GetName

        public final java.lang.String GetName()
        Return name of this UserConstant.
        Returns:
        name of this UserConstant.
      • GetRegisterQuantity

        public final int GetRegisterQuantity()
        Member access. The renderer will use these to set the registers with the appropriate values.
        Returns:
        base register quantity.
      • SetData

        public void SetData​(int iPos,
                            float fValue)
        The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded. However, Shader-derived classes may provide their own storage and set the float pointer accordingly. Such derived classes are responsible for deallocating the storage if it was dynamically allocated.
        Parameters:
        iPos - position in data array to write.
        fValue - new value.
      • SetDataSource

        public void SetDataSource​(float[] afData)
        The Shader base class provides storage for the user constants and will set the float pointer to this storage when the shader program is loaded. However, Shader-derived classes may provide their own storage and set the float pointer accordingly. Such derived classes are responsible for deallocating the storage if it was dynamically allocated.
        Parameters:
        afData - data source.