|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cult3d.Cult
This class provides a way to access static Cult3D utility methods.
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 |
public static final int BACKGROUND_TILED
setBackground(Texture, int)
public static final int BACKGROUND_STRETCHED
setBackground(Texture, int)
Method Detail |
public static java.awt.Image getImage(java.lang.String imageName)
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.
imageName
- The name of the image resource.public static java.awt.Image createImage(int width, int height)
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.
width
- The desired height of the Imageheight
- the desired width of the ImageTextureImage
public static java.awt.Image createImage(java.awt.Image image)
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.
image
- the image to create a copy from.TextureImage
public static boolean isLoaded()
public static void showDocument(java.net.URL url)
url
- an absolute URL giving the location of the document.public static void showDocument(java.net.URL url, java.lang.String target)
url
argument. The
target
argument indicates where to display the frame.
The target
is standard HTML target (for instance_self, _new)url
- an absolute URL giving the location of the document.target
- a String
indicating where to display
the page (Standard html target name).public static void stopBlitting()
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.resumeBlitting()
public static void resumeBlitting()
stopBlitting()
public static void setBackground(Texture texture, int how)
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.
texture
- the texture to set as background.how
- Use the classvarible BACKGROUND_STRECTH and BACKGROUND_TILE.BACKGROUND_TILED
,
BACKGROUND_STRETCHED
public static void sendMessageToHost(java.lang.String msg)
The
- string you want sent as a message
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |