Hi,
I’m having problem it the live production server. In my local server everything works.
In the live server, the browser complains that resource model/poly_ann.glb faild to load.
I’m guessing it’s some kind of path finding issue. I tried to move the folder around and the .glb but no luck.
here is some of the code:
import * as THREE from './three/build/three.module.js';
import { GLTFLoader } from './three/examples/jsm/loaders/GLTFLoader.js';
import { DRACOLoader } from './three/examples/jsm/loaders/DRACOLoader.js';
import { GUI } from './three/examples/jsm/libs/dat.gui.module.js';
let camera, scene, renderer,gui,model;
gui = model = renderer = scene = camera = null;
init();
// init everything
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color( 0x000000 );
initLights(scene);
var dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath( './three/examples/js/libs/draco/gltf/' );
dracoLoader.setDecoderConfig({ type: 'js' });
const loader = new GLTFLoader();
loader.setDRACOLoader(dracoLoader);
loader.load( '../models/poly_ann.glb', function ( gltf )
{
model = gltf.scene;
model.rotation.y = Math.PI * 0.7;
model.scale.set(10.0, 10.0, 10.0);
model.position.y = -4.0;
model.position.x = 4.0;
model.updateMatrix(); // not sure if needed.
scene.add( model );
initGui();
});
.
.
.
my folder structure is as follows:
app
├── __init__.py
├── static
│ ├── css
│ │ └── style.css
│ ├── js
│ │ └── app.js
│ │ └── three
│ └── models
│ └── poly_ann.glb
├── templates
│ └── index.html
└── views.py
any help will be appreciated.
Thanks