Skip to content

Commit 68965dc

Browse files
authored
Merge branch 'CERN:main' into main
2 parents 9187e93 + 151abc9 commit 68965dc

3 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/screenshot.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Screenshot Test
2+
3+
on:
4+
push:
5+
branches: [ "fix/tessellation-artifacts" ]
6+
7+
jobs:
8+
test-and-screenshot:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install dependencies
14+
run: sudo apt update && sudo apt install --fix-missing cmake gcc gfortran libx11-dev libglu1-mesa-dev libmotif-dev tcsh libxaw7-dev libglew-dev libdlm-dev libgl2ps-dev libpng-dev xvfb imagemagick
15+
16+
- name: Build
17+
run: |
18+
make config
19+
make build
20+
21+
- name: Run test_f3 and capture screenshot
22+
run: |
23+
Xvfb :99 -screen 0 1024x768x24 &
24+
export DISPLAY=:99
25+
sleep 2
26+
./build/test_f/test_f3 &
27+
TEST_PID=$!
28+
sleep 5
29+
import -window root test_f3_output.png
30+
kill $TEST_PID
31+
32+
- name: Upload Screenshot Artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: test_f3-screenshot
36+
path: test_f3_output.png

src/libphigs/f_binding/fb_extel.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,3 +884,38 @@ FTN_SUBROUTINE(psmcv3)(
884884
spacelist.half_spaces = &list[0];
885885
pset_model_clip_vol3(iop, spacelist);
886886
}
887+
888+
/*******************************************************************************
889+
* psbici
890+
*
891+
* DESCR: set back interior colour index
892+
* RETURNS: N/A
893+
*/
894+
FTN_SUBROUTINE(psbici)(
895+
FTN_INTEGER(coli)
896+
)
897+
{
898+
Pint colr_ind = FTN_INTEGER_GET(coli);
899+
#ifdef DEBUG
900+
printf("DEBUG: pset back interior color index set to %d\n", colr_ind);
901+
#endif
902+
pset_back_int_colr_ind(colr_ind);
903+
}
904+
905+
/*******************************************************************************
906+
* psbisi
907+
*
908+
* DESCR: set back interior style index
909+
* RETURNS: N/A
910+
*/
911+
FTN_SUBROUTINE(psbisi)(
912+
FTN_INTEGER(stylei)
913+
)
914+
{
915+
Pint style_ind = FTN_INTEGER_GET(stylei);
916+
#ifdef DEBUG
917+
printf("DEBUG: pset back interior style index set to %d\n", style_ind);
918+
#endif
919+
pset_back_int_style_ind(style_ind);
920+
}
921+

src/libphigs/wsgl/wsgl_tess.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ static void CALLBACK tessEndCB() {
2626
glEnd();
2727
}
2828

29+
static void CALLBACK tessEdgeFlagCB(GLboolean flag) {
30+
glEdgeFlag(flag);
31+
}
32+
2933
static void CALLBACK tessVertexCB(void *data) {
3034
Wsgl_tess_vertex *v = (Wsgl_tess_vertex *)data;
3135
if (v->has_norm) {
@@ -83,6 +87,9 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re
8387
int normal_indices[MAX_VERTICES];
8488
int n_vertices = 0;
8589
int n_normals = 0;
90+
GLboolean orig_depth_mask;
91+
GLfloat cur_color[4];
92+
int has_transparency = 0;
8693

8794
tess = gluNewTess();
8895
if (!tess) return;
@@ -92,6 +99,25 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re
9299
gluTessCallback(tess, GLU_TESS_VERTEX, (void (CALLBACK *)())tessVertexCB);
93100
gluTessCallback(tess, GLU_TESS_ERROR, (void (CALLBACK *)())tessErrorCB);
94101
gluTessCallback(tess, GLU_TESS_COMBINE, (void (CALLBACK *)())tessCombineCB);
102+
gluTessCallback(tess, GLU_TESS_EDGE_FLAG, (void (CALLBACK *)())tessEdgeFlagCB);
103+
104+
/* Determine if depth writing should be disabled for order-independent transparency */
105+
glGetBooleanv(GL_DEPTH_WRITEMASK, &orig_depth_mask);
106+
107+
if (num_vertices > 0 && vertices[0].apply_cb) {
108+
if (vertices[0].colr_type == PMODEL_RGBA && vertices[0].colr.direct.rgba.alpha < 1.0f) {
109+
has_transparency = 1;
110+
}
111+
} else {
112+
glGetFloatv(GL_CURRENT_COLOR, cur_color);
113+
if (cur_color[3] < 1.0f) {
114+
has_transparency = 1;
115+
}
116+
}
117+
118+
if (has_transparency && orig_depth_mask == GL_TRUE) {
119+
glDepthMask(GL_FALSE);
120+
}
95121

96122
gluTessBeginPolygon(tess, NULL);
97123
gluTessBeginContour(tess);
@@ -115,6 +141,13 @@ void wsgl_draw_tess_polygon(Wsgl_tess_vertex *vertices, int num_vertices, int re
115141
gluTessEndPolygon(tess);
116142
gluDeleteTess(tess);
117143

144+
/* Restore default edge flag state for subsequent rendering */
145+
glEdgeFlag(GL_TRUE);
146+
147+
if (has_transparency && orig_depth_mask == GL_TRUE) {
148+
glDepthMask(GL_TRUE);
149+
}
150+
118151
if (record_geom_flag && n_vertices > 0) {
119152
wsgl_add_geometry(GEOM_FACE, vertex_indices, normal_indices, n_vertices);
120153
}

0 commit comments

Comments
 (0)