Reputation: 37
I am trying to load PLY models from backend, however they aren't displaying correctly (those three mountains should be 3 models of scanned trees).
I tried to change mesh but it doesn't change the lines showing instead of points.
Code:
public prepare3d():void{
var height= 400;
var width = this.rendererContainer.nativeElement.clientWidth;
var scene = new THREE.Scene();
scene.background = new THREE.Color( 0xEEEEEE );
const fov = 45;
const aspect = width / height;
const near = 1;
const far = 1000;
var camera = new THREE.PerspectiveCamera( 75, width / height, 0.1, 1000 );
camera.position.set( 3, 0.15, 3 );
var cameraTarget = new THREE.Vector3( 0, - 0.1, 0 );
var geometry = new THREE.BoxGeometry();
loader.load( '/assets/v1.ply', function ( geometry ) {
geometry.computeVertexNormals();
var material = new THREE.MeshStandardMaterial( { color: 0x0055ff, flatShading: true } );
var mesh = new THREE.Mesh( geometry, material );
mesh.position.y = 0;
mesh.position.z = 0.3;
mesh.rotation.x = - Math.PI / 2;
mesh.scale.multiplyScalar( 0.001 );
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
});
}
Upvotes: 0
Views: 354