|
Jazz3D API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--com.sygem.jazz3d3.World
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);
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 |
public static final int RETURN_NULL
public static final int RETURN_EMPTY_OBJECT
NOTE: This is the default behaviour.
public static final int SPHERE_COLLISION
public static final int POLYGON_COLLISION
Constructor Detail |
public World(java.applet.Applet app)
app
- An Applet - usually 'this' when called from within an applet.public World()
Method Detail |
public final java.lang.String getVersion()
public final void destroy()
public void setRegCode(java.lang.String regcode)
regcode
- A Jazz3D registration codesetDomainRegCode(java.lang.String)
public void setDomainRegCode(java.lang.String regcode)
regcode
- A Jazz3D domain registration codesetRegCode(java.lang.String)
public final java.awt.Dimension minimumSize()
minimumSize
in class java.awt.Component
public final java.awt.Dimension preferredSize()
preferredSize
in class java.awt.Component
public final void setDelay(int new_delay)
delay
- The number of milliseconds to wait between drawing each frame.public final void prep()
public final void prepNewObjects()
public final void reshape(int x, int y, int w, int h)
reshape
in class java.awt.Component
public final int addObject(Object3d obj)
object
- The object to be added to the worldObject3d
public final void enableTransparentObjects()
RenderTransparent
public final void deleteAllObjects()
BEWARE: There is no undo for this...
deleteObject(int)
public final void deleteObject(int objectid)
BEWARE: There is no undo for this...
objectid
- The objectid of the object - as returned by addObject()deleteAllObjects()
,
addObject(Object3d)
public final void deleteObject(java.lang.String objectName)
BEWARE: There is no undo for this...
objectName
- The name of the object - as set by Object3d.setName()deleteAllObjects()
,
deleteObject(int)
,
Object3d.setName(java.lang.String)
public final void setGetObjectBehaviour(int behaviour)
behaviour
- The behaviour to applyRETURN_NULL
,
RETURN_EMPTY_OBJECT
public final Object3d getObject(int pid)
objid
- An id as returned by addChild()Object3d.addChild(com.sygem.jazz3d3.Object3d, double, double, double)
,
getParentObject(int)
,
getObject(String)
public final Object3d getParentObject(int objid)
objid
- An id as returned by addObject()getParentObject(String)
,
getObject(int)
public final Object3d getObject(java.lang.String qname)
qname
- The name of the objectObject3d.setName(java.lang.String)
,
Object3d.addChild(com.sygem.jazz3d3.Object3d, double, double, double)
,
getParentObject(String)
,
getObject(int)
public final Object3d getParentObject(java.lang.String qname)
qname
- The name of the parent objectObject3d.setName(java.lang.String)
,
getParentObject(int)
,
getObject(String)
public final Object3d[] getAllParentObjects()
getParentObject(int)
,
getObject(String)
,
Object3d.getChildObjects()
public final Light getLight(int lightid)
lightid
- The id of the light sourceaddLight(com.sygem.jazz3d3.Light)
public final int addLight(Light l)
l
- a Light objectLight
,
Lightpoint
,
Lightspot
public final void setAmbientColour(int r, int g, int b)
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.addObject(Object3d)
,
Object3d.setAmbientColour(int, int, int)
public final void setBoundingBoxes(boolean boxes)
boxes
- Use 'true' for turning boxes on, and 'false' to turn them off again.public final void updateBackgroundImage()
public final void setBackgroundColour(int r, int g, int b)
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.public final void setBackground(java.lang.String filename)
filename
- A string, containing the location of the image. This can
be either a full URL or relative to the applet location.shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
public final void setBackground(Texture tx)
tx
- A Texture, as loaded previously by the TextureLoader.shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
,
TextureLoader
public final void setTiledBackground(java.lang.String filename)
filename
- A string, containing the location of the image. This can
be either a full URL or relative to the applet location.shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
public final void setTiledBackground(Texture tx)
tex
- A texture, as loaded previously by the TextureLoader.TextureLoader
,
shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
public final void setPanoramicBackground(java.lang.String filename)
filename
- A string, containing the location of the image. This can
be either a full URL or relative to the applet location.shiftPanoramicBackground(int, int)
public final void setPanoramicBackground(Texture tx)
tex
- A texture, as loaded previously by the TextureLoader.shiftPanoramicBackground(int, int)
,
TextureLoader
public final void shiftPanoramicBackground(int x, int y)
x
- The x position to start displaying the backgroundy
- The y position to start displaying the backgroundsetPanoramicBackground(Texture)
public final void shiftBgLeft(int amount)
amount
- The number of pixels to shift the image by.shiftBgRight(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
public final void shiftBgRight(int amount)
amount
- The number of pixels to shift the image by.shiftBgLeft(int)
,
shiftBgUp(int)
,
shiftBgDown(int)
public final void shiftBgUp(int amount)
amount
- The number of pixels to shift the image by.shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgDown(int)
public final void shiftBgDown(int amount)
amount
- The number of pixels to shift the image by.shiftBgLeft(int)
,
shiftBgRight(int)
,
shiftBgUp(int)
public final void redraw()
prepareCanvas()
,
generateImage()
,
drawImage()
,
finishCanvas()
public final void prepareCanvas()
generateImage()
,
drawImage()
,
finishCanvas()
public final void generateImage()
prepareCanvas()
,
drawImage()
,
finishCanvas()
public final void drawImage()
prepareCanvas()
,
generateImage()
,
finishCanvas()
public final void finishCanvas()
prepareCanvas()
,
generateImage()
,
drawImage()
public final java.awt.Graphics getCanvas()
public final int[] getImage()
Visimagik
public final void setImage(int[] buffer)
buffer
- An array of integers, from VisiMagik.Visimagik
public final void setFog(boolean fogOn)
Note that fogging is off by default.
fogOn
- A boolean, 'true' turns the fog on, and 'false' turns it off.public final void setFogColour(int r, int g, int b)
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.public final void setFogStart(double fogStart)
fogStart
- The distance from the camera to start foggingpublic final void setFogEnd(double fogEnd)
fogEnd
- The distance from the camera to end foggingpublic final void setAntiAliasing(boolean aa)
aa
- True if anti-aliasing is to be used, and false if notpublic final void setBilinear(boolean bb)
bb
- True if bilinear filtering is to be used, and false if notRenderTexturedHQ
public final void setHitherYon(double hither, double yon)
hither
- A double, specifying the near camera plane.yon
- A double, specifying the far camera plane.public final void setCamera(Camera3d c)
c
- A camera3d object.Camera3d
public final Camera3d getCamera()
Camera3d
public final void setCameraCollisionMode(int colMode)
colMode
- One of the field SPHERE_COLLISION or POLYGON_COLLISIONSPHERE_COLLISION
,
POLYGON_COLLISION
public final int getCameraCollisionMode()
SPHERE_COLLISION
,
POLYGON_COLLISION
public final boolean testCollision(int objectid1, int objectid2)
Note that this does not check any sub-objects - you will need to test those explicitly.
objectid1
- An integer as returned by addObject()objectid2
- An integer as returned by addObject()addObject(com.sygem.jazz3d3.Object3d)
,
testCollisionAll(int)
public final int[] testCollisionAll(int objectid)
Again it should be noted that these tests do not involve sub-objects.
objectid
- An integer as returned by addObject()addObject(com.sygem.jazz3d3.Object3d)
,
testCollision(int, int)
public final boolean testCameraCollision(int objectid)
objectid
- An integer as returned by addObject()addObject(com.sygem.jazz3d3.Object3d)
,
testCameraCollisionAll()
public final int[] testCameraCollisionAll()
testCameraCollision(int)
public final void setCameraRadius(double cameraSize)
cameraSize
- The new size of the cameratestCameraCollision(int)
public final boolean pick(Vertex start, Vertex end, int objectid)
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.start
- The starting Vertex of the rayend
- The ending Vertex of the rayobjectid
- The id of an objectHitPoint
,
Object3d.getID()
,
addObject(com.sygem.jazz3d3.Object3d)
public final boolean pickClosest(Vertex start, Vertex end, int objectid)
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.start
- The starting Vertex of the rayend
- The ending Vertex of the rayobjectid
- The id of an objectHitPoint
,
Object3d.getID()
,
addObject(com.sygem.jazz3d3.Object3d)
public final boolean pickClosest(Vertex start, Vertex end)
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.start
- The starting Vertex of the rayend
- The ending Vertex of the rayobjectid
- The id of an objectHitPoint
,
Object3d.getID()
,
addObject(com.sygem.jazz3d3.Object3d)
public final boolean pickClosest(int x, int y)
x
- The x screen point to testy
- The y screen point to testHitPoint
public final void suspend()
resume()
public final void resume()
suspend()
public static void setImageResourceLoader(ResourceLoader loader)
loader
- A resource loader for Images.public static ResourceLoader getImageResourceLoader()
public static void setModelResourceLoader(ResourceLoader loader)
loader
- A resource loader for Models.public static ResourceLoader getModelResourceLoader()
public static void setFontResourceLoader(ResourceLoader loader)
loader
- A resource loader for Fonts.public static ResourceLoader getFontResourceLoader()
public java.awt.image.ImageConsumer getConsumer()
ImageProducer
public void addConsumer(java.awt.image.ImageConsumer newIC)
addConsumer
in interface java.awt.image.ImageProducer
ImageProducer
public final void startProduction(java.awt.image.ImageConsumer theIC)
startProduction
in interface java.awt.image.ImageProducer
ImageProducer
public final boolean isConsumer(java.awt.image.ImageConsumer i)
isConsumer
in interface java.awt.image.ImageProducer
ImageProducer
public final void requestTopDownLeftRightResend(java.awt.image.ImageConsumer i)
requestTopDownLeftRightResend
in interface java.awt.image.ImageProducer
ImageProducer
public final void removeConsumer(java.awt.image.ImageConsumer i)
removeConsumer
in interface java.awt.image.ImageProducer
ImageProducer
|
©2001 SyGem Software |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |