Package gaiasky.util

Class 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 size, float rotationCenter, com.badlogic.gdx.graphics.Camera camera, boolean faceCamera)  
      static void drawFont3D​(BitmapFont font, ExtSpriteBatch batch, java.lang.String text, float x, float y, float z, float size, float rotationCenter, com.badlogic.gdx.graphics.Camera camera, 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, 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 camera
      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
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DecalUtils

        public DecalUtils()
    • 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 that ExtSpriteBatch.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 size,
                                      float rotationCenter,
                                      com.badlogic.gdx.graphics.Camera camera,
                                      boolean faceCamera)
      • drawFont3D

        public static void drawFont3D​(BitmapFont font,
                                      ExtSpriteBatch batch,
                                      java.lang.String text,
                                      float x,
                                      float y,
                                      float z,
                                      float size,
                                      float rotationCenter,
                                      com.badlogic.gdx.graphics.Camera camera,
                                      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 that ExtSpriteBatch.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.
        camera - 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,
                                      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 that ExtSpriteBatch.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)
      • 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 vector
        up - 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 set
        direction - the direction vector
        up - 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 vector
        up - the up vector