Rise
The Vieneo Province
Loading...
Searching...
No Matches
VehicleLightProfiles.h
Go to the documentation of this file.
1#pragma once
2#include "LandingLights.h"
4
5namespace LandingLights
6{
7 inline Profile VehicleProfile(unsigned char type)
8 {
9 switch (type)
10 {
14 return RoadLow;
15 case VehicleType::T27: // Mammoth's off-road driving lamps
16 return TruckDriving;
17 case VehicleType::EVA_SUIT: return Helmet;
18 default: return AircraftLanding;
19 }
20 }
21 inline Light Configure(Light light, unsigned char type, const RiseMath::Matrix& modelBase)
22 {
23 light.profile = VehicleProfile(type);
24 // Vehicle axes use -Y as physical up (SetProjectionMatrices rolls pi).
25 // Convert it back to model space so the low-beam cutoff clips the sky,
26 // not the road, and follows vehicle pitch/roll with the authored aim.
27 RiseMath::Matrix inverse;
28 RiseMath::MatrixInverse(&inverse, nullptr, &modelBase);
29 const RiseMath::Vector3 vehicleUp(0, -1, 0);
30 RiseMath::Vec3TransformNormal(&light.up, &vehicleUp, &inverse);
31 light.up = OrthonormalUp(light.up, light.direction);
32 return light;
33 }
34}
@ EVA_SUIT
Definition ServerTypes.h:69
@ C98
Definition ServerTypes.h:61
@ C2
Definition ServerTypes.h:66
@ C2A
Definition ServerTypes.h:81
@ T120
Definition ServerTypes.h:67
@ T27
Definition ServerTypes.h:82
@ DIHV
Definition ServerTypes.h:62
@ T121
Definition ServerTypes.h:89
constexpr Profile AircraftLanding
Definition BeamProfile.h:38
Light Configure(Light light, unsigned char type, const RiseMath::Matrix &modelBase)
constexpr Profile Helmet
Definition BeamProfile.h:41
Profile VehicleProfile(unsigned char type)
Vector OrthonormalUp(Vector up, const Vector &direction)
Definition BeamProfile.h:43
constexpr Profile RoadLow
Definition BeamProfile.h:35
constexpr Profile TruckDriving
Definition BeamProfile.h:37
Vector3 * Vec3TransformNormal(Vector3 *out, const Vector3 *a, const Matrix *m)
Definition ClientMath.h:107
Matrix * MatrixInverse(Matrix *out, float *determinant, const Matrix *a)
Definition ClientMath.h:118
RiseMath::Vector3 up
RiseMath::Vector3 direction