| 66 | } |
| 67 | |
| 68 | void EngineGL33::PrepareMeshTLImpl(const FrameState& frame, const Matrix4& modelToWorld, const Poseidon::render::LegacySpec& spec) |
| 69 | { |
| 70 | EnableSunLight(!Poseidon::render::Has(spec.material, Poseidon::render::Material::DisableSun)); |
| 71 | ChangeClipPlanes(); |
| 72 | |
| 73 | GfxMatrix worldMatrix; |
| 74 | ConvertMatrix(worldMatrix, modelToWorld); |
| 75 | // Camera-relative rendering |
| 76 | worldMatrix._41 -= frame.cameraPos[0]; |
| 77 | worldMatrix._42 -= frame.cameraPos[1]; |
| 78 | worldMatrix._43 -= frame.cameraPos[2]; |
| 79 | |
| 80 | _currentDrawItem = DrawItem{}; |
| 81 | _currentDrawItem.worldMatrix = worldMatrix; |
| 82 | _currentDrawItem.specFlags = spec; |
| 83 | _currentDrawItem.bias = _bias; |
| 84 | |
| 85 | UploadObjectConstants(_currentDrawItem); |
| 86 | |
| 87 | // IsColored objects carry their opacity + fade in the scene constant colour; |
| 88 | // mirror the software path (TransLight.cpp) or they render at texture alpha. |
| 89 | float constColor[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 90 | if (GScene && Poseidon::render::Has(spec.routing, Poseidon::render::Routing::IsColored)) |
| 91 | { |
| 92 | ColorVal cc = GScene->GetConstantColor(); |
| 93 | constColor[0] = cc.R(); |
| 94 | constColor[1] = cc.G(); |
| 95 | constColor[2] = cc.B(); |
| 96 | constColor[3] = cc.A(); |
| 97 | } |
| 98 | if (memcmp(constColor, _psConstants.constColor, sizeof(constColor)) != 0) |
| 99 | { |
| 100 | memcpy(_psConstants.constColor, constColor, sizeof(constColor)); |
| 101 | UploadPSConstant(PSConstants::SlotConstColor, _psConstants.constColor); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | void EngineGL33::BeginMeshTL(const Shape& sMesh, int spec, bool dynamic) |
| 106 | { |
nothing calls this directly
no test coverage detected