OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
objvisual.h
Go to the documentation of this file.
1#pragma once
2
7
8class Npc;
9class World;
10
11class ObjVisual {
12 public:
13 ObjVisual();
14 ObjVisual(ObjVisual&& other);
16 ~ObjVisual();
17
18 void save(Serialize& fout, const Interactive& mob) const;
19 void load(Serialize& fin, Interactive &mob);
20
21 void setVisual(const zenkit::IItem& visual, World& world, bool staticDraw);
22 void setVisual(const zenkit::VirtualObject& visual, World& world, bool staticDraw);
23 void setObjMatrix(const Tempest::Matrix4x4& obj);
24
25 void setSlotItem(MeshObjects::Mesh&& itm, std::string_view slot);
26
28
29 const Animation::Sequence* startAnimAndGet(std::string_view name, uint64_t tickCount, bool force = false);
30 bool isAnimExist(std::string_view name) const;
31
32 bool updateAnimation(Npc* npc, Interactive* mobsi, World& world, uint64_t dt, bool force);
33 void processLayers(World& world);
34 void syncPhysics();
35
36 const ProtoMesh* protoMesh() const;
37 const Tempest::Matrix4x4& bone(size_t i) const;
38
39 private:
40 enum Type : uint8_t {
41 M_None = 0,
42 M_Mdl,
43 M_Mesh,
44 M_Pfx,
45 M_Bundle,
46 };
47
48 struct Mdl {
49 PhysicMesh physic;
50 MdlVisual view;
51 const ProtoMesh* proto = nullptr;
52 };
53
54 struct Mesh {
55 PhysicMesh physic;
57 const ProtoMesh* proto = nullptr;
58 };
59
60 union {
61 Mdl mdl;
62 Mesh mesh;
65 };
66 Type type = M_None;
67
68 void cleanup();
69 void setType(Type t);
70 };
71
Definition npc.h:25
void setObjMatrix(const Tempest::Matrix4x4 &obj)
void syncPhysics()
void save(Serialize &fout, const Interactive &mob) const
Definition objvisual.cpp:63
void load(Serialize &fin, Interactive &mob)
Definition objvisual.cpp:68
VobBundle bundle
Definition objvisual.h:64
void setSlotItem(MeshObjects::Mesh &&itm, std::string_view slot)
bool updateAnimation(Npc *npc, Interactive *mobsi, World &world, uint64_t dt, bool force)
PfxEmitter pfx
Definition objvisual.h:63
bool isAnimExist(std::string_view name) const
void setVisual(const zenkit::IItem &visual, World &world, bool staticDraw)
void setInteractive(Interactive *it)
const ProtoMesh * protoMesh() const
ObjVisual & operator=(ObjVisual &&other)
Definition objvisual.cpp:35
const Animation::Sequence * startAnimAndGet(std::string_view name, uint64_t tickCount, bool force=false)
void processLayers(World &world)
const Tempest::Matrix4x4 & bone(size_t i) const
Mesh mesh
Definition objvisual.h:62
Definition world.h:31