Level H Engine
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Flocking Class Reference

Creates a Flocking object. NOTE - This is a HEAVILY modifed version of code from a previous assignment (It was not built for 3D initaliy) More...

#include <Flocking.h>

Collaboration diagram for Flocking:
Collaboration graph

Public Member Functions

 Flocking (int inNumberOfBoids, std::string inSpriteID, int inXBoundary, int inYBoundary, float inMaxVel)
 Constructs the 2D Flocking object. More...
 
 Flocking (int inNumberOfBoids, std::string inMesh, std::string inBoidTexture, std::string inBoidVertexShader, std::string inBoidFragmentShader, int inXBoundary, int inYBoundary, int inZBoundary, float inMaxVel)
 Constructs the 3D Flocking object. More...
 
 Flocking (int inNumberOfBoids, std::string inMesh, std::string inBoidVertexShader, std::string inBoidFragmentShader, int inXBoundary, int inYBoundary, int inZBoundary, float inMaxVel)
 Constructs the 3D Flocking object. More...
 
 ~Flocking ()
 Destructs the Flocking object. More...
 
void update2D ()
 A function that updates the Flocking. More...
 
void update3D ()
 A function that updates the Flocking. More...
 
void draw2D ()
 Draws the 2D Flocking. More...
 
void setRule1 (int inApplyRule1)
 Set applyRule1. More...
 
void setRule2 (int inApplyRule2)
 Set applyRule2. More...
 
void setRule3 (int inApplyRule3)
 Set applyRule3. More...
 

Private Member Functions

Vec2 rule1 (int index)
 Applies Boid Rule 1. More...
 
Vec3 ruleOne3D (int index)
 Applies Boid Rule 1. More...
 
Vec2 rule2 (int index)
 Applies Boid Rule 2. More...
 
Vec3 ruleTwo3D (int index)
 Applies Boid Rule 2. More...
 
Vec2 rule3 (int index)
 Applies Boid Rule 3. More...
 
Vec3 ruleThree3D (int index)
 Applies Boid Rule 3. More...
 
Vec2 roughBoundaries (int index)
 Applies Boid rough boundaries. More...
 
Vec3 roughBoundaries3D (int index)
 Applies Boid rough boundaries. More...
 
void limitVelocity (int index)
 Limits the Boid velocity. More...
 
void limitVelocity3D (int index)
 Limits the Boid velocity. More...
 

Private Attributes

std::string spriteID
 The ID of the 2D boid sprite. More...
 
std::vector< Boid * > boids
 A vector of Particle boids. More...
 
int applyRule1
 What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative) More...
 
int applyRule2
 
int applyRule3
 
int xBoundary
 The boundaries of the boids. More...
 
int yBoundary
 
int zBoundary
 
float maxVel
 The max velocity. More...
 

Detailed Description

Creates a Flocking object. NOTE - This is a HEAVILY modifed version of code from a previous assignment (It was not built for 3D initaliy)

Constructor & Destructor Documentation

◆ Flocking() [1/3]

Flocking::Flocking ( int  inNumberOfBoids,
std::string  inSpriteID,
int  inXBoundary,
int  inYBoundary,
float  inMaxVel 
)

Constructs the 2D Flocking object.

Parameters
inNmberOfBoidsThe number of boids.
inSpriteIDThe ID of the sprite.
inXBoundaryThe rough x boundary of the boids.
inYBoundaryThe rough y boundary of the boids.
inMaxVelThe maximum velocity of the boids.

◆ Flocking() [2/3]

Flocking::Flocking ( int  inNumberOfBoids,
std::string  inMesh,
std::string  inBoidTexture,
std::string  inBoidVertexShader,
std::string  inBoidFragmentShader,
int  inXBoundary,
int  inYBoundary,
int  inZBoundary,
float  inMaxVel 
)

Constructs the 3D Flocking object.

Parameters
inNmberOfBoidsThe number of boids.
meshIDThe path of the mesh for the boids
meshIDThe path of the texture for the boids.
meshIDThe path of the vertex shader for the boids.
meshIDThe path of the fragment shader for the boids.
inXBoundaryThe rough x boundary of the boids.
inYBoundaryThe rough y boundary of the boids.
inZBoundaryThe rough z boundary of the boids.
inMaxVelThe maximum velocity of the boids.

◆ Flocking() [3/3]

Flocking::Flocking ( int  inNumberOfBoids,
std::string  inMesh,
std::string  inBoidVertexShader,
std::string  inBoidFragmentShader,
int  inXBoundary,
int  inYBoundary,
int  inZBoundary,
float  inMaxVel 
)

Constructs the 3D Flocking object.

Parameters
inNmberOfBoidsThe number of boids.
meshIDThe path of the mesh for the boids
meshIDThe path of the vertex shader for the boids.
meshIDThe path of the fragment shader for the boids.
inXBoundaryThe rough x boundary of the boids.
inYBoundaryThe rough y boundary of the boids.
inYBoundaryThe rough z boundary of the boids.
inMaxVelThe maximum velocity of the boids.

◆ ~Flocking()

Flocking::~Flocking ( )

Destructs the Flocking object.

Member Function Documentation

◆ draw2D()

void Flocking::draw2D ( )

Draws the 2D Flocking.

Parameters
rendererA pointer to the renderer.
Here is the caller graph for this function:

◆ limitVelocity()

void Flocking::limitVelocity ( int  index)
private

Limits the Boid velocity.

Parameters
indexThe index of the Boid to test.
Here is the caller graph for this function:

◆ limitVelocity3D()

void Flocking::limitVelocity3D ( int  index)
private

Limits the Boid velocity.

Parameters
indexThe index of the Boid to test.
Here is the caller graph for this function:

◆ roughBoundaries()

Vec2 Flocking::roughBoundaries ( int  index)
private

Applies Boid rough boundaries.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the boundary.
Here is the caller graph for this function:

◆ roughBoundaries3D()

Vec3 Flocking::roughBoundaries3D ( int  index)
private

Applies Boid rough boundaries.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the boundary.
Here is the caller graph for this function:

◆ rule1()

Vec2 Flocking::rule1 ( int  index)
private

Applies Boid Rule 1.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ rule2()

Vec2 Flocking::rule2 ( int  index)
private

Applies Boid Rule 2.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ rule3()

Vec2 Flocking::rule3 ( int  index)
private

Applies Boid Rule 3.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ ruleOne3D()

Vec3 Flocking::ruleOne3D ( int  index)
private

Applies Boid Rule 1.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ ruleThree3D()

Vec3 Flocking::ruleThree3D ( int  index)
private

Applies Boid Rule 3.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ ruleTwo3D()

Vec3 Flocking::ruleTwo3D ( int  index)
private

Applies Boid Rule 2.

Parameters
indexThe index of the Boid to test.
Returns
The resultant velocity of the rule.
Here is the caller graph for this function:

◆ setRule1()

void Flocking::setRule1 ( int  inApplyRule1)

Set applyRule1.

Parameters
applyRule1What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)
Here is the caller graph for this function:

◆ setRule2()

void Flocking::setRule2 ( int  inApplyRule2)

Set applyRule2.

Parameters
applyRule2What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)
Here is the caller graph for this function:

◆ setRule3()

void Flocking::setRule3 ( int  inApplyRule3)

Set applyRule3.

Parameters
applyRule3What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)
Here is the caller graph for this function:

◆ update2D()

void Flocking::update2D ( )

A function that updates the Flocking.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update3D()

void Flocking::update3D ( )

A function that updates the Flocking.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ applyRule1

int Flocking::applyRule1
private

What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)

◆ applyRule2

int Flocking::applyRule2
private

◆ applyRule3

int Flocking::applyRule3
private

◆ boids

std::vector<Boid*> Flocking::boids
private

A vector of Particle boids.

◆ maxVel

float Flocking::maxVel
private

The max velocity.

◆ spriteID

std::string Flocking::spriteID
private

The ID of the 2D boid sprite.

◆ xBoundary

int Flocking::xBoundary
private

The boundaries of the boids.

◆ yBoundary

int Flocking::yBoundary
private

◆ zBoundary

int Flocking::zBoundary
private

The documentation for this class was generated from the following files: