mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Created a free look utility which only works on win32 right now. It lets the user fly around with the mouse and keyboard. Had to add some ugly matrix functions to the math utilities.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3005 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -235,7 +235,7 @@ void Flush()
|
||||
if (numVertices)
|
||||
{
|
||||
// set global constants
|
||||
VertexShaderManager::SetConstants(false, false);
|
||||
VertexShaderManager::SetConstants(false, false, false);
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
PixelShaderCache::SetShader();
|
||||
|
@ -62,6 +62,7 @@ void Config::Load()
|
||||
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
||||
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
|
||||
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
|
||||
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
|
||||
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
||||
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
||||
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
||||
@ -147,6 +148,7 @@ void Config::Save()
|
||||
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
||||
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
|
||||
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
|
||||
iniFile.Set("Settings", "FreeLook", bFreeLook);
|
||||
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
|
||||
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
||||
iniFile.Set("Settings", "MSAA", iMultisampleMode);
|
||||
|
@ -86,6 +86,7 @@ struct Config
|
||||
bool bDumpTextures;
|
||||
bool bDumpEFBTarget;
|
||||
bool bDumpFrames;
|
||||
bool bFreeLook;
|
||||
|
||||
// Hacks
|
||||
bool bEFBCopyDisable;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "../Config.h"
|
||||
|
||||
#include "../TextureMngr.h"
|
||||
#include "VertexShaderManager.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CLOSE(ConfigDialog::OnClose)
|
||||
@ -54,7 +55,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CHECKBOX(ID_TEXFMTCENTER, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DUMPTEXTURES, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DUMPEFBTARGET, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DUMPFRAMES, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DUMPFRAMES, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_FREELOOK, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLELIGHTING, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLETEXTURING, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLEFOG, ConfigDialog::AdvancedSettingsChanged)
|
||||
@ -350,6 +352,8 @@ void ConfigDialog::CreateGUIControls()
|
||||
" set up for the dump or several gigabytes of space available."));
|
||||
#endif
|
||||
m_DumpFrames->SetValue(g_Config.bDumpFrames);
|
||||
m_FreeLook = new wxCheckBox(m_PageAdvanced, ID_FREELOOK, wxT("Free Look"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_FreeLook->SetValue(g_Config.bFreeLook);
|
||||
|
||||
// Hacks controls
|
||||
m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
@ -415,10 +419,12 @@ void ConfigDialog::CreateGUIControls()
|
||||
sRenderBoxRow1->Add(sSBox, 0, wxALL|wxEXPAND, 5);
|
||||
sbRendering->Add(sRenderBoxRow1);
|
||||
|
||||
sUtilities = new wxBoxSizer(wxHORIZONTAL);
|
||||
sUtilities->Add(m_DumpTextures, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_DumpEFBTarget, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_DumpFrames, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
//sUtilities = new wxBoxSizer(wxHORIZONTAL);
|
||||
sUtilities = new wxGridBagSizer(0, 0);
|
||||
sUtilities->Add(m_DumpTextures, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_DumpEFBTarget, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_DumpFrames, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_FreeLook, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sbUtilities->Add(sUtilities, 1, wxEXPAND);
|
||||
|
||||
// Sizers
|
||||
@ -558,6 +564,9 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
case ID_DUMPFRAMES:
|
||||
g_Config.bDumpFrames = m_DumpFrames->IsChecked();
|
||||
break;
|
||||
case ID_FREELOOK:
|
||||
g_Config.bFreeLook = m_FreeLook->IsChecked();
|
||||
break;
|
||||
case ID_TEXTUREPATH:
|
||||
break;
|
||||
case ID_CHECKBOX_DISABLECOPYEFB:
|
||||
|
@ -64,7 +64,7 @@ class ConfigDialog : public wxDialog
|
||||
wxStaticBoxSizer* sbRendering;
|
||||
wxGridBagSizer* sRendering;
|
||||
wxStaticBoxSizer* sbUtilities;
|
||||
wxBoxSizer* sUtilities;
|
||||
wxGridBagSizer* sUtilities;
|
||||
wxStaticBoxSizer* sbHacks;
|
||||
wxGridBagSizer* sHacks;
|
||||
|
||||
@ -108,6 +108,7 @@ class ConfigDialog : public wxDialog
|
||||
wxCheckBox *m_DumpTextures;
|
||||
wxCheckBox *m_DumpEFBTarget;
|
||||
wxCheckBox *m_DumpFrames;
|
||||
wxCheckBox *m_FreeLook;
|
||||
wxStaticBox * m_StaticBox_EFB;
|
||||
wxCheckBox *m_CheckBox_DisableCopyEFB;
|
||||
wxRadioButton *m_Radio_CopyEFBToRAM, *m_Radio_CopyEFBToGL;
|
||||
@ -167,6 +168,7 @@ class ConfigDialog : public wxDialog
|
||||
ID_DUMPTEXTURES,
|
||||
ID_DUMPEFBTARGET,
|
||||
ID_DUMPFRAMES,
|
||||
ID_FREELOOK,
|
||||
ID_TEXTUREPATH,
|
||||
|
||||
ID_CHECKBOX_DISABLECOPYEFB,
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "main.h"
|
||||
#include "Win32.h"
|
||||
#include "OnScreenDisplay.h"
|
||||
#include "VertexShaderManager.h"
|
||||
|
||||
#include "StringUtil.h"
|
||||
|
||||
@ -138,6 +139,65 @@ HWND GetChildParentWnd()
|
||||
return m_hMain;
|
||||
}
|
||||
|
||||
void FreeLookInput( UINT iMsg, WPARAM wParam )
|
||||
{
|
||||
static float debugSpeed = 1.0f;
|
||||
static bool mouseLookEnabled = false;
|
||||
static float lastMouse[2];
|
||||
|
||||
switch( iMsg )
|
||||
{
|
||||
|
||||
case WM_KEYDOWN:
|
||||
switch( LOWORD( wParam ))
|
||||
{
|
||||
case '9':
|
||||
debugSpeed /= 2.0f;
|
||||
break;
|
||||
case '0':
|
||||
debugSpeed *= 2.0f;
|
||||
break;
|
||||
case 'W':
|
||||
VertexShaderManager::TranslateView(0.0f, debugSpeed);
|
||||
break;
|
||||
case 'S':
|
||||
VertexShaderManager::TranslateView(0.0f, -debugSpeed);
|
||||
break;
|
||||
case 'A':
|
||||
VertexShaderManager::TranslateView(debugSpeed, 0.0f);
|
||||
break;
|
||||
case 'D':
|
||||
VertexShaderManager::TranslateView(-debugSpeed, 0.0f);
|
||||
break;
|
||||
case 'R':
|
||||
VertexShaderManager::ResetView();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (mouseLookEnabled) {
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
VertexShaderManager::RotateView((point.x - lastMouse[0]) / 200.0f, (point.y - lastMouse[1]) / 200.0f);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
POINT point;
|
||||
GetCursorPos(&point);
|
||||
lastMouse[0] = point.x;
|
||||
lastMouse[1] = point.y;
|
||||
mouseLookEnabled= true;
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
mouseLookEnabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HDC hdc;
|
||||
@ -298,6 +358,10 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_Config.bFreeLook) {
|
||||
FreeLookInput( iMsg, wParam );
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ void Flush()
|
||||
Renderer::SetRenderMode(Renderer::RM_Normal);
|
||||
|
||||
// set global constants
|
||||
VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bSMGhack);
|
||||
VertexShaderManager::SetConstants(g_Config.bProjectionHax1, g_Config.bSMGhack, g_Config.bFreeLook);
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
// finally bind
|
||||
|
Reference in New Issue
Block a user