From 7b107078a2a3b9f62a076f91e873f5ad0597d167 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 1 Feb 2024 00:52:45 +0100 Subject: Correctly sort collision responses and apply in correct order --- src/Math/AABB.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Math/AABB.hpp') diff --git a/src/Math/AABB.hpp b/src/Math/AABB.hpp index 4ad5534..b50ba56 100644 --- a/src/Math/AABB.hpp +++ b/src/Math/AABB.hpp @@ -76,7 +76,15 @@ struct AABB { }; } - Vec3 pushout(Vector<3> v, AABB against) const; + struct CollisionResponse { + // Velocity until the collision. + // Always has the same direction as the original velocity, and lower magnitude. + Vec3 v_to_collision; + // Velocity sliding along the collision plane. + // Projection of the fraction of the original velocity that was blocked by collision, onto the collision plane. + Vec3 v_slide; + }; + CollisionResponse collision_response(Vector<3> v, AABB against) const; Vector<3> min, max; }; -- cgit 1.4.1 > a dumb minecraft in c++ and opengl.
summary refs log tree commit diff
path: root/src/GFX/Shading/Shader.hpp
blob: 8c6c5c836ddfa3a4cd258034aee8f674005384b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include "../../Common/Sizes.hpp"
#include "../../Assets.hpp"

namespace MC::GFX::Shading {

class Shader {

public:
    enum class Type {
        Vertex,
        Fragment,
    };

    Shader(Type type, const Char* source);

    U32 get() const {
        return m_shader;
    }

private:
    U32 m_shader;
};

}