Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
- var loader = new THREE.GLTFLoader();
- GLTFLoader is not a constructor
- <template>
- <div id="container"></div>
- </template>
- <script>
- import * as THREE from 'three'
- import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
- export default {
- name: 'ThreeTest',
- data() {
- return {
- camera: null,
- scene: null,
- renderer: null,
- mesh: null
- }
- },
- methods: {
- init: function() {
- var loader = new THREE.GLTFLoader();
- loader.load( 'assets/Models/eames_lounge_chair/scene.gltf', function ( gltf ) {
- scene.add( gltf.scene );
- }, undefined, function ( error ) {
- console.error( error );
- } );
- },
- animate: function() {
- },
- onWindowResize: function() {
- camera.aspect = window.innerWidth / window.innerHeight;
- camera.updateProjectionMatrix();
- renderer.setSize( window.innerWidth, window.innerHeight );
- }
- },
- mounted() {
- this.init();
- this.animate();
- }
- }
- </script>
- <style scoped>
- #container {
- width: 10em;
- height: 10em;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement