Libraries.Game.Graphics.Attribute Documentation

The Attribute class represents a single visual property that is to be used during 3D rendering. Each Attribute contains data that describes how to handle a step during the rendering process. The base Attribute class can not be instantiated directly, but there are many classes that inherit from it, such as the ColorAttribute and TextureAttribute classes.

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
integer typeAn integer code that describes a specific type of Attribute.

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Copy()This action will return a copy of this Attribute.
Equals(Libraries.Game.Graphics.Attribute other)This action will test to see if two Attributes are of the same type.
Equals(Libraries.Language.Object object)This action determines if the given object is equal to this Attribute.
GetAttributeAlias(integer type)GetAttributeAlias will take an integer code for a particular type of Attribute and return a text alias representing that type.
GetAttributeType(text alias)GetAttributeType will take a text alias for a particular type of Attribute and return an integer code representing that type.
GetHashCode()This action gets the hash code for an object.
HashCode()This action will return a hash code that identifies an Attribute by its type.
SetAttribute(integer setType)SetAttribute will set data used by this Attribute.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Copy()

This action will return a copy of this Attribute.

Example Code

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)

            Attribute copiedAttribute = attribute:Copy()
        end
    end

Return

Libraries.Game.Graphics.Attribute: A copy of this 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.

Example Code

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

Parameters

Return

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

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.

Example Code

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

Parameters

Return

text: A text alias representing the described Attribute type.

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.

Example Code

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

Parameters

Return

integer: An integer code representing the described Attribute type.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

HashCode()

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

Example Code

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

Return

integer:

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