|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.graphics.g3d.decals.Decal
public class Decal
Represents a sprite in 3d space. Typical 3d transformations such as translation, rotation and scaling are supported. The position includes a z component other than setting the depth no manual layering has to be performed, correct overlay is guaranteed by using the depth buffer. Decals are handled by the
DecalBatch
.
Field Summary | |
---|---|
static int |
C1
|
static int |
C2
|
static int |
C3
|
static int |
C4
|
protected Vector2 |
dimensions
|
protected DecalMaterial |
material
|
protected Vector3 |
position
|
protected Quaternion |
rotation
|
protected static Quaternion |
rotator
|
protected Vector2 |
scale
|
static int |
SIZE
Size of the decal in floats. |
Vector2 |
transformationOffset
The transformation offset can be used to change the pivot point for rotation and scaling. |
static int |
U1
|
static int |
U2
|
static int |
U3
|
static int |
U4
|
protected boolean |
updated
|
static int |
V1
|
static int |
V2
|
static int |
V3
|
static int |
V4
|
int |
value
Set a multipurpose value which can be queried and used for things like group identification. |
protected float[] |
vertices
|
protected static Vector3 |
X_AXIS
|
static int |
X1
|
static int |
X2
|
static int |
X3
|
static int |
X4
|
protected static Vector3 |
Y_AXIS
|
static int |
Y1
|
static int |
Y2
|
static int |
Y3
|
static int |
Y4
|
protected static Vector3 |
Z_AXIS
|
static int |
Z1
|
static int |
Z2
|
static int |
Z3
|
static int |
Z4
|
Constructor Summary | |
---|---|
protected |
Decal()
|
Method Summary | |
---|---|
float |
getHeight()
|
DecalMaterial |
getMaterial()
|
Vector3 |
getPosition()
Returns the position of this decal. |
Quaternion |
getRotation()
Returns the rotation. |
float |
getScaleX()
|
float |
getScaleY()
|
TextureRegion |
getTextureRegion()
|
float[] |
getVertices()
Returns the vertices backing this sprite. The returned value should under no circumstances be modified. |
float |
getWidth()
|
float |
getX()
|
float |
getY()
|
float |
getZ()
|
void |
lookAt(Vector3 position,
Vector3 up)
Sets the rotation of the Decal to face the given point. |
static Decal |
newDecal(float width,
float height,
TextureRegion textureRegion)
Creates a decal using the region for texturing |
static Decal |
newDecal(float width,
float height,
TextureRegion textureRegion,
boolean hasTransparency)
Creates a decal using the region for texturing |
static Decal |
newDecal(float width,
float height,
TextureRegion textureRegion,
int srcBlendFactor,
int dstBlendFactor)
Creates a decal using the region for texturing and the specified blending parameters for blending |
static Decal |
newDecal(TextureRegion textureRegion)
Creates a decal assuming the dimensions of the texture region |
static Decal |
newDecal(TextureRegion textureRegion,
boolean hasTransparency)
Creates a decal assuming the dimensions of the texture region and adding transparency |
protected void |
resetVertices()
Resets the position components of the vertices array based ont he dimensions (preparation for transformation) |
void |
rotateX(float angle)
Rotates along local X axis by the specified angle |
void |
rotateY(float angle)
Rotates along local Y axis by the specified angle |
void |
rotateZ(float angle)
Rotates along local Z axis by the specified angle |
void |
setBlending(int srcBlendFactor,
int dstBlendFactor)
Sets the blending parameters for this decal |
void |
setColor(float r,
float g,
float b,
float a)
Sets the color of all four vertices to the specified color |
void |
setDimensions(float width,
float height)
Sets the width and height in world units |
void |
setHeight(float height)
Sets the height in world units |
void |
setPosition(float x,
float y,
float z)
Sets the position to the given world coordinates |
void |
setRotation(Vector3 dir,
Vector3 up)
Sets the rotation of this decal based on the (normalized) direction and up vector. |
void |
setRotationX(float angle)
Sets the rotation on the local X axis to the specified angle |
void |
setRotationY(float angle)
Sets the rotation on the local Y axis to the specified angle |
void |
setRotationZ(float angle)
Sets the rotation on the local Z axis to the specified angle |
void |
setScale(float scale)
Sets scale along both the x and y axis |
void |
setScale(float scaleX,
float scaleY)
Sets scale along both the x and y axis |
void |
setScaleX(float scale)
Sets scale along the x axis |
void |
setScaleY(float scale)
Sets scale along the y axis |
void |
setTextureRegion(TextureRegion textureRegion)
Sets the texture region |
void |
setWidth(float width)
Sets the width in world units |
void |
setX(float x)
Sets the position on the x axis |
void |
setY(float y)
Sets the position on the y axis |
void |
setZ(float z)
Sets the position on the z axis |
protected void |
transformVertices()
Transforms the position component of the vertices using properties such as position, scale, etc. |
void |
translate(float x,
float y,
float z)
Translates by the specified amount of units |
void |
translateX(float units)
Moves by the specified amount of units along the x axis |
void |
translateY(float units)
Moves by the specified amount of units along the y axis |
void |
translateZ(float units)
Moves by the specified amount of units along the z axis |
protected void |
update()
Recalculates vertices array if it grew out of sync with the properties (position, ..) |
protected void |
updateUVs()
Re-applies the uv coordinates from the material's texture region to the uv components of the vertices array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SIZE
public int value
protected float[] vertices
protected Vector3 position
protected Quaternion rotation
protected Vector2 scale
public Vector2 transformationOffset
protected Vector2 dimensions
protected DecalMaterial material
protected boolean updated
public static final int X1
public static final int Y1
public static final int Z1
public static final int C1
public static final int U1
public static final int V1
public static final int X2
public static final int Y2
public static final int Z2
public static final int C2
public static final int U2
public static final int V2
public static final int X3
public static final int Y3
public static final int Z3
public static final int C3
public static final int U3
public static final int V3
public static final int X4
public static final int Y4
public static final int Z4
public static final int C4
public static final int U4
public static final int V4
protected static Quaternion rotator
protected static final Vector3 X_AXIS
protected static final Vector3 Y_AXIS
protected static final Vector3 Z_AXIS
Constructor Detail |
---|
protected Decal()
Method Detail |
---|
public void setColor(float r, float g, float b, float a)
r
- Red componentg
- Green componentb
- Blue componenta
- Alpha componentpublic void setRotationX(float angle)
angle
- Angle in degrees to set rotation topublic void setRotationY(float angle)
angle
- Angle in degrees to set rotation topublic void setRotationZ(float angle)
angle
- Angle in degrees to set rotation topublic void rotateX(float angle)
angle
- Angle in degrees to rotate bypublic void rotateY(float angle)
angle
- Angle in degrees to rotate bypublic void rotateZ(float angle)
angle
- Angle in degrees to rotate bypublic void setRotation(Vector3 dir, Vector3 up)
dir
- the direction vectorup
- the up vectorpublic Quaternion getRotation()
public void translateX(float units)
units
- Units to move the decalpublic void setX(float x)
x
- Position to locate the decal atpublic float getX()
public void translateY(float units)
units
- Units to move the decalpublic void setY(float y)
y
- Position to locate the decal atpublic float getY()
public void translateZ(float units)
units
- Units to move the decalpublic void setZ(float z)
z
- Position to locate the decal atpublic float getZ()
public void translate(float x, float y, float z)
x
- Units to move along the x axisy
- Units to move along the y axisz
- Units to move along the z axispublic void setPosition(float x, float y, float z)
x
- X positiony
- Y Positionz
- Z Positionpublic Vector3 getPosition()
public void setScaleX(float scale)
scale
- New scale along x axispublic float getScaleX()
public void setScaleY(float scale)
scale
- New scale along y axispublic float getScaleY()
public void setScale(float scaleX, float scaleY)
scaleX
- Scale on the x axisscaleY
- Scale on the y axispublic void setScale(float scale)
scale
- New scalepublic void setWidth(float width)
width
- Width in world unitspublic float getWidth()
public void setHeight(float height)
height
- Height in world unitspublic float getHeight()
public void setDimensions(float width, float height)
width
- Width in world unitsheight
- Height in world unitspublic float[] getVertices()
protected void update()
protected void transformVertices()
protected void resetVertices()
protected void updateUVs()
public void setTextureRegion(TextureRegion textureRegion)
textureRegion
- Texture region to applypublic TextureRegion getTextureRegion()
public void setBlending(int srcBlendFactor, int dstBlendFactor)
srcBlendFactor
- Source blend factor used by glBlendFuncdstBlendFactor
- Destination blend factor used by glBlendFuncpublic DecalMaterial getMaterial()
public void lookAt(Vector3 position, Vector3 up)
position
- up
- public static Decal newDecal(TextureRegion textureRegion)
textureRegion
- Texture region to use
public static Decal newDecal(TextureRegion textureRegion, boolean hasTransparency)
textureRegion
- Texture region to usehasTransparency
- Whether or not this sprite will be treated as having transparency (transparent png, etc.)
public static Decal newDecal(float width, float height, TextureRegion textureRegion)
width
- Width of the decal in world unitsheight
- Height of the decal in world unitstextureRegion
- TextureRegion to use
public static Decal newDecal(float width, float height, TextureRegion textureRegion, boolean hasTransparency)
width
- Width of the decal in world unitsheight
- Height of the decal in world unitstextureRegion
- TextureRegion to usehasTransparency
- Whether or not this sprite will be treated as having transparency (transparent png, etc.)
public static Decal newDecal(float width, float height, TextureRegion textureRegion, int srcBlendFactor, int dstBlendFactor)
width
- Width of the decal in world unitsheight
- Height of the decal in world unitstextureRegion
- TextureRegion to usesrcBlendFactor
- Source blend used by glBlendFuncdstBlendFactor
- Destination blend used by glBlendFunc
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |