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

Method SetStartState

Source/Graphics/drawbatch.cpp:334–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void DrawBatch::SetStartState() const {
335 Graphics *graphics = Graphics::Instance();
336 Shaders *shaders = Shaders::Instance();
337 Textures *textures = Textures::Instance();
338
339 graphics->setDepthFunc(depth_func);
340 graphics->setPolygonOffset(polygon_offset);
341 graphics->setGLState(gl_state);
342
343 shaders->setProgram(shader_id);
344
345 for (const auto &uniform : uniforms) {
346 uniform.Apply();
347 }
348
349 if (use_cam_pos) {
350 shaders->SetUniformVec3("cam_pos", ActiveCameras::Get()->GetPos());
351 }
352
353 if (use_time) {
354 shaders->SetUniformFloat("time", game_timer.GetRenderTime());
355 }
356
357 if (use_light) {
358 shaders->SetUniformVec3("ws_light", primary_light->pos);
359 shaders->SetUniformVec4("primary_light_color", vec4(primary_light->color, primary_light->intensity));
360 }
361
362 shaders->SetUniformVec4("uniform_color", color);
363
364 for (int i = 0; i < kMaxTextures; i++) {
365 if (texture_ref[i].valid()) {
366 textures->bindTexture(texture_ref[i], i);
367 }
368 }
369
370 if (transparent && graphics->use_sample_alpha_to_coverage) {
371 glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
372 }
373}
374
375void DrawBatch::EndVertexArrays() const {
376 for (int i = 1; i < 8; i++) {

Callers 3

DrawMethod · 0.80
DrawMethod · 0.80
DrawItemMethod · 0.80

Calls 14

setDepthFuncMethod · 0.80
setPolygonOffsetMethod · 0.80
setGLStateMethod · 0.80
setProgramMethod · 0.80
GetRenderTimeMethod · 0.80
bindTextureMethod · 0.80
vec4Class · 0.70
GetFunction · 0.50
ApplyMethod · 0.45
SetUniformVec3Method · 0.45
GetPosMethod · 0.45
SetUniformFloatMethod · 0.45

Tested by

no test coverage detected