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

Method SetViewportForCamera

Source/Main/engine.cpp:3271–3306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3269}
3270
3271void Engine::SetViewportForCamera(int which_cam, int num_screens, Graphics::ScreenType screen_type) {
3272 Graphics* graphics = Graphics::Instance();
3273 switch (which_cam) {
3274 case 0: // Draw the first screen, which might take up the whole viewport, or just half
3275 if (num_screens == 1) {
3276 active_screen_start = vec2(0.0f, 0.0f);
3277 active_screen_end = vec2(1.0f, 1.0f);
3278 } else if (num_screens == 2) {
3279 active_screen_start = vec2(0.0f, 0.0f);
3280 active_screen_end = vec2(1.0f, 0.5f);
3281 } else if (num_screens == 3 || num_screens == 4) {
3282 active_screen_start = vec2(0.0f, 0.0f);
3283 active_screen_end = vec2(0.5f, 0.5f);
3284 }
3285 break;
3286 case 1: // The second screen always just takes half the viewport
3287 if (num_screens == 2) {
3288 active_screen_start = vec2(0.0f, 0.5f);
3289 active_screen_end = vec2(1.0f, 1.0f);
3290 } else if (num_screens == 3 || num_screens == 4) {
3291 active_screen_start = vec2(0.5f, 0.0f);
3292 active_screen_end = vec2(1.0f, 0.5f);
3293 }
3294 break;
3295 case 2:
3296 active_screen_start = vec2(0.0f, 0.5f);
3297 active_screen_end = vec2(0.5f, 1.0f);
3298 break;
3299 case 3:
3300 active_screen_start = vec2(0.5f, 0.5f);
3301 active_screen_end = vec2(1.0f, 1.0f);
3302 break;
3303 }
3304
3305 graphics->startDraw(active_screen_start, active_screen_end, screen_type);
3306}
3307
3308void Engine::DrawCubeMap(TextureRef cube_map, const vec3& pos, GLuint cube_map_fbo, SceneGraph::SceneDrawType scene_draw_type) {
3309 GLuint cube_map_tex_id = Textures::Instance()->returnTexture(cube_map);

Callers

nothing calls this directly

Calls 2

startDrawMethod · 0.80
vec2Class · 0.50

Tested by

no test coverage detected