| 174 | } |
| 175 | |
| 176 | void CTextRenderer::Draw() |
| 177 | { |
| 178 | ScopedPerfMarker(__FUNCTION__); |
| 179 | |
| 180 | CalculatePositions(true); |
| 181 | |
| 182 | for (CRenderTextObject *item = m_DrawPointer; item != nullptr; item = item->m_PrevDraw) |
| 183 | { |
| 184 | if (!item->IsText()) |
| 185 | { |
| 186 | continue; |
| 187 | } |
| 188 | |
| 189 | CTextData &text = *(CTextData *)item; |
| 190 | |
| 191 | if (text.Timer >= g_Ticks) |
| 192 | { |
| 193 | uint16_t textColor = text.Color; |
| 194 | |
| 195 | auto uniformValue = SDM_NO_COLOR; |
| 196 | if (textColor != 0u) |
| 197 | { |
| 198 | g_ColorManager.SendColorsToShader(textColor); |
| 199 | |
| 200 | uniformValue = SDM_COLORED; |
| 201 | if (text.Unicode) |
| 202 | { |
| 203 | uniformValue = SDM_TEXT_COLORED_NO_BLACK; |
| 204 | } |
| 205 | else if (text.Font != 5 && text.Font != 8) |
| 206 | { |
| 207 | uniformValue = SDM_PARTIAL_HUE; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | #ifndef NEW_RENDERER_ENABLED |
| 212 | glUniform1iARB(g_ShaderDrawMode, uniformValue); |
| 213 | |
| 214 | #else |
| 215 | ShaderUniformCmd cmd{ g_ShaderDrawMode, ShaderUniformType::ShaderUniformType_Int1 }; |
| 216 | cmd.value.asInt1 = uniformValue; |
| 217 | RenderAdd_SetShaderUniform(g_renderCmdList, cmd); |
| 218 | #endif |
| 219 | |
| 220 | if (text.Transparent) |
| 221 | { |
| 222 | uint8_t alpha = text.Alpha; |
| 223 | |
| 224 | if (alpha == 0xFF) |
| 225 | { |
| 226 | alpha = 0x7F; |
| 227 | } |
| 228 | |
| 229 | #ifndef NEW_RENDERER_ENABLED |
| 230 | glEnable(GL_BLEND); |
| 231 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 232 | glColor4ub(0xFF, 0xFF, 0xFF, alpha); |
| 233 | #else |
no test coverage detected