MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / gpu_DrawFlatPolygon3D

Function gpu_DrawFlatPolygon3D

renderer/HardwareOpenGL.cpp:1264–1315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262}
1263
1264void gpu_DrawFlatPolygon3D(g3Point **p, int nv) {
1265 float fr, fg, fb;
1266 int i;
1267
1268 if (UseMultitexture) {
1269 gpu_SetMultitextureBlendMode(false);
1270 }
1271
1272 float alpha = gpu_Alpha_multiplier * gpu_Alpha_factor;
1273
1274 fr = GR_COLOR_RED(gpu_state.cur_color);
1275 fg = GR_COLOR_GREEN(gpu_state.cur_color);
1276 fb = GR_COLOR_BLUE(gpu_state.cur_color);
1277 fr /= 255.0;
1278 fg /= 255.0;
1279 fb /= 255.0;
1280
1281 // And draw!
1282 dglBegin(GL_POLYGON);
1283 for (i = 0; i < nv; i++) {
1284 g3Point *pnt = p[i];
1285 ASSERT(pnt->p3_flags & PF_ORIGPOINT);
1286
1287 if (gpu_state.cur_alpha_type & ATF_VERTEX)
1288 alpha = pnt->p3_a * gpu_Alpha_multiplier * gpu_Alpha_factor;
1289
1290 // If we have a lighting model, apply the correct lighting!
1291 if (gpu_state.cur_light_state != LS_NONE) {
1292 // Do lighting based on intesity (MONO) or colored (RGB)
1293 if (gpu_state.cur_color_model == CM_MONO)
1294 dglColor4f(pnt->p3_l, pnt->p3_l, pnt->p3_l, alpha);
1295 else {
1296 dglColor4f(pnt->p3_r, pnt->p3_g, pnt->p3_b, alpha);
1297 }
1298
1299 } else {
1300 dglColor4f(fr, fg, fb, alpha);
1301 }
1302
1303 /*
1304 // Finally, specify a vertex
1305 float z = std::max(0,std::min(1.0,1.0-(1.0/(pnt->p3_z+Z_bias))));
1306 dglVertex3f (pnt->p3_sx+x_add,pnt->p3_sy+y_add,-z);
1307 */
1308 dglVertex3f(pnt->p3_vecPreRot.x, pnt->p3_vecPreRot.y, pnt->p3_vecPreRot.z);
1309 }
1310
1311 dglEnd();
1312 CHECK_ERROR(11)
1313 OpenGL_polys_drawn++;
1314 OpenGL_verts_processed += nv;
1315}
1316
1317// Sets the gamma correction value
1318void rend_SetGammaValue(float val) {

Callers 1

rend_DrawPolygon3DFunction · 0.85

Calls 4

GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85

Tested by

no test coverage detected