Dawn/src/dawn/physics/3d/Ray3D.hpp

40 lines
770 B
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnlibs.hpp"
#include "assert/assert.hpp"
#include "PhysicsTriangle.hpp"
#include "PhysicsSphere.hpp"
#include "AABB3D.hpp"
namespace Dawn {
struct Ray3D {
glm::vec3 origin;
glm::vec3 direction;
};
bool_t raytestSphere(
struct Ray3D ray,
struct PhysicsSphere sphere,
glm::vec3 *hit,
glm::vec3 *normal
);
bool_t raytestTriangle(
struct Ray3D ray,
struct PhysicsTriangle triangle,
glm::vec2 *hit,
float_t *distance
);
bool_t raytestAABB(
struct Ray3D ray,
struct AABB3D box,
glm::vec3 *point,
glm::vec3 *normal,
float_t *distance
);
}