MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / PrepareMeshTLImpl

Method PrepareMeshTLImpl

engine/PoseidonGL33/EngineGL33_Mesh.cpp:68–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void 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
105void EngineGL33::BeginMeshTL(const Shape& sMesh, int spec, bool dynamic)
106{

Callers

nothing calls this directly

Calls 7

ConvertMatrixFunction · 0.85
HasFunction · 0.50
GetConstantColorMethod · 0.45
RMethod · 0.45
GMethod · 0.45
BMethod · 0.45
AMethod · 0.45

Tested by

no test coverage detected