Browse Source

Remove dependencies on math.hpp, remove some obsolete systems

master
C. J. Howard 1 year ago
parent
commit
a768d52b3a
47 changed files with 64 additions and 379 deletions
  1. +1
    -1
      src/animation/ease.hpp
  2. +2
    -1
      src/color/aces.hpp
  3. +2
    -1
      src/color/cat.hpp
  4. +1
    -1
      src/color/cct.hpp
  5. +1
    -1
      src/color/illuminant.hpp
  6. +2
    -1
      src/color/rgb.hpp
  7. +1
    -1
      src/color/srgb.hpp
  8. +1
    -1
      src/color/ucs.hpp
  9. +1
    -1
      src/color/xyy.hpp
  10. +1
    -1
      src/color/xyz.hpp
  11. +3
    -1
      src/entity/commands.cpp
  12. +2
    -0
      src/game/ant/morphogenesis.cpp
  13. +1
    -0
      src/game/ant/swarm.cpp
  14. +1
    -1
      src/game/component/cavity.hpp
  15. +0
    -39
      src/game/component/samara.hpp
  16. +0
    -40
      src/game/component/snap.hpp
  17. +1
    -1
      src/game/component/transform.hpp
  18. +0
    -4
      src/game/context.hpp
  19. +0
    -10
      src/game/state/boot.cpp
  20. +1
    -0
      src/game/state/main-menu.cpp
  21. +0
    -15
      src/game/state/nuptial-flight.cpp
  22. +1
    -0
      src/game/system/collision.cpp
  23. +2
    -0
      src/game/system/constraint.cpp
  24. +0
    -1
      src/game/system/painting.cpp
  25. +0
    -61
      src/game/system/samara.cpp
  26. +0
    -39
      src/game/system/samara.hpp
  27. +0
    -93
      src/game/system/snapping.cpp
  28. +0
    -40
      src/game/system/snapping.hpp
  29. +1
    -0
      src/game/system/steering.cpp
  30. +3
    -1
      src/geom/aabb.hpp
  31. +1
    -1
      src/geom/bounding-volume.hpp
  32. +1
    -1
      src/geom/mesh-functions.cpp
  33. +1
    -1
      src/geom/plane.hpp
  34. +1
    -1
      src/geom/projection.hpp
  35. +1
    -1
      src/geom/ray.hpp
  36. +1
    -1
      src/geom/sphere.hpp
  37. +2
    -1
      src/geom/view-frustum.hpp
  38. +14
    -10
      src/math/matrix.hpp
  39. +1
    -0
      src/render/context.hpp
  40. +0
    -1
      src/render/passes/bloom-pass.cpp
  41. +1
    -0
      src/render/passes/material-pass.cpp
  42. +3
    -1
      src/render/passes/shadow-map-pass.cpp
  43. +2
    -1
      src/render/renderer.cpp
  44. +1
    -0
      src/scene/camera.cpp
  45. +2
    -1
      src/scene/directional-light.cpp
  46. +1
    -1
      src/scene/object.cpp
  47. +2
    -1
      src/scene/spot-light.cpp

+ 1
- 1
src/animation/ease.hpp View File

@ -51,7 +51,7 @@
#ifndef ANTKEEPER_EASE_HPP
#define ANTKEEPER_EASE_HPP
#include "math/math.hpp"
#include "math/interpolation.hpp"
#include <cmath>
/**

+ 2
- 1
src/color/aces.hpp View File

@ -21,7 +21,8 @@
#define ANTKEEPER_COLOR_ACES_HPP
#include "color/rgb.hpp"
#include "math/math.hpp"
#include "math/matrix.hpp"
#include "math/vector.hpp"
namespace color {

+ 2
- 1
src/color/cat.hpp View File

@ -20,7 +20,8 @@
#ifndef ANTKEEPER_COLOR_CAT_HPP
#define ANTKEEPER_COLOR_CAT_HPP
#include "math/math.hpp"
#include "math/matrix.hpp"
#include "math/vector.hpp"
namespace color {

+ 1
- 1
src/color/cct.hpp View File

@ -20,9 +20,9 @@
#ifndef ANTKEEPER_COLOR_CCT_HPP
#define ANTKEEPER_COLOR_CCT_HPP
#include "math/math.hpp"
#include "ucs.hpp"
#include "xyy.hpp"
#include "math/vector.hpp"
namespace color {

+ 1
- 1
src/color/illuminant.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_COLOR_ILLUMINANT_HPP
#define ANTKEEPER_COLOR_ILLUMINANT_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace color {

+ 2
- 1
src/color/rgb.hpp View File

@ -21,7 +21,8 @@
#define ANTKEEPER_COLOR_RGB_HPP
#include "color/cat.hpp"
#include "math/math.hpp"
#include "math/matrix.hpp"
#include "math/vector.hpp"
namespace color {

+ 1
- 1
src/color/srgb.hpp View File

@ -22,7 +22,7 @@
#include "color/rgb.hpp"
#include "color/illuminant.hpp"
#include "math/math.hpp"
#include "math/vector.hpp"
#include <cmath>
namespace color {

+ 1
- 1
src/color/ucs.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_COLOR_UCS_HPP
#define ANTKEEPER_COLOR_UCS_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace color {

+ 1
- 1
src/color/xyy.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_COLOR_XYY_HPP
#define ANTKEEPER_COLOR_XYY_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace color {

+ 1
- 1
src/color/xyz.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_COLOR_XYZ_HPP
#define ANTKEEPER_COLOR_XYZ_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace color {

+ 3
- 1
src/entity/commands.cpp View File

@ -20,10 +20,12 @@
#include "entity/commands.hpp"
#include "game/component/model.hpp"
#include "game/component/transform.hpp"
#include "game/component/snap.hpp"
#include "game/component/parent.hpp"
#include "game/component/celestial-body.hpp"
#include "game/component/terrain.hpp"
#include "math/quaternion-type.hpp"
#include "math/quaternion-operators.hpp"
#include "math/quaternion-functions.hpp"
#include <limits>
namespace entity {

+ 2
- 0
src/game/ant/morphogenesis.cpp View File

@ -20,6 +20,8 @@
#include "game/ant/morphogenesis.hpp"
#include "render/material.hpp"
#include "render/vertex-attribute.hpp"
#include "math/transform-operators.hpp"
#include "math/quaternion-operators.hpp"
#include <unordered_set>
#include <iostream>

+ 1
- 0
src/game/ant/swarm.cpp View File

@ -23,6 +23,7 @@
#include "game/component/model.hpp"
#include "game/component/picking.hpp"
#include "resources/resource-manager.hpp"
#include "math/quaternion-operators.hpp"
#include "config.hpp"
#include <cmath>
#include <random>

+ 1
- 1
src/game/component/cavity.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GAME_COMPONENT_CAVITY_HPP
#define ANTKEEPER_GAME_COMPONENT_CAVITY_HPP
#include "math/math.hpp"
#include "utility/fundamental-types.hpp"
namespace game {
namespace component {

+ 0
- 39
src/game/component/samara.hpp View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_GAME_COMPONENT_SAMARA_HPP
#define ANTKEEPER_GAME_COMPONENT_SAMARA_HPP
#include "utility/fundamental-types.hpp"
namespace game {
namespace component {
struct samara
{
float3 direction;
float angle;
float chirality;
};
} // namespace component
} // namespace game
#endif // ANTKEEPER_GAME_COMPONENT_SAMARA_HPP

+ 0
- 40
src/game/component/snap.hpp View File

@ -1,40 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_GAME_COMPONENT_SNAP_HPP
#define ANTKEEPER_GAME_COMPONENT_SNAP_HPP
#include "geom/ray.hpp"
namespace game {
namespace component {
struct snap
{
geom::ray<float> ray;
bool relative;
bool warp;
bool autoremove;
};
} // namespace component
} // namespace game
#endif // ANTKEEPER_GAME_COMPONENT_SNAP_HPP

+ 1
- 1
src/game/component/transform.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GAME_COMPONENT_TRANSFORM_HPP
#define ANTKEEPER_GAME_COMPONENT_TRANSFORM_HPP
#include "math/math.hpp"
#include "math/transform-type.hpp"
namespace game {
namespace component {

+ 0
- 4
src/game/context.hpp View File

@ -91,11 +91,9 @@ namespace game
class collision;
class constraint;
class locomotion;
class snapping;
class camera;
class nest;
class render;
class samara;
class proteome;
class steering;
class spring;
@ -281,9 +279,7 @@ struct context
game::system::constraint* constraint_system;
game::system::locomotion* locomotion_system;
game::system::steering* steering_system;
game::system::snapping* snapping_system;
game::system::render* render_system;
game::system::samara* samara_system;
game::system::subterrain* subterrain_system;
game::system::terrain* terrain_system;
game::system::vegetation* vegetation_system;

+ 0
- 10
src/game/state/boot.cpp View File

@ -61,9 +61,7 @@
#include "game/system/collision.hpp"
#include "game/system/constraint.hpp"
#include "game/system/locomotion.hpp"
#include "game/system/snapping.hpp"
#include "game/system/render.hpp"
#include "game/system/samara.hpp"
#include "game/system/subterrain.hpp"
#include "game/system/terrain.hpp"
#include "game/system/vegetation.hpp"
@ -860,12 +858,6 @@ void boot::setup_systems()
// Setup collision system
ctx.collision_system = new game::system::collision(*ctx.entity_registry);
// Setup samara system
ctx.samara_system = new game::system::samara(*ctx.entity_registry);
// Setup snapping system
ctx.snapping_system = new game::system::snapping(*ctx.entity_registry);
// Setup behavior system
ctx.behavior_system = new game::system::behavior(*ctx.entity_registry);
@ -1131,10 +1123,8 @@ void boot::setup_loop()
// Update entity systems
ctx.terrain_system->update(t, dt);
//ctx.vegetation_system->update(t, dt);
ctx.snapping_system->update(t, dt);
ctx.subterrain_system->update(t, dt);
ctx.collision_system->update(t, dt);
ctx.samara_system->update(t, dt);
ctx.behavior_system->update(t, dt);
ctx.steering_system->update(t, dt);
ctx.locomotion_system->update(t, dt);

+ 1
- 0
src/game/state/main-menu.cpp View File

@ -40,6 +40,7 @@
#include "game/component/model.hpp"
#include "game/component/steering.hpp"
#include "game/component/transform.hpp"
#include "math/projection.hpp"
#include <limits>
namespace game {

+ 0
- 15
src/game/state/nuptial-flight.cpp View File

@ -76,21 +76,6 @@ nuptial_flight::nuptial_flight(game::context& ctx):
ctx.logger->push_task("Entering nuptial flight state");
math::matrix<float, 3, 3> m =
{
1, 2, 3,
4, 5, 6,
7, 8, 9
};
auto m2 = math::matrix<float, 3, 3>::one();
auto m3 = math::matrix<int, 3, 3>(m2);
std::cout << "m: " << m << std::endl;
std::cout << "m2: " << m2 << std::endl;
std::cout << "m3: " << m3 << std::endl;
// Init selected picking flag
selected_picking_flag = std::uint32_t{1} << (sizeof(std::uint32_t) * 8 - 1);
selected_eid = entt::null;

+ 1
- 0
src/game/system/collision.cpp View File

@ -22,6 +22,7 @@
#include "game/component/picking.hpp"
#include "geom/primitive/intersection.hpp"
#include "geom/primitive/plane.hpp"
#include "math/transform-operators.hpp"
#include <limits>
namespace game {

+ 2
- 0
src/game/system/constraint.cpp View File

@ -19,6 +19,8 @@
#include "game/system/constraint.hpp"
#include "game/component/constraint-stack.hpp"
#include "math/quaternion-operators.hpp"
#include "math/transform-operators.hpp"
namespace game {
namespace system {

+ 0
- 1
src/game/system/painting.cpp View File

@ -23,7 +23,6 @@
#include "game/component/tool.hpp"
#include "event/event-dispatcher.hpp"
#include "resources/resource-manager.hpp"
#include "math/math.hpp"
#include "render/material.hpp"
#include "render/model.hpp"
#include "utility/fundamental-types.hpp"

+ 0
- 61
src/game/system/samara.cpp View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "samara.hpp"
#include "game/component/transform.hpp"
#include "game/component/samara.hpp"
#include "entity/id.hpp"
#include "math/math.hpp"
#include "utility/fundamental-types.hpp"
namespace game {
namespace system {
samara::samara(entity::registry& registry):
updatable(registry)
{}
void samara::update(double t, double dt)
{
registry.view<component::samara, component::transform>().each(
[&](entity::id entity_id, auto& samara, auto& transform)
{
samara.angle += samara.chirality * math::radians(360.0f * 6.0f) * dt;
transform.local.translation += samara.direction * 20.0f * (float)dt;
transform.local.rotation =
math::angle_axis(samara.angle, float3{0, 1, 0}) *
math::angle_axis(math::radians(20.0f), float3{1, 0, 0}) *
((samara.chirality < 0.0f) ? math::angle_axis(math::radians(180.0f), float3{0, 0, -1}) : math::quaternion<float>{1, 0, 0, 0});
if (transform.local.translation.y() < 0.0f)
{
const float zone = 200.0f;
transform.local.translation.x() = math::random(-zone, zone);
transform.local.translation.y() = math::random(100.0f, 150.0f);
transform.local.translation.z() = math::random(-zone, zone);
transform.warp = true;
samara.chirality = (math::random(0.0f, 1.0f) < 0.5f) ? -1.0f : 1.0f;
}
});
}
} // namespace system
} // namespace game

+ 0
- 39
src/game/system/samara.hpp View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_GAME_SYSTEM_SAMARA_HPP
#define ANTKEEPER_GAME_SYSTEM_SAMARA_HPP
#include "game/system/updatable.hpp"
namespace game {
namespace system {
class samara: public updatable
{
public:
samara(entity::registry& registry);
virtual void update(double t, double dt);
};
} // namespace system
} // namespace game
#endif // ANTKEEPER_GAME_SYSTEM_SAMARA_HPP

+ 0
- 93
src/game/system/snapping.cpp View File

@ -1,93 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#include "snapping.hpp"
#include "game/component/collision.hpp"
#include "game/component/snap.hpp"
#include "game/component/transform.hpp"
#include "entity/id.hpp"
#include "utility/fundamental-types.hpp"
namespace game {
namespace system {
snapping::snapping(entity::registry& registry):
updatable(registry)
{}
void snapping::update(double t, double dt)
{
registry.view<component::transform, component::snap>().each(
[&](entity::id entity_id, auto& snap_transform, auto& snap)
{
bool intersection = false;
float a = std::numeric_limits<float>::infinity();
float3 pick;
geom::ray<float> snap_ray = snap.ray;
if (snap.relative)
{
snap_ray.origin += snap_transform.local.translation;
snap_ray.direction = snap_transform.local.rotation * snap_ray.direction;
}
this->registry.view<component::transform, component::collision>().each(
[&](entity::id entity_id, auto& collision_transform, auto& collision)
{
// Transform ray into local space of collision component
math::transform<float> inverse_transform = math::inverse(collision_transform.local);
float3 origin = inverse_transform * snap_ray.origin;
float3 direction = math::normalize(math::conjugate(collision_transform.local.rotation) * snap_ray.direction);
geom::ray<float> transformed_ray = {origin, direction};
// Broad phase AABB test
auto aabb_result = geom::ray_aabb_intersection(transformed_ray, collision.bounds);
if (!std::get<0>(aabb_result))
{
return;
}
// Narrow phase mesh test
auto mesh_result = collision.mesh_accelerator.query_nearest(transformed_ray);
if (mesh_result)
{
intersection = true;
if (mesh_result->t < a)
{
a = mesh_result->t;
pick = snap_ray.extrapolate(a);
}
}
});
if (intersection)
{
snap_transform.local.translation = pick;
snap_transform.warp = snap.warp;
if (snap.autoremove)
{
this->registry.remove<component::snap>(entity_id);
}
}
});
}
} // namespace system
} // namespace game

+ 0
- 40
src/game/system/snapping.hpp View File

@ -1,40 +0,0 @@
/*
* Copyright (C) 2021 Christopher J. Howard
*
* This file is part of Antkeeper source code.
*
* Antkeeper source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Antkeeper source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP
#define ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP
#include "game/system/updatable.hpp"
namespace game {
namespace system {
class snapping:
public updatable
{
public:
snapping(entity::registry& registry);
virtual void update(double t, double dt);
};
} // namespace system
} // namespace game
#endif // ANTKEEPER_GAME_SYSTEM_SNAPPING_HPP

+ 1
- 0
src/game/system/steering.cpp View File

@ -23,6 +23,7 @@
#include "entity/id.hpp"
#include "ai/steering/behavior/wander.hpp"
#include "ai/steering/behavior/seek.hpp"
#include "math/quaternion-operators.hpp"
#include "config.hpp"
namespace game {

+ 3
- 1
src/geom/aabb.hpp View File

@ -22,7 +22,9 @@
#include "bounding-volume.hpp"
#include "sphere.hpp"
#include "math/math.hpp"
#include "math/vector.hpp"
#include "math/matrix.hpp"
#include "math/transform-type.hpp"
#include <limits>
namespace geom {

+ 1
- 1
src/geom/bounding-volume.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GEOM_BOUNDING_VOLUME_HPP
#define ANTKEEPER_GEOM_BOUNDING_VOLUME_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
#include <stdexcept>
namespace geom {

+ 1
- 1
src/geom/mesh-functions.cpp View File

@ -18,7 +18,7 @@
*/
#include "mesh-functions.hpp"
#include "math/math.hpp"
#include "utility/fundamental-types.hpp"
#include <unordered_map>
namespace geom {

+ 1
- 1
src/geom/plane.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GEOM_PLANE_HPP
#define ANTKEEPER_GEOM_PLANE_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace geom {

+ 1
- 1
src/geom/projection.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GEOM_PROJECTION_HPP
#define ANTKEEPER_GEOM_PROJECTION_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace geom {

+ 1
- 1
src/geom/ray.hpp View File

@ -20,7 +20,7 @@
#ifndef ANTKEEPER_GEOM_RAY_HPP
#define ANTKEEPER_GEOM_RAY_HPP
#include "math/math.hpp"
#include "math/vector.hpp"
namespace geom {

+ 1
- 1
src/geom/sphere.hpp View File

@ -22,7 +22,7 @@
#include "geom/bounding-volume.hpp"
#include "geom/aabb.hpp"
#include "math/math.hpp"
#include "math/vector.hpp"
#include <algorithm>
namespace geom {

+ 2
- 1
src/geom/view-frustum.hpp View File

@ -21,7 +21,8 @@
#define ANTKEEPER_GEOM_VIEW_FRUSTUM_HPP
#include "geom/convex-hull.hpp"
#include "math/math.hpp"
#include "math/vector.hpp"
#include "math/matrix.hpp"
#include <array>
namespace geom {

+ 14
- 10
src/math/matrix.hpp View File

@ -31,7 +31,7 @@
namespace math {
/**
* *n*-by-*m* column-major matrix.
* *n* by *m* column-major matrix.
*
* @tparam T Matrix element data type.
* @tparam N Number of columns.
@ -90,11 +90,11 @@ struct matrix
/// @}
/**
* Returns a reference to the element at a given index, in column-major order.
* Returns a reference to the element at a given column-major index.
*
* @param i Index of a matrix element.
* @param i Column-major index of a matrix element.
*
* @return Reference to the element at index @p i.
* @return Reference to the element at column-major index @p i.
*/
/// @{
constexpr inline T& element(std::size_t i) noexcept
@ -131,15 +131,19 @@ struct matrix
}
/// @}
/// Returns a pointer to the column vector array.
/**
* Returns a pointer to the first element.
*
* @warning If column_vector_type is not a POD type, elements may not be stored contiguously.
*/
/// @{
constexpr inline column_vector_type* data() noexcept
constexpr inline element_type* data() noexcept
{
return columns;
return &columns[0][0];
};
constexpr inline const column_vector_type* data() const noexcept
constexpr inline const element_type* data() const noexcept
{
return columns;
return &columns[0][0];
};
/// @}
@ -249,7 +253,7 @@ struct matrix
* @tparam P Target number of columns.
* @tparam O Target number of rows.
*
* @return *p*-by-*o* matrix.
* @return *p by *o* matrix.
*/
template <std::size_t P, std::size_t O>
constexpr inline explicit operator matrix<T, P, O>() const noexcept

+ 1
- 0
src/render/context.hpp View File

@ -23,6 +23,7 @@
#include "geom/plane.hpp"
#include "geom/bounding-volume.hpp"
#include "utility/fundamental-types.hpp"
#include "math/transform-operators.hpp"
#include <list>
namespace scene

+ 0
- 1
src/render/passes/bloom-pass.cpp View File

@ -32,7 +32,6 @@
#include "gl/texture-filter.hpp"
#include "render/vertex-attribute.hpp"
#include "render/context.hpp"
#include "math/math.hpp"
#include <cmath>
#include <glad/glad.h>

+ 1
- 0
src/render/passes/material-pass.cpp View File

@ -42,6 +42,7 @@
#include "scene/point-light.hpp"
#include "scene/spot-light.hpp"
#include "config.hpp"
#include "math/quaternion-operators.hpp"
#include <cmath>
#include <glad/glad.h>

+ 3
- 1
src/render/passes/shadow-map-pass.cpp View File

@ -32,7 +32,9 @@
#include "geom/view-frustum.hpp"
#include "geom/aabb.hpp"
#include "config.hpp"
#include "math/math.hpp"
#include "math/vector.hpp"
#include "math/matrix.hpp"
#include "math/quaternion-operators.hpp"
#include <cmath>
#include <glad/glad.h>

+ 2
- 1
src/render/renderer.cpp View File

@ -28,9 +28,10 @@
#include "scene/text.hpp"
#include "render/model.hpp"
#include "gl/drawing-mode.hpp"
#include "math/math.hpp"
#include "math/matrix.hpp"
#include "geom/projection.hpp"
#include "config.hpp"
#include "math/quaternion-operators.hpp"
#include <functional>
#include <set>

+ 1
- 0
src/scene/camera.cpp View File

@ -21,6 +21,7 @@
#include "config.hpp"
#include "math/constants.hpp"
#include "math/interpolation.hpp"
#include "math/quaternion-operators.hpp"
namespace scene {

+ 2
- 1
src/scene/directional-light.cpp View File

@ -19,7 +19,8 @@
#include "directional-light.hpp"
#include "config.hpp"
#include "math/math.hpp"
#include "math/quaternion-operators.hpp"
#include "math/interpolation.hpp"
namespace scene {

+ 1
- 1
src/scene/object.cpp View File

@ -18,7 +18,7 @@
*/
#include "scene/object.hpp"
#include "math/math.hpp"
#include "math/interpolation.hpp"
namespace scene {

+ 2
- 1
src/scene/spot-light.cpp View File

@ -19,7 +19,8 @@
#include "spot-light.hpp"
#include "config.hpp"
#include "math/math.hpp"
#include "math/quaternion-operators.hpp"
#include "math/interpolation.hpp"
#include <cmath>
namespace scene {

Loading…
Cancel
Save