fekalnigtacko/src/gameview/vehicleview.hpp
2026-03-01 16:40:57 +01:00

56 lines
1.2 KiB
C++

#pragma once
#include "entityview.hpp"
#include "assets/vehiclemdl.hpp"
#include "game/vehicle_sync.hpp"
#include <chrono>
namespace game::view
{
struct VehicleWheelViewInfo
{
TransformNode node;
float steering = 0.0f;
float z_offset = 0.0f;
float speed = 0.0f;
float rotation = 0.0f;
};
class VehicleView : public EntityView
{
using Super = EntityView;
public:
VehicleView(WorldView& world, net::InMessage& msg);
DELETE_COPY_MOVE(VehicleView)
virtual bool ProcessMsg(net::EntMsgType type, net::InMessage& msg) override;
virtual bool ProcessUpdateMsg(net::InMessage* msg) override;
virtual void Update(const UpdateInfo& info) override;
virtual void Draw(const DrawArgs& args) override;
private:
bool ReadState(net::InMessage* msg);
private:
std::shared_ptr<const assets::VehicleModel> model_;
assets::Mesh mesh_;
glm::vec4 color_;
game::VehicleSyncState sync_;
std::vector<VehicleWheelViewInfo> wheels_;
float update_time_ = 0.0f;
Transform root_trans_[2];
VehicleFlags flags_ = 0;
std::shared_ptr<const audio::Sound> snd_accel_;
audio::SoundSource* snd_accel_src_ = nullptr;
bool windows_broken_ = false;
};
}