We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Load gltf uncaught range error

Home Forums Programming Load gltf uncaught range error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40563
    fsjouw
    Participant

    On friday we created an export that worked fine but now I made an export and it doesn’t load for some reason. Before I exported from blender using just regular export to gltf, but now I also used the verge3d plugin to export it but it makes no difference?

    Oh and dragging the gltf into the gltf validator online shows it is valid.

    The code is sort of a quick setup to get some basic things working, I don’t really need/use the puzzles.

    class TemplateVerasol {
    
        initialize(el, state) {
    
            console.log('initialize');
    
            //var logicURL = "templates/Verasol/visual_logic.js"
            var sceneURL = "templates/Verasol/gltf/Shade.gltf"
            if (!sceneURL) {
                console.log('No scene URL specified')
                return
            }
    
            v3d.Cache.enabled = true
            var self = this
    
            var initOptions = v3d.PL ? v3d.PL.execInitPuzzles().initOptions : {useFullscreen: false}
            initOptions.useBkgTransp = true;
    
            self.loadScene(sceneURL, initOptions, el, state)
    
            // new v3d.PuzzlesLoader().loadLogic(logicURL, function () {
            //     var initOptions = v3d.PL ? v3d.PL.execInitPuzzles().initOptions : {useFullscreen: false}
            //     self.loadScene(sceneURL, initOptions, el, state)
            // })
        }
    
        loadScene(sceneURL, initOptions, el, state) {
    
            console.log('loadScene');
    
            var self = this
    
            var ctxSettings = {alpha: true, preserveDrawingBuffer: true}
            var preloader = new v3d.SimplePreloader({container: el})
    
            app = new v3d.App(el, ctxSettings, preloader)
            if (initOptions.useBkgTransp) {
                app.clearBkgOnLoad = true
                app.renderer.setClearColor(0x000000, 0)
            }
    
            this.el = el
            this.el.data = {
                v3d: v3d,                       // used in updateState function
                renderer: app.renderer,         // used in dump png function
                updateState: this.updateState   // used in calling updateState function from server
            }
    
            this.prepareExternalInterface(app)
    
            sceneURL = initOptions.useCompAssets ? sceneURL + '.xz' : sceneURL
            app.loadScene(sceneURL, function () {
                app.enableControls()
                app.run()
    
                if (v3d.PE) v3d.PE.updateAppInstance(app)
                if (v3d.PL) v3d.PL.init(app, initOptions)
    
                self.updateState(el, state)
            }, null, function () {
                console.log('Can\'t load the scene ' + sceneURL)
            })
    
            sunshadeObject = app.scene.getObjectByName('Shade');
    
            return app
        }
    
        prepareExternalInterface(app) {
            console.log('prepareExternalInterface');
            var self = this
    
            app.ExternalInterface = {}
            app.ExternalInterface.ControllerWidthFunction = function (ControllerWidthValue) {
                self.el.$server.setFieldValue('length', ControllerWidthValue, false)
            }
            app.ExternalInterface.ControllerHeightFunction = function (ControllerHeightValue) {
                self.el.$server.setFieldValue('height', ControllerHeightValue, false)
            }
            app.ExternalInterface.ControllerDepthFunction = function (ControllerDepthValue) {
                self.el.$server.setFieldValue('width', ControllerDepthValue, false)
            }
            app.ExternalInterface.SetAnimation = function (SetAnimationValue) {
                self.el.$server.setFieldValue('animation', SetAnimationValue, false)
            }
        }
    
        updateState(el, state) {
    
            console.log('updateState');
    
            setWidth(state.fields.breedte.value);
            setHeight(state.fields.hoogte.value);
            setDepth(state.fields.diepte.value);
            setGlassType(state.fields.glas.value);
            setGlassType(state.fields.kleur.value);
            setRegenpijp(state.fields.regenpijp.value);
            setDesign(state.fields.design.value);       
        }
    }
    Uncaught RangeError: Invalid typed array length: 4
        at new Uint8Array (<anonymous>)
        at W_.parse (v3d.js?1619609049531:1)
        at Object.onLoad (v3d.js?1619609049531:1)
        at XMLHttpRequest.<anonymous> (v3d.js?1619609049531:1)
    #40578

    Hi,

    It looks like there’s a problem with the gltf file itself and it can’t be loaded properly. Can you attach the problematic gltf file so we could reproduce the issue?

    Co-founder and lead developer at Soft8Soft.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.