HitBox added. acceleration of collision detection in 20 times.
parent
e347215f11
commit
1ad591ed04
|
@ -10,10 +10,10 @@ using namespace std;
|
||||||
int main() {
|
int main() {
|
||||||
Shooter game;
|
Shooter game;
|
||||||
|
|
||||||
game.create(1280, 720, ShooterConsts::PROJECT_NAME);
|
//game.create(1280, 720, ShooterConsts::PROJECT_NAME);
|
||||||
//game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
//game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
||||||
|
|
||||||
//game.create(2048, 1152, ShooterConsts::PROJECT_NAME, false);
|
game.create(2048, 1152, ShooterConsts::PROJECT_NAME, false);
|
||||||
//game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
//game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -7,19 +7,22 @@
|
||||||
|
|
||||||
#include "../Mesh.h"
|
#include "../Mesh.h"
|
||||||
|
|
||||||
class HitBox {
|
class HitBox final {
|
||||||
private:
|
private:
|
||||||
std::vector<Vec3D> _hitBox;
|
std::vector<Vec3D> _hitBox;
|
||||||
|
|
||||||
void _addIfUnique(const Vec3D& point);
|
void _addIfUnique(const Vec3D &point);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HitBox() = default;
|
HitBox() = default;
|
||||||
explicit HitBox(const Mesh& mesh);
|
|
||||||
|
|
||||||
std::vector<Vec3D>::iterator begin() { return _hitBox.begin(); }
|
explicit HitBox(const Mesh &mesh);
|
||||||
std::vector<Vec3D>::iterator end() { return _hitBox.end(); }
|
|
||||||
|
|
||||||
HitBox static Box(const Mesh& mesh);
|
[[nodiscard]] std::vector<Vec3D>::iterator begin() { return _hitBox.begin(); }
|
||||||
|
|
||||||
|
[[nodiscard]] std::vector<Vec3D>::iterator end() { return _hitBox.end(); }
|
||||||
|
|
||||||
|
HitBox static Box(const Mesh &mesh);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue