OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
physicvbo.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4#include <cstdint>
5
6#include <zenkit/Material.hh>
7
8#include "physics/physics.h"
9#include "resources.h"
10
11class PackedMesh;
12
13class PhysicVbo : public btTriangleIndexVertexArray {
14 public:
16
17 PhysicVbo(PackedMesh&& packed);
18 PhysicVbo(const std::vector<btVector3>* v);
19
20 PhysicVbo(const PhysicVbo&)=delete;
22
23 void addIndex(const std::vector<uint32_t>& index, size_t iboOff, size_t iboLen, zenkit::MaterialGroup material);
24 void addIndex(const std::vector<uint32_t>& index, size_t iboOff, size_t iboLen, zenkit::MaterialGroup material, const char* sector);
25 zenkit::MaterialGroup materialId(size_t segment) const;
26 auto sectorName(size_t segment) const -> const char*;
27 bool useQuantization() const;
28 bool isEmpty() const;
29
30 void adjustMesh();
31
32 std::string_view validateSectorName(std::string_view name) const;
33
34 private:
35 PhysicVbo(const std::vector<Vertex>& v);
36
37 void addSegment(size_t indexSize,size_t offset, zenkit::MaterialGroup material, const char* sector);
38
39 struct Segment {
40 size_t off;
41 int size;
42 zenkit::MaterialGroup mat;
43 const char* sector=nullptr;
44 };
45
46 std::vector<btVector3> vStorage;
47 const std::vector<btVector3>& vert;
48 std::vector<uint32_t> id;
49 std::vector<Segment> segments;
50 };
PhysicVbo(const PhysicVbo &)=delete
bool isEmpty() const
Definition physicvbo.cpp:97
bool useQuantization() const
Definition physicvbo.cpp:86
PhysicVbo(PhysicVbo &&)=delete
void adjustMesh()
zenkit::MaterialGroup materialId(size_t segment) const
Definition physicvbo.cpp:74
void addIndex(const std::vector< uint32_t > &index, size_t iboOff, size_t iboLen, zenkit::MaterialGroup material)
Definition physicvbo.cpp:30
auto sectorName(size_t segment) const -> const char *
Definition physicvbo.cpp:80
std::string_view validateSectorName(std::string_view name) const