70 lines
1.6 KiB
JavaScript
70 lines
1.6 KiB
JavaScript
|
/**
|
||
|
* Skeleton Superset
|
||
|
* @param id
|
||
|
* @param bones GameLib.D3.Bone
|
||
|
* @param boneInverses
|
||
|
* @param useVertexTexture
|
||
|
* @param boneTextureWidth
|
||
|
* @param boneTextureHeight
|
||
|
* @param boneMatrices
|
||
|
* @param boneTexture
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.D3.Skeleton = function(
|
||
|
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.
|
||
|
* @type GameLib.D3.Matrix4[]
|
||
|
*/
|
||
|
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;
|
||
|
};
|
||
|
|