Only submit trailing vertices if the previous triangle was visible
This commit is contained in:
parent
f8d1fa3439
commit
5299badf58
@ -216,7 +216,7 @@ void SceneListSubmit(Vertex* vertices, int n) {
|
|||||||
#define SUBMIT_QUEUED_VERTEX(sflags) \
|
#define SUBMIT_QUEUED_VERTEX(sflags) \
|
||||||
do { if(queued_vertex) { queued_vertex->flags = (sflags); _glPushHeaderOrVertex(queued_vertex); queued_vertex = NULL; } } while(0)
|
do { if(queued_vertex) { queued_vertex->flags = (sflags); _glPushHeaderOrVertex(queued_vertex); queued_vertex = NULL; } } while(0)
|
||||||
|
|
||||||
uint8_t visible_mask = 0;
|
int visible_mask = 0;
|
||||||
|
|
||||||
sq = SQ_BASE_ADDRESS;
|
sq = SQ_BASE_ADDRESS;
|
||||||
|
|
||||||
@ -237,21 +237,21 @@ void SceneListSubmit(Vertex* vertices, int n) {
|
|||||||
// we need to finalize this strip and move on
|
// we need to finalize this strip and move on
|
||||||
SUBMIT_QUEUED_VERTEX(qv.flags);
|
SUBMIT_QUEUED_VERTEX(qv.flags);
|
||||||
|
|
||||||
_glPerspectiveDivideVertex(v0, h);
|
// If the last triangle was all visible, we need
|
||||||
_glPushHeaderOrVertex(v0);
|
// to submit the last two vertices, any clipped triangles
|
||||||
|
// would've
|
||||||
|
if(visible_mask == ALL_VISIBLE) {
|
||||||
|
_glPerspectiveDivideVertex(v0, h);
|
||||||
|
_glPushHeaderOrVertex(v0);
|
||||||
|
|
||||||
_glPerspectiveDivideVertex(v1, h);
|
_glPerspectiveDivideVertex(v1, h);
|
||||||
_glPushHeaderOrVertex(v1);
|
_glPushHeaderOrVertex(v1);
|
||||||
i += 2;
|
i += 2;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!is_header(v2));
|
visible_mask = (
|
||||||
|
|
||||||
// FIXME: What if v1 or v2 are headers? Should we handle that or just
|
|
||||||
// assume the user has done something weird and all bets are off?
|
|
||||||
|
|
||||||
int visible_mask = (
|
|
||||||
(v0->xyz[2] >= -v0->w) << 0 |
|
(v0->xyz[2] >= -v0->w) << 0 |
|
||||||
(v1->xyz[2] >= -v1->w) << 1 |
|
(v1->xyz[2] >= -v1->w) << 1 |
|
||||||
(v2->xyz[2] >= -v2->w) << 2
|
(v2->xyz[2] >= -v2->w) << 2
|
||||||
|
@ -64,7 +64,7 @@ int check_start() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLfloat movement = 0.0f;
|
static GLfloat movement = -10.0f;
|
||||||
static GLfloat rotation = 0.0f;
|
static GLfloat rotation = 0.0f;
|
||||||
|
|
||||||
void update_movement() {
|
void update_movement() {
|
||||||
|
Loading…
Reference in New Issue
Block a user