better skeleton and bone creation
parent
904fc77407
commit
1147f6d1d5
|
@ -60,11 +60,12 @@ R3.D3.Mesh = function (
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.skeleton) {
|
if (
|
||||||
this.skeleton = new R3.D3.Skeleton(
|
R3.Utils.Defined(this.skeleton) &&
|
||||||
this.graphics,
|
R3.Utils.Defined(this.skeleton.componentType) &&
|
||||||
this.skeleton
|
!(this.skeleton instanceof R3.D3.Skeleton)
|
||||||
);
|
) {
|
||||||
|
this.skeleton = R3.Component.ConstructFromObject(this.skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cloneDirection = new R3.Vector3(
|
this.cloneDirection = new R3.Vector3(
|
||||||
|
|
|
@ -29,17 +29,15 @@ R3.D3.Skeleton = function Skeleton(
|
||||||
apiSkeleton.parentEntity
|
apiSkeleton.parentEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
this.bones = this.bones.map(
|
this.bones = this.bones.map(
|
||||||
function(apiBone) {
|
function(apiBone) {
|
||||||
|
|
||||||
if (apiBone instanceof R3.D3.API.Bone) {
|
if (
|
||||||
return new R3.D3.Bone(
|
R3.Utils.Defined(apiBone.componentType) &&
|
||||||
this.graphics,
|
!(apiBone instanceof R3.D3.Bone)
|
||||||
apiBone
|
) {
|
||||||
)
|
return R3.Component.ConstructFromObject(apiBone);
|
||||||
} else {
|
|
||||||
console.warn('apiBone not an instance of API.Bone');
|
|
||||||
throw new Error('apiBone not an instance of API.Bone');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
|
@ -30,10 +30,10 @@ R3.D3.Vertex = function Vertex(
|
||||||
this.boneWeights = this.boneWeights.map(
|
this.boneWeights = this.boneWeights.map(
|
||||||
function(boneWeight) {
|
function(boneWeight) {
|
||||||
return new R3.Vector4(
|
return new R3.Vector4(
|
||||||
this.graphics,
|
this.implementation,
|
||||||
boneWeight
|
boneWeight
|
||||||
)
|
)
|
||||||
}
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue