Explorar el Código

Update Navigation Lua API.

Aster Jian hace 12 años
padre
commit
bf02252c65

+ 1 - 6
Extras/LuaScript/pkgs/Navigation/Navigable.pkg

@@ -1,14 +1,9 @@
 $#include "Navigable.h"
 
-/// Component which tags geometry for inclusion in the navigation mesh. Optionally auto-includes geometry from child nodes.
 class Navigable : public Component
 {
-public:
-    /// Set whether geometry is automatically collected from child nodes. Default true.
     void SetRecursive(bool enable);
-    /// Return whether geometry is automatically collected from child nodes.
-    bool IsRecursive() const { return recursive_; }
+    bool IsRecursive() const;
     
-    // Properties:
     tolua_property__is_set bool recursive;
 };

+ 29 - 67
Extras/LuaScript/pkgs/Navigation/NavigationMesh.pkg

@@ -1,106 +1,68 @@
 $#include "NavigationMesh.h"
 
-/// Description of a navigation mesh geometry component, with transform and bounds information.
 struct NavigationGeometryInfo
 {
-    /// Component.
-    Component* component_;
-    /// Geometry LOD level if applicable.
-    unsigned lodLevel_;
-    /// Transform relative to the navigation mesh root node.
-    Matrix3x4 transform_;
-    /// Bounding box relative to the navigation mesh root node.
-    BoundingBox boundingBox_;
+    Component* component_ @ component;
+    unsigned lodLevel_ @ lodLevel;
+    Matrix3x4 transform_ @ transform;
+    BoundingBox boundingBox_ @ boundingBox;
 };
 
-/// Navigation mesh component. Collects the navigation geometry from child nodes with the Navigable component and responds to path queries.
+
 class NavigationMesh : public Component
 {
 public:
-    /// Set tile size.
     void SetTileSize(int size);
-    /// Set cell size.
     void SetCellSize(float size);
-    /// Set cell height.
     void SetCellHeight(float height);
-    /// Set navigation agent height.
     void SetAgentHeight(float height);
-    /// Set navigation agent radius.
     void SetAgentRadius(float radius);
-    /// Set navigation agent max vertical climb.
     void SetAgentMaxClimb(float maxClimb);
-    /// Set navigation agent max slope.
     void SetAgentMaxSlope(float maxSlope);
-    /// Set region minimum size.
     void SetRegionMinSize(float size);
-    /// Set region merge size.
     void SetRegionMergeSize(float size);
-    /// Set edge max length.
     void SetEdgeMaxLength(float length);
-    /// Set edge max error.
     void SetEdgeMaxError(float error);
-    /// Set detail sampling distance.
     void SetDetailSampleDistance(float distance);
-    /// Set detail sampling maximum error.
     void SetDetailSampleMaxError(float error);
-    /// Set padding of the navigation mesh bounding box. Having enough padding allows to add geometry on the extremities of the navigation mesh when doing partial rebuilds.
     void SetPadding(const Vector3& padding);
-    /// Rebuild the navigation mesh. Return true if successful.
     bool Build();
-    /// Rebuild part of the navigation mesh contained by the world-space bounding box. Return true if successful.
     bool Build(const BoundingBox& boundingBox);
     
-    /// Find a path between world space points. Return non-empty list of points if successful. Extents specifies how far off the navigation mesh the points can be.
+    // void FindPath(PODVector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
     tolua_outside PODVector<Vector3> NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
     tolua_outside PODVector<Vector3> NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end);
     
-    /// Return a random point on the navigation mesh.
     Vector3 GetRandomPoint();
-    /// Return a random point on the navigation mesh within a circle. The circle radius is only a guideline and in practice the returned point may be further away.
+    
     Vector3 GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE);
-    /// Return distance to wall from a point. Maximum search radius must be specified.
+    Vector3 GetRandomPointInCircle(const Vector3& center, float radius);
+    
     float GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE);
-    /// Perform a walkability raycast on the navigation mesh between start and end and return the point where a wall was hit, or the end point if no walls.
+    float GetDistanceToWall(const Vector3& point, float radius);
+    
     Vector3 Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
+    Vector3 Raycast(const Vector3& start, const Vector3& end);
 
-    /// Return tile size.
-    int GetTileSize() const { return tileSize_; }
-    /// Return cell size.
-    float GetCellSize() const { return cellSize_; }
-    /// Return cell height.
-    float GetCellHeight() const { return cellHeight_; }
-    /// Return navigation agent height.
-    float GetAgentHeight() const { return agentHeight_; }
-    /// Return navigation agent radius.
-    float GetAgentRadius() const { return agentRadius_; }
-    /// Return navigation agent max vertical climb.
-    float GetAgentMaxClimb() const { return agentMaxClimb_; }
-    /// Return navigation agent max slope.
-    float GetAgentMaxSlope() const { return agentMaxSlope_; }
-    /// Return region minimum size.
-    float GetRegionMinSize() const { return regionMinSize_; }
-    /// Return region merge size.
-    float GetRegionMergeSize() const { return regionMergeSize_; }
-    /// Return edge max length.
-    float GetEdgeMaxLength() const { return edgeMaxLength_; }
-    /// Return edge max error.
-    float GetEdgeMaxError() const { return edgeMaxError_; }
-    /// Return detail sampling distance.
-    float GetDetailSampleDistance() const { return detailSampleDistance_; }
-    /// Return detail sampling maximum error.
-    float GetDetailSampleMaxError() const { return detailSampleMaxError_; }
-    /// Return navigation mesh bounding box padding.
-    const Vector3& GetPadding() const { return padding_; }
-    /// Return whether has been initialized with valid navigation data.
-    bool IsInitialized() const { return navMesh_ != 0; }
-    /// Return local space bounding box of the navigation mesh.
-    const BoundingBox& GetBoundingBox() const { return boundingBox_; }
-    /// Return world space bounding box of the navigation mesh.
+    int GetTileSize() const;
+    float GetCellSize() const;
+    float GetCellHeight() const;
+    float GetAgentHeight() const;
+    float GetAgentRadius() const;
+    float GetAgentMaxClimb() const;
+    float GetAgentMaxSlope() const;
+    float GetRegionMinSize() const;
+    float GetRegionMergeSize() const;
+    float GetEdgeMaxLength() const;
+    float GetEdgeMaxError() const;
+    float GetDetailSampleDistance() const;
+    float GetDetailSampleMaxError() const;
+    const Vector3& GetPadding() const;
+    bool IsInitialized() const;
+    const BoundingBox& GetBoundingBox() const;
     BoundingBox GetWorldBoundingBox() const;
-    /// Return number of tiles.
-    IntVector2 GetNumTiles() const { return IntVector2(numTilesX_, numTilesZ_); }
+    IntVector2 GetNumTiles() const;
     
-    // Properties:
     tolua_property__get_set int tileSize;
     tolua_property__get_set float cellSize;
     tolua_property__get_set float cellHeight;

+ 2 - 10
Extras/LuaScript/pkgs/Navigation/OffMeshConnection.pkg

@@ -1,24 +1,16 @@
 $#include "OffMeshConnection.h"
 
-/// A link between otherwise unconnected regions of the navigation mesh.
 class OffMeshConnection : public Component
 {
 public:
-    /// Set endpoint node.
     void SetEndPoint(Node* node);
-    /// Set radius.
     void SetRadius(float radius);
-    /// Set bidirectional flag. Default true.
     void SetBidirectional(bool enabled);
     
-    /// Return endpoint node.
     Node* GetEndPoint() const;
-    /// Return radius.
-    float GetRadius() const { return radius_; }
-    /// Return whether is bidirectional.
-    bool IsBidirectional() const { return bidirectional_; }
+    float GetRadius() const;
+    bool IsBidirectional() const;
     
-    // Properties:
     tolua_property__get_set Node* endPoint;
     tolua_property__get_set float radius;
     tolua_property__is_set bool bidirectional;