reflect camera - clip plane - deprecated warning

hello !

i 'm trying to make a water plane, following the exemple of Demo nature :
( discourse.panda3d.org/viewtopic.php … emo+nature )

The system works, but i 've got a little problem:
it’s a deprecated warning on the : ‘ClipPlaneAttrib’
( :pgraph(warning): Using deprecated ClipPlaneAttrib interface. )
I’m now looking for the new way of doing this

can anyone help me ?

planeNode = PlaneNode( ‘reflectPlane’ )
planeNode.setPlane( self.reflectplane )

cfa = CullFaceAttrib.makeReverse( )
cpa = ClipPlaneAttrib.make( ClipPlaneAttrib.OAdd, planeNode )
self.rs = RenderState.make( cfa,cpa )
self.cam.node( ).setInitialState( self.rs )

thanks

The correct way to make a clip plane these days is:

planeNP = NodePath(PlaneNode('reflectPlane', self.reflectPlane))
render.setClipPlane(planeNP)

David

thanks

Sorry to wake up the old thread, but I can’t get the new method to work.
In my water class, I create the stuff like this:

self.Plane = Plane(Vec3(0, 0, 1), Point3(0, 0, self.NodePath.getZ()))
self.NodePath.node().setBounds(BoundingPlane(self.Plane))
self.PlaneNode = self.NodePath.attachNewNode(PlaneNode("VWaterPlane", self.Plane))

Now, after setting up my water camera, I used to do it like this:

self.Camera.node().setInitialState(RenderState.make(CullFaceAttrib.makeReverse(), ClipPlaneAttrib.make(ClipPlaneAttrib.OAdd, self.PlaneNode)))

However, how to do this sort of stuff with the setClipPlane interface? I don’t want to put it on render, since all cameras will be affected then?

You can use:

ClipPlaneAttrib.make().addOnPlane(self.PlaneNode)

But note that an easier way to set up attribs on a camera may be to use a temporary node (not render, but any old NodePath you create for this purpose), which allows you to use the standard NodePath interface for setting state:

np = NodePath('np')
np.setAttrib(CullFaceAttrib.makeReverse())
np.setClipPlane(self.PlaneNode)
self.Camera.node().setInitialState(np.getState())

This is particularly useful when you are setting lots of attributes on your camera.

David

Ah, thanks.