lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello Alex,

On 3.4.2010, at 11.33, Alex Davies wrote:

> Also there's additional advantages - ie the length could become variable (why limit it to 4?), and changing to doubles wouldn't blow out the Value type.  Which would be a nice option to have as default, as mixing floats and doubles can cause all kinds of surprises for the unsuspecting.

I think making vectors variable length and garbage collected would limit the performance too much. 4d vectors is all there needs to be for a 3d application, although there could be an option to limit the size at compile-time like it was previously proposed by one.

> imo the perfect vector extension to Lua would implement both vectors (tuple of numbers) and matrices (tuple of vectors of same dimension) - all the building blocks of a 3d app.  Throw in tuples for good measure (anything that is neither a matrix nor a vector).  All of these could be declared the same way, and let them be sorted out at runtime.
> 
> Perhaps hide the function call in a bit of parser higgery jiggery (say an OP_NEWTUPLE) and you have:

We felt that we wanted to keep the language as simple as possible without introducing too much modifications into it. Matrices can be done in lua on top of the vectors quite nicely. Tupples are something else and can be done in plain lua as well.


> ... and while you're at it throw in swizzles (newvec = vec.zzx), dot point and cross product operators (lets say .! and *!), perhaps vertices (collection of vectors) and vertexstrings (collection of vertices) and you have a pretty nifty language aimed at 3d graphics ;).

Vector swizzling is already implemented. Again for dot and cross product operations, we wanted to keep the actual language modifications at minimum.

> Then you just need a genius (read: Mike Pall) to make a pixel shader/vertex shader runtime compiler (or cross compiler to hlsl) out of it, and... well, at this point I snapped back to reality.

Yes, we would also like to see our patch integrated into LuaJIT and we are looking forward into it.

-- Henri Häkkinen