View Full Version : rib dso: passing float arrays

09 September 2006, 08:01 PM
In my rib dso I am trying to pass a float array pointer in the surface call...

Say I have a RtFloat *someFloat, which is a pointer that contains an array of floats in my surface rib call I am trying the following passes

Surface( "location of shader", (RtToken)someFloatName, &somefloat, ...);
Surface( "location of shader", (RtToken)someFloatName, somefloat, ...);
Surface( "location of shader", (RtToken)someFloatName, (RtFloat *)somefloat, ...);

No matter how I do it... it always gives me the 1st index rather than a list in the shader rib.
From my poor knowledge of pointers it doesnt seem to work. Does someone here have a clue where I am going wrong?
Thanks in advance

the solution is so stupid I still am trying to understand why its so....

Surface( "location of shader", (RtToken)float[sizeOfArray] someFloatName, &somefloat, ...);

so in effect one has to specify the size of the array when after the float...
the rib would look like this then: "uniform float[2] test" [0.3 0.48]

09 September 2006, 09:20 AM
Yep, otherwise how would prman know how many floats to pluck out of the array?

09 September 2006, 03:46 PM
the way I was doing it was actually following the rsl specifications of defining a float array...
float myvar[10] [data] ( yeah I didnt mention in my previous post - sorry )
however the way im doing it is like this
float [10] myvar [data]
I dont know playmesumch00ns, this isnt the 1st time that rib and rsl code follow similar method of specifing stuff and it took me 4 wastefull hours figuring that one out.. sigh
quick programming question anyways... there is no way in c++ to like say specifc array variables something like: myvar[2:5] like what you can do in python... I know stupid question but thought of asking anyways...

09 September 2006, 05:53 PM
if you have access to the prman 13.0 i would strongly recommend writing thread-safe shadeop DSOs using the new API. iirc the ArrayIter classes have a length operator that tell you the length of the parameter arrays.

CGTalk Moderation
09 September 2006, 05:53 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.