ref: 711de5682e829770a1f2f68d863929d3cd5ca837
parent: 9c620f78c79a668824dfd967598bcfc58a249e4e
author: David <gek@katherine>
date: Thu Mar 11 19:41:44 EST 2021
Automatic commit.
--- a/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -27,7 +27,8 @@
#define TGL_FEATURE_LIT_TEXTURES 1
//Enable the patternized "discard"-ing of pixels.
#define TGL_FEATURE_POLYGON_STIPPLE 0
-//Enable the rendering of large polygons (in terms of vertex count).
+//Enable the rendering of large polygons (in terms of vertex count)
+//Also enabled the rendering of line loops.
//the maximum number of vertices in a polygon is defined in zgl.h
#define TGL_FEATURE_GL_POLYGON 0
//Enable GL_BLEND functionality
--- a/src/clip.c
+++ b/src/clip.c
@@ -204,10 +204,22 @@
gl_transform_to_viewport_clip_c(&q1);
gl_transform_to_viewport_clip_c(&q2);
- if (c->zb->depth_test)
- ZB_line_z(c->zb, &q1.zp, &q2.zp);
- else
- ZB_line(c->zb, &q1.zp, &q2.zp);
+ if (c->render_mode == GL_SELECT) {
+ gl_add_select1(q1.zp.z, q2.zp.z, q2.zp.z);
+ }else if (c->render_mode == GL_FEEDBACK){
+ gl_add_feedback(
+ GL_LINE_TOKEN,
+ &q1,
+ &q2,
+ NULL,
+ 0
+ );
+ } else {
+ if (c->zb->depth_test)
+ ZB_line_z(c->zb, &q1.zp, &q2.zp);
+ else
+ ZB_line(c->zb, &q1.zp, &q2.zp);
+ }
}
}
}
@@ -403,7 +415,6 @@
gl_add_select1(p0->zp.z, p1->zp.z, p2->zp.z);
}
void gl_draw_triangle_feedback(GLVertex* p0, GLVertex* p1, GLVertex* p2){
- //GLContext* c = gl_get_context();
gl_add_feedback(
GL_POLYGON_TOKEN,
p0,
--- a/src/select.c
+++ b/src/select.c
@@ -130,7 +130,9 @@
GLuint vertex_pos_hits_needed = 2;
GLuint vertex_color_hits_needed = 4;
GLuint vertex_texture_hits_needed = 4;
+#if TGL_FEATURE_ERROR_CHECK == 1
GLuint done = 0;
+#endif
switch(c->feedback_type){
case GL_2D: vertex_feedback_hits_needed = 2;
vertex_pos_hits_needed = 2;
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -225,24 +225,6 @@
cnt++;
c->vertex_cnt = cnt;
- /* quick fix to avoid crashes on large polygons */
-//#if TGL_FEATURE_GL_POLYGON == 1
-// if (n >= c->vertex_max) {
-// GLVertex* newarray;
-// c->vertex_max <<= 1; /* just double size */
-// newarray = gl_malloc(sizeof(GLVertex) * c->vertex_max);
-//#if TGL_FEATURE_ERROR_CHECK == 1
-// if (!newarray)
-//#define ERROR_FLAG GL_OUT_OF_MEMORY
-//#include "error_check.h"
-//#else
-// if (!newarray) exit(1);
-//#endif
-// memcpy(newarray, c->vertex, n * sizeof(GLVertex));
-// gl_free(c->vertex);
-// c->vertex = newarray;
-// }
-//#endif
/* new vertex entry */
v = &c->vertex[n];
n++;
@@ -267,8 +249,9 @@
if (c->texture_2d_enabled) {
#if TGL_FEATURE_LIT_TEXTURES == 1
- if (!(c->lighting_enabled))
- v->color = gl_V4_New(1, 1, 1, 0); // Fix by GEK for unlit textured models.
+//Bad!
+// if (!(c->lighting_enabled))
+// v->color = gl_V4_New(1, 1, 1, 0); // Fix by GEK for unlit textured models.
#endif
if (c->apply_texture_matrix) {
gl_M4_MulV4(&v->tex_coord, c->matrix_stack_ptr[2], &c->current_tex_coord);
@@ -296,7 +279,9 @@
}
break;
case GL_LINE_STRIP:
+#if TGL_FEATURE_GL_POLYGON == 1
case GL_LINE_LOOP:
+#endif
switch(n){
case 1:
{
@@ -390,13 +375,14 @@
//Assume it went alright.
#endif
//#if TGL_FEATURE_GL_POLYGON == 1
- if (c->begin_type == GL_LINE_LOOP) {
+
+//#endif
+#if TGL_FEATURE_GL_POLYGON == 1
+ if (c->begin_type == GL_LINE_LOOP) {
if (c->vertex_cnt >= 3) {
gl_draw_line(&c->vertex[0], &c->vertex[2]);
}
}
-//#endif
-#if TGL_FEATURE_GL_POLYGON == 1
else if (c->begin_type == GL_POLYGON) {
GLint i = c->vertex_cnt;
while (i >= 3) {