[fluxus] Object Loader
Christian Sandor
chris.sandor at gmail.com
Mon Jan 1 03:45:06 PST 2007
Hi all,
Happy new year!
Recently, I have played with the .obj-loader of fluxus.
(see examples/23-objimport.scm). I have found several problems with
it. Also, my scheme/fluxus skills are not that good, so I might be
making
some obvious mistakes....
1) Speed
On my MacBookPro (2.16 GHz)
Loading meshes/bunny.scm (1500 triangles): 1 second
Loading a more complex model (20000 triangles): 75 seconds
It seems to me that the there is some fundamental problem in the
object loader ... Maybe, the object loader should better be
implemented in C?
For my OpenGL programs, I use glm.c.
This is a compact and fast way of loading object files.
When using Scheme, maybe something like:
http://www.franz.com/support/tech_corner/cons-tricks-121306.lhtml
should be done?
2) Caching of Loaded Models
My goal is to parse object files only once. When I reload a script,
the object should not be loaded again.
I tried something like (in C syntax, sorry):
bool modelLoaded = 0;
if (modelLoaded==0){
loadModel();
modelLoaded = 1;
}
However, when I reload this script, this model is (of course) reloaded.
Is there any way to get around this? Sorry, this is a total newbie
question....
3) Reusing pdata
Another problem I have is reusing loaded models. When just drawing
several instances
of a loaded model, this can easily be done with "draw-instance".
However, in the following case,
I do not know what to do: consider example/17-physics1.scm
Assume that I want to pass loaded objects to the physics engine. In
that case, the line:
(let ((ob (build-cube)))
should me modified to use instances of the loaded object.
I imagine someting like:
(let ((ob (clone my-object))
where the imaginary function (clone my-object) makes a copy of the
loaded .obj data.
Is there a better way to do this? Or does scheme/fluxus already offer
this functionality?
Sorry, I also assume that this is a newbie's question.
Cheers!
Chris
More information about the Fluxus
mailing list