Commit MetaInfo

修订版31a47e0457603e46f725125fad0912844657075d (tree)
时间2011-06-04 07:00:00
作者Jarmonik
CommiterJarmonik

Log Message

D3D9Client: Atlantis MFD bug fixed

更改概述

差异

diff -r 9f47a5a6905d -r 31a47e045760 D3D9Client.cfg
--- a/D3D9Client.cfg Mon Oct 24 14:32:30 2011 +0200
+++ b/D3D9Client.cfg Sat Jun 04 00:00:00 2011 +0200
@@ -3,10 +3,11 @@
33 PlanetAnisoMode = 2
44 PlanetMipmapMode = 1
55 PlanetMipmapBias = 0
6-DebugLvl = 1
7-VCNearPlane = 0.16
6+DebugLvl = 2
7+VCNearPlane = 0.02
88 LightSourcesInUse = 12
99 MemAllocLogic = 0
1010 DisableDrvMgm = 0
1111 NearClipPlaneMode = 0
1212 InSurfaceBlit = font1tex.dds Cockpit\hud.dds DG\dg_panel.dds Cockpit\hud_red.dds Cockpit\hud_blue.dds Cockpit\hud_yellow.dds
13+NVPerfHUD = 0
diff -r 9f47a5a6905d -r 31a47e045760 Modules/D3D9Client/D3D9Client.fx
--- a/Modules/D3D9Client/D3D9Client.fx Mon Oct 24 14:32:30 2011 +0200
+++ b/Modules/D3D9Client/D3D9Client.fx Sat Jun 04 00:00:00 2011 +0200
@@ -37,14 +37,14 @@
3737 uniform extern float4x4 gGrpT; // Mesh group transformation matrix
3838 uniform extern float4 gAttennuate; // Attennuation of fragment color
3939 uniform extern float4 gInScatter; // In scattering light
40-uniform extern float4 gColor;
41-uniform extern float4 gFogColor;
40+uniform extern float4 gColor; // General purpose color parameter
41+uniform extern float4 gFogColor; // Distance fog color in "Legacy" implementation
4242 uniform extern float4 gTexOff;
4343 uniform extern float4 gRadius; // PlanetRad, AtmOuterLimit, CameraRad, CameraAlt
4444 uniform extern float3 gCameraPos; // Planet relative camera position, Unit vector
4545 uniform extern Light gLights[12];
4646 uniform extern int gLightCount;
47-uniform extern Light gSun; // Light input structure
47+uniform extern Light gSun; // Sun light input structure
4848 uniform extern Mtrl gMat; // Material input structure
4949 uniform extern Mtrl gWater; // Water material input structure
5050 uniform extern bool gModAlpha; // Configuration input
@@ -56,10 +56,9 @@
5656 uniform extern float gFogDensity;
5757 uniform extern float gTime;
5858 uniform extern float gMix; // Day/Night ration, MFD Scale factor, Cloud micro texture intensity
59-uniform extern texture gTex0; // Diffuse texture
60-uniform extern texture gTex1; // Night texture
61-uniform extern texture gTex2; // Specular map
62-uniform extern texture gTex3; // Micro texture
59+uniform extern texture gTex0;
60+uniform extern texture gTex1;
61+uniform extern texture gTex3;
6362
6463 // Legacy Atmosphere --------------------------------------------------------
6564
@@ -125,10 +124,22 @@
125124 // Texture Sampler implementations
126125 // -------------------------------------------------------------------------------------------------------------
127126
128-sampler Tex0S = sampler_state
127+sampler Tex0S = sampler_state // Primary Mesh texture sampler
129128 {
130129 Texture = <gTex0>;
131- MinFilter = Anisotropic;
130+ MinFilter = ANISOTROPIC;
131+ MagFilter = LINEAR;
132+ MipFilter = LINEAR;
133+ MaxAnisotropy = 4;
134+ MipMapLODBias = 0;
135+ AddressU = WRAP;
136+ AddressV = WRAP;
137+};
138+
139+sampler Tex1S = sampler_state // Secundary mesh texture sampler (i.e. night texture)
140+{
141+ Texture = <gTex1>;
142+ MinFilter = ANISOTROPIC;
132143 MagFilter = LINEAR;
133144 MipFilter = LINEAR;
134145 MaxAnisotropy = 4;
@@ -136,18 +147,18 @@
136147 AddressV = WRAP;
137148 };
138149
139-sampler MFDSamp = sampler_state
150+sampler MFDSamp = sampler_state // Virtual Cockpit MFD screen sampler
140151 {
141152 Texture = <gTex0>;
142153 MinFilter = ANISOTROPIC;
143154 MagFilter = LINEAR;
144- MipFilter = NONE;
155+ MipFilter = LINEAR;
145156 MaxAnisotropy = 4;
146157 AddressU = CLAMP;
147158 AddressV = CLAMP;
148159 };
149160
150-sampler Panel0S = sampler_state
161+sampler Panel0S = sampler_state // Sampler for mesh based panels. Must be compatible with Non-power of two conditional
151162 {
152163 Texture = <gTex0>;
153164 MinFilter = NONE;
@@ -157,19 +168,8 @@
157168 AddressV = CLAMP;
158169 };
159170
160-sampler Tex1S = sampler_state
161-{
162- Texture = <gTex1>;
163- MinFilter = Anisotropic;
164- MagFilter = LINEAR;
165- MipFilter = LINEAR;
166- MaxAnisotropy = 4;
167- AddressU = WRAP;
168- AddressV = WRAP;
169-};
170171
171-
172-sampler Tile0S = sampler_state
172+sampler Tile0S = sampler_state // Base tile sampler
173173 {
174174 Texture = <gTex0>;
175175 MinFilter = LINEAR;
@@ -192,7 +192,7 @@
192192 AddressV = MIRROR;
193193 };
194194
195-sampler RingS = sampler_state
195+sampler RingS = sampler_state // Planetary rings sampler
196196 {
197197 Texture = <gTex0>;
198198 MinFilter = LINEAR;
@@ -204,13 +204,13 @@
204204 };
205205
206206
207+
207208 // Planet surface samplers -----------------------------------------------------
208209
209-
210-sampler Planet0S = sampler_state
210+sampler Planet0S = sampler_state // Planet/Cloud diffuse texture sampler
211211 {
212212 Texture = <gTex0>;
213- MinFilter = Anisotropic;
213+ MinFilter = ANISOTROPIC;
214214 MagFilter = LINEAR;
215215 MipFilter = LINEAR;
216216 MaxAnisotropy = 4;
@@ -218,10 +218,10 @@
218218 AddressV = CLAMP;
219219 };
220220
221-sampler Planet1S = sampler_state
221+sampler Planet1S = sampler_state // Planet nightlights/specular mask sampler
222222 {
223223 Texture = <gTex1>;
224- MinFilter = Anisotropic;
224+ MinFilter = ANISOTROPIC;
225225 MagFilter = LINEAR;
226226 MipFilter = LINEAR;
227227 MaxAnisotropy = 2;
@@ -229,21 +229,10 @@
229229 AddressV = CLAMP;
230230 };
231231
232-sampler Planet2S = sampler_state
233-{
234- Texture = <gTex2>;
235- MinFilter = Anisotropic;
236- MagFilter = LINEAR;
237- MipFilter = LINEAR;
238- MaxAnisotropy = 2;
239- AddressU = CLAMP;
240- AddressV = CLAMP;
241-};
242-
243-sampler Planet3S = sampler_state
232+sampler Planet3S = sampler_state // Planet/Cloud micro texture sampler
244233 {
245234 Texture = <gTex3>;
246- MinFilter = Anisotropic;
235+ MinFilter = ANISOTROPIC;
247236 MagFilter = LINEAR;
248237 MipFilter = LINEAR;
249238 MaxAnisotropy = 2;
@@ -277,7 +266,7 @@
277266 else if (gHazeMode==2) {
278267 float fogFact = 1.0f / exp(max(0,depth) * gFogDensity);
279268 att = fogFact;
280- ins = float4((1.0f-fogFact) * gFogColor.rgb, 0.0f);
269+ ins = half4((1.0f-fogFact) * gFogColor.rgb, 0.0f);
281270 return;
282271 }
283272 }
diff -r 9f47a5a6905d -r 31a47e045760 Modules/Plugin/D3D9Client.dll
Binary file Modules/Plugin/D3D9Client.dll has changed
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/ChangeLog.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Orbitersdk/D3D9Client/ChangeLog.txt Sat Jun 04 00:00:00 2011 +0200
@@ -0,0 +1,5 @@
1+D3D9Client Change Log
2+
3+RC2
4+- Shadow position bug fixed
5+- MFD and Multisampling conflict fixed from old style panels.
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Client.cpp
--- a/Orbitersdk/D3D9Client/D3D9Client.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Client.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -184,7 +184,7 @@
184184
185185 LogOk("Starting to initialize device and 3D environment...");
186186
187- HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData(), cfg->DisableDriverManagement);
187+ HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData(), bool(cfg->DisableDriverManagement), bool(cfg->NVPerfHUD));
188188
189189 if (hr!=S_OK) {
190190 WriteLog("ERROR: Failed to initialize 3D Framework");
@@ -1117,7 +1117,7 @@
11171117 SetTextColor(hDC, 0xC08080);
11181118 SetBkMode(hDC,TRANSPARENT);
11191119 char data[128];
1120- sprintf_s(data,128,"D3D9Client RC21 Build [%s]",__DATE__);
1120+ sprintf_s(data,128,"D3D9Client RC22 Build [%s]",__DATE__);
11211121 TextOut(hDC,viewW*1018/1600, viewH*705/875 + 2*18, data, strlen(data));
11221122
11231123 SelectObject(hDC, hO);
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Config.cpp
--- a/Orbitersdk/D3D9Client/D3D9Config.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Config.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -17,6 +17,7 @@
1717 int D3D9Config::def_MemoryLogic = 0;
1818 int D3D9Config::def_DisableDriverManagement = 0;
1919 int D3D9Config::def_NearClipPlane = 0;
20+int D3D9Config::def_NVPerfHUD = 0;
2021
2122
2223 // ==============================================================
@@ -44,6 +45,7 @@
4445 MaxLights = def_MaxLights;
4546 MemoryLogic = def_MemoryLogic;
4647 NearClipPlane = def_NearClipPlane;
48+ NVPerfHUD = def_NVPerfHUD;
4749
4850 DisableDriverManagement = def_DisableDriverManagement;
4951
@@ -71,6 +73,7 @@
7173 if (oapiReadItem_int (hFile, "MemAllocLogic", i)) MemoryLogic = i;
7274 if (oapiReadItem_int (hFile, "DisableDrvMgm", i)) DisableDriverManagement = i;
7375 if (oapiReadItem_int (hFile, "NearClipPlaneMode", i)) NearClipPlane = i;
76+ if (oapiReadItem_int (hFile, "NVPerfHUD", i)) NVPerfHUD = i;
7477
7578 oapiReadItem_string (hFile, "InSurfaceBlit", InSurface);
7679
@@ -94,6 +97,7 @@
9497 oapiWriteItem_int (hFile, "DisableDrvMgm", DisableDriverManagement);
9598 oapiWriteItem_int (hFile, "NearClipPlaneMode", NearClipPlane);
9699 oapiWriteItem_string (hFile, "InSurfaceBlit", InSurface);
100+ oapiWriteItem_int (hFile, "NVPerfHUD", NVPerfHUD);
97101
98102 oapiCloseFile (hFile, FILE_OUT);
99103 }
\ No newline at end of file
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Config.h
--- a/Orbitersdk/D3D9Client/D3D9Config.h Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Config.h Sat Jun 04 00:00:00 2011 +0200
@@ -23,6 +23,7 @@
2323 double VCNearPlane;
2424 int DebugLvl;
2525 int MaxLights;
26+ int NVPerfHUD;
2627 char *InSurface;
2728 char *GDISurface;
2829 char *NoAlpha;
@@ -40,6 +41,7 @@
4041 static int def_MaxLights;
4142 static int def_MemoryLogic;
4243 static int def_DisableDriverManagement;
44+ static int def_NVPerfHUD;
4345 };
4446
4547 #endif // !__D3D9CONFIG_H
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Effect.cpp
--- a/Orbitersdk/D3D9Client/D3D9Effect.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Effect.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -54,7 +54,6 @@
5454
5555 D3DXHANDLE D3D9Effect::eTex0 = 0;
5656 D3DXHANDLE D3D9Effect::eTex1 = 0;
57-D3DXHANDLE D3D9Effect::eTex2 = 0;
5857 D3DXHANDLE D3D9Effect::eTex3 = 0;
5958
6059 D3DXHANDLE D3D9Effect::eSpecularMode = 0;
@@ -188,7 +187,6 @@
188187
189188 eTex0 = FX->GetParameterByName(0,"gTex0");
190189 eTex1 = FX->GetParameterByName(0,"gTex1");
191- eTex2 = FX->GetParameterByName(0,"gTex2");
192190 eTex3 = FX->GetParameterByName(0,"gTex3");
193191
194192 eGlobalAmb = FX->GetParameterByName(0,"gGlobalAmb");
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Effect.h
--- a/Orbitersdk/D3D9Client/D3D9Effect.h Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Effect.h Sat Jun 04 00:00:00 2011 +0200
@@ -91,7 +91,6 @@
9191 // Textures --------------------------------------------------------
9292 static D3DXHANDLE eTex0;
9393 static D3DXHANDLE eTex1;
94- static D3DXHANDLE eTex2;
9594 static D3DXHANDLE eTex3;
9695
9796 // Legacy Atmosphere -----------------------------------------------
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Frame.cpp
--- a/Orbitersdk/D3D9Client/D3D9Frame.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Frame.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -113,10 +113,12 @@
113113 // Name: Initialize()
114114 // Desc: Creates the internal objects for the framework
115115 //-----------------------------------------------------------------------------
116-HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData, bool _ddm)
116+HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData, bool _ddm, bool _nvPerfHud)
117117 {
118118 _TRACE;
119119
120+ nvPerfHud = _nvPerfHud;
121+
120122 bool bFail = false;
121123
122124 Clear();
@@ -427,18 +429,17 @@
427429
428430 if (SWVert) devBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
429431 else devBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
430-
431432 if (Pure) devBehaviorFlags |= D3DCREATE_PUREDEVICE;
432-
433433 if (DDM) devBehaviorFlags |= D3DCREATE_DISABLE_DRIVER_MANAGEMENT;
434434
435435
436-
437436 HRESULT hr = 0;
438437
439- /*
440- if (Adapter==1) {
441- hr = pD3D->CreateDevice(
438+ if (nvPerfHud && Adapter==1) {
439+
440+ LogErr("[WARNING] NVPerfHUD mode is Active (Disable from D3D9Client.cfg) [WARNING]");
441+
442+ hr = pD3D->CreateDevice(
442443 Adapter, // primary adapter
443444 D3DDEVTYPE_REF, // device type
444445 hWnd, // window associated with device
@@ -446,18 +447,17 @@
446447 &d3dPP, // present parameters
447448 &pd3dDevice); // return created device
448449 }
449-
450- if (Adapter==0) {
451- */
452- hr = pD3D->CreateDevice(
450+ else {
451+
452+ hr = pD3D->CreateDevice(
453453 Adapter, // primary adapter
454454 D3DDEVTYPE_HAL, // device type
455455 hWnd, // window associated with device
456456 devBehaviorFlags|D3DCREATE_MULTITHREADED|D3DCREATE_FPU_PRESERVE,
457457 &d3dPP, // present parameters
458458 &pd3dDevice); // return created device
459- /*}*/
460-
459+ }
460+
461461 if (hr!=S_OK) LogErr("CreateDevice() Failed");
462462
463463 // Get Backbuffer
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Frame.h
--- a/Orbitersdk/D3D9Client/D3D9Frame.h Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Frame.h Sat Jun 04 00:00:00 2011 +0200
@@ -43,6 +43,7 @@
4343 BOOL Pure;
4444 BOOL DDM;
4545 BOOL bGDIBB;
46+ BOOL nvPerfHud;
4647 DWORD dwRenderWidth; // Dimensions of the render target
4748 DWORD dwRenderHeight;
4849 LPDIRECT3D9 pD3D; // The Direct3D object
@@ -95,7 +96,7 @@
9596
9697
9798 // Creates the Framework
98- HRESULT Initialize(HWND hWnd, struct oapi::GraphicsClient::VIDEODATA *vData, bool _ddm);
99+ HRESULT Initialize(HWND hWnd, struct oapi::GraphicsClient::VIDEODATA *vData, bool _ddm, bool nvPerfHud);
99100
100101 HRESULT DestroyObjects();
101102
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/D3D9Surface.cpp
--- a/Orbitersdk/D3D9Client/D3D9Surface.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/D3D9Surface.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -265,6 +265,7 @@
265265
266266 //HR(D3DXCreateTexture(pDevice, Width, Height, 0, D3DUSAGE_DYNAMIC | D3DUSAGE_AUTOGENMIPMAP, Format, D3DPOOL_DEFAULT, &pTex));
267267 HR(pDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC | D3DUSAGE_AUTOGENMIPMAP, Format, D3DPOOL_DEFAULT, &pTex, NULL));
268+ //HR(pDevice->CreateTexture(Width, Height, 1, D3DUSAGE_AUTOGENMIPMAP, Format, D3DPOOL_DEFAULT, &pTex, NULL));
268269
269270 GetDesc(&desc);
270271 LogBlu("D3D9ClientSurface: New Texture Surface(0x%X) w=%u, h=%u", this, Width, Height);
@@ -927,6 +928,7 @@
927928 pSrc->Release();
928929 pBak->Release();
929930 pTex->GenerateMipSubLevels();
931+ //LogErr("Initial=%u New=%u",levels,pTex->GetLevelCount());
930932 }
931933 else {
932934 LPDIRECT3DSURFACE9 pSrc, pTgt;
@@ -938,6 +940,7 @@
938940 pSrc->Release();
939941 pBak->Release();
940942 pTex->GenerateMipSubLevels();
943+ //LogErr("Initial=%u New=%u",levels,pTex->GetLevelCount());
941944 }
942945
943946 GetDesc(&desc);
@@ -1022,7 +1025,7 @@
10221025 if (D3DXLoadSurfaceFromFileA(pSurf, NULL, NULL, cpath, NULL, D3DX_DEFAULT, 0, NULL)==S_OK) {
10231026 SetName(fname);
10241027 GetDesc(&desc);
1025- LogOk("Surface %s found",fname);
1028+ LogOk("Surface %s found, (%ux%u)",fname,info.Width,info.Height);
10261029 return true;
10271030 }
10281031 else {
@@ -1112,11 +1115,15 @@
11121115 Format = D3DFMT_X8R8G8B8;
11131116 }
11141117
1115-
1118+ if (Mips==0) Mips = D3DX_FROM_FILE;
1119+
11161120 if (D3DXCreateTextureFromFileExA(pDevice, cpath, 0, 0, Mips, Usage, Format, Pool, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &pTex)==S_OK) {
11171121 SetName(fname);
11181122 GetDesc(&desc);
1119- LogOk("Texture %s found. Handle=0x%X",fname,this);
1123+ char poolname[32]; strcpy_s(poolname,32,"UnKnown");
1124+ if (Pool==D3DPOOL_DEFAULT) strcpy_s(poolname,32,"Default");
1125+ if (Pool==D3DPOOL_SYSTEMMEM) strcpy_s(poolname,32,"SystemMem");
1126+ LogOk("Texture %s found. Handle=0x%X, (%ux%u), MipMaps=%u, Pool=%s",fname,this, desc.Width,desc.Height, pTex->GetLevelCount(), poolname);
11201127 return true;
11211128 }
11221129 else {
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/GDIPad.cpp
--- a/Orbitersdk/D3D9Client/GDIPad.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/GDIPad.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -136,13 +136,11 @@
136136
137137 bool GDIPad::Text (int x, int y, const char *str, int len)
138138 {
139- //LogErr("%s",str);
140139 return (TextOut (hDC, x, y, str, len) != FALSE);
141140 }
142141
143142 bool GDIPad::TextBox (int x1, int y1, int x2, int y2, const char *str, int len)
144143 {
145- LogErr("GDIPad::TextBox called");
146144 RECT r;
147145 r.left = x1;
148146 r.top = y1;
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/GPL.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Orbitersdk/D3D9Client/GPL.txt Sat Jun 04 00:00:00 2011 +0200
@@ -0,0 +1,339 @@
1+ GNU GENERAL PUBLIC LICENSE
2+ Version 2, June 1991
3+
4+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6+ Everyone is permitted to copy and distribute verbatim copies
7+ of this license document, but changing it is not allowed.
8+
9+ Preamble
10+
11+ The licenses for most software are designed to take away your
12+freedom to share and change it. By contrast, the GNU General Public
13+License is intended to guarantee your freedom to share and change free
14+software--to make sure the software is free for all its users. This
15+General Public License applies to most of the Free Software
16+Foundation's software and to any other program whose authors commit to
17+using it. (Some other Free Software Foundation software is covered by
18+the GNU Lesser General Public License instead.) You can apply it to
19+your programs, too.
20+
21+ When we speak of free software, we are referring to freedom, not
22+price. Our General Public Licenses are designed to make sure that you
23+have the freedom to distribute copies of free software (and charge for
24+this service if you wish), that you receive source code or can get it
25+if you want it, that you can change the software or use pieces of it
26+in new free programs; and that you know you can do these things.
27+
28+ To protect your rights, we need to make restrictions that forbid
29+anyone to deny you these rights or to ask you to surrender the rights.
30+These restrictions translate to certain responsibilities for you if you
31+distribute copies of the software, or if you modify it.
32+
33+ For example, if you distribute copies of such a program, whether
34+gratis or for a fee, you must give the recipients all the rights that
35+you have. You must make sure that they, too, receive or can get the
36+source code. And you must show them these terms so they know their
37+rights.
38+
39+ We protect your rights with two steps: (1) copyright the software, and
40+(2) offer you this license which gives you legal permission to copy,
41+distribute and/or modify the software.
42+
43+ Also, for each author's protection and ours, we want to make certain
44+that everyone understands that there is no warranty for this free
45+software. If the software is modified by someone else and passed on, we
46+want its recipients to know that what they have is not the original, so
47+that any problems introduced by others will not reflect on the original
48+authors' reputations.
49+
50+ Finally, any free program is threatened constantly by software
51+patents. We wish to avoid the danger that redistributors of a free
52+program will individually obtain patent licenses, in effect making the
53+program proprietary. To prevent this, we have made it clear that any
54+patent must be licensed for everyone's free use or not licensed at all.
55+
56+ The precise terms and conditions for copying, distribution and
57+modification follow.
58+
59+ GNU GENERAL PUBLIC LICENSE
60+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61+
62+ 0. This License applies to any program or other work which contains
63+a notice placed by the copyright holder saying it may be distributed
64+under the terms of this General Public License. The "Program", below,
65+refers to any such program or work, and a "work based on the Program"
66+means either the Program or any derivative work under copyright law:
67+that is to say, a work containing the Program or a portion of it,
68+either verbatim or with modifications and/or translated into another
69+language. (Hereinafter, translation is included without limitation in
70+the term "modification".) Each licensee is addressed as "you".
71+
72+Activities other than copying, distribution and modification are not
73+covered by this License; they are outside its scope. The act of
74+running the Program is not restricted, and the output from the Program
75+is covered only if its contents constitute a work based on the
76+Program (independent of having been made by running the Program).
77+Whether that is true depends on what the Program does.
78+
79+ 1. You may copy and distribute verbatim copies of the Program's
80+source code as you receive it, in any medium, provided that you
81+conspicuously and appropriately publish on each copy an appropriate
82+copyright notice and disclaimer of warranty; keep intact all the
83+notices that refer to this License and to the absence of any warranty;
84+and give any other recipients of the Program a copy of this License
85+along with the Program.
86+
87+You may charge a fee for the physical act of transferring a copy, and
88+you may at your option offer warranty protection in exchange for a fee.
89+
90+ 2. You may modify your copy or copies of the Program or any portion
91+of it, thus forming a work based on the Program, and copy and
92+distribute such modifications or work under the terms of Section 1
93+above, provided that you also meet all of these conditions:
94+
95+ a) You must cause the modified files to carry prominent notices
96+ stating that you changed the files and the date of any change.
97+
98+ b) You must cause any work that you distribute or publish, that in
99+ whole or in part contains or is derived from the Program or any
100+ part thereof, to be licensed as a whole at no charge to all third
101+ parties under the terms of this License.
102+
103+ c) If the modified program normally reads commands interactively
104+ when run, you must cause it, when started running for such
105+ interactive use in the most ordinary way, to print or display an
106+ announcement including an appropriate copyright notice and a
107+ notice that there is no warranty (or else, saying that you provide
108+ a warranty) and that users may redistribute the program under
109+ these conditions, and telling the user how to view a copy of this
110+ License. (Exception: if the Program itself is interactive but
111+ does not normally print such an announcement, your work based on
112+ the Program is not required to print an announcement.)
113+
114+These requirements apply to the modified work as a whole. If
115+identifiable sections of that work are not derived from the Program,
116+and can be reasonably considered independent and separate works in
117+themselves, then this License, and its terms, do not apply to those
118+sections when you distribute them as separate works. But when you
119+distribute the same sections as part of a whole which is a work based
120+on the Program, the distribution of the whole must be on the terms of
121+this License, whose permissions for other licensees extend to the
122+entire whole, and thus to each and every part regardless of who wrote it.
123+
124+Thus, it is not the intent of this section to claim rights or contest
125+your rights to work written entirely by you; rather, the intent is to
126+exercise the right to control the distribution of derivative or
127+collective works based on the Program.
128+
129+In addition, mere aggregation of another work not based on the Program
130+with the Program (or with a work based on the Program) on a volume of
131+a storage or distribution medium does not bring the other work under
132+the scope of this License.
133+
134+ 3. You may copy and distribute the Program (or a work based on it,
135+under Section 2) in object code or executable form under the terms of
136+Sections 1 and 2 above provided that you also do one of the following:
137+
138+ a) Accompany it with the complete corresponding machine-readable
139+ source code, which must be distributed under the terms of Sections
140+ 1 and 2 above on a medium customarily used for software interchange; or,
141+
142+ b) Accompany it with a written offer, valid for at least three
143+ years, to give any third party, for a charge no more than your
144+ cost of physically performing source distribution, a complete
145+ machine-readable copy of the corresponding source code, to be
146+ distributed under the terms of Sections 1 and 2 above on a medium
147+ customarily used for software interchange; or,
148+
149+ c) Accompany it with the information you received as to the offer
150+ to distribute corresponding source code. (This alternative is
151+ allowed only for noncommercial distribution and only if you
152+ received the program in object code or executable form with such
153+ an offer, in accord with Subsection b above.)
154+
155+The source code for a work means the preferred form of the work for
156+making modifications to it. For an executable work, complete source
157+code means all the source code for all modules it contains, plus any
158+associated interface definition files, plus the scripts used to
159+control compilation and installation of the executable. However, as a
160+special exception, the source code distributed need not include
161+anything that is normally distributed (in either source or binary
162+form) with the major components (compiler, kernel, and so on) of the
163+operating system on which the executable runs, unless that component
164+itself accompanies the executable.
165+
166+If distribution of executable or object code is made by offering
167+access to copy from a designated place, then offering equivalent
168+access to copy the source code from the same place counts as
169+distribution of the source code, even though third parties are not
170+compelled to copy the source along with the object code.
171+
172+ 4. You may not copy, modify, sublicense, or distribute the Program
173+except as expressly provided under this License. Any attempt
174+otherwise to copy, modify, sublicense or distribute the Program is
175+void, and will automatically terminate your rights under this License.
176+However, parties who have received copies, or rights, from you under
177+this License will not have their licenses terminated so long as such
178+parties remain in full compliance.
179+
180+ 5. You are not required to accept this License, since you have not
181+signed it. However, nothing else grants you permission to modify or
182+distribute the Program or its derivative works. These actions are
183+prohibited by law if you do not accept this License. Therefore, by
184+modifying or distributing the Program (or any work based on the
185+Program), you indicate your acceptance of this License to do so, and
186+all its terms and conditions for copying, distributing or modifying
187+the Program or works based on it.
188+
189+ 6. Each time you redistribute the Program (or any work based on the
190+Program), the recipient automatically receives a license from the
191+original licensor to copy, distribute or modify the Program subject to
192+these terms and conditions. You may not impose any further
193+restrictions on the recipients' exercise of the rights granted herein.
194+You are not responsible for enforcing compliance by third parties to
195+this License.
196+
197+ 7. If, as a consequence of a court judgment or allegation of patent
198+infringement or for any other reason (not limited to patent issues),
199+conditions are imposed on you (whether by court order, agreement or
200+otherwise) that contradict the conditions of this License, they do not
201+excuse you from the conditions of this License. If you cannot
202+distribute so as to satisfy simultaneously your obligations under this
203+License and any other pertinent obligations, then as a consequence you
204+may not distribute the Program at all. For example, if a patent
205+license would not permit royalty-free redistribution of the Program by
206+all those who receive copies directly or indirectly through you, then
207+the only way you could satisfy both it and this License would be to
208+refrain entirely from distribution of the Program.
209+
210+If any portion of this section is held invalid or unenforceable under
211+any particular circumstance, the balance of the section is intended to
212+apply and the section as a whole is intended to apply in other
213+circumstances.
214+
215+It is not the purpose of this section to induce you to infringe any
216+patents or other property right claims or to contest validity of any
217+such claims; this section has the sole purpose of protecting the
218+integrity of the free software distribution system, which is
219+implemented by public license practices. Many people have made
220+generous contributions to the wide range of software distributed
221+through that system in reliance on consistent application of that
222+system; it is up to the author/donor to decide if he or she is willing
223+to distribute software through any other system and a licensee cannot
224+impose that choice.
225+
226+This section is intended to make thoroughly clear what is believed to
227+be a consequence of the rest of this License.
228+
229+ 8. If the distribution and/or use of the Program is restricted in
230+certain countries either by patents or by copyrighted interfaces, the
231+original copyright holder who places the Program under this License
232+may add an explicit geographical distribution limitation excluding
233+those countries, so that distribution is permitted only in or among
234+countries not thus excluded. In such case, this License incorporates
235+the limitation as if written in the body of this License.
236+
237+ 9. The Free Software Foundation may publish revised and/or new versions
238+of the General Public License from time to time. Such new versions will
239+be similar in spirit to the present version, but may differ in detail to
240+address new problems or concerns.
241+
242+Each version is given a distinguishing version number. If the Program
243+specifies a version number of this License which applies to it and "any
244+later version", you have the option of following the terms and conditions
245+either of that version or of any later version published by the Free
246+Software Foundation. If the Program does not specify a version number of
247+this License, you may choose any version ever published by the Free Software
248+Foundation.
249+
250+ 10. If you wish to incorporate parts of the Program into other free
251+programs whose distribution conditions are different, write to the author
252+to ask for permission. For software which is copyrighted by the Free
253+Software Foundation, write to the Free Software Foundation; we sometimes
254+make exceptions for this. Our decision will be guided by the two goals
255+of preserving the free status of all derivatives of our free software and
256+of promoting the sharing and reuse of software generally.
257+
258+ NO WARRANTY
259+
260+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268+REPAIR OR CORRECTION.
269+
270+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278+POSSIBILITY OF SUCH DAMAGES.
279+
280+ END OF TERMS AND CONDITIONS
281+
282+ How to Apply These Terms to Your New Programs
283+
284+ If you develop a new program, and you want it to be of the greatest
285+possible use to the public, the best way to achieve this is to make it
286+free software which everyone can redistribute and change under these terms.
287+
288+ To do so, attach the following notices to the program. It is safest
289+to attach them to the start of each source file to most effectively
290+convey the exclusion of warranty; and each file should have at least
291+the "copyright" line and a pointer to where the full notice is found.
292+
293+ <one line to give the program's name and a brief idea of what it does.>
294+ Copyright (C) <year> <name of author>
295+
296+ This program is free software; you can redistribute it and/or modify
297+ it under the terms of the GNU General Public License as published by
298+ the Free Software Foundation; either version 2 of the License, or
299+ (at your option) any later version.
300+
301+ This program is distributed in the hope that it will be useful,
302+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304+ GNU General Public License for more details.
305+
306+ You should have received a copy of the GNU General Public License along
307+ with this program; if not, write to the Free Software Foundation, Inc.,
308+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309+
310+Also add information on how to contact you by electronic and paper mail.
311+
312+If the program is interactive, make it output a short notice like this
313+when it starts in an interactive mode:
314+
315+ Gnomovision version 69, Copyright (C) year name of author
316+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317+ This is free software, and you are welcome to redistribute it
318+ under certain conditions; type `show c' for details.
319+
320+The hypothetical commands `show w' and `show c' should show the appropriate
321+parts of the General Public License. Of course, the commands you use may
322+be called something other than `show w' and `show c'; they could even be
323+mouse-clicks or menu items--whatever suits your program.
324+
325+You should also get your employer (if you work as a programmer) or your
326+school, if any, to sign a "copyright disclaimer" for the program, if
327+necessary. Here is a sample; alter the names:
328+
329+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331+
332+ <signature of Ty Coon>, 1 April 1989
333+ Ty Coon, President of Vice
334+
335+This General Public License does not permit incorporating your program into
336+proprietary programs. If your program is a subroutine library, you may
337+consider it more useful to permit linking proprietary applications with the
338+library. If this is what you want to do, use the GNU Lesser General
339+Public License instead of this License.
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/HazeMgr.cpp
--- a/Orbitersdk/D3D9Client/HazeMgr.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/HazeMgr.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -85,7 +85,8 @@
8585 if (!dual) alpha = 1.0-alpha;
8686 if (alpha <= 0.0) return; // nothing to do
8787
88- //if (dual && cdist<1.001) return;
88+ // Problem: the top part of horizon haze is rendered twice
89+ if (dual && cdist<1.001) return; // Enabled 04.06.2011
8990
9091 VECTOR3 cpos = {0,cdist,0};
9192 double id = 1.0 / max (cdist, 1.001);
@@ -136,6 +137,8 @@
136137 colofs = (dual ? 0.4 : 0.3);
137138
138139 HR(FX->SetTechnique(eHazeTech));
140+
141+
139142 HR(FX->SetMatrix(eW, &transm));
140143 HR(FX->SetMatrix(eVP, gc->GetScene()->GetProjectionViewMatrix()));
141144 HR(FX->SetTexture(eTex0, NULL)); //horizon->GetTexture())); // Diffuse Texture
@@ -177,6 +180,7 @@
177180 UINT numPasses = 0;
178181 HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
179182 HR(FX->BeginPass(0));
183+
180184 HR(pDev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLESTRIP, 0, 2*HORIZON_NSEG, 2*HORIZON_NSEG, Idx, D3DFMT_INDEX16, Vtx, sizeof(HVERTEX)));
181185
182186 if (dual) {
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/LICENSE.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Orbitersdk/D3D9Client/LICENSE.txt Sat Jun 04 00:00:00 2011 +0200
@@ -0,0 +1,17 @@
1+Orbiter Visualisation Project
2+Graphics Client Plugins for Orbiter Space Flight Simulator
3+Copyright (C) 2006-2010 Martin Schweiger
4+
5+This program is free software; you can redistribute it and/or
6+modify it under the terms of the GNU General Public License
7+as published by the Free Software Foundation; either version 2
8+of the License, or (at your option) any later version.
9+
10+This program is distributed in the hope that it will be useful,
11+but WITHOUT ANY WARRANTY; without even the implied warranty of
12+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+GNU General Public License for more details.
14+
15+You should have received a copy of the GNU General Public License
16+along with this program; if not, write to the Free Software
17+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/Mesh.cpp
--- a/Orbitersdk/D3D9Client/Mesh.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/Mesh.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -10,6 +10,7 @@
1010 // class D3D9Mesh (implementation)
1111 // ==============================================================
1212
13+#define VISIBILITY_TOL 0.0015f
1314
1415 #include "Mesh.h"
1516 #include "Log.h"
@@ -586,6 +587,8 @@
586587 HR(FX->SetMatrix(eW, pW));
587588 HR(FX->SetMatrix(eVP, pVP));
588589 HR(FX->SetTexture(eTex0, pTex));
590+ if (sunLight) FX->SetValue(eSun, sunLight, sizeof(D3D9Light));
591+ HR(FX->SetValue(eMat, &defmat, sizeof(D3DMATERIAL9)));
589592 HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
590593 HR(FX->BeginPass(0));
591594 RenderGroup(dev, Grp[0]);
@@ -608,6 +611,8 @@
608611 HR(FX->SetMatrix(eW, pW));
609612 HR(FX->SetMatrix(eVP, pVP));
610613 HR(FX->SetTexture(eTex0, pTex->GetTexture()));
614+ if (sunLight) FX->SetValue(eSun, sunLight, sizeof(D3D9Light));
615+ HR(FX->SetValue(eMat, &defmat, sizeof(D3DMATERIAL9)));
611616 HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
612617 HR(FX->BeginPass(0));
613618 RenderGroup(dev, grp);
@@ -683,7 +688,7 @@
683688 float mix = 0.0f;
684689 float ap = (float)scn->GetCameraAperture();
685690 float h = tan(ap);
686- float dfr = h*0.0025f;
691+ float dfr = h*VISIBILITY_TOL;
687692 float as = (float)scn->GetCameraAspect();
688693 float w = h/as;
689694 float hf = (1.0f/cos(ap));
@@ -879,7 +884,7 @@
879884 float mix = 0.0f;
880885 float ap = (float)scn->GetCameraAperture();
881886 float h = tan(ap);
882- float dfr = h*0.0025f;
887+ float dfr = h*VISIBILITY_TOL;
883888 float as = 1.0f/(float)scn->GetCameraAspect();
884889 float w = h*as;
885890 float hf = (1.0f/cos(ap));
@@ -1009,7 +1014,7 @@
10091014
10101015 float ap = (float)scn->GetCameraAperture();
10111016 float h = tan(ap);
1012- float dfr = h*0.0025f;
1017+ float dfr = h*VISIBILITY_TOL;
10131018 float as = 1.0f/(float)scn->GetCameraAspect();
10141019 float w = h*as;
10151020 float hf = (1.0f/cos(ap));
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/Particle.cpp
--- a/Orbitersdk/D3D9Client/Particle.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/Particle.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -435,6 +435,9 @@
435435
436436 if (tex) HR(FX->SetTexture(eTex0, tex->GetTexture()));
437437
438+ HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
439+ HR(FX->BeginPass(0));
440+
438441 for (p = pfirst, vtx = dvtx, n = i0 = 0; p; p = p->next) {
439442
440443 SetDParticleCoords(p->pos - camera_gpos, p->size, vtx);
@@ -455,16 +458,16 @@
455458 smokemat.Diffuse.a = (float)max (0.1, p->alpha0*(1.0-(oapiGetSimTime()-p->t0)*ipht2));
456459
457460 HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9)));
458- HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
459- HR(FX->BeginPass(0));
461+ HR(FX->CommitChanges());
460462 HR(dev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, n*4, n*2, idx, D3DFMT_INDEX16, dvtx+i0*4, sizeof(NTVERTEX)));
461- HR(FX->EndPass());
462- HR(FX->End());
463-
463+
464464 i0 += n;
465465 n = 0;
466466 }
467467 }
468+
469+ HR(FX->EndPass());
470+ HR(FX->End());
468471 }
469472
470473
@@ -489,8 +492,12 @@
489492 HR(FX->SetTechnique(eEmissiveTech));
490493 HR(FX->SetMatrix(eW, &mWorld));
491494 HR(FX->SetMatrix(eVP, pVP));
495+
492496 if (tex) HR(FX->SetTexture(eTex0, tex->GetTexture()));
493497
498+ HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
499+ HR(FX->BeginPass(0));
500+
494501 for (p = pfirst, vtx = evtx, n = i0 = 0; p; p = p->next) {
495502
496503 SetEParticleCoords(p->pos - camera_gpos, p->size, vtx);
@@ -504,21 +511,19 @@
504511 smokemat.Diffuse.a = (float)max (0.1, p->alpha0*(1.0-(oapiGetSimTime()-p->t0)*ipht2));
505512 SetMaterial(smokemat.Emissive);
506513
507- HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9)));
508-
509514 if (++n == stride || n+i0 == np) {
510515
511516 HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9)));
512- HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
513- HR(FX->BeginPass(0));
517+ HR(FX->CommitChanges());
514518 HR(dev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, n*4, n*2, idx, D3DFMT_INDEX16, evtx+i0*4, sizeof(VERTEX_XYZ_TEX)));
515- HR(FX->EndPass());
516- HR(FX->End());
517-
519+
518520 i0 += n;
519521 n = 0;
520522 }
521523 }
524+
525+ HR(FX->EndPass());
526+ HR(FX->End());
522527 }
523528
524529
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/Scene.cpp
--- a/Orbitersdk/D3D9Client/Scene.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/Scene.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -787,6 +787,7 @@
787787 if (oapiGetObjectType(hObj) == OBJTP_VESSEL) {
788788
789789 pv->vobj->Render(pDevice);
790+
790791 if (hObj == hFocus) vFocus = (vVessel*)pv->vobj; // remember focus visual
791792
792793 if ((plnmode & (PLN_ENABLE|PLN_VMARK)) == (PLN_ENABLE|PLN_VMARK)) {
@@ -818,7 +819,7 @@
818819 pDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0L); // clear z-buffer
819820 double znear = gc->Cfg()->VCNearPlane;
820821 if (znear<0.01) znear=0.01;
821- if (znear>0.5) znear=0.5;
822+ if (znear>2.5) znear=2.5;
822823 SetCameraFustrumLimits(znear, oapiGetSize(hFocus));
823824 vFocus->Render(pDevice, true);
824825 }
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/SurfMgr.cpp
--- a/Orbitersdk/D3D9Client/SurfMgr.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/SurfMgr.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -124,7 +124,6 @@
124124
125125 FX->SetTexture(eTex0, tile[idx].tex);
126126 FX->SetTexture(eTex1, ltex);
127- //FX->SetTexture(eTex2, ltex);
128127 FX->CommitChanges();
129128 mesh.pTile->DrawSubset(0);
130129 }
@@ -185,8 +184,7 @@
185184 HR(FX->SetMatrix(eW, &mWorld));
186185 HR(FX->SetTexture(eTex0, tex)); // Diffuse Texture
187186 HR(FX->SetTexture(eTex1, ltex)); // Night Lights
188- //HR(FX->SetTexture(eTex2, ltex)); // Specular map
189-
187+
190188 if (microtex) {
191189 HR(FX->SetTexture(eTex3, microtex->GetTexture()));
192190 HR(FX->SetFloat(eMix, 1.0f));
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/VVessel.cpp
--- a/Orbitersdk/D3D9Client/VVessel.cpp Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/VVessel.cpp Sat Jun 04 00:00:00 2011 +0200
@@ -70,6 +70,18 @@
7070 SURFACE(mfdoff)->Fill(NULL, 0);
7171 if (defexhausttex) defexhausttex->Release();
7272 gc->GetTexMgr()->LoadTexture("Exhaust.dds", &defexhausttex, 0);
73+
74+ //if (defreentrytex) defreentrytex->Release();
75+ //gc->GetTexMgr()->LoadTexture("Reentry.dds", &defreentrytex, 0);
76+
77+ static WORD idx[6] = {0,1,2, 3,2,1};
78+
79+ static NTVERTEX vtx[4] = {
80+ {0,-1, 1, -1,0,0, 0,0},
81+ {0, 1, 1, -1,0,0, 0,1},
82+ {0,-1,-1, -1,0,0, 1,0},
83+ {0, 1,-1, -1,0,0, 1,1}
84+ };
7385 }
7486
7587
@@ -156,9 +168,6 @@
156168
157169 if (!active) return false;
158170
159- //DWORD plnmode = *(DWORD*)gc->GetConfigParam(CFGPRM_PLANETARIUMFLAG);
160- //if (plnmode & PLN_ENABLE) ClearAnimations();
161-
162171 vObject::Update();
163172 UpdateAnimations();
164173
@@ -416,7 +425,7 @@
416425 DWORD h = SURFACE(sMFD[mfd])->GetHeight();
417426 if (tMFD[mfd]) {
418427 if (SURFACE(tMFD[mfd])->GetWidth()==w && SURFACE(tMFD[mfd])->GetWidth()==h) continue;
419- delete SURFACE(tMFD[mfd]);
428+ else delete SURFACE(tMFD[mfd]);
420429 }
421430 tMFD[mfd] = SURFACE(gc->clbkCreateTexture(w, h));
422431 SURFACE(tMFD[mfd])->Fill(NULL, 0);
@@ -453,12 +462,17 @@
453462
454463 if (vismode==0) continue;
455464
465+
456466 //char *qw[2]={"False","True"};
457467 //LogErr("Index=%u VisMode=0x%hX, bCockbit=%s, bVC=%s, bInternal=%s",i,vismode,qw[bCockpit],qw[bVC],qw[internalpass]);
458468
459- // Added 3-jan-2011 to prevent VC interior double rendering during exterior and interior passes
460- if (vismode==MESHVIS_VC && internalpass==false) continue;
461-
469+ if (internalpass==false) {
470+ if (vismode==MESHVIS_VC) continue; // Added 3-jan-2011 to prevent VC interior double rendering during exterior and interior passes
471+ }
472+ else {
473+
474+ }
475+
462476 if (bCockpit) {
463477 if (internalpass && (vismode & MESHVIS_EXTPASS)) continue;
464478 if (!(vismode & MESHVIS_COCKPIT)) {
@@ -482,7 +496,7 @@
482496 if (internalpass) meshlist[i].mesh->Render(dev, pWT, mVP, 0x1); // Render VC
483497 else meshlist[i].mesh->Render(dev, pWT, mVP, 0x0); // Render Exterior
484498
485-
499+
486500 // render VC HUD and MFDs ------------------------------------------------------------------------
487501 //
488502 if (bVC && internalpass) {
@@ -496,11 +510,11 @@
496510 if (sMFD[mfd]) {
497511 gc->clbkBlt(tMFD[mfd], 0, 0, sMFD[mfd]);
498512 D3D9Mesh::GROUPREC * MFDGrp = meshlist[i].mesh->GetGroup(mfdspec[mfd]->ngroup);
499- meshlist[i].mesh->RenderSimple(dev, 4, MFDGrp, &mWorld, mVP, tMFD[mfd]);
513+ meshlist[i].mesh->RenderSimple(dev, 4, MFDGrp, pWT, mVP, tMFD[mfd]);
500514 }
501515 else {
502516 D3D9Mesh::GROUPREC * MFDGrp = meshlist[i].mesh->GetGroup(mfdspec[mfd]->ngroup);
503- meshlist[i].mesh->RenderSimple(dev, 4, MFDGrp, &mWorld, mVP, mfdoff);
517+ meshlist[i].mesh->RenderSimple(dev, 4, MFDGrp, pWT, mVP, mfdoff);
504518 }
505519 }
506520 }
@@ -510,7 +524,7 @@
510524 if (sHUD && hudspec->nmesh == i) {
511525 gc->clbkBlt(tHUD, 0, 0, sHUD);
512526 D3D9Mesh::GROUPREC * HUDGrp = meshlist[i].mesh->GetGroup(hudspec->ngroup);
513- meshlist[i].mesh->RenderSimple(dev, 1, HUDGrp, &mWorld, mVP, tHUD);
527+ meshlist[i].mesh->RenderSimple(dev, 1, HUDGrp, pWT, mVP, tHUD);
514528 }
515529 }
516530 }
@@ -519,6 +533,13 @@
519533 }
520534
521535
536+bool vVessel::RenderReentryTexture(LPDIRECT3DDEVICE9 dev)
537+{
538+
539+ return true;
540+}
541+
542+
522543
523544 bool vVessel::RenderExhaust(LPDIRECT3DDEVICE9 dev)
524545 {
@@ -905,7 +926,44 @@
905926 {0,0,0, 0,0,0, 0.99609375f, 0.49609375f}
906927 };
907928
929+ MESHGROUPEX grp; memset(&grp, 0, sizeof(MESHGROUPEX));
930+
931+ grp.Idx = ExhaustIdx;
932+ grp.Vtx = ExhaustVtx;
933+ grp.nIdx = 12;
934+ grp.nVtx = 8;
935+ grp.MtrlIdx = 0;
936+ grp.TexIdx = 1;
937+
938+ pExhaust = new D3D9Mesh(gc, &grp, (MATERIAL*)&engmat, NULL);
939+}
940+
941+// ============================================================================================
942+//
943+/*
944+void vVessel::CreateReentry()
945+{
908946
947+ static D3DMATERIAL9 engmat = { // emissive material for engine exhaust
948+ {0,0,0,1},
949+ {0,0,0,1},
950+ {0,0,0,1},
951+ {1,1,1,1},
952+ 0.0
953+ };
954+
955+ static WORD ReentryIdx[12] = {0,1,2, 3,2,1, 4,5,6, 7,6,5};
956+
957+ static NTVERTEX ReentryVtx[8] = {
958+ {0,0,0, 0,0,0, 0.24f,0},
959+ {0,0,0, 0,0,0, 0.24f,1},
960+ {0,0,0, 0,0,0, 0.01f,0},
961+ {0,0,0, 0,0,0, 0.01f,1},
962+ {0,0,0, 0,0,0, 0.50390625f, 0.00390625f},
963+ {0,0,0, 0,0,0, 0.99609375f, 0.00390625f},
964+ {0,0,0, 0,0,0, 0.50390625f, 0.49609375f},
965+ {0,0,0, 0,0,0, 0.99609375f, 0.49609375f}
966+ };
909967
910968 MESHGROUPEX grp; memset(&grp, 0, sizeof(MESHGROUPEX));
911969
@@ -918,7 +976,7 @@
918976
919977 pExhaust = new D3D9Mesh(gc, &grp, (MATERIAL*)&engmat, NULL);
920978 }
921-
979+*/
922980
923981 // ===========================================================================================
924982 //
diff -r 9f47a5a6905d -r 31a47e045760 Orbitersdk/D3D9Client/VVessel.h
--- a/Orbitersdk/D3D9Client/VVessel.h Mon Oct 24 14:32:30 2011 +0200
+++ b/Orbitersdk/D3D9Client/VVessel.h Sat Jun 04 00:00:00 2011 +0200
@@ -79,6 +79,7 @@
7979 bool Render (LPDIRECT3DDEVICE9 dev, bool internalpass);
8080
8181 bool RenderExhaust (LPDIRECT3DDEVICE9 dev);
82+ bool RenderReentryTexture(LPDIRECT3DDEVICE9 dev);
8283
8384 /**
8485 * \brief Render the vessel's active light beacons
Show on old repository browser