Libraries.Game.Graphics.Skybox Documentation

Inherits from: Libraries.Language.Object

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)

Dispose()

This action releases all the memory used to store the Skybox's texture. Once this has been called, it won't be initialized anymore, so it will need to be loaded again to be used.

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)

GetBackFile()

This action returns the file that was used to load the back side of the skybox.

Return

Libraries.System.File:

GetBottomFile()

This action returns the file that was used to load the bottom side of the skybox.

Return

Libraries.System.File:

GetFrontFile()

This action returns the file that was used to load the front side of the skybox.

Return

Libraries.System.File:

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

GetLeftFile()

This action returns the file that was used to load the left side of the skybox.

Return

Libraries.System.File:

GetRightFile()

This action returns the file that was used to load the right side of the skybox.

Return

Libraries.System.File:

GetTopFile()

This action returns the file that was used to load the top side of the skybox.

Return

Libraries.System.File:

InvertSkybox(boolean invert)

The InvertSkybox action sets whether or not the images of the Skybox should be inverted when used. If this is true, images will appear to be flipped around the y-axis (or in other words, appear to be drawn backwards). If this is set to false, then the images will appear to be drawn in the correct direction, but the left image will appear on the right, and the right image will appear on the left. By default, this value is set to true.

Parameters

  • boolean invert: Whether or not the Skybox should be inverted.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "Skybox" containing our six images.
        skybox:Load("Skybox/right.jpg", "Skybox/left.jpg", "Skybox/top.jpg", "Skybox/bottom.jpg", "Skybox/front.jpg", "Skybox/back.jpg")
        skybox:InvertSkybox(false)
        SetSkybox(skybox)
    end
end

IsInverted()

This action returns whether or not the images of the Skybox are currently inverted. This will cause them to appear to be drawn backwards. By default, Skyboxes are inverted, so this will return true. This can be disabled or enabled using the InvertSkybox action.

Return

boolean: Whether or not the Skybox is inverted. This is true by default.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "Skybox" containing our six images.
        skybox:Load("Skybox/right.jpg", "Skybox/left.jpg", "Skybox/top.jpg", "Skybox/bottom.jpg", "Skybox/front.jpg", "Skybox/back.jpg")
        SetSkybox(skybox)
        
        boolean inverted = skybox:IsInverted()
        output "Is the Skybox inverted? " + inverted
    end
end

IsLoaded()

Whether this Skybox has been loaded or not yet. On most platforms, this is true immediately after calling the Load action. On the web, this is true at some point in time after Load is called, due to the nature of how image loading is handled during online execution.

Return

boolean:

Load(Libraries.System.File right, Libraries.System.File left, Libraries.System.File up, Libraries.System.File down, Libraries.System.File forward, Libraries.System.File back)

The Load action loads all six sides of the Skybox. It takes six files as parameters, which represent the images that form the right, left, top, bottom, front, and back sides of the Skybox, respectively.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        right:SetPath("Skybox/right.jpg")
        File left
        left:SetPath("Skybox/left.jpg")
        File top
        top:SetPath("Skybox/top.jpg")
        File bottom
        bottom:SetPath("Skybox/bottom.jpg")
        File front
        front:SetPath("Skybox/front.jpg")
        File back
        back:SetPath("Skybox/back.jpg")
        skybox:Load(right, left, top, bottom, front, back)
        SetSkybox(skybox)
    end
end

Load(text right, text left, text up, text down, text forward, text back)

The Load action loads all six sides of the Skybox. It takes six text parameters, which are the the file paths from the default working directory for images comprising the right, left, top, bottom, front, and back sides of the Skybox, respectively.

Parameters

  • text right: The file path to an image representing the right side of the skybox.
  • text left: The file path to an image representing the left side of the skybox.
  • text up: The file path to an image representing the top of the skybox.
  • text down: The file path to an image representing the bottom of the skybox.
  • text forward: The file path to an image representing the front of the skybox.
  • text back: The file path to an image representing the back of the skybox.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadBack(Libraries.System.File image)

This action loads the back of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadBack(text fileName)

This action loads the back of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadBottom(Libraries.System.File image)

This action loads the bottom of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadBottom(text fileName)

This action loads the bottom of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadFront(Libraries.System.File image)

This action loads the front of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadFront(text fileName)

This action loads the front of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadLeft(text fileName)

This action loads the left side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadLeft(Libraries.System.File image)

This action loads the left side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadRight(text fileName)

This action loads the right side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

LoadRight(Libraries.System.File image)

This action loads the right side of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadTop(Libraries.System.File image)

This action loads the top of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.System.File

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        File right
        File left
        File top
        File bottom
        File front
        File back
        right:SetPath("Skybox/right.jpg")
        left:SetPath("Skybox/left.jpg")
        top:SetPath("Skybox/top.jpg")
        bottom:SetPath("Skybox/bottom.jpg")
        front:SetPath("Skybox/front.jpg")
        back:SetPath("Skybox/back.jpg")

        skybox:LoadRight(right)
        skybox:LoadLeft(left)
        skybox:LoadTop(top)
        skybox:LoadBottom(bottom)
        skybox:LoadFront(front)
        skybox:LoadBack(back)
        SetSkybox(skybox)
    end
end

LoadTop(text fileName)

This action loads the top of the Skybox. Note that all six sides of the Skybox must be loaded before it can be used. Attempting to use a Skybox without loading all six sides will throw an error.

Parameters

  • text fileName: The path from the default working directory to an image file.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:LoadRight("Skybox/right.jpg")
        skybox:LoadLeft("Skybox/left.jpg")
        skybox:LoadTop("Skybox/top.jpg")
        skybox:LoadBottom("Skybox/bottom.jpg")
        skybox:LoadFront("Skybox/front.jpg")
        skybox:LoadBack("Skybox/back.jpg")
        SetSkybox(skybox)
    end
end

Rotate(number x, number y, number z, number degrees)

This action will rotate the Skybox about an axis represented by the given numbers. The axis is essentially a ray that starts at the center of the Skybox and points in the direction of the provided x, y, and z values. The Skybox will then rotate clockwise around that ray. The Skybox will be rotated by an angle given in degrees.

Parameters

  • number x: How far the ray points along the x-axis.
  • number y: How far the ray points along the y-axis.
  • number z: How far the ray points along the z-axis.
  • number degrees: How many degrees to rotate (clockwise).

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    Skybox skybox

    action Main
        StartGame()
    end

    action CreateGame
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
        SetSkybox(skybox)
    end

    action Update(number seconds)
        // The Skybox will rotate around the y-axis at a rate of 2 degrees per second.
        skybox:Rotate(0, 1, 0, 2 * seconds)
    end
end

Rotate(Libraries.Compute.Vector3 axis, number degrees)

This action will rotate the Skybox about an axis represented by the given Vector3. The axis is essentially a ray that starts at the center of the Skybox and points outward. The Skybox will then rotate clockwise around that ray. The Skybox will be rotated by an angle given in degrees.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.Compute.Vector3

class Main is Game

    Skybox skybox
    Vector3 axis

    action Main
        StartGame()
    end

    action CreateGame
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
        SetSkybox(skybox)

        axis:Set(0, 1, 0)
    end

    action Update(number seconds)
        // The Skybox will rotate around the axis at a rate of 2 degrees per second.
        skybox:Rotate(axis, 2 * seconds)
    end
end

SetToRotation(Libraries.Compute.Vector3 axis, number degrees)

The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it. The rotation is measured as a number of degrees rotated clockwise around the given axis. The axis is essentially a ray that begins in the center of the Skybox and extends outward.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox
use Libraries.Compute.Vector3

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
        SetSkybox(skybox)

        Vector3 axis
        axis:Set(0, 1, 0)
        skybox:SetToRotation(axis, 90)
    end
end

SetToRotation(number x, number y, number z, number degrees)

The SetToRotation action will rotate the Skybox from its base orientation, ignoring any previous rotations that have been applied to it. The rotation is measured as a number of degrees rotated clockwise around the given axis. The axis is essentially a ray that begins in the center of the Skybox and extends outward.

Parameters

  • number x: How far the ray points along the x-axis.
  • number y: How far the ray points along the y-axis.
  • number z: How far the ray points along the z-axis.
  • number degrees: The number of degrees to rotate the Skybox.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Skybox

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        Skybox skybox
        // Assuming we have a folder named "skybox" containing our six images.
        skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
        SetSkybox(skybox)

        skybox:SetToRotation(0, 1, 0, 90)
    end
end