Jazz3D API


com.sygem.jazz3d3
Class World

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.sygem.jazz3d3.World
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.image.ImageProducer, java.awt.MenuContainer, java.io.Serializable

public class World
extends java.awt.Canvas
implements java.awt.image.ImageProducer

The World class acts as a container for all objects in the Jazz3D package. All operations on objects and lights can be done through the world.

The World is created just like any other AWT component, but from an Applet, it must be passed an Applet in the constructor. For example:

World my_world = new World(); // or World(this) for an Applet
add(my_world);

Version:
3.0a
Author:
SyGem Software
See Also:
Serialized Form

Field Summary
static int POLYGON_COLLISION
          Field used to set the Camera collision mode to be polygon accurate.
static int RETURN_EMPTY_OBJECT
          Sets Jazz3D to return a blank object if an object is not found.
static int RETURN_NULL
          Sets Jazz3D to return NULL if an object is not found.
static int SPHERE_COLLISION
          Field used to set the Camera collision mode to bounding spheres.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
World()
          Default constructor.
World(java.applet.Applet app)
          Applet-based Constructor.
 
Method Summary
 void addConsumer(java.awt.image.ImageConsumer newIC)
           
 int addLight(Light l)
          Adds a single light to the world.
 int addObject(Object3d obj)
          This links an Object3d with the world.
 void deleteAllObjects()
          As the name suggests - it deletes all the objects currently added to the world.
 void deleteObject(int objectid)
          Deletes a single object from the world.
 void deleteObject(java.lang.String objectName)
          Deletes a single object from the world.
 void destroy()
          Cleans up all resources associated with the World.
 void drawImage()
          Places the internal image buffer on the actual canvas.
 void enableTransparentObjects()
          Enables transparent object rendering.
 void finishCanvas()
          Finalizes the display.
 void generateImage()
          Renders the world display to the internal buffers.
 Object3d[] getAllParentObjects()
          Obtain an array containing all parent objects.
 Camera3d getCamera()
          Returns the currently active camera.
 int getCameraCollisionMode()
          Gets the Camera collision mode.
 java.awt.Graphics getCanvas()
          Returns the current graphics canvas.
 java.awt.image.ImageConsumer getConsumer()
           
static ResourceLoader getFontResourceLoader()
          Gets the resource loader being used for Fonts.
 int[] getImage()
          Enables VisiMagik to get a copy of the internal image buffer.
static ResourceLoader getImageResourceLoader()
          Gets the resource loader being used for Images.
 Light getLight(int lightid)
          Obtain a reference to a Light source.
static ResourceLoader getModelResourceLoader()
          Gets the resource loader being used for Models.
 Object3d getObject(int pid)
          Obtain a handle on any object.
 Object3d getObject(java.lang.String qname)
          Obtain a handle on any object.
 Object3d getParentObject(int objid)
          Obtain a handle on a parent object.
 Object3d getParentObject(java.lang.String qname)
          Obtain a handle on an parent object.
 java.lang.String getVersion()
          Returns a version-identifier String.
 boolean isConsumer(java.awt.image.ImageConsumer i)
           
 java.awt.Dimension minimumSize()
          Sets the minimum size of the component
 boolean pick(Vertex start, Vertex end, int objectid)
          Performs ray-polygon collision detection against a given object.
 boolean pickClosest(int x, int y)
          Finds the closest polygon to a given point on screen.
 boolean pickClosest(Vertex start, Vertex end)
          Performs ray-polygon collision detection against all objects.
 boolean pickClosest(Vertex start, Vertex end, int objectid)
          Performs ray-polygon collision detection against a given object.
 java.awt.Dimension preferredSize()
          Sets the preferred size of the component
 void prep()
          This method must be called before you begin drawing the world.
 void prepareCanvas()
          Clears the graphic display & z-buffer, ready for drawing on
 void prepNewObjects()
          This method must be called after any new objects have been added to the world.
 void redraw()
          Forces Jazz3D to redraw all objects, and display the result on the world canvas.
 void removeConsumer(java.awt.image.ImageConsumer i)
           
 void requestTopDownLeftRightResend(java.awt.image.ImageConsumer i)
           
 void reshape(int x, int y, int w, int h)
          Resizes the World component.
 void resume()
          Wakes Jazz3D up.
 void setAmbientColour(int r, int g, int b)
          Sets the ambient colour of all objects to the specified colour.
 void setAntiAliasing(boolean aa)
          Enables Anti-Aliasing.
 void setBackground(java.lang.String filename)
          Loads an image and sets it as the background for the world.
 void setBackground(Texture tx)
          Sets the background of the canvas to a loaded Texture.
 void setBackgroundColour(int r, int g, int b)
          Sets the background colour of the world canvas.
 void setBilinear(boolean bb)
          Enables Bilinear filtering.
 void setBoundingBoxes(boolean boxes)
          Sets Jazz3D up to use bounding boxes for object culling.
 void setCamera(Camera3d c)
          Sets the currently active camera.
 void setCameraCollisionMode(int colMode)
          Sets the Camera collision mode.
 void setCameraRadius(double cameraSize)
          Collision detection - sets the size of the camera.
 void setDelay(int new_delay)
          Used to set the time Jazz3D waits between drawing each frame.
 void setDomainRegCode(java.lang.String regcode)
          Attempts to register Jazz3D against the domain it is running on.
 void setFog(boolean fogOn)
          Turns the fog on or off.
 void setFogColour(int r, int g, int b)
          Set the colour of the fog.
 void setFogEnd(double fogEnd)
          Set the distance from the camera at which the fog becomes most dense.
 void setFogStart(double fogStart)
          Set the distance from the camera at which the fog starts.
static void setFontResourceLoader(ResourceLoader loader)
          Sets the resource loader to use for Fonts.
 void setGetObjectBehaviour(int behaviour)
          Set the behaviour when an object is not found by a Get request.
 void setHitherYon(double hither, double yon)
          Sets the z range for drawing.
 void setImage(int[] buffer)
          Enables VisiMagik to set the internal image buffer after it has been modified.
static void setImageResourceLoader(ResourceLoader loader)
          Sets the resource loader to use for Images.
static void setModelResourceLoader(ResourceLoader loader)
          Sets the resource loader to use for Models.
 void setPanoramicBackground(java.lang.String filename)
          Loads an image and sets it as the background for the world.
 void setPanoramicBackground(Texture tx)
          Sets the background of the canvas to a loaded Texture.
 void setRegCode(java.lang.String regcode)
          Attempts to register Jazz3D.
 void setTiledBackground(java.lang.String filename)
          Loads an image and sets it as the background for the world.
 void setTiledBackground(Texture tx)
          Sets the background of the canvas to a loaded Texture.
 void shiftBgDown(int amount)
          Shifts the background image down.
 void shiftBgLeft(int amount)
          Shifts the background image to the left.
 void shiftBgRight(int amount)
          Shifts the background image to the right.
 void shiftBgUp(int amount)
          Shifts the background image up.
 void shiftPanoramicBackground(int x, int y)
          Set the position of the panoramic background.
 void startProduction(java.awt.image.ImageConsumer theIC)
           
 void suspend()
          Sends Jazz3D to sleep.
 boolean testCameraCollision(int objectid)
          Collision detection - tests if the camera is in collision with an object.
 int[] testCameraCollisionAll()
          Collision detection - tests if the camera is in collision with any objects.
 boolean testCollision(int objectid1, int objectid2)
          Collision detection - detect for collisions between 2 objects.
 int[] testCollisionAll(int objectid)
          Collision detection - detect for collisions between 1 object and every other object.
 void updateBackgroundImage()
          Updates the background image! This would normally only be called if you are using dynamic textures as your background - you will need to call this to get your backgrounds updated.
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext, paint
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RETURN_NULL

public static final int RETURN_NULL
Sets Jazz3D to return NULL if an object is not found.

RETURN_EMPTY_OBJECT

public static final int RETURN_EMPTY_OBJECT
Sets Jazz3D to return a blank object if an object is not found.

NOTE: This is the default behaviour.


SPHERE_COLLISION

public static final int SPHERE_COLLISION
Field used to set the Camera collision mode to bounding spheres. This is the default option/

POLYGON_COLLISION

public static final int POLYGON_COLLISION
Field used to set the Camera collision mode to be polygon accurate.
Constructor Detail

World

public World(java.applet.Applet app)
Applet-based Constructor.
Parameters:
app - An Applet - usually 'this' when called from within an applet.

World

public World()
Default constructor. This should be used when you are creating Applications, rather than Applets.
Method Detail

getVersion

public final java.lang.String getVersion()
Returns a version-identifier String.

destroy

public final void destroy()
Cleans up all resources associated with the World.

setRegCode

public void setRegCode(java.lang.String regcode)
Attempts to register Jazz3D. If the parameter is a valid registration code, (and a domain code has been entered if necessary), no messages will obscure your 3D world.
Parameters:
regcode - A Jazz3D registration code
See Also:
setDomainRegCode(java.lang.String)

setDomainRegCode

public void setDomainRegCode(java.lang.String regcode)
Attempts to register Jazz3D against the domain it is running on. This method can be called multiple times from a single applet, so your applet doesn't need to be re-written for different domains. Domain codes are available from our website, priced just $10 each.
Parameters:
regcode - A Jazz3D domain registration code
See Also:
setRegCode(java.lang.String)

minimumSize

public final java.awt.Dimension minimumSize()
Sets the minimum size of the component
Overrides:
minimumSize in class java.awt.Component

preferredSize

public final java.awt.Dimension preferredSize()
Sets the preferred size of the component
Overrides:
preferredSize in class java.awt.Component

setDelay

public final void setDelay(int new_delay)
Used to set the time Jazz3D waits between drawing each frame. The time is specified in milliseconds. The lower the delay, the faster Jazz3D will appear to run. Beware that using very low values could cause other applications to become unresponsive as Jazz3D takes all of the processing power available.
Parameters:
delay - The number of milliseconds to wait between drawing each frame.

prep

public final void prep()
This method must be called before you begin drawing the world. It should be called from the applet's run() method (or any method called from there).

prepNewObjects

public final void prepNewObjects()
This method must be called after any new objects have been added to the world. If it is not called, the objects may not be drawn, or may be drawn incorrectly.

reshape

public final void reshape(int x,
                          int y,
                          int w,
                          int h)
Resizes the World component. This will automatically adjust the size that the world is drawn at.
Overrides:
reshape in class java.awt.Component

addObject

public final int addObject(Object3d obj)
This links an Object3d with the world.
Parameters:
object - The object to be added to the world
Returns:
An integer which can be used later to reference this object. If the returned value is negative, then an error occured.
See Also:
Object3d

enableTransparentObjects

public final void enableTransparentObjects()
Enables transparent object rendering. This method MUST be called if you are using the RenderTransparent renderer.
See Also:
RenderTransparent

deleteAllObjects

public final void deleteAllObjects()
As the name suggests - it deletes all the objects currently added to the world.

BEWARE: There is no undo for this...

See Also:
deleteObject(int)

deleteObject

public final void deleteObject(int objectid)
Deletes a single object from the world.

BEWARE: There is no undo for this...

Parameters:
objectid - The objectid of the object - as returned by addObject()
See Also:
deleteAllObjects(), addObject(Object3d)

deleteObject

public final void deleteObject(java.lang.String objectName)
Deletes a single object from the world.

BEWARE: There is no undo for this...

Parameters:
objectName - The name of the object - as set by Object3d.setName()
See Also:
deleteAllObjects(), deleteObject(int), Object3d.setName(java.lang.String)

setGetObjectBehaviour

public final void setGetObjectBehaviour(int behaviour)
Set the behaviour when an object is not found by a Get request.
Parameters:
behaviour - The behaviour to apply
See Also:
RETURN_NULL, RETURN_EMPTY_OBJECT

getObject

public final Object3d getObject(int pid)
Obtain a handle on any object. This allows you to modify any object which has been added to the World, including sub-objects.
Parameters:
objid - An id as returned by addChild()
See Also:
Object3d.addChild(com.sygem.jazz3d3.Object3d, double, double, double), getParentObject(int), getObject(String)

getParentObject

public final Object3d getParentObject(int objid)
Obtain a handle on a parent object. This allows you to modify any object which has been added directly to the World. It will not allow you to access any sub-objects.
Parameters:
objid - An id as returned by addObject()
See Also:
getParentObject(String), getObject(int)

getObject

public final Object3d getObject(java.lang.String qname)
Obtain a handle on any object. This allows you to modify any object which has been added to the World, including sub-objects.
Parameters:
qname - The name of the object
See Also:
Object3d.setName(java.lang.String), Object3d.addChild(com.sygem.jazz3d3.Object3d, double, double, double), getParentObject(String), getObject(int)

getParentObject

public final Object3d getParentObject(java.lang.String qname)
Obtain a handle on an parent object. This allows you to modify any object which has been added directly to the World. It will not allow you to access any sub-objects.
Parameters:
qname - The name of the parent object
See Also:
Object3d.setName(java.lang.String), getParentObject(int), getObject(String)

getAllParentObjects

public final Object3d[] getAllParentObjects()
Obtain an array containing all parent objects. This allows you to modify every object which has been added directly to the World. It will not allow you to access any sub-objects.
See Also:
getParentObject(int), getObject(String), Object3d.getChildObjects()

getLight

public final Light getLight(int lightid)
Obtain a reference to a Light source.
Parameters:
lightid - The id of the light source
See Also:
addLight(com.sygem.jazz3d3.Light)

addLight

public final int addLight(Light l)
Adds a single light to the world. This can be any kind of light supported by Jazz3D.
Parameters:
l - a Light object
Returns:
An integer which can be used later to reference this light
See Also:
Light, Lightpoint, Lightspot

setAmbientColour

public final void setAmbientColour(int r,
                                   int g,
                                   int b)
Sets the ambient colour of all objects to the specified colour. The ambient colour can be thought of as the colour the object will appear if there is no light falling on it.
Parameters:
r - The red value of the colour. Ranges between 0 and 255.
g - The green value of the colour. Ranges between 0 and 255.
b - The blue value of the colour. Ranges between 0 and 255.
See Also:
addObject(Object3d), Object3d.setAmbientColour(int, int, int)

setBoundingBoxes

public final void setBoundingBoxes(boolean boxes)
Sets Jazz3D up to use bounding boxes for object culling. This can speed up program execution quite considerably if you have a lot of objects which are not visible at any one time.
Parameters:
boxes - Use 'true' for turning boxes on, and 'false' to turn them off again.

updateBackgroundImage

public final void updateBackgroundImage()
Updates the background image! This would normally only be called if you are using dynamic textures as your background - you will need to call this to get your backgrounds updated.

setBackgroundColour

public final void setBackgroundColour(int r,
                                      int g,
                                      int b)
Sets the background colour of the world canvas.
Parameters:
r - The red value of the colour. Ranges between 0 and 255.
g - The green value of the colour. Ranges between 0 and 255.
b - The blue value of the colour. Ranges between 0 and 255.

setBackground

public final void setBackground(java.lang.String filename)
Loads an image and sets it as the background for the world. The image will be stretched to fit the world canvas.
Parameters:
filename - A string, containing the location of the image. This can be either a full URL or relative to the applet location.
See Also:
shiftBgLeft(int), shiftBgRight(int), shiftBgUp(int), shiftBgDown(int)

setBackground

public final void setBackground(Texture tx)
Sets the background of the canvas to a loaded Texture.
Parameters:
tx - A Texture, as loaded previously by the TextureLoader.
See Also:
shiftBgLeft(int), shiftBgRight(int), shiftBgUp(int), shiftBgDown(int), TextureLoader

setTiledBackground

public final void setTiledBackground(java.lang.String filename)
Loads an image and sets it as the background for the world. The image will be tiled on the world canvas.
Parameters:
filename - A string, containing the location of the image. This can be either a full URL or relative to the applet location.
See Also:
shiftBgLeft(int), shiftBgRight(int), shiftBgUp(int), shiftBgDown(int)

setTiledBackground

public final void setTiledBackground(Texture tx)
Sets the background of the canvas to a loaded Texture. The image will be tiled on the world canvas.
Parameters:
tex - A texture, as loaded previously by the TextureLoader.
See Also:
TextureLoader, shiftBgLeft(int), shiftBgRight(int), shiftBgUp(int), shiftBgDown(int)

setPanoramicBackground

public final void setPanoramicBackground(java.lang.String filename)
Loads an image and sets it as the background for the world. The image will be tiled if it is smaller than the world canvas. If not, this image will not be altered - and can be moved around.
Parameters:
filename - A string, containing the location of the image. This can be either a full URL or relative to the applet location.
See Also:
shiftPanoramicBackground(int, int)

setPanoramicBackground

public final void setPanoramicBackground(Texture tx)
Sets the background of the canvas to a loaded Texture. The image will be tiled if it is smaller than the world canvas. If not, this image will not be altered - and can be moved around.
Parameters:
tex - A texture, as loaded previously by the TextureLoader.
See Also:
shiftPanoramicBackground(int, int), TextureLoader

shiftPanoramicBackground

public final void shiftPanoramicBackground(int x,
                                           int y)
Set the position of the panoramic background. The position is relative to the top left corner of the original image. The x and y values can wrap around, so if you specify a large value, it will handle it.
Parameters:
x - The x position to start displaying the background
y - The y position to start displaying the background
See Also:
setPanoramicBackground(Texture)

shiftBgLeft

public final void shiftBgLeft(int amount)
Shifts the background image to the left.
Parameters:
amount - The number of pixels to shift the image by.
See Also:
shiftBgRight(int), shiftBgUp(int), shiftBgDown(int)

shiftBgRight

public final void shiftBgRight(int amount)
Shifts the background image to the right.
Parameters:
amount - The number of pixels to shift the image by.
See Also:
shiftBgLeft(int), shiftBgUp(int), shiftBgDown(int)

shiftBgUp

public final void shiftBgUp(int amount)
Shifts the background image up.
Parameters:
amount - The number of pixels to shift the image by.
See Also:
shiftBgLeft(int), shiftBgRight(int), shiftBgDown(int)

shiftBgDown

public final void shiftBgDown(int amount)
Shifts the background image down.
Parameters:
amount - The number of pixels to shift the image by.
See Also:
shiftBgLeft(int), shiftBgRight(int), shiftBgUp(int)

redraw

public final void redraw()
Forces Jazz3D to redraw all objects, and display the result on the world canvas.
See Also:
prepareCanvas(), generateImage(), drawImage(), finishCanvas()

prepareCanvas

public final void prepareCanvas()
Clears the graphic display & z-buffer, ready for drawing on
See Also:
generateImage(), drawImage(), finishCanvas()

generateImage

public final void generateImage()
Renders the world display to the internal buffers. After this step, VisiMagik can be invoked on the rendered display.
See Also:
prepareCanvas(), drawImage(), finishCanvas()

drawImage

public final void drawImage()
Places the internal image buffer on the actual canvas. After this step, the canvas can be drawn on using standard AWT routines.
See Also:
prepareCanvas(), generateImage(), finishCanvas()

finishCanvas

public final void finishCanvas()
Finalizes the display. Performs the double-buffering needed to give a stable image.
See Also:
prepareCanvas(), generateImage(), drawImage()

getCanvas

public final java.awt.Graphics getCanvas()
Returns the current graphics canvas. This is then suitable for drawing on using standard AWT graphics methods.
Returns:
The current Graphics context

getImage

public final int[] getImage()
Enables VisiMagik to get a copy of the internal image buffer.
Returns:
An array of integers, for use with VisiMagik.
See Also:
Visimagik

setImage

public final void setImage(int[] buffer)
Enables VisiMagik to set the internal image buffer after it has been modified.
Parameters:
buffer - An array of integers, from VisiMagik.
See Also:
Visimagik

setFog

public final void setFog(boolean fogOn)
Turns the fog on or off.

Note that fogging is off by default.

Parameters:
fogOn - A boolean, 'true' turns the fog on, and 'false' turns it off.

setFogColour

public final void setFogColour(int r,
                               int g,
                               int b)
Set the colour of the fog. This will be the colour when the fog is at its most dense.
Parameters:
r - The red value of the colour. Ranges between 0 and 255.
g - The green value of the colour. Ranges between 0 and 255.
b - The blue value of the colour. Ranges between 0 and 255.

setFogStart

public final void setFogStart(double fogStart)
Set the distance from the camera at which the fog starts.
Parameters:
fogStart - The distance from the camera to start fogging

setFogEnd

public final void setFogEnd(double fogEnd)
Set the distance from the camera at which the fog becomes most dense.
Parameters:
fogEnd - The distance from the camera to end fogging

setAntiAliasing

public final void setAntiAliasing(boolean aa)
Enables Anti-Aliasing. At present, Anti-Aliasing is only implemented as a simple blur filter.
Parameters:
aa - True if anti-aliasing is to be used, and false if not

setBilinear

public final void setBilinear(boolean bb)
Enables Bilinear filtering. This will only have an effect if you are using one of the High Quality Textured renderers.
Parameters:
bb - True if bilinear filtering is to be used, and false if not
See Also:
RenderTexturedHQ

setHitherYon

public final void setHitherYon(double hither,
                               double yon)
Sets the z range for drawing. No pixels are drawn if they fall outside this range. The hither plane is the one nearest the camera, and is usually set to zero. Interesting things happen when this is non-zero. The yon plane is way over there... Into the screen. It allows you to avoid drawing objects which are too far away to be seen.
Parameters:
hither - A double, specifying the near camera plane.
yon - A double, specifying the far camera plane.

setCamera

public final void setCamera(Camera3d c)
Sets the currently active camera.
Parameters:
c - A camera3d object.
See Also:
Camera3d

getCamera

public final Camera3d getCamera()
Returns the currently active camera.
Returns:
A Camera3d object
See Also:
Camera3d

setCameraCollisionMode

public final void setCameraCollisionMode(int colMode)
Sets the Camera collision mode.
Parameters:
colMode - One of the field SPHERE_COLLISION or POLYGON_COLLISION
See Also:
SPHERE_COLLISION, POLYGON_COLLISION

getCameraCollisionMode

public final int getCameraCollisionMode()
Gets the Camera collision mode.
Returns:
The Camera collision mode - either SPHERE_COLLISION or POLYGON_COLLISION
See Also:
SPHERE_COLLISION, POLYGON_COLLISION

testCollision

public final boolean testCollision(int objectid1,
                                   int objectid2)
Collision detection - detect for collisions between 2 objects. Given the 2 objectids, this will perform bounding sphere collision detection between them.

Note that this does not check any sub-objects - you will need to test those explicitly.

Parameters:
objectid1 - An integer as returned by addObject()
objectid2 - An integer as returned by addObject()
Returns:
True if the objects are in collision, and false if they are not.
See Also:
addObject(com.sygem.jazz3d3.Object3d), testCollisionAll(int)

testCollisionAll

public final int[] testCollisionAll(int objectid)
Collision detection - detect for collisions between 1 object and every other object. Given an objectid, this will perform bounding sphere collision detection between the object and every other object in the world.

Again it should be noted that these tests do not involve sub-objects.

Parameters:
objectid - An integer as returned by addObject()
Returns:
An array containing all the objects in collision with the tested one.
See Also:
addObject(com.sygem.jazz3d3.Object3d), testCollision(int, int)

testCameraCollision

public final boolean testCameraCollision(int objectid)
Collision detection - tests if the camera is in collision with an object.
Parameters:
objectid - An integer as returned by addObject()
Returns:
True if the object and camera are in collision, and false if they are not.
See Also:
addObject(com.sygem.jazz3d3.Object3d), testCameraCollisionAll()

testCameraCollisionAll

public final int[] testCameraCollisionAll()
Collision detection - tests if the camera is in collision with any objects.
Returns:
An array containing all the objects in collision with the tested one.
See Also:
testCameraCollision(int)

setCameraRadius

public final void setCameraRadius(double cameraSize)
Collision detection - sets the size of the camera.
Parameters:
cameraSize - The new size of the camera
See Also:
testCameraCollision(int)

pick

public final boolean pick(Vertex start,
                          Vertex end,
                          int objectid)
Performs ray-polygon collision detection against a given object. A ray is cast from start to end, and tests each polygon in the specified object for a collision. If a collision occurs, then this will return True, and the HitPoint class will contain details of the collision.
Parameters:
start - The starting Vertex of the ray
end - The ending Vertex of the ray
objectid - The id of an object
See Also:
HitPoint, Object3d.getID(), addObject(com.sygem.jazz3d3.Object3d)

pickClosest

public final boolean pickClosest(Vertex start,
                                 Vertex end,
                                 int objectid)
Performs ray-polygon collision detection against a given object. A ray is cast from start to end, and tests each polygon in the specified object for a collision. If a collision occurs, then this will return True, and the HitPoint class will contain details of the collision. The details of the closest collision are recorded.
Parameters:
start - The starting Vertex of the ray
end - The ending Vertex of the ray
objectid - The id of an object
See Also:
HitPoint, Object3d.getID(), addObject(com.sygem.jazz3d3.Object3d)

pickClosest

public final boolean pickClosest(Vertex start,
                                 Vertex end)
Performs ray-polygon collision detection against all objects. A ray is cast from start to end, and tests each polygon in each object for a collision. If a collision occurs, then this will return True, and the HitPoint class will contain details of the collision. The details of the closest collision are recorded.
Parameters:
start - The starting Vertex of the ray
end - The ending Vertex of the ray
objectid - The id of an object
See Also:
HitPoint, Object3d.getID(), addObject(com.sygem.jazz3d3.Object3d)

pickClosest

public final boolean pickClosest(int x,
                                 int y)
Finds the closest polygon to a given point on screen.
Parameters:
x - The x screen point to test
y - The y screen point to test
See Also:
HitPoint

suspend

public final void suspend()
Sends Jazz3D to sleep. No drawing operations will be performed whilst suspended, allowing you to delete and add objects safely.
See Also:
resume()

resume

public final void resume()
Wakes Jazz3D up. Allows drawing operations to continue.
See Also:
suspend()

setImageResourceLoader

public static void setImageResourceLoader(ResourceLoader loader)
Sets the resource loader to use for Images. A default loader is always provided.
Parameters:
loader - A resource loader for Images.

getImageResourceLoader

public static ResourceLoader getImageResourceLoader()
Gets the resource loader being used for Images.
Returns:
The resource loader for Images.

setModelResourceLoader

public static void setModelResourceLoader(ResourceLoader loader)
Sets the resource loader to use for Models. A default loader is always provided.
Parameters:
loader - A resource loader for Models.

getModelResourceLoader

public static ResourceLoader getModelResourceLoader()
Gets the resource loader being used for Models.
Returns:
The resource loader for Models.

setFontResourceLoader

public static void setFontResourceLoader(ResourceLoader loader)
Sets the resource loader to use for Fonts. A default loader is always provided.
Parameters:
loader - A resource loader for Fonts.

getFontResourceLoader

public static ResourceLoader getFontResourceLoader()
Gets the resource loader being used for Fonts.
Returns:
The resource loader for Fonts.

getConsumer

public java.awt.image.ImageConsumer getConsumer()
See Also:
ImageProducer

addConsumer

public void addConsumer(java.awt.image.ImageConsumer newIC)
Specified by:
addConsumer in interface java.awt.image.ImageProducer
See Also:
ImageProducer

startProduction

public final void startProduction(java.awt.image.ImageConsumer theIC)
Specified by:
startProduction in interface java.awt.image.ImageProducer
See Also:
ImageProducer

isConsumer

public final boolean isConsumer(java.awt.image.ImageConsumer i)
Specified by:
isConsumer in interface java.awt.image.ImageProducer
See Also:
ImageProducer

requestTopDownLeftRightResend

public final void requestTopDownLeftRightResend(java.awt.image.ImageConsumer i)
Specified by:
requestTopDownLeftRightResend in interface java.awt.image.ImageProducer
See Also:
ImageProducer

removeConsumer

public final void removeConsumer(java.awt.image.ImageConsumer i)
Specified by:
removeConsumer in interface java.awt.image.ImageProducer
See Also:
ImageProducer

©2001 SyGem Software