r3-legacy/src/game-lib-d3-skeleton.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-10-14 12:32:53 +02:00
/**
* Skeleton Superset
* @param id
2016-12-02 13:00:56 +01:00
* @param bones GameLib.D3.API.Bone
2016-10-14 12:32:53 +02:00
* @param boneInverses
* @param useVertexTexture
* @param boneTextureWidth
* @param boneTextureHeight
* @param boneMatrices
* @param boneTexture
* @constructor
*/
2016-11-21 16:08:39 +01:00
GameLib.D3.Skeleton = function Skeleton(
2016-10-14 12:32:53 +02:00
id,
bones,
boneInverses,
useVertexTexture,
boneTextureWidth,
boneTextureHeight,
boneMatrices,
boneTexture
) {
this.id = id;
this.bones = bones;
/**
* An array of Matrix4s that represent the inverse of the matrixWorld of the individual bones.
2016-12-15 14:53:39 +01:00
* @type GameLib.Matrix4[]
2016-10-14 12:32:53 +02:00
*/
if (typeof boneInverses == 'undefined') {
boneInverses = [];
}
this.boneInverses = boneInverses;
/**
* Use a vertex texture in the shader - allows for more than 4 bones per vertex, not supported by all devices
* @type {boolean}
*/
if (typeof useVertexTexture == 'undefined') {
useVertexTexture = false;
}
this.useVertexTexture = useVertexTexture;
if (this.useVertexTexture == true) {
console.warn('support for vertex texture bones is not supported yet - something could break somewhere');
}
if (typeof boneTextureWidth == 'undefined') {
boneTextureWidth = 0;
}
this.boneTextureWidth = boneTextureWidth;
if (typeof boneTextureHeight == 'undefined') {
boneTextureHeight = 0;
}
this.boneTextureHeight = boneTextureHeight;
if (typeof boneMatrices == 'undefined') {
boneMatrices = [];
}
this.boneMatrices = boneMatrices;
if (typeof boneTexture == 'undefined') {
boneTexture = [];
}
this.boneTexture = boneTexture;
};