- Timestamp:
- 04/18/20 20:18:36 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
js/human_3d_alignment/src/visualization/jointmeshfactory.js
r881 r911 33 33 * @returns {Mesh} Mesh for a given joint 34 34 */ 35 getNewJointMesh(joint, shapeConfig) {35 getNewJointMesh(joint, color, shapeConfig) { 36 36 let firstPartPosVec = new THREE.Vector3( 37 37 joint.get_part1().get_p().get_x(), … … 42 42 joint.get_part2().get_p().get_y(), 43 43 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);47 44 48 45 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); 62 48 let mesh = new THREE.Mesh( geometry, material ); //new Physijs.CylinderMesh( geometry, Physijs.createMaterial(material) ); //new THREE.Mesh( geometry, material ); 63 49 50 let orientation = new THREE.Matrix4(); 64 51 orientation.lookAt(firstPartPosVec, secondPartPosVec, new THREE.Object3D().up); 65 52 orientation.multiply(new THREE.Matrix4().set( … … 82 69 mesh: mesh, 83 70 connectedParts: [], 84 showTransparent: shapeConfig.isTransparent71 showTransparent: true 85 72 }; 86 73 return mesh; … … 115 102 * @returns {JointMesh} new joint mesh, for properties of Object look at addConnectionInfo jointMesh param documentation 116 103 */ 117 create(joint, partMeshes) {104 create(joint, color, partMeshes) { 118 105 let result; 119 106 let shape = joint.get_shape(); 120 107 121 108 if (this.jointShapes['SHAPE_FIXED'].value == shape) { 122 result = this.getNewJointMesh(joint, this.config.linkShape);109 result = this.getNewJointMesh(joint, color, this.config.linkShape); 123 110 } else { 124 result = this.getNewJointMesh(joint, this.config.cylinderShape);111 result = this.getNewJointMesh(joint, color, this.config.cylinderShape); 125 112 } 126 113
Note: See TracChangeset
for help on using the changeset viewer.