16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 15:09:19 +02:00

build 181030. basic external views system

This commit is contained in:
tmj-fstate
2018-10-30 14:29:02 +01:00
parent 83f56b07f8
commit c59b53067a
12 changed files with 593 additions and 451 deletions

View File

@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
#include "Button.h"
#include "AirCoupler.h"
#include "sound.h"
#include "Spring.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
@@ -444,8 +445,6 @@ private:
exchange_data m_exchange; // state of active load exchange procedure, if any
exchange_sounds m_exchangesounds; // sounds associated with the load exchange
Math3D::vector3 modelShake;
bool renderme; // yB - czy renderowac
float ModCamRot;
int iInventory[ 2 ] { 0, 0 }; // flagi bitowe posiadanych submodeli (np. świateł)
@@ -540,6 +539,9 @@ private:
void RenderSounds();
inline Math3D::vector3 GetPosition() const {
return vPosition; };
// converts location from vehicle coordinates frame to world frame
inline Math3D::vector3 GetWorldPosition( Math3D::vector3 const &Location ) const {
return vPosition + mMatrix * Location; }
// pobranie współrzędnych czoła
inline Math3D::vector3 HeadPosition() {
return vCoulpler[iDirection ^ 1]; };
@@ -638,6 +640,41 @@ private:
double MEDLogTime = 0;
double MEDLogInactiveTime = 0;
int MEDLogCount = 0;
// vehicle shaking calculations
// TBD, TODO: make an object out of it
public:
// methods
void update_shake( double const Timedelta );
std::pair<double, double> shake_angles() const;
// members
struct baseshake_config {
Math3D::vector3 angle_scale { 0.05, 0.0, 0.1 }; // roll, yaw, pitch
Math3D::vector3 jolt_scale { 0.2, 0.2, 0.1 };
double jolt_limit { 0.15 };
} BaseShake;
struct engineshake_config {
float scale { 2.f };
float fadein_offset { 1.5f }; // 90 rpm
float fadein_factor { 0.3f };
float fadeout_offset { 10.f }; // 600 rpm
float fadeout_factor { 0.5f };
} EngineShake;
struct huntingshake_config {
float scale { 1.f };
float frequency { 1.f };
float fadein_begin { 0.f }; // effect start speed in km/h
float fadein_end { 0.f }; // full effect speed in km/h
} HuntingShake;
float HuntingAngle { 0.f }; // crude approximation of hunting oscillation; current angle of sine wave
bool IsHunting { false };
TSpring ShakeSpring;
struct shake_state {
Math3D::vector3 velocity {}; // current shaking vector
Math3D::vector3 offset {}; // overall shake-driven offset from base position
} ShakeState;
Math3D::vector3 modelShake;
};