Package gaiasky.util
Class DecalUtils
java.lang.Object
gaiasky.util.DecalUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
drawFont2D
(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, String text, float x, float y, float scale, float width) static void
drawFont2D
(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, String text, float x, float y, float scale, int align) static void
drawFont2D
(BitmapFont font, ExtSpriteBatch batch, String text, float x, float y) static void
drawFont2D
(BitmapFont font, ExtSpriteBatch batch, String text, com.badlogic.gdx.math.Vector3 position) static void
drawFont3D
(BitmapFont font, ExtSpriteBatch batch, String text, float x, float y, float z, double size, float rotationCenter, ICamera cam, boolean faceCamera, float minSizeDegrees, float maxSizeDegrees) 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, String text, float x, float y, float z, float size, float rotationCenter, ICamera camera, boolean faceCamera) static void
drawFont3D
(BitmapFont font, ExtSpriteBatch batch, String text, com.badlogic.gdx.math.Vector3 position, float scale, ICamera 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, String text, com.badlogic.gdx.math.Vector3 position, ICamera camera, boolean faceCamera) Draws the given text using the given font in the given 3D position using the 3D coordinate space.static void
drawSprite
(Sprite sprite, com.badlogic.gdx.graphics.g2d.SpriteBatch batch, float x, float y, float z, double size, float rotationCenter, ICamera cam, boolean faceCamera, float minSizeDegrees, float maxSizeDegrees) Draws the given sprite 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.
-
Constructor Details
-
DecalUtils
public DecalUtils()
-
-
Method Details
-
drawSprite
public static void drawSprite(Sprite sprite, com.badlogic.gdx.graphics.g2d.SpriteBatch batch, float x, float y, float z, double size, float rotationCenter, ICamera cam, boolean faceCamera, float minSizeDegrees, float maxSizeDegrees) Draws the given sprite using the given font in the given 3D position using the 3D coordinate space. If faceCamera is true, the sprite 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:
sprite
- The sprite.batch
- The sprite batch to use.x
- The x coordinate.y
- The y coordinate.z
- The z coordinate.size
- The scale of the sprite.rotationCenter
- Angles to rotate around center.cam
- The camera.faceCamera
- Whether to apply bill-boarding.minSizeDegrees
- Minimum visual size of the text in degrees. Zero or negative to disable.maxSizeDegrees
- Maximum visual size of the text in degrees. Zero or negative to disable.
-
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, String text, com.badlogic.gdx.math.Vector3 position, ICamera 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, String text, float x, float y, float z, float size, float rotationCenter, ICamera camera, boolean faceCamera) -
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, String text, float x, float y, float z, double size, float rotationCenter, ICamera cam, boolean faceCamera, float minSizeDegrees, float maxSizeDegrees) 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.size
- The scale of the font.rotationCenter
- Angles to rotate around center.cam
- The camera.faceCamera
- Whether to apply bill-boarding.minSizeDegrees
- Minimum visual size of the text in degrees. Zero or negative to disable.maxSizeDegrees
- Maximum visual size of the text in degrees. Zero or negative to disable.
-
drawFont3D
public static void drawFont3D(BitmapFont font, ExtSpriteBatch batch, String text, com.badlogic.gdx.math.Vector3 position, float scale, ICamera 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.scale
- The scale of the font.camera
- The camera.
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, String text, com.badlogic.gdx.math.Vector3 position) -
drawFont2D
-
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, String text, float x, float y, float scale, float width) -
drawFont2D
public static void drawFont2D(BitmapFont font, ExtSpriteBatch batch, RenderingContext rc, 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
-
setBillboardRotation
public 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.- Parameters:
direction
- the direction vectorup
- the up vector
-