swordlegend / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

function request, rasterizevertex #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Could you add the following functionality to the rasterization functionality?

In my project, I don't have access to the geometry, so instead I must flood
fill the level with collision tests as an offline pre-process. What this
rcRasterizeVertex does is allow me to rasterize a single vertex, which is
typically where the flood filled raycast hits the ground. It also returns
whether or not it added a span or not, which I use as effectively an
'already explored' status. Would be much appreciated if it were added to
the core library so I don't have to merge it with each update. Also if you
would please give it a once over to see if that is doing what it should be
doing. I based it off of bits of other triangle rasterization function.

Original issue reported on code.google.com by jswig...@gmail.com on 6 Feb 2010 at 8:05

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not sure of the granularity of the function is something I'd like to add the
core, but I will at least promote the addSpan to the API, as it will be useful 
for
custom promitives such as analytically rasterizing a sphere or regular 
heighfield. I
can add return code too.

Original comment by memono...@gmail.com on 6 Feb 2010 at 3:16

GoogleCodeExporter commented 9 years ago
The function would be useful, if only to hide how things work internally. I'd 
prefer
to avoid external functionality that requires me to know how things work 
internally
in order to use. Alternately maybe you could return that code from the
rasterizetriangles, and I could just pass in the same point as each vertex of a 
triangle.

Original comment by jswig...@gmail.com on 8 Feb 2010 at 2:55

GoogleCodeExporter commented 9 years ago
I added rcAddSpan to the API, not the full rasterize vertex. I also decided 
against
the return value. I do not want to add functions which the code does not need 
and
which I don't know how to maintain. The return values falls into the second 
category.
I also want to encourage to keep Recast process as transparent as possible to 
allow
people to hack the in between data if they needs to do that.

You can use following code to check if the span exits before you call addSpan 
(not
100% if I got the logic right):

// new span is already handled?
bool spanAdded = true;
for (rcSpan* s = solid.spans[x0 + y0*solid.width]; s; s = s->next)
{
    if (ismin >= s->smin && ismax <= s->smax)
        spanAdded = false;
}

rcAddSpan is added in R127.

Original comment by memono...@gmail.com on 12 Feb 2010 at 1:27