Class: Gfx3SpriteJSS
The `Gfx3SpriteJSS` is a subclass of `Gfx3Sprite` that represents a static sprite (without animations).
Constructors
- new Gfx3SpriteJSS(): Gfx3SpriteJSS
The constructor.
Methods
- beginVertices(vertexCount: number): void
The "beginVertices" function prepare your vertex buffer to write process.
Warning: You need to call this method before define your vertices.
- vertexCount: The parameter `vertexCount` represents the number of vertices that
will be stored in the vertex buffer.
- defineVertex(v: number[]): void
The "defineVertex" function takes in an array of numbers representing a vertex.
- v: An array of numbers representing the attributes of vertex.
- delete(): void
The "delete" function free all resources.
Warning: you need to call this method to free allocation for this object.
- draw(): void
The "draw" function.
- endVertices(): void
The "endVertices" function writes vertex data to the vertex buffer and calculates the bounding box
based on the vertices.
- getBillboardMode(): boolean
The "getBillboardMode" function returns the billboardMode property.
- getBoundingBox(): Gfx3BoundingBox
The "getBoundingBox" function returns the bounding box.
- getFlip()
The "getFlip" function returns two booleans, first is the x-axis flip flag, second is the y-axis flip flag.
- getGroup01(): Gfx3StaticGroup
The "getGroup01" function returns the static group index 1.
- getLocalAxies()
The "getLocalAxies" function returns an array of three vectors representing the local axes of an
object based on its transformation matrix.
- getOffset(): vec2
The "getOffset" function returns the origin offset.
- getOffsetX(): number
The "getOffsetX" function returns the offset in x-axis direction.
- getOffsetY(): number
The "getOffsetY" function returns the offset in y-axis direction.
- getPixelsPerUnit(): number
The "getPixelsPerUnit" function get the pixelsPerUnit property.
- getPosition(): vec3
The "getPosition" function returns the position.
- getPositionX(): number
The "getPositionX" function returns the x-coordinate of the position.
- getPositionY(): number
The "getPositionY" function returns the y-coordinate of the position.
- getPositionZ(): number
The "getPositionZ" function returns the z-coordinate of the position.
- getRotation(): vec3
The "getRotation" function returns the rotation as Euler angles.
- getRotationQuaternion(): vec4
The "getRotationQuaternion" function returns the Quaternion based on the Euler angles provided.
- getRotationX(): number
The "getRotationX" function returns the rotation angle on x-axis.
- getRotationY(): number
The "getRotationY" function returns the rotation angle on y-axis.
- getRotationZ(): number
The "getRotationZ" function returns the rotation angle on z-axis.
- getScale(): vec3
The "getScale" function returns the scale as a 3D vector.
- getScaleX(): number
The "getScaleX" function returns the scale factor on x-axis.
- getScaleY(): number
The "getScaleY" function returns the scale factor on y-axis.
- getScaleZ(): number
The "getScaleZ" function returns the scale factor on z-axis.
- getTexture(): Gfx3Texture
The "getTexture" function returns the sprite texture.
- getTextureRect(): vec4
The "getTextureRect" function returns the texture rectangle.
- getTransformMatrix(): mat4
The "getTransformMatrix" function returns the transform matrix from position, rotation, scale, origin offset
and pixel per unit values.
- getVertexCount(): number
The "getVertexCount" function returns the number of vertices.
- getVertexSubBufferOffset(): number
The "getVertexSubBufferOffset" function returns the offset of the vertex sub-buffer.
Nota bene: All vertices are stored in one global vertex buffer handled by "Gfx3Manager".
SubBuffer is just a reference offset/size pointing to the big one buffer.
- getVertexSubBufferSize(): number
The "getVertexSubBufferSize" function returns the byte length of the vertex sub buffer.
Nota bene: All vertices are stored in one global vertex buffer handled by "Gfx3Manager".
SubBuffer is just a reference offset/size pointing to the big one buffer.
- getVertices()
The "getVertices" function returns an array of numbers representing vertices.
- getWorldBoundingBox(): Gfx3BoundingBox
The "getWorldBoundingBox" function returns the world bounding box by transforming its
local bounding box using its transform matrix.
- rotate(x: number, y: number, z: number): void
The "rotate" function add rotation values to Euler angles.
- x: The rotation angle on x-axis in radians.
- y: The rotation angle on y-axis in radians.
- z: The rotation angle on z-axis in radians.
- setBillboardMode(billboardMode: boolean): void
The "setBillboardMode" function sets the billboard mode to either true or false.
- billboardMode: A boolean value that determines whether the object should be
displayed as a billboard, meaning it always faces the camera regardless of its orientation.
- setFlipX(x: boolean): void
The "setFlipX" function sets the value of the flipX property to the provided boolean value.
- setFlipY(y: boolean): void
The "setFlipY" function sets the value of the flipY property to the provided boolean value.
- setOffset(offsetX: number, offsetY: number): void
The "setOffset" function set the origin offset value.
- offsetX: The x-offset.
- offsetY: The y-offset.
- setOffsetNormalized(offsetXFactor: number, offsetYFactor: number): void
The "setOffsetNormalized" function sets the normalized origin offset value.
- offsetXFactor: The offsetXFactor represent the normalized x-coordinate offset value.
- offsetYFactor: The offsetYFactor represent the normalized y-coordinate offset value.
- setPixelsPerUnit(pixelsPerUnit: number): void
The "setPixelsPerUnit" function sets the number of pixels per unit.
- pixelsPerUnit: The `pixelsPerUnit` parameter is a number that represents the number
of pixels per unit of measurement. It is used to determine the scale or resolution at which
the sprite is displayed.
- setPosition(x: number, y: number, z: number): void
The "setPosition" function set the position with the given x, y and z coordinates.
- x: The X coordinate of the position.
- y: The Y coordinate of the position.
- z: The Z coordinate of the position.
- setRotation(x: number, y: number, z: number): void
The "setRotation" function sets rotation Euler angles (in radians).
- x: The rotation angle on x-axis in radians.
- y: The rotation angle on y-axis in radians.
- z: The rotation angle on z-axis in radians.
- setRotationQuaternion(quaternion: vec4): void
The "setRotationQuaternion" function sets the rotation using Quaternion.
- quaternion: The quaternion.
- setScale(x: number, y: number, z: number): void
The "setScale" function sets the scale with the given x, y and z factors.
- x: The x factor in the x-axis direction.
- y: The y factor in the y-axis direction.
- z: The z factor in the z-axis direction.
- setTexture(texture: Gfx3Texture): void
The "setTexture" function sets the sprite texture.
- texture: The sprite texture.
- setTextureRect(left: number, top: number, width: number, height: number): void
The "setTextureRect" function sets the texture rectangle with the given left, top, width, and height values.
- left: The x-coordinate of the top-left texture rectangle corner.
- top: The y-coordinate of the top-left texture rectangle corner.
- width: The width of the texture rectangle.
- height: The height of the texture rectangle.
- setVertices(vertices: number[]): void
The "setVertices" function sets the vertices in one pass.
- vertices: An array of numbers representing the vertices of a shape.
- translate(x: number, y: number, z: number): void
The "translate" function translate the position.
- x: The amount of translation in the x-axis direction.
- y: The amount of translation in the y-axis direction.
- z: The amount of translation in the z-axis direction.
- update(): void
The "update" function.
- zoom(x: number, y: number, z: number): void
The "zoom" function add scale values.
- x: The x factor in the x-axis direction.
- y: The y factor in the y-axis direction.
- z: The z factor in the z-axis direction.