rib dso: passing float arrays


#1

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

edit
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]


#2

Yep, otherwise how would prman know how many floats to pluck out of the array?


#3

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…


#4

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.


#5

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.