Commit MetaInfo

修订版5aed6816050b6c93bb8c5412f8871963496d8f33 (tree)
时间2019-11-05 05:35:37
作者 <Kuddel@c0f5...>

Log Message

- replaced oapiGetSize(hObj) calls of VObject descendants by 'size' (no functional change).
- some trailing spaces removed by IDE (no functional change).

更改概述

差异

diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/Mesh.cpp
--- a/Orbitersdk/D3D9Client/Mesh.cpp Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/Mesh.cpp Mon Nov 04 20:35:37 2019 +0000
@@ -100,7 +100,7 @@
100100 Grp = new GROUPREC[nGrp]; memset2(Grp, 0, sizeof(GROUPREC) * nGrp);
101101
102102 for (DWORD i=0;i<nGrp;i++) {
103- SetGroupRec(i, hGroup[i]);
103+ SetGroupRec(i, hGroup[i]);
104104 Grp[i].TexIdxEx[0] = SPEC_DEFAULT;
105105 Grp[i].TexMixEx[0] = 0.0f;
106106 Grp[i].TexIdx = i;
@@ -137,7 +137,7 @@
137137 D3D9Mesh::D3D9Mesh(const MESHGROUPEX *pGroup, const MATERIAL *pMat, D3D9ClientSurface *pTex) : D3D9Effect()
138138 {
139139 Null();
140-
140+
141141 // template meshes are stored in system memory
142142 nGrp = 1;
143143 Grp = new GROUPREC[nGrp]; memset2(Grp, 0, sizeof(GROUPREC) * nGrp);
@@ -149,7 +149,7 @@
149149 Mtrl = new D3D9MatExt[nMtrl];
150150 pGrpTF = new D3DXMATRIX[nGrp];
151151
152- SetGroupRec(0, pGroup);
152+ SetGroupRec(0, pGroup);
153153
154154 HR(pDev->CreateVertexBuffer(MaxVert*sizeof(NMVERTEX), 0, 0, D3DPOOL_DEFAULT, &pVB, NULL));
155155 HR(pDev->CreateIndexBuffer(MaxFace*sizeof(WORD)*3, 0, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &pIB, NULL));
@@ -184,7 +184,7 @@
184184 MaxVert = mesh.MaxVert;
185185
186186 memcpy2(Grp, mesh.Grp, sizeof(GROUPREC)*nGrp);
187-
187+
188188 HR(pDev->CreateVertexBuffer(MaxVert*sizeof(NMVERTEX), 0, 0, D3DPOOL_DEFAULT, &pVB, NULL));
189189 HR(pDev->CreateIndexBuffer(MaxFace*sizeof(WORD)*3, 0, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &pIB, NULL));
190190
@@ -198,7 +198,7 @@
198198 memcpy2(pITgt, pISrc, MaxFace*6);
199199 HR(mesh.pIB->Unlock());
200200 HR(pIB->Unlock());
201-
201+
202202
203203 HR(mesh.pVB->Lock(0, 0, (LPVOID*)&pVSrc, 0));
204204 HR(pVB->Lock(0, 0, (LPVOID*)&pVTgt, 0));
@@ -273,7 +273,7 @@
273273 void D3D9Mesh::Release()
274274 {
275275 SAFE_DELETEA(Locals);
276- SAFE_DELETEA(Grp);
276+ SAFE_DELETEA(Grp);
277277 SAFE_DELETEA(Tex);
278278 SAFE_DELETEA(Mtrl);
279279 SAFE_DELETEA(pGrpTF);
@@ -534,7 +534,7 @@
534534 if (!pVB) return;
535535
536536 if (bTextured) {
537-
537+
538538 XMVECTOR *ta = (XMVECTOR*)_aligned_malloc(sizeof(__m128)*(nVtx+1), 16);
539539 XMVECTOR zero = XMVectorSet(0, 0, 0, 0);
540540 for (DWORD i = 0; i < nVtx; i++) ta[i] = zero;
@@ -670,7 +670,7 @@
670670 Grp[i].nFace = mg->nIdx/3;
671671 Grp[i].nVert = mg->nVtx;
672672 MaxFace += Grp[i].nFace;
673- MaxVert += Grp[i].nVert;
673+ MaxVert += Grp[i].nVert;
674674 }
675675
676676
@@ -784,7 +784,7 @@
784784 pIB->Unlock();
785785 }
786786 }
787-
787+
788788 if (mg->nVtx>0) BoundingBox(pVert, mg->nVtx, &grp->BBox);
789789 else D9ZeroAABB(&grp->BBox);
790790
@@ -864,7 +864,7 @@
864864 NTVERTEX Convert(NMVERTEX &v)
865865 {
866866 NTVERTEX n;
867- n.x = v.x; n.y = v.y; n.z = v.z;
867+ n.x = v.x; n.y = v.y; n.z = v.z;
868868 n.nx = v.nx; n.ny = v.ny; n.nz = v.nz;
869869 n.tu = v.u; n.tv = v.v;
870870 return n;
@@ -1154,42 +1154,42 @@
11541154 // SET ---------------------------------------------------------------
11551155 if (bSet && value) {
11561156 switch (mid) {
1157- case MESHM_DIFFUSE:
1158- Mtrl[idx].Diffuse = *((D3DXVECTOR4*)value);
1157+ case MESHM_DIFFUSE:
1158+ Mtrl[idx].Diffuse = *((D3DXVECTOR4*)value);
11591159 Mtrl[idx].ModFlags |= D3D9MATEX_DIFFUSE;
11601160 bMtrlModidied = true;
11611161 return 0;
1162- case MESHM_AMBIENT:
1163- Mtrl[idx].Ambient = *((D3DXVECTOR3*)value);
1162+ case MESHM_AMBIENT:
1163+ Mtrl[idx].Ambient = *((D3DXVECTOR3*)value);
11641164 Mtrl[idx].ModFlags |= D3D9MATEX_AMBIENT;
11651165 bMtrlModidied = true;
11661166 return 0;
1167- case MESHM_SPECULAR:
1168- Mtrl[idx].Specular = *((D3DXVECTOR4*)value);
1167+ case MESHM_SPECULAR:
1168+ Mtrl[idx].Specular = *((D3DXVECTOR4*)value);
11691169 Mtrl[idx].ModFlags |= D3D9MATEX_SPECULAR;
11701170 bMtrlModidied = true;
11711171 return 0;
11721172 case MESHM_EMISSION:
1173- Mtrl[idx].Emissive = *((D3DXVECTOR3*)value);
1173+ Mtrl[idx].Emissive = *((D3DXVECTOR3*)value);
11741174 Mtrl[idx].ModFlags |= D3D9MATEX_EMISSIVE;
11751175 bMtrlModidied = true;
11761176 return 0;
1177- case MESHM_EMISSION2:
1178- Mtrl[idx].Emission2 = *((D3DXVECTOR3*)value);
1177+ case MESHM_EMISSION2:
1178+ Mtrl[idx].Emission2 = *((D3DXVECTOR3*)value);
11791179 Mtrl[idx].ModFlags |= D3D9MATEX_EMISSION2;
11801180 bMtrlModidied = true;
11811181 return 0;
1182- case MESHM_REFLECT:
1183- Mtrl[idx].Reflect = *((D3DXVECTOR3*)value);
1182+ case MESHM_REFLECT:
1183+ Mtrl[idx].Reflect = *((D3DXVECTOR3*)value);
11841184 Mtrl[idx].ModFlags |= D3D9MATEX_REFLECT;
11851185 bMtrlModidied = true;
11861186 return 0;
11871187 case MESHM_ROUGHNESS:
1188- Mtrl[idx].Roughness = value->g;
1188+ Mtrl[idx].Roughness = value->g;
11891189 Mtrl[idx].ModFlags |= D3D9MATEX_ROUGHNESS;
11901190 bMtrlModidied = true;
11911191 return 0;
1192- case MESHM_FRESNEL:
1192+ case MESHM_FRESNEL:
11931193 Mtrl[idx].Fresnel = *((D3DXVECTOR3*)value);
11941194 Mtrl[idx].ModFlags |= D3D9MATEX_FRESNEL;
11951195 bMtrlModidied = true;
@@ -1256,24 +1256,24 @@
12561256 Mtrl[idx].ModFlags &= (~D3D9MATEX_EMISSIVE);
12571257 bMtrlModidied = true;
12581258 return 0;
1259- case MESHM_EMISSION2:
1260- Mtrl[idx].Emission2 = D3DXVECTOR3(1, 1, 1);
1261- Mtrl[idx].ModFlags &= (~D3D9MATEX_EMISSION2);
1259+ case MESHM_EMISSION2:
1260+ Mtrl[idx].Emission2 = D3DXVECTOR3(1, 1, 1);
1261+ Mtrl[idx].ModFlags &= (~D3D9MATEX_EMISSION2);
12621262 bMtrlModidied = true;
12631263 return 0;
1264- case MESHM_REFLECT:
1265- Mtrl[idx].Reflect = D3DXVECTOR3(0,0,0);
1266- Mtrl[idx].ModFlags &= (~D3D9MATEX_REFLECT);
1264+ case MESHM_REFLECT:
1265+ Mtrl[idx].Reflect = D3DXVECTOR3(0,0,0);
1266+ Mtrl[idx].ModFlags &= (~D3D9MATEX_REFLECT);
12671267 bMtrlModidied = true;
12681268 return 0;
1269- case MESHM_ROUGHNESS:
1270- Mtrl[idx].Roughness = 0.0f;
1271- Mtrl[idx].ModFlags &= (~D3D9MATEX_ROUGHNESS);
1269+ case MESHM_ROUGHNESS:
1270+ Mtrl[idx].Roughness = 0.0f;
1271+ Mtrl[idx].ModFlags &= (~D3D9MATEX_ROUGHNESS);
12721272 bMtrlModidied = true;
12731273 return 0;
1274- case MESHM_FRESNEL:
1275- Mtrl[idx].Fresnel = D3DXVECTOR3(1, 0, 1024.0f);
1276- Mtrl[idx].ModFlags &= (~D3D9MATEX_FRESNEL);
1274+ case MESHM_FRESNEL:
1275+ Mtrl[idx].Fresnel = D3DXVECTOR3(1, 0, 1024.0f);
1276+ Mtrl[idx].ModFlags &= (~D3D9MATEX_FRESNEL);
12771277 bMtrlModidied = true;
12781278 return 0;
12791279 }
@@ -1387,7 +1387,7 @@
13871387
13881388 Grp[g].Shader = SHADER_PBR;
13891389 Grp[g].PBRStatus = 0;
1390-
1390+
13911391 DWORD ti = Grp[g].TexIdx;
13921392
13931393 if (Tex[ti] != NULL) {
@@ -1424,7 +1424,7 @@
14241424 //
14251425 void D3D9Mesh::Render(const LPD3DXMATRIX pW, int iTech, LPDIRECT3DCUBETEXTURE9 *pEnv, int nEnv)
14261426 {
1427-
1427+
14281428 _TRACE;
14291429
14301430 // Check material status
@@ -1465,11 +1465,11 @@
14651465 bool bMeshCull = true;
14661466 bool bTextured = true;
14671467 bool bGroupCull = true;
1468- bool bUpdateFlow = true;
1468+ bool bUpdateFlow = true;
14691469 bool bShadowProjection = false;
14701470
1471-
1472-
1471+
1472+
14731473 switch (iTech) {
14741474 case RENDER_VC:
14751475 EnablePlanetGlow(false);
@@ -1510,7 +1510,7 @@
15101510 }
15111511
15121512 D3DXMATRIX mWorldMesh;
1513-
1513+
15141514 if (bGlobalTF) D3DXMatrixMultiply(&mWorldMesh, &mTransform, pW);
15151515 else mWorldMesh = *pW;
15161516
@@ -1518,7 +1518,7 @@
15181518
15191519 D3D9MatExt *mat, *old_mat = NULL;
15201520 LPD3D9CLIENTSURFACE old_tex = NULL;
1521-
1521+
15221522 pDev->SetVertexDeclaration(pMeshVertexDecl);
15231523 pDev->SetStreamSource(0, pVB, 0, sizeof(NMVERTEX));
15241524 pDev->SetIndices(pIB);
@@ -1549,7 +1549,7 @@
15491549 int nMeshLights = 0;
15501550 D3DXVECTOR3 pos;
15511551 D3DXVec3TransformCoord(&pos, &D3DXVECTOR3f4(BBox.bs), pW);
1552-
1552+
15531553 // Find all local lights effecting this mesh ------------------------------------------
15541554 //
15551555 for (int i = 0; i < nSceneLights; i++) {
@@ -1564,21 +1564,21 @@
15641564
15651565 FX->SetBool(eLightsEnabled, true);
15661566
1567- // If any, Sort the list based on illuminance -------------------------------------------
1567+ // If any, Sort the list based on illuminance -------------------------------------------
15681568 qsort(LightList, nMeshLights, sizeof(_LightList), compare_lights);
15691569
15701570 nMeshLights = min(nMeshLights, Config->MaxLights());
15711571
15721572 // Create a list of N most effective lights ---------------------------------------------
1573- for (int i = 0; i < nMeshLights; i++) memcpy2(&Locals[i], &pLights[LightList[i].idx], sizeof(LightStruct));
1573+ for (int i = 0; i < nMeshLights; i++) memcpy2(&Locals[i], &pLights[LightList[i].idx], sizeof(LightStruct));
15741574 }
15751575 }
15761576
15771577 FX->SetValue(eLights, Locals, sizeof(LightStruct) * Config->MaxLights());
1578-
1578+
15791579
15801580 if (nEnv >= 1 && pEnv[0]) FX->SetTexture(eEnvMapA, pEnv[0]);
1581-
1581+
15821582
15831583 UINT numPasses = 0;
15841584 HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
@@ -1592,10 +1592,10 @@
15921592
15931593 for (DWORD g=0; g<nGrp; g++) {
15941594
1595-
1595+
15961596 bool bHUD = (Grp[g].MFDScreenId == 0x100);
15971597
1598- // Inline engine renders HUD/MFDs in a separate rendering pass and flag 0x2 is used to disable rendering during the main rendering pass
1598+ // Inline engine renders HUD/MFDs in a separate rendering pass and flag 0x2 is used to disable rendering during the main rendering pass
15991599 if ((Grp[g].UsrFlag & 0x2) && (!bHUD)) continue;
16001600
16011601
@@ -1625,7 +1625,7 @@
16251625 HR(FX->BeginPass(Grp[g].Shader));
16261626 CurrentShader = Grp[g].Shader;
16271627 }
1628-
1628+
16291629
16301630
16311631 // Mesh Debugger -------------------------------------------------------------------------------------------
@@ -1682,7 +1682,7 @@
16821682
16831683 if (CurrentShader == SHADER_LEGACY) {
16841684 if (tni && Grp[g].TexMixEx[0] < 0.5f) tni = 0;
1685- if (tni && Tex[tni]) FX->SetTexture(eEmisMap, Tex[tni]->GetTexture());
1685+ if (tni && Tex[tni]) FX->SetTexture(eEmisMap, Tex[tni]->GetTexture());
16861686 }
16871687 else {
16881688
@@ -1747,14 +1747,14 @@
17471747 old_mat = NULL;
17481748 reset(FC);
17491749 bUpdateFlow = true;
1750-
1750+
17511751 SURFHANDLE hMFD;
17521752 if (bHUD) hMFD = gc->GetVCHUDSurface(&hudspec);
17531753 else hMFD = gc->GetMFDSurface(Grp[g].MFDScreenId - 1);
17541754
17551755 if (hMFD) FX->SetTexture(eTex0, SURFACE(hMFD)->GetTexture());
17561756 else FX->SetTexture(eTex0, gc->GetDefaultTexture()->GetTexture());
1757-
1757+
17581758 if (Grp[g].MtrlIdx==SPEC_DEFAULT) mat = &mfdmat;
17591759 else mat = &Mtrl[Grp[g].MtrlIdx];
17601760
@@ -1801,7 +1801,7 @@
18011801 bUpdateFlow = false;
18021802 HR(FX->SetValue(eFlow, &FC, sizeof(TexFlow)));
18031803 }
1804-
1804+
18051805 bool bPBR = (Grp[g].PBRStatus & 0xF) == (0x8 + 0x4);
18061806 bool bRGH = (Grp[g].PBRStatus & 0xE) == (0x8 + 0x2);
18071807 bool bNoL = (Grp[g].UsrFlag & 0x04) != 0;
@@ -1816,7 +1816,7 @@
18161816 FX->SetBool(eNoColor, bNoC);
18171817 FX->SetBool(eSwitch, bPBR);
18181818 FX->SetBool(eRghnSw, bRGH);
1819-
1819+
18201820
18211821 // Update envmap and fresnel status as required
18221822 if (bRefl) {
@@ -2054,17 +2054,17 @@
20542054
20552055 FX->SetBool(eLightsEnabled, true);
20562056
2057- // If any, Sort the list based on illuminance -------------------------------------------
2057+ // If any, Sort the list based on illuminance -------------------------------------------
20582058 qsort(LightList, nMeshLights, sizeof(_LightList), compare_lights);
20592059
20602060 nMeshLights = min(nMeshLights, Config->MaxLights());
20612061
20622062 // Create a list of N most effective lights ---------------------------------------------
20632063 int i;
2064- for (i = 0; i < nMeshLights; i++) memcpy2(&Locals[i], &pLights[LightList[i].idx], sizeof(LightStruct));
2064+ for (i = 0; i < nMeshLights; i++) memcpy2(&Locals[i], &pLights[LightList[i].idx], sizeof(LightStruct));
20652065 }
20662066 }
2067-
2067+
20682068 FX->SetValue(eLights, Locals, sizeof(LightStruct) * Config->MaxLights());
20692069
20702070 UINT numPasses = 0;
@@ -2132,7 +2132,7 @@
21322132 D3D9Stats.Mesh.TexChanges++;
21332133
21342134 if (DebugControls::IsActive()) if (pTune) FX->SetValue(eTune, &pTune[ti], sizeof(D3D9Tune));
2135-
2135+
21362136 old_tex = Tex[ti];
21372137 FX->SetTexture(eTex0, Tex[ti]->GetTexture());
21382138
@@ -2327,7 +2327,7 @@
23272327 D3D9MatExt *mat, *old_mat = NULL;
23282328 LPD3D9CLIENTSURFACE old_tex = NULL;
23292329 LPDIRECT3DTEXTURE9 pNorm = NULL;
2330-
2330+
23312331 pDev->SetVertexDeclaration(pMeshVertexDecl);
23322332 pDev->SetStreamSource(0, pVB, 0, sizeof(NMVERTEX));
23332333 pDev->SetIndices(pIB);
@@ -2341,8 +2341,8 @@
23412341 //FX->SetBool(eUseSpec, false);
23422342 //FX->SetBool(eUseEmis, false);
23432343 //FX->SetBool(eUseRefl, false);
2344-
2345-
2344+
2345+
23462346 UINT numPasses = 0;
23472347 HR(FX->Begin(&numPasses, D3DXFX_DONOTSAVESTATE));
23482348
@@ -2363,7 +2363,7 @@
23632363 DWORD tni=Grp[g].TexIdxEx[0];
23642364
23652365 if (ti==0 && tni!=0) continue;
2366-
2366+
23672367 if (Tex[ti]==NULL || ti==0) bTextured = false;
23682368 else bTextured = true;
23692369
@@ -2440,7 +2440,7 @@
24402440 if (!pIB || !pGB) return;
24412441
24422442 D3DXMATRIX GroupMatrix, mWorldMesh; UINT numPasses = 0;
2443-
2443+
24442444 if (bGlobalTF) D3DXMatrixMultiply(&mWorldMesh, &mTransform, pW);
24452445 else mWorldMesh = *pW;
24462446
@@ -2461,7 +2461,7 @@
24612461
24622462 bool bInit = true;
24632463 bool bCurrentState = false;
2464-
2464+
24652465 for (DWORD g = 0; g < nGrp; g++) {
24662466
24672467
@@ -2485,7 +2485,7 @@
24852485
24862486
24872487 if (bShadowMap) {
2488-
2488+
24892489 bool bDisable = (Grp[g].UsrFlag & 0x1) != 0;
24902490
24912491 if (bDisable != bCurrentState) {
@@ -2516,7 +2516,7 @@
25162516 void D3D9Mesh::RenderShadowsEx(float alpha, const LPD3DXMATRIX pP, const LPD3DXMATRIX pW, const D3DXVECTOR4 *light, const D3DXVECTOR4 *param)
25172517 {
25182518 if (!pVB || !pGB) return;
2519-
2519+
25202520 D3D9Stats.Mesh.Meshes++;
25212521
25222522 pDev->SetVertexDeclaration(pVector4Decl);
@@ -2746,9 +2746,9 @@
27462746 void D3D9Mesh::SetRotation(D3DXMATRIX &rot)
27472747 {
27482748 bGlobalTF = true;
2749-
2749+
27502750 memcpy(&mTransform, &rot, 48);
2751-
2751+
27522752 D3DXMatrixInverse(&mTransformInv, NULL, &mTransform);
27532753
27542754 for (DWORD i = 0; i<nGrp; i++) {
@@ -2869,7 +2869,7 @@
28692869
28702870 float dst = D3DXVec3Dot(&bs, vDir);
28712871 float len2 = D3DXVec3Dot(&bs, &bs);
2872-
2872+
28732873 if (dst < -rad) continue;
28742874 if (sqrt(len2 - dst*dst) > rad) continue;
28752875
@@ -2880,7 +2880,7 @@
28802880
28812881 WORD *pIdc = &pIBSys[Grp[g].FaceOff*3];
28822882 D3DXVECTOR3 *pVrt = &pGBSys[Grp[g].VertOff];
2883-
2883+
28842884 D3DXMATRIX mWI; float det;
28852885 D3DXMatrixInverse(&mWI, &det, &mW);
28862886
@@ -2894,7 +2894,7 @@
28942894 WORD a = pIdc[i*3+0];
28952895 WORD b = pIdc[i*3+1];
28962896 WORD c = pIdc[i*3+2];
2897-
2897+
28982898 _a = pVrt[a];
28992899 _b = pVrt[b];
29002900 _c = pVrt[c];
@@ -2902,7 +2902,7 @@
29022902 float u, v, dst;
29032903
29042904 D3DXVec3Cross(&cp, &(_c - _b), &(_a - _b));
2905-
2905+
29062906 if (D3DXVec3Dot(&cp, &dir)<0) {
29072907 if (D3DXIntersectTri(&_c, &_b, &_a, &pos, &dir, &u, &v, &dst)) {
29082908 if (dst > 0.1f) {
@@ -2920,7 +2920,7 @@
29202920 }
29212921 }
29222922
2923-
2923+
29242924 if (result.idx >= 0 && result.group >= 0) {
29252925
29262926 int i = result.idx;
@@ -2956,7 +2956,7 @@
29562956 D3DXVec3Normalize(&result.normal, &cp);
29572957
29582958 D3DXVECTOR3 p = (_b * u) + (_a * v) + (_c * (1.0f - u - v));
2959- D3DXVec3TransformCoord(&result.pos, &p, &mW);
2959+ D3DXVec3TransformCoord(&result.pos, &p, &mW);
29602960 }
29612961
29622962 return result;
@@ -3133,4 +3133,4 @@
31333133 UpdateGeometryBuffer();
31343134 CheckMeshStatus();
31353135 return true;
3136-}
\ No newline at end of file
3136+}
diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/Mesh.h
--- a/Orbitersdk/D3D9Client/Mesh.h Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/Mesh.h Mon Nov 04 20:35:37 2019 +0000
@@ -20,7 +20,7 @@
2020 #include "D3D9Client.h"
2121 #include "D3D9Effect.h"
2222 #include "AABBUtil.h"
23-#include <d3d9.h>
23+#include <d3d9.h>
2424 #include <d3dx9.h>
2525 #include <vector>
2626
@@ -54,7 +54,7 @@
5454 float illuminace;
5555 };
5656
57-
57+
5858 /**
5959 * \brief Mesh object with D3D9-specific vertex buffer
6060 *
@@ -62,7 +62,7 @@
6262 * textures.
6363 */
6464
65-class D3D9Mesh : private D3D9Effect
65+class D3D9Mesh : private D3D9Effect
6666 {
6767
6868 public:
@@ -72,7 +72,7 @@
7272 bool bMtrlModidied;
7373
7474 D9BBox BBox;
75-
75+
7676 struct GROUPREC { // mesh group definition
7777 DWORD VertOff; // Main mesh Vertex Offset
7878 DWORD FaceOff; // Main mesh Index Offset
@@ -92,7 +92,7 @@
9292 bool bUpdate; // Bounding box update required
9393 bool bDualSided;
9494 bool bDeleted; // This entry is deleted by DelGroup()
95- bool bRendered;
95+ bool bRendered;
9696 //bool bAdvanced; // This group reguires more advanced shader than default one
9797 D3DXMATRIX Transform; // Group specific transformation matrix
9898 D9BBox BBox;
@@ -102,7 +102,7 @@
102102
103103 explicit D3D9Mesh(const char *name);
104104 D3D9Mesh(const D3D9Mesh &mesh) : D3D9Effect() { Copy(mesh); }
105-
105+
106106 /**
107107 * \brief Create a mesh consisting of a single mesh group
108108 * \param client graphics client
@@ -125,12 +125,12 @@
125125 void UnLockIndexBuffer();
126126 NMVERTEX * LockVertexBuffer(DWORD grp, DWORD flags);
127127 WORD * LockIndexBuffer(DWORD grp, DWORD flags);
128-
128+
129129 void SetName(const char *name);
130130 const char * GetName() const { return name; }
131131
132132 void SetClass(DWORD cl) { vClass = cl; }
133-
133+
134134
135135 /**
136136 * \brief Check if a mesh is casting shadows
@@ -151,7 +151,7 @@
151151 * \brief Returns number of material specifications.
152152 * \return Number of materials.
153153 */
154- SURFHANDLE GetTexture(DWORD idx) const { return Tex[idx]; }
154+ SURFHANDLE GetTexture(DWORD idx) const { return Tex[idx]; }
155155 bool HasTexture(SURFHANDLE hSurf);
156156 bool IsReflective() const { return bIsReflective; }
157157
@@ -210,7 +210,7 @@
210210 void RenderRings(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex);
211211 void RenderRings2(const LPD3DXMATRIX pW, LPDIRECT3DTEXTURE9 pTex, float irad, float orad);
212212 void RenderAxisVector(LPD3DXMATRIX pW, const LPD3DXCOLOR pColor, float len);
213-
213+
214214 void CheckMeshStatus();
215215 void ConvertToDynamic();
216216 void ResetTransformations();
@@ -222,9 +222,9 @@
222222 void UpdateGroup(MESHHANDLE hMesh, DWORD idx);
223223
224224 void SetSunLight(const D3D9Sun *pLight);
225-
225+
226226 D3D9Pick Pick(const LPD3DXMATRIX pW, const LPD3DXMATRIX pT, const D3DXVECTOR3 *vDir);
227-
227+
228228 void UpdateBoundingBox();
229229 void BoundingBox(const NMVERTEX *vtx, DWORD n, D9BBox *box);
230230
@@ -244,7 +244,7 @@
244244 * calculated as the product of material and texture alpha value.
245245 */
246246 inline void EnableMatAlpha (bool enable) { bModulateMatAlpha = enable; }
247-
247+
248248 DWORD AddTexture(D3D9ClientSurface *pTex);
249249 DWORD AddMaterial(D3D9MatExt *pMat);
250250 void SetMeshGroupTextureIdx(DWORD grp, DWORD tex_idx);
@@ -267,7 +267,7 @@
267267
268268 D3DXVECTOR3 *pGBSys;
269269 WORD *pIBSys;
270-
270+
271271 DWORD MaxVert;
272272 DWORD MaxFace;
273273 DWORD Constr;
@@ -289,9 +289,9 @@
289289
290290 _LightList LightList[MAX_SCENE_LIGHTS];
291291 LightStruct *Locals;
292-
293292
294- bool bDynamic; // Mesh is using a dynamic vertex buffer for faster read-modify-write
293+
294+ bool bDynamic; // Mesh is using a dynamic vertex buffer for faster read-modify-write
295295 bool bBSRecompute; // Bounding sphere must be recomputed
296296 bool bBSRecomputeAll;
297297 bool bModulateMatAlpha; // mix material and texture alpha channels
@@ -299,7 +299,7 @@
299299
300300 char name[128];
301301
302-
302+
303303 };
304304
305-#endif // !__MESH_H
\ No newline at end of file
305+#endif // !__MESH_H
diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/VObject.cpp
--- a/Orbitersdk/D3D9Client/VObject.cpp Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/VObject.cpp Mon Nov 04 20:35:37 2019 +0000
@@ -51,11 +51,11 @@
5151 , bOmit (false)
5252 , scn( (Scene *)scene) // should be const!
5353 , sunapprad()
54- , sundst()
54+ , sundst ()
55+ , size (oapiGetSize(_hObj))
5556 {
5657 _TRACE;
5758 D3DXMatrixIdentity(&mWorld);
58- size = oapiGetSize(hObj);
5959 cdist = 0.0;
6060 dmWorld = identity4();
6161 albedo = _V(1,1,1);
@@ -303,14 +303,13 @@
303303 cpos = gpos - scn->GetCameraGPos();
304304 cdist = length(cpos);
305305
306- double rad = oapiGetSize(hObj);
307- double alt = max(1.0, cdist-rad);
308- double apr = rad * scn->ViewH()*0.5 / (alt * tan(scn->GetCameraAperture()));
306+ double alt = max(1.0, cdist - size);
307+ double apr = size * scn->ViewH()*0.5 / (alt * tan(scn->GetCameraAperture()));
309308
310309 double ds = 10000.0 / cdist;
311310 double s = 2.0;
312311 if (apr<0.3) s = 1.0;
313- float size = float(rad * ds * s/apr);
312+ float scale = float(size * ds * s/apr);
314313
315314 D3DXMATRIX W;
316315 D3DXVECTOR3 vCam;
@@ -318,7 +317,7 @@
318317 vPos*=float(ds);
319318
320319 D3DXVec3Normalize(&vCam, &vPos);
321- D3DMAT_CreateX_Billboard(&vCam, &vPos, size, &W);
320+ D3DMAT_CreateX_Billboard(&vCam, &vPos, scale, &W);
322321
323322 float ints = float(sqrt(1.0+dotp(unit(gpos-spos), unit(cpos)))) * 1.0f;
324323
diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/VPlanet.cpp
--- a/Orbitersdk/D3D9Client/VPlanet.cpp Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/VPlanet.cpp Mon Nov 04 20:35:37 2019 +0000
@@ -77,7 +77,7 @@
7777 }
7878 prm.horizon_minelev = *(double*)oapiGetObjectParam(_hObj, OBJPRM_PLANET_MINELEVATION);
7979 prm.horizon_minrad = min (1.0 + prm.horizon_minelev / size, 1.0 - 1e-4);
80-
80+
8181 prm.bAtm = oapiPlanetHasAtmosphere (_hObj);
8282 if (prm.bAtm) {
8383 const ATMCONST *atmc = oapiGetPlanetAtmConstants(_hObj);
@@ -143,7 +143,7 @@
143143 } else {
144144 ringmgr = 0;
145145 }
146-
146+
147147 memcpy2 (&fog, oapiGetObjectParam (_hObj, OBJPRM_PLANET_FOGPARAM), sizeof (FogParam));
148148 prm.bFogEnabled = (fog.dens_0 > 0);
149149
@@ -151,7 +151,7 @@
151151
152152 //if (*(bool*)gc->GetConfigParam(CFGPRM_ATMFOG)==false) prm.bFogEnabled = false;
153153
154-
154+
155155 nbase = oapiGetBaseCount (_hObj);
156156 if (nbase) vbase = new vBase*[nbase];
157157 else vbase = NULL;
@@ -168,8 +168,8 @@
168168 vbase[i] = new vBase (hBase, scn, this);
169169 }
170170 }
171- }
172-
171+ }
172+
173173 mesh = NULL;
174174 if (surfmgr && surfmgr->GetMaxLevel() == 0) {
175175 char cbuf[256];
@@ -184,8 +184,8 @@
184184 // Create a rock patch mesh --------------------------------------------------------------
185185 //
186186 pRockPatch = NULL;
187-
188-
187+
188+
189189 // Add a cursor object into the scene ------------------------
190190 //
191191 hCursor[0] = AddMarker(D3D9SM_SPHERE, 0.0, 0.0, 80.0f, &D3DXCOLOR(0, 0, 0.75, 0.5f)); // Cursor
@@ -319,9 +319,9 @@
319319
320320 float dst = D3DXVec3Length(&pos);
321321
322- *dmin = dst - float(oapiGetSize(hObj));
322+ *dmin = dst - float(size);
323323 *zmin = *dmin;
324- *zmax = dst + float(oapiGetSize(hObj));
324+ *zmax = dst + float(size);
325325
326326 return true;
327327 }
@@ -348,7 +348,7 @@
348348 void vPlanet::PickSurface(TILEPICK *result)
349349 {
350350 if (surfmgr2) {
351-
351+
352352 surfmgr2->Pick(result);
353353
354354 if (result->pTile) {
@@ -399,7 +399,7 @@
399399 HSRFOBJ vPlanet::AddObject(D3D9Mesh *pMesh, double lng, double lat, float rot, bool bDual, float scale)
400400 {
401401 _SRFMARKER m; memset(&m, 0, sizeof(_SRFMARKER));
402-
402+
403403 m.lng = lng;
404404 m.lat = lat;
405405 m.rot = rot;
@@ -409,10 +409,10 @@
409409 m.pMesh = pMesh;
410410 m.type = 0;
411411 m.bEnabled = true;
412-
412+
413413 D3DXMatrixRotationAxis(&m.mWorld, &D3DXVEC(m.uPos), rot);
414414 D3DXMatrixScaling(&m.mWorld, scale, scale, scale);
415-
415+
416416 Markers.push_front(m);
417417 return Markers.begin();
418418 }
@@ -431,10 +431,10 @@
431431 m.vColor = D3DXC2V(*color);
432432 m.type = WORD(type);
433433 m.bEnabled = true;
434-
434+
435435 switch (type) {
436436 case D3D9SM_SPHERE:
437- {
437+ {
438438 m.bDual = true;
439439 m.pMesh = hStockMesh[type];
440440 }
@@ -487,7 +487,7 @@
487487 {
488488 _TRACE;
489489 if (!active) return false;
490-
490+
491491 vObject::Update(bMainScene);
492492
493493 // Update Sunlight direction -------------------------------------
@@ -565,7 +565,7 @@
565565 }
566566
567567 // check all base visuals
568- if (nbase) {
568+ if (nbase) {
569569 VECTOR3 pos, cpos = scn->GetCameraGPos();
570570 double scale = (double)scn->ViewH()/scn->GetTanAp();
571571 for (DWORD i = 0; i < nbase; i++) {
@@ -591,11 +591,11 @@
591591 }
592592
593593 // Toggle surface base on/off based on visual size -----------------
594- //
594+ //
595595 if (vbase[i]) {
596596 if (apprad < 1.0) vbase[i]->Activate(false);
597597 else if (apprad > 2.0) vbase[i]->Activate(true);
598- vbase[i]->Update(bMainScene);
598+ vbase[i]->Update(bMainScene);
599599 }
600600 }
601601 }
@@ -631,8 +631,8 @@
631631 if (hazemgr) { delete hazemgr; hazemgr = NULL; }
632632 if (hazemgr2) { delete hazemgr2; hazemgr2 = NULL; }
633633 } else {
634- if (tilever>1 && bScatter) {
635- if (!hazemgr2) hazemgr2 = new HazeManager2 (scn->GetClient(), this);
634+ if (tilever>1 && bScatter) {
635+ if (!hazemgr2) hazemgr2 = new HazeManager2 (scn->GetClient(), this);
636636 }
637637 else if (!hazemgr) hazemgr = new HazeManager (scn->GetClient(), this);
638638 }
@@ -683,7 +683,7 @@
683683 HR(D3D9Effect::FX->SetBool(D3D9Effect::eShadowToggle, true));
684684 }
685685 }
686-
686+
687687
688688 PlanetRenderer::InitializeScattering(this);
689689 PlanetRenderer::SetViewProjectionMatrix(scn->GetProjectionViewMatrix());
@@ -721,9 +721,9 @@
721721
722722 if (ringmgr) {
723723 ringmgr->Render(dev, mWorld, false);
724- dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
724+ dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
725725 }
726-
726+
727727 if (hazemgr2) {
728728 double apr = 180.0 * scn->GetCameraAperture() / (scn->GetCameraAspect() * PI);
729729 hazemgr2->Render(mWorld, float(apr));
@@ -733,8 +733,8 @@
733733 RenderCloudLayer (dev, D3DCULL_NONE); // render clouds from below
734734
735735 if (hazemgr) hazemgr->Render(dev, mWorld); // horizon ring
736-
737-
736+
737+
738738 if (prm.bAtm) {
739739 if (ModLighting (amb))
740740 prm.AmbColor = D3DXCOLOR(amb);
@@ -785,7 +785,7 @@
785785 mesh->SetSunLight(scn->GetSun());
786786 mesh->Render(&mWorld, RENDER_ASTEROID);
787787 } else {
788- RenderSphere (dev);
788+ RenderSphere (dev);
789789 }
790790
791791 if (nbase) RenderBaseStructures (dev);
@@ -796,7 +796,7 @@
796796 if (hazemgr) hazemgr->Render (dev, mWorld, true); // haze across planet disc
797797 if (ringmgr) {
798798 ringmgr->Render (dev, mWorld, true);
799- dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
799+ dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
800800 }
801801
802802 }
@@ -811,14 +811,14 @@
811811
812812 void vPlanet::RenderBeacons(LPDIRECT3DDEVICE9 dev)
813813 {
814- // Beacons rendered elsewhere before the cloud layer
814+ // Beacons rendered elsewhere before the cloud layer
815815 }
816816
817817 // ==============================================================
818818 /*
819819 void vPlanet::RenderSurfaceMicroDetails(LPDIRECT3DDEVICE9 dev)
820820 {
821-
821+
822822 }
823823 */
824824 // ==============================================================
@@ -869,9 +869,9 @@
869869 }
870870
871871 if (bLog) D3D9SetTime(D3D9Stats.Timer.Surface, tot_surf);
872- }
872+ }
873873 else {
874- dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
874+ dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
875875 if (prm.bFog) D3D9Effect::FX->SetFloat(D3D9Effect::eFogDensity, fogfactor/dist_scale);
876876 surfmgr->SetAmbientColor(prm.AmbColor);
877877 surfmgr->Render (dev, mWorld, dist_scale, patchres, 0.0, prm.bFog); // surface
@@ -900,7 +900,7 @@
900900 double tot_cloud = D3D9GetTime();
901901
902902 if (cullmode != D3DCULL_CCW) dev->SetRenderState (D3DRS_CULLMODE, cullmode);
903- if (cloudmgr2) {
903+ if (cloudmgr2) {
904904 cloudmgr2->Render(dmWorld, false, prm);
905905 }
906906 else
@@ -917,12 +917,12 @@
917917 if (cloudmgr2) {
918918 //if (prm.bCloudFlatShadows)
919919 // cloudmgr2->RenderFlatCloudShadows (dmWorld, prm);
920- }
920+ }
921921 else if (clouddata) { // legacy method
922922 float fogfactor;
923923 D3D9Effect::FX->GetFloat(D3D9Effect::eFogDensity, &fogfactor);
924924 if (prm.bFog) D3D9Effect::FX->SetFloat(D3D9Effect::eFogDensity, fogfactor/dist_scale);
925- clouddata->cloudmgr->RenderShadow(dev, clouddata->mWorldC0, dist_scale, min(patchres,8), clouddata->viewap, clouddata->shadowalpha);
925+ clouddata->cloudmgr->RenderShadow(dev, clouddata->mWorldC0, dist_scale, min(patchres,8), clouddata->viewap, clouddata->shadowalpha);
926926 if (prm.bFog) D3D9Effect::FX->SetFloat(D3D9Effect::eFogDensity, fogfactor);
927927 }
928928 }
@@ -932,7 +932,7 @@
932932 void vPlanet::RenderBaseSurfaces(LPDIRECT3DDEVICE9 dev)
933933 {
934934 for (DWORD i=0;i<nbase;i++) if (vbase[i]) {
935- vbase[i]->RenderSurface(dev);
935+ vbase[i]->RenderSurface(dev);
936936 vbase[i]->RenderRunwayLights(dev);
937937 }
938938 }
@@ -995,14 +995,14 @@
995995
996996 D3DXVECTOR3 lambda4 = D3DXVECTOR3(pow(float(SPrm.red),rp), pow(float(SPrm.green),rp), pow(float(SPrm.blue),rp));
997997 D3DXVECTOR3 lambda2 = D3DXVECTOR3(pow(float(SPrm.red),mp), pow(float(SPrm.green),mp), pow(float(SPrm.blue),mp));
998-
998+
999999 D3DXVec3Normalize(&lambda4, &lambda4);
10001000 D3DXVec3Normalize(&lambda2, &lambda2);
10011001
10021002 D3DXVECTOR3 vOutTotSun = lambda4*float(SPrm.rout) + lambda2*float(SPrm.mie);
10031003 D3DXVECTOR3 vRayInSct = lambda4*float(SPrm.rin * SPrm.rout);
10041004
1005- double fDPS = max(0.34, dotp(unit(vPos), sundir));
1005+ double fDPS = max(0.34, dotp(unit(vPos), sundir));
10061006 double fDns = exp2(-fAlt * prm.InvSclHeight);
10071007
10081008 return exp2(-vOutTotSun * float(fDns * AngleCoEff(fDPS)));
@@ -1050,12 +1050,12 @@
10501050 double R = R0 + alt;
10511051
10521052 double rdt = -R * cos(dir);
1053- double Ray = rdt + sqrt(R1*R1 - (R*R - rdt*rdt));
1053+ double Ray = rdt + sqrt(R1*R1 - (R*R - rdt*rdt));
10541054
1055- double p0 = Ray * 0.0;
1056- double p1 = Ray * 0.2765;
1057- double p2 = Ray * 0.7235;
1058- double p3 = Ray * 1.0;
1055+ double p0 = Ray * 0.0;
1056+ double p1 = Ray * 0.2765;
1057+ double p2 = Ray * 0.7235;
1058+ double p3 = Ray * 1.0;
10591059
10601060 double a0 = sqrt(R*R + p0*p0 + 2.0*R*p0*cos(dir)) - R0;
10611061 double a1 = sqrt(R*R + p1*p1 + 2.0*R*p1*cos(dir)) - R0;
@@ -1090,7 +1090,7 @@
10901090 for (int i=0;i<samples;i++) {
10911091 double exact = ExactOpticalDepth(0.0, angle, size, outer, prm.SclHeight) / prm.SclHeight;
10921092 double gauss = GaussLobatto(0.0, angle, size, outer, prm.SclHeight) / prm.SclHeight;
1093- double accur = OpticalDepth(0.0, cos(angle)) / double(prm.SclHeight);
1093+ double accur = OpticalDepth(0.0, cos(angle)) / double(prm.SclHeight);
10941094 angle += delta;
10951095 fprintf(fp,"%d %6.6g %6.6g %6.6g\n", i, exact, accur, gauss);
10961096 }
@@ -1108,9 +1108,9 @@
11081108 if (mode==0 && alt>0.5) mode = 2;
11091109 if (mode==0 && alt<0.5) mode = 1;
11101110
1111- if (mode==1) return &SPrm; // Surface configuration
1111+ if (mode==1) return &SPrm; // Surface configuration
11121112 if (mode==2) return &OPrm; // Orbital configuration
1113-
1113+
11141114 // ----------------------------------------------------
11151115 CPrm.aux1 = lerp(SPrm.aux1, OPrm.aux1, alt);
11161116 CPrm.aux2 = lerp(SPrm.aux2, OPrm.aux2, alt);
@@ -1135,11 +1135,11 @@
11351135 CPrm.hazei = lerp(SPrm.hazei, OPrm.hazei, alt);
11361136 // ----------------------------------------------------
11371137 CPrm.height = SPrm.height;
1138-
1138+
11391139 return &CPrm;
11401140 }
1141-
1142-
1141+
1142+
11431143
11441144 // ==============================================================
11451145
@@ -1191,14 +1191,14 @@
11911191 oapiReadItem_float(hFile, "AGamma", prm->agamma);
11921192 oapiReadItem_float(hFile, "HazeClr", prm->hazec);
11931193 oapiReadItem_float(hFile, "HazeIts", prm->hazei);
1194-
1194+
11951195 oapiCloseFile(hFile, FILE_IN_ZEROONFAIL);
11961196
11971197 if (!oapiPlanetHasAtmosphere(hObj)) return false;
11981198
11991199 UpdateAtmoConfig();
12001200 return true;
1201-
1201+
12021202 }
12031203
12041204 // ==============================================================
@@ -1237,7 +1237,7 @@
12371237 // -----------------------------------------------------------------
12381238 oapiWriteItem_float(hFile, "MiePower", prm->mie);
12391239 oapiWriteItem_float(hFile, "MiePhase", prm->mphase);
1240- // -----------------------------------------------------------------
1240+ // -----------------------------------------------------------------
12411241 oapiWriteItem_float(hFile, "Aux1", prm->aux1);
12421242 oapiWriteItem_float(hFile, "Aux2", prm->aux2);
12431243 oapiWriteItem_float(hFile, "Aux3", prm->aux3);
@@ -1245,7 +1245,7 @@
12451245 oapiWriteItem_float(hFile, "AGamma", prm->agamma);
12461246 oapiWriteItem_float(hFile, "HazeClr", prm->hazec);
12471247 oapiWriteItem_float(hFile, "HazeIts", prm->hazei);
1248-
1248+
12491249 oapiCloseFile(hFile, FILE_OUT);
12501250
12511251 DumpDebugFile();
@@ -1312,7 +1312,7 @@
13121312 bool vPlanet::ParseMicroTextures()
13131313 {
13141314 if (Config->MicroMode==0) return false; // Micro textures are disabled
1315- if (surfmgr2==NULL) return false; // Only supported with tile format 2
1315+ if (surfmgr2==NULL) return false; // Only supported with tile format 2
13161316
13171317 // Parse file (only once!)
13181318 if (!bMicroTexFileRead) {
diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/VStar.cpp
--- a/Orbitersdk/D3D9Client/VStar.cpp Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/VStar.cpp Mon Nov 04 20:35:37 2019 +0000
@@ -20,7 +20,6 @@
2020
2121 vStar::vStar(OBJHANDLE _hObj, const Scene *scene): vObject (_hObj, scene)
2222 {
23-// size = oapiGetSize(_hObj);
2423 maxdist = 0.5*scene->GetCameraFarPlane();
2524 }
2625
@@ -71,7 +70,7 @@
7170 mWorld._21 = -(mWorld._12*mWorld._33 - mWorld._32*mWorld._13); //0;
7271 mWorld._22 = -(mWorld._13*mWorld._31 - mWorld._33*mWorld._11); //1;
7372 mWorld._23 = -(mWorld._11*mWorld._32 - mWorld._31*mWorld._12); // 0;
74-
73+
7574 // artificially reduce size reduction with distance
7675 // to make star appear larger
7776 size_hack = float(1.0+pow(cdist,0.6)*1e-6);
diff -r 65e72438aa43 -r 5aed6816050b Orbitersdk/D3D9Client/VVessel.cpp
--- a/Orbitersdk/D3D9Client/VVessel.cpp Mon Nov 04 18:27:33 2019 +0000
+++ b/Orbitersdk/D3D9Client/VVessel.cpp Mon Nov 04 20:35:37 2019 +0000
@@ -781,7 +781,7 @@
781781
782782 DWORD bfvmode = *(DWORD*)gc->GetConfigParam(CFGPRM_SHOWBODYFORCEVECTORSFLAG);
783783 float sclset = *(float*)gc->GetConfigParam(CFGPRM_BODYFORCEVECTORSSCALE);
784- float scale = float(oapiGetSize(hObj)) / 50.0f;
784+ float scale = float(size) / 50.0f;
785785
786786 // -------------------------------------
787787 // Render Body Force Vectors
@@ -802,10 +802,10 @@
802802 if (bfvmode & BFV_TOTAL) { vessel->GetForceVector(vector); if (length(vector)>len) len = length(vector); }
803803 if (bfvmode & BFV_TORQUE) { vessel->GetTorqueVector(vector); if (length(vector)>len) len = length(vector); }
804804
805- lscale = float(oapiGetSize(hObj)*sclset/len);
805+ lscale = float(size * sclset / len);
806806 }
807807 else {
808- lscale = float(oapiGetSize(hObj))*sclset/50.0f;
808+ lscale = float(size * sclset / 50.0);
809809 }
810810
811811 alpha = *(float*)gc->GetConfigParam(CFGPRM_BODYFORCEVECTORSOPACITY);
@@ -881,7 +881,7 @@
881881 {
882882 float sclset = *(float*)gc->GetConfigParam(CFGPRM_COORDINATEAXESSCALE);
883883 scale *= 0.99f; // 1% "slimmer" to avoid z-fighting with force vector(s)
884- float ascale = float(oapiGetSize(hObj))*sclset*0.5f;
884+ float ascale = float(size)*sclset*0.5f;
885885
886886 RenderAxisVector(pSkp, &D3DXCOLOR(1,0,0,alpha), _V(1,0,0), ascale, scale);
887887 RenderAxisLabel(pSkp, &D3DXCOLOR(1,0,0,alpha), _V(1,0,0), ascale, scale, "X");
Show on old repository browser