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

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-11-10 23:52:46 +01:00
15 changed files with 659 additions and 473 deletions

View File

@@ -20,6 +20,7 @@ http://mozilla.org/MPL/2.0/.
#include "AirCoupler.h"
#include "Texture.h"
#include "sound.h"
#include "Spring.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
@@ -445,8 +446,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ł)
@@ -541,6 +540,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]; };
@@ -613,8 +615,9 @@ private:
void CouplersDettach(double MinDist, int MyScanDir);
void RadioStop();
void Damage(char flag);
void RaLightsSet(int head, int rear);
void RaLightsSet(int head, int rear);
int LightList( side const Side ) const { return iInventory[ Side ]; }
void set_cab_lights( float const Level );
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
float GetEPP(); // wyliczanie sredniego cisnienia w PG
int DirectionSet(int d); // ustawienie kierunku w składzie
@@ -638,6 +641,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;
};