Skip to content
Snippets Groups Projects
Verified Commit ff2323f3 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Add doxygen comments to geometry module

parent 3d9108f8
No related branches found
No related tags found
1 merge request!108Resolve "Basic geometry module"
......@@ -23,23 +23,25 @@ Detailed build process:
Most dependencies will be used via submodules but for example Vulkan needs to be installed correctly depending on your platform. So please setup your environment properly.
| Name of dependency | Used as submodule |
|-----------------------------------|---|
| [Vulkan](https://www.vulkan.org/) | ❌ |
| [Vulkan-Headers](https://github.com/KhronosGroup/Vulkan-Headers) | ✅ |
| [Vulkan-Hpp](https://github.com/KhronosGroup/Vulkan-Hpp) | ✅ |
| [GLFW](https://www.glfw.org/) | ✅ |
| [SPIRV-CROSS](https://github.com/KhronosGroup/SPIRV-Cross) | ✅ |
| Name of dependency | Used as submodule |
|-----------------------------------------------------------------------------------|---|
| [Vulkan](https://www.vulkan.org/) | ❌ |
| [Vulkan-Headers](https://github.com/KhronosGroup/Vulkan-Headers) | ✅ |
| [Vulkan-Hpp](https://github.com/KhronosGroup/Vulkan-Hpp) | ✅ |
| [GLFW](https://www.glfw.org/) | ✅ |
| [SPIRV-CROSS](https://github.com/KhronosGroup/SPIRV-Cross) | ✅ |
| [VulkanMemoryAllocator-Hpp](https://github.com/malte-v/VulkanMemoryAllocator-Hpp) | ✅ |
### Modules (optional):
The following modules will be provided in this repository and they will automatically be builded together with the framework if used. You can configure/adjust the build using CMake if necessary.
- [Algorithm](modules/algorithm/README.md)
- [Asset-Loader](modules/asset_loader/README.md)
- [Camera](modules/asset_loader/README.md)
- [GUI](modules/gui/README.md)
- [Effects](modules/effects/README.md)
- [Geometry](modules/geometry/README.md)
- [Material](modules/material/README.md)
- [Meshlet](modules/meshlet/README.md)
- [Scene](modules/scene/README.md)
......
......@@ -9,30 +9,97 @@ namespace vkcv::geometry {
* @{
*/
/**
* A basic class to provide attributes for circular geometry.
*/
class Circular {
private:
/**
* Radius of the circular part of the geometry.
*/
float m_radius;
/**
* Resolution in case of generating the geometry in a
* discrete way.
*/
size_t m_resolution;
public:
/**
* Constructor creating circular geometry by a given
* radius and a resolution also provides a default.
*
* @param[in] radius Radius of the circular geometry
* @param[in] resoltion Resolution of the circular geometry
*/
explicit Circular(float radius, size_t resoltion = 10);
/**
* Copy-constructor of a circular geometry.
*
* @param[in] other Other circular geometry
*/
Circular(const Circular& other) = default;
/**
* Move-constructor of a circular geometry.
*
* @param[in] other Other circular geometry
*/
Circular(Circular&& other) = default;
/**
* Destructor of a circular geometry.
*/
~Circular() = default;
/**
* Copy-operator of a circular geometry.
*
* @param[in] other Other circular geometry
* @return Reference to this circular geometry
*/
Circular& operator=(const Circular& other) = default;
/**
* Move-operator of a circular geometry.
*
* @param[in] other Other circular geometry
* @return Reference to this circular geometry
*/
Circular& operator=(Circular&& other) = default;
/**
* Return the radius of the circular part of the geometry.
*
* @return Radius of the circular geometry
*/
[[nodiscard]]
float getRadius() const;
/**
* Set the radius of the circular part of the geometry.
*
* @param[in] radius Radius of the circular geometry
*/
void setRadius(float radius);
/**
* Return the resolution of the geometry for discrete
* generation.
*
* @return Resolution of the circular geometry
*/
[[nodiscard]]
size_t getResolution() const;
/**
* Set the resolution of the geometry for any discrete
* generation.
*
* @param[in] resolution Resolution of the circular geometry
*/
void setResolution(size_t resolution);
};
......
......@@ -9,31 +9,110 @@ namespace vkcv::geometry {
* @{
*/
/**
* A class to use geometry in form of a cuboid.
*/
class Cuboid : public Volume {
private:
/**
* Size of the cuboid in 3D-space.
*/
glm::vec3 m_size;
public:
/**
* Constructor creating cuboid by a given position
* and size as 3D vectors.
*
* @param[in] position Position of the cuboid as 3D vector
* @param[in] size Size of the cuboid as 3D vector
*/
Cuboid(const glm::vec3& position, const glm::vec3& size);
/**
* Constructor creating cube by a given position
* as 3D vector and uniform size.
*
* @param[in] position Position of the cube as 3D vector
* @param[in] size Uniform size of the cube
*/
Cuboid(const glm::vec3& position, float size);
/**
* Copy-constructor of a cuboid.
*
* @param[in] other Other cuboid
*/
Cuboid(const Cuboid& other) = default;
/**
* Move-constructor of a cuboid.
*
* @param[in] other Other cuboid
*/
Cuboid(Cuboid&& other) = default;
/**
* Destructor of a cuboid.
*/
~Cuboid() = default;
/**
* Copy-operator of a cuboid.
*
* @param[in] other Other cuboid
* @return Reference to this cuboid
*/
Cuboid& operator=(const Cuboid& other) = default;
/**
* Move-operator of a cuboid.
*
* @param[in] other Other cuboid
* @return Reference to this cuboid
*/
Cuboid& operator=(Cuboid&& other) = default;
/**
* Return the size of a cuboid as 3D vector.
*
* @return Size of the cuboid as 3D vector
*/
[[nodiscard]]
const glm::vec3& getSize() const;
/**
* Set the size of a cuboid to a specific
* 3D vector.
*
* @param[in] position Size as 3D vector
*/
void setSize(const glm::vec3& size);
/**
* Returns the signed distance from a point to the closest
* surface of the cuboid.
*
* The result is negative if the point is contained by the
* cuboid.
*
* @param[in] point Point as 3D vector
* @return Signed distance from point to surface
*/
[[nodiscard]]
float distanceTo(const glm::vec3& point) override;
/**
* Generates a vertex data structure, which can be
* used for rendering via draw calls, containing
* the cuboid in a discrete form.
*
* The vertex data will store positions, normals and
* UV-coordinates as vertex attributes.
*
* @param[in,out] core Core instance
* @return Vertex data with generated geometry
*/
[[nodiscard]]
VertexData generateVertexData(Core& core) const override;
......
......@@ -10,29 +10,101 @@ namespace vkcv::geometry {
* @{
*/
/**
* A class to use geometry in form of a cylinder.
*/
class Cylinder : public Volume, public Circular {
private:
/**
* Height of the cylinder (Y-axis)
*/
float m_height;
public:
/**
* Constructor creating cylinder by a given position
* as 3D vector, a given height and a radius.
*
* @param[in] position Position of the cylinder as 3D vector
* @param[in] height Height of the cylinder
* @param[in] radius Radius of the cylinder
*/
Cylinder(const glm::vec3& position, float height, float radius);
/**
* Copy-constructor of a cylinder.
*
* @param[in] other Other cylinder
*/
Cylinder(const Cylinder& other) = default;
/**
* Move-constructor of a cylinder.
*
* @param[in] other Other cylinder
*/
Cylinder(Cylinder&& other) = default;
/**
* Destructor of a cylinder.
*/
~Cylinder() = default;
/**
* Copy-operator of a cylinder.
*
* @param[in] other Other cylinder
* @return Reference to this cylinder
*/
Cylinder& operator=(const Cylinder& other) = default;
/**
* Move-operator of a cylinder.
*
* @param[in] other Other cylinder
* @return Reference to this cylinder
*/
Cylinder& operator=(Cylinder&& other) = default;
/**
* Return the height of the cylinder.
*
* @return Height of the cylinder
*/
[[nodiscard]]
float getHeight() const;
/**
* Set the height of the cylinder.
*
* @param[in] height Height of the cylinder
*/
void setHeight(float height);
/**
* Returns the signed distance from a point to the closest
* surface of the cylinder.
*
* The result is negative if the point is contained by the
* cylinder.
*
* @param[in] point Point as 3D vector
* @return Signed distance from point to surface
*/
[[nodiscard]]
float distanceTo(const glm::vec3& point) override;
/**
* Generates a vertex data structure, which can be
* used for rendering via draw calls, containing
* the cylinder in a discrete form.
*
* The vertex data will store positions, normals and
* UV-coordinates as vertex attributes.
*
* @param[in,out] core Core instance
* @return Vertex data with generated geometry
*/
[[nodiscard]]
VertexData generateVertexData(Core& core) const override;
......
......@@ -14,26 +14,87 @@ namespace vkcv::geometry {
* @{
*/
/**
* A basic class to provide attributes for any kind of geometry.
*/
class Geometry {
private:
/**
* Position of the geometry in 3D-coordinates.
*/
glm::vec3 m_position;
public:
/**
* Constructor creating geometry by a given position
* as 3D vector.
*
* @param[in] position Position of the geometry as 3D vector
*/
explicit Geometry(const glm::vec3& position);
/**
* Copy-constructor of a geometry.
*
* @param[in] other Other geometry
*/
Geometry(const Geometry& other) = default;
/**
* Move-constructor of a geometry.
*
* @param[in] other Other geometry
*/
Geometry(Geometry&& other) = default;
/**
* Destructor of a geometry.
*/
~Geometry() = default;
/**
* Copy-operator of a geometry.
*
* @param[in] other Other geometry
* @return Reference to this geometry
*/
Geometry& operator=(const Geometry& other) = default;
/**
* Move-operator of a geometry.
*
* @param[in] other Other geometry
* @return Reference to this geometry
*/
Geometry& operator=(Geometry&& other) = default;
/**
* Return the position of a geometry as 3D vector.
*
* @return Position of the geometry as 3D vector
*/
[[nodiscard]]
const glm::vec3& getPosition() const;
/**
* Set the position of a geometry to a specific
* 3D vector.
*
* @param[in] position Position as 3D vector
*/
void setPosition(const glm::vec3& position);
/**
* Generates a vertex data structure, which can be
* used for rendering via draw calls, containing
* the geometry in a discrete form.
*
* The vertex data will store positions, normals and
* UV-coordinates as vertex attributes.
*
* @param[in,out] core Core instance
* @return Vertex data with generated geometry
*/
[[nodiscard]]
virtual VertexData generateVertexData(Core& core) const = 0;
......
......@@ -10,24 +10,79 @@ namespace vkcv::geometry {
* @{
*/
/**
* A class to use geometry in form of a sphere.
*/
class Sphere : public Volume, public Circular {
private:
float m_radius;
public:
/**
* Constructor creating sphere by a given position
* as 3D vector and a radius.
*
* @param[in] position Position of the sphere as 3D vector
* @param[in] radius Radius of the sphere
*/
Sphere(const glm::vec3& position, float radius);
/**
* Copy-constructor of a sphere.
*
* @param[in] other Other sphere
*/
Sphere(const Sphere& other) = default;
/**
* Move-constructor of a sphere.
*
* @param[in] other Other sphere
*/
Sphere(Sphere&& other) = default;
/**
* Destructor of a sphere.
*/
~Sphere() = default;
/**
* Copy-operator of a sphere.
*
* @param[in] other Other sphere
* @return Reference to this sphere
*/
Sphere& operator=(const Sphere& other) = default;
/**
* Move-operator of a sphere.
*
* @param[in] other Other sphere
* @return Reference to this sphere
*/
Sphere& operator=(Sphere&& other) = default;
/**
* Returns the signed distance from a point to the closest
* surface of the sphere.
*
* The result is negative if the point is contained by the
* sphere.
*
* @param[in] point Point as 3D vector
* @return Signed distance from point to surface
*/
[[nodiscard]]
float distanceTo(const glm::vec3& point) override;
/**
* Generates a vertex data structure, which can be
* used for rendering via draw calls, containing
* the sphere in a discrete form.
*
* The vertex data will store positions, normals and
* UV-coordinates as vertex attributes.
*
* @param[in,out] core Core instance
* @return Vertex data with generated geometry
*/
[[nodiscard]]
VertexData generateVertexData(Core& core) const override;
......
......@@ -9,26 +9,87 @@ namespace vkcv::geometry {
* @{
*/
/**
* A class to use geometry in form of a teapot.
*/
class Teapot : public Geometry {
private:
/**
* Uniform scale of the teapot.
*/
float m_scale;
public:
/**
* Constructor creating teapot by a given position
* as 3D vector and uniform scale.
*
* @param[in] position Position of the teapot as 3D vector
* @param[in] scale Uniform scale of the teapot
*/
explicit Teapot(const glm::vec3& position, float scale);
/**
* Copy-constructor of a teapot.
*
* @param[in] other Other teapot
*/
Teapot(const Teapot& other) = default;
/**
* Move-constructor of a teapot.
*
* @param[in] other Other teapot
*/
Teapot(Teapot&& other) = default;
/**
* Destructor of a teapot.
*/
~Teapot() = default;
/**
* Copy-operator of a teapot.
*
* @param[in] other Other teapot
* @return Reference to this teapot
*/
Teapot& operator=(const Teapot& other) = default;
/**
* Move-operator of a teapot.
*
* @param[in] other Other teapot
* @return Reference to this teapot
*/
Teapot& operator=(Teapot&& other) = default;
/**
* Return the uniform scale of a teapot.
*
* @return Uniform scale of the teapot
*/
[[nodiscard]]
float getScale() const;
/**
* Set the uniform scale of a teapot.
*
* @param scale Uniform scale
*/
void setScale(float scale);
/**
* Generates a vertex data structure, which can be
* used for rendering via draw calls, containing
* the teapot in a discrete form.
*
* The vertex data will store positions, normals and
* UV-coordinates as vertex attributes.
*
* @param[in,out] core Core instance
* @return Vertex data with generated geometry
*/
[[nodiscard]]
VertexData generateVertexData(Core& core) const override;
......
......@@ -9,22 +9,75 @@ namespace vkcv::geometry {
* @{
*/
/**
* A basic class to provide functions for any volumetric geometry.
*/
class Volume : public Geometry {
private:
public:
/**
* Constructor creating volumetric geometry by a given
* position as 3D vector.
*
* @param[in] position Position of the geometry as 3D vector
*/
explicit Volume(const glm::vec3& position);
/**
* Copy-constructor of a volumetric geometry.
*
* @param[in] other Other volumetric geometry
*/
Volume(const Volume& other) = default;
/**
* Move-constructor of a volumetric geometry.
*
* @param[in] other Other volumetric geometry
*/
Volume(Volume&& other) = default;
/**
* Destructor of a volumetric geometry.
*/
~Volume() = default;
/**
* Copy-operator of a volumetric geometry.
*
* @param[in] other Other volumetric geometry
* @return Reference to this volumetric geometry
*/
Volume& operator=(const Volume& other) = default;
/**
* Move-operator of a volumetric geometry.
*
* @param[in] other Other volumetric geometry
* @return Reference to this volumetric geometry
*/
Volume& operator=(Volume&& other) = default;
/**
* Returns the signed distance from a point to the closest
* surface of the volumetric geometry.
*
* The result is negative if the point is contained by the
* volumetric geometry.
*
* @param[in] point Point as 3D vector
* @return Signed distance from point to surface
*/
[[nodiscard]]
virtual float distanceTo(const glm::vec3& point) = 0;
/**
* Returns as boolean value whether a point is contained
* by a volumetric geometry.
*
* @param[in] point Point as 3D vector
* @return true if the point is contained, other false.
*/
[[nodiscard]]
bool contains(const glm::vec3& point);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment