1
This commit is contained in:
parent
8e4ace732d
commit
38e444124a
@ -1134,6 +1134,12 @@ void MapInstance::AdjustOnLandPoint(glm::vec3& point)
|
||||
if (dtStatusFailed(status) || poly_count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
glm::vec3 orig;
|
||||
glm::vec3 dir;
|
||||
glm::vec2 bary_position;
|
||||
float distance;
|
||||
|
||||
for (int i = 0; i < poly_count; ++i) {
|
||||
unsigned int slat = 0;
|
||||
unsigned int it = 0;
|
||||
@ -1152,6 +1158,20 @@ void MapInstance::AdjustOnLandPoint(glm::vec3& point)
|
||||
const float* va = &tile->verts[poly->verts[0]*3];
|
||||
const float* vb = &tile->verts[poly->verts[ii-1]*3];
|
||||
const float* vc = &tile->verts[poly->verts[ii]*3];
|
||||
|
||||
glm::vec3 v0 = glm::vec3(va[0], va[1], va[2]);
|
||||
glm::vec3 v1 = glm::vec3(vb[0], vb[1], vb[2]);
|
||||
glm::vec3 v2 = glm::vec3(vc[0], vc[1], vc[2]);
|
||||
bool hit = glm::intersectRayTriangle
|
||||
(orig,
|
||||
dir,
|
||||
v0,
|
||||
v1,
|
||||
v2,
|
||||
bary_position,
|
||||
distance
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user