|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Common interface for the anfy3dAPI system
| Method Summary | |
int |
addChild(int ID,
int childID)
adds a child item (it may be a Light, a Mesh or a Transform) to a Transform |
void |
beginScene()
beginning of a scene modifies. |
void |
clearScene()
clears all the items contained inside a scene. |
int |
createCamera()
Create a new default Camera |
int |
createLightDirectional()
create a new default Directional light |
int |
createLightOmni()
create a new default Omni light |
int |
createMaterial()
create a new default material with diffuse(0,0,0) emissive(0,0,0) transparency(0) |
int |
createMesh(float[] vertex,
int[] vertexI,
float[] color,
int[] colorI,
float[] map0,
int[] map0I,
float[] normal,
int[] normalI,
int[] materialI,
int[] textureI)
create a new Mesh |
int |
createTexture()
create a new default (null) Texture |
int |
createTransform()
create a unit transformation |
void |
delete(int ID)
delete an item from memory. |
void |
endScene()
ends of a scene modifies (and also renders) |
java.lang.String |
getAuthor()
returns the author of the engine |
java.awt.Component |
getComponent()
return the Component object that will be used for rendering. |
float[] |
getMeshNormalTransformed(int ID,
int subID)
gets the rotated array of normals. |
float[] |
getMeshVertexTransformed(int ID,
int subID)
gets the rotated array of vertices. |
java.lang.String |
getSystem()
returns the subsystem of the engine |
java.lang.String |
getVersion()
returns the version of the engine |
int |
pick(float x,
float y,
float z,
float nx,
float ny,
float nz,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
picks the object that intersect a ray. |
int |
pick(int mousex,
int mousey,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
picks the object that is under the mouse |
void |
remChild(int ID,
int childID)
remove a child item from a Transform |
void |
render()
renders a scene. |
void |
setAmbientColor(float r,
float g,
float b)
set ambient light color (default is 0 0 0) |
void |
setBackgroundColor(float r,
float g,
float b)
set the color of the background |
void |
setBackgroundImage(int[] pix,
int width,
int height)
set as background an Image. |
void |
setBilinear(boolean bilinear)
sets bilinear filtering on and off for all the scene |
void |
setCameraFov(int ID,
float fov)
set the fov (field of view) of a Camera (the fov should be int the interval (0,179] (default is 48) |
void |
setCameraLookAt(int ID,
float lx,
float ly,
float lz,
float upx,
float upy,
float upz)
set the orientation of a Camera |
void |
setCameraMatrix(int ID,
float[] m)
set the camera transformation directly |
void |
setCameraOrientation(int ID,
float x,
float y,
float z,
float w)
set the orientation of a Camera (default is 0,0,1,0) |
void |
setCameraPlanes(int ID,
float near,
float far)
set the near and far planes of a Camera (default near is 0.1 and far is +infinite) |
void |
setCameraPosition(int ID,
float x,
float y,
float z)
set the position of a Camera (default is 0,0,10) |
void |
setFilter(int filter)
sets a post-processing filter |
void |
setFogActive(boolean flag)
switch fog on/off |
void |
setFogLinear(float near,
float far,
float r,
float g,
float b)
set fog parameters |
void |
setKeyCode(java.lang.String key)
sets the keyCode to register this engine |
void |
setLightActive(int ID,
boolean flag)
switch on/off a Light |
void |
setLightAttenuation(int ID,
float a,
float b,
float c)
set the attenuation of an Omni Light; as attenuation formula is used: atten = 1/max(a+b*d+c*d*d,1) where d is the distance of a point from the light |
void |
setLightColor(int ID,
float r,
float g,
float b)
set the color of a Light |
void |
setLightDirection(int ID,
float x,
float y,
float z)
set the direction of a Directional Light |
void |
setLightIntensity(int ID,
float i)
set the intensity of a Light |
void |
setLightPosition(int ID,
float x,
float y,
float z)
set the position of an Omni Light |
void |
setLightRadius(int ID,
float r)
set the radius of illumination of an Omni Light |
void |
setMaterialDiffuse(int ID,
float r,
float g,
float b)
set the diffuse color of a Material |
void |
setMaterialEmissive(int ID,
float r,
float g,
float b)
set the emissive color of a Material |
void |
setMaterialTransparency(int ID,
float n)
set the transparency of a Material |
void |
setMeshActive(int ID,
boolean flag)
switch on/off a Mesh |
void |
setMeshColor(int ID,
float[] color)
change the vertex colors of a Mesh |
void |
setMeshMap(int ID,
float[] map)
change the mapping coords of a Mesh |
void |
setMeshMaterial(int ID,
int matID)
set the Material of a Mesh |
void |
setMeshNormal(int ID,
float[] normal)
change the normals of a Mesh |
void |
setMeshTexture(int ID,
int texID)
set the Texture of a Mesh |
void |
setMeshVertex(int ID,
float[] vertex)
change the vertices of a Mesh (useful for morphing etc) |
void |
setSceneCamera(int ID)
set the active Camera for the scene |
void |
setSceneRoot(int ID)
set the root Transform for the scene |
void |
setTextureBilinear(int ID,
boolean bilinear)
set bilinear filtering for a texture |
void |
setTextureImage(int ID,
int[] pix,
int width,
int height)
set the new image for a Texture |
void |
setTransformMatrix(int ID,
float[] matrix)
set the 3x4 affine transformation matrix of a Transform item |
| Method Detail |
public java.awt.Component getComponent()
public java.lang.String getVersion()
public java.lang.String getAuthor()
public java.lang.String getSystem()
public void setKeyCode(java.lang.String key)
public void beginScene()
public void render()
public void endScene()
public int createTransform()
public int createMaterial()
public int createMesh(float[] vertex,
int[] vertexI,
float[] color,
int[] colorI,
float[] map0,
int[] map0I,
float[] normal,
int[] normalI,
int[] materialI,
int[] textureI)
vertex - an array containing all the vertices in (x,y,z) formatvertexI - an array containing the vertexIndices in the format (p0,p1,p2) to connect the faces. Faces are always triangulescolor - an array containing the colors in (r,g,b) format. If null every vertex will has the color of the material for that facecolorI - an array containing informations for the color of every vertex of a face. The length of this array must be the same of the vertexI array. If null the vertexI array will be usedmap0 - an array containing the mappings in (u,v) format. If null no texturemapping will be usedmap0I - an array containing informations for the mapping of every vertex of a face. The length of this array must be the same of the vertexI array. If null the vertexI array will be usednormal - an array containing the normals in (nx,ny,nz) format. If null no normals will be used (and no illumination will be performed)normalI - an array containing informations for the normal of every vertex of a face. The length of this array must be the same of the vertexI array. If null the vertexI array will be usedmaterialI - an array containing information for the material to use for every face. Every entry of this array MUST be a valid Material ID. If an entry is -1 no material will be usedtextureI - an array containing information for the texture to use for every face. If an entry is -1 no texture will be usedpublic int createCamera()
public int createLightOmni()
public int createLightDirectional()
public int createTexture()
public void delete(int ID)
ID - the ID of the item to deletepublic void clearScene()
public void setBackgroundColor(float r,
float g,
float b)
r - red componentg - green componentb - blue component
public void setBackgroundImage(int[] pix,
int width,
int height)
pix - an array containing a argb image (alpha is used !)width - width of the imageheight - height of the image
public void setTransformMatrix(int ID,
float[] matrix)
ID - the ID of the Transform item to modifymatrix - the new 4x3 affine matrix that will be used for that Transform
public int addChild(int ID,
int childID)
ID - the ID of the parent TransformchildID - the ID of the child item
public void remChild(int ID,
int childID)
ID - the ID of the parent TransformchildID - the ID of the child item
public void setMaterialDiffuse(int ID,
float r,
float g,
float b)
ID - the ID of the Materialr - red componentg - green componentb - blue component
public void setMaterialEmissive(int ID,
float r,
float g,
float b)
ID - the ID of the Materialr - red componentg - green componentb - blue component
public void setMaterialTransparency(int ID,
float n)
ID - the ID of the Materialn - the transparency (range 0.0-1.0)
public void setTextureImage(int ID,
int[] pix,
int width,
int height)
ID - the ID of the Texturepix - an array of data in format ARGBwidth - width of the imageheight - height of the image
public void setTextureBilinear(int ID,
boolean bilinear)
ID - the ID of the Texturebilinear - true/false to switch bilinear on/off
public void setMeshActive(int ID,
boolean flag)
ID - the ID of the Meshflag - true-visible, false-invisible
public void setMeshMaterial(int ID,
int matID)
ID - the ID of the MeshmatID - the ID of the Material or -1 to switch off illumination for that mesh
public void setMeshTexture(int ID,
int texID)
ID - the ID of the MeshtexID - the ID of the Texture or -1 to switch texture off for the Mesh
public void setMeshVertex(int ID,
float[] vertex)
ID - the ID of the Meshvertex - an array of float that will replace the old vertex list; the length of
this array should be the same length of the original vertex array
public void setMeshColor(int ID,
float[] color)
ID - the ID of the Meshcolor - an array of float that will replace the old color list; the length of
this array should be the same length of the original color array
public void setMeshNormal(int ID,
float[] normal)
ID - the ID of the Meshnormal - an array of float that will replace the old normal list; the length of
this array should be the same length of the original normal array
public void setMeshMap(int ID,
float[] map)
ID - the ID of the Meshmap - an array of float that will replace the old mapping coords list; the length of
this array should be the same length of the original array
public float[] getMeshNormalTransformed(int ID,
int subID)
ID - the ID of the MeshsubID - the subID of the instance of the Mesh (returned by addChild)
public float[] getMeshVertexTransformed(int ID,
int subID)
ID - the ID of the MeshsubID - the subID of the instance of the Mesh (returned by addChild)
public void setCameraOrientation(int ID,
float x,
float y,
float z,
float w)
ID - the ID of the Camerax - x component of axisy - y component of axisz - z component of axisw - angle
public void setCameraLookAt(int ID,
float lx,
float ly,
float lz,
float upx,
float upy,
float upz)
ID - the ID of the Cameralx - x component of LookAt vectorly - y component of LookAt vectorlz - z component of LookAt vectorupx - x component of Up vectorupy - y component of Up vectorupz - z component of Up vector
public void setCameraPosition(int ID,
float x,
float y,
float z)
ID - the ID of the Camerax - x positiony - y positionz - z position
public void setCameraFov(int ID,
float fov)
ID - the ID of the Camerafov - the fov expressed in degrees
public void setCameraPlanes(int ID,
float near,
float far)
ID - the ID of the Cameranear - the near plane (must be greater that 0)far - the far plane (must be greater than near; -1 means infinite)
public void setCameraMatrix(int ID,
float[] m)
ID - the ID of the Cameram - a 4x3 matrix that contains the transformationpublic void setSceneRoot(int ID)
ID - the ID of the Transform that will be the root of all the scenepublic void setSceneCamera(int ID)
ID - the ID of the Camera that will be used to render the scene
public void setLightColor(int ID,
float r,
float g,
float b)
ID - the ID of the Lightr - red componentg - green componentb - blue component
public void setLightIntensity(int ID,
float i)
ID - the ID of the Lighti - the intensity (range 0.0-1.0)
public void setLightActive(int ID,
boolean flag)
ID - the ID of the Lightflag - true-on, false-off
public void setLightDirection(int ID,
float x,
float y,
float z)
ID - the ID of a Directional Lightx - x axis componenty - y axis componentz - z axis component
public void setLightAttenuation(int ID,
float a,
float b,
float c)
ID - the ID of the Omni Lighta - b - c -
public void setLightPosition(int ID,
float x,
float y,
float z)
ID - the ID of the Omni Lightx - x positiony - y positionz - z position
public void setLightRadius(int ID,
float r)
ID - the ID of the Omni Lightr - the radius
public int pick(int mousex,
int mousey,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
mousex - x mouse positionmousey - y mouse positioninfo - a float array of dimension 4 to store distance and intersecting point or nullmatInfo - an int array of dimension 2 that will contain the material and texture picked (or -1 if mesh has not material or texture) if null these datas will not be returnednormalInfo - a float array of dimension 3 that will contain the normal of the face picked or null
public int pick(float x,
float y,
float z,
float nx,
float ny,
float nz,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
x - x start position of the rayy - y start position of the rayz - z start position of the raynx - x axis direction of the rayny - y axis direction of the raynz - z axis direction of the rayinfo - a float array of dimension 4 to store distance and intersecting point or null if you don't want these datas o be calculatedmatInfo - an int array of dimension 2 that will contain the material and texture picked (or -1 if mesh has not material or texture) if null these datas will not be returnedtexInfo - a float array of dimension 2 that will contain the coordinate of the texel picked on the texture or nullnormalInfo - a float array of dimension 3 that will contain the normal of the face picked or nullpublic void setBilinear(boolean bilinear)
bilinear - true to switch bilinear filtering onpublic void setFilter(int filter)
filter - can be: 0-none 1-antialias 2-blurmotionpublic void setFogActive(boolean flag)
flag - true-fog on, false-fog off
public void setFogLinear(float near,
float far,
float r,
float g,
float b)
type - 0-linear fog 1-exponential fognear - near fog planefar - far fog planer - fog r colorg - fog g colorb - fog b color
public void setAmbientColor(float r,
float g,
float b)
r - red ambient componentg - green ambient componentb - blue ambient component
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||