add GetMesh() in IInputGeomProvider

This commit is contained in:
ikpil 2023-08-24 23:07:03 +09:00
parent afc9d26d52
commit e4b5bddac7
3 changed files with 15 additions and 4 deletions

View File

@ -32,7 +32,7 @@ namespace DotRecast.Recast.Toolset.Geom
public readonly float[] normals;
private readonly RcVec3f bmin;
private readonly RcVec3f bmax;
private readonly List<RcConvexVolume> _convexVolumes = new List<RcConvexVolume>();
private readonly List<RcOffMeshConnection> _offMeshConnections = new List<RcOffMeshConnection>();
private readonly RcTriMesh _mesh;
@ -61,6 +61,11 @@ namespace DotRecast.Recast.Toolset.Geom
_mesh = new RcTriMesh(vertices, faces);
}
public RcTriMesh GetMesh()
{
return _mesh;
}
public RcVec3f GetMeshBoundsMin()
{
return bmin;
@ -129,7 +134,7 @@ namespace DotRecast.Recast.Toolset.Geom
public bool RaycastMesh(RcVec3f src, RcVec3f dst, out float tmin)
{
tmin = 1.0f;
// Prune hit ray.
if (!Intersections.IsectSegAABB(src, dst, bmin, bmax, out var btmin, out var btmax))
{
@ -196,7 +201,7 @@ namespace DotRecast.Recast.Toolset.Geom
volume.areaMod = areaMod;
AddConvexVolume(volume);
}
public void AddConvexVolume(RcConvexVolume volume)
{
_convexVolumes.Add(volume);
@ -206,7 +211,7 @@ namespace DotRecast.Recast.Toolset.Geom
{
_convexVolumes.Clear();
}
private static int[] MapFaces(List<int> meshFaces)
{
int[] faces = new int[meshFaces.Count];

View File

@ -26,6 +26,7 @@ namespace DotRecast.Recast.Geom
{
public interface IInputGeomProvider
{
RcTriMesh GetMesh();
RcVec3f GetMeshBoundsMin();
RcVec3f GetMeshBoundsMax();

View File

@ -81,6 +81,11 @@ namespace DotRecast.Recast.Geom
_mesh = new RcTriMesh(vertices, faces);
}
public RcTriMesh GetMesh()
{
return _mesh;
}
public RcVec3f GetMeshBoundsMin()
{
return bmin;