Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set texture(value) // eslint-disable-line require-jsdoc
{
if (this._texture === value)
{
return;
}
this._texture = value || Texture.EMPTY;
this.cachedTint = 0xFFFFFF;
this._textureID = -1;
this._textureTrimmedID = -1;
if (value)
{
// wait for the texture to load
if (value.baseTexture.valid)
{
this._onTextureUpdate();
}
else
{
value.once('update', this._onTextureUpdate, this);
}
set texture(value) // eslint-disable-line require-jsdoc
{
if (this._texture === value)
{
return;
}
if (this._texture)
{
this._texture.off('update', this._onTextureUpdate, this);
}
this._texture = value || Texture.EMPTY;
this._cachedTint = 0xFFFFFF;
this._textureID = -1;
this._textureTrimmedID = -1;
if (value)
{
// wait for the texture to load
if (value.baseTexture.valid)
{
this._onTextureUpdate();
}
else
{
value.once('update', this._onTextureUpdate, this);
}
*
* @member {PIXI.Filter|PIXI.Shader}
*/
this.shader = null;
/**
* An internal cached value of the tint.
*
* @private
* @member {number}
* @default 0xFFFFFF
*/
this.cachedTint = 0xFFFFFF;
// call texture setter
this.texture = texture || Texture.EMPTY;
/**
* this is used to store the vertex data of the sprite (basically a quad)
*
* @private
* @member {Float32Array}
*/
this.vertexData = new Float32Array(8);
/**
* This is used to calculate the bounds of the object IF it is a trimmed sprite
*
* @private
* @member {Float32Array}
*/
this.vertexTrimmedData = null;
* @member {number}
* @default 0xFFFFFF
*/
this._cachedTint = 0xFFFFFF;
/**
* this is used to store the uvs data of the sprite, assigned at the same time
* as the vertexData in calculateVertices()
*
* @private
* @member {Float32Array}
*/
this.uvs = null;
// call texture setter
this.texture = texture || Texture.EMPTY;
/**
* this is used to store the vertex data of the sprite (basically a quad)
*
* @private
* @member {Float32Array}
*/
this.vertexData = new Float32Array(8);
/**
* This is used to calculate the bounds of the object IF it is a trimmed sprite
*
* @private
* @member {Float32Array}
*/
this.vertexTrimmedData = null;
constructor(texture = Texture.EMPTY, vertices, uvs, indices, drawMode)
{
const geometry = new MeshGeometry(vertices, uvs, indices);
geometry.getBuffer('aVertexPosition').static = false;
const meshMaterial = new MeshMaterial(texture);
super(geometry, meshMaterial, null, drawMode);
/**
* upload vertices buffer each frame
* @member {boolean}
*/
this.autoUpdate = true;
}