Class Shader

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Shader()
      Support for streaming.
      protected Shader​(java.lang.String rkShaderName)
      The constructor called by the derived classes VertexShader and PixelShader.
      protected Shader​(java.lang.String rkShaderName, java.lang.String rkProgramText)
      The constructor called by the derived classes VertexShader and PixelShader.
    • Field Detail

      • m_kShaderName

        protected java.lang.String m_kShaderName
        The shader name, which contributes to a uniquely identifying string for a shader program.
      • m_spkProgram

        protected Program m_spkProgram
        The shader program, which is dependent on graphics API.
      • m_kUserData

        protected java.util.Vector<java.lang.Float> m_kUserData
        The user-defined data are specific to each shader object. The Program object knows only the name, which register to assign the value to, and how many registers to use. The storage provided here is for the convenience of Shader-derived classes. However, a derived class may provide alternate storage by calling UserConstant::SetDataSource for each user constant of interest.
      • m_kImageNames

        protected java.util.Vector<java.lang.String> m_kImageNames
        The names of images used by an instance of a shader program. The Texture objects store the actual images and the samplers that are used to sample the images.
      • m_kTextures

        protected java.util.Vector<Texture> m_kTextures
        Texture objects store the actual images and the samplers that are used to sample the images.
      • m_kSamplerImageNames

        protected java.util.Vector<java.lang.String> m_kSamplerImageNames
      • vertexShaderTexture2

        public static java.lang.String vertexShaderTexture2
      • vertexShaderTexture3

        public static java.lang.String vertexShaderTexture3
      • pixelShaderTexture2

        public static java.lang.String pixelShaderTexture2
      • pixelShaderTextureTransparent2

        public static java.lang.String pixelShaderTextureTransparent2
    • Constructor Detail

      • Shader

        public Shader()
        Support for streaming.
      • Shader

        protected Shader​(java.lang.String rkShaderName)
        The constructor called by the derived classes VertexShader and PixelShader.
        Parameters:
        rkShaderName - shader name.
      • Shader

        protected Shader​(java.lang.String rkShaderName,
                         java.lang.String rkProgramText)
        The constructor called by the derived classes VertexShader and PixelShader.
        Parameters:
        rkShaderName - shader name.
        rkProgramText - shader program text.
        bUnique - flag
    • Method Detail

      • GetDiskUsed

        public int GetDiskUsed​(StreamVersion rkVersion)
        Returns the size of this object and it's children on disk for the current StreamVersion parameter.
        Specified by:
        GetDiskUsed in interface StreamInterface
        Overrides:
        GetDiskUsed in class GraphicsObject
        Parameters:
        rkVersion - the current version of the Stream file being created.
        Returns:
        the size of this object on disk.
      • GetGetSamplerInformation

        public SamplerInformation GetGetSamplerInformation​(int i)
        Returns the SamplerInformation associated with the ith texture or sampler in the shader program.
        Parameters:
        i - the ith sampler in the shader program.
        Returns:
        SamplerInformation.
      • GetImageName

        public java.lang.String GetImageName​(int i)
        Get the image name.
        Parameters:
        i - image position.
        Returns:
        image name.
      • GetShaderName

        public final java.lang.String GetShaderName()
        The name of the shader object. The program object has a name that contains the shader name as a substring, but adds additional text as needed (the path to a shader on disk, the identifying information for a procedurally generated shader).
        Returns:
        shader name.
      • GetTexture

        public Texture GetTexture​(int i)
        Get the texture at position i.
        Parameters:
        i - texture index.
        Returns:
        texture at position i.
      • GetTexture

        public Texture GetTexture​(java.lang.String kSamplerImageName)
      • GetTextureQuantity

        public int GetTextureQuantity()
        Return number of textures in this shader.
        Returns:
        number of textures in this shader.
      • Link

        public void Link​(Stream rkStream,
                         Stream.Link pkLink)
        Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.
        Specified by:
        Link in interface StreamInterface
        Overrides:
        Link in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
        pkLink - the Link class from which the child object IDs are read.
      • Load

        public void Load​(Stream rkStream,
                         Stream.Link pkLink)
        Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.
        Specified by:
        Load in interface StreamInterface
        Overrides:
        Load in class GraphicsObject
        Parameters:
        rkStream - the Stream from which this object is being read.
        pkLink - the Link class for storing the IDs of this object's children objects.
      • OnLoadProgram

        public void OnLoadProgram​(Program pkProgram)
        Called when a program is loaded.
        Parameters:
        pkProgram - the newly loaded program.
      • OnReleaseProgram

        public void OnReleaseProgram()
        Called when a program is released.
      • Register

        public boolean Register​(Stream rkStream)
        Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.
        Specified by:
        Register in interface StreamInterface
        Overrides:
        Register in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
        Returns:
        true if this object is registered, false if the object has already been registered.
      • Save

        public void Save​(Stream rkStream)
        Write this object and all it's children to the Stream.
        Specified by:
        Save in interface StreamInterface
        Overrides:
        Save in class GraphicsObject
        Parameters:
        rkStream - the Stream where the child objects are stored.
      • SaveStrings

        public StringTree SaveStrings​(java.lang.String acTitle)
        Write this object into a StringTree for the scene-graph visualization.
        Specified by:
        SaveStrings in interface StreamInterface
        Overrides:
        SaveStrings in class GraphicsObject
        Parameters:
        acTitle - the header for this object in the StringTree.
        Returns:
        StringTree containing a String-based representation of this object and it's children.
      • SetImageName

        public void SetImageName​(int i,
                                 java.lang.String rkName,
                                 java.lang.String kSamplerImageName)
        Set the image name.
        Parameters:
        i - image position.
        rkName - image name.
      • SetTexture

        public void SetTexture​(int i,
                               Texture kTexture,
                               java.lang.String kSamplerImageName)
        Set the texture at position i.
        Parameters:
        i - texture index.
        kTexture - texture to put at position i.
      • SetTextureQuantity

        public void SetTextureQuantity​(int iQuantity)
        Set the number of textures in this shader.
        Parameters:
        iQuantity - the number of textures in this shader.