peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
526 stars 320 forks source link

Unable to load mtl file #68

Open srinivasrk opened 5 years ago

srinivasrk commented 5 years ago

I'm trying to recreate the example https://github.com/peterqliu/threebox/blob/master/examples/logistics.html and I end up getting a warning on my console

threebox.js:4644 THREE.MeshPhongMaterial: .shading has been removed. Use the boolean .flatShading instead.
threebox.js:4675 THREE.MultiMaterial has been removed. Use an Array instead.

I do not see the truck object as well.

map.addLayer({
                    id: 'custom_layer',
                    type: 'custom',
                    renderingMode: '3d',
                    onAdd: function(map, mbxContext){
                        window.tb = new Threebox(
                            map, 
                            mbxContext,
                            {defaultLights: true}
                        );
                        // import truck from an external obj file, scaling up its size 10x
                        var options = {
                            obj: 'Truck.obj',
                            mtl: 'Truck.mtl',
                            scale: 10
                        }
                        tb.loadObj(options, function(model) {
                            // console.log(model)
                            var truck = model.setCoords(origin);
                            console.log(truck)
                            tb.add(truck);                        
                        })

                    },
                    render: function(gl, matrix){
                        tb.update();
                    }

                })

This is the snippet I'm using to load the model