OLD | NEW |
1 /* | 1 /* |
2 * $Id$ | 2 * $Id$ |
3 * | 3 * |
4 * ***** BEGIN GPL LICENSE BLOCK ***** | 4 * ***** BEGIN GPL LICENSE BLOCK ***** |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or | 6 * This program is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License | 7 * modify it under the terms of the GNU General Public License |
8 * as published by the Free Software Foundation; either version 2 | 8 * as published by the Free Software Foundation; either version 2 |
9 * of the License, or (at your option) any later version. | 9 * of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 #ifdef WIN32 | 36 #ifdef WIN32 |
37 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning | 37 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning |
38 #include <windows.h> | 38 #include <windows.h> |
39 #endif | 39 #endif |
40 | 40 |
41 #include "GL/glew.h" | 41 #include "GL/glew.h" |
42 #include "GPU_extensions.h" | 42 #include "GPU_extensions.h" |
43 | 43 |
44 #include "GPG_Application.h" | 44 #include "GPG_Application.h" |
| 45 #include "BL_BlenderDataConversion.h" |
45 | 46 |
46 #include <iostream> | 47 #include <iostream> |
47 #include <MT_assert.h> | 48 #include <MT_assert.h> |
48 #include <stdlib.h> | 49 #include <stdlib.h> |
49 | 50 |
50 /********************************** | 51 /********************************** |
51 * Begin Blender include block | 52 * Begin Blender include block |
52 **********************************/ | 53 **********************************/ |
53 #ifdef __cplusplus | 54 #ifdef __cplusplus |
54 extern "C" | 55 extern "C" |
(...skipping 15 matching lines...) Expand all Loading... |
70 | 71 |
71 | 72 |
72 #include "BL_System.h" | 73 #include "BL_System.h" |
73 #include "KX_KetsjiEngine.h" | 74 #include "KX_KetsjiEngine.h" |
74 | 75 |
75 // include files needed by "KX_BlenderSceneConverter.h" | 76 // include files needed by "KX_BlenderSceneConverter.h" |
76 #include "CTR_Map.h" | 77 #include "CTR_Map.h" |
77 #include "SCA_IActuator.h" | 78 #include "SCA_IActuator.h" |
78 #include "RAS_MeshObject.h" | 79 #include "RAS_MeshObject.h" |
79 #include "RAS_OpenGLRasterizer.h" | 80 #include "RAS_OpenGLRasterizer.h" |
80 #include "RAS_VAOpenGLRasterizer.h" | |
81 #include "RAS_ListRasterizer.h" | 81 #include "RAS_ListRasterizer.h" |
82 #include "RAS_GLExtensionManager.h" | 82 #include "RAS_GLExtensionManager.h" |
83 #include "KX_PythonInit.h" | 83 #include "KX_PythonInit.h" |
84 #include "KX_PyConstraintBinding.h" | 84 #include "KX_PyConstraintBinding.h" |
85 #include "BL_Material.h" // MAXTEX | 85 #include "BL_Material.h" // MAXTEX |
86 | 86 |
87 #include "KX_BlenderSceneConverter.h" | 87 #include "KX_BlenderSceneConverter.h" |
88 #include "NG_LoopBackNetworkDeviceInterface.h" | 88 #include "NG_LoopBackNetworkDeviceInterface.h" |
89 | 89 |
90 #include "GPC_MouseDevice.h" | 90 #include "GPC_MouseDevice.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return success; | 363 return success; |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 bool GPG_Application::startFullScreen( | 367 bool GPG_Application::startFullScreen( |
368 int width, | 368 int width, |
369 int height, | 369 int height, |
370 int bpp,int frequency, | 370 int bpp,int frequency, |
371 const bool stereoVisual, | 371 const bool stereoVisual, |
372 const int stereoMode, | 372 const int stereoMode, |
373 » » const GHOST_TUns16 samples) | 373 » » const GHOST_TUns16 samples, |
| 374 » » bool useDesktop) |
374 { | 375 { |
375 bool success; | 376 bool success; |
| 377 GHOST_TUns32 sysWidth=0, sysHeight=0; |
| 378 fSystem->getMainDisplayDimensions(sysWidth, sysHeight); |
376 // Create the main window | 379 // Create the main window |
377 GHOST_DisplaySetting setting; | 380 GHOST_DisplaySetting setting; |
378 » setting.xPixels = width; | 381 » setting.xPixels = (useDesktop) ? sysWidth : width; |
379 » setting.yPixels = height; | 382 » setting.yPixels = (useDesktop) ? sysHeight : height; |
380 setting.bpp = bpp; | 383 setting.bpp = bpp; |
381 setting.frequency = frequency; | 384 setting.frequency = frequency; |
382 | 385 |
383 » fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual); | 386 » fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual, samples); |
384 m_mainWindow->setCursorVisibility(false); | 387 m_mainWindow->setCursorVisibility(false); |
385 m_mainWindow->setState(GHOST_kWindowStateFullScreen); | 388 m_mainWindow->setState(GHOST_kWindowStateFullScreen); |
386 | 389 |
387 success = initEngine(m_mainWindow, stereoMode); | 390 success = initEngine(m_mainWindow, stereoMode); |
388 if (success) { | 391 if (success) { |
389 success = startEngine(); | 392 success = startEngine(); |
390 } | 393 } |
391 return success; | 394 return success; |
392 } | 395 } |
393 | 396 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 return false; | 564 return false; |
562 ································ | 565 ································ |
563 m_canvas->Init(); | 566 m_canvas->Init(); |
564 if (gm->flag & GAME_SHOW_MOUSE) | 567 if (gm->flag & GAME_SHOW_MOUSE) |
565 m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);··································· | 568 m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);··································· |
566 | 569 |
567 m_rendertools = new GPC_RenderTools(); | 570 m_rendertools = new GPC_RenderTools(); |
568 if (!m_rendertools) | 571 if (!m_rendertools) |
569 goto initFailed; | 572 goto initFailed; |
570 ················ | 573 ················ |
571 » » if(useLists) { | 574 » » //Don't use displaylists with VBOs |
572 » » » if(GLEW_VERSION_1_1) | 575 » » //If auto starts using VBOs, make sure to check for that here |
573 » » » » m_rasterizer = new RAS_ListRasterizer(m_canvas,
true); | 576 » » if(useLists && gm->raster_storage != RAS_STORE_VBO) |
574 » » » else | 577 » » » m_rasterizer = new RAS_ListRasterizer(m_canvas, false, g
m->raster_storage); |
575 » » » » m_rasterizer = new RAS_ListRasterizer(m_canvas); | |
576 » » } | |
577 » » else if (GLEW_VERSION_1_1) | |
578 » » » m_rasterizer = new RAS_VAOpenGLRasterizer(m_canvas); | |
579 else | 578 else |
580 » » » m_rasterizer = new RAS_OpenGLRasterizer(m_canvas); | 579 » » » m_rasterizer = new RAS_OpenGLRasterizer(m_canvas, gm->ra
ster_storage); |
581 | 580 |
582 /* Stereo parameters - Eye Separation from the UI - stereomode f
rom the command-line/UI */ | 581 /* Stereo parameters - Eye Separation from the UI - stereomode f
rom the command-line/UI */ |
583 m_rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) stereo
Mode); | 582 m_rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) stereo
Mode); |
584 m_rasterizer->SetEyeSeparation(m_startScene->gm.eyeseparation); | 583 m_rasterizer->SetEyeSeparation(m_startScene->gm.eyeseparation); |
585 ················ | 584 ················ |
586 if (!m_rasterizer) | 585 if (!m_rasterizer) |
587 goto initFailed; | 586 goto initFailed; |
588 ················································ | 587 ················································ |
589 // create the inputdevices | 588 // create the inputdevices |
590 m_keyboard = new GPG_KeyboardDevice(); | 589 m_keyboard = new GPG_KeyboardDevice(); |
(...skipping 20 matching lines...) Expand all Loading... |
611 m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); | 610 m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); |
612 ················ | 611 ················ |
613 // set the devices | 612 // set the devices |
614 m_ketsjiengine->SetKeyboardDevice(m_keyboard); | 613 m_ketsjiengine->SetKeyboardDevice(m_keyboard); |
615 m_ketsjiengine->SetMouseDevice(m_mouse); | 614 m_ketsjiengine->SetMouseDevice(m_mouse); |
616 m_ketsjiengine->SetNetworkDevice(m_networkdevice); | 615 m_ketsjiengine->SetNetworkDevice(m_networkdevice); |
617 m_ketsjiengine->SetCanvas(m_canvas); | 616 m_ketsjiengine->SetCanvas(m_canvas); |
618 m_ketsjiengine->SetRenderTools(m_rendertools); | 617 m_ketsjiengine->SetRenderTools(m_rendertools); |
619 m_ketsjiengine->SetRasterizer(m_rasterizer); | 618 m_ketsjiengine->SetRasterizer(m_rasterizer); |
620 | 619 |
| 620 ················ |
| 621 ················ |
| 622 |
| 623 m_ketsjiengine->SetExitKey(ConvertKeyCode(gm->exitkey)); |
621 m_ketsjiengine->SetTimingDisplay(frameRate, false, false); | 624 m_ketsjiengine->SetTimingDisplay(frameRate, false, false); |
622 #ifdef WITH_PYTHON | 625 #ifdef WITH_PYTHON |
623 CValue::SetDeprecationWarnings(nodepwarnings); | 626 CValue::SetDeprecationWarnings(nodepwarnings); |
624 #else | 627 #else |
625 (void)nodepwarnings; | 628 (void)nodepwarnings; |
626 #endif | 629 #endif |
627 | 630 |
628 m_ketsjiengine->SetUseFixedTime(fixed_framerate); | 631 m_ketsjiengine->SetUseFixedTime(fixed_framerate); |
629 m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties)
; | 632 m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties)
; |
630 m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); | 633 m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 894 |
892 | 895 |
893 bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown) | 896 bool GPG_Application::handleKey(GHOST_IEvent* event, bool isDown) |
894 { | 897 { |
895 bool handled = false; | 898 bool handled = false; |
896 MT_assert(event); | 899 MT_assert(event); |
897 if (m_keyboard) | 900 if (m_keyboard) |
898 { | 901 { |
899 GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(
); | 902 GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(
); |
900 GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>
(eventData); | 903 GHOST_TEventKeyData* keyData = static_cast<GHOST_TEventKeyData*>
(eventData); |
901 » » //no need for this test | 904 |
902 » » //if (fSystem->getFullScreen()) { | 905 » » if (m_keyboard->ToNative(keyData->key) == KX_KetsjiEngine::GetEx
itKey() && !m_keyboard->m_hookesc && !m_isEmbedded) { |
903 » » » if (keyData->key == GHOST_kKeyEsc && !m_keyboard->m_hook
esc && !m_isEmbedded) { | 906 » » » m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; |
904 » » » » m_exitRequested = KX_EXIT_REQUEST_OUTSIDE; | 907 » » } |
905 » » » } | |
906 » » //} | |
907 m_keyboard->ConvertEvent(keyData->key, isDown); | 908 m_keyboard->ConvertEvent(keyData->key, isDown); |
908 handled = true; | 909 handled = true; |
909 } | 910 } |
910 return handled; | 911 return handled; |
911 } | 912 } |
912 | 913 |
913 | 914 |
914 | 915 |
915 static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time) | 916 static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time) |
916 { | 917 { |
917 GHOST_IWindow* window = (GHOST_IWindow*)task->getUserData(); | 918 GHOST_IWindow* window = (GHOST_IWindow*)task->getUserData(); |
918 if (fSystem->validWindow(window)) { | 919 if (fSystem->validWindow(window)) { |
919 window->invalidate(); | 920 window->invalidate(); |
920 } | 921 } |
921 } | 922 } |
OLD | NEW |