Package gaia.cu9.ari.gaiaorbit.util
Class DecalUtils
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.util.DecalUtils
-
public class DecalUtils extends java.lang.Object
This class provides utils to use Sprites and Fonts as if they were Decals, this is, flat textures in the 3D space.
-
-
Constructor Summary
Constructors Constructor Description DecalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, java.lang.String text, float x, float y, float scale, float width)
static void
drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, java.lang.String text, float x, float y, float scale, int align)
static void
drawFont2D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, float x, float y)
static void
drawFont2D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position)
static void
drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, float x, float y, float z, float scale, float rotationCenter, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space.static void
drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position, float scale, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space.static void
drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space.static com.badlogic.gdx.math.Quaternion
getBillboardRotation(com.badlogic.gdx.graphics.Camera camera)
Gets the billboard rotation using the parameters of the given camerastatic com.badlogic.gdx.math.Quaternion
getBillboardRotation(com.badlogic.gdx.math.Vector3 direction, com.badlogic.gdx.math.Vector3 up)
Returns a Quaternion representing the billboard rotation to be applied to a decal that is always to face the given direction and up vectorstatic void
setBillboardRotation(com.badlogic.gdx.math.Quaternion rotation, com.badlogic.gdx.math.Vector3 direction, com.badlogic.gdx.math.Vector3 up)
Sets the rotation of this decal based on the (normalized) direction and up vector.static void
setBillboardRotation(com.badlogic.gdx.math.Quaternion rotation, Vector3d direction, Vector3d up)
Sets the rotation of this decal based on the (normalized) direction and up vector.
-
-
-
Method Detail
-
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space. If faceCamera is true, the text is rendered always facing the camera. It assumes thatExtSpriteBatch.begin()
has been called. This enables 3D techniques such as z-buffering to be applied to the text textures.- Parameters:
font
- The font.batch
- The sprite batch to use.text
- The text to write.position
- The 3D position.camera
- The camera.
-
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, float x, float y, float z, float scale, float rotationCenter, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space. If faceCamera is true, the text is rendered always facing the camera. It assumes thatExtSpriteBatch.begin()
has been called. This enables 3D techniques such as z-buffering to be applied to the text textures.- Parameters:
font
- The font.batch
- The sprite batch to use.text
- The text to write.x
- The x coordinate.y
- The y coordinate.z
- The z coordinate.scale
- The scale of the font.rotationCenter
- Angles to rotate around center.camera
- The camera.faceCamera
- Whether to apply bill-boarding.
-
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position, float scale, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)
Draws the given text using the given font in the given 3D position using the 3D coordinate space. If faceCamera is true, the text is rendered always facing the camera. It assumes thatExtSpriteBatch.begin()
has been called. This enables 3D techniques such as z-buffering to be applied to the text textures.- Parameters:
font
- The font.batch
- The sprite batch to use.text
- The text to write.position
- The 3D position.camera
- The camera.scale
- The scale of the font.
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, com.badlogic.gdx.math.Vector3 position)
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, float x, float y)
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, java.lang.String text, float x, float y, float scale, float width)
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, java.lang.String text, float x, float y, float scale, int align)
-
getBillboardRotation
public static com.badlogic.gdx.math.Quaternion getBillboardRotation(com.badlogic.gdx.graphics.Camera camera)
Gets the billboard rotation using the parameters of the given camera- Parameters:
camera
- The camera- Returns:
- The quaternion with the rotation
-
getBillboardRotation
public static com.badlogic.gdx.math.Quaternion getBillboardRotation(com.badlogic.gdx.math.Vector3 direction, com.badlogic.gdx.math.Vector3 up)
Returns a Quaternion representing the billboard rotation to be applied to a decal that is always to face the given direction and up vector- Parameters:
direction
- The direction vectorup
- The up vector- Returns:
- The quaternion with the rotation
-
setBillboardRotation
public static void setBillboardRotation(com.badlogic.gdx.math.Quaternion rotation, com.badlogic.gdx.math.Vector3 direction, com.badlogic.gdx.math.Vector3 up)
Sets the rotation of this decal based on the (normalized) direction and up vector.- Parameters:
rotation
- out-parameter, quaternion where the result is setdirection
- the direction vectorup
- the up vector
-
-