LightRampAttrib problem

Hi all,
I followed what says the manual for the Shader Generator in c++, but in the toon shader ( him again :laughing: ) they said to use this :

np.setAttrib(LightRampAttrib.makeSingleThreshold(t0, l0))

So i tried again to translate it in my language using the c++ reference, but the lightRambMode is a private function i can’t access it.

LightRampAttrib::LightRampMode

Enumerator:
LRT_default
LRT_identity
LRT_single_threshold
LRT_double_threshold
LRT_hdr0
LRT_hdr1
LRT_hdr2

Here is my code :

pandaActor.set_attrib(LightRampAttrib::LightRampMode{LRT_double_threshold});

I tried that but it’s the same problem :

LightRampAttrib *attrib= new LightRampAttrib();
attrib-> mode = LRT_double_threshold;
pandaActor.set_attrib(attrib);

How can I solve it? Thanks for you help!

It’s really just like in Python; LightRampAttrib::LRT_double_threshold.

Thanks but it says :

error C2664: ‘NodePath::set_attrib’ : can not convert the parameter 1 of ‘LightRampAttrib::LightRampMode’ to ‘const RenderAttrib *’

Code :

np.set_attrib(LightRampAttrib::LRT_double_threshold);

It seems that you’re not very familiar with Python and C++ yet, is that right? I really recommend you to get a good amount of experience before attempting Panda3D.

This Python code:

np.setAttrib(LightRampAttrib.makeSingleThreshold(t0, l0))

Translates to this in C++:

np.set_attrib(LightRampAttrib::make_single_threshold(t0, l0));
np.setAttrib(LightRampAttrib.makeSingleThreshold(t0, l0))

translates directly to:

np.set_attrib(LightRampAttrib::make_single_threshold(t0, l0));

I can’t help but notice that some of your questions appear to originate in an inexperience with the C++ language itself. Are you sure that C++ is the language you want to be developing in? Although Panda3D does support C++, it is primarily useful for developers who are already very strong C++ coders. Really, for most applications, Python is the better choice for Panda3D development; and it has the further advantage of being the easier language to use and develop in.

David

Thanks for you help guys, yes I know that I’m just a newbie in c++, but i want to learn it and the only way I find to that is using a 3D engine to remake a game I made before, it’s the hard way but I choose it.

In two days I learned more than one week in the normal methode, I also know that I made you sick with this kind of question and I’m sorry for that, but there is no forum where I can pose them :confused:

Another thanks for your help !

c-c-c-c-coooomboooanswer… that makes +10 bonus points for both, dave and rdb!

sry for beeing oftopic but it’s too epic to not mention it.