better skeleton and bone creation

beta.r3js.org
-=ybafelo 2018-05-01 07:46:39 +02:00
parent 904fc77407
commit 1147f6d1d5
3 changed files with 14 additions and 15 deletions

View File

@ -60,11 +60,12 @@ R3.D3.Mesh = function (
}.bind(this)
);
if (this.skeleton) {
this.skeleton = new R3.D3.Skeleton(
this.graphics,
this.skeleton
);
if (
R3.Utils.Defined(this.skeleton) &&
R3.Utils.Defined(this.skeleton.componentType) &&
!(this.skeleton instanceof R3.D3.Skeleton)
) {
this.skeleton = R3.Component.ConstructFromObject(this.skeleton);
}
this.cloneDirection = new R3.Vector3(

View File

@ -29,17 +29,15 @@ R3.D3.Skeleton = function Skeleton(
apiSkeleton.parentEntity
);
this.bones = this.bones.map(
function(apiBone) {
if (apiBone instanceof R3.D3.API.Bone) {
return new R3.D3.Bone(
this.graphics,
apiBone
)
} else {
console.warn('apiBone not an instance of API.Bone');
throw new Error('apiBone not an instance of API.Bone');
if (
R3.Utils.Defined(apiBone.componentType) &&
!(apiBone instanceof R3.D3.Bone)
) {
return R3.Component.ConstructFromObject(apiBone);
}
}.bind(this)

View File

@ -30,10 +30,10 @@ R3.D3.Vertex = function Vertex(
this.boneWeights = this.boneWeights.map(
function(boneWeight) {
return new R3.Vector4(
this.graphics,
this.implementation,
boneWeight
)
}
}.bind(this)
);
};