Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @private
* @member {object[]}
*/
this.staticProperties = [];
for (let i = 0; i < properties.length; ++i)
{
let property = properties[i];
// Make copy of properties object so that when we edit the offset it doesn't
// change all other instances of the object literal
property = {
attributeName: property.attributeName,
size: property.size,
uploadFunction: property.uploadFunction,
type: property.type || TYPES.FLOAT,
offset: property.offset,
};
if (dynamicPropertyFlags[i])
{
this.dynamicProperties.push(property);
}
else
{
this.staticProperties.push(property);
}
}
this.staticStride = 0;
this.staticBuffer = null;
this.staticData = null;
constructor(vertices, uvs, index)
{
super();
const verticesBuffer = new Buffer(vertices);
const uvsBuffer = new Buffer(uvs, true);
const indexBuffer = new Buffer(index, true, true);
this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)
.addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)
.addIndex(indexBuffer);
/**
* Dirty flag to limit update calls on Mesh. For example,
* limiting updates on a single Mesh instance with a shared Geometry
* within the render loop.
* @private
* @member {number}
* @default -1
*/
this._updateId = -1;
}
*
* @member {PIXI.Buffer}
* @protected
*/
this._buffer = new Buffer(null, _static, false);
/**
* Index buffer data
*
* @member {PIXI.Buffer}
* @protected
*/
this._indexBuffer = new Buffer(null, _static, true);
this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)
.addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)
.addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)
.addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)
.addIndex(this._indexBuffer);
}
}
export function sizeOfType(glint)
{
switch (glint)
{
case TYPES.FLOAT:
return 4;
case TYPES.HALF_FLOAT:
case TYPES.UNSIGNED_SHORT_5_5_5_1:
case TYPES.UNSIGNED_SHORT_4_4_4_4:
case TYPES.UNSIGNED_SHORT_5_6_5:
case TYPES.UNSIGNED_SHORT:
return 2;
case TYPES.UNSIGNED_BYTE:
return 1;
default:
throw new Error(`{$glint} isn't a TYPES enum!`);
}
}
* Buffer used for position, color, texture IDs
*
* @member {PIXI.Buffer}
* @protected
*/
this._buffer = new Buffer(null, _static, false);
/**
* Index buffer data
*
* @member {PIXI.Buffer}
* @protected
*/
this._indexBuffer = new Buffer(null, _static, true);
this.addAttribute('aVertexPosition', this._buffer, 2, false, TYPES.FLOAT)
.addAttribute('aTextureCoord', this._buffer, 2, false, TYPES.FLOAT)
.addAttribute('aColor', this._buffer, 4, true, TYPES.UNSIGNED_BYTE)
.addAttribute('aTextureId', this._buffer, 1, true, TYPES.FLOAT)
.addIndex(this._indexBuffer);
}
}
constructor(vertices, uvs, index)
{
super();
const verticesBuffer = new Buffer(vertices);
const uvsBuffer = new Buffer(uvs, true);
const indexBuffer = new Buffer(index, true, true);
this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)
.addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)
.addIndex(indexBuffer);
/**
* Dirty flag to limit update calls on Mesh. For example,
* limiting updates on a single Mesh instance with a shared Geometry
* within the render loop.
* @private
* @member {number}
* @default -1
*/
this._updateId = -1;
}