Ignore:
Timestamp:
04/18/20 20:18:36 (4 years ago)
Author:
Maciej Komosinski
Message:

Added the actual functionality of the app in place of previous draft

File:
1 edited

Legend:

Unmodified
Added
Removed
  • js/human_3d_alignment/src/visualization/partmeshfactory.js

    r881 r911  
    3636     * @returns {PartMesh} info about part mesh
    3737     */
    38     getNewSphereMesh(part, sphereRadius, segments, applyScale) {
     38    getNewSphereMesh(part, color, sphereRadius, segments, applyScale) {
    3939        let geometry = new THREE.SphereGeometry(sphereRadius, segments, segments);
    40         let material = this.transformations.getNewMaterial(
    41             part.get_vcolor().get_x(),
    42             part.get_vcolor().get_y(),
    43             part.get_vcolor().get_z());
     40        let material = this.transformations.getNewMaterial(color);
    4441        let mesh = null;
    4542        if (applyScale) {
     
    9491     * @returns {PartMesh} info about part mesh
    9592     */
    96     getNewBoxMesh(part) {
     93    getNewBoxMesh(part, color) {
    9794        let geometry = new THREE.BoxGeometry(2, 2, 2);
    9895        geometry.scale(
     
    10198            part.get_scale().get_z());
    10299
    103         let material = this.transformations.getNewMaterial(
    104             part.get_vcolor().get_x(),
    105             part.get_vcolor().get_y(),
    106             part.get_vcolor().get_z());
     100        let material = this.transformations.getNewMaterial(color);
    107101        let mesh = new THREE.Mesh(geometry, material);
    108102        mesh.position.set(
     
    133127     * @returns {PartMesh} info about part mesh
    134128     */
    135     getNewCylinderMesh(part) {
     129    getNewCylinderMesh(part, color) {
    136130        let geometry = new THREE.CylinderGeometry(1, 1, 2, 32);
    137         let material = this.transformations.getNewMaterial(
    138             part.get_vcolor().get_x(),
    139             part.get_vcolor().get_y(),
    140             part.get_vcolor().get_z());
     131        let material = this.transformations.getNewMaterial(color);
    141132
    142133        geometry.scale(
     
    181172     * @returns {PartMesh} info about part mesh
    182173     */
    183     create(part) {
     174    create(part, color) {
    184175
    185176        let shape = part.get_shape();
     
    187178            return this.getNewSphereMesh(
    188179                part,
     180                color,
    189181                this.config.ellipsoidShape.radius,
    190182                this.config.ellipsoidShape.segments, true);
    191183        }
    192184        else if (this.partShapes['SHAPE_CUBOID'].value == shape) {
    193             return this.getNewBoxMesh(part);
     185            return this.getNewBoxMesh(part, color);
    194186        }
    195187        else if (this.partShapes['SHAPE_CYLINDER'].value == shape) {
    196             return this.getNewCylinderMesh(part);
     188            return this.getNewCylinderMesh(part, color);
    197189        }
    198190        return this.getNewSphereMesh(
    199191            part,
     192            color,
    200193            this.config.defaultShape.radius,
    201194            this.config.defaultShape.segments,
Note: See TracChangeset for help on using the changeset viewer.