You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I include a COLLADA model in my XML, say the rubber duckie sample:
<collada document="duck.dae" />
There doesn't seem to be a way of adding an arbitrary number of ducks to the scene graph.
I've tried creating a new GLGE.Object and setting its mesh and materials, but calling doc.getElement on the document's onLoad handler results in a GLGE.Collada object that is uninitialized -- it's missing the xml property and its children array is empty.
The text was updated successfully, but these errors were encountered:
I found that GLGE.Collada supports callbacks when finished. This might work:
var assetFinished = (function() {
var NUM_ASSETS = 2;
var count = 0;
return function() {
if (++count == NUM_ASSETS) init();
};
})();
var duck = new GLGE.Collada();
duck.setDocument('assets/duck.dae', null, assetFinished);
doc = new GLGE.Document();
doc.onLoad = assetFinished;
doc.parseScript('scene-xml');
function init() {
var renderer = new GLGE.Renderer($('canvas')[0]);
...
}
Yep, my custom asset loader works. I also have this function:
function createDuckie() {
if (!duck.xml) throw new Error("Collada model not loaded");
var source = duck.getObjects()[0]; // Ew.
var dest = new GLGE.Object();
dest.setScale(0.01);
dest.setRotX(Math.PI / 2);
dest.setRotY(Math.random() * 2 * Math.PI);
dest.setMesh(source.getMesh());
dest.setMaterial(source.getMaterial());
return dest;
}
If I include a COLLADA model in my XML, say the rubber duckie sample:
There doesn't seem to be a way of adding an arbitrary number of ducks to the scene graph.
I've tried creating a new
GLGE.Object
and setting its mesh and materials, but callingdoc.getElement
on the document'sonLoad
handler results in aGLGE.Collada
object that is uninitialized -- it's missing thexml
property and itschildren
array is empty.The text was updated successfully, but these errors were encountered: