Portal.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Portal" inherits="Spatial" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Portal nodes are used to enable visibility between [Room]s.
  5. </brief_description>
  6. <description>
  7. [Portal]s are a special type of [MeshInstance] that allow the portal culling system to 'see' from one room to the next. They often correspond to doors and windows in level geometry. By only allowing [Camera]s to see through portals, this allows the system to cull out all the objects in rooms that cannot be seen through portals. This is a form of [b]occlusion culling[/b], and can greatly increase performance.
  8. There are some limitations to the form of portals:
  9. They must be single sided convex polygons, and usually you would orientate their front faces [b]outward[/b] from the [Room] they are placed in. The vertices should be positioned on a single plane (although their positioning does not have to be perfect).
  10. There is no need to place an opposite portal in an adjacent room, links are made two-way automatically.
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <methods>
  15. <method name="set_point">
  16. <return type="void" />
  17. <argument index="0" name="index" type="int" />
  18. <argument index="1" name="position" type="Vector2" />
  19. <description>
  20. Sets individual points. Primarily for use by the editor.
  21. [b]Note:[/b] This function will not resize the point array. Set [member points] to set the number of points.
  22. </description>
  23. </method>
  24. </methods>
  25. <members>
  26. <member name="include_in_bound" type="bool" setter="set_include_in_bound" getter="get_include_in_bound" default="false">
  27. When a manual bound has not been explicitly specified for a [Room], the convex hull bound will be estimated from the geometry of the objects within the room. This setting determines whether the portal geometry is included in this estimate of the room bound.
  28. </member>
  29. <member name="linked_room" type="NodePath" setter="set_linked_room" getter="get_linked_room" default="NodePath(&quot;&quot;)">
  30. This is a shortcut for setting the linked [Room] in the name of the [Portal] (the name is used during conversion).
  31. </member>
  32. <member name="points" type="PoolVector2Array" setter="set_points" getter="get_points" default="PoolVector2Array( 1, -1, 1, 1, -1, 1, -1, -1 )">
  33. The points defining the shape of the [Portal] polygon (which should be convex).
  34. These are defined in 2D, with [code]0,0[/code] being the origin of the [Portal] node's [member Spatial.global_transform].
  35. [b]Note:[/b] These raw points are sanitized for winding order internally.
  36. </member>
  37. <member name="portal_active" type="bool" setter="set_portal_active" getter="get_portal_active" default="true">
  38. Visibility through [Portal]s can be turned on and off at runtime - this is useful for having closable doors.
  39. </member>
  40. <member name="portal_margin" type="float" setter="set_portal_margin" getter="get_portal_margin" default="1.0">
  41. Some objects are so big that they may be present in more than one [Room] ('sprawling'). As we often don't want objects that *just* breach the edges to be assigned to neighbouring rooms, you can assign an extra margin through the [Portal] to allow objects to breach without sprawling.
  42. </member>
  43. <member name="two_way" type="bool" setter="set_two_way" getter="is_two_way" default="true">
  44. Portals default to being two way - see through in both directions, however you can make them one way, visible from the source room only.
  45. </member>
  46. <member name="use_default_margin" type="bool" setter="set_use_default_margin" getter="get_use_default_margin" default="true">
  47. In most cases you will want to use the default [Portal] margin in your portals (this is set in the [RoomManager]).
  48. If you want to override this default, set this value to [code]false[/code], and the local [member portal_margin] will take effect.
  49. </member>
  50. </members>
  51. <constants>
  52. </constants>
  53. </class>