Libraries.Game.Graphics.DepthTestAttribute Documentation

Inherits from: Libraries.Game.Graphics.Attribute, Libraries.Language.Object

Variables Table

VariablesDescription
integer depthFunctionThe depth test function to be used by OpenGL. A value of 0 will disable it. The default value is the value of the GL_LEQUAL constant.
integer DEPTH_TESTThe depth test function to be used by OpenGL. A value of 0 will disable it. The default value is the value of the GL_LEQUAL constant.
number depthRangeNearA value used by OpenGL for depth testing. Mapping of near clipping plane to window coordinates, default value of 0.
text ALIAS
boolean depthMaskWhether to write to the underlying depth buffer. Default value is true.
number depthRangeFarA value used by OpenGL for depth testing. Mapping of far clipping plane to window coordinates, default value of 1.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Copy()

A value used by OpenGL for depth testing. Mapping of far clipping plane to window coordinates, default value of 1.

Return

Libraries.Game.Graphics.Attribute:

Equals(Libraries.Game.Graphics.Attribute other)

This action will test to see if two Attributes are of the same type. Note that it will not test if the contents of the Attributes are the same.

Parameters

Return

boolean: Whether or not the two attributes are of the same type.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.ColorAttribute
use Libraries.Game.Graphics.Attribute
use Libraries.Game.Graphics.Color

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Color color

        // Using the ColorAttribute class, which inherits from Attribute.
        ColorAttribute attribute1

        attribute1:SetAttribute(attribute1:GetDiffuseValue(), color:Green())
        Attribute attribute2 = attribute1:Copy()

        output "attribute1 = attribute2 is " + attribute1:Equals(attribute2)

    end
end

Equals(Libraries.Language.Object object)

This action determines if the given object is equal to this Attribute.

Parameters

Return

boolean: True if the object is an Attribute with the same type, otherwise it returns false.

GetAttributeAlias(integer type)

GetAttributeAlias will take an integer code for a particular type of Attribute and return a text alias representing that type. Each class that inherits from Attribute will contain a series of actions that will return an integer code for a given type. The contents of this Attribute are not considered during this action, and can be ignored.

Parameters

  • integer type: An integer code describing an Attribute type.

Return

text: A text alias representing the described Attribute type.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.TextureAttribute

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        // Using the TextureAttribute class, which inherits from Attribute.
        TextureAttribute attribute
        text alias = attribute:GetAttributeAlias(attribute:GetDiffuseValue())

        output "The alias for a diffuse TextureAttribute is " + alias
    end
end

GetAttributeType(text alias)

GetAttributeType will take a text alias for a particular type of Attribute and return an integer code representing that type. Each class that inherits from Attribute will contain a series of public constant text fields that contain an alias for a given type. The contents of this Attribute are not considered during this action, and can be ignored.

Parameters

  • text alias: A text alias describing an Attribute type.

Return

integer: An integer code representing the described Attribute type.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.TextureAttribute

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        // Using the TextureAttribute class, which inherits from Attribute.
        TextureAttribute attribute
        integer code = attribute:GetAttributeType(attribute:DIFFUSE_ALIAS)

        output "The type code for a diffuse TextureAttribute is " + code
    end
end

GetDepthTestValue()

A value used by OpenGL for depth testing. Mapping of near clipping plane to window coordinates, default value of 0.

Return

integer:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetType()

This action returns an integer code representing what type is stored in this Attribute. This can be compared against results from the GetAttributeType(text) action to more precisely determine what the meaning behind the code is.

Return

integer: An integer code representing this Attribute's type.

HashCode()

This action will return a hash code that identifies an Attribute by its type.

Return

integer:

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.ColorAttribute
use Libraries.Game.Graphics.Attribute
use Libraries.Game.Graphics.Color

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        // Using the ColorAttribute class, which inherits from Attribute.
        ColorAttribute attribute
        Color green
        green:SetColor(0, 1, 0, 1)
        attribute:SetAttribute(attribute:GetDiffuseValue(), green)

        output "The hash code for the attribute is " + attribute:GetHashCode()
    end
end

SetAttribute(integer setType)

SetAttribute will set data used by this Attribute. Note that most classes which inherit from Attribute will have their own implementations of SetAttribute which may require different parameters - e.g., to use SetAttribute in the ColorAttribute class, it requires both an integer type, but also a color. Most users should not use this action directly.

Parameters

  • integer setType: The type to set this Attribute to.