|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--a3dAPI.a3dCORE
This class implements all anfy3dAPI core functions. It's also used to initialize a device driver
| Constructor Summary | |
a3dCORE(java.lang.String driver)
Creates a new a3dCORE rendering 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[] material,
int[] texture)
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[][][] |
grow(int[][][] start)
|
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 x,
float y,
float z)
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 |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public a3dCORE(java.lang.String driver)
driver - the driver that you want to initialize. Driver can be:
"software" - for the standard software driver
"software-swzoom" - for a software drivers that offers software zooming
"software-jzoom" - for a software drivers that offers zooming through java awt functions
"software-antialias" - for a software driver that supports true per-pixel antialiasing
"hardware-gl4j" - for an hardware driver that uses gl4java
Please note that if the hardware driver cannot be instantiated (for example becouse you didn't
installed gl4java) then the render will automatically switch to the software mode.
Also consider that if you don't use hw acceleration you can remove the class a3dGL4J.class from
the distribution and save some kb| Method Detail |
public java.lang.String getVersion()
anfy3dAPIgetVersion in interface anfy3dAPIpublic java.lang.String getAuthor()
anfy3dAPIgetAuthor in interface anfy3dAPIpublic java.lang.String getSystem()
anfy3dAPIgetSystem in interface anfy3dAPI
public final void setBackgroundColor(float r,
float g,
float b)
anfy3dAPIsetBackgroundColor in interface anfy3dAPIa3dAPI.anfy3dAPIr - red componentg - green componentb - blue component
public final void setBackgroundImage(int[] pix,
int width,
int height)
anfy3dAPIsetBackgroundImage in interface anfy3dAPIa3dAPI.anfy3dAPIpix - an array containing a argb image (alpha is used !)width - width of the imageheight - height of the image
public void setTextureImage(int ID,
int[] pix,
int width,
int height)
anfy3dAPIsetTextureImage in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Texturepix - an array of data in format ARGBwidth - width of the imageheight - height of the imagepublic void setBilinear(boolean bilinear)
anfy3dAPIsetBilinear in interface anfy3dAPIa3dAPI.anfy3dAPIbilinear - true to switch bilinear filtering onpublic void beginScene()
anfy3dAPIbeginScene in interface anfy3dAPIpublic void endScene()
anfy3dAPIendScene in interface anfy3dAPIpublic void setFilter(int filter)
anfy3dAPIsetFilter in interface anfy3dAPIa3dAPI.anfy3dAPIfilter - can be: 0-none 1-antialias 2-blurmotionpublic java.awt.Component getComponent()
anfy3dAPIgetComponent in interface anfy3dAPIpublic void setKeyCode(java.lang.String key)
anfy3dAPIsetKeyCode in interface anfy3dAPIpublic void setFogActive(boolean flag)
anfy3dAPIsetFogActive in interface anfy3dAPIa3dAPI.anfy3dAPIflag - true-fog on, false-fog off
public void setFogLinear(float near,
float far,
float r,
float g,
float b)
anfy3dAPIsetFogLinear in interface anfy3dAPIa3dAPI.anfy3dAPItype - 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)
anfy3dAPIsetAmbientColor in interface anfy3dAPIa3dAPI.anfy3dAPIr - red ambient componentg - green ambient componentb - blue ambient componentpublic final int createTransform()
anfy3dAPIcreateTransform in interface anfy3dAPIa3dAPI.anfy3dAPIpublic final int createMaterial()
anfy3dAPIcreateMaterial in interface anfy3dAPIa3dAPI.anfy3dAPI
public final int createMesh(float[] vertex,
int[] vertexI,
float[] color,
int[] colorI,
float[] map0,
int[] map0I,
float[] normal,
int[] normalI,
int[] material,
int[] texture)
anfy3dAPIcreateMesh in interface anfy3dAPIa3dAPI.anfy3dAPIvertex - 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 final int createCamera()
anfy3dAPIcreateCamera in interface anfy3dAPIa3dAPI.anfy3dAPIpublic final int createLightOmni()
anfy3dAPIcreateLightOmni in interface anfy3dAPIa3dAPI.anfy3dAPIpublic final int createLightDirectional()
anfy3dAPIcreateLightDirectional in interface anfy3dAPIa3dAPI.anfy3dAPIpublic final int createTexture()
anfy3dAPIcreateTexture in interface anfy3dAPIa3dAPI.anfy3dAPI
public final void setTransformMatrix(int ID,
float[] matrix)
anfy3dAPIsetTransformMatrix in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Transform item to modifymatrix - the new 4x3 affine matrix that will be used for that Transform
public final int addChild(int ID,
int childID)
anfy3dAPIaddChild in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the parent TransformchildID - the ID of the child item
public final void remChild(int ID,
int childID)
anfy3dAPIremChild in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the parent TransformchildID - the ID of the child item
public final void setMaterialDiffuse(int ID,
float r,
float g,
float b)
anfy3dAPIsetMaterialDiffuse in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Materialr - red componentg - green componentb - blue component
public final void setMaterialEmissive(int ID,
float r,
float g,
float b)
anfy3dAPIsetMaterialEmissive in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Materialr - red componentg - green componentb - blue component
public final void setMaterialTransparency(int ID,
float n)
anfy3dAPIsetMaterialTransparency in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Materialn - the transparency (range 0.0-1.0)
public void setTextureBilinear(int ID,
boolean bilinear)
anfy3dAPIsetTextureBilinear in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Texturebilinear - true/false to switch bilinear on/off
public final void setMeshActive(int ID,
boolean flag)
anfy3dAPIsetMeshActive in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Meshflag - true-visible, false-invisible
public final void setMeshMaterial(int ID,
int matID)
anfy3dAPIsetMeshMaterial in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the MeshmatID - the ID of the Material or -1 to switch off illumination for that mesh
public final void setMeshTexture(int ID,
int texID)
anfy3dAPIsetMeshTexture in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the MeshtexID - the ID of the Texture or -1 to switch texture off for the Mesh
public final void setMeshVertex(int ID,
float[] vertex)
anfy3dAPIsetMeshVertex in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final void setMeshColor(int ID,
float[] color)
anfy3dAPIsetMeshColor in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final void setMeshNormal(int ID,
float[] normal)
anfy3dAPIsetMeshNormal in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final void setMeshMap(int ID,
float[] map)
anfy3dAPIsetMeshMap in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final float[] getMeshNormalTransformed(int ID,
int subID)
anfy3dAPIgetMeshNormalTransformed in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the MeshsubID - the subID of the instance of the Mesh (returned by addChild)
public final float[] getMeshVertexTransformed(int ID,
int subID)
anfy3dAPIgetMeshVertexTransformed in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the MeshsubID - the subID of the instance of the Mesh (returned by addChild)
public final void setCameraOrientation(int ID,
float x,
float y,
float z,
float w)
anfy3dAPIsetCameraOrientation in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Camerax - x component of axisy - y component of axisz - z component of axisw - angle
public final void setCameraLookAt(int ID,
float lx,
float ly,
float lz,
float upx,
float upy,
float upz)
anfy3dAPIsetCameraLookAt in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final void setCameraFov(int ID,
float fov)
anfy3dAPIsetCameraFov in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Camerafov - the fov expressed in degrees
public final void setCameraPlanes(int ID,
float near,
float far)
anfy3dAPIsetCameraPlanes in interface anfy3dAPIa3dAPI.anfy3dAPIID - 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 final void setCameraPosition(int ID,
float x,
float y,
float z)
anfy3dAPIsetCameraPosition in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Camerax - x positiony - y positionz - z position
public final void setCameraMatrix(int ID,
float[] m)
anfy3dAPIsetCameraMatrix in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Cameram - a 4x3 matrix that contains the transformationpublic final void setSceneRoot(int ID)
anfy3dAPIsetSceneRoot in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Transform that will be the root of all the scenepublic final void setSceneCamera(int ID)
anfy3dAPIsetSceneCamera in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Camera that will be used to render the scene
public final void setLightColor(int ID,
float r,
float g,
float b)
anfy3dAPIsetLightColor in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Lightr - red componentg - green componentb - blue component
public final void setLightIntensity(int ID,
float i)
anfy3dAPIsetLightIntensity in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Lighti - the intensity (range 0.0-1.0)
public final void setLightActive(int ID,
boolean flag)
anfy3dAPIsetLightActive in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Lightflag - true-on, false-off
public final void setLightDirection(int ID,
float x,
float y,
float z)
anfy3dAPIsetLightDirection in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of a Directional Lightx - x axis componenty - y axis componentz - z axis component
public final void setLightAttenuation(int ID,
float x,
float y,
float z)
anfy3dAPIsetLightAttenuation in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Omni Lighta - b - c -
public final void setLightPosition(int ID,
float x,
float y,
float z)
anfy3dAPIsetLightPosition in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Omni Lightx - x positiony - y positionz - z position
public final void setLightRadius(int ID,
float r)
anfy3dAPIsetLightRadius in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the Omni Lightr - the radiuspublic int[][][] grow(int[][][] start)
public final void delete(int ID)
anfy3dAPIdelete in interface anfy3dAPIa3dAPI.anfy3dAPIID - the ID of the item to deletepublic void clearScene()
anfy3dAPIclearScene in interface anfy3dAPIpublic final void render()
anfy3dAPIrender in interface anfy3dAPI
public int pick(float x,
float y,
float z,
float nx,
float ny,
float nz,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
anfy3dAPIpick in interface anfy3dAPIa3dAPI.anfy3dAPIx - 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 null
public final int pick(int mousex,
int mousey,
float[] info,
int[] matInfo,
float[] texInfo,
float[] normalInfo)
anfy3dAPIpick in interface anfy3dAPIa3dAPI.anfy3dAPImousex - 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
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||