Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.cult3d
Class Cult

    java.lang.Object
      |
      +--com.cult3d.Cult

public final class Cult
extends java.lang.Object

This class provides a way to access static Cult3D utility methods.

Since:
  Cult3D 4.0

Field Summary
`static int` | `BACKGROUND_STRETCHED` This class variable is telling the setBackground method to strecth the background.
`static int` | `BACKGROUND_TILED` This class variable is telling the setBackground method to tile the background.

Method Summary
`static java.awt.Image` | `createImage(java.awt.Image image)` Creates a copy of the given Image that can be used for off-screen painting.
`static java.awt.Image` | `createImage(int width, int height)` Creates an empty TextureImage that can be used for off-screen painting.
`static java.awt.Image` | `getImage(java.lang.String imageName)` Extracts an Image resource from the Cult3D object.
`static boolean` | `isLoaded()` Checks if the Cult3D viewer has fully loaded the Cult3D object file.
`static void` | `resumeBlitting()` Resumes the blitting after a call to stopBlitting.
`static void` | `sendMessageToHost(java.lang.String msg)` Sends a message to a Cult3D object embedded in the same HTML page.
`static void` | `setBackground(Texture texture, int how)` Sets the given Texture as background, either stretched to fill the entire Cult3D Viewer window, or tiled.
`static void` | `showDocument(java.net.URL url)` Replaces the Web page currently being viewed with the given URL.
`static void` | `showDocument(java.net.URL url, java.lang.String target)` Requests that the browser shows the Web page indicated by the `url` argument.
`static void` | `stopBlitting()` Stops the blitter.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BACKGROUND_TILED

    public static final int BACKGROUND_TILED

  This class variable is telling the setBackground method to tile the background.
  See Also:
    `setBackground(Texture, int)`
  Since:
    Cult3D 5.3

### BACKGROUND_STRETCHED

    public static final int BACKGROUND_STRETCHED

  This class variable is telling the setBackground method to strecth the background.
  See Also:
    `setBackground(Texture, int)`
  Since:
    Cult3D 5.3

Method Detail

### getImage

    public static java.awt.Image getImage(java.lang.String imageName)

  Extracts an Image resource from the Cult3D object. The image must be included in the Cult3D Designer as a resource and must be in either gif or jpg/jpeg format.

  The given string is the name of the image resource and is equal to the file name of the original image, including the file extension. Observe that the identifier is case sensitive so make sure that it matches the original file name exactly. If an image resource with the given name can't be found, a NameNotFoundException will be thrown.

  The returned object is of the type java.awt.Image, but can safely be downcasted to a TextureImage. The downcasting is neccessary when using the Texture.setTexture() method to update a texture in the world.

  Parameters:
    `imageName` - The name of the image resource.
  Returns:
    A java.awt.Image (TextureImage) containing the image resource.
  Throws:
    NameNotFoundException - If no image resource included in the Cult3D object can be found that matches the given resource name.
  Since:
    Cult3D 4.0

### createImage

    public static java.awt.Image createImage(int width,
                                             int height)

  Creates an empty TextureImage that can be used for off-screen painting.

  The returned object is of the type java.awt.Image, but can safely be downcasted to a TextureImage. The downcasting is neccessary when using the Texture.setTexture() method to update a texture in the world.

  Parameters:
    `width` - The desired height of the Image
    `height` - the desired width of the Image
  Returns:
    An empty java.awt.Image (TextureImage).
  Since:
    Cult3D 4.0
  See Also:
    `TextureImage`

### createImage

    public static java.awt.Image createImage(java.awt.Image image)

  Creates a copy of the given Image that can be used for off-screen painting.

  The returned object is of the type java.awt.Image, but can safely be downcasted to a TextureImage. This is neccessary when using the Texture.setTexture() method to update a texture in the world.

  Parameters:
    `image` - the image to create a copy from.
  Since:
    Cult3D 4.0
  See Also:
    `TextureImage`

### isLoaded

    public static boolean isLoaded()

  Checks if the Cult3D viewer has fully loaded the Cult3D object file. Observe it only checks if all geometry and resources are loaded and that Java has started (not that Java has finished loading resources). Before the Cult3D object file is fully loaded, attempts to create Texture objects and to load resources such as images can block if the resource has not yet been loaded by the viewer.
  Returns:
    true if the viewer has finished loading.
  Since:
    Cult3D 4.0

### showDocument

    public static void showDocument(java.net.URL url)

  Replaces the Web page currently being viewed with the given URL.
  Parameters:
    `url` - an absolute URL giving the location of the document.
  Since:
    Cult3D 4.0

### showDocument

    public static void showDocument(java.net.URL url,
                                    java.lang.String target)

  Requests that the browser shows the Web page indicated by the `url` argument. The `target` argument indicates where to display the frame. The `target` is standard HTML target (for instance_self, _new)
  Parameters:
    `url` - an absolute URL giving the location of the document.
    `target` - a `String` indicating where to display the page (Standard html target name).
  Since:
    Cult3D 4.0

### stopBlitting

    public static void stopBlitting()

  Stops the blitter. Use this method when updating the state of the world in many steps, to avoid showing the world in an inconsistent state.

  The stopBlitting() method and the resumeBlitting() method should enclose the block of code that updates the world like in the following example:

        Cult.stopBlitting()
        // alter world state here
        Cult.resumeBlitting()

  Make sure that you synchronise calls to startBlitting() and stopBlitting() between different threads.
  Since:
    Cult3D 4.2
  See Also:
    `resumeBlitting()`

### resumeBlitting

    public static void resumeBlitting()

  Resumes the blitting after a call to stopBlitting. Note stopBlitting and resumeBlitting must be used in the same thread, and it is strongly recommened that when having a call to stopBlitting in a method also have resumeBlitting in the same method.
  Since:
    Cult3D 4.2
  See Also:
    `stopBlitting()`

### setBackground

    public static void setBackground(Texture texture,
                                     int how)

  Sets the given Texture as background, either stretched to fill the entire Cult3D Viewer window, or tiled.

  If changing the Texture used as background with Texture.setTexture(), this method must be called again for the update to be fully visible. If this is not done only the areas close to moving objects in the scene will be updated due to rendering optimizations.

  NOTE: Currently, it is only possible to create Texture objects that are mapped to polygons in the scene, and not from images included as resources. Therefor, it is neccessary to create a polygon in the 3D modeling tool of choice, and map the desired texture to it. Then it is possible to create a Texture object of that texture that can be used for the background. This polygon can be hidden for instance by placing it behind the used camera.

  Parameters:
    `texture` - the texture to set as background.
    `how` - Use the classvarible BACKGROUND_STRECTH and BACKGROUND_TILE.
  Since:
    Cult3D 4.2
  See Also:
    `BACKGROUND_TILED`, `BACKGROUND_STRETCHED`

### sendMessageToHost

    public static void sendMessageToHost(java.lang.String msg)

  Sends a message to a Cult3D object embedded in the same HTML page. Read the enclosed Cult3D Designer documentation/tutorial about how to get the sended message into a HTML Script language. (You can find the documentation in CULT3D_INSTALLATION_DIRECTORY\Docs)
  Parameters:
    `The` - string you want sent as a message
  Since:
    Cult3D 5.3

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD