Closed Arsakes closed 8 years ago
Can you cause the error with this build of xml3d? http://xml3d.org/xml3d/scripts/xml3d-xmlbug.js
It should output an error like "Found null document for uri ..." then we can find out if it's always the same XML document causing the error.
Checked, it turns out the problem is with material.xml file: http://localhost:8080/xml/materials.xml#panoramicC.
Each panoramic material generates the problem, even if i change my own shader to "diffuse" (XML one).
The common thing is each one loads 4000x2000 texture.
<xml3d>
...
<material id="panoramic" model="urn:xml3d:material:simpleshader">
<float name="ambientIntensity">1.0</float>
<texture name="diffuseTexture" wrapS="repeat" wrapT="repeat">
<img src="/images/panorama_1.jpg"/>
</texture>
</material>
<material id="panoramicC" model="urn:xml3d:material:simpleshader">
<float name="ambientIntensity">1.0</float>
<texture name="diffuseTexture" wrapS="repeat" wrapT="repeat">
<img src="/images/panorama_1.jpg"/>
</texture>
<texture name="histMap" wrapS="repeat" wrapT="repeat">
<img src="/images/lightmap2.png"/>
</texture>
<texture name="panTexture" wrapS="repeat" wrapT="repeat">
<img src="/images/panorama_1HDR.jpg"/>
</texture>
</material>
...
</xml3d>
That seems ok, wrapS and wrapT were changed in 5.0 they should be set like this now:
<texture name="diffuseTexture" wrap="repeat repeat">
And you should make sure the textures are power of 2 when using repeat (WebGL limitation), otherwise XML3D will have to resize them which can be pretty slow with such big textures. So they should all be 4096x2048 in your case.
But that wouldn't cause this problem. There are only a couple of places in the code where this null document could happen but I can't see any reason for it. I've added some more logging to the build, can you run it through again and have a look in the console for any clues or errors?
Hmm, as I said thing was random but I after I changed the wrap instruction to 5.0 error stopped occuring.
Thanks, will keep this open for a while, then close if I'm sure it was the cause.
So errors did came back but possibly with new material declared ('grid') (not sure of this due to their random nature).
Piggyback on pending request for document http://localhost:8080/xml/materials.xml
xml3d-xmlbug.js:26008 updateExternalHandles: null document encountered Object {fragments: Array[0], pending: Promise, handler: XML3DFormatHandler}document: documentURL: ""_documentURL: "http://localhost:8080/xml/materials.xml"activeElement: nullanchors: HTMLCollection[0]applets: HTMLCollection[0]baseURI: nullbody: nullcharacterSet: "UTF-8"charset: "UTF-8"childElementCount: 1childNodes: NodeList[1]children: HTMLCollection[1]compatMode: "CSS1Compat"contentType: "application/xml"currentScript: nulldefaultCharset: undefineddefaultView: nulldesignMode: "off"dir: ""doctype: nulldocumentElement: xml3d._xml3ddocumentURI: nulldomain: ""embeds: HTMLCollection[0]firstChild: xml3d._xml3dfirstElementChild: xml3d._xml3dfonts: FontFaceSetforms: HTMLCollection[0]head: nullhidden: trueimages: HTMLCollection[0]implementation: DOMImplementationinputEncoding: "UTF-8"lastChild: xml3d._xml3dlastElementChild: xml3d._xml3dlastModified: "02/26/2016 14:46:12"links: HTMLCollection[0]location: nulllocation: nullnextSibling: nullnodeName: "#document"nodeType: 9nodeValue: nullonabort: nullonautocomplete: nullonautocompleteerror: nullonbeforecopy: nullonbeforecut: nullonbeforepaste: nullonblur: nulloncancel: nulloncanplay: nulloncanplaythrough: nullonchange: nullonclick: nullonclose: nulloncontextmenu: nulloncopy: nulloncuechange: nulloncut: nullondblclick: nullondrag: nullondragend: nullondragenter: nullondragleave: nullondragover: nullondragstart: nullondrop: nullondurationchange: nullonemptied: nullonended: nullonerror: nullonfocus: nulloninput: nulloninvalid: nullonkeydown: nullonkeypress: nullonkeyup: nullonload: nullonloadeddata: nullonloadedmetadata: nullonloadstart: nullonmousedown: nullonmouseenter: nullonmouseleave: nullonmousemove: nullonmouseout: nullonmouseover: nullonmouseup: nullonmousewheel: nullonpaste: nullonpause: nullonplay: nullonplaying: nullonpointerlockchange: nullonpointerlockerror: nullonprogress: nullonratechange: nullonreadystatechange: nullonreset: nullonresize: nullonscroll: nullonsearch: nullonseeked: nullonseeking: nullonselect: nullonselectionchange: nullonselectstart: nullonshow: nullonstalled: nullonsubmit: nullonsuspend: nullontimeupdate: nullontoggle: nullonvolumechange: nullonwaiting: nullonwebkitfullscreenchange: nullonwebkitfullscreenerror: nullonwheel: nullorigin: "null"ownerDocument: nullparentElement: nullparentNode: nullplugins: HTMLCollection[0]pointerLockElement: nullpreferredStylesheetSet: nullpreviousSibling: nullreadyState: "interactive"referrer: ""rootElement: nullscripts: HTMLCollection[0]scrollingElement: nullselectedStylesheetSet: nullstyleSheets: StyleSheetListtextContent: nulltitle: ""visibilityState: "hidden"webkitCurrentFullScreenElement: nullwebkitFullscreenElement: nullwebkitFullscreenEnabled: truewebkitHidden: truewebkitIsFullScreen: falsewebkitVisibilityState: "hidden"xmlEncoding: "UTF-8"xmlStandalone: falsexmlVersion: "1.0"__proto__: XMLDocumentfragments: Array[0]length: 0__proto__: Array[0]handler: XML3DFormatHandlerdataAdapterFactory: XML3DDataAdapterFactoryrenderAdapterFactories: Object__proto__: object__proto__: ObjectupdateExternalHandles @ xml3d-xmlbug.js:26008updateDocumentHandles @ xml3d-xmlbug.js:26084(anonymous function) @ xml3d-xmlbug.js:25970
And next one:
xml3d-xmlbug.js:26358 Parsed http://localhost:8080/xml/materials.xml with document result #document
xml3d-xmlbug.js:29316 TypeError: Cannot read property 'querySelector' of undefined
at XML3DFormatHandler.getFragmentData (http://xml3d.org/xml3d/scripts/xml3d-xmlbug.js:26643:24)
at updateExternalHandles (http://xml3d.org/xml3d/scripts/xml3d-xmlbug.js:26010:33)
at updateDocumentHandles (http://xml3d.org/xml3d/scripts/xml3d-xmlbug.js:26084:9)
at http://xml3d.org/xml3d/scripts/xml3d-xmlbug.js:25970:21ns.exports.doLog @ xml3d-xmlbug.js:29316ns.exports.logError @ xml3d-xmlbug.js:29344(anonymous function) @ xml3d-xmlbug.js:25975
xml3d-xmlbug.js:26358 Parsed http://localhost:8080/xml/spiotr.xml with document result #document
Finally materials.xml content:
<xml3d>
<material id="marker" model="urn:xml3d:material:markershader">
<float name="ambientIntensity">1.0</float>
<float name="opacity">0.5</float>
</material>
<material id="grid" model="urn:xml3d:material:gridshader">
<float name="gridSize">1.0</float>
</material>
<material id="lightmat" model="urn:xml3d:material:matte">
<float name="ambientIntensity">1.0</float>
<float3 name="diffuseColor">0.9 0.5 0.9</float3>
</material>
<material id="crossfade" model="urn:xml3d:material:crossfade">
<float name="ambientIntensity">1.0</float>
<texture name="diffuseTexture" wrap="repeat repeat">
<img id="tex0" src="/images/panorama_1.jpg"/>
</texture>
<texture name="diffuseTexture2" wrap="repeat repeat">
<img id="tex1" src="/images/panorama_2.jpg"/>
</texture>
</material>
<material id="panoramic" model="urn:xml3d:material:simpleshader">
<float name="ambientIntensity">1.0</float>
<texture name="diffuseTexture" wrap="repeat repeat">
<img id="diffuseTexture" src="/images/panorama_1.jpg"/>
</texture>
</material>
<material id="halina_mat" model="urn:xml3d:material:normalshader">
<float name="ambientIntensity">0.4</float>
<texture name="diffuseTexture" wrap="repeat repeat">
<img src="/images/halina.png"/>
</texture>
</material>
<material id="spiotr_mat" model="urn:xml3d:material:diffuse">
<float name="ambientIntensity">0.4</float>
<!-- float name="shininess">0.1</float -->
<!-- float3 name="specularColor">1.0 1.0 0.8</float3 -->
<texture name="diffuseTexture" wrap="repeat repeat">
<img src="/images/spiotr.png"/>
</texture>
</material>
</xml3d>
Thanks for the log, I think I found the problem. Potential fix was pushed to the hotfix-5.1.3 branch and I built a copy of that here:
http://xml3d.org/xml3d/scripts/xml3d-5.1.3.js
Can you run that for a while and let me know if the problem comes back?
Yes, of course will test it thoroughly and let you know.
Its working I think we can close the issue. Looking forward to see this implemented in master branch.
Great, thanks again for the report. I'll merge the hotfix into master later this week.
I'm reloading the same scene and sometime (~50% cases ) I get following error:
Any ideas for the cause?