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/jointmeshfactory.js

    r881 r911  
    3333     * @returns {Mesh}  Mesh for a given joint
    3434     */
    35     getNewJointMesh(joint, shapeConfig) {
     35    getNewJointMesh(joint, color, shapeConfig) {
    3636        let firstPartPosVec = new THREE.Vector3(
    3737            joint.get_part1().get_p().get_x(),
     
    4242            joint.get_part2().get_p().get_y(),
    4343            joint.get_part2().get_p().get_z());
    44         //let line = new THREE.LineCurve3(firstPartPosVec, secondPartPosVec);
    45         //let geometry = new THREE.TubeGeometry(line, numsegmentstube, shapeConfig.radius,
    46         //    shapeConfig.radiusSegments, false);
    4744
    4845        let direction = new THREE.Vector3().subVectors(secondPartPosVec, firstPartPosVec);
    49         let orientation = new THREE.Matrix4();
    50 
    51         let geometry = new THREE.CylinderGeometry(shapeConfig.radius, shapeConfig.radius, direction.length(), shapeConfig.radiusSegments);
    52        
    53 
    54         let material = this.transformations.getNewMaterial(
    55             joint.get_vcolor().get_x(),
    56             joint.get_vcolor().get_y(),
    57             joint.get_vcolor().get_z());
    58         material.transparent = shapeConfig.isTransparent;
    59         material.opacity = shapeConfig.opacity;
    60         //let mesh = new THREE.Mesh(geometry, material);
    61        
     46        let geometry = new THREE.CylinderGeometry(shapeConfig.radius, shapeConfig.radius, direction.length() - 2 * 0.18, shapeConfig.radiusSegments);     
     47        let material = this.transformations.getNewMaterial(color);   
    6248        let mesh = new THREE.Mesh( geometry, material ); //new Physijs.CylinderMesh( geometry, Physijs.createMaterial(material) ); //new THREE.Mesh( geometry, material );
    6349
     50        let orientation = new THREE.Matrix4();
    6451        orientation.lookAt(firstPartPosVec, secondPartPosVec, new THREE.Object3D().up);
    6552        orientation.multiply(new THREE.Matrix4().set(
     
    8269            mesh: mesh,
    8370            connectedParts: [],
    84             showTransparent: shapeConfig.isTransparent
     71            showTransparent: true
    8572        };
    8673        return mesh;
     
    115102     * @returns {JointMesh} new joint mesh, for properties of Object look at addConnectionInfo jointMesh param documentation
    116103     */
    117     create(joint, partMeshes) {
     104    create(joint, color, partMeshes) {
    118105        let result;
    119106        let shape = joint.get_shape();
    120107
    121108        if (this.jointShapes['SHAPE_FIXED'].value == shape) {
    122             result = this.getNewJointMesh(joint, this.config.linkShape);
     109            result = this.getNewJointMesh(joint, color, this.config.linkShape);
    123110        } else {
    124             result = this.getNewJointMesh(joint, this.config.cylinderShape);
     111            result = this.getNewJointMesh(joint, color, this.config.cylinderShape);
    125112        }
    126113
Note: See TracChangeset for help on using the changeset viewer.