Re: [Plib-users] passing more than one value to psl scripts
Brought to you by:
sjbaker
From: Gerald F. <gf...@tu...> - 2004-11-30 10:00:01
|
Jonathan Wheare wrote: > I've been pondering the same question, and the best idea I have been > able to come up with is to use an int value as a handle with each unique > value representing an sgVec or sgMat, then writing wrapper functions for > all the lowlevel sg functions. so for example if I wanted to add two > vectors I could use: > in psl > > int position_handle = pslGetVec3Handle("position"); > int offset_handle = pslGetVec3Handle("offset"); > int result_handle = pslNewVec3("result"); > > pslSgAddVec3(result_handle,position_handle, offset_handle); > > There would be some added overhead in matching hashes, but hopefully > most of it could be simplified to only happen once per script. I > haven't tried this out yet, so I have no idea if it would work. > Any suggestions? This is an interesting workaround solution I did not think about. I am pretty sure it would work. Nevertheless, to my mind psl lacks here some functionality to make the language truly elegant. For my current purposes accessing single float values is sufficient, however, a respective extension of psl could make scripts much more efficient (which would be in accordance with the library's design goals). I see two different solutions: either allowing arrays as return parameters, or the addition some additional basic data types such as vec2, vec3, vec4, mat2, mat3, mat4 similar to the OpenGL shading language. It would be very interesting to hear some comments from the original author whether there are plans for such extensions or objections against them. Regards Gerald |