forked from mirror/DotRecast
012 -> xyz
This commit is contained in:
parent
713576c14a
commit
da8c66bd1a
|
@ -68,9 +68,9 @@ public class TileNavMeshBuilder : AbstractNavMeshBuilder
|
|||
int vertsPerPoly)
|
||||
{
|
||||
NavMeshParams navMeshParams = new NavMeshParams();
|
||||
navMeshParams.orig[0] = geom.getMeshBoundsMin()[0];
|
||||
navMeshParams.orig[1] = geom.getMeshBoundsMin()[1];
|
||||
navMeshParams.orig[2] = geom.getMeshBoundsMin()[2];
|
||||
navMeshParams.orig.x = geom.getMeshBoundsMin().x;
|
||||
navMeshParams.orig.y = geom.getMeshBoundsMin().y;
|
||||
navMeshParams.orig.z = geom.getMeshBoundsMin().z;
|
||||
navMeshParams.tileWidth = tileSize * cellSize;
|
||||
navMeshParams.tileHeight = tileSize * cellSize;
|
||||
|
||||
|
|
|
@ -266,11 +266,11 @@ public class DebugDraw
|
|||
float u = PAD + i * ARC_PTS_SCALE;
|
||||
Vector3f pt = new Vector3f();
|
||||
evalArc(x0, y0, z0, dx, dy, dz, len * h, u, ref pt);
|
||||
vertex(prev[0], prev[1], prev[2], col);
|
||||
vertex(pt[0], pt[1], pt[2], col);
|
||||
prev[0] = pt[0];
|
||||
prev[1] = pt[1];
|
||||
prev[2] = pt[2];
|
||||
vertex(prev.x, prev.y, prev.z, col);
|
||||
vertex(pt.x, pt.y, pt.z, col);
|
||||
prev.x = pt.x;
|
||||
prev.y = pt.y;
|
||||
prev.z = pt.z;
|
||||
}
|
||||
|
||||
// End arrows
|
||||
|
@ -295,9 +295,9 @@ public class DebugDraw
|
|||
|
||||
private void evalArc(float x0, float y0, float z0, float dx, float dy, float dz, float h, float u, ref Vector3f res)
|
||||
{
|
||||
res[0] = x0 + dx * u;
|
||||
res[1] = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1));
|
||||
res[2] = z0 + dz * u;
|
||||
res.x = x0 + dx * u;
|
||||
res.y = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1));
|
||||
res.z = z0 + dz * u;
|
||||
}
|
||||
|
||||
public void debugDrawCross(float x, float y, float z, float size, int col, float lineWidth)
|
||||
|
@ -410,41 +410,41 @@ public class DebugDraw
|
|||
vnormalize(ref ay);
|
||||
|
||||
vertex(p, col);
|
||||
// vertex(p[0]+az[0]*s+ay[0]*s/2, p[1]+az[1]*s+ay[1]*s/2, p[2]+az[2]*s+ay[2]*s/2, col);
|
||||
vertex(p[0] + az[0] * s + ax[0] * s / 3, p[1] + az[1] * s + ax[1] * s / 3, p[2] + az[2] * s + ax[2] * s / 3, col);
|
||||
// vertex(p.x+az.x*s+ay.x*s/2, p.y+az.y*s+ay.y*s/2, p.z+az.z*s+ay.z*s/2, col);
|
||||
vertex(p.x + az.x * s + ax.x * s / 3, p.y + az.y * s + ax.y * s / 3, p.z + az.z * s + ax.z * s / 3, col);
|
||||
|
||||
vertex(p, col);
|
||||
// vertex(p[0]+az[0]*s-ay[0]*s/2, p[1]+az[1]*s-ay[1]*s/2, p[2]+az[2]*s-ay[2]*s/2, col);
|
||||
vertex(p[0] + az[0] * s - ax[0] * s / 3, p[1] + az[1] * s - ax[1] * s / 3, p[2] + az[2] * s - ax[2] * s / 3, col);
|
||||
// vertex(p.x+az.x*s-ay.x*s/2, p.y+az.y*s-ay.y*s/2, p.z+az.z*s-ay.z*s/2, col);
|
||||
vertex(p.x + az.x * s - ax.x * s / 3, p.y + az.y * s - ax.y * s / 3, p.z + az.z * s - ax.z * s / 3, col);
|
||||
}
|
||||
|
||||
public void vcross(ref Vector3f dest, Vector3f v1, Vector3f v2)
|
||||
{
|
||||
dest[0] = v1[1] * v2[2] - v1[2] * v2[1];
|
||||
dest[1] = v1[2] * v2[0] - v1[0] * v2[2];
|
||||
dest[2] = v1[0] * v2[1] - v1[1] * v2[0];
|
||||
dest.x = v1.y * v2.z - v1.z * v2.y;
|
||||
dest.y = v1.z * v2.x - v1.x * v2.z;
|
||||
dest.z = v1.x * v2.y - v1.y * v2.x;
|
||||
}
|
||||
|
||||
public void vnormalize(ref Vector3f v)
|
||||
{
|
||||
float d = (float)(1.0f / Math.Sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]));
|
||||
v[0] *= d;
|
||||
v[1] *= d;
|
||||
v[2] *= d;
|
||||
float d = (float)(1.0f / Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z));
|
||||
v.x *= d;
|
||||
v.y *= d;
|
||||
v.z *= d;
|
||||
}
|
||||
|
||||
public void vsub(ref Vector3f dest, Vector3f v1, Vector3f v2)
|
||||
{
|
||||
dest[0] = v1[0] - v2[0];
|
||||
dest[1] = v1[1] - v2[1];
|
||||
dest[2] = v1[2] - v2[2];
|
||||
dest.x = v1.x - v2.x;
|
||||
dest.y = v1.y - v2.y;
|
||||
dest.z = v1.z - v2.z;
|
||||
}
|
||||
|
||||
public float vdistSqr(Vector3f v1, Vector3f v2)
|
||||
{
|
||||
float x = v1[0] - v2[0];
|
||||
float y = v1[1] - v2[1];
|
||||
float z = v1[2] - v2[2];
|
||||
float x = v1.x - v2.x;
|
||||
float y = v1.y - v2.y;
|
||||
float z = v1.z - v2.z;
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
|
@ -595,9 +595,9 @@ public class DebugDraw
|
|||
float[] r = GLU.mul(rx, ry);
|
||||
float[] t = new float[16];
|
||||
t[0] = t[5] = t[10] = t[15] = 1;
|
||||
t[12] = -cameraPos[0];
|
||||
t[13] = -cameraPos[1];
|
||||
t[14] = -cameraPos[2];
|
||||
t[12] = -cameraPos.x;
|
||||
t[13] = -cameraPos.y;
|
||||
t[14] = -cameraPos.z;
|
||||
_viewMatrix = GLU.mul(r, t);
|
||||
getOpenGlDraw().viewMatrix(_viewMatrix);
|
||||
updateFrustum();
|
||||
|
@ -701,6 +701,6 @@ public class DebugDraw
|
|||
|
||||
public bool frustumTest(Vector3f bmin, Vector3f bmax)
|
||||
{
|
||||
return frustumTest(new float[] { bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2] });
|
||||
return frustumTest(new float[] { bmin.x, bmin.y, bmin.z, bmax.x, bmax.y, bmax.z });
|
||||
}
|
||||
}
|
|
@ -88,9 +88,9 @@ public class GLU
|
|||
if (@out[3] == 0.0)
|
||||
return 0;
|
||||
@out[3] = 1.0f / @out[3];
|
||||
objectCoordinate[0] = @out[0] * @out[3];
|
||||
objectCoordinate[1] = @out[1] * @out[3];
|
||||
objectCoordinate[2] = @out[2] * @out[3];
|
||||
objectCoordinate.x = @out[0] * @out[3];
|
||||
objectCoordinate.y = @out[1] * @out[3];
|
||||
objectCoordinate.z = @out[2] * @out[3];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,10 +202,10 @@ public class NavMeshRenderer
|
|||
// Draw bounds
|
||||
Vector3f bmin = geom.getMeshBoundsMin();
|
||||
Vector3f bmax = geom.getMeshBoundsMax();
|
||||
debugDraw.debugDrawBoxWire(bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2],
|
||||
debugDraw.debugDrawBoxWire(bmin.x, bmin.y, bmin.z, bmax.x, bmax.y, bmax.z,
|
||||
DebugDraw.duRGBA(255, 255, 255, 128), 1.0f);
|
||||
debugDraw.begin(DebugDrawPrimitives.POINTS, 5.0f);
|
||||
debugDraw.vertex(bmin[0], bmin[1], bmin[2], DebugDraw.duRGBA(255, 255, 255, 128));
|
||||
debugDraw.vertex(bmin.x, bmin.y, bmin.z, DebugDraw.duRGBA(255, 255, 255, 128));
|
||||
debugDraw.end();
|
||||
}
|
||||
|
||||
|
@ -254,16 +254,16 @@ public class NavMeshRenderer
|
|||
var vb = Vector3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
|
||||
debugDraw.vertex(vol.verts[0], vol.hmax, vol.verts[2], col);
|
||||
debugDraw.vertex(vb[0], vol.hmax, vb[2], col);
|
||||
debugDraw.vertex(va[0], vol.hmax, va[2], col);
|
||||
debugDraw.vertex(vb.x, vol.hmax, vb.z, col);
|
||||
debugDraw.vertex(va.x, vol.hmax, va.z, col);
|
||||
|
||||
debugDraw.vertex(va[0], vol.hmin, va[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va[0], vol.hmax, va[2], col);
|
||||
debugDraw.vertex(vb[0], vol.hmax, vb[2], col);
|
||||
debugDraw.vertex(va.x, vol.hmin, va.z, DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va.x, vol.hmax, va.z, col);
|
||||
debugDraw.vertex(vb.x, vol.hmax, vb.z, col);
|
||||
|
||||
debugDraw.vertex(va[0], vol.hmin, va[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(vb[0], vol.hmax, vb[2], col);
|
||||
debugDraw.vertex(vb[0], vol.hmin, vb[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va.x, vol.hmin, va.z, DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(vb.x, vol.hmax, vb.z, col);
|
||||
debugDraw.vertex(vb.x, vol.hmin, vb.z, DebugDraw.duDarkenCol(col));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,12 +277,12 @@ public class NavMeshRenderer
|
|||
{
|
||||
var va = Vector3f.Of(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]);
|
||||
var vb = Vector3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
debugDraw.vertex(va[0], vol.hmin, va[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(vb[0], vol.hmin, vb[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va[0], vol.hmax, va[2], col);
|
||||
debugDraw.vertex(vb[0], vol.hmax, vb[2], col);
|
||||
debugDraw.vertex(va[0], vol.hmin, va[2], DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va[0], vol.hmax, va[2], col);
|
||||
debugDraw.vertex(va.x, vol.hmin, va.z, DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(vb.x, vol.hmin, vb.z, DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va.x, vol.hmax, va.z, col);
|
||||
debugDraw.vertex(vb.x, vol.hmax, vb.z, col);
|
||||
debugDraw.vertex(va.x, vol.hmin, va.z, DebugDraw.duDarkenCol(col));
|
||||
debugDraw.vertex(va.x, vol.hmax, va.z, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public struct OpenGLVertex
|
|||
[FieldOffset(20)] private readonly int color;
|
||||
|
||||
public OpenGLVertex(Vector3f pos, Vector2f uv, int color) :
|
||||
this(pos[0], pos[1], pos[2], uv.x, uv.y, color)
|
||||
this(pos.x, pos.y, pos.z, uv.x, uv.y, color)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public struct OpenGLVertex
|
|||
}
|
||||
|
||||
public OpenGLVertex(Vector3f pos, int color) :
|
||||
this(pos[0], pos[1], pos[2], 0f, 0f, color)
|
||||
this(pos.x, pos.y, pos.z, 0f, 0f, color)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
Vector3f norm = Vector3f.Of(normals[i], normals[i + 1], normals[i + 2]);
|
||||
|
||||
int color;
|
||||
char a = (char)(220 * (2 + norm[0] + norm[1]) / 4);
|
||||
if (norm[1] < walkableThr)
|
||||
char a = (char)(220 * (2 + norm.x + norm.y) / 4);
|
||||
if (norm.y < walkableThr)
|
||||
{
|
||||
color = duLerpCol(duRGBA(a, a, a, 255), unwalkable, 64);
|
||||
}
|
||||
|
@ -72,12 +72,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
Vector3f vc = Vector3f.Of(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]);
|
||||
|
||||
int ax = 0, ay = 0;
|
||||
if (Math.Abs(norm[1]) > Math.Abs(norm[ax]))
|
||||
if (Math.Abs(norm.y) > Math.Abs(norm[ax]))
|
||||
{
|
||||
ax = 1;
|
||||
}
|
||||
|
||||
if (Math.Abs(norm[2]) > Math.Abs(norm[ax]))
|
||||
if (Math.Abs(norm.z) > Math.Abs(norm[ax]))
|
||||
{
|
||||
ax = 2;
|
||||
}
|
||||
|
@ -215,12 +215,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
}
|
||||
|
||||
// End points and their on-mesh locations.
|
||||
vertex(va[0], va[1], va[2], col);
|
||||
vertex(va.x, va.y, va.z, col);
|
||||
vertex(con.pos[0], con.pos[1], con.pos[2], col);
|
||||
col2 = startSet ? col : duRGBA(220, 32, 16, 196);
|
||||
appendCircle(con.pos[0], con.pos[1] + 0.1f, con.pos[2], con.rad, col2);
|
||||
|
||||
vertex(vb[0], vb[1], vb[2], col);
|
||||
vertex(vb.x, vb.y, vb.z, col);
|
||||
vertex(con.pos[3], con.pos[4], con.pos[5], col);
|
||||
col2 = endSet ? col : duRGBA(220, 32, 16, 196);
|
||||
appendCircle(con.pos[3], con.pos[4] + 0.1f, con.pos[5], con.rad, col2);
|
||||
|
@ -426,10 +426,10 @@ public class RecastDebugDraw : DebugDraw
|
|||
|
||||
static float distancePtLine2d(Vector3f pt, Vector3f p, Vector3f q)
|
||||
{
|
||||
float pqx = q[0] - p[0];
|
||||
float pqz = q[2] - p[2];
|
||||
float dx = pt[0] - p[0];
|
||||
float dz = pt[2] - p[2];
|
||||
float pqx = q.x - p.x;
|
||||
float pqz = q.z - p.z;
|
||||
float dx = pt.x - p.x;
|
||||
float dz = pt.z - p.z;
|
||||
float d = pqx * pqx + pqz * pqz;
|
||||
float t = pqx * dx + pqz * dz;
|
||||
if (d != 0)
|
||||
|
@ -437,8 +437,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
t /= d;
|
||||
}
|
||||
|
||||
dx = p[0] + t * pqx - pt[0];
|
||||
dz = p[2] + t * pqz - pt[2];
|
||||
dx = p.x + t * pqx - pt.x;
|
||||
dz = p.z + t * pqz - pt.z;
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
||||
|
@ -467,9 +467,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
continue;
|
||||
}
|
||||
|
||||
appendBoxWire(tile.data.header.bmin[0] + n.bmin[0] * cs, tile.data.header.bmin[1] + n.bmin[1] * cs,
|
||||
tile.data.header.bmin[2] + n.bmin[2] * cs, tile.data.header.bmin[0] + n.bmax[0] * cs,
|
||||
tile.data.header.bmin[1] + n.bmax[1] * cs, tile.data.header.bmin[2] + n.bmax[2] * cs,
|
||||
appendBoxWire(tile.data.header.bmin.x + n.bmin[0] * cs, tile.data.header.bmin.y + n.bmin[1] * cs,
|
||||
tile.data.header.bmin.z + n.bmin[2] * cs, tile.data.header.bmin.x + n.bmax[0] * cs,
|
||||
tile.data.header.bmin.y + n.bmax[1] * cs, tile.data.header.bmin.z + n.bmax[2] * cs,
|
||||
duRGBA(255, 255, 255, 128));
|
||||
}
|
||||
|
||||
|
@ -487,8 +487,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin[0] + x * cs;
|
||||
float fz = chf.bmin[2] + y * cs;
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
CompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||
|
@ -510,7 +510,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
color = areaToCol(area);
|
||||
}
|
||||
|
||||
float fy = chf.bmin[1] + (s.y + 1) * ch;
|
||||
float fy = chf.bmin.y + (s.y + 1) * ch;
|
||||
vertex(fx, fy, fz, color);
|
||||
vertex(fx, fy, fz + cs, color);
|
||||
vertex(fx + cs, fy, fz + cs, color);
|
||||
|
@ -550,7 +550,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
if (cont2 != null)
|
||||
{
|
||||
Vector3f pos2 = getContourCenter(cont2, orig, cs, ch);
|
||||
appendArc(pos[0], pos[1], pos[2], pos2[0], pos2[1], pos2[2], 0.25f, 0.6f, 0.6f, color);
|
||||
appendArc(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z, 0.25f, 0.6f, 0.6f, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -575,9 +575,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
private Vector3f getContourCenter(Contour cont, Vector3f orig, float cs, float ch)
|
||||
{
|
||||
Vector3f center = new Vector3f();
|
||||
center[0] = 0;
|
||||
center[1] = 0;
|
||||
center[2] = 0;
|
||||
center.x = 0;
|
||||
center.y = 0;
|
||||
center.z = 0;
|
||||
if (cont.nverts == 0)
|
||||
{
|
||||
return center;
|
||||
|
@ -586,18 +586,18 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int i = 0; i < cont.nverts; ++i)
|
||||
{
|
||||
int v = i * 4;
|
||||
center[0] += cont.verts[v + 0];
|
||||
center[1] += cont.verts[v + 1];
|
||||
center[2] += cont.verts[v + 2];
|
||||
center.x += cont.verts[v + 0];
|
||||
center.y += cont.verts[v + 1];
|
||||
center.z += cont.verts[v + 2];
|
||||
}
|
||||
|
||||
float s = 1.0f / cont.nverts;
|
||||
center[0] *= s * cs;
|
||||
center[1] *= s * ch;
|
||||
center[2] *= s * cs;
|
||||
center[0] += orig[0];
|
||||
center[1] += orig[1] + 4 * ch;
|
||||
center[2] += orig[2];
|
||||
center.x *= s * cs;
|
||||
center.y *= s * ch;
|
||||
center.z *= s * cs;
|
||||
center.x += orig.x;
|
||||
center.y += orig.y + 4 * ch;
|
||||
center.z += orig.z;
|
||||
return center;
|
||||
}
|
||||
|
||||
|
@ -634,9 +634,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = c.rverts[j * 4];
|
||||
int v1 = c.rverts[j * 4 + 1];
|
||||
int v2 = c.rverts[j * 4 + 2];
|
||||
float fx = orig[0] + v0 * cs;
|
||||
float fy = orig[1] + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig[2] + v2 * cs;
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + v2 * cs;
|
||||
vertex(fx, fy, fz, color);
|
||||
if (j > 0)
|
||||
{
|
||||
|
@ -649,9 +649,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = c.rverts[0];
|
||||
int v1 = c.rverts[1];
|
||||
int v2 = c.rverts[2];
|
||||
float fx = orig[0] + v0 * cs;
|
||||
float fy = orig[1] + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig[2] + v2 * cs;
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + v2 * cs;
|
||||
vertex(fx, fy, fz, color);
|
||||
}
|
||||
}
|
||||
|
@ -679,9 +679,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
off = ch * 2;
|
||||
}
|
||||
|
||||
float fx = orig[0] + v0 * cs;
|
||||
float fy = orig[1] + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig[2] + v2 * cs;
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.z + v2 * cs;
|
||||
vertex(fx, fy, fz, colv);
|
||||
}
|
||||
}
|
||||
|
@ -722,14 +722,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
int vb2 = c.verts[j * 4 + 2];
|
||||
int col = (va3 & RecastConstants.RC_AREA_BORDER) != 0 ? bcolor : color;
|
||||
|
||||
float fx = orig[0] + va0 * cs;
|
||||
float fy = orig[1] + (va1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig[2] + va2 * cs;
|
||||
float fx = orig.x + va0 * cs;
|
||||
float fy = orig.y + (va1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + va2 * cs;
|
||||
vertex(fx, fy, fz, col);
|
||||
|
||||
fx = orig[0] + vb0 * cs;
|
||||
fy = orig[1] + (vb1 + 1 + (i & 1)) * ch;
|
||||
fz = orig[2] + vb2 * cs;
|
||||
fx = orig.x + vb0 * cs;
|
||||
fy = orig.y + (vb1 + 1 + (i & 1)) * ch;
|
||||
fz = orig.z + vb2 * cs;
|
||||
vertex(fx, fy, fz, col);
|
||||
}
|
||||
}
|
||||
|
@ -757,9 +757,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
off = ch * 2;
|
||||
}
|
||||
|
||||
float fx = orig[0] + v0 * cs;
|
||||
float fy = orig[1] + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig[2] + v2 * cs;
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.z + v2 * cs;
|
||||
vertex(fx, fy, fz, colv);
|
||||
}
|
||||
}
|
||||
|
@ -790,12 +790,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
float fx = orig[0] + x * cs;
|
||||
float fz = orig[2] + y * cs;
|
||||
float fx = orig.x + x * cs;
|
||||
float fz = orig.z + y * cs;
|
||||
Span s = hf.spans[x + y * w];
|
||||
while (s != null)
|
||||
{
|
||||
appendBox(fx, orig[1] + s.smin * ch, fz, fx + cs, orig[1] + s.smax * ch, fz + cs, fcol);
|
||||
appendBox(fx, orig.y + s.smin * ch, fz, fx + cs, orig.y + s.smax * ch, fz + cs, fcol);
|
||||
s = s.next;
|
||||
}
|
||||
}
|
||||
|
@ -822,8 +822,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
float fx = orig[0] + x * cs;
|
||||
float fz = orig[2] + y * cs;
|
||||
float fx = orig.x + x * cs;
|
||||
float fz = orig.z + y * cs;
|
||||
Span s = hf.spans[x + y * w];
|
||||
while (s != null)
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
fcol[0] = duMultCol(areaToCol(s.area), 200);
|
||||
}
|
||||
|
||||
appendBox(fx, orig[1] + s.smin * ch, fz, fx + cs, orig[1] + s.smax * ch, fz + cs, fcol);
|
||||
appendBox(fx, orig.y + s.smin * ch, fz, fx + cs, orig.y + s.smax * ch, fz + cs, fcol);
|
||||
s = s.next;
|
||||
}
|
||||
}
|
||||
|
@ -860,14 +860,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin[0] + x * cs;
|
||||
float fz = chf.bmin[2] + y * cs;
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
CompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||
{
|
||||
CompactSpan s = chf.spans[i];
|
||||
float fy = chf.bmin[1] + (s.y) * ch;
|
||||
float fy = chf.bmin.y + (s.y) * ch;
|
||||
int color;
|
||||
if (s.reg != 0)
|
||||
{
|
||||
|
@ -913,14 +913,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin[0] + x * cs;
|
||||
float fz = chf.bmin[2] + y * cs;
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
CompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||
{
|
||||
CompactSpan s = chf.spans[i];
|
||||
float fy = chf.bmin[1] + (s.y + 1) * ch;
|
||||
float fy = chf.bmin.y + (s.y + 1) * ch;
|
||||
char cd = (char)(chf.dist[i] * dscale);
|
||||
int color = duRGBA(cd, cd, cd, 255);
|
||||
vertex(fx, fy, fz, color);
|
||||
|
@ -978,9 +978,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = mesh.verts[vi[k] * 3];
|
||||
int v1 = mesh.verts[vi[k] * 3 + 1];
|
||||
int v2 = mesh.verts[vi[k] * 3 + 2];
|
||||
float x = orig[0] + v0 * cs;
|
||||
float y = orig[1] + (v1 + 1) * ch;
|
||||
float z = orig[2] + v2 * cs;
|
||||
float x = orig.x + v0 * cs;
|
||||
float y = orig.y + (v1 + 1) * ch;
|
||||
float z = orig.z + v2 * cs;
|
||||
vertex(x, y, z, color);
|
||||
}
|
||||
}
|
||||
|
@ -1012,9 +1012,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
int v = vi[k] * 3;
|
||||
float x = orig[0] + mesh.verts[v] * cs;
|
||||
float y = orig[1] + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig[2] + mesh.verts[v + 2] * cs;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
vertex(x, y, z, coln);
|
||||
}
|
||||
}
|
||||
|
@ -1052,9 +1052,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
int v = vi[k] * 3;
|
||||
float x = orig[0] + mesh.verts[v] * cs;
|
||||
float y = orig[1] + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig[2] + mesh.verts[v + 2] * cs;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
vertex(x, y, z, col);
|
||||
}
|
||||
}
|
||||
|
@ -1067,9 +1067,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int i = 0; i < mesh.nverts; ++i)
|
||||
{
|
||||
int v = i * 3;
|
||||
float x = orig[0] + mesh.verts[v] * cs;
|
||||
float y = orig[1] + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig[2] + mesh.verts[v + 2] * cs;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
vertex(x, y, z, colv);
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1213,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
continue;
|
||||
}
|
||||
|
||||
vertex(node.pos[0], node.pos[1] + off, node.pos[2], duRGBA(255, 192, 0, 255));
|
||||
vertex(node.pos.x, node.pos.y + off, node.pos.z, duRGBA(255, 192, 0, 255));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1240,8 +1240,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
continue;
|
||||
}
|
||||
|
||||
vertex(node.pos[0], node.pos[1] + off, node.pos[2], duRGBA(255, 192, 0, 128));
|
||||
vertex(parent.pos[0], parent.pos[1] + off, parent.pos[2], duRGBA(255, 192, 0, 128));
|
||||
vertex(node.pos.x, node.pos.y + off, node.pos.z, duRGBA(255, 192, 0, 128));
|
||||
vertex(parent.pos.x, parent.pos.y + off, parent.pos.z, duRGBA(255, 192, 0, 128));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1368,37 +1368,37 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
int col = side == 0 ? duRGBA(128, 0, 0, 128) : duRGBA(128, 0, 128, 128);
|
||||
|
||||
float x = va[0] + ((side == 0) ? -padx : padx);
|
||||
float x = va.x + ((side == 0) ? -padx : padx);
|
||||
|
||||
vertex(x, va[1] - pady, va[2], col);
|
||||
vertex(x, va[1] + pady, va[2], col);
|
||||
vertex(x, va.y - pady, va.z, col);
|
||||
vertex(x, va.y + pady, va.z, col);
|
||||
|
||||
vertex(x, va[1] + pady, va[2], col);
|
||||
vertex(x, vb[1] + pady, vb[2], col);
|
||||
vertex(x, va.y + pady, va.z, col);
|
||||
vertex(x, vb.y + pady, vb.z, col);
|
||||
|
||||
vertex(x, vb[1] + pady, vb[2], col);
|
||||
vertex(x, vb[1] - pady, vb[2], col);
|
||||
vertex(x, vb.y + pady, vb.z, col);
|
||||
vertex(x, vb.y - pady, vb.z, col);
|
||||
|
||||
vertex(x, vb[1] - pady, vb[2], col);
|
||||
vertex(x, va[1] - pady, va[2], col);
|
||||
vertex(x, vb.y - pady, vb.z, col);
|
||||
vertex(x, va.y - pady, va.z, col);
|
||||
}
|
||||
else if (side == 2 || side == 6)
|
||||
{
|
||||
int col = side == 2 ? duRGBA(0, 128, 0, 128) : duRGBA(0, 128, 128, 128);
|
||||
|
||||
float z = va[2] + ((side == 2) ? -padx : padx);
|
||||
float z = va.z + ((side == 2) ? -padx : padx);
|
||||
|
||||
vertex(va[0], va[1] - pady, z, col);
|
||||
vertex(va[0], va[1] + pady, z, col);
|
||||
vertex(va.x, va.y - pady, z, col);
|
||||
vertex(va.x, va.y + pady, z, col);
|
||||
|
||||
vertex(va[0], va[1] + pady, z, col);
|
||||
vertex(vb[0], vb[1] + pady, z, col);
|
||||
vertex(va.x, va.y + pady, z, col);
|
||||
vertex(vb.x, vb.y + pady, z, col);
|
||||
|
||||
vertex(vb[0], vb[1] + pady, z, col);
|
||||
vertex(vb[0], vb[1] - pady, z, col);
|
||||
vertex(vb.x, vb.y + pady, z, col);
|
||||
vertex(vb.x, vb.y - pady, z, col);
|
||||
|
||||
vertex(vb[0], vb[1] - pady, z, col);
|
||||
vertex(va[0], va[1] - pady, z, col);
|
||||
vertex(vb.x, vb.y - pady, z, col);
|
||||
vertex(va.x, va.y - pady, z, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,9 +109,9 @@ public class DemoInputGeomProvider : InputGeomProvider
|
|||
e1[j] = vertices[v2 + j] - vertices[v0 + j];
|
||||
}
|
||||
|
||||
normals[i] = e0[1] * e1[2] - e0[2] * e1[1];
|
||||
normals[i + 1] = e0[2] * e1[0] - e0[0] * e1[2];
|
||||
normals[i + 2] = e0[0] * e1[1] - e0[1] * e1[0];
|
||||
normals[i] = e0.y * e1.z - e0.z * e1.y;
|
||||
normals[i + 1] = e0.z * e1.x - e0.x * e1.z;
|
||||
normals[i + 2] = e0.x * e1.y - e0.y * e1.x;
|
||||
float d = (float)Math.Sqrt(normals[i] * normals[i] + normals[i + 1] * normals[i + 1] + normals[i + 2] * normals[i + 2]);
|
||||
if (d > 0)
|
||||
{
|
||||
|
@ -161,10 +161,10 @@ public class DemoInputGeomProvider : InputGeomProvider
|
|||
float btmin = btminmax[0];
|
||||
float btmax = btminmax[1];
|
||||
float[] p = new float[2], q = new float[2];
|
||||
p[0] = src[0] + (dst[0] - src[0]) * btmin;
|
||||
p[1] = src[2] + (dst[2] - src[2]) * btmin;
|
||||
q[0] = src[0] + (dst[0] - src[0]) * btmax;
|
||||
q[1] = src[2] + (dst[2] - src[2]) * btmax;
|
||||
p[0] = src.x + (dst.x - src.x) * btmin;
|
||||
p[1] = src.z + (dst.z - src.z) * btmin;
|
||||
q[0] = src.x + (dst.x - src.x) * btmax;
|
||||
q[1] = src.z + (dst.z - src.z) * btmax;
|
||||
|
||||
List<ChunkyTriMeshNode> chunks = _mesh.chunkyTriMesh.getChunksOverlappingSegment(p, q);
|
||||
if (0 == chunks.Count)
|
||||
|
|
|
@ -33,12 +33,12 @@ public class DemoOffMeshConnection
|
|||
public DemoOffMeshConnection(Vector3f start, Vector3f end, float radius, bool bidir, int area, int flags)
|
||||
{
|
||||
verts = new float[6];
|
||||
verts[0] = start[0];
|
||||
verts[1] = start[1];
|
||||
verts[2] = start[2];
|
||||
verts[3] = end[0];
|
||||
verts[4] = end[1];
|
||||
verts[5] = end[2];
|
||||
verts[0] = start.x;
|
||||
verts[1] = start.y;
|
||||
verts[2] = start.z;
|
||||
verts[3] = end.x;
|
||||
verts[4] = end.y;
|
||||
verts[5] = end.z;
|
||||
this.radius = radius;
|
||||
this.bidir = bidir;
|
||||
this.area = area;
|
||||
|
|
|
@ -144,9 +144,9 @@ public class RecastDemo
|
|||
}
|
||||
|
||||
float[] modelviewMatrix = dd.viewMatrix(cameraPos, cameraEulers);
|
||||
cameraPos[0] += scrollZoom * 2.0f * modelviewMatrix[2];
|
||||
cameraPos[1] += scrollZoom * 2.0f * modelviewMatrix[6];
|
||||
cameraPos[2] += scrollZoom * 2.0f * modelviewMatrix[10];
|
||||
cameraPos.x += scrollZoom * 2.0f * modelviewMatrix[2];
|
||||
cameraPos.y += scrollZoom * 2.0f * modelviewMatrix[6];
|
||||
cameraPos.z += scrollZoom * 2.0f * modelviewMatrix[10];
|
||||
scrollZoom = 0;
|
||||
}
|
||||
|
||||
|
@ -169,17 +169,17 @@ public class RecastDemo
|
|||
if (pan)
|
||||
{
|
||||
float[] modelviewMatrix = dd.viewMatrix(cameraPos, cameraEulers);
|
||||
cameraPos[0] = origCameraPos[0];
|
||||
cameraPos[1] = origCameraPos[1];
|
||||
cameraPos[2] = origCameraPos[2];
|
||||
cameraPos.x = origCameraPos.x;
|
||||
cameraPos.y = origCameraPos.y;
|
||||
cameraPos.z = origCameraPos.z;
|
||||
|
||||
cameraPos[0] -= 0.1f * dx * modelviewMatrix[0];
|
||||
cameraPos[1] -= 0.1f * dx * modelviewMatrix[4];
|
||||
cameraPos[2] -= 0.1f * dx * modelviewMatrix[8];
|
||||
cameraPos.x -= 0.1f * dx * modelviewMatrix[0];
|
||||
cameraPos.y -= 0.1f * dx * modelviewMatrix[4];
|
||||
cameraPos.z -= 0.1f * dx * modelviewMatrix[8];
|
||||
|
||||
cameraPos[0] += 0.1f * dy * modelviewMatrix[1];
|
||||
cameraPos[1] += 0.1f * dy * modelviewMatrix[5];
|
||||
cameraPos[2] += 0.1f * dy * modelviewMatrix[9];
|
||||
cameraPos.x += 0.1f * dy * modelviewMatrix[1];
|
||||
cameraPos.y += 0.1f * dy * modelviewMatrix[5];
|
||||
cameraPos.z += 0.1f * dy * modelviewMatrix[9];
|
||||
if (dx * dx + dy * dy > 3 * 3)
|
||||
{
|
||||
movedDuringPan = true;
|
||||
|
@ -214,9 +214,9 @@ public class RecastDemo
|
|||
movedDuringPan = false;
|
||||
origMousePos[0] = mousePos[0];
|
||||
origMousePos[1] = mousePos[1];
|
||||
origCameraPos[0] = cameraPos[0];
|
||||
origCameraPos[1] = cameraPos[1];
|
||||
origCameraPos[2] = cameraPos[2];
|
||||
origCameraPos.x = cameraPos.x;
|
||||
origCameraPos.y = cameraPos.y;
|
||||
origCameraPos.z = cameraPos.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ public class RecastDemo
|
|||
{
|
||||
/*
|
||||
* try (MemoryStack stack = stackPush()) { int[] w = stack.mallocInt(1); int[] h =
|
||||
* stack.mallocInt(1); glfwGetWindowSize(win, w, h); width = w[0]; height = h[0]; }
|
||||
* stack.mallocInt(1); glfwGetWindowSize(win, w, h); width = w.x; height = h.x; }
|
||||
*/
|
||||
if (sample.getInputGeom() != null)
|
||||
{
|
||||
|
@ -449,15 +449,15 @@ public class RecastDemo
|
|||
double movey = (_moveBack - _moveFront) * keySpeed * dt + scrollZoom * 2.0f;
|
||||
scrollZoom = 0;
|
||||
|
||||
cameraPos[0] += (float)(movex * modelviewMatrix[0]);
|
||||
cameraPos[1] += (float)(movex * modelviewMatrix[4]);
|
||||
cameraPos[2] += (float)(movex * modelviewMatrix[8]);
|
||||
cameraPos.x += (float)(movex * modelviewMatrix[0]);
|
||||
cameraPos.y += (float)(movex * modelviewMatrix[4]);
|
||||
cameraPos.z += (float)(movex * modelviewMatrix[8]);
|
||||
|
||||
cameraPos[0] += (float)(movey * modelviewMatrix[2]);
|
||||
cameraPos[1] += (float)(movey * modelviewMatrix[6]);
|
||||
cameraPos[2] += (float)(movey * modelviewMatrix[10]);
|
||||
cameraPos.x += (float)(movey * modelviewMatrix[2]);
|
||||
cameraPos.y += (float)(movey * modelviewMatrix[6]);
|
||||
cameraPos.z += (float)(movey * modelviewMatrix[10]);
|
||||
|
||||
cameraPos[1] += (float)((_moveUp - _moveDown) * keySpeed * dt);
|
||||
cameraPos.y += (float)((_moveUp - _moveDown) * keySpeed * dt);
|
||||
|
||||
long time = FrequencyWatch.Ticks;
|
||||
prevFrameTime = time;
|
||||
|
@ -597,7 +597,7 @@ public class RecastDemo
|
|||
hit = PolyMeshRaycast.raycast(sample.getRecastResults(), rayStart, rayEnd);
|
||||
}
|
||||
|
||||
float[] rayDir = new float[] { rayEnd[0] - rayStart[0], rayEnd[1] - rayStart[1], rayEnd[2] - rayStart[2] };
|
||||
float[] rayDir = new float[] { rayEnd.x - rayStart.x, rayEnd.y - rayStart.y, rayEnd.z - rayStart.z };
|
||||
Tool rayTool = toolsUI.getTool();
|
||||
vNormalize(rayDir);
|
||||
if (rayTool != null)
|
||||
|
@ -612,16 +612,16 @@ public class RecastDemo
|
|||
{
|
||||
// Marker
|
||||
markerPositionSet = true;
|
||||
markerPosition[0] = rayStart[0] + (rayEnd[0] - rayStart[0]) * hitTime;
|
||||
markerPosition[1] = rayStart[1] + (rayEnd[1] - rayStart[1]) * hitTime;
|
||||
markerPosition[2] = rayStart[2] + (rayEnd[2] - rayStart[2]) * hitTime;
|
||||
markerPosition.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
||||
markerPosition.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
||||
markerPosition.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector3f pos = new Vector3f();
|
||||
pos[0] = rayStart[0] + (rayEnd[0] - rayStart[0]) * hitTime;
|
||||
pos[1] = rayStart[1] + (rayEnd[1] - rayStart[1]) * hitTime;
|
||||
pos[2] = rayStart[2] + (rayEnd[2] - rayStart[2]) * hitTime;
|
||||
pos.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
||||
pos.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
||||
pos.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
||||
if (rayTool != null)
|
||||
{
|
||||
rayTool.handleClick(rayStart, pos, processHitTestShift);
|
||||
|
@ -669,15 +669,15 @@ public class RecastDemo
|
|||
}
|
||||
|
||||
bminN = Vector3f.Of(
|
||||
Math.Min(bminN.Value[0], result.getSolidHeightfield().bmin[0]),
|
||||
Math.Min(bminN.Value[1], result.getSolidHeightfield().bmin[1]),
|
||||
Math.Min(bminN.Value[2], result.getSolidHeightfield().bmin[2])
|
||||
Math.Min(bminN.Value.x, result.getSolidHeightfield().bmin.x),
|
||||
Math.Min(bminN.Value.y, result.getSolidHeightfield().bmin.y),
|
||||
Math.Min(bminN.Value.z, result.getSolidHeightfield().bmin.z)
|
||||
);
|
||||
|
||||
bmaxN = Vector3f.Of(
|
||||
Math.Max(bmaxN.Value[0], result.getSolidHeightfield().bmax[0]),
|
||||
Math.Max(bmaxN.Value[1], result.getSolidHeightfield().bmax[1]),
|
||||
Math.Max(bmaxN.Value[2], result.getSolidHeightfield().bmax[2])
|
||||
Math.Max(bmaxN.Value.x, result.getSolidHeightfield().bmax.x),
|
||||
Math.Max(bmaxN.Value.y, result.getSolidHeightfield().bmax.y),
|
||||
Math.Max(bmaxN.Value.z, result.getSolidHeightfield().bmax.z)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -689,11 +689,11 @@ public class RecastDemo
|
|||
Vector3f bmax = bmaxN.Value;
|
||||
|
||||
camr = (float)(Math.Sqrt(
|
||||
sqr(bmax[0] - bmin[0]) + sqr(bmax[1] - bmin[1]) + sqr(bmax[2] - bmin[2]))
|
||||
sqr(bmax.x - bmin.x) + sqr(bmax.y - bmin.y) + sqr(bmax.z - bmin.z))
|
||||
/ 2);
|
||||
cameraPos[0] = (bmax[0] + bmin[0]) / 2 + camr;
|
||||
cameraPos[1] = (bmax[1] + bmin[1]) / 2 + camr;
|
||||
cameraPos[2] = (bmax[2] + bmin[2]) / 2 + camr;
|
||||
cameraPos.x = (bmax.x + bmin.x) / 2 + camr;
|
||||
cameraPos.y = (bmax.y + bmin.y) / 2 + camr;
|
||||
cameraPos.z = (bmax.z + bmin.z) / 2 + camr;
|
||||
camr *= 3;
|
||||
cameraEulers[0] = 45;
|
||||
cameraEulers[1] = -45;
|
||||
|
|
|
@ -62,8 +62,8 @@ public class ConvexVolumeTool : Tool
|
|||
IList<ConvexVolume> vols = geom.convexVolumes();
|
||||
for (int i = 0; i < vols.Count; ++i)
|
||||
{
|
||||
if (PolyUtils.pointInPoly(vols[i].verts, p) && p[1] >= vols[i].hmin
|
||||
&& p[1] <= vols[i].hmax)
|
||||
if (PolyUtils.pointInPoly(vols[i].verts, p) && p.y >= vols[i].hmin
|
||||
&& p.y <= vols[i].hmax)
|
||||
{
|
||||
nearestIndex = i;
|
||||
}
|
||||
|
@ -123,9 +123,9 @@ public class ConvexVolumeTool : Tool
|
|||
else
|
||||
{
|
||||
// Add new point
|
||||
pts.Add(p[0]);
|
||||
pts.Add(p[1]);
|
||||
pts.Add(p[2]);
|
||||
pts.Add(p.x);
|
||||
pts.Add(p.y);
|
||||
pts.Add(p.z);
|
||||
// Update hull.
|
||||
if (pts.Count > 3)
|
||||
{
|
||||
|
|
|
@ -336,9 +336,9 @@ public class CrowdProfilingTool
|
|||
|
||||
if (ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_VALID)
|
||||
{
|
||||
float dx = ag.targetPos[0] - ag.npos[0];
|
||||
float dy = ag.targetPos[1] - ag.npos[1];
|
||||
float dz = ag.targetPos[2] - ag.npos[2];
|
||||
float dx = ag.targetPos.x - ag.npos.x;
|
||||
float dy = ag.targetPos.y - ag.npos.y;
|
||||
float dz = ag.targetPos.z - ag.npos.z;
|
||||
return dx * dx + dy * dy + dz * dz < 0.3f;
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ public class CrowdProfilingTool
|
|||
{
|
||||
float radius = ag.option.radius;
|
||||
Vector3f pos = ag.npos;
|
||||
dd.debugDrawCircle(pos[0], pos[1], pos[2], radius, duRGBA(0, 0, 0, 32), 2.0f);
|
||||
dd.debugDrawCircle(pos.x, pos.y, pos.z, radius, duRGBA(0, 0, 0, 32), 2.0f);
|
||||
}
|
||||
|
||||
foreach (CrowdAgent ag in crowd.getActiveAgents())
|
||||
|
@ -396,8 +396,8 @@ public class CrowdProfilingTool
|
|||
else if (ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
col = duLerpCol(col, duRGBA(64, 255, 0, 128), 128);
|
||||
|
||||
dd.debugDrawCylinder(pos[0] - radius, pos[1] + radius * 0.1f, pos[2] - radius, pos[0] + radius, pos[1] + height,
|
||||
pos[2] + radius, col);
|
||||
dd.debugDrawCylinder(pos.x - radius, pos.y + radius * 0.1f, pos.z - radius, pos.x + radius, pos.y + height,
|
||||
pos.z + radius, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,9 +235,9 @@ public class CrowdTool : Tool
|
|||
|
||||
for (int i = 0; i < AGENT_MAX_TRAIL; ++i)
|
||||
{
|
||||
trail.trail[i * 3] = p[0];
|
||||
trail.trail[i * 3 + 1] = p[1];
|
||||
trail.trail[i * 3 + 2] = p[2];
|
||||
trail.trail[i * 3] = p.x;
|
||||
trail.trail[i * 3 + 1] = p.y;
|
||||
trail.trail[i * 3 + 2] = p.z;
|
||||
}
|
||||
|
||||
trail.htrail = 0;
|
||||
|
@ -289,12 +289,12 @@ public class CrowdTool : Tool
|
|||
Vector3f p = ag.npos;
|
||||
float r = ag.option.radius;
|
||||
float h = ag.option.height;
|
||||
bmin[0] = p[0] - r;
|
||||
bmin[1] = p[1];
|
||||
bmin[2] = p[2] - r;
|
||||
bmax[0] = p[0] + r;
|
||||
bmax[1] = p[1] + h;
|
||||
bmax[2] = p[2] + r;
|
||||
bmin.x = p.x - r;
|
||||
bmin.y = p.y;
|
||||
bmin.z = p.z - r;
|
||||
bmax.x = p.x + r;
|
||||
bmax.y = p.y + h;
|
||||
bmax.z = p.z + r;
|
||||
}
|
||||
|
||||
private void setMoveTarget(Vector3f p, bool adjust)
|
||||
|
@ -346,7 +346,7 @@ public class CrowdTool : Tool
|
|||
private Vector3f calcVel(Vector3f pos, Vector3f tgt, float speed)
|
||||
{
|
||||
Vector3f vel = vSub(tgt, pos);
|
||||
vel[1] = 0.0f;
|
||||
vel.y = 0.0f;
|
||||
vNormalize(ref vel);
|
||||
return vScale(vel, speed);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ public class CrowdTool : Tool
|
|||
}
|
||||
|
||||
if (m_targetRef != 0)
|
||||
dd.debugDrawCross(m_targetPos[0], m_targetPos[1] + 0.1f, m_targetPos[2], rad, duRGBA(255, 255, 255, 192), 2.0f);
|
||||
dd.debugDrawCross(m_targetPos.x, m_targetPos.y + 0.1f, m_targetPos.z, rad, duRGBA(255, 255, 255, 192), 2.0f);
|
||||
|
||||
// Occupancy grid.
|
||||
if (toolParams.m_showGrid)
|
||||
|
@ -401,7 +401,7 @@ public class CrowdTool : Tool
|
|||
foreach (CrowdAgent ag in crowd.getActiveAgents())
|
||||
{
|
||||
Vector3f pos = ag.corridor.getPos();
|
||||
gridy = Math.Max(gridy, pos[1]);
|
||||
gridy = Math.Max(gridy, pos.y);
|
||||
}
|
||||
|
||||
gridy += 1.0f;
|
||||
|
@ -442,7 +442,7 @@ public class CrowdTool : Tool
|
|||
int idx = (trail.htrail + AGENT_MAX_TRAIL - j) % AGENT_MAX_TRAIL;
|
||||
int v = idx * 3;
|
||||
float a = 1 - j / (float)AGENT_MAX_TRAIL;
|
||||
dd.vertex(prev[0], prev[1] + 0.1f, prev[2], duRGBA(0, 0, 0, (int)(128 * preva)));
|
||||
dd.vertex(prev.x, prev.y + 0.1f, prev.z, duRGBA(0, 0, 0, (int)(128 * preva)));
|
||||
dd.vertex(trail.trail[v], trail.trail[v + 1] + 0.1f, trail.trail[v + 2], duRGBA(0, 0, 0, (int)(128 * a)));
|
||||
preva = a;
|
||||
vCopy(ref prev, trail.trail, v);
|
||||
|
@ -469,16 +469,16 @@ public class CrowdTool : Tool
|
|||
{
|
||||
Vector3f va = j == 0 ? pos : ag.corners[j - 1].getPos();
|
||||
Vector3f vb = ag.corners[j].getPos();
|
||||
dd.vertex(va[0], va[1] + radius, va[2], duRGBA(128, 0, 0, 192));
|
||||
dd.vertex(vb[0], vb[1] + radius, vb[2], duRGBA(128, 0, 0, 192));
|
||||
dd.vertex(va.x, va.y + radius, va.z, duRGBA(128, 0, 0, 192));
|
||||
dd.vertex(vb.x, vb.y + radius, vb.z, duRGBA(128, 0, 0, 192));
|
||||
}
|
||||
|
||||
if ((ag.corners[ag.corners.Count - 1].getFlags()
|
||||
& NavMeshQuery.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||
{
|
||||
Vector3f v = ag.corners[ag.corners.Count - 1].getPos();
|
||||
dd.vertex(v[0], v[1], v[2], duRGBA(192, 0, 0, 192));
|
||||
dd.vertex(v[0], v[1] + radius * 2, v[2], duRGBA(192, 0, 0, 192));
|
||||
dd.vertex(v.x, v.y, v.z, duRGBA(192, 0, 0, 192));
|
||||
dd.vertex(v.x, v.y + radius * 2, v.z, duRGBA(192, 0, 0, 192));
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -487,21 +487,21 @@ public class CrowdTool : Tool
|
|||
{
|
||||
/* float dvel[3], pos[3];
|
||||
calcSmoothSteerDirection(ag.pos, ag.cornerVerts, ag.ncorners, dvel);
|
||||
pos[0] = ag.pos[0] + dvel[0];
|
||||
pos[1] = ag.pos[1] + dvel[1];
|
||||
pos[2] = ag.pos[2] + dvel[2];
|
||||
pos.x = ag.pos.x + dvel.x;
|
||||
pos.y = ag.pos.y + dvel.y;
|
||||
pos.z = ag.pos.z + dvel.z;
|
||||
|
||||
float off = ag.radius+0.1f;
|
||||
float[] tgt = &ag.cornerVerts[0];
|
||||
float y = ag.pos[1]+off;
|
||||
float[] tgt = &ag.cornerVerts.x;
|
||||
float y = ag.pos.y+off;
|
||||
|
||||
dd.begin(DU_DRAW_LINES, 2.0f);
|
||||
|
||||
dd.vertex(ag.pos[0],y,ag.pos[2], duRGBA(255,0,0,192));
|
||||
dd.vertex(pos[0],y,pos[2], duRGBA(255,0,0,192));
|
||||
dd.vertex(ag.pos.x,y,ag.pos.z, duRGBA(255,0,0,192));
|
||||
dd.vertex(pos.x,y,pos.z, duRGBA(255,0,0,192));
|
||||
|
||||
dd.vertex(pos[0],y,pos[2], duRGBA(255,0,0,192));
|
||||
dd.vertex(tgt[0],y,tgt[2], duRGBA(255,0,0,192));
|
||||
dd.vertex(pos.x,y,pos.z, duRGBA(255,0,0,192));
|
||||
dd.vertex(tgt.x,y,tgt.z, duRGBA(255,0,0,192));
|
||||
|
||||
dd.end();*/
|
||||
}
|
||||
|
@ -511,8 +511,8 @@ public class CrowdTool : Tool
|
|||
if (toolParams.m_showCollisionSegments)
|
||||
{
|
||||
Vector3f center = ag.boundary.getCenter();
|
||||
dd.debugDrawCross(center[0], center[1] + radius, center[2], 0.2f, duRGBA(192, 0, 128, 255), 2.0f);
|
||||
dd.debugDrawCircle(center[0], center[1] + radius, center[2], ag.option.collisionQueryRange, duRGBA(192, 0, 128, 128), 2.0f);
|
||||
dd.debugDrawCross(center.x, center.y + radius, center.z, 0.2f, duRGBA(192, 0, 128, 255), 2.0f);
|
||||
dd.debugDrawCircle(center.x, center.y + radius, center.z, ag.option.collisionQueryRange, duRGBA(192, 0, 128, 128), 2.0f);
|
||||
|
||||
dd.begin(LINES, 3.0f);
|
||||
for (int j = 0; j < ag.boundary.getSegmentCount(); ++j)
|
||||
|
@ -524,7 +524,7 @@ public class CrowdTool : Tool
|
|||
if (triArea2D(pos, s0, s3) < 0.0f)
|
||||
col = duDarkenCol(col);
|
||||
|
||||
dd.appendArrow(s[0][0], s[0][1] + 0.2f, s[0][2], s[1][0], s[1][2] + 0.2f, s[1][2], 0.0f, 0.3f, col);
|
||||
dd.appendArrow(s[0].x, s[0].y + 0.2f, s[0].z, s[1].x, s[1].z + 0.2f, s[1].z, 0.0f, 0.3f, col);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -532,7 +532,7 @@ public class CrowdTool : Tool
|
|||
|
||||
if (toolParams.m_showNeis)
|
||||
{
|
||||
dd.debugDrawCircle(pos[0], pos[1] + radius, pos[2], ag.option.collisionQueryRange, duRGBA(0, 192, 128, 128),
|
||||
dd.debugDrawCircle(pos.x, pos.y + radius, pos.z, ag.option.collisionQueryRange, duRGBA(0, 192, 128, 128),
|
||||
2.0f);
|
||||
|
||||
dd.begin(LINES, 2.0f);
|
||||
|
@ -541,8 +541,8 @@ public class CrowdTool : Tool
|
|||
CrowdAgent nei = ag.neis[j].agent;
|
||||
if (nei != null)
|
||||
{
|
||||
dd.vertex(pos[0], pos[1] + radius, pos[2], duRGBA(0, 192, 128, 128));
|
||||
dd.vertex(nei.npos[0], nei.npos[1] + radius, nei.npos[2], duRGBA(0, 192, 128, 128));
|
||||
dd.vertex(pos.x, pos.y + radius, pos.z, duRGBA(0, 192, 128, 128));
|
||||
dd.vertex(nei.npos.x, nei.npos.y + radius, nei.npos.z, duRGBA(0, 192, 128, 128));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,9 +552,9 @@ public class CrowdTool : Tool
|
|||
if (toolParams.m_showOpt)
|
||||
{
|
||||
dd.begin(LINES, 2.0f);
|
||||
dd.vertex(m_agentDebug.optStart[0], m_agentDebug.optStart[1] + 0.3f, m_agentDebug.optStart[2],
|
||||
dd.vertex(m_agentDebug.optStart.x, m_agentDebug.optStart.y + 0.3f, m_agentDebug.optStart.z,
|
||||
duRGBA(0, 128, 0, 192));
|
||||
dd.vertex(m_agentDebug.optEnd[0], m_agentDebug.optEnd[1] + 0.3f, m_agentDebug.optEnd[2], duRGBA(0, 128, 0, 192));
|
||||
dd.vertex(m_agentDebug.optEnd.x, m_agentDebug.optEnd.y + 0.3f, m_agentDebug.optEnd.z, duRGBA(0, 128, 0, 192));
|
||||
dd.end();
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ public class CrowdTool : Tool
|
|||
if (m_agentDebug.agent == ag)
|
||||
col = duRGBA(255, 0, 0, 128);
|
||||
|
||||
dd.debugDrawCircle(pos[0], pos[1], pos[2], radius, col, 2.0f);
|
||||
dd.debugDrawCircle(pos.x, pos.y, pos.z, radius, col, 2.0f);
|
||||
}
|
||||
|
||||
foreach (CrowdAgent ag in crowd.getActiveAgents())
|
||||
|
@ -589,8 +589,8 @@ public class CrowdTool : Tool
|
|||
else if (ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
col = duLerpCol(col, duRGBA(64, 255, 0, 128), 128);
|
||||
|
||||
dd.debugDrawCylinder(pos[0] - radius, pos[1] + radius * 0.1f, pos[2] - radius, pos[0] + radius, pos[1] + height,
|
||||
pos[2] + radius, col);
|
||||
dd.debugDrawCylinder(pos.x - radius, pos.y + radius * 0.1f, pos.z - radius, pos.x + radius, pos.y + height,
|
||||
pos.z + radius, col);
|
||||
}
|
||||
|
||||
if (toolParams.m_showVO)
|
||||
|
@ -603,9 +603,9 @@ public class CrowdTool : Tool
|
|||
// Draw detail about agent sela
|
||||
ObstacleAvoidanceDebugData vod = m_agentDebug.vod;
|
||||
|
||||
float dx = ag.npos[0];
|
||||
float dy = ag.npos[1] + ag.option.height;
|
||||
float dz = ag.npos[2];
|
||||
float dx = ag.npos.x;
|
||||
float dy = ag.npos.y + ag.option.height;
|
||||
float dz = ag.npos.z;
|
||||
|
||||
dd.debugDrawCircle(dx, dy, dz, ag.option.maxSpeed, duRGBA(255, 255, 255, 64), 2.0f);
|
||||
|
||||
|
@ -618,10 +618,10 @@ public class CrowdTool : Tool
|
|||
float pen2 = vod.getSamplePreferredSidePenalty(j);
|
||||
int col = duLerpCol(duRGBA(255, 255, 255, 220), duRGBA(128, 96, 0, 220), (int)(pen * 255));
|
||||
col = duLerpCol(col, duRGBA(128, 0, 0, 220), (int)(pen2 * 128));
|
||||
dd.vertex(dx + p[0] - sr, dy, dz + p[2] - sr, col);
|
||||
dd.vertex(dx + p[0] - sr, dy, dz + p[2] + sr, col);
|
||||
dd.vertex(dx + p[0] + sr, dy, dz + p[2] + sr, col);
|
||||
dd.vertex(dx + p[0] + sr, dy, dz + p[2] - sr, col);
|
||||
dd.vertex(dx + p.x - sr, dy, dz + p.z - sr, col);
|
||||
dd.vertex(dx + p.x - sr, dy, dz + p.z + sr, col);
|
||||
dd.vertex(dx + p.x + sr, dy, dz + p.z + sr, col);
|
||||
dd.vertex(dx + p.x + sr, dy, dz + p.z - sr, col);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -648,12 +648,12 @@ public class CrowdTool : Tool
|
|||
else if (ag.targetState == MoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
col = duLerpCol(col, duRGBA(64, 255, 0, 192), 128);
|
||||
|
||||
dd.debugDrawCircle(pos[0], pos[1] + height, pos[2], radius, col, 2.0f);
|
||||
dd.debugDrawCircle(pos.x, pos.y + height, pos.z, radius, col, 2.0f);
|
||||
|
||||
dd.debugDrawArrow(pos[0], pos[1] + height, pos[2], pos[0] + dvel[0], pos[1] + height + dvel[1], pos[2] + dvel[2],
|
||||
dd.debugDrawArrow(pos.x, pos.y + height, pos.z, pos.x + dvel.x, pos.y + height + dvel.y, pos.z + dvel.z,
|
||||
0.0f, 0.4f, duRGBA(0, 192, 255, 192), m_agentDebug.agent == ag ? 2.0f : 1.0f);
|
||||
|
||||
dd.debugDrawArrow(pos[0], pos[1] + height, pos[2], pos[0] + vel[0], pos[1] + height + vel[1], pos[2] + vel[2], 0.0f,
|
||||
dd.debugDrawArrow(pos.x, pos.y + height, pos.z, pos.x + vel.x, pos.y + height + vel.y, pos.z + vel.z, 0.0f,
|
||||
0.4f, duRGBA(0, 0, 0, 160), 2.0f);
|
||||
}
|
||||
|
||||
|
@ -689,9 +689,9 @@ public class CrowdTool : Tool
|
|||
AgentTrail trail = m_trails[ag.idx];
|
||||
// Update agent movement trail.
|
||||
trail.htrail = (trail.htrail + 1) % AGENT_MAX_TRAIL;
|
||||
trail.trail[trail.htrail * 3] = ag.npos[0];
|
||||
trail.trail[trail.htrail * 3 + 1] = ag.npos[1];
|
||||
trail.trail[trail.htrail * 3 + 2] = ag.npos[2];
|
||||
trail.trail[trail.htrail * 3] = ag.npos.x;
|
||||
trail.trail[trail.htrail * 3 + 1] = ag.npos.y;
|
||||
trail.trail[trail.htrail * 3 + 2] = ag.npos.z;
|
||||
}
|
||||
|
||||
m_agentDebug.vod.normalizeSamples();
|
||||
|
|
|
@ -202,15 +202,15 @@ public class DynamicUpdateTool : Tool
|
|||
|
||||
if (sposSet && eposSet && dynaMesh != null)
|
||||
{
|
||||
Vector3f sp = Vector3f.Of(spos[0], spos[1] + 1.3f, spos[2]);
|
||||
Vector3f ep = Vector3f.Of(epos[0], epos[1] + 1.3f, epos[2]);
|
||||
Vector3f sp = Vector3f.Of(spos.x, spos.y + 1.3f, spos.z);
|
||||
Vector3f ep = Vector3f.Of(epos.x, epos.y + 1.3f, epos.z);
|
||||
long t1 = FrequencyWatch.Ticks;
|
||||
float? hitPos = dynaMesh.voxelQuery().raycast(sp, ep);
|
||||
long t2 = FrequencyWatch.Ticks;
|
||||
raycastTime = (t2 - t1) / TimeSpan.TicksPerMillisecond;
|
||||
raycastHit = hitPos.HasValue;
|
||||
raycastHitPos = hitPos.HasValue
|
||||
? Vector3f.Of(sp[0] + hitPos.Value * (ep[0] - sp[0]), sp[1] + hitPos.Value * (ep[1] - sp[1]), sp[2] + hitPos.Value * (ep[2] - sp[2]))
|
||||
? Vector3f.Of(sp.x + hitPos.Value * (ep.x - sp.x), sp.y + hitPos.Value * (ep.y - sp.y), sp.z + hitPos.Value * (ep.z - sp.z))
|
||||
: ep;
|
||||
}
|
||||
}
|
||||
|
@ -234,11 +234,11 @@ public class DynamicUpdateTool : Tool
|
|||
);
|
||||
vNormalize(ref a);
|
||||
float len = 1f + (float)random.NextDouble() * 20f;
|
||||
a[0] *= len;
|
||||
a[1] *= len;
|
||||
a[2] *= len;
|
||||
Vector3f start = Vector3f.Of(p[0], p[1], p[2]);
|
||||
Vector3f end = Vector3f.Of(p[0] + a[0], p[1] + a[1], p[2] + a[2]);
|
||||
a.x *= len;
|
||||
a.y *= len;
|
||||
a.z *= len;
|
||||
Vector3f start = Vector3f.Of(p.x, p.y, p.z);
|
||||
Vector3f end = Vector3f.Of(p.x + a.x, p.y + a.y, p.z + a.z);
|
||||
return Tuple.Create<Collider, ColliderGizmo>(new CapsuleCollider(
|
||||
start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, dynaMesh.config.walkableClimb), GizmoFactory.capsule(start, end, radius));
|
||||
}
|
||||
|
@ -266,8 +266,8 @@ public class DynamicUpdateTool : Tool
|
|||
a[0] *= len;
|
||||
a[1] *= len;
|
||||
a[2] *= len;
|
||||
Vector3f start = Vector3f.Of(p[0], p[1], p[2]);
|
||||
Vector3f end = Vector3f.Of(p[0] + a[0], p[1] + a[1], p[2] + a[2]);
|
||||
Vector3f start = Vector3f.Of(p.x, p.y, p.z);
|
||||
Vector3f end = Vector3f.Of(p.x + a[0], p.y + a[1], p.z + a[2]);
|
||||
return Tuple.Create<Collider, ColliderGizmo>(new CylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER,
|
||||
dynaMesh.config.walkableClimb), GizmoFactory.cylinder(start, end, radius));
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public class DynamicUpdateTool : Tool
|
|||
private Tuple<Collider, ColliderGizmo> compositeCollider(Vector3f p)
|
||||
{
|
||||
Vector3f baseExtent = Vector3f.Of(5, 3, 8);
|
||||
Vector3f baseCenter = Vector3f.Of(p[0], p[1] + 3, p[2]);
|
||||
Vector3f baseCenter = Vector3f.Of(p.x, p.y + 3, p.z);
|
||||
Vector3f baseUp = Vector3f.Of(0, 1, 0);
|
||||
Vector3f forward = Vector3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
vNormalize(ref forward);
|
||||
|
@ -284,22 +284,22 @@ public class DynamicUpdateTool : Tool
|
|||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, dynaMesh.config.walkableClimb);
|
||||
var roofUp = Vector3f.Zero;
|
||||
Vector3f roofExtent = Vector3f.Of(4.5f, 4.5f, 8f);
|
||||
float[] rx = GLU.build_4x4_rotation_matrix(45, forward[0], forward[1], forward[2]);
|
||||
float[] rx = GLU.build_4x4_rotation_matrix(45, forward.x, forward.y, forward.z);
|
||||
roofUp = mulMatrixVector(ref roofUp, rx, baseUp);
|
||||
Vector3f roofCenter = Vector3f.Of(p[0], p[1] + 6, p[2]);
|
||||
Vector3f roofCenter = Vector3f.Of(p.x, p.y + 6, p.z);
|
||||
BoxCollider roof = new BoxCollider(roofCenter, BoxCollider.getHalfEdges(roofUp, forward, roofExtent),
|
||||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, dynaMesh.config.walkableClimb);
|
||||
Vector3f trunkStart = Vector3f.Of(
|
||||
baseCenter[0] - forward[0] * 15 + side[0] * 6,
|
||||
p[1],
|
||||
baseCenter[2] - forward[2] * 15 + side[2] * 6
|
||||
baseCenter.x - forward.x * 15 + side.x * 6,
|
||||
p.y,
|
||||
baseCenter.z - forward.z * 15 + side.z * 6
|
||||
);
|
||||
Vector3f trunkEnd = Vector3f.Of(trunkStart[0], trunkStart[1] + 10, trunkStart[2]);
|
||||
Vector3f trunkEnd = Vector3f.Of(trunkStart.x, trunkStart.y + 10, trunkStart.z);
|
||||
CapsuleCollider trunk = new CapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD,
|
||||
dynaMesh.config.walkableClimb);
|
||||
Vector3f crownCenter = Vector3f.Of(
|
||||
baseCenter[0] - forward[0] * 15 + side[0] * 6, p[1] + 10,
|
||||
baseCenter[2] - forward[2] * 15 + side[2] * 6
|
||||
baseCenter.x - forward.x * 15 + side.x * 6, p.y + 10,
|
||||
baseCenter.z - forward.z * 15 + side.z * 6
|
||||
);
|
||||
SphereCollider crown = new SphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS,
|
||||
dynaMesh.config.walkableClimb);
|
||||
|
@ -348,16 +348,16 @@ public class DynamicUpdateTool : Tool
|
|||
Vector3f vr = new Vector3f();
|
||||
for (int i = 0; i < geom.vertices.Length; i += 3)
|
||||
{
|
||||
v[0] = geom.vertices[i];
|
||||
v[1] = geom.vertices[i + 1];
|
||||
v[2] = geom.vertices[i + 2];
|
||||
v.x = geom.vertices[i];
|
||||
v.y = geom.vertices[i + 1];
|
||||
v.z = geom.vertices[i + 2];
|
||||
mulMatrixVector(ref vr, m, v);
|
||||
vr[0] += p[0];
|
||||
vr[1] += p[1] - 0.1f;
|
||||
vr[2] += p[2];
|
||||
verts[i] = vr[0];
|
||||
verts[i + 1] = vr[1];
|
||||
verts[i + 2] = vr[2];
|
||||
vr.x += p.x;
|
||||
vr.y += p.y - 0.1f;
|
||||
vr.z += p.z;
|
||||
verts[i] = vr.x;
|
||||
verts[i + 1] = vr.y;
|
||||
verts[i + 2] = vr.z;
|
||||
}
|
||||
|
||||
return verts;
|
||||
|
@ -373,9 +373,9 @@ public class DynamicUpdateTool : Tool
|
|||
|
||||
private Vector3f mulMatrixVector(ref Vector3f resultvector, float[] matrix, Vector3f pvector)
|
||||
{
|
||||
resultvector[0] = matrix[0] * pvector[0] + matrix[4] * pvector[1] + matrix[8] * pvector[2];
|
||||
resultvector[1] = matrix[1] * pvector[0] + matrix[5] * pvector[1] + matrix[9] * pvector[2];
|
||||
resultvector[2] = matrix[2] * pvector[0] + matrix[6] * pvector[1] + matrix[10] * pvector[2];
|
||||
resultvector.x = matrix[0] * pvector.x + matrix[4] * pvector.y + matrix[8] * pvector.z;
|
||||
resultvector.y = matrix[1] * pvector.x + matrix[5] * pvector.y + matrix[9] * pvector.z;
|
||||
resultvector.z = matrix[2] * pvector.x + matrix[6] * pvector.y + matrix[10] * pvector.z;
|
||||
return resultvector;
|
||||
}
|
||||
|
||||
|
@ -409,9 +409,9 @@ public class DynamicUpdateTool : Tool
|
|||
float dy = 0.5f * (bounds[4] - bounds[1]);
|
||||
float dz = 0.5f * (bounds[5] - bounds[2]);
|
||||
float rSqr = dx * dx + dy * dy + dz * dz;
|
||||
float mx = point[0] - cx;
|
||||
float my = point[1] - cy;
|
||||
float mz = point[2] - cz;
|
||||
float mx = point.x - cx;
|
||||
float my = point.y - cy;
|
||||
float mz = point.z - cz;
|
||||
float c = mx * mx + my * my + mz * mz - rSqr;
|
||||
if (c <= 0.0f)
|
||||
{
|
||||
|
@ -458,8 +458,8 @@ public class DynamicUpdateTool : Tool
|
|||
{
|
||||
int spathCol = raycastHit ? duRGBA(128, 32, 16, 220) : duRGBA(64, 128, 240, 220);
|
||||
dd.begin(LINES, 2.0f);
|
||||
dd.vertex(spos[0], spos[1] + 1.3f, spos[2], spathCol);
|
||||
dd.vertex(raycastHitPos[0], raycastHitPos[1], raycastHitPos[2], spathCol);
|
||||
dd.vertex(spos.x, spos.y + 1.3f, spos.z, spathCol);
|
||||
dd.vertex(raycastHitPos.x, raycastHitPos.y, raycastHitPos.z, spathCol);
|
||||
dd.end();
|
||||
}
|
||||
|
||||
|
@ -474,16 +474,16 @@ public class DynamicUpdateTool : Tool
|
|||
float c = sample.getSettingsUI().getAgentMaxClimb();
|
||||
dd.depthMask(false);
|
||||
// Agent dimensions.
|
||||
dd.debugDrawCylinderWire(pos[0] - r, pos[1] + 0.02f, pos[2] - r, pos[0] + r, pos[1] + h, pos[2] + r, col, 2.0f);
|
||||
dd.debugDrawCircle(pos[0], pos[1] + c, pos[2], r, duRGBA(0, 0, 0, 64), 1.0f);
|
||||
dd.debugDrawCylinderWire(pos.x - r, pos.y + 0.02f, pos.z - r, pos.x + r, pos.y + h, pos.z + r, col, 2.0f);
|
||||
dd.debugDrawCircle(pos.x, pos.y + c, pos.z, r, duRGBA(0, 0, 0, 64), 1.0f);
|
||||
int colb = duRGBA(0, 0, 0, 196);
|
||||
dd.begin(LINES);
|
||||
dd.vertex(pos[0], pos[1] - c, pos[2], colb);
|
||||
dd.vertex(pos[0], pos[1] + c, pos[2], colb);
|
||||
dd.vertex(pos[0] - r / 2, pos[1] + 0.02f, pos[2], colb);
|
||||
dd.vertex(pos[0] + r / 2, pos[1] + 0.02f, pos[2], colb);
|
||||
dd.vertex(pos[0], pos[1] + 0.02f, pos[2] - r / 2, colb);
|
||||
dd.vertex(pos[0], pos[1] + 0.02f, pos[2] + r / 2, colb);
|
||||
dd.vertex(pos.x, pos.y - c, pos.z, colb);
|
||||
dd.vertex(pos.x, pos.y + c, pos.z, colb);
|
||||
dd.vertex(pos.x - r / 2, pos.y + 0.02f, pos.z, colb);
|
||||
dd.vertex(pos.x + r / 2, pos.y + 0.02f, pos.z, colb);
|
||||
dd.vertex(pos.x, pos.y + 0.02f, pos.z - r / 2, colb);
|
||||
dd.vertex(pos.x, pos.y + 0.02f, pos.z + r / 2, colb);
|
||||
dd.end();
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -670,17 +670,17 @@ public class DynamicUpdateTool : Tool
|
|||
ImGui.Separator();
|
||||
if (sposSet)
|
||||
{
|
||||
ImGui.Text($"Start: {spos[0]}, {spos[1] + 1.3f}, {spos[2]}");
|
||||
ImGui.Text($"Start: {spos.x}, {spos.y + 1.3f}, {spos.z}");
|
||||
}
|
||||
|
||||
if (eposSet)
|
||||
{
|
||||
ImGui.Text($"End: {epos[0]}, {epos[1] + 1.3f}, {epos[2]}");
|
||||
ImGui.Text($"End: {epos.x}, {epos.y + 1.3f}, {epos.z}");
|
||||
}
|
||||
|
||||
if (raycastHit)
|
||||
{
|
||||
ImGui.Text($"Hit: {raycastHitPos[0]}, {raycastHitPos[1]}, {raycastHitPos[2]}");
|
||||
ImGui.Text($"Hit: {raycastHitPos.x}, {raycastHitPos.y}, {raycastHitPos.z}");
|
||||
}
|
||||
|
||||
ImGui.NewLine();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Core;
|
||||
using DotRecast.Detour.Dynamic.Colliders;
|
||||
using DotRecast.Recast.Demo.Draw;
|
||||
|
||||
|
@ -42,23 +42,23 @@ public class BoxGizmo : ColliderGizmo
|
|||
float s0 = (i & 1) != 0 ? 1f : -1f;
|
||||
float s1 = (i & 2) != 0 ? 1f : -1f;
|
||||
float s2 = (i & 4) != 0 ? 1f : -1f;
|
||||
vertices[i * 3 + 0] = center[0] + s0 * halfEdges[0][0] + s1 * halfEdges[1][0] + s2 * halfEdges[2][0];
|
||||
vertices[i * 3 + 1] = center[1] + s0 * halfEdges[0][1] + s1 * halfEdges[1][1] + s2 * halfEdges[2][1];
|
||||
vertices[i * 3 + 2] = center[2] + s0 * halfEdges[0][2] + s1 * halfEdges[1][2] + s2 * halfEdges[2][2];
|
||||
vertices[i * 3 + 0] = center.x + s0 * halfEdges[0].x + s1 * halfEdges[1].x + s2 * halfEdges[2].x;
|
||||
vertices[i * 3 + 1] = center.y + s0 * halfEdges[0].y + s1 * halfEdges[1].y + s2 * halfEdges[2].y;
|
||||
vertices[i * 3 + 2] = center.z + s0 * halfEdges[0].z + s1 * halfEdges[1].z + s2 * halfEdges[2].z;
|
||||
}
|
||||
}
|
||||
|
||||
public void render(RecastDebugDraw debugDraw)
|
||||
{
|
||||
var trX = Vector3f.Of(halfEdges[0][0], halfEdges[1][0], halfEdges[2][0]);
|
||||
var trY = Vector3f.Of(halfEdges[0][1], halfEdges[1][1], halfEdges[2][1]);
|
||||
var trZ = Vector3f.Of(halfEdges[0][2], halfEdges[1][2], halfEdges[2][2]);
|
||||
var trX = Vector3f.Of(halfEdges[0].x, halfEdges[1].x, halfEdges[2].x);
|
||||
var trY = Vector3f.Of(halfEdges[0].y, halfEdges[1].y, halfEdges[2].y);
|
||||
var trZ = Vector3f.Of(halfEdges[0].z, halfEdges[1].z, halfEdges[2].z);
|
||||
float[] vertices = new float[8 * 3];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vertices[i * 3 + 0] = RecastVectors.dot(VERTS[i], trX) + center[0];
|
||||
vertices[i * 3 + 1] = RecastVectors.dot(VERTS[i], trY) + center[1];
|
||||
vertices[i * 3 + 2] = RecastVectors.dot(VERTS[i], trZ) + center[2];
|
||||
vertices[i * 3 + 0] = RecastVectors.dot(VERTS[i], trX) + center.x;
|
||||
vertices[i * 3 + 1] = RecastVectors.dot(VERTS[i], trY) + center.y;
|
||||
vertices[i * 3 + 2] = RecastVectors.dot(VERTS[i], trZ) + center.z;
|
||||
}
|
||||
|
||||
debugDraw.begin(DebugDrawPrimitives.TRIS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Core;
|
||||
using DotRecast.Recast.Demo.Draw;
|
||||
using static DotRecast.Recast.RecastVectors;
|
||||
using static DotRecast.Core.RecastMath;
|
||||
|
@ -17,21 +17,21 @@ public class CapsuleGizmo : ColliderGizmo
|
|||
{
|
||||
center = new float[]
|
||||
{
|
||||
0.5f * (start[0] + end[0]), 0.5f * (start[1] + end[1]),
|
||||
0.5f * (start[2] + end[2])
|
||||
0.5f * (start.x + end.x), 0.5f * (start.y + end.y),
|
||||
0.5f * (start.z + end.z)
|
||||
};
|
||||
Vector3f axis = Vector3f.Of(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
|
||||
Vector3f axis = Vector3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
Vector3f[] normals = new Vector3f[3];
|
||||
normals[1] = Vector3f.Of(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
|
||||
normals[1] = Vector3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
normalize(ref normals[1]);
|
||||
normals[0] = getSideVector(axis);
|
||||
normals[2] = Vector3f.Zero;
|
||||
cross(ref normals[2], normals[0], normals[1]);
|
||||
normalize(ref normals[2]);
|
||||
triangles = generateSphericalTriangles();
|
||||
var trX = Vector3f.Of(normals[0][0], normals[1][0], normals[2][0]);
|
||||
var trY = Vector3f.Of(normals[0][1], normals[1][1], normals[2][1]);
|
||||
var trZ = Vector3f.Of(normals[0][2], normals[1][2], normals[2][2]);
|
||||
var trX = Vector3f.Of(normals[0].x, normals[1].x, normals[2].x);
|
||||
var trY = Vector3f.Of(normals[0].y, normals[1].y, normals[2].y);
|
||||
var trZ = Vector3f.Of(normals[0].z, normals[1].z, normals[2].z);
|
||||
float[] spVertices = generateSphericalVertices();
|
||||
float halfLength = 0.5f * vLen(axis);
|
||||
vertices = new float[spVertices.Length];
|
||||
|
@ -43,21 +43,21 @@ public class CapsuleGizmo : ColliderGizmo
|
|||
float x = radius * spVertices[i];
|
||||
float y = radius * spVertices[i + 1] + offset;
|
||||
float z = radius * spVertices[i + 2];
|
||||
vertices[i] = x * trX[0] + y * trX[1] + z * trX[2] + center[0];
|
||||
vertices[i + 1] = x * trY[0] + y * trY[1] + z * trY[2] + center[1];
|
||||
vertices[i + 2] = x * trZ[0] + y * trZ[1] + z * trZ[2] + center[2];
|
||||
v[0] = vertices[i] - center[0];
|
||||
v[1] = vertices[i + 1] - center[1];
|
||||
v[2] = vertices[i + 2] - center[2];
|
||||
vertices[i] = x * trX.x + y * trX.y + z * trX.z + center[0];
|
||||
vertices[i + 1] = x * trY.x + y * trY.y + z * trY.z + center[1];
|
||||
vertices[i + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center[2];
|
||||
v.x = vertices[i] - center[0];
|
||||
v.y = vertices[i + 1] - center[1];
|
||||
v.z = vertices[i + 2] - center[2];
|
||||
normalize(ref v);
|
||||
gradient[i / 3] = clamp(0.57735026f * (v[0] + v[1] + v[2]), -1, 1);
|
||||
gradient[i / 3] = clamp(0.57735026f * (v.x + v.y + v.z), -1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3f getSideVector(Vector3f axis)
|
||||
{
|
||||
Vector3f side = Vector3f.Of(1, 0, 0);
|
||||
if (axis[0] > 0.8)
|
||||
if (axis.x > 0.8)
|
||||
{
|
||||
side = Vector3f.Of(0, 0, 1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using DotRecast.Core;
|
||||
using DotRecast.Core;
|
||||
using DotRecast.Recast.Demo.Draw;
|
||||
using static DotRecast.Recast.RecastVectors;
|
||||
using static DotRecast.Core.RecastMath;
|
||||
|
@ -17,21 +17,21 @@ public class CylinderGizmo : ColliderGizmo
|
|||
public CylinderGizmo(Vector3f start, Vector3f end, float radius)
|
||||
{
|
||||
center = Vector3f.Of(
|
||||
0.5f * (start[0] + end[0]), 0.5f * (start[1] + end[1]),
|
||||
0.5f * (start[2] + end[2])
|
||||
0.5f * (start.x + end.x), 0.5f * (start.y + end.y),
|
||||
0.5f * (start.z + end.z)
|
||||
);
|
||||
Vector3f axis = Vector3f.Of(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
|
||||
Vector3f axis = Vector3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
Vector3f[] normals = new Vector3f[3];
|
||||
normals[1] = Vector3f.Of(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
|
||||
normals[1] = Vector3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
normalize(ref normals[1]);
|
||||
normals[0] = getSideVector(axis);
|
||||
normals[2] = Vector3f.Zero;
|
||||
cross(ref normals[2], normals[0], normals[1]);
|
||||
normalize(ref normals[2]);
|
||||
triangles = generateCylindricalTriangles();
|
||||
Vector3f trX = Vector3f.Of(normals[0][0], normals[1][0], normals[2][0]);
|
||||
Vector3f trY = Vector3f.Of(normals[0][1], normals[1][1], normals[2][1]);
|
||||
Vector3f trZ = Vector3f.Of(normals[0][2], normals[1][2], normals[2][2]);
|
||||
Vector3f trX = Vector3f.Of(normals[0].x, normals[1].x, normals[2].x);
|
||||
Vector3f trY = Vector3f.Of(normals[0].y, normals[1].y, normals[2].y);
|
||||
Vector3f trZ = Vector3f.Of(normals[0].z, normals[1].z, normals[2].z);
|
||||
vertices = generateCylindricalVertices();
|
||||
float halfLength = 0.5f * vLen(axis);
|
||||
gradient = new float[vertices.Length / 3];
|
||||
|
@ -42,20 +42,20 @@ public class CylinderGizmo : ColliderGizmo
|
|||
float x = radius * vertices[i];
|
||||
float y = vertices[i + 1] + offset;
|
||||
float z = radius * vertices[i + 2];
|
||||
vertices[i] = x * trX[0] + y * trX[1] + z * trX[2] + center[0];
|
||||
vertices[i + 1] = x * trY[0] + y * trY[1] + z * trY[2] + center[1];
|
||||
vertices[i + 2] = x * trZ[0] + y * trZ[1] + z * trZ[2] + center[2];
|
||||
vertices[i] = x * trX.x + y * trX.y + z * trX.z + center.x;
|
||||
vertices[i + 1] = x * trY.x + y * trY.y + z * trY.z + center.y;
|
||||
vertices[i + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center.z;
|
||||
if (i < vertices.Length / 4 || i >= 3 * vertices.Length / 4)
|
||||
{
|
||||
gradient[i / 3] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
v[0] = vertices[i] - center[0];
|
||||
v[1] = vertices[i + 1] - center[1];
|
||||
v[2] = vertices[i + 2] - center[2];
|
||||
v.x = vertices[i] - center.x;
|
||||
v.y = vertices[i + 1] - center.y;
|
||||
v.z = vertices[i + 2] - center.z;
|
||||
normalize(ref v);
|
||||
gradient[i / 3] = clamp(0.57735026f * (v[0] + v[1] + v[2]), -1, 1);
|
||||
gradient[i / 3] = clamp(0.57735026f * (v.x + v.y + v.z), -1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CylinderGizmo : ColliderGizmo
|
|||
private Vector3f getSideVector(Vector3f axis)
|
||||
{
|
||||
Vector3f side = Vector3f.Of(1, 0, 0);
|
||||
if (axis[0] > 0.8)
|
||||
if (axis.x > 0.8)
|
||||
{
|
||||
side = Vector3f.Of(0, 0, 1);
|
||||
}
|
||||
|
|
|
@ -185,11 +185,11 @@ public class GizmoHelper
|
|||
e1[j] = vertices[v2 + j] - vertices[v0 + j];
|
||||
}
|
||||
|
||||
normal[0] = e0[1] * e1[2] - e0[2] * e1[1];
|
||||
normal[1] = e0[2] * e1[0] - e0[0] * e1[2];
|
||||
normal[2] = e0[0] * e1[1] - e0[1] * e1[0];
|
||||
normal.x = e0.y * e1.z - e0.z * e1.y;
|
||||
normal.y = e0.z * e1.x - e0.x * e1.z;
|
||||
normal.z = e0.x * e1.y - e0.y * e1.x;
|
||||
RecastVectors.normalize(ref normal);
|
||||
float c = clamp(0.57735026f * (normal[0] + normal[1] + normal[2]), -1, 1);
|
||||
float c = clamp(0.57735026f * (normal.x + normal.y + normal.z), -1, 1);
|
||||
int col = DebugDraw.duLerpCol(DebugDraw.duRGBA(32, 32, 0, 160), DebugDraw.duRGBA(220, 220, 0, 160),
|
||||
(int)(127 * (1 + c)));
|
||||
return col;
|
||||
|
|
|
@ -32,8 +32,8 @@ public class SphereGizmo : ColliderGizmo
|
|||
float c = clamp(0.57735026f * (vertices[v] + vertices[v + 1] + vertices[v + 2]), -1, 1);
|
||||
int col = DebugDraw.duLerpCol(DebugDraw.duRGBA(32, 32, 0, 160), DebugDraw.duRGBA(220, 220, 0, 160),
|
||||
(int)(127 * (1 + c)));
|
||||
debugDraw.vertex(radius * vertices[v] + center[0], radius * vertices[v + 1] + center[1],
|
||||
radius * vertices[v + 2] + center[2], col);
|
||||
debugDraw.vertex(radius * vertices[v] + center.x, radius * vertices[v + 1] + center.y,
|
||||
radius * vertices[v + 2] + center.z, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,14 +179,14 @@ public class JumpLinkBuilderTool : Tool
|
|||
dd.end();
|
||||
|
||||
dd.begin(LINES, 1.0f);
|
||||
dd.vertex(link.start.p[0], link.start.p[1], link.start.p[2], colb);
|
||||
dd.vertex(link.start.p[0], link.start.p[1] + r, link.start.p[2], colb);
|
||||
dd.vertex(link.start.p[0], link.start.p[1] + r, link.start.p[2], colb);
|
||||
dd.vertex(link.start.q[0], link.start.q[1] + r, link.start.q[2], colb);
|
||||
dd.vertex(link.start.q[0], link.start.q[1] + r, link.start.q[2], colb);
|
||||
dd.vertex(link.start.q[0], link.start.q[1], link.start.q[2], colb);
|
||||
dd.vertex(link.start.q[0], link.start.q[1], link.start.q[2], colb);
|
||||
dd.vertex(link.start.p[0], link.start.p[1], link.start.p[2], colb);
|
||||
dd.vertex(link.start.p.x, link.start.p.y, link.start.p.z, colb);
|
||||
dd.vertex(link.start.p.x, link.start.p.y + r, link.start.p.z, colb);
|
||||
dd.vertex(link.start.p.x, link.start.p.y + r, link.start.p.z, colb);
|
||||
dd.vertex(link.start.q.x, link.start.q.y + r, link.start.q.z, colb);
|
||||
dd.vertex(link.start.q.x, link.start.q.y + r, link.start.q.z, colb);
|
||||
dd.vertex(link.start.q.x, link.start.q.y, link.start.q.z, colb);
|
||||
dd.vertex(link.start.q.x, link.start.q.y, link.start.q.z, colb);
|
||||
dd.vertex(link.start.p.x, link.start.p.y, link.start.p.z, colb);
|
||||
dd.end();
|
||||
|
||||
GroundSegment end = link.end;
|
||||
|
@ -198,14 +198,14 @@ public class JumpLinkBuilderTool : Tool
|
|||
dd.end();
|
||||
|
||||
dd.begin(LINES, 1.0f);
|
||||
dd.vertex(end.p[0], end.p[1], end.p[2], colb);
|
||||
dd.vertex(end.p[0], end.p[1] + r, end.p[2], colb);
|
||||
dd.vertex(end.p[0], end.p[1] + r, end.p[2], colb);
|
||||
dd.vertex(end.q[0], end.q[1] + r, end.q[2], colb);
|
||||
dd.vertex(end.q[0], end.q[1] + r, end.q[2], colb);
|
||||
dd.vertex(end.q[0], end.q[1], end.q[2], colb);
|
||||
dd.vertex(end.q[0], end.q[1], end.q[2], colb);
|
||||
dd.vertex(end.p[0], end.p[1], end.p[2], colb);
|
||||
dd.vertex(end.p.x, end.p.y, end.p.z, colb);
|
||||
dd.vertex(end.p.x, end.p.y + r, end.p.z, colb);
|
||||
dd.vertex(end.p.x, end.p.y + r, end.p.z, colb);
|
||||
dd.vertex(end.q.x, end.q.y + r, end.q.z, colb);
|
||||
dd.vertex(end.q.x, end.q.y + r, end.q.z, colb);
|
||||
dd.vertex(end.q.x, end.q.y, end.q.z, colb);
|
||||
dd.vertex(end.q.x, end.q.y, end.q.z, colb);
|
||||
dd.vertex(end.p.x, end.p.y, end.p.z, colb);
|
||||
dd.end();
|
||||
|
||||
dd.begin(LINES, 4.0f);
|
||||
|
@ -245,7 +245,7 @@ public class JumpLinkBuilderTool : Tool
|
|||
col = duRGBA(220, 32, 32, 255);
|
||||
}
|
||||
|
||||
spt[1] = s.p[1] + off;
|
||||
spt.y = s.p.y + off;
|
||||
dd.vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ public class JumpLinkBuilderTool : Tool
|
|||
off = 0.1f;
|
||||
}
|
||||
|
||||
spt[1] = s.p[1] + off;
|
||||
spt.y = s.p.y + off;
|
||||
dd.vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class JumpLinkBuilderTool : Tool
|
|||
col = duRGBA(220, 32, 32, 255);
|
||||
}
|
||||
|
||||
spt[1] = s.p[1] + off;
|
||||
spt.y = s.p.y + off;
|
||||
dd.vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ public class JumpLinkBuilderTool : Tool
|
|||
off = 0.1f;
|
||||
}
|
||||
|
||||
spt[1] = s.p[1] + off;
|
||||
spt.y = s.p.y + off;
|
||||
dd.vertex(spt, col);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class OffMeshConnectionTool : Tool
|
|||
|
||||
if (hitPosSet)
|
||||
{
|
||||
dd.debugDrawCross(hitPos[0], hitPos[1] + 0.1f, hitPos[2], s, duRGBA(0, 0, 0, 128), 2.0f);
|
||||
dd.debugDrawCross(hitPos.x, hitPos.y + 0.1f, hitPos.z, s, duRGBA(0, 0, 0, 128), 2.0f);
|
||||
}
|
||||
|
||||
DemoInputGeomProvider geom = sample.getInputGeom();
|
||||
|
|
|
@ -243,9 +243,9 @@ public class TestNavmeshTool : Tool
|
|||
moveTgt, m_filter);
|
||||
MoveAlongSurfaceResult moveAlongSurface = result.result;
|
||||
|
||||
iterPos[0] = moveAlongSurface.getResultPos()[0];
|
||||
iterPos[1] = moveAlongSurface.getResultPos()[1];
|
||||
iterPos[2] = moveAlongSurface.getResultPos()[2];
|
||||
iterPos.x = moveAlongSurface.getResultPos().x;
|
||||
iterPos.y = moveAlongSurface.getResultPos().y;
|
||||
iterPos.z = moveAlongSurface.getResultPos().z;
|
||||
|
||||
List<long> visited = result.result.getVisited();
|
||||
polys = PathUtils.fixupCorridor(polys, visited);
|
||||
|
@ -254,7 +254,7 @@ public class TestNavmeshTool : Tool
|
|||
Result<float> polyHeight = m_navQuery.getPolyHeight(polys[0], moveAlongSurface.getResultPos());
|
||||
if (polyHeight.Succeeded())
|
||||
{
|
||||
iterPos[1] = polyHeight.result;
|
||||
iterPos.y = polyHeight.result;
|
||||
}
|
||||
|
||||
// Handle end of path and off-mesh links when close enough.
|
||||
|
@ -304,7 +304,7 @@ public class TestNavmeshTool : Tool
|
|||
|
||||
// Move position at the other side of the off-mesh link.
|
||||
iterPos = endPos;
|
||||
iterPos[1] = m_navQuery.getPolyHeight(polys[0], iterPos).result;
|
||||
iterPos.y = m_navQuery.getPolyHeight(polys[0], iterPos).result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class TestNavmeshTool : Tool
|
|||
if (0 < m_polys.Count)
|
||||
{
|
||||
// In case of partial path, make sure the end point is clamped to the last polygon.
|
||||
var epos = Vector3f.Of(m_epos[0], m_epos[1], m_epos[2]);
|
||||
var epos = Vector3f.Of(m_epos.x, m_epos.y, m_epos.z);
|
||||
if (m_polys[m_polys.Count - 1] != m_endRef)
|
||||
{
|
||||
Result<ClosestPointOnPolyResult> result = m_navQuery
|
||||
|
@ -392,7 +392,7 @@ public class TestNavmeshTool : Tool
|
|||
.getPolyHeight(hit.result.path[hit.result.path.Count - 1], m_hitPos);
|
||||
if (result.Succeeded())
|
||||
{
|
||||
m_hitPos[1] = result.result;
|
||||
m_hitPos.y = result.result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +423,8 @@ public class TestNavmeshTool : Tool
|
|||
{
|
||||
if (m_sposSet && m_startRef != 0 && m_eposSet)
|
||||
{
|
||||
float dx = m_epos[0] - m_spos[0];
|
||||
float dz = m_epos[2] - m_spos[2];
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
Result<FindPolysAroundResult> result = m_navQuery.findPolysAroundCircle(m_startRef, m_spos, dist,
|
||||
m_filter);
|
||||
|
@ -439,25 +439,25 @@ public class TestNavmeshTool : Tool
|
|||
{
|
||||
if (m_sposSet && m_startRef != 0 && m_eposSet)
|
||||
{
|
||||
float nx = (m_epos[2] - m_spos[2]) * 0.25f;
|
||||
float nz = -(m_epos[0] - m_spos[0]) * 0.25f;
|
||||
float nx = (m_epos.z - m_spos.z) * 0.25f;
|
||||
float nz = -(m_epos.x - m_spos.x) * 0.25f;
|
||||
float agentHeight = m_sample != null ? m_sample.getSettingsUI().getAgentHeight() : 0;
|
||||
|
||||
m_queryPoly[0] = m_spos[0] + nx * 1.2f;
|
||||
m_queryPoly[1] = m_spos[1] + agentHeight / 2;
|
||||
m_queryPoly[2] = m_spos[2] + nz * 1.2f;
|
||||
m_queryPoly[0] = m_spos.x + nx * 1.2f;
|
||||
m_queryPoly[1] = m_spos.y + agentHeight / 2;
|
||||
m_queryPoly[2] = m_spos.z + nz * 1.2f;
|
||||
|
||||
m_queryPoly[3] = m_spos[0] - nx * 1.3f;
|
||||
m_queryPoly[4] = m_spos[1] + agentHeight / 2;
|
||||
m_queryPoly[5] = m_spos[2] - nz * 1.3f;
|
||||
m_queryPoly[3] = m_spos.x - nx * 1.3f;
|
||||
m_queryPoly[4] = m_spos.y + agentHeight / 2;
|
||||
m_queryPoly[5] = m_spos.z - nz * 1.3f;
|
||||
|
||||
m_queryPoly[6] = m_epos[0] - nx * 0.8f;
|
||||
m_queryPoly[7] = m_epos[1] + agentHeight / 2;
|
||||
m_queryPoly[8] = m_epos[2] - nz * 0.8f;
|
||||
m_queryPoly[6] = m_epos.x - nx * 0.8f;
|
||||
m_queryPoly[7] = m_epos.y + agentHeight / 2;
|
||||
m_queryPoly[8] = m_epos.z - nz * 0.8f;
|
||||
|
||||
m_queryPoly[9] = m_epos[0] + nx;
|
||||
m_queryPoly[10] = m_epos[1] + agentHeight / 2;
|
||||
m_queryPoly[11] = m_epos[2] + nz;
|
||||
m_queryPoly[9] = m_epos.x + nx;
|
||||
m_queryPoly[10] = m_epos.y + agentHeight / 2;
|
||||
m_queryPoly[11] = m_epos.z + nz;
|
||||
|
||||
Result<FindPolysAroundResult> result = m_navQuery.findPolysAroundShape(m_startRef, m_queryPoly, m_filter);
|
||||
if (result.Succeeded())
|
||||
|
@ -486,8 +486,8 @@ public class TestNavmeshTool : Tool
|
|||
randomPoints.Clear();
|
||||
if (m_sposSet && m_startRef != 0 && m_eposSet)
|
||||
{
|
||||
float dx = m_epos[0] - m_spos[0];
|
||||
float dz = m_epos[2] - m_spos[2];
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
PolygonByCircleConstraint constraint = constrainByCircle
|
||||
? PolygonByCircleConstraint.strict()
|
||||
|
@ -564,7 +564,7 @@ public class TestNavmeshTool : Tool
|
|||
dd.begin(LINES, 3.0f);
|
||||
for (int i = 0; i < m_smoothPath.Count; ++i)
|
||||
{
|
||||
dd.vertex(m_smoothPath[i][0], m_smoothPath[i][1] + 0.1f, m_smoothPath[i][2], spathCol);
|
||||
dd.vertex(m_smoothPath[i].x, m_smoothPath[i].y + 0.1f, m_smoothPath[i].z, spathCol);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -573,7 +573,7 @@ public class TestNavmeshTool : Tool
|
|||
/*
|
||||
if (m_pathIterNum)
|
||||
{
|
||||
duDebugDrawNavMeshPoly(&dd, *m_navMesh, m_pathIterPolys[0], DebugDraw.duRGBA(255,255,255,128));
|
||||
duDebugDrawNavMeshPoly(&dd, *m_navMesh, m_pathIterPolys.x, DebugDraw.duRGBA(255,255,255,128));
|
||||
|
||||
dd.depthMask(false);
|
||||
dd.begin(DebugDrawPrimitives.LINES, 1.0f);
|
||||
|
@ -582,17 +582,17 @@ public class TestNavmeshTool : Tool
|
|||
int curCol = DebugDraw.duRGBA(255,255,255,220);
|
||||
int steerCol = DebugDraw.duRGBA(0,192,255,220);
|
||||
|
||||
dd.vertex(m_prevIterPos[0],m_prevIterPos[1]-0.3f,m_prevIterPos[2], prevCol);
|
||||
dd.vertex(m_prevIterPos[0],m_prevIterPos[1]+0.3f,m_prevIterPos[2], prevCol);
|
||||
dd.vertex(m_prevIterPos.x,m_prevIterPos.y-0.3f,m_prevIterPos.z, prevCol);
|
||||
dd.vertex(m_prevIterPos.x,m_prevIterPos.y+0.3f,m_prevIterPos.z, prevCol);
|
||||
|
||||
dd.vertex(m_iterPos[0],m_iterPos[1]-0.3f,m_iterPos[2], curCol);
|
||||
dd.vertex(m_iterPos[0],m_iterPos[1]+0.3f,m_iterPos[2], curCol);
|
||||
dd.vertex(m_iterPos.x,m_iterPos.y-0.3f,m_iterPos.z, curCol);
|
||||
dd.vertex(m_iterPos.x,m_iterPos.y+0.3f,m_iterPos.z, curCol);
|
||||
|
||||
dd.vertex(m_prevIterPos[0],m_prevIterPos[1]+0.3f,m_prevIterPos[2], prevCol);
|
||||
dd.vertex(m_iterPos[0],m_iterPos[1]+0.3f,m_iterPos[2], prevCol);
|
||||
dd.vertex(m_prevIterPos.x,m_prevIterPos.y+0.3f,m_prevIterPos.z, prevCol);
|
||||
dd.vertex(m_iterPos.x,m_iterPos.y+0.3f,m_iterPos.z, prevCol);
|
||||
|
||||
dd.vertex(m_prevIterPos[0],m_prevIterPos[1]+0.3f,m_prevIterPos[2], steerCol);
|
||||
dd.vertex(m_steerPos[0],m_steerPos[1]+0.3f,m_steerPos[2], steerCol);
|
||||
dd.vertex(m_prevIterPos.x,m_prevIterPos.y+0.3f,m_prevIterPos.z, steerCol);
|
||||
dd.vertex(m_steerPos.x,m_steerPos.y+0.3f,m_steerPos.z, steerCol);
|
||||
|
||||
for (int i = 0; i < m_steerPointCount-1; ++i)
|
||||
{
|
||||
|
@ -638,10 +638,10 @@ public class TestNavmeshTool : Tool
|
|||
col = spathCol;
|
||||
}
|
||||
|
||||
dd.vertex(straightPathItem.getPos()[0], straightPathItem.getPos()[1] + 0.4f,
|
||||
straightPathItem.getPos()[2], col);
|
||||
dd.vertex(straightPathItem2.getPos()[0], straightPathItem2.getPos()[1] + 0.4f,
|
||||
straightPathItem2.getPos()[2], col);
|
||||
dd.vertex(straightPathItem.getPos().x, straightPathItem.getPos().y + 0.4f,
|
||||
straightPathItem.getPos().z, col);
|
||||
dd.vertex(straightPathItem2.getPos().x, straightPathItem2.getPos().y + 0.4f,
|
||||
straightPathItem2.getPos().z, col);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -667,8 +667,8 @@ public class TestNavmeshTool : Tool
|
|||
col = spathCol;
|
||||
}
|
||||
|
||||
dd.vertex(straightPathItem.getPos()[0], straightPathItem.getPos()[1] + 0.4f,
|
||||
straightPathItem.getPos()[2], col);
|
||||
dd.vertex(straightPathItem.getPos().x, straightPathItem.getPos().y + 0.4f,
|
||||
straightPathItem.getPos().z, col);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -696,10 +696,10 @@ public class TestNavmeshTool : Tool
|
|||
{
|
||||
StraightPathItem straightPathItem = m_straightPath[i];
|
||||
StraightPathItem straightPathItem2 = m_straightPath[i + 1];
|
||||
dd.vertex(straightPathItem.getPos()[0], straightPathItem.getPos()[1] + 0.4f,
|
||||
straightPathItem.getPos()[2], spathCol);
|
||||
dd.vertex(straightPathItem2.getPos()[0], straightPathItem2.getPos()[1] + 0.4f,
|
||||
straightPathItem2.getPos()[2], spathCol);
|
||||
dd.vertex(straightPathItem.getPos().x, straightPathItem.getPos().y + 0.4f,
|
||||
straightPathItem.getPos().z, spathCol);
|
||||
dd.vertex(straightPathItem2.getPos().x, straightPathItem2.getPos().y + 0.4f,
|
||||
straightPathItem2.getPos().z, spathCol);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -707,8 +707,8 @@ public class TestNavmeshTool : Tool
|
|||
for (int i = 0; i < m_straightPath.Count; ++i)
|
||||
{
|
||||
StraightPathItem straightPathItem = m_straightPath[i];
|
||||
dd.vertex(straightPathItem.getPos()[0], straightPathItem.getPos()[1] + 0.4f,
|
||||
straightPathItem.getPos()[2], spathCol);
|
||||
dd.vertex(straightPathItem.getPos().x, straightPathItem.getPos().y + 0.4f,
|
||||
straightPathItem.getPos().z, spathCol);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
|
@ -717,10 +717,10 @@ public class TestNavmeshTool : Tool
|
|||
{
|
||||
int hitCol = duRGBA(0, 0, 0, 128);
|
||||
dd.begin(LINES, 2.0f);
|
||||
dd.vertex(m_hitPos[0], m_hitPos[1] + 0.4f, m_hitPos[2], hitCol);
|
||||
dd.vertex(m_hitPos[0] + m_hitNormal[0] * agentRadius,
|
||||
m_hitPos[1] + 0.4f + m_hitNormal[1] * agentRadius,
|
||||
m_hitPos[2] + m_hitNormal[2] * agentRadius, hitCol);
|
||||
dd.vertex(m_hitPos.x, m_hitPos.y + 0.4f, m_hitPos.z, hitCol);
|
||||
dd.vertex(m_hitPos.x + m_hitNormal.x * agentRadius,
|
||||
m_hitPos.y + 0.4f + m_hitNormal.y * agentRadius,
|
||||
m_hitPos.z + m_hitNormal.z * agentRadius, hitCol);
|
||||
dd.end();
|
||||
}
|
||||
|
||||
|
@ -733,15 +733,15 @@ public class TestNavmeshTool : Tool
|
|||
dd.depthMask(false);
|
||||
if (m_spos != Vector3f.Zero)
|
||||
{
|
||||
dd.debugDrawCircle(m_spos[0], m_spos[1] + agentHeight / 2, m_spos[2], m_distanceToWall,
|
||||
dd.debugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, m_distanceToWall,
|
||||
duRGBA(64, 16, 0, 220), 2.0f);
|
||||
}
|
||||
|
||||
if (m_hitPos != Vector3f.Zero)
|
||||
{
|
||||
dd.begin(LINES, 3.0f);
|
||||
dd.vertex(m_hitPos[0], m_hitPos[1] + 0.02f, m_hitPos[2], duRGBA(0, 0, 0, 192));
|
||||
dd.vertex(m_hitPos[0], m_hitPos[1] + agentHeight, m_hitPos[2], duRGBA(0, 0, 0, 192));
|
||||
dd.vertex(m_hitPos.x, m_hitPos.y + 0.02f, m_hitPos.z, duRGBA(0, 0, 0, 192));
|
||||
dd.vertex(m_hitPos.x, m_hitPos.y + agentHeight, m_hitPos.z, duRGBA(0, 0, 0, 192));
|
||||
dd.end();
|
||||
}
|
||||
|
||||
|
@ -760,7 +760,7 @@ public class TestNavmeshTool : Tool
|
|||
dd.depthMask(false);
|
||||
Vector3f p0 = getPolyCenter(m_navMesh, m_parent[i]);
|
||||
Vector3f p1 = getPolyCenter(m_navMesh, m_polys[i]);
|
||||
dd.debugDrawArc(p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], 0.25f, 0.0f, 0.4f,
|
||||
dd.debugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f,
|
||||
duRGBA(0, 0, 0, 128), 2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -772,10 +772,10 @@ public class TestNavmeshTool : Tool
|
|||
if (m_sposSet && m_eposSet)
|
||||
{
|
||||
dd.depthMask(false);
|
||||
float dx = m_epos[0] - m_spos[0];
|
||||
float dz = m_epos[2] - m_spos[2];
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
dd.debugDrawCircle(m_spos[0], m_spos[1] + agentHeight / 2, m_spos[2], dist, duRGBA(64, 16, 0, 220),
|
||||
dd.debugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, dist, duRGBA(64, 16, 0, 220),
|
||||
2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ public class TestNavmeshTool : Tool
|
|||
dd.depthMask(false);
|
||||
Vector3f p0 = getPolyCenter(m_navMesh, m_parent[i]);
|
||||
Vector3f p1 = getPolyCenter(m_navMesh, m_polys[i]);
|
||||
dd.debugDrawArc(p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], 0.25f, 0.0f, 0.4f,
|
||||
dd.debugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f,
|
||||
duRGBA(0, 0, 0, 128), 2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -830,7 +830,7 @@ public class TestNavmeshTool : Tool
|
|||
dd.depthMask(false);
|
||||
Vector3f p0 = getPolyCenter(m_navMesh, m_parent[i]);
|
||||
Vector3f p1 = getPolyCenter(m_navMesh, m_polys[i]);
|
||||
dd.debugDrawArc(p0[0], p0[1], p0[2], p1[0], p1[1], p1[2], 0.25f, 0.0f, 0.4f,
|
||||
dd.debugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f,
|
||||
duRGBA(0, 0, 0, 128), 2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ public class TestNavmeshTool : Tool
|
|||
|
||||
Vector3f delta = vSub(s3, s.vmin);
|
||||
Vector3f p0 = vMad(s.vmin, delta, 0.5f);
|
||||
Vector3f norm = Vector3f.Of(delta[2], 0, -delta[0]);
|
||||
Vector3f norm = Vector3f.Of(delta.z, 0, -delta.x);
|
||||
vNormalize(ref norm);
|
||||
Vector3f p1 = vMad(p0, norm, agentRadius * 0.5f);
|
||||
// Skip backfacing segments.
|
||||
|
@ -875,8 +875,8 @@ public class TestNavmeshTool : Tool
|
|||
col = duRGBA(96, 32, 16, 192);
|
||||
}
|
||||
|
||||
dd.vertex(p0[0], p0[1] + agentClimb, p0[2], col);
|
||||
dd.vertex(p1[0], p1[1] + agentClimb, p1[2], col);
|
||||
dd.vertex(p0.x, p0.y + agentClimb, p0.z, col);
|
||||
dd.vertex(p1.x, p1.y + agentClimb, p1.z, col);
|
||||
|
||||
dd.vertex(s[0], s[1] + agentClimb, s[2], col);
|
||||
dd.vertex(s[3], s[4] + agentClimb, s[5], col);
|
||||
|
@ -893,7 +893,7 @@ public class TestNavmeshTool : Tool
|
|||
if (m_sposSet)
|
||||
{
|
||||
dd.depthMask(false);
|
||||
dd.debugDrawCircle(m_spos[0], m_spos[1] + agentHeight / 2, m_spos[2], m_neighbourhoodRadius,
|
||||
dd.debugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, m_neighbourhoodRadius,
|
||||
duRGBA(64, 16, 0, 220), 2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -906,17 +906,17 @@ public class TestNavmeshTool : Tool
|
|||
int col = duRGBA(64, 16, 0, 220);
|
||||
foreach (Vector3f point in randomPoints)
|
||||
{
|
||||
dd.vertex(point[0], point[1] + 0.1f, point[2], col);
|
||||
dd.vertex(point.x, point.y + 0.1f, point.z, col);
|
||||
}
|
||||
|
||||
dd.end();
|
||||
if (m_sposSet && m_eposSet)
|
||||
{
|
||||
dd.depthMask(false);
|
||||
float dx = m_epos[0] - m_spos[0];
|
||||
float dz = m_epos[2] - m_spos[2];
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
dd.debugDrawCircle(m_spos[0], m_spos[1] + agentHeight / 2, m_spos[2], dist, duRGBA(64, 16, 0, 220),
|
||||
dd.debugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, dist, duRGBA(64, 16, 0, 220),
|
||||
2.0f);
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -932,16 +932,16 @@ public class TestNavmeshTool : Tool
|
|||
float c = m_sample.getSettingsUI().getAgentMaxClimb();
|
||||
dd.depthMask(false);
|
||||
// Agent dimensions.
|
||||
dd.debugDrawCylinderWire(pos[0] - r, pos[1] + 0.02f, pos[2] - r, pos[0] + r, pos[1] + h, pos[2] + r, col, 2.0f);
|
||||
dd.debugDrawCircle(pos[0], pos[1] + c, pos[2], r, duRGBA(0, 0, 0, 64), 1.0f);
|
||||
dd.debugDrawCylinderWire(pos.x - r, pos.y + 0.02f, pos.z - r, pos.x + r, pos.y + h, pos.z + r, col, 2.0f);
|
||||
dd.debugDrawCircle(pos.x, pos.y + c, pos.z, r, duRGBA(0, 0, 0, 64), 1.0f);
|
||||
int colb = duRGBA(0, 0, 0, 196);
|
||||
dd.begin(LINES);
|
||||
dd.vertex(pos[0], pos[1] - c, pos[2], colb);
|
||||
dd.vertex(pos[0], pos[1] + c, pos[2], colb);
|
||||
dd.vertex(pos[0] - r / 2, pos[1] + 0.02f, pos[2], colb);
|
||||
dd.vertex(pos[0] + r / 2, pos[1] + 0.02f, pos[2], colb);
|
||||
dd.vertex(pos[0], pos[1] + 0.02f, pos[2] - r / 2, colb);
|
||||
dd.vertex(pos[0], pos[1] + 0.02f, pos[2] + r / 2, colb);
|
||||
dd.vertex(pos.x, pos.y - c, pos.z, colb);
|
||||
dd.vertex(pos.x, pos.y + c, pos.z, colb);
|
||||
dd.vertex(pos.x - r / 2, pos.y + 0.02f, pos.z, colb);
|
||||
dd.vertex(pos.x + r / 2, pos.y + 0.02f, pos.z, colb);
|
||||
dd.vertex(pos.x, pos.y + 0.02f, pos.z - r / 2, colb);
|
||||
dd.vertex(pos.x, pos.y + 0.02f, pos.z + r / 2, colb);
|
||||
dd.end();
|
||||
dd.depthMask(true);
|
||||
}
|
||||
|
@ -958,15 +958,15 @@ public class TestNavmeshTool : Tool
|
|||
for (int i = 0; i < poly.vertCount; ++i)
|
||||
{
|
||||
int v = poly.verts[i] * 3;
|
||||
center[0] += tile.data.verts[v];
|
||||
center[1] += tile.data.verts[v + 1];
|
||||
center[2] += tile.data.verts[v + 2];
|
||||
center.x += tile.data.verts[v];
|
||||
center.y += tile.data.verts[v + 1];
|
||||
center.z += tile.data.verts[v + 2];
|
||||
}
|
||||
|
||||
float s = 1.0f / poly.vertCount;
|
||||
center[0] *= s;
|
||||
center[1] *= s;
|
||||
center[2] *= s;
|
||||
center.x *= s;
|
||||
center.y *= s;
|
||||
center.z *= s;
|
||||
}
|
||||
|
||||
return center;
|
||||
|
|
Loading…
Reference in New Issue