Skip to content

Commit

Permalink
- Added rendering of side force vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmonik committed Jan 8, 2024
1 parent eff61a0 commit a1bbd0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OVP/D3D7Client/VVessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void vVessel::UpdateRenderVectors()
if ((flag & BFV_SIDEFORCE) && vessel->GetSideForceVector(F)) {
sprintf(cbuf, "SF = %fN", len = length(F));
if (logscale) len = log(len + shift) - lshift; else len *= scale;
AddVector(unit(F) * (len * pscale), _V(0, 0, 0), scale2, std::string(cbuf), _V(0, 0, 1), alpha, D3DRGB(0.0392, 0.6235, 0.4941));
AddVector(unit(F) * (len * pscale), _V(0, 0, 0), scale2, std::string(cbuf), _V(0.0392, 0.6235, 0.4941), alpha, D3DRGB(0.0392, 0.6235, 0.4941));
}
if ((flag & BFV_TOTAL) && vessel->GetForceVector(F)) {
sprintf(cbuf, "F = %fN", len = length(F));
Expand Down
10 changes: 10 additions & 0 deletions OVP/D3D9Client/VVessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ void vVessel::RenderVectors (LPDIRECT3DDEVICE9 dev, D3D9Pad *pSkp)
if (bfvmode & BFV_LIFT) { vessel->GetLiftVector(vector); if (length(vector)>len) len = length(vector); }
if (bfvmode & BFV_TOTAL) { vessel->GetForceVector(vector); if (length(vector)>len) len = length(vector); }
if (bfvmode & BFV_TORQUE) { vessel->GetTorqueVector(vector); if (length(vector)>len) len = length(vector); }
if (bfvmode & BFV_SIDEFORCE) { vessel->GetSideForceVector(vector); if (length(vector) > len) len = length(vector); }

lscale = float(size * sclset / len);
}
Expand Down Expand Up @@ -924,6 +925,15 @@ void vVessel::RenderVectors (LPDIRECT3DDEVICE9 dev, D3D9Pad *pSkp)
RenderAxisLabel(pSkp, ptr(D3DXCOLOR(1,0,1,alpha)), vector, lscale, scale, label, bLog);
}
}

if (bfvmode & BFV_SIDEFORCE) {
vessel->GetSideForceVector(vector);
if (length(vector) > threshold) {
RenderAxisVector(pSkp, ptr(D3DXCOLOR(0.0392, 0.6235, 0.4941, alpha)), vector, lscale, scale, bLog);
sprintf_s(label, 64, "SF = %sN", value_string(length(vector)));
RenderAxisLabel(pSkp, ptr(D3DXCOLOR(0.0392, 0.6235, 0.4941, alpha)), vector, lscale, scale, label, bLog);
}
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions Src/Orbiter/Vvessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,11 @@ void VVessel::UpdateRenderVectors()
if (logscale) len = log(len+shift) - lshift; else len *= scale;
AddVector (F.unit()*(len*pscale), Vector(0,0,0), scale2, std::string(cbuf), Vector (1,1,1), alpha, D3DRGB (1,1,1));
}
if ((flag & BFV_SIDEFORCE) && vessel->GetSideForceVector(F)) {
sprintf(cbuf, "SF =%sN", FloatStr(len = F.length(), 4));
if (logscale) len = log(len + shift) - lshift; else len *= scale;
AddVector(F.unit() * (len * pscale), Vector(0, 0, 0), scale2, std::string(cbuf), Vector(0.0392, 0.6235, 0.4941), alpha, D3DRGB(0.0392, 0.6235, 0.4941));
}
if (1) {
for (int i = 0; i < vessel->nforcevec; i++) {
F = vessel->forcevec[i];
Expand Down

0 comments on commit a1bbd0b

Please sign in to comment.