| 224 | } |
| 225 | |
| 226 | void EngineGL33::DrawTestPattern(const char* name) |
| 227 | { |
| 228 | if (!_glContext || !_frameOpen) |
| 229 | return; |
| 230 | |
| 231 | auto makeTL = [](float x, float y, float z, DWORD col) -> TLVertex |
| 232 | { |
| 233 | TLVertex v; |
| 234 | v.pos = Vector3P(x, y, z); |
| 235 | v.rhw = 1.0f; |
| 236 | v.color = PackedColor(col); |
| 237 | v.specular = PackedColor(DWORD(0xFF000000)); |
| 238 | v.t0 = {0.0f, 0.0f}; |
| 239 | v.t1 = {0.0f, 0.0f}; |
| 240 | return v; |
| 241 | }; |
| 242 | |
| 243 | auto setupFlatDraw = [&]() |
| 244 | { |
| 245 | SelectVertexShader(VSScreen); |
| 246 | UploadVSScreenConstants(); |
| 247 | SelectPixelShader(PSFlat); |
| 248 | Poseidon::render::cull::None(); |
| 249 | }; |
| 250 | |
| 251 | auto drawQuad = [&](TLVertex v[4]) |
| 252 | { |
| 253 | TLVertex triList[6] = {v[0], v[1], v[2], v[0], v[2], v[3]}; |
| 254 | GL33Bind::Vao(_vaoScreen); |
| 255 | glBindBuffer(GL_ARRAY_BUFFER, _vbo); |
| 256 | glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(triList), triList); |
| 257 | glDrawArrays(GL_TRIANGLES, 0, 6); |
| 258 | }; |
| 259 | |
| 260 | auto clearGL = [&](DWORD color) |
| 261 | { |
| 262 | float c[4] = {((color >> 16) & 0xFF) / 255.0f, ((color >> 8) & 0xFF) / 255.0f, (color & 0xFF) / 255.0f, |
| 263 | ((color >> 24) & 0xFF) / 255.0f}; |
| 264 | Poseidon::render::pipeline::SetClearColor(c[0], c[1], c[2], c[3]); |
| 265 | Poseidon::render::clear::ColorDepthStencil(); |
| 266 | }; |
| 267 | |
| 268 | if (strcmp(name, "gradient3d") == 0) |
| 269 | { |
| 270 | setupFlatDraw(); |
| 271 | InvalidatePipelineCache(); |
| 272 | ApplyBlendMode(BlendMode::Opaque); |
| 273 | ApplyDepthMode(DepthMode::Normal); |
| 274 | |
| 275 | float w = (float)_w, h = (float)_h; |
| 276 | TLVertex v[4] = { |
| 277 | makeTL(0, 0, 0.5f, 0xFFFF0000), |
| 278 | makeTL(w, 0, 0.5f, 0xFF00FF00), |
| 279 | makeTL(w, h, 0.5f, 0xFFFFFFFF), |
| 280 | makeTL(0, h, 0.5f, 0xFF0000FF), |
| 281 | }; |
| 282 | drawQuad(v); |
| 283 | return; |
nothing calls this directly
no test coverage detected