Ankush's Garage
A collection of stuff made by Ankush Roy
Loading...
Searching...
No Matches
Boids.h
Go to the documentation of this file.
1
#ifndef INCLUDE_SRC_BOIDS_H_
2
#define INCLUDE_SRC_BOIDS_H_
3
4
#include "
Core/Common/pch.h
"
5
6
struct
BoidsEntity
7
{
8
glm::vec2
Position
;
9
glm::vec2
Velocity
;
10
float
Rotation
;
11
};
12
13
class
BoidsContainer
14
{
15
public
:
16
BoidsContainer
();
17
void
init
();
18
void
changeData
(
float
Seperation,
float
Alignment,
float
Cohesion);
19
void
update
();
20
// clang-format off
21
[[nodiscard]]
unsigned
int
numBoids
() const noexcept {
return
NUM_BOIDS
; }
22
// clang-format on
23
[[nodiscard]]
const
std::vector<BoidsEntity> &
getBoids
()
const
;
24
25
public
:
26
glm::vec4
Color
= {0.455f, 0.780f, 0.925f, 0.5f};
27
float
seperation
= 0.05f;
28
float
alignment
= 0.05f;
29
float
cohesion
= 0.0005f;
30
31
private
:
32
std::vector<BoidsEntity>
BoidsVec
{};
33
const
unsigned
int
NUM_BOIDS
= 100;
// changing this requires building the transfer buffers. So
34
// I refrained from doing that.
35
};
36
37
#endif
// INCLUDE_SRC_BOIDS_H_
BoidsContainer::getBoids
const std::vector< BoidsEntity > & getBoids() const
Definition
Boids.cpp:146
BoidsContainer::cohesion
float cohesion
Definition
Boids.h:29
BoidsContainer::numBoids
unsigned int numBoids() const noexcept
Definition
Boids.h:21
BoidsContainer::changeData
void changeData(float Seperation, float Alignment, float Cohesion)
Definition
Boids.cpp:32
BoidsContainer::BoidsVec
std::vector< BoidsEntity > BoidsVec
Definition
Boids.h:32
BoidsContainer::init
void init()
Definition
Boids.cpp:10
BoidsContainer::seperation
float seperation
Definition
Boids.h:27
BoidsContainer::alignment
float alignment
Definition
Boids.h:28
BoidsContainer::update
void update()
Definition
Boids.cpp:39
BoidsContainer::BoidsContainer
BoidsContainer()
Definition
Boids.cpp:5
BoidsContainer::NUM_BOIDS
const unsigned int NUM_BOIDS
Definition
Boids.h:33
BoidsContainer::Color
glm::vec4 Color
Definition
Boids.h:26
pch.h
BoidsEntity
Definition
Boids.h:7
BoidsEntity::Velocity
glm::vec2 Velocity
Definition
Boids.h:9
BoidsEntity::Position
glm::vec2 Position
Definition
Boids.h:8
BoidsEntity::Rotation
float Rotation
Definition
Boids.h:10
src
Projects
Boids
src
Boids.h
Generated by
1.13.2