* Curtis Olson -- Saturday 21 March 2009:
> To me the idea of giving nasal efficient access to vec3 and vec4 types for
> manipulating things like material properties, texture coordinates, lighting,
> and positions seems like the strongest argument "for" this proposal.

And that's quite a weak reason! How often does Nasal manipulate a color?

(1) some aircraft when pressing a button/operating a control (b29, ch53, ...)

There's no (2), AFAIK. It's *very* rare. Same for vectors. Most is done
via "material" animations, and even that is quite rare!


For speeding up Nasal the solution is: write faster Nasal code!
- set{Double,Int,Bool}Value() are faster than setValue()
- getBoolValue is slower than getValue()
- run loops only when they are needed  (see wiki)
- don't check properties for nil in a loop, but make sure that they
  aren't nil *before* you start the loop
- setprop() is faster than n.getValue()
- etc. etc.

And besides: we could easily support faster vector and color property
reading/writing with some Nasal extension functions. No need to introduce
new property types for that. We just don't have that yet because we didn't
need it.



> For the types that Tim proposes, they are almost always written as float
> color[4] and accessed with color[0], color[1], color[2], color[3], or
> pos[0], pos[1], pos[2], etc. in C and C++ when you are dealing with OpenGL.
> Anyone who would represent an opengl color in C/C++ the way Melchior
> suggests would have to convert it to a vec3/vec4 before actually using it.

 SGVec3 vec = readVec3(node);

Problem solved! A few helper functions do the trick without crippling
our whole property system. A vector element is a separate entity when
we read it in, when we write it out, it even is one within SGVec3. Why
on Earth should it not be one in the property tree? If some code wants
to read *many* of them from the tree, then chances are that the code is
broken, not the property tree.

m.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to