qq_36628227 2017-10-31 14:50 采纳率: 0%
浏览 5008

addEventListener is not a function!求大神解答!跪谢

three.js报loader.addEventListener is not a function的错误

代码如下:
<!DOCTYPE html>









if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); var container, stats; var camera, controls, scene, renderer; var cross; init(); animate(); function init() { camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.01, 1e10 ); camera.position.z = 0.2; controls = new THREE.TrackballControls( camera ); controls.rotateSpeed = 5.0; controls.zoomSpeed = 5; controls.panSpeed = 2; controls.noZoom = false; controls.noPan = false; controls.staticMoving = true; controls.dynamicDampingFactor = 0.3; scene = new THREE.Scene(); scene.add( camera ); // light var dirLight = new THREE.DirectionalLight( 0xffffff ); dirLight.position.set( 200, 200, 1000 ).normalize(); camera.add( dirLight ); camera.add( dirLight.target ); // A begin var material = new THREE.MeshLambertMaterial( { color:0xffffff, side: THREE.DoubleSide } ); var loader = new THREE.VTKLoader(); loader.addEventListener( 'load', function ( event ) { var geometry = event.content; var mesh = new THREE.Mesh( geometry, material ); mesh.position.setY( - 0.09 ); scene.add( mesh ); } ); loader.load( "../model/bunny.vtk" ); // A end // renderer renderer = new THREE.WebGLRenderer( { antialias: false } ); renderer.setClearColorHex( 0x000000, 1 ); renderer.setSize( window.innerWidth, window.innerHeight ); container = document.createElement( 'div' ); document.body.appendChild( container ); container.appendChild( renderer.domElement ); stats = new Stats(); stats.domElement.style.position = 'absolute'; stats.domElement.style.top = '0px'; container.appendChild( stats.domElement ); // window.addEventListener( 'resize', onWindowResize, false ); } function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); controls.handleResize(); } function animate() { requestAnimationFrame( animate ); controls.update(); renderer.render( scene, camera ); stats.update(); }



报错如下:
图片说明

  • 写回答

1条回答

  • qq_40723276 2017-11-01 09:22
    关注

    一个是全局发号器(例如ZooKeeper有Sequence型节点,或者自己弄个发号器服务不断产生递增值作为发号),但是效率会比较低。
    二个是mapPartition,获得当前分区的分区号。然后分区号x一个系数+当前分区本地递增值。系数是分区最大的数据条数+一定冗余。
    最省事是前者,最快但容易出问题是后者。

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?