r3-legacy/src/r3-d3-vertex.js

60 lines
1.2 KiB
JavaScript
Raw Normal View History

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(
this.graphics,
boneWeight
)
}
);
};
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();
}
)
);
};