MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / DrawShadowCache

Function DrawShadowCache

Source/Main/engine.cpp:3416–3442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3414}
3415
3416void DrawShadowCache(const mat4& proj_view_matrix, const char* special) {
3417 Graphics* graphics = Graphics::Instance();
3418 Shaders* shaders = Shaders::Instance();
3419
3420 GLState gl_state;
3421 gl_state.depth_test = true;
3422 gl_state.cull_face = true;
3423 gl_state.depth_write = true;
3424 gl_state.blend = false;
3425
3426 graphics->setGLState(gl_state);
3427
3428 const int kBufSize = 512;
3429 char shader_name[kBufSize];
3430 FormatString(shader_name, kBufSize, "shadow%s", special);
3431 int shader_id = shaders->returnProgram(shader_name);
3432 shaders->setProgram(shader_id);
3433 shaders->SetUniformMat4("projection_view_mat", proj_view_matrix);
3434 int vert_attrib_id = shaders->returnShaderAttrib("vert", shader_id);
3435
3436 shadow_cache_verts_vbo.Bind();
3437 graphics->EnableVertexAttribArray(vert_attrib_id);
3438 glVertexAttribPointer(vert_attrib_id, 3, GL_FLOAT, false, 0, 0);
3439 shadow_cache_indices_vbo.Bind();
3440 graphics->DrawElements(GL_TRIANGLES, shadow_cache_indices.size(), GL_UNSIGNED_INT, 0);
3441 graphics->ResetVertexAttribArrays();
3442}
3443
3444static bool UpdateShadowCache(SceneGraph* scenegraph) {
3445 Graphics* graphics = Graphics::Instance();

Callers 3

UpdateShadowCacheFunction · 0.85
GetShadowableTrisFunction · 0.85
UpdateShadowCascadesFunction · 0.85

Calls 11

FormatStringFunction · 0.85
setGLStateMethod · 0.80
returnProgramMethod · 0.80
setProgramMethod · 0.80
SetUniformMat4Method · 0.80
returnShaderAttribMethod · 0.80
BindMethod · 0.45
DrawElementsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected