Jump to content
Sign in to follow this  
woodenduck

Sop vex ptnum vs cvex

Recommended Posts

Hi, 

So in days of old when you used to create a Sop Vex Geometry Type Operator you had access to ptnum as a read-only global variable. Now if I try that in a cvex operator I get "Error 1067: Reference to undefined variable: ptnum". 

What is the current method for getting the current point number in the cvex context?

Cheers, 

WD

Share this post


Link to post
Share on other sites

in CVEX you define it as an argument and if it's fed to the shader it will be automatically populated, so in most geometry CVEX contexts it will contain actual ptnum in others like lens CVEX shader it will stay the default value (in this case 0) etc.

cvex
randomshader(int ptnum = 0; export vector Cd = { 0, 0, 0 })
{
    Cd = random(ptnum);
}

 

Share this post


Link to post
Share on other sites

Thanks Thomas, 

So if I understand you correctly, ptnum just needs to be initialised to some value, then fed in to the function and will automatically receive a value?

Share this post


Link to post
Share on other sites

all arguments of a context level (shader) function have to be initialized with default value

and yes, whatever program calls the CVEX shader function may pass some arguments

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×