修订版 | 31a47e0457603e46f725125fad0912844657075d (tree) |
---|---|
时间 | 2011-06-04 07:00:00 |
作者 | Jarmonik |
Commiter | Jarmonik |
D3D9Client: Atlantis MFD bug fixed
@@ -3,10 +3,11 @@ | ||
3 | 3 | PlanetAnisoMode = 2 |
4 | 4 | PlanetMipmapMode = 1 |
5 | 5 | PlanetMipmapBias = 0 |
6 | -DebugLvl = 1 | |
7 | -VCNearPlane = 0.16 | |
6 | +DebugLvl = 2 | |
7 | +VCNearPlane = 0.02 | |
8 | 8 | LightSourcesInUse = 12 |
9 | 9 | MemAllocLogic = 0 |
10 | 10 | DisableDrvMgm = 0 |
11 | 11 | NearClipPlaneMode = 0 |
12 | 12 | 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 |
@@ -37,14 +37,14 @@ | ||
37 | 37 | uniform extern float4x4 gGrpT; // Mesh group transformation matrix |
38 | 38 | uniform extern float4 gAttennuate; // Attennuation of fragment color |
39 | 39 | 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 | |
42 | 42 | uniform extern float4 gTexOff; |
43 | 43 | uniform extern float4 gRadius; // PlanetRad, AtmOuterLimit, CameraRad, CameraAlt |
44 | 44 | uniform extern float3 gCameraPos; // Planet relative camera position, Unit vector |
45 | 45 | uniform extern Light gLights[12]; |
46 | 46 | uniform extern int gLightCount; |
47 | -uniform extern Light gSun; // Light input structure | |
47 | +uniform extern Light gSun; // Sun light input structure | |
48 | 48 | uniform extern Mtrl gMat; // Material input structure |
49 | 49 | uniform extern Mtrl gWater; // Water material input structure |
50 | 50 | uniform extern bool gModAlpha; // Configuration input |
@@ -56,10 +56,9 @@ | ||
56 | 56 | uniform extern float gFogDensity; |
57 | 57 | uniform extern float gTime; |
58 | 58 | 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; | |
63 | 62 | |
64 | 63 | // Legacy Atmosphere -------------------------------------------------------- |
65 | 64 |
@@ -125,10 +124,22 @@ | ||
125 | 124 | // Texture Sampler implementations |
126 | 125 | // ------------------------------------------------------------------------------------------------------------- |
127 | 126 | |
128 | -sampler Tex0S = sampler_state | |
127 | +sampler Tex0S = sampler_state // Primary Mesh texture sampler | |
129 | 128 | { |
130 | 129 | 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; | |
132 | 143 | MagFilter = LINEAR; |
133 | 144 | MipFilter = LINEAR; |
134 | 145 | MaxAnisotropy = 4; |
@@ -136,18 +147,18 @@ | ||
136 | 147 | AddressV = WRAP; |
137 | 148 | }; |
138 | 149 | |
139 | -sampler MFDSamp = sampler_state | |
150 | +sampler MFDSamp = sampler_state // Virtual Cockpit MFD screen sampler | |
140 | 151 | { |
141 | 152 | Texture = <gTex0>; |
142 | 153 | MinFilter = ANISOTROPIC; |
143 | 154 | MagFilter = LINEAR; |
144 | - MipFilter = NONE; | |
155 | + MipFilter = LINEAR; | |
145 | 156 | MaxAnisotropy = 4; |
146 | 157 | AddressU = CLAMP; |
147 | 158 | AddressV = CLAMP; |
148 | 159 | }; |
149 | 160 | |
150 | -sampler Panel0S = sampler_state | |
161 | +sampler Panel0S = sampler_state // Sampler for mesh based panels. Must be compatible with Non-power of two conditional | |
151 | 162 | { |
152 | 163 | Texture = <gTex0>; |
153 | 164 | MinFilter = NONE; |
@@ -157,19 +168,8 @@ | ||
157 | 168 | AddressV = CLAMP; |
158 | 169 | }; |
159 | 170 | |
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 | -}; | |
170 | 171 | |
171 | - | |
172 | -sampler Tile0S = sampler_state | |
172 | +sampler Tile0S = sampler_state // Base tile sampler | |
173 | 173 | { |
174 | 174 | Texture = <gTex0>; |
175 | 175 | MinFilter = LINEAR; |
@@ -192,7 +192,7 @@ | ||
192 | 192 | AddressV = MIRROR; |
193 | 193 | }; |
194 | 194 | |
195 | -sampler RingS = sampler_state | |
195 | +sampler RingS = sampler_state // Planetary rings sampler | |
196 | 196 | { |
197 | 197 | Texture = <gTex0>; |
198 | 198 | MinFilter = LINEAR; |
@@ -204,13 +204,13 @@ | ||
204 | 204 | }; |
205 | 205 | |
206 | 206 | |
207 | + | |
207 | 208 | // Planet surface samplers ----------------------------------------------------- |
208 | 209 | |
209 | - | |
210 | -sampler Planet0S = sampler_state | |
210 | +sampler Planet0S = sampler_state // Planet/Cloud diffuse texture sampler | |
211 | 211 | { |
212 | 212 | Texture = <gTex0>; |
213 | - MinFilter = Anisotropic; | |
213 | + MinFilter = ANISOTROPIC; | |
214 | 214 | MagFilter = LINEAR; |
215 | 215 | MipFilter = LINEAR; |
216 | 216 | MaxAnisotropy = 4; |
@@ -218,10 +218,10 @@ | ||
218 | 218 | AddressV = CLAMP; |
219 | 219 | }; |
220 | 220 | |
221 | -sampler Planet1S = sampler_state | |
221 | +sampler Planet1S = sampler_state // Planet nightlights/specular mask sampler | |
222 | 222 | { |
223 | 223 | Texture = <gTex1>; |
224 | - MinFilter = Anisotropic; | |
224 | + MinFilter = ANISOTROPIC; | |
225 | 225 | MagFilter = LINEAR; |
226 | 226 | MipFilter = LINEAR; |
227 | 227 | MaxAnisotropy = 2; |
@@ -229,21 +229,10 @@ | ||
229 | 229 | AddressV = CLAMP; |
230 | 230 | }; |
231 | 231 | |
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 | |
244 | 233 | { |
245 | 234 | Texture = <gTex3>; |
246 | - MinFilter = Anisotropic; | |
235 | + MinFilter = ANISOTROPIC; | |
247 | 236 | MagFilter = LINEAR; |
248 | 237 | MipFilter = LINEAR; |
249 | 238 | MaxAnisotropy = 2; |
@@ -277,7 +266,7 @@ | ||
277 | 266 | else if (gHazeMode==2) { |
278 | 267 | float fogFact = 1.0f / exp(max(0,depth) * gFogDensity); |
279 | 268 | att = fogFact; |
280 | - ins = float4((1.0f-fogFact) * gFogColor.rgb, 0.0f); | |
269 | + ins = half4((1.0f-fogFact) * gFogColor.rgb, 0.0f); | |
281 | 270 | return; |
282 | 271 | } |
283 | 272 | } |
@@ -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. |
@@ -184,7 +184,7 @@ | ||
184 | 184 | |
185 | 185 | LogOk("Starting to initialize device and 3D environment..."); |
186 | 186 | |
187 | - HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData(), cfg->DisableDriverManagement); | |
187 | + HRESULT hr = pFramework->Initialize(hRenderWnd, GetVideoData(), bool(cfg->DisableDriverManagement), bool(cfg->NVPerfHUD)); | |
188 | 188 | |
189 | 189 | if (hr!=S_OK) { |
190 | 190 | WriteLog("ERROR: Failed to initialize 3D Framework"); |
@@ -1117,7 +1117,7 @@ | ||
1117 | 1117 | SetTextColor(hDC, 0xC08080); |
1118 | 1118 | SetBkMode(hDC,TRANSPARENT); |
1119 | 1119 | char data[128]; |
1120 | - sprintf_s(data,128,"D3D9Client RC21 Build [%s]",__DATE__); | |
1120 | + sprintf_s(data,128,"D3D9Client RC22 Build [%s]",__DATE__); | |
1121 | 1121 | TextOut(hDC,viewW*1018/1600, viewH*705/875 + 2*18, data, strlen(data)); |
1122 | 1122 | |
1123 | 1123 | SelectObject(hDC, hO); |
@@ -17,6 +17,7 @@ | ||
17 | 17 | int D3D9Config::def_MemoryLogic = 0; |
18 | 18 | int D3D9Config::def_DisableDriverManagement = 0; |
19 | 19 | int D3D9Config::def_NearClipPlane = 0; |
20 | +int D3D9Config::def_NVPerfHUD = 0; | |
20 | 21 | |
21 | 22 | |
22 | 23 | // ============================================================== |
@@ -44,6 +45,7 @@ | ||
44 | 45 | MaxLights = def_MaxLights; |
45 | 46 | MemoryLogic = def_MemoryLogic; |
46 | 47 | NearClipPlane = def_NearClipPlane; |
48 | + NVPerfHUD = def_NVPerfHUD; | |
47 | 49 | |
48 | 50 | DisableDriverManagement = def_DisableDriverManagement; |
49 | 51 |
@@ -71,6 +73,7 @@ | ||
71 | 73 | if (oapiReadItem_int (hFile, "MemAllocLogic", i)) MemoryLogic = i; |
72 | 74 | if (oapiReadItem_int (hFile, "DisableDrvMgm", i)) DisableDriverManagement = i; |
73 | 75 | if (oapiReadItem_int (hFile, "NearClipPlaneMode", i)) NearClipPlane = i; |
76 | + if (oapiReadItem_int (hFile, "NVPerfHUD", i)) NVPerfHUD = i; | |
74 | 77 | |
75 | 78 | oapiReadItem_string (hFile, "InSurfaceBlit", InSurface); |
76 | 79 |
@@ -94,6 +97,7 @@ | ||
94 | 97 | oapiWriteItem_int (hFile, "DisableDrvMgm", DisableDriverManagement); |
95 | 98 | oapiWriteItem_int (hFile, "NearClipPlaneMode", NearClipPlane); |
96 | 99 | oapiWriteItem_string (hFile, "InSurfaceBlit", InSurface); |
100 | + oapiWriteItem_int (hFile, "NVPerfHUD", NVPerfHUD); | |
97 | 101 | |
98 | 102 | oapiCloseFile (hFile, FILE_OUT); |
99 | 103 | } |
\ No newline at end of file |
@@ -23,6 +23,7 @@ | ||
23 | 23 | double VCNearPlane; |
24 | 24 | int DebugLvl; |
25 | 25 | int MaxLights; |
26 | + int NVPerfHUD; | |
26 | 27 | char *InSurface; |
27 | 28 | char *GDISurface; |
28 | 29 | char *NoAlpha; |
@@ -40,6 +41,7 @@ | ||
40 | 41 | static int def_MaxLights; |
41 | 42 | static int def_MemoryLogic; |
42 | 43 | static int def_DisableDriverManagement; |
44 | + static int def_NVPerfHUD; | |
43 | 45 | }; |
44 | 46 | |
45 | 47 | #endif // !__D3D9CONFIG_H |
@@ -54,7 +54,6 @@ | ||
54 | 54 | |
55 | 55 | D3DXHANDLE D3D9Effect::eTex0 = 0; |
56 | 56 | D3DXHANDLE D3D9Effect::eTex1 = 0; |
57 | -D3DXHANDLE D3D9Effect::eTex2 = 0; | |
58 | 57 | D3DXHANDLE D3D9Effect::eTex3 = 0; |
59 | 58 | |
60 | 59 | D3DXHANDLE D3D9Effect::eSpecularMode = 0; |
@@ -188,7 +187,6 @@ | ||
188 | 187 | |
189 | 188 | eTex0 = FX->GetParameterByName(0,"gTex0"); |
190 | 189 | eTex1 = FX->GetParameterByName(0,"gTex1"); |
191 | - eTex2 = FX->GetParameterByName(0,"gTex2"); | |
192 | 190 | eTex3 = FX->GetParameterByName(0,"gTex3"); |
193 | 191 | |
194 | 192 | eGlobalAmb = FX->GetParameterByName(0,"gGlobalAmb"); |
@@ -91,7 +91,6 @@ | ||
91 | 91 | // Textures -------------------------------------------------------- |
92 | 92 | static D3DXHANDLE eTex0; |
93 | 93 | static D3DXHANDLE eTex1; |
94 | - static D3DXHANDLE eTex2; | |
95 | 94 | static D3DXHANDLE eTex3; |
96 | 95 | |
97 | 96 | // Legacy Atmosphere ----------------------------------------------- |
@@ -113,10 +113,12 @@ | ||
113 | 113 | // Name: Initialize() |
114 | 114 | // Desc: Creates the internal objects for the framework |
115 | 115 | //----------------------------------------------------------------------------- |
116 | -HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData, bool _ddm) | |
116 | +HRESULT CD3DFramework9::Initialize(HWND _hWnd, GraphicsClient::VIDEODATA *vData, bool _ddm, bool _nvPerfHud) | |
117 | 117 | { |
118 | 118 | _TRACE; |
119 | 119 | |
120 | + nvPerfHud = _nvPerfHud; | |
121 | + | |
120 | 122 | bool bFail = false; |
121 | 123 | |
122 | 124 | Clear(); |
@@ -427,18 +429,17 @@ | ||
427 | 429 | |
428 | 430 | if (SWVert) devBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; |
429 | 431 | else devBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING; |
430 | - | |
431 | 432 | if (Pure) devBehaviorFlags |= D3DCREATE_PUREDEVICE; |
432 | - | |
433 | 433 | if (DDM) devBehaviorFlags |= D3DCREATE_DISABLE_DRIVER_MANAGEMENT; |
434 | 434 | |
435 | 435 | |
436 | - | |
437 | 436 | HRESULT hr = 0; |
438 | 437 | |
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( | |
442 | 443 | Adapter, // primary adapter |
443 | 444 | D3DDEVTYPE_REF, // device type |
444 | 445 | hWnd, // window associated with device |
@@ -446,18 +447,17 @@ | ||
446 | 447 | &d3dPP, // present parameters |
447 | 448 | &pd3dDevice); // return created device |
448 | 449 | } |
449 | - | |
450 | - if (Adapter==0) { | |
451 | - */ | |
452 | - hr = pD3D->CreateDevice( | |
450 | + else { | |
451 | + | |
452 | + hr = pD3D->CreateDevice( | |
453 | 453 | Adapter, // primary adapter |
454 | 454 | D3DDEVTYPE_HAL, // device type |
455 | 455 | hWnd, // window associated with device |
456 | 456 | devBehaviorFlags|D3DCREATE_MULTITHREADED|D3DCREATE_FPU_PRESERVE, |
457 | 457 | &d3dPP, // present parameters |
458 | 458 | &pd3dDevice); // return created device |
459 | - /*}*/ | |
460 | - | |
459 | + } | |
460 | + | |
461 | 461 | if (hr!=S_OK) LogErr("CreateDevice() Failed"); |
462 | 462 | |
463 | 463 | // Get Backbuffer |
@@ -43,6 +43,7 @@ | ||
43 | 43 | BOOL Pure; |
44 | 44 | BOOL DDM; |
45 | 45 | BOOL bGDIBB; |
46 | + BOOL nvPerfHud; | |
46 | 47 | DWORD dwRenderWidth; // Dimensions of the render target |
47 | 48 | DWORD dwRenderHeight; |
48 | 49 | LPDIRECT3D9 pD3D; // The Direct3D object |
@@ -95,7 +96,7 @@ | ||
95 | 96 | |
96 | 97 | |
97 | 98 | // 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); | |
99 | 100 | |
100 | 101 | HRESULT DestroyObjects(); |
101 | 102 |
@@ -265,6 +265,7 @@ | ||
265 | 265 | |
266 | 266 | //HR(D3DXCreateTexture(pDevice, Width, Height, 0, D3DUSAGE_DYNAMIC | D3DUSAGE_AUTOGENMIPMAP, Format, D3DPOOL_DEFAULT, &pTex)); |
267 | 267 | 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)); | |
268 | 269 | |
269 | 270 | GetDesc(&desc); |
270 | 271 | LogBlu("D3D9ClientSurface: New Texture Surface(0x%X) w=%u, h=%u", this, Width, Height); |
@@ -927,6 +928,7 @@ | ||
927 | 928 | pSrc->Release(); |
928 | 929 | pBak->Release(); |
929 | 930 | pTex->GenerateMipSubLevels(); |
931 | + //LogErr("Initial=%u New=%u",levels,pTex->GetLevelCount()); | |
930 | 932 | } |
931 | 933 | else { |
932 | 934 | LPDIRECT3DSURFACE9 pSrc, pTgt; |
@@ -938,6 +940,7 @@ | ||
938 | 940 | pSrc->Release(); |
939 | 941 | pBak->Release(); |
940 | 942 | pTex->GenerateMipSubLevels(); |
943 | + //LogErr("Initial=%u New=%u",levels,pTex->GetLevelCount()); | |
941 | 944 | } |
942 | 945 | |
943 | 946 | GetDesc(&desc); |
@@ -1022,7 +1025,7 @@ | ||
1022 | 1025 | if (D3DXLoadSurfaceFromFileA(pSurf, NULL, NULL, cpath, NULL, D3DX_DEFAULT, 0, NULL)==S_OK) { |
1023 | 1026 | SetName(fname); |
1024 | 1027 | GetDesc(&desc); |
1025 | - LogOk("Surface %s found",fname); | |
1028 | + LogOk("Surface %s found, (%ux%u)",fname,info.Width,info.Height); | |
1026 | 1029 | return true; |
1027 | 1030 | } |
1028 | 1031 | else { |
@@ -1112,11 +1115,15 @@ | ||
1112 | 1115 | Format = D3DFMT_X8R8G8B8; |
1113 | 1116 | } |
1114 | 1117 | |
1115 | - | |
1118 | + if (Mips==0) Mips = D3DX_FROM_FILE; | |
1119 | + | |
1116 | 1120 | if (D3DXCreateTextureFromFileExA(pDevice, cpath, 0, 0, Mips, Usage, Format, Pool, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &pTex)==S_OK) { |
1117 | 1121 | SetName(fname); |
1118 | 1122 | 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); | |
1120 | 1127 | return true; |
1121 | 1128 | } |
1122 | 1129 | else { |
@@ -136,13 +136,11 @@ | ||
136 | 136 | |
137 | 137 | bool GDIPad::Text (int x, int y, const char *str, int len) |
138 | 138 | { |
139 | - //LogErr("%s",str); | |
140 | 139 | return (TextOut (hDC, x, y, str, len) != FALSE); |
141 | 140 | } |
142 | 141 | |
143 | 142 | bool GDIPad::TextBox (int x1, int y1, int x2, int y2, const char *str, int len) |
144 | 143 | { |
145 | - LogErr("GDIPad::TextBox called"); | |
146 | 144 | RECT r; |
147 | 145 | r.left = x1; |
148 | 146 | r.top = y1; |
@@ -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. |
@@ -85,7 +85,8 @@ | ||
85 | 85 | if (!dual) alpha = 1.0-alpha; |
86 | 86 | if (alpha <= 0.0) return; // nothing to do |
87 | 87 | |
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 | |
89 | 90 | |
90 | 91 | VECTOR3 cpos = {0,cdist,0}; |
91 | 92 | double id = 1.0 / max (cdist, 1.001); |
@@ -136,6 +137,8 @@ | ||
136 | 137 | colofs = (dual ? 0.4 : 0.3); |
137 | 138 | |
138 | 139 | HR(FX->SetTechnique(eHazeTech)); |
140 | + | |
141 | + | |
139 | 142 | HR(FX->SetMatrix(eW, &transm)); |
140 | 143 | HR(FX->SetMatrix(eVP, gc->GetScene()->GetProjectionViewMatrix())); |
141 | 144 | HR(FX->SetTexture(eTex0, NULL)); //horizon->GetTexture())); // Diffuse Texture |
@@ -177,6 +180,7 @@ | ||
177 | 180 | UINT numPasses = 0; |
178 | 181 | HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); |
179 | 182 | HR(FX->BeginPass(0)); |
183 | + | |
180 | 184 | HR(pDev->DrawIndexedPrimitiveUP(D3DPT_TRIANGLESTRIP, 0, 2*HORIZON_NSEG, 2*HORIZON_NSEG, Idx, D3DFMT_INDEX16, Vtx, sizeof(HVERTEX))); |
181 | 185 | |
182 | 186 | if (dual) { |
@@ -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. |
@@ -10,6 +10,7 @@ | ||
10 | 10 | // class D3D9Mesh (implementation) |
11 | 11 | // ============================================================== |
12 | 12 | |
13 | +#define VISIBILITY_TOL 0.0015f | |
13 | 14 | |
14 | 15 | #include "Mesh.h" |
15 | 16 | #include "Log.h" |
@@ -586,6 +587,8 @@ | ||
586 | 587 | HR(FX->SetMatrix(eW, pW)); |
587 | 588 | HR(FX->SetMatrix(eVP, pVP)); |
588 | 589 | HR(FX->SetTexture(eTex0, pTex)); |
590 | + if (sunLight) FX->SetValue(eSun, sunLight, sizeof(D3D9Light)); | |
591 | + HR(FX->SetValue(eMat, &defmat, sizeof(D3DMATERIAL9))); | |
589 | 592 | HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); |
590 | 593 | HR(FX->BeginPass(0)); |
591 | 594 | RenderGroup(dev, Grp[0]); |
@@ -608,6 +611,8 @@ | ||
608 | 611 | HR(FX->SetMatrix(eW, pW)); |
609 | 612 | HR(FX->SetMatrix(eVP, pVP)); |
610 | 613 | HR(FX->SetTexture(eTex0, pTex->GetTexture())); |
614 | + if (sunLight) FX->SetValue(eSun, sunLight, sizeof(D3D9Light)); | |
615 | + HR(FX->SetValue(eMat, &defmat, sizeof(D3DMATERIAL9))); | |
611 | 616 | HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); |
612 | 617 | HR(FX->BeginPass(0)); |
613 | 618 | RenderGroup(dev, grp); |
@@ -683,7 +688,7 @@ | ||
683 | 688 | float mix = 0.0f; |
684 | 689 | float ap = (float)scn->GetCameraAperture(); |
685 | 690 | float h = tan(ap); |
686 | - float dfr = h*0.0025f; | |
691 | + float dfr = h*VISIBILITY_TOL; | |
687 | 692 | float as = (float)scn->GetCameraAspect(); |
688 | 693 | float w = h/as; |
689 | 694 | float hf = (1.0f/cos(ap)); |
@@ -879,7 +884,7 @@ | ||
879 | 884 | float mix = 0.0f; |
880 | 885 | float ap = (float)scn->GetCameraAperture(); |
881 | 886 | float h = tan(ap); |
882 | - float dfr = h*0.0025f; | |
887 | + float dfr = h*VISIBILITY_TOL; | |
883 | 888 | float as = 1.0f/(float)scn->GetCameraAspect(); |
884 | 889 | float w = h*as; |
885 | 890 | float hf = (1.0f/cos(ap)); |
@@ -1009,7 +1014,7 @@ | ||
1009 | 1014 | |
1010 | 1015 | float ap = (float)scn->GetCameraAperture(); |
1011 | 1016 | float h = tan(ap); |
1012 | - float dfr = h*0.0025f; | |
1017 | + float dfr = h*VISIBILITY_TOL; | |
1013 | 1018 | float as = 1.0f/(float)scn->GetCameraAspect(); |
1014 | 1019 | float w = h*as; |
1015 | 1020 | float hf = (1.0f/cos(ap)); |
@@ -435,6 +435,9 @@ | ||
435 | 435 | |
436 | 436 | if (tex) HR(FX->SetTexture(eTex0, tex->GetTexture())); |
437 | 437 | |
438 | + HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); | |
439 | + HR(FX->BeginPass(0)); | |
440 | + | |
438 | 441 | for (p = pfirst, vtx = dvtx, n = i0 = 0; p; p = p->next) { |
439 | 442 | |
440 | 443 | SetDParticleCoords(p->pos - camera_gpos, p->size, vtx); |
@@ -455,16 +458,16 @@ | ||
455 | 458 | smokemat.Diffuse.a = (float)max (0.1, p->alpha0*(1.0-(oapiGetSimTime()-p->t0)*ipht2)); |
456 | 459 | |
457 | 460 | HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9))); |
458 | - HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); | |
459 | - HR(FX->BeginPass(0)); | |
461 | + HR(FX->CommitChanges()); | |
460 | 462 | 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 | + | |
464 | 464 | i0 += n; |
465 | 465 | n = 0; |
466 | 466 | } |
467 | 467 | } |
468 | + | |
469 | + HR(FX->EndPass()); | |
470 | + HR(FX->End()); | |
468 | 471 | } |
469 | 472 | |
470 | 473 |
@@ -489,8 +492,12 @@ | ||
489 | 492 | HR(FX->SetTechnique(eEmissiveTech)); |
490 | 493 | HR(FX->SetMatrix(eW, &mWorld)); |
491 | 494 | HR(FX->SetMatrix(eVP, pVP)); |
495 | + | |
492 | 496 | if (tex) HR(FX->SetTexture(eTex0, tex->GetTexture())); |
493 | 497 | |
498 | + HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); | |
499 | + HR(FX->BeginPass(0)); | |
500 | + | |
494 | 501 | for (p = pfirst, vtx = evtx, n = i0 = 0; p; p = p->next) { |
495 | 502 | |
496 | 503 | SetEParticleCoords(p->pos - camera_gpos, p->size, vtx); |
@@ -504,21 +511,19 @@ | ||
504 | 511 | smokemat.Diffuse.a = (float)max (0.1, p->alpha0*(1.0-(oapiGetSimTime()-p->t0)*ipht2)); |
505 | 512 | SetMaterial(smokemat.Emissive); |
506 | 513 | |
507 | - HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9))); | |
508 | - | |
509 | 514 | if (++n == stride || n+i0 == np) { |
510 | 515 | |
511 | 516 | HR(FX->SetValue(eMat, &smokemat, sizeof(D3DMATERIAL9))); |
512 | - HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE)); | |
513 | - HR(FX->BeginPass(0)); | |
517 | + HR(FX->CommitChanges()); | |
514 | 518 | 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 | + | |
518 | 520 | i0 += n; |
519 | 521 | n = 0; |
520 | 522 | } |
521 | 523 | } |
524 | + | |
525 | + HR(FX->EndPass()); | |
526 | + HR(FX->End()); | |
522 | 527 | } |
523 | 528 | |
524 | 529 |
@@ -787,6 +787,7 @@ | ||
787 | 787 | if (oapiGetObjectType(hObj) == OBJTP_VESSEL) { |
788 | 788 | |
789 | 789 | pv->vobj->Render(pDevice); |
790 | + | |
790 | 791 | if (hObj == hFocus) vFocus = (vVessel*)pv->vobj; // remember focus visual |
791 | 792 | |
792 | 793 | if ((plnmode & (PLN_ENABLE|PLN_VMARK)) == (PLN_ENABLE|PLN_VMARK)) { |
@@ -818,7 +819,7 @@ | ||
818 | 819 | pDevice->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0L); // clear z-buffer |
819 | 820 | double znear = gc->Cfg()->VCNearPlane; |
820 | 821 | if (znear<0.01) znear=0.01; |
821 | - if (znear>0.5) znear=0.5; | |
822 | + if (znear>2.5) znear=2.5; | |
822 | 823 | SetCameraFustrumLimits(znear, oapiGetSize(hFocus)); |
823 | 824 | vFocus->Render(pDevice, true); |
824 | 825 | } |
@@ -124,7 +124,6 @@ | ||
124 | 124 | |
125 | 125 | FX->SetTexture(eTex0, tile[idx].tex); |
126 | 126 | FX->SetTexture(eTex1, ltex); |
127 | - //FX->SetTexture(eTex2, ltex); | |
128 | 127 | FX->CommitChanges(); |
129 | 128 | mesh.pTile->DrawSubset(0); |
130 | 129 | } |
@@ -185,8 +184,7 @@ | ||
185 | 184 | HR(FX->SetMatrix(eW, &mWorld)); |
186 | 185 | HR(FX->SetTexture(eTex0, tex)); // Diffuse Texture |
187 | 186 | HR(FX->SetTexture(eTex1, ltex)); // Night Lights |
188 | - //HR(FX->SetTexture(eTex2, ltex)); // Specular map | |
189 | - | |
187 | + | |
190 | 188 | if (microtex) { |
191 | 189 | HR(FX->SetTexture(eTex3, microtex->GetTexture())); |
192 | 190 | HR(FX->SetFloat(eMix, 1.0f)); |
@@ -70,6 +70,18 @@ | ||
70 | 70 | SURFACE(mfdoff)->Fill(NULL, 0); |
71 | 71 | if (defexhausttex) defexhausttex->Release(); |
72 | 72 | 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 | + }; | |
73 | 85 | } |
74 | 86 | |
75 | 87 |
@@ -156,9 +168,6 @@ | ||
156 | 168 | |
157 | 169 | if (!active) return false; |
158 | 170 | |
159 | - //DWORD plnmode = *(DWORD*)gc->GetConfigParam(CFGPRM_PLANETARIUMFLAG); | |
160 | - //if (plnmode & PLN_ENABLE) ClearAnimations(); | |
161 | - | |
162 | 171 | vObject::Update(); |
163 | 172 | UpdateAnimations(); |
164 | 173 |
@@ -416,7 +425,7 @@ | ||
416 | 425 | DWORD h = SURFACE(sMFD[mfd])->GetHeight(); |
417 | 426 | if (tMFD[mfd]) { |
418 | 427 | if (SURFACE(tMFD[mfd])->GetWidth()==w && SURFACE(tMFD[mfd])->GetWidth()==h) continue; |
419 | - delete SURFACE(tMFD[mfd]); | |
428 | + else delete SURFACE(tMFD[mfd]); | |
420 | 429 | } |
421 | 430 | tMFD[mfd] = SURFACE(gc->clbkCreateTexture(w, h)); |
422 | 431 | SURFACE(tMFD[mfd])->Fill(NULL, 0); |
@@ -453,12 +462,17 @@ | ||
453 | 462 | |
454 | 463 | if (vismode==0) continue; |
455 | 464 | |
465 | + | |
456 | 466 | //char *qw[2]={"False","True"}; |
457 | 467 | //LogErr("Index=%u VisMode=0x%hX, bCockbit=%s, bVC=%s, bInternal=%s",i,vismode,qw[bCockpit],qw[bVC],qw[internalpass]); |
458 | 468 | |
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 | + | |
462 | 476 | if (bCockpit) { |
463 | 477 | if (internalpass && (vismode & MESHVIS_EXTPASS)) continue; |
464 | 478 | if (!(vismode & MESHVIS_COCKPIT)) { |
@@ -482,7 +496,7 @@ | ||
482 | 496 | if (internalpass) meshlist[i].mesh->Render(dev, pWT, mVP, 0x1); // Render VC |
483 | 497 | else meshlist[i].mesh->Render(dev, pWT, mVP, 0x0); // Render Exterior |
484 | 498 | |
485 | - | |
499 | + | |
486 | 500 | // render VC HUD and MFDs ------------------------------------------------------------------------ |
487 | 501 | // |
488 | 502 | if (bVC && internalpass) { |
@@ -496,11 +510,11 @@ | ||
496 | 510 | if (sMFD[mfd]) { |
497 | 511 | gc->clbkBlt(tMFD[mfd], 0, 0, sMFD[mfd]); |
498 | 512 | 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]); | |
500 | 514 | } |
501 | 515 | else { |
502 | 516 | 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); | |
504 | 518 | } |
505 | 519 | } |
506 | 520 | } |
@@ -510,7 +524,7 @@ | ||
510 | 524 | if (sHUD && hudspec->nmesh == i) { |
511 | 525 | gc->clbkBlt(tHUD, 0, 0, sHUD); |
512 | 526 | 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); | |
514 | 528 | } |
515 | 529 | } |
516 | 530 | } |
@@ -519,6 +533,13 @@ | ||
519 | 533 | } |
520 | 534 | |
521 | 535 | |
536 | +bool vVessel::RenderReentryTexture(LPDIRECT3DDEVICE9 dev) | |
537 | +{ | |
538 | + | |
539 | + return true; | |
540 | +} | |
541 | + | |
542 | + | |
522 | 543 | |
523 | 544 | bool vVessel::RenderExhaust(LPDIRECT3DDEVICE9 dev) |
524 | 545 | { |
@@ -905,7 +926,44 @@ | ||
905 | 926 | {0,0,0, 0,0,0, 0.99609375f, 0.49609375f} |
906 | 927 | }; |
907 | 928 | |
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 | +{ | |
908 | 946 | |
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 | + }; | |
909 | 967 | |
910 | 968 | MESHGROUPEX grp; memset(&grp, 0, sizeof(MESHGROUPEX)); |
911 | 969 |
@@ -918,7 +976,7 @@ | ||
918 | 976 | |
919 | 977 | pExhaust = new D3D9Mesh(gc, &grp, (MATERIAL*)&engmat, NULL); |
920 | 978 | } |
921 | - | |
979 | +*/ | |
922 | 980 | |
923 | 981 | // =========================================================================================== |
924 | 982 | // |
@@ -79,6 +79,7 @@ | ||
79 | 79 | bool Render (LPDIRECT3DDEVICE9 dev, bool internalpass); |
80 | 80 | |
81 | 81 | bool RenderExhaust (LPDIRECT3DDEVICE9 dev); |
82 | + bool RenderReentryTexture(LPDIRECT3DDEVICE9 dev); | |
82 | 83 | |
83 | 84 | /** |
84 | 85 | * \brief Render the vessel's active light beacons |