|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.rico.engine.util.Tools
public class Tools
This class provides some usefull methods for calculations or image processing, for example
Constructor Summary | |
---|---|
Tools()
|
Method Summary | |
---|---|
static void |
beginOrthoMode(javax.media.opengl.GL gl)
Enables the orthographic projection mode. |
static void |
billboardCylindricalBegin(javax.media.opengl.GL gl)
Applies the cylindrical billboarding technique by performing some undo calculations on the current modelview matrix. |
static void |
billboardEnd(javax.media.opengl.GL gl)
Finishes the application of the current billboarding technique |
static void |
billboardSphericalBegin(javax.media.opengl.GL gl)
Applies the spherical billboarding technique by performing some undo calculations on the current modelview matrix. |
static float |
cos(float value)
Returns the cosine value for the specified value |
static com.sun.opengl.util.texture.Texture |
createCubeMapTexture(java.lang.String posX,
java.lang.String negX,
java.lang.String posY,
java.lang.String negY,
java.lang.String posZ,
java.lang.String negZ)
Creates a texture with six images that can be used for cube maps. |
static Line3D |
createLineFromScreenCoords(int screenX,
int screenY)
Creates a line from the specified screen coordinates into the world. |
static com.sun.opengl.util.texture.Texture |
createTexture(java.lang.String path,
boolean mipmap)
Returns the texture object that is created by the file which is specified by the method parameter. |
static com.sun.opengl.util.texture.Texture |
createTexture(java.lang.String texPath,
boolean mipmap,
boolean rotate,
boolean flip)
Returns the texture object that is created by the file which is specified by the method parameter. |
static float |
cut(float value,
float min,
float max)
Cuts the specified value to stay within the min and max boundaries. |
static void |
endOrthoMode(javax.media.opengl.GL gl)
Disables the orthographic projection mode. |
static float |
findMaximum(float... values)
A method that accepts an arbitrary number of float values and returns the maximum value of these |
static float |
findMinimum(float... values)
A method that accepts an arbitrary number of float values and returns the minimum value of these |
static java.awt.image.BufferedImage |
getHorizontallyFlippedImage(java.awt.image.BufferedImage img)
Returns a horizontally flipped version of the specified image |
static int |
getLastTextureUnit(javax.media.opengl.GL gl)
Returns the OpenGL constant for the last texture unit of the graphics card. |
static int |
getNearestPowerOfTwo(int number)
This method returns the neares power of two according to the specified number. |
static Point3D |
getNormalVector(Point3D p0,
Point3D p1,
Point3D p2)
Calculates and returns the normal by using the three specified vertices The returned normal vector is normalized. |
static Point3D |
getNormalVector(Triangle trig)
Calculates and returns the normal by using the specified triangle The returned normal vector is normalized. |
static Point3D |
getNormalVectorNotNormalized(Point3D p0,
Point3D p1,
Point3D p2)
Calculates and returns the normal by using the three specified vertices. |
static Point3D |
getNormalVectorNotNormalized(Triangle trig)
Calculates and returns the normal by using the specified triangle The returned normal vector is not normalized. |
static Point3D |
getProjectedScreenCoords(Point3D worldCoords)
Returns the screen coordinates as a Point3D object, that can be projected from the specified point in world coordinates to the screen. |
static Point3D |
getProjectedWorldCoords(int screenX,
int screenY)
Returns the world coordinates of the point that is under the specified screen coordinates. |
static java.awt.image.BufferedImage |
getRotatedAndHorizFlippedImage(java.awt.image.BufferedImage image)
Returns the rotated and horizontally flipped version of the specified image |
static java.awt.image.BufferedImage |
getRotatedImage(java.awt.image.BufferedImage img,
float degrees)
Returns a rotated version of the specified image |
static float[] |
getRow(int row,
javax.vecmath.Matrix4f mat)
This method returns the desired row from the specified matrix. |
static int |
getTextureUnit(int number)
Returns the OpenGL texture unit constant for the specified number. |
static java.awt.image.BufferedImage |
getVerticallyFlippedImage(java.awt.image.BufferedImage img)
Returns a vertically flipped version of the specified image |
static boolean |
isEqual(float a,
float b,
float tolerance)
Compares to float values for equality by using the specified tolerance. |
static float[] |
matrixToFloatArray(javax.vecmath.Matrix4f matrix4f)
Returns the float array representation of the specified Matrix. |
static float[] |
removeRotations(javax.media.opengl.GL gl)
This method returns a float array with 16 values, that represents the modelview matrix with all rotation operations eliminated. |
static float[] |
removeTransformations(javax.media.opengl.GL gl)
This method returns a float array with 16 values, that represents the modelview matrix with all translate and rotate operations eliminated. |
static float[] |
removeTranslations(javax.media.opengl.GL gl)
This method returns a float array with 16 values, that represents the modelview matrix with all translate operations eliminated. |
static float |
round(float value,
int decimal)
Returns a rounded version of the specified value. |
static void |
setGlobalAmbientLight(javax.media.opengl.GL gl,
float red,
float green,
float blue,
float alpha)
Sets the color of the global ambient background light. |
static void |
setUpBlendFunction(javax.media.opengl.GL gl,
BlendSourceFactor srcFact,
BlendDestFactor destFact)
Sets the blend function to the specified values. |
static float |
sin(float value)
Returns the sine value for the specified value |
static float |
tan(float value)
Returns the tangent value for the specified value |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Tools()
Method Detail |
---|
public static float sin(float value)
value
- value in degrees, not radians
public static float cos(float value)
value
- value in degrees, not radians
public static float tan(float value)
value
- value in degrees, not radians
public static float cut(float value, float min, float max)
value
- value to cutmin
- min value boundarymax
- max value boundary
public static float round(float value, int decimal)
decimal
- decimal place (position after decimal point)
public static int getNearestPowerOfTwo(int number)
number
- number to find the neares power of two for
public static boolean isEqual(float a, float b, float tolerance)
a
- first valueb
- second valuetolerance
- tolerance while comparing
public static Point3D getNormalVector(Point3D p0, Point3D p1, Point3D p2)
p0
- vertex 1p1
- vertex 2p2
- vertex 3
public static Point3D getNormalVector(Triangle trig)
trig
- triangle to calculate a normal vector for
public static Point3D getNormalVectorNotNormalized(Point3D p0, Point3D p1, Point3D p2)
p0
- vertex 1p1
- vertex 2p2
- vertex 3
public static Point3D getNormalVectorNotNormalized(Triangle trig)
trig
- triangle to calculate a normal vector for
public static float[] matrixToFloatArray(javax.vecmath.Matrix4f matrix4f)
matrix4f
- 4x4 matrix to convert to a float array
public static float[] getRow(int row, javax.vecmath.Matrix4f mat)
row
- row to retrieve (1-4)mat
- matrix to rterieve the row from
public static float findMaximum(float... values)
values
- float values
public static float findMinimum(float... values)
values
- float values
public static void billboardSphericalBegin(javax.media.opengl.GL gl)
gl
- public static void billboardCylindricalBegin(javax.media.opengl.GL gl)
gl
- public static void billboardEnd(javax.media.opengl.GL gl)
public static float[] removeTransformations(javax.media.opengl.GL gl)
gl
-
public static float[] removeTranslations(javax.media.opengl.GL gl)
gl
-
public static float[] removeRotations(javax.media.opengl.GL gl)
gl
-
public static java.awt.image.BufferedImage getRotatedImage(java.awt.image.BufferedImage img, float degrees)
img
- image to be used for rotationdegrees
- number of degrees to rotate the image
public static java.awt.image.BufferedImage getHorizontallyFlippedImage(java.awt.image.BufferedImage img)
img
- image to be used for rotation
public static java.awt.image.BufferedImage getVerticallyFlippedImage(java.awt.image.BufferedImage img)
img
- image to be used for rotation
public static java.awt.image.BufferedImage getRotatedAndHorizFlippedImage(java.awt.image.BufferedImage image)
image
- original image
public static com.sun.opengl.util.texture.Texture createTexture(java.lang.String texPath, boolean mipmap, boolean rotate, boolean flip)
texPath
- path to texture filemipmap
- create mipmaps? --> true = yes, false = norotate
- rotate texture 180° clockwise? --> true = yes, false = noflip
- flip texture? --> true = yes, false = no
public static com.sun.opengl.util.texture.Texture createTexture(java.lang.String path, boolean mipmap)
path
- path to texture filemipmap
- create mipmaps? --> true = yes, false = no
public static com.sun.opengl.util.texture.Texture createCubeMapTexture(java.lang.String posX, java.lang.String negX, java.lang.String posY, java.lang.String negY, java.lang.String posZ, java.lang.String negZ)
posX
- path to posX texturenegX
- path to negX textureposY
- path to posY texturenegY
- path to negY textureposZ
- path to posZ texturenegZ
- path to negZ texture
public static int getLastTextureUnit(javax.media.opengl.GL gl)
gl
-
public static int getTextureUnit(int number)
public static void setGlobalAmbientLight(javax.media.opengl.GL gl, float red, float green, float blue, float alpha)
red
- amount of redgreen
- amount of greenblue
- amount of bluealpha
- alpha-valuepublic static void setUpBlendFunction(javax.media.opengl.GL gl, BlendSourceFactor srcFact, BlendDestFactor destFact)
gl
- srcFact
- value from the BlendSourceFactor enumerationdestFact
- value from the BlendDestFactor enumerationpublic static Point3D getProjectedWorldCoords(int screenX, int screenY)
screenX
- x coordinate on the screenscreenY
- y coordinate on the screen
public static Point3D getProjectedScreenCoords(Point3D worldCoords)
worldCoords
- point in 3D world space
public static Line3D createLineFromScreenCoords(int screenX, int screenY)
screenX
- x coordinate on the screenscreenY
- y coordinate on the screen
public static void beginOrthoMode(javax.media.opengl.GL gl)
gl
- public static void endOrthoMode(javax.media.opengl.GL gl)
gl
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |