/**
* Applies value for 4 sprite vertices
*
* @param {number} index first vertex index also sprite index
* @param {number} offset prop offset for value
* @param {*} value value to write (into Foat32Array[])
* @example
* const posIndecies = {x:0, y: 1, z: 2};
*
* //sets x pos. you can wrap it into any function, getter/setter or whatever
* manager.applyPropForVerties(sprite.index, posIndecies.x, 42.0); //x
*/
applyPropForVerties(index, offset, value) {
const apply = (vertindex) => {
const globalOffset = vertindex * BabylonSprite.vertexStrideSize;
this._vertexData[globalOffset + offset] = value;
};
apply(index * 4 + 0);
apply(index * 4 + 1);
apply(index * 4 + 2);
apply(index * 4 + 3);
this.dirty = true;
}
Comments