2018-04-09 09:35:04 +02:00
|
|
|
/**
|
|
|
|
* R3.D3.Vertex
|
|
|
|
* @param implementation
|
|
|
|
* @param apiVertex
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
R3.D3.Vertex = function Vertex(
|
|
|
|
implementation,
|
|
|
|
apiVertex
|
|
|
|
) {
|
|
|
|
this.implementation = implementation;
|
|
|
|
this.implementation.isNotThreeThrow();
|
|
|
|
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiVertex)) {
|
|
|
|
apiVertex = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
R3.D3.API.Vertex.call(
|
|
|
|
this,
|
|
|
|
apiVertex.position,
|
|
|
|
apiVertex.boneWeights
|
|
|
|
);
|
|
|
|
|
|
|
|
this.position = new R3.Vector3(
|
|
|
|
this.implementation,
|
|
|
|
this.position,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
this.boneWeights = this.boneWeights.map(
|
|
|
|
function(boneWeight) {
|
|
|
|
return new R3.Vector4(
|
2018-05-01 07:46:39 +02:00
|
|
|
this.implementation,
|
2018-04-09 09:35:04 +02:00
|
|
|
boneWeight
|
|
|
|
)
|
2018-05-01 07:46:39 +02:00
|
|
|
}.bind(this)
|
2018-04-09 09:35:04 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
R3.D3.Vertex.prototype = Object.create(R3.Component.prototype);
|
|
|
|
R3.D3.Vertex.prototype.constructor = R3.D3.Vertex;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts a R3.D3.Vertex to R3.D3.API.Vertex
|
|
|
|
* @returns {R3.D3.API.Vertex}
|
|
|
|
*/
|
|
|
|
R3.D3.Vertex.prototype.toApiObject = function() {
|
|
|
|
|
|
|
|
return new R3.D3.API.Vertex(
|
|
|
|
this.position.toApiObject(),
|
|
|
|
this.boneWeights.map(
|
|
|
|
function(boneWeight){
|
|
|
|
return boneWeight.toApiObject();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|