首页 > 解决方案 > load vrml in an angular project using three-full

问题描述

I am trying to load vrml(wrl) file in browser using three-full and angular 6.

import {Component, ViewChild, ElementRef} from '@angular/core';
import * as THREEFULL from 'three-full';
import * as THREE from 'three';

//var STLLoader = require('three-stl-loader')(THREE);

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  @ViewChild('rendererContainer') rendererContainer: ElementRef;
  @ViewChild('inset') inset: ElementRef;

      ngOnInit() {

        // var loader = new STLLoader();
        // loader.load('assets/stls/Chiller.stl', data=>{});
        var loader = new THREEFULL.VRMLLoader();
        loader.load('assets/stls/house.wrl', data=>{});
      }    
}

But I get the following error:

ERROR TypeError: Cannot read property 'isRecordingFaces' of undefined

at parseProperty (Three.es.js:79995)

at getTree (Three.es.js:80315)

at parseV2 (Three.es.js:80799)

at VRMLLoader.parse (Three.es.js:80866)

at Object.onLoad (Three.es.js:79822)

at XMLHttpRequest. (Three.es.js:21802)

at ZoneDelegate.invokeTask (zone.js:425)

at Object.onInvokeTask (core.es5.js:3881)

at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192)

It seems that loading a wrl file causes already the error. Can someone help me?

Thank you!

标签: javascriptangular

解决方案


推荐阅读