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

Function grtext_Render

grtext/grtext.cpp:521–679  ·  view source on GitHub ↗

renders all text but DOESN'T flush buffer

Source from the content-addressed store, hash-verified

519
520// renders all text but DOESN'T flush buffer
521void grtext_Render() {
522 // setup rendering of text.
523 rend_SetTextureType(TT_LINEAR);
524 rend_SetOverlayType(OT_NONE);
525 rend_SetFiltering(0);
526 rend_SetLighting(LS_FLAT_GOURAUD);
527 rend_SetAlphaType(ATF_TEXTURE + ATF_CONSTANT);
528 rend_SetColorModel(CM_MONO);
529 rend_SetZBufferState(0);
530 rend_SetAlphaValue(Grtext_alpha);
531
532 // render text.
533 int pos = 0;
534
535 while (pos < Grtext_ptr) {
536 switch (Grtext_buffer[pos]) {
537 case GRTEXTOP_SETCOLOR: {
538 struct {
539 char op;
540 ddgr_color col;
541 } cmd;
542
543 memcpy(&cmd, &Grtext_buffer[pos], sizeof(cmd));
544 pos += sizeof(cmd);
545 rend_SetFlatColor(cmd.col);
546 // rend_SetCharacterParameters(cmd.col, cmd.col, cmd.col, cmd.col);
547 Grtext_colors[0] = cmd.col;
548 // Grtext_colors[1] = cmd.col[1];
549 // Grtext_colors[2] = cmd.col[2];
550 // Grtext_colors[3] = cmd.col[3];
551 } break;
552
553 case GRTEXTOP_SETFLAGS: {
554 struct {
555 char op;
556 int flags;
557 } cmd;
558
559 memcpy(&cmd, &Grtext_buffer[pos], sizeof(cmd));
560 pos += sizeof(cmd);
561
562 if (cmd.flags & GRTEXTFLAG_SATURATE)
563 Grtext_alphatype = AT_SATURATE_TEXTURE;
564 else
565 Grtext_alphatype = ATF_CONSTANT + ATF_TEXTURE;
566 rend_SetAlphaType(Grtext_alphatype);
567
568 if (cmd.flags & GRTEXTFLAG_SHADOW)
569 Grtext_shadow = true;
570 else
571 Grtext_shadow = false;
572 } break;
573
574 case GRTEXTOP_FANCYCOLOR: {
575 struct {
576 char op;
577 // ddgr_color col[4];
578 ddgr_color col;

Callers 1

grtext_FlushFunction · 0.85

Calls 11

grtext_RenderStringFunction · 0.85
grfont_BltCharFunction · 0.85
rend_SetTextureTypeFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetFilteringFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetZBufferStateFunction · 0.50
rend_SetAlphaValueFunction · 0.50
rend_SetFlatColorFunction · 0.50

Tested by

no test coverage detected