group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ViewmodelConfig.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
7
8#include <array>
9#include <cstddef>
10#include <glm/vec3.hpp>
11
14{
15 float scale;
17 float yawOffset, pitchOffset, rollOffset; // degrees
18};
19
22{
23 float scale;
24 glm::vec3 handOffset; // relative to player center (right, up, forward)
25 float yawOffset, pitchOffset, rollOffset; // degrees
26};
27
30{
31 glm::vec3 scale{1.0f};
32 glm::vec3 translation{0.0f};
33 float yawOffset = 0.0f;
34 float pitchOffset = 0.0f;
35 float rollOffset = 0.0f;
36 float spinDegreesPerSecond = 45.0f;
37 float bobAmplitude = 6.0f;
38 float bobHz = 0.6f;
39};
40
43{
44 const char* filename;
45 bool flipUVs;
46};
47
50{
51 float pitchKick = 3.0f;
52 float pushBack = 2.0f;
53 float rollKick = 1.0f;
54 float recoverySpeed = 12.0f;
55};
56
59{
60 static constexpr std::array<ViewmodelParams, 4> k_params{{
61 // Rifle — existing tuning
62 {.scale = 39.0f,
63 .forward = 78.0f,
64 .right = 37.0f,
65 .down = -11.0f,
66 .yawOffset = 0.0f,
67 .pitchOffset = -1.0f,
68 .rollOffset = 0.0f},
69 // Rocket — fallback to rifle tuning
70 {.scale = 39.0f,
71 .forward = 7.0f,
72 .right = 27.0f,
73 .down = 77.5f,
74 .yawOffset = 0.0f,
75 .pitchOffset = 0.0f,
76 .rollOffset = 0.0f},
77 // RailGun — marksman
78 {.scale = 20.0f,
79 .forward = 48.0f,
80 .right = 30.0f,
81 .down = 27.0f,
82 .yawOffset = 0.0f,
83 .pitchOffset = 0.0f,
84 .rollOffset = 0.0f},
85 // EnergyGun
86 {.scale = 20.0f,
87 .forward = 80.0f,
88 .right = 38.5f,
89 .down = 24.0f,
90 .yawOffset = 0.0f,
91 .pitchOffset = 0.0f,
92 .rollOffset = 0.0f},
93 }};
94
95 return k_params[static_cast<std::size_t>(type)];
96}
97
100{
101 static const std::array<ThirdPersonWeaponParams, 4> k_params{{
102 // Rifle
103 {.scale = 0.025f,
104 .handOffset = {1.5f, -3.5f, 14.0f},
105 .yawOffset = -47.0f,
106 .pitchOffset = 13.0f,
107 .rollOffset = 0.0f},
108 // Rocket
109 {.scale = 0.025f,
110 .handOffset = {1.5f, -3.5f, 14.0f},
111 .yawOffset = -47.0f,
112 .pitchOffset = 13.0f,
113 .rollOffset = 0.0f},
114 // RailGun
115 {.scale = 1.0f, .handOffset = {7.5f, 7.5f, 15.0f}, .yawOffset = 0.0f, .pitchOffset = 96.0f, .rollOffset = 2.0f},
116 // EnergyGun
117 {.scale = 1.0f, .handOffset = {7.5f, 7.0f, 6.0f}, .yawOffset = 6.0f, .pitchOffset = 94.0f, .rollOffset = 0.0f},
118 }};
119
120 return k_params[static_cast<std::size_t>(type)];
121}
122
125{
126 static const std::array<WeaponSpawnerModelParams, 4> k_params{{
127 // Rifle
128 {.scale = {16.0f, 16.0f, 16.0f},
129 .translation = {0.0f, 16.0f, 0.0f},
130 .yawOffset = 0.0f,
131 .pitchOffset = 0.0f,
132 .rollOffset = 0.0f,
133 .spinDegreesPerSecond = 45.0f,
134 .bobAmplitude = 6.0f,
135 .bobHz = 0.6f},
136 // Rocket
137 {.scale = {15.0f, 15.0f, 15.0f},
138 .translation = {0.0f, -25.0f, -4.0f},
139 .yawOffset = 0.0f,
140 .pitchOffset = 0.0f,
141 .rollOffset = 0.0f,
142 .spinDegreesPerSecond = 45.0f,
143 .bobAmplitude = 6.0f,
144 .bobHz = 0.6f},
145 // RailGun
146 {.scale = {15.0f, 15.0f, 15.0f},
147 .translation = {0.0f, -5.0f, 0.0f},
148 .yawOffset = 0.0f,
149 .pitchOffset = 0.0f,
150 .rollOffset = 0.0f,
151 .spinDegreesPerSecond = 45.0f,
152 .bobAmplitude = 6.0f,
153 .bobHz = 0.6f},
154 // EnergyGun
155 {.scale = {10.0f, 10.0f, 10.0f},
156 .translation = {0.0f, 2.0f, 0.0f},
157 .yawOffset = 0.0f,
158 .pitchOffset = 0.0f,
159 .rollOffset = 0.0f,
160 .spinDegreesPerSecond = 45.0f,
161 .bobAmplitude = 6.0f,
162 .bobHz = 0.6f},
163 }};
164
165 return k_params[static_cast<std::size_t>(type)];
166}
167
170{
171 static constexpr std::array<WeaponModelInfo, 4> k_infos{{
172 {.filename = "assault_rifle.glb", .flipUVs = true},
173 {.filename = "rocket_launcher.glb", .flipUVs = true},
174 {.filename = "rail_gun.glb", .flipUVs = true},
175 {.filename = "energy_gun.glb", .flipUVs = true},
176 }};
177 return k_infos[static_cast<std::size_t>(type)];
178}
179
182{
183 static constexpr std::array<RecoilParams, 4> k_params{{
184 // Rifle (R-301) — full-auto, low per-shot, fast recovery
185 {.pitchKick = 2.0f, .pushBack = 1.5f, .rollKick = 0.5f, .recoverySpeed = 14.0f},
186 // Rocket — big boom
187 {.pitchKick = 8.0f, .pushBack = 5.0f, .rollKick = 2.0f, .recoverySpeed = 6.0f},
188 // RailGun (Triple Take) — medium
189 {.pitchKick = 5.0f, .pushBack = 3.0f, .rollKick = 1.0f, .recoverySpeed = 8.0f},
190 // EnergyGun (Wingman) — hand cannon
191 {.pitchKick = 6.0f, .pushBack = 4.0f, .rollKick = 1.5f, .recoverySpeed = 7.0f},
192 }};
193
194 return k_params[static_cast<std::size_t>(type)];
195}
Projectile component and weapon/surface type enumerations.
const ThirdPersonWeaponParams & getThirdPersonWeaponParams(WeaponType type)
Returns third-person weapon attachment params for remote players.
Definition ViewmodelConfig.hpp:99
const RecoilParams & getRecoilParams(WeaponType type)
Returns visual recoil params for a weapon type.
Definition ViewmodelConfig.hpp:181
const ViewmodelParams & getViewmodelParams(WeaponType type)
Returns viewmodel positioning params for a weapon type.
Definition ViewmodelConfig.hpp:58
const WeaponSpawnerModelParams & getWeaponSpawnerModelParams(WeaponType type)
Returns world weapon pickup/spawner model params for a weapon type.
Definition ViewmodelConfig.hpp:124
WeaponModelInfo getWeaponModelInfo(WeaponType type)
Returns the GLB filename and load flags for a weapon type.
Definition ViewmodelConfig.hpp:169
WeaponType
Weapon type — determines tracer style, damage, sound, and impact effects.
Definition WeaponState.hpp:12
Visual recoil params per weapon type (viewmodel-only, does not affect aim).
Definition ViewmodelConfig.hpp:50
float rollKick
Degrees of random roll kick per shot.
Definition ViewmodelConfig.hpp:53
float recoverySpeed
Spring decay rate (higher = snappier recovery).
Definition ViewmodelConfig.hpp:54
float pitchKick
Degrees of upward pitch kick per shot.
Definition ViewmodelConfig.hpp:51
float pushBack
Quake units of backward push per shot.
Definition ViewmodelConfig.hpp:52
Third-person weapon attachment params for remote players.
Definition ViewmodelConfig.hpp:22
float scale
Definition ViewmodelConfig.hpp:23
glm::vec3 handOffset
Definition ViewmodelConfig.hpp:24
float rollOffset
Definition ViewmodelConfig.hpp:25
float pitchOffset
Definition ViewmodelConfig.hpp:25
float yawOffset
Definition ViewmodelConfig.hpp:25
First-person viewmodel positioning/rotation params per weapon type.
Definition ViewmodelConfig.hpp:14
float yawOffset
Definition ViewmodelConfig.hpp:17
float forward
Definition ViewmodelConfig.hpp:16
float scale
Definition ViewmodelConfig.hpp:15
float rollOffset
Definition ViewmodelConfig.hpp:17
float right
Definition ViewmodelConfig.hpp:16
float pitchOffset
Definition ViewmodelConfig.hpp:17
float down
Definition ViewmodelConfig.hpp:16
Asset filename + load flags for a weapon model.
Definition ViewmodelConfig.hpp:43
const char * filename
Definition ViewmodelConfig.hpp:44
bool flipUVs
Definition ViewmodelConfig.hpp:45
World weapon spawner model params.
Definition ViewmodelConfig.hpp:30
float bobAmplitude
Definition ViewmodelConfig.hpp:37
float bobHz
Definition ViewmodelConfig.hpp:38
float pitchOffset
Definition ViewmodelConfig.hpp:34
float spinDegreesPerSecond
Definition ViewmodelConfig.hpp:36
glm::vec3 scale
Definition ViewmodelConfig.hpp:31
float yawOffset
Definition ViewmodelConfig.hpp:33
glm::vec3 translation
Definition ViewmodelConfig.hpp:32
float rollOffset
Definition ViewmodelConfig.hpp:35