PortalNode

class PortalNode

Bases: PandaNode

A node in the scene graph that can hold a Portal Polygon, which is a rectangle. Other types of polygons are not supported for now. It also holds a PT(PandaNode) Cell that this portal is connected to

Inheritance diagram

Inheritance diagram of PortalNode

explicit PortalNode(std::string const &name)
explicit PortalNode(std::string const &name, LPoint3 pos, PN_stdfloat scale = 10.0)

Default constructor, just an empty node, no geo This is used to read portal from model. You can also use this from python to create an empty portal. Then you can set the vertices yourself, with add_vertex().

Create a default rectangle as portal. Use this to create an arbitrary portal and setup from Python

void add_vertex(LPoint3 const &vertex)

Adds a new vertex to the portal polygon. The vertices should be defined in a counterclockwise orientation when viewing through the portal.

void clear_vertices(void)

Resets the vertices of the portal to the empty list.

NodePath get_cell_in(void) const

Sets the cell that this portal belongs to

NodePath get_cell_out(void) const

Sets the cell that this portal leads out to

static TypeHandle get_class_type(void)
PortalMask get_from_portal_mask(void) const

Returns the current “from” PortalMask. In order for a portal to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

PortalMask get_into_portal_mask(void) const

Returns the current “into” PortalMask. In order for a portal to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

int get_max_depth(void)

Returns the maximum depth this portal will be visible at

int get_num_vertices(void) const

Returns the number of vertices in the portal polygon.

bool get_portal_geom(void) const

Returns the current state of the portal_geom flag. See set_portal_geom().

LPoint3 const &get_vertex(int n) const

Returns the nth vertex of the portal polygon.

bool is_clip_plane(void)

Is this portal clipping against its left-right planes

bool is_open(void)

Is this portal open from current camera zone

bool is_visible(void)

Is this portal facing the camera

void set_cell_in(NodePath const &cell)

Sets the cell that this portal belongs to

void set_cell_out(NodePath const &cell)

Sets the cell that this portal leads out to

void set_clip_plane(bool value)

this is set if the portal will clip against its left and right planes

void set_from_portal_mask(PortalMask mask)

Sets the “from” PortalMask. In order for a portal to be detected from this object into another object, the intersection of this object’s “from” mask and the other object’s “into” mask must be nonzero.

void set_into_portal_mask(PortalMask mask)

Sets the “into” PortalMask. In order for a portal to be detected from another object into this object, the intersection of the other object’s “from” mask and this object’s “into” mask must be nonzero.

void set_max_depth(int value)

Set the maximum depth this portal will be visible at

void set_open(bool value)

Python sets this based on curent camera zone

void set_portal_geom(bool flag)

Sets the state of the “portal geom” flag for this PortalNode. Normally, this is false; when this is set true, the PortalSolids in this node will test for portals with actual renderable geometry, in addition to whatever PortalSolids may be indicated by the from_portal_mask.

Setting this to true causes this to test all GeomNodes for portals. It is an all-or-none thing; there is no way to portal with only some GeomNodes, as GeomNodes have no into_portal_mask.

void set_portal_mask(PortalMask mask)

Simultaneously sets both the “from” and “into” PortalMask values to the same thing.

void set_visible(bool value)

this is set if the portal is facing camera