1
This commit is contained in:
parent
8b8fb38a7c
commit
203adbe1f4
@ -1,5 +1,7 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include "Recast.h"
|
||||||
|
|
||||||
#include "inputgeom.h"
|
#include "inputgeom.h"
|
||||||
|
|
||||||
struct BoundsItem
|
struct BoundsItem
|
||||||
@ -224,7 +226,38 @@ namespace f8
|
|||||||
|
|
||||||
void InputGeom::Init(float width, float height)
|
void InputGeom::Init(float width, float height)
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
verts_.reserve(3 * 4);
|
||||||
|
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(0);
|
||||||
|
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(height);
|
||||||
|
|
||||||
|
verts_.push_back(width);
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(height);
|
||||||
|
|
||||||
|
verts_.push_back(width);
|
||||||
|
verts_.push_back(0);
|
||||||
|
verts_.push_back(0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
tris_.push_back(0);
|
||||||
|
tris_.push_back(1);
|
||||||
|
tris_.push_back(2);
|
||||||
|
|
||||||
|
tris_.push_back(0);
|
||||||
|
tris_.push_back(2);
|
||||||
|
tris_.push_back(3);
|
||||||
|
}
|
||||||
|
rcCalcBounds(GetVerts(), GetVertCount(), min_, max_);
|
||||||
|
if (!rcCreateChunkyTriMesh(GetVerts(), GetTris(), GetTriCount(), 256, &chunky_mesh_)) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,16 @@ namespace f8
|
|||||||
const float* GetMeshBoundsMin() const { return min_; }
|
const float* GetMeshBoundsMin() const { return min_; }
|
||||||
const float* GetMeshBoundsMax() const { return max_; }
|
const float* GetMeshBoundsMax() const { return max_; }
|
||||||
const float* GetVerts() const { return !verts_.empty() ? &verts_[0] : nullptr; }
|
const float* GetVerts() const { return !verts_.empty() ? &verts_[0] : nullptr; }
|
||||||
int GetVertCount() const { return verts_.size(); }
|
int GetVertCount() const { return verts_.size() / 3; }
|
||||||
|
const int* GetTris() const { return !tris_.empty() ? &tris_[0] : nullptr; }
|
||||||
|
int GetTriCount() const { return tris_.size() / 3; }
|
||||||
const rcChunkyTriMesh* GetChunkyMesh() { return &chunky_mesh_; }
|
const rcChunkyTriMesh* GetChunkyMesh() { return &chunky_mesh_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float min_[3] = {0};
|
float min_[3] = {0};
|
||||||
float max_[3] = {0};
|
float max_[3] = {0};
|
||||||
std::vector<float> verts_;
|
std::vector<float> verts_;
|
||||||
|
std::vector<int> tris_;
|
||||||
rcChunkyTriMesh chunky_mesh_;
|
rcChunkyTriMesh chunky_mesh_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -51,3 +54,4 @@ namespace f8
|
|||||||
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm,
|
int rcGetChunksOverlappingRect(const rcChunkyTriMesh* cm,
|
||||||
float bmin[2], float bmax[2],
|
float bmin[2], float bmax[2],
|
||||||
int* ids, const int maxIds);
|
int* ids, const int maxIds);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user