mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-29 18:20:18 -07:00
Remove unnecessary code from modelviewer
This commit is contained in:
parent
e5e50e8010
commit
084cac49db
@ -155,38 +155,23 @@ ModelViewer.prototype.initLights = function () {
|
|||||||
ModelViewer.prototype.addModel = function(geometry) {
|
ModelViewer.prototype.addModel = function(geometry) {
|
||||||
var material = new THREE.MeshPhongMaterial({
|
var material = new THREE.MeshPhongMaterial({
|
||||||
color: 0x136fc3,
|
color: 0x136fc3,
|
||||||
specular: 0x0D0D0D,
|
specular: 0x111111,
|
||||||
shading: THREE.SmoothShading,
|
shading: THREE.SmoothShading,
|
||||||
shininess: 30,
|
shininess: 30,
|
||||||
fog: false,
|
fog: false,
|
||||||
side: THREE.DoubleSide,
|
side: THREE.DoubleSide,
|
||||||
wireframe: this.wireframe,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
geometry.center();
|
|
||||||
var mesh = new THREE.Mesh(geometry, material);
|
var mesh = new THREE.Mesh(geometry, material);
|
||||||
|
|
||||||
mesh.geometry.computeFaceNormals();
|
// Move model to ground
|
||||||
mesh.geometry.computeVertexNormals();
|
geometry.center();
|
||||||
mesh.geometry.computeBoundingBox();
|
|
||||||
|
|
||||||
mesh.castShadow = true;
|
|
||||||
// mesh.receiveShadow = true;
|
|
||||||
|
|
||||||
var dims = mesh.geometry.boundingBox.max.clone().sub(mesh.geometry.boundingBox.min);
|
|
||||||
|
|
||||||
maxDim = Math.max(Math.max(dims.x, dims.y), dims.z);
|
|
||||||
|
|
||||||
mesh.position.x = -(mesh.geometry.boundingBox.min.x + mesh.geometry.boundingBox.max.x) / 2;
|
|
||||||
mesh.position.y = -(mesh.geometry.boundingBox.min.y + mesh.geometry.boundingBox.max.y) / 2;
|
|
||||||
mesh.position.z = -mesh.geometry.boundingBox.min.z;
|
mesh.position.z = -mesh.geometry.boundingBox.min.z;
|
||||||
|
|
||||||
// mesh.position.set(0, mesh.position.x, mesh.position.z);
|
|
||||||
|
|
||||||
this.object = mesh;
|
this.object = mesh;
|
||||||
|
|
||||||
this.scene.add(mesh);
|
this.scene.add(mesh);
|
||||||
|
|
||||||
|
// Center and zoom camera to model
|
||||||
this.centerCamera(mesh);
|
this.centerCamera(mesh);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user