dzzd
Interface IScene3D


public interface IScene3D

Used for accessing to a Scene3D.
provide simple methods to manage a 3D scene.

Since:
1.0
Version:
1.0
Author:
Bruno Augier
See Also:
Copyright Bruno Augier 2005

Method Summary
 void addCamera3D(ICamera3D c)
          Add the given Camera3D to this scene.
 void addLight3D(ILight3D l)
          Add the given Light3D to this scene.
 void addMaterial(IMaterial m)
          Add the given Material to this scene.
 void addMesh3D(IMesh3D m)
          Add the given Mesh3D to this scene.
 void addSceneObject(ISceneObject object)
          Add the given SceneObject to this scene.
 void addTexture(ITexture t)
          Add the given Texture to this scene.
 void clearScene3D()
          Clear this scene3D.
 int getBackgroundColor()
          Gets background color.
 ICamera3D getCamera3DById(int id)
          Gets the Camera3D having the given id from this scene.
 ICamera3D getCamera3DByName(java.lang.String name)
          Gets the Camera3D having the given name from this scene.
 ICamera3D getCurrentCamera3D()
          Gets the Camera3D used for camera space.
 ILight3D getLight3DById(int id)
          Gets the Light3D having the given id from this scene.
 ILight3D getLight3DByName(java.lang.String name)
          Gets the Light3D having the given name from this scene.
 IMaterial getMaterialById(int id)
          Gets the Material having the given id from this scene.
 IMaterial getMaterialByName(java.lang.String name)
          Gets the Material having the given name from this scene.
 IMesh3D getMesh3DById(int id)
          Gets the Mesh3D having the given id from this scene.
 IMesh3D getMesh3DByName(java.lang.String name)
          Gets the Mesh3D having the given name from this scene.
 int getNbCamera3D()
          Gets the total number of Camera3D in this Scene3D

 int getNbLight3D()
          Gets the total number of Light3D in this Scene3D

 int getNbMaterial()
          Gets the total number of Material in this Scene3D

 int getNbMesh3D()
          Gets the total number of Mesh3D in this Scene3D

 int getNbMonitoredObject()
          Gets total number of SceneObject currently monitored.
 int getNbTexture()
          Gets the total number of Texture in this Scene3D

 int getSkyBoxMesh3DId()
          Gets the Mesh3D id object to use as sky box.
 ITexture getTextureById(int id)
          Gets the Texture having the given id from this scene.
 ITexture getTextureByName(java.lang.String name)
          Gets the Texture having the given name from this scene.
 boolean isBackgroundEnabled()
          Gets the backgroundEnabled flag .
 void loadScene3DFrom3DS(java.lang.String baseURL, java.lang.String file)
          Asynchroneously load a scene3D from a 3ds file using an URL.
 void playScene3DObjectAnimator()
          Update all Scene3DObject having a Scene3DObjectAnimator.
 void removeCamera3DById(int id)
          Remove the Camera3D having the given id from this scene.
 void removeLight3DById(int id)
          Remove the Light3D having the given id from this scene.
 void removeMaterialById(int id)
          Remove the Material having the given id from this scene.
 void removeMesh3DById(int id)
          Remove the Mesh3D having the given id from this scene.
 void removeScene3DObject(IScene3DObject object)
          Remove the given Scene3DObject from this scene.
 void removeTextureById(int id)
          Remove the Texture having the given id from this scene.
 void setBackgroundColor(int color)
          Sets background color.
 void setBackgroundEnabled(boolean flag)
          Sets the backgroundEnabled flag .
 void setCurrentCamera3DById(int id)
          Sets the Camera3D to use for camera space using its id.
 void setCurrentCamera3DByName(java.lang.String name)
          Sets the Camera3D to use for camera space using its name.
 void setScene3DBufferSize(int maxMesh3D, int maxLight3D, int maxCamera3D, int maxMaterial, int maxTexture)
          Sets this scene3D internal buffer size.
 void setScene3DObjectToCamera()
          Sets all Scene3DObject to camera space.
 void setScene3DObjectToWorld()
          Sets all Scene3DObject to world space.
 void setSkyBoxMesh3DById(int id)
          Sets the Mesh3D id object to use as sky box.
 void setSkyBoxMesh3DByName(java.lang.String name)
          Sets the Mesh3D name object to use as sky box.
 void updateMonitoredObjects()
          Check all monitored SceneObject and update them or the scene3D if needed.
 

Method Detail

setScene3DBufferSize

public void setScene3DBufferSize(int maxMesh3D,
                                 int maxLight3D,
                                 int maxCamera3D,
                                 int maxMaterial,
                                 int maxTexture)
Sets this scene3D internal buffer size.

this method must be used to increase/reduce the scene3D internal buffers size.

Default value are :
IMesh3D : 4096
ILight3D : 1024
ICamera3D: 1024
IMaterial: 1024
ITexture: 1024


Note: This method will reset the scene3D by calling clearScene3D internally.

Parameters:
maxMesh3D - maximum number of mesh3D allowed.
maxLight3D - maximum number of light3D allowed.
maxCamera3D - maximum number of camera3D allowed.
maxMaterial - maximum number of material allowed.
maxTexture - maximum number of texture allowed.

clearScene3D

public void clearScene3D()
Clear this scene3D.

remove all SceneObject including mesh,camera,light,material and texture.

a new default camera and light will be created just before this method return.


loadScene3DFrom3DS

public void loadScene3DFrom3DS(java.lang.String baseURL,
                               java.lang.String file)
Asynchroneously load a scene3D from a 3ds file using an URL.
this method can load 3ds file from a network or a file.

external scene files, as textures files, are expected to be at the same baseURL location.


loading sample:
loadScene3DFrom3DS("http://myserver.com/","my3dsfile.3ds");

this function will return immediadly and loading state will be accessible via monitored objects.


it is possible to load multiple 3ds file if needed

each loaded 3ds file will create a root mesh object with the 3ds file name as its name

loading sample:
loadScene3DFrom3DS("http://myserver.com/","my3dsfile.3ds");
loadScene3DFrom3DS("http://myserver.com/","my3dsfile2.3ds");
.....once loaded, you can do the following to get the root object of all 3d object of one of the loaded file.
getMesh3DByName("my3dsfile.3ds");
or
getMesh3DByName("my3dsfile2.3ds");


Parameters:
baseURL - the base URL location.
file - the file name.

setBackgroundColor

public void setBackgroundColor(int color)
Sets background color.

Parameters:
color - new background color

getBackgroundColor

public int getBackgroundColor()
Gets background color.

Returns:
current background color

getNbMonitoredObject

public int getNbMonitoredObject()
Gets total number of SceneObject currently monitored.

this will return the number of files currently loading as well as the number of sceneObject currently moving to an other state : loading,initilising,synchronising, etc..

Returns:
total currently monitored sceneObject

getNbMesh3D

public int getNbMesh3D()
Gets the total number of Mesh3D in this Scene3D

Returns:
total number of Mesh3D

getNbLight3D

public int getNbLight3D()
Gets the total number of Light3D in this Scene3D

Returns:
total number of Light3D

getNbCamera3D

public int getNbCamera3D()
Gets the total number of Camera3D in this Scene3D

Returns:
total number of Camera3D

getNbMaterial

public int getNbMaterial()
Gets the total number of Material in this Scene3D

Returns:
total number of Material

getNbTexture

public int getNbTexture()
Gets the total number of Texture in this Scene3D

Returns:
total number of Texture

addSceneObject

public void addSceneObject(ISceneObject object)
Add the given SceneObject to this scene.

Parameters:
object - the new SceneObject to add.

addMesh3D

public void addMesh3D(IMesh3D m)
Add the given Mesh3D to this scene.

Parameters:
m - the new Mesh3D to add.

addLight3D

public void addLight3D(ILight3D l)
Add the given Light3D to this scene.

Parameters:
l - the new Light3D to add.

addCamera3D

public void addCamera3D(ICamera3D c)
Add the given Camera3D to this scene.

Parameters:
c - the new Camera3D to add.

addMaterial

public void addMaterial(IMaterial m)
Add the given Material to this scene.

Parameters:
m - the new Material to add.

addTexture

public void addTexture(ITexture t)
Add the given Texture to this scene.

Parameters:
t - the new Texture to add.

removeScene3DObject

public void removeScene3DObject(IScene3DObject object)
Remove the given Scene3DObject from this scene.

this method will remove the given Scene3DObject and all its childrens.

Material and Texture are not affected by this method.

Parameters:
object - the Scene3DObject to remove.

removeMesh3DById

public void removeMesh3DById(int id)
Remove the Mesh3D having the given id from this scene.

this method will remove Mesh3D and all its childrens.

Material and Texture are not affected by this method.

Parameters:
id - id of the Mesh3D to remove.

removeLight3DById

public void removeLight3DById(int id)
Remove the Light3D having the given id from this scene.

this method will remove Light3D and all its childrens.

Material and Texture are not affected by this method.

Parameters:
id - id of the Light3D to remove.

removeCamera3DById

public void removeCamera3DById(int id)
Remove the Camera3D having the given id from this scene.

this method will remove Camera3D and all its childrens.

Material and Texture are not affected by this method.

Parameters:
id - id of the Camera3D to remove.

removeMaterialById

public void removeMaterialById(int id)
Remove the Material having the given id from this scene.

Parameters:
id - id of the Material to remove.

removeTextureById

public void removeTextureById(int id)
Remove the Texture having the given id from this scene.

Parameters:
id - id of the Texture to remove.

getMesh3DById

public IMesh3D getMesh3DById(int id)
Gets the Mesh3D having the given id from this scene.

Parameters:
id - id of the Mesh3D to get.

getMesh3DByName

public IMesh3D getMesh3DByName(java.lang.String name)
Gets the Mesh3D having the given name from this scene.

Parameters:
name - name of the Mesh3D to get.

getCamera3DById

public ICamera3D getCamera3DById(int id)
Gets the Camera3D having the given id from this scene.

Parameters:
id - id of the Camera3D to get.

getCamera3DByName

public ICamera3D getCamera3DByName(java.lang.String name)
Gets the Camera3D having the given name from this scene.

Parameters:
name - name of the Camera3D to get.

getLight3DById

public ILight3D getLight3DById(int id)
Gets the Light3D having the given id from this scene.

Parameters:
id - id of the Light3D to get.

getLight3DByName

public ILight3D getLight3DByName(java.lang.String name)
Gets the Light3D having the given name from this scene.

Parameters:
name - name of the Light3D to get.

getMaterialById

public IMaterial getMaterialById(int id)
Gets the Material having the given id from this scene.

Parameters:
id - id of the Material to get.

getMaterialByName

public IMaterial getMaterialByName(java.lang.String name)
Gets the Material having the given name from this scene.

Parameters:
name - name of the Material to get.

getTextureById

public ITexture getTextureById(int id)
Gets the Texture having the given id from this scene.

Parameters:
id - id of the Texture to get.

getTextureByName

public ITexture getTextureByName(java.lang.String name)
Gets the Texture having the given name from this scene.

Parameters:
name - name of the Texture to get.

setSkyBoxMesh3DById

public void setSkyBoxMesh3DById(int id)
Sets the Mesh3D id object to use as sky box.

Mesh3D used as skybox will be rendered without lighting and always at position 0,0,0 relative to the camera.

Typically this will be a 3D box with its pivot located at the center and faces normal reversed.

Other object than 3d box can be used : sphere,dome...

Parameters:
id - id of the Mesh3D to use as sky box.

getSkyBoxMesh3DId

public int getSkyBoxMesh3DId()
Gets the Mesh3D id object to use as sky box.

Mesh3D used as skybox will be rendered without lighting and always at position 0,0,0 relative to the camera.

Typically this will be a 3D box with its pivot located at the center and faces normal reversed.

Other object than 3d box can be used : sphere,dome...

Returns:
id of the Mesh3D to use as sky box.

setSkyBoxMesh3DByName

public void setSkyBoxMesh3DByName(java.lang.String name)
Sets the Mesh3D name object to use as sky box.

Mesh3D used as skybox will be rendered without lighting and always at position 0,0,0 relative to the camera.

Typically this will be a 3D box with its pivot located at the center and faces normal reversed.

Other object than 3d box can be used : sphere,dome...

Parameters:
name - name of the Mesh3D to use as sky box.

setCurrentCamera3DById

public void setCurrentCamera3DById(int id)
Sets the Camera3D to use for camera space using its id.

this camera will be used for camera space as well as to render the scene when scene is passed to a Render3D.

Parameters:
id - id of the Camera3D to use for camera space.

setCurrentCamera3DByName

public void setCurrentCamera3DByName(java.lang.String name)
Sets the Camera3D to use for camera space using its name.

this camera will be used for camera space as well as to render the scene when scene is passed to a Render3D.

Parameters:
name - name of the Camera3D to use for camera space.

getCurrentCamera3D

public ICamera3D getCurrentCamera3D()
Gets the Camera3D used for camera space.

this camera will be used for camera space as well as to render the scene when scene is passed to a Render3D.

Returns:
the Camera3D used for camera space.

setScene3DObjectToWorld

public void setScene3DObjectToWorld()
Sets all Scene3DObject to world space.

all Scene3DObject will be passed to world space.


setScene3DObjectToCamera

public void setScene3DObjectToCamera()
Sets all Scene3DObject to camera space.

setScene3DObjectToWorld must have been called at least once before each call to this method.

all Scene3DObject will be passed to world space.


updateMonitoredObjects

public void updateMonitoredObjects()
Check all monitored SceneObject and update them or the scene3D if needed.

if some monitored SceneObject have reached a new state this method will update them or the scene3D if needed.

for example if some SceneObject(texture,3ds file) have reached the state loaded, they will be added to the scene.


playScene3DObjectAnimator

public void playScene3DObjectAnimator()
Update all Scene3DObject having a Scene3DObjectAnimator.

call the Scene3DObjectAnimator.play method for each Scene3DObjectAnimator used by Scene3DObject of this scene3D.


isBackgroundEnabled

public boolean isBackgroundEnabled()
Gets the backgroundEnabled flag .
set this flag to false to disable background filling.

Returns:
backgroundEnabled flag

setBackgroundEnabled

public void setBackgroundEnabled(boolean flag)
Sets the backgroundEnabled flag .
set this flag to false to disable background filling.

Parameters:
flag - backgroundEnabled flag