Re: How can I store global variables one by one in an array?


I replied to the email that was sent to me, but I'm not sure if it was for sending only.
I'm not sure if you received it, so I'll send it to this thread as well.
I'm sorry for the confusing question.
I will explain based on the reply you gave me.
First of all, in OSL, if you simply call "P", you will be calling a set of shading points P, I think.
This means that you don't know how many shading points there are in the scene, and you can't read the numerical values of the coordinates of each shading point.
What I want to do is to take one arbitrary coordinate from the set of shading points (like a normal point type) and store that coordinate in an array. Then I want to use the length of P as the conditional expression in the for statement, and in that I want to take an element from the array and compare it to the other P to create a map.
Since what I want to do is declare a variable, so to speak, I can't show any code in OSL that would change this.
If I were to express it in C instead
int P_length = sizeof(P.x) / sizeof(P.x[0]);
float P_xval =P.x[103];
and so on.
Or, if I can access the coordinates of every single point in the set of P, I may be able to omit this kind of code.
Maybe it exists as a member of the structure P.
Is it possible to program like this in OSL?
And do such variables exist?
That's what I want to ask.
And one more thing, I am sorry to repeat this question.
It seems that the global variables contain elements like members in c language.
Is there a site or a way to view all of them? I would appreciate it if you could help me.
Thank you.

Join to automatically receive all group messages.