Libraries.Game.Graphics.Material Documentation

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

Actions Documentation

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

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

Parameters

Example

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

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.

Parameters

Example

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

Add(Libraries.Game.Graphics.Attribute attribute)

This action will add an Attribute to this Attributes object.

Parameters

Example

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

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)

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.

Parameters

  • integer disableMask: An integer describing any number of Attribute objects to be disabled.

Example

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

Empty()

This action removes all Attribute objects from this Attributes object.

Example

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.

Parameters

  • integer enableMask: An integer describing any number of Attribute objects to be enabled.

Example

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

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

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.

Parameters

  • integer type: The integer identifier for the type of Attribute to return.

Return

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

Example

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

GetAttributeArray()

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

Return

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

Example

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

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()

GetID()

Return

text

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.

Return

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

Example

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

GetSize()

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

Return

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

Example

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

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.

Parameters

  • integer type: An integer value that identifies an Attribute type.

Return

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

Example

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

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.

Parameters

  • integer type: An integer code identifying a type of Attribute.

Return

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

Example

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

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.

Parameters

  • integer mask: An integer code representing any number of Attribute objects to remove.

Example

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

SetID(text newID)

Parameters

  • text newID