Added functions to rasterize index mesh based in ushort indices and function which is equivalent to ogl drawArrays.
This commit is contained in:
parent
aa62a15161
commit
ecb01d3441
@ -407,7 +407,6 @@ void rcRasterizeTriangle(const float* v0, const float* v1, const float* v2,
|
|||||||
// verts - (in) array of vertices
|
// verts - (in) array of vertices
|
||||||
// nv - (in) vertex count
|
// nv - (in) vertex count
|
||||||
// tris - (in) array of triangle vertex indices
|
// tris - (in) array of triangle vertex indices
|
||||||
// norms - (in) array of triangle normals
|
|
||||||
// flags - (in) array of triangle flags (uses WALKABLE)
|
// flags - (in) array of triangle flags (uses WALKABLE)
|
||||||
// nt - (in) triangle count
|
// nt - (in) triangle count
|
||||||
// solid - (in) heighfield where the triangles are rasterized
|
// solid - (in) heighfield where the triangles are rasterized
|
||||||
@ -415,6 +414,27 @@ void rcRasterizeTriangles(const float* verts, int nv,
|
|||||||
const int* tris, const unsigned char* flags, int nt,
|
const int* tris, const unsigned char* flags, int nt,
|
||||||
rcHeightfield& solid);
|
rcHeightfield& solid);
|
||||||
|
|
||||||
|
// Rasterizes the triangles into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// tris - (in) array of triangle vertex indices
|
||||||
|
// flags - (in) array of triangle flags (uses WALKABLE)
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// solid - (in) heighfield where the triangles are rasterized
|
||||||
|
void rcRasterizeTriangles(const float* verts, int nv,
|
||||||
|
const unsigned short* tris, const unsigned char* flags, int nt,
|
||||||
|
rcHeightfield& solid);
|
||||||
|
|
||||||
|
// Rasterizes the triangles into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// flags - (in) array of triangle flags (uses WALKABLE)
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// solid - (in) heighfield where the triangles are rasterized
|
||||||
|
void rcRasterizeTriangles(const float* verts, const unsigned char* flags, int nt,
|
||||||
|
rcHeightfield& solid);
|
||||||
|
|
||||||
// Removes WALKABLE flag from all spans that are at ledges. This filtering
|
// Removes WALKABLE flag from all spans that are at ledges. This filtering
|
||||||
// removes possible overestimation of the conservative voxelization so that
|
// removes possible overestimation of the conservative voxelization so that
|
||||||
// the resulting mesh will not have regions hanging in air over ledges.
|
// the resulting mesh will not have regions hanging in air over ledges.
|
||||||
|
@ -282,7 +282,7 @@ void rcRasterizeTriangle(const float* v0, const float* v1, const float* v2,
|
|||||||
if (rcGetBuildTimes())
|
if (rcGetBuildTimes())
|
||||||
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rcRasterizeTriangles(const float* verts, int nv,
|
void rcRasterizeTriangles(const float* verts, int nv,
|
||||||
const int* tris, const unsigned char* flags, int nt,
|
const int* tris, const unsigned char* flags, int nt,
|
||||||
rcHeightfield& solid)
|
rcHeightfield& solid)
|
||||||
@ -306,3 +306,50 @@ void rcRasterizeTriangles(const float* verts, int nv,
|
|||||||
if (rcGetBuildTimes())
|
if (rcGetBuildTimes())
|
||||||
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangles(const float* verts, int nv,
|
||||||
|
const unsigned short* tris, const unsigned char* flags, int nt,
|
||||||
|
rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcTimeVal startTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[tris[i*3+0]*3];
|
||||||
|
const float* v1 = &verts[tris[i*3+1]*3];
|
||||||
|
const float* v2 = &verts[tris[i*3+2]*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, flags[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcTimeVal endTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
|
if (rcGetBuildTimes())
|
||||||
|
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangles(const float* verts, const unsigned char* flags, int nt,
|
||||||
|
rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcTimeVal startTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[(i*3+0)*3];
|
||||||
|
const float* v1 = &verts[(i*3+1)*3];
|
||||||
|
const float* v2 = &verts[(i*3+2)*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, flags[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcTimeVal endTime = rcGetPerformanceTimer();
|
||||||
|
|
||||||
|
if (rcGetBuildTimes())
|
||||||
|
rcGetBuildTimes()->rasterizeTriangles += rcGetDeltaTimeUsec(startTime, endTime);
|
||||||
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user