mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 23:32:41 +08:00
Improved rendering for nav poly selection, path shader now batches selection lines and tris
This commit is contained in:
+3
-65
@@ -1435,7 +1435,8 @@ namespace CodeWalker
|
||||
if (selectionItem.NavPoly != null)
|
||||
{
|
||||
Renderer.RenderSelectionNavPoly(selectionItem.NavPoly);
|
||||
//return;//don't render a selection box for nav mesh?
|
||||
Renderer.RenderSelectionNavPolyOutline(selectionItem.NavPoly, cgrn);
|
||||
return;//don't render a selection box for nav poly
|
||||
}
|
||||
if (selectionItem.NavPoint != null)
|
||||
{
|
||||
@@ -2717,70 +2718,7 @@ namespace CodeWalker
|
||||
|
||||
if ((CurMouseHit.NavPoly != null) && MouseSelectEnabled)
|
||||
{
|
||||
var colour = Color4.White;
|
||||
var colourval = (uint)colour.ToRgba();
|
||||
var poly = CurMouseHit.NavPoly;
|
||||
var ynv = poly.Ynv;
|
||||
var ic = poly._RawData.IndexCount;
|
||||
var startid = poly._RawData.IndexID;
|
||||
var endid = startid + ic;
|
||||
var lastid = endid - 1;
|
||||
var vc = ynv.Vertices.Count;
|
||||
var startind = ynv.Indices[startid];
|
||||
|
||||
////draw poly outline
|
||||
VertexTypePC v = new VertexTypePC();
|
||||
v.Colour = colourval;
|
||||
VertexTypePC v0 = new VertexTypePC();
|
||||
for (int id = startid; id < endid; id++)
|
||||
{
|
||||
var ind = ynv.Indices[id];
|
||||
if (ind >= vc)
|
||||
{ continue; }
|
||||
|
||||
v.Position = ynv.Vertices[ind];
|
||||
Renderer.SelectionLineVerts.Add(v);
|
||||
if (id == startid)
|
||||
{
|
||||
v0 = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
Renderer.SelectionLineVerts.Add(v);
|
||||
}
|
||||
if (id == lastid)
|
||||
{
|
||||
Renderer.SelectionLineVerts.Add(v0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////draw poly triangles
|
||||
//VertexTypePC v0 = new VertexTypePC();
|
||||
//VertexTypePC v1 = new VertexTypePC();
|
||||
//VertexTypePC v2 = new VertexTypePC();
|
||||
//v0.Position = ynv.Vertices[startind];
|
||||
//v0.Colour = colourval;
|
||||
//v1.Colour = colourval;
|
||||
//v2.Colour = colourval;
|
||||
//int tricount = ic - 2;
|
||||
//for (int t = 0; t < tricount; t++)
|
||||
//{
|
||||
// int tid = startid + t;
|
||||
// int ind1 = ynv.Indices[tid + 1];
|
||||
// int ind2 = ynv.Indices[tid + 2];
|
||||
// if ((ind1 >= vc) || (ind2 >= vc))
|
||||
// { continue; }
|
||||
// v1.Position = ynv.Vertices[ind1];
|
||||
// v2.Position = ynv.Vertices[ind2];
|
||||
// Renderer.SelectionTriVerts.Add(v0);
|
||||
// Renderer.SelectionTriVerts.Add(v1);
|
||||
// Renderer.SelectionTriVerts.Add(v2);
|
||||
// Renderer.SelectionTriVerts.Add(v0);
|
||||
// Renderer.SelectionTriVerts.Add(v2);
|
||||
// Renderer.SelectionTriVerts.Add(v1);
|
||||
//}
|
||||
|
||||
Renderer.RenderSelectionNavPolyOutline(CurMouseHit.NavPoly, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user