Tut-Procedural-Cube cleaned up

Hello there,

I wanted to learn about pandas Geom Interface and found the Tut-Procedural-Cube sample helpful but somewhat awkward in style (lots of code duplication, variables named square0, square1 etc. instead of lists, tabs instead of spaces, and so on). I tried to clean it up a bit and make it comply with PEP 0008 some more. Results are here and I also have a mostly useless diff since every line changed (tabs->spaces). It doesn’t change the logic though. I’m not very intimate with panda3d, so I’m very open for criticism on the changes I made. Now a few things:

I don’t understand the logic behind the lightening. Everytime I switch a light off and on again, it changes its absolute position, while the description “ingame” suggests otherwise. May I change that so that one light is really in the front and one on top, or did I just misunderstand the concept here?

Second, I might want to rework this sample (depends on the time I have) to be a bit more generic. I don’t think beginners should be very interested in it, so I feel it could be a bit more advanced (like generating different kinds of primitives or changing more properties ingame). Is something like this wanted for?

Also, where do I send patches? Is there a git, should I send it to a bugtracker … I just put it here because I don’t know better.

there are some “samples” showing how to create other geometry then cubes already:

discourse.panda3d.org/viewtopic … e+geometry

nouser.org/PMW/pmwiki.php/Re … eGenerator

i think the light could use some improvement in the sample, as you say it’s hard to understand what it’s trying to do. Maybe use setLightOff on render instead of detaching it.

to lights:
with nodepath.setLight(light) and nodepath.setLightOff() you can toggle specific lights on nodes (which work recursively). if you disable lights, everything will be 100% lit = no shadows. to have everything dark, set a light to color (0, 0, 0, 1)

to patches: i think the best for small patches is a forum post (possibly with a link to an external patch or file). for bigger patches, you may mail them directly to some devs as well

Thanks for the answers; the links provided were very useful. I think I’ll go ahead and rewrite the sample with ideas from those other examples, because their more generic approach is better suited for an official sample than the one provided (samples should be copy&pasteble I believe, the one provided isn’t). I’ll post it here when I get to doing it. Thanks for the tips on lightening. Anyway, I believe it’d be better to remove it from the sample altogether as it adds nothing to its “tutorial value”.

i dont think that’s true (“believe it’d be better to remove it from the sample altogether”), at least my first implementation of a procedural geometry was based on the manual and this sample. samples are a very good starting point for a lot of different tasks, simple stuff like the makeSquare or makeCube functions are things i often copy and reuse when implementing something.

(maybe it should be made simpler then it currently is, leaving out the light stuff that is not very useful and easy to understand)

I’m sorry for the misunderstanding - of course I meant “remove the lightening stuff from the sample altogether”. So I completely agree with you.