From 7c3f715f19c0ab70e21c42474f06454dab7877f4 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Sat, 20 Sep 2008 14:43:10 +0000 Subject: [PATCH] More fog emulation groundwork both in OpenGL and DX9. Needs more fog format researching. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@586 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/VideoCommon/Src/BPMemory.h | 1 + .../Plugins/Plugin_VideoDX9/Src/BPStructs.cpp | 20 ++++++++++++++----- .../Plugins/Plugin_VideoOGL/Src/BPStructs.cpp | 8 ++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index 7e029af09a..06c48d9351 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -39,6 +39,7 @@ #define BPMEM_CLEARBBOX2 0x56 // TODO(ector): add something that watches bboxes #define BPMEM_TEXMODE0_1 0x80 #define BPMEM_TEXMODE0_2 0xA0 +#define BPMEM_FOGRANGE 0xE8 #define BPMEM_FOGPARAM0 0xEE #define BPMEM_FOGBMAGNITUDE 0xEF #define BPMEM_FOGBEXPONENT 0xF0 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp index 87a7cbb6c6..630894e824 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp @@ -311,6 +311,14 @@ void BPWritten(int addr, int changes, int newval) } break; + case BPMEM_FOGRANGE: + if(changes) { + // TODO(XK): Fog range format + //Renderer::SetRenderState(D3DRS_FOGSTART, ... + //Renderer::SetRenderState(D3DRS_FOGEND, ... + } + break; + case BPMEM_FOGPARAM0: { // u32 fogATemp = bpmem.fog.a<<12; @@ -341,11 +349,7 @@ void BPWritten(int addr, int changes, int newval) /// u32 fogCTemp = bpmem.fog.c_proj_fsel.cShifted12 << 12; // float fogC = *(float*)(&fogCTemp); - if(bpmem.fog.c_proj_fsel.fsel > 0 && !bFog) { - Renderer::SetRenderState(D3DRS_FOGENABLE, true); - bFog = true; - } - + //printf("%f %f magnitude: %x\n", bpmem.fog.a.GetA(),bpmem.fog.c_proj_fsel.GetC(), bpmem.fog.b_magnitude); switch(bpmem.fog.c_proj_fsel.fsel) { @@ -373,6 +377,12 @@ void BPWritten(int addr, int changes, int newval) PanicAlert("Non-Emulated Fog selection %d\n", bpmem.fog.c_proj_fsel.fsel); break; } + + if(bpmem.fog.c_proj_fsel.fsel > 0 && !bFog) { + Renderer::SetRenderState(D3DRS_FOGENABLE, true); + bFog = true; + } + } break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp index eb8c3978a2..282d29adad 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp @@ -256,6 +256,14 @@ void BPWritten(int addr, int changes, int newval) } break; + case BPMEM_FOGRANGE: + if(changes) { + // TODO(XK): Fog range format + //glFogi(GL_FOG_START, ... + //glFogi(GL_FOG_END, ... + } + break; + case BPMEM_FOGPARAM0: case BPMEM_FOGBEXPONENT: case BPMEM_FOGBMAGNITUDE: