Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
  2.  
  3. var loader = new THREE.GLTFLoader();
  4.  
  5. GLTFLoader is not a constructor
  6.  
  7. <template>
  8. <div id="container"></div>
  9. </template>
  10.  
  11. <script>
  12. import * as THREE from 'three'
  13. import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
  14.  
  15. export default {
  16. name: 'ThreeTest',
  17. data() {
  18. return {
  19. camera: null,
  20. scene: null,
  21. renderer: null,
  22. mesh: null
  23. }
  24. },
  25. methods: {
  26. init: function() {
  27. var loader = new THREE.GLTFLoader();
  28.  
  29. loader.load( 'assets/Models/eames_lounge_chair/scene.gltf', function ( gltf ) {
  30.  
  31. scene.add( gltf.scene );
  32.  
  33. }, undefined, function ( error ) {
  34.  
  35. console.error( error );
  36.  
  37. } );
  38.  
  39. },
  40. animate: function() {
  41.  
  42. },
  43. onWindowResize: function() {
  44. camera.aspect = window.innerWidth / window.innerHeight;
  45. camera.updateProjectionMatrix();
  46.  
  47. renderer.setSize( window.innerWidth, window.innerHeight );
  48. }
  49. },
  50. mounted() {
  51.  
  52. this.init();
  53. this.animate();
  54. }
  55. }
  56. </script>
  57.  
  58. <style scoped>
  59. #container {
  60. width: 10em;
  61. height: 10em;
  62. }
  63. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement