Libraries.Game.Graphics.Attributes Documentation

The Attributes class represents a collection of individual Attribute objects. Each Attribute is used to describe a visual property of an object drawn in 3D space. The Attributes class is not usually used directly in the engine - the engine instead uses the Material and Environment classes, which inherit from Attributes, to handle different tasks.

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Containers.Array<Libraries.Game.Graphics.Attribute> array)This action will add an array of Attribute objects to this Attributes object.
Add(Libraries.Game.Graphics.Attributes attributes)This action will add all of the attribute objects stored in the given Attributes object to this Attributes object.
Add(Libraries.Game.Graphics.Attribute attribute)This action will add an Attribute to this Attributes object.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Disable(integer disableMask)This action will disable the given type (or multiple types, if combined using the Or operation of the BitwiseOperations class) in this Attributes object.
Empty()This action removes all Attribute objects from this Attributes object.
Enable(integer enableMask)This action will enable the given type (or multiple types, if combined using the Or operation of the BitwiseOperations class) in this Attributes object.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetAttribute(integer type)This action returns the Attribute stored within this Attributes object with the given type.
GetAttributeArray()This action returns the array of Attribute objects contained within this Attributes object.
GetHashCode()This action gets the hash code for an object.
GetMask()This action returns an integer mask containing the combined integer code values of each Attribute type present in this Attributes object.
GetSize()This action returns the number of Attribute objects that are currently part of this Attributes object.
GetTypeIndex(integer type)This action will identify the index of a given Attribute type.
HasAttribute(integer type)This action tests if the given Attribute type is currently a part of this Attributes object.
Remove(integer mask)This action will remove an Attribute of the given Attribute type from this Attributes object, or remove multiple Attribute objects if the integer code provided is the combined values of multiple Attribute types.

Actions Documentation

Add(Libraries.Containers.Array<Libraries.Game.Graphics.Attribute> array)

This action will add an array of Attribute objects to this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight
    use Libraries.Game.Graphics.Attribute

    class Main is Game

        Model sphere

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            sphere:LoadSphere(3, 3, 3, color:Orange())
            Add(sphere)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(0, -1, 1)
            Add(light)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = sphere:GetMaterials()

            integer counter = 0

            repeat while counter < materialsArray:GetSize()
                Material material = materialsArray:Get(counter)

                Array<Attribute> newAttributes

                ColorAttribute specularAttribute
                specular

Parameters

Add(Libraries.Game.Graphics.Attributes attributes)

This action will add all of the attribute objects stored in the given Attributes object to this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight
    use Libraries.Game.Graphics.Attributes

    class Main is Game

        Model sphere

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            sphere:LoadSphere(3, 3, 3, color:Orange())
            Add(sphere)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(0, -1, 1)
            Add(light)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = sphere:GetMaterials()

            integer counter = 0

            repeat while counter < materialsArray:GetSize()
                Material material = materialsArray:Get(counter)

                Attributes newAttributes

                ColorAttribute specularAttribute
                specular

Parameters

Add(Libraries.Game.Graphics.Attribute attribute)

This action will add an Attribute to this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        Model sphere

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            sphere:LoadSphere(3, 3, 3, color:Orange())
            Add(sphere)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(0, -1, 1)
            Add(light)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = sphere:GetMaterials()

            integer counter = 0

            repeat while counter < materialsArray:GetSize()
                Material material = materialsArray:Get(counter)

                ColorAttribute colorAttribute
                color

Parameters

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.

Example Code

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

Parameters

Return

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

Disable(integer disableMask)

This action will disable the given type (or multiple types, if combined using the Or operation of the BitwiseOperations class) in this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters

Empty()

This action removes all Attribute objects from this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0

            repeat while counter < materialsArray:GetSize()
                Material material = materialsArray:Get(counter)

                // This will remove all the Attribute objects being used by the Material.
                material:Empty()

                counter = counter + 1
            end
        end
    end

Enable(integer enableMask)

This action will enable the given type (or multiple types, if combined using the Or operation of the BitwiseOperations class) in this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetAttribute(integer type)

This action returns the Attribute stored within this Attributes object with the given type. If no such Attribute has been stored in this object, it will return undefined.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters

Return

Libraries.Game.Graphics.Attribute: An attribute of the requested type, or undefined if the Attribute wasn't contained in this object.

GetAttributeArray()

This action returns the array of Attribute objects contained within this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Game.Graphics.Attribute

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Return

Libraries.Containers.Array: An array containing each Attribute object stored by this object.

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.

GetMask()

This action returns an integer mask containing the combined integer code values of each Attribute type present in this Attributes object. The codes are combined using bitwise Or operations.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Compute.BitwiseOperations

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            BitwiseOperations bits
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Return

integer: An integer mask formed by using bitwise Or on all of the Attribute codes in this Attributes object.

GetSize()

This action returns the number of Attribute objects that are currently part of this Attributes object.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0

            repeat while counter < materialsArray:GetSize()
                Material material = materialsArray:Get(counter)

                output "Material " + counter + " has " + material:GetSize() + " attribute(s)."

                counter = counter + 1
            end
        end
    end

Return

integer: The number of Attribute objects contained in this object.

GetTypeIndex(integer type)

This action will identify the index of a given Attribute type. If the Attributes object does not currently have the given type, -1 will be returned.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array
    use Libraries.Game.Graphics.Attribute

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters

Return

integer: The index of the Attribute of the requested type, or -1 if there was none.

HasAttribute(integer type)

This action tests if the given Attribute type is currently a part of this Attributes object. A boolean value is returned based on the result.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters

Return

boolean: Whether or not this object contains an Attribute of the given type.

Remove(integer mask)

This action will remove an Attribute of the given Attribute type from this Attributes object, or remove multiple Attribute objects if the integer code provided is the combined values of multiple Attribute types.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Material
    use Libraries.Game.Graphics.ColorAttribute
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(1, 1, 1, color:Purple())
            Add(box)

            // The Material class inherits from Attributes. Whenever a user wants to
            // manipulate the attributes being used in a game, they will most likely
            // be working with a Material object.
            Array<Material> materialsArray = box:GetMaterials()

            output "The box is using " + materialsArray:GetSize() + " material(s)."

            integer counter = 0
            ColorAttribute colorAttribute

            // We store the Diffuse value from the ColorAttribute class. Each type
            // of attribute has a unique code that identifies the Attribute. This
            // particular code represents the Diffuse color attribute.
            integer diffuseValue = color

Parameters