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

A class that handles the model component. More...

#include <ModelComponent.h>

Inheritance diagram for ModelComponent:
Inheritance graph
Collaboration diagram for ModelComponent:
Collaboration graph

Public Member Functions

virtual ~ModelComponent ()
 A virtual destructor. More...
 
void onRender ()
 A function for the model render. More...
 
void initaliseHeightmap (std::string fileName)
 A function to initalise a mesh with a heightmap. More...
 
void initalisePrimitive (Primitives::PrimativeType primType)
 A function to initalise a mesh using a primiative type. More...
 
void initaliseHeightmap (std::string fileName, std::string textureFileName)
 A function to initalise a mesh with a heightmap ad a texture. More...
 
void addMat4Uniform (std::string uniformID, float *matPointer)
 A function to add a matrix 4 uniform. More...
 
void addVec3Uniform (std::string uniformID, Vec3 vec)
 A function to initlaise the uniforms. More...
 
void initaliseUniforms ()
 A function to initlaise the uniforms. More...
 
void setDiffuse (Vec3 inDif)
 A function to set the diffuse value. More...
 
void setAmbient (Vec3 inAmb)
 A function to set the ambient value. More...
 
void initaliseMesh (std::string objFileName)
 A function to initalise a mesh without a texture. More...
 
void initaliseMesh (std::string objFileName, std::string textureFileName)
 A function to initalise a mesh with a texture. More...
 
void initaliseShaders (std::string vertexShaderFileName, std::string fragmentShaderFileName)
 A function to initalise the shaders to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!! More...
 
void initaliseShaders (std::string vertexShaderFileName, float inR, float inG, float inB)
 A function to initalise the shaders to use a colour with the mesh. MUST BE RUN AFTER MESH INITALISE!!! More...
 
void initaliseShaders (std::string vertexShaderFileName, Vec3 inDiffuse, Vec3 inAmbient)
 A function to initalise the shaders to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!! More...
 
void initaliseDefaultColourShaders (std::string vertexShaderFileName, std::string inColour)
 A function to initalise a default colour shader to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!! More...
 
std::string getMeshID ()
 A function to get the mesh ID. More...
 
virtual void onAwake ()
 A virtual function for the componets awake. More...
 
virtual void onDestroy ()
 A virtual function for the componets destroy. More...
 
void setColour ()
 A function to set the colour. More...
 
- Public Member Functions inherited from Component
virtual ~Component ()
 A virtual destructor. More...
 
std::weak_ptr< GameObjectgetGameObject ()
 A function to get the game object linked with the component. More...
 
virtual void onUpdate ()
 A virtual function for the componets update. More...
 
void setDestroyed (bool inDestroyed)
 A function to set the componets destroyed boolean. More...
 
bool getDestroyed ()
 A function to get the componets destroyed boolean. More...
 
std::string getID ()
 A function to set the components type ID. More...
 

Private Attributes

std::string shaderID
 The Shader for the Model. More...
 
std::string meshID
 The mesh for the Model. More...
 
bool textured
 A boolean for if textured. More...
 
bool colour
 
std::unordered_map< std::string, float * > mat4Uniforms
 The Uniform locations for the shader program. More...
 
std::unordered_map< std::string, Vec3vec3Uniforms
 
Vec3 ambient
 The ambient and diffuse values. More...
 
Vec3 diffuse
 

Additional Inherited Members

- Protected Attributes inherited from Component
std::string id
 The ID of the component type. More...
 

Detailed Description

A class that handles the model component.

Constructor & Destructor Documentation

◆ ~ModelComponent()

ModelComponent::~ModelComponent ( )
virtual

A virtual destructor.

Member Function Documentation

◆ addMat4Uniform()

void ModelComponent::addMat4Uniform ( std::string  uniformID,
float *  matPointer 
)

A function to add a matrix 4 uniform.

Parameters
uniformIDThe ID of the uniform.
matPointerA pointer to the matrix array.
Here is the call graph for this function:

◆ addVec3Uniform()

void ModelComponent::addVec3Uniform ( std::string  uniformID,
Vec3  vec 
)

A function to initlaise the uniforms.

Here is the call graph for this function:

◆ getMeshID()

std::string ModelComponent::getMeshID ( )
inline

A function to get the mesh ID.

Returns
The ID of the mesh.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseDefaultColourShaders()

void ModelComponent::initaliseDefaultColourShaders ( std::string  vertexShaderFileName,
std::string  inColour 
)

A function to initalise a default colour shader to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!!

Parameters
vertexShaderFileNameThe vertex shader to use.
inColourThe default colour shader to use.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseHeightmap() [1/2]

void ModelComponent::initaliseHeightmap ( std::string  fileName)

A function to initalise a mesh with a heightmap.

Parameters
fileNameThe image file for the heightmap.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseHeightmap() [2/2]

void ModelComponent::initaliseHeightmap ( std::string  fileName,
std::string  textureFileName 
)

A function to initalise a mesh with a heightmap ad a texture.

Parameters
fileNameThe image file for the heightmap.
textureFileNameThe name of the texture file.
Here is the call graph for this function:

◆ initaliseMesh() [1/2]

void ModelComponent::initaliseMesh ( std::string  objFileName)

A function to initalise a mesh without a texture.

Parameters
objFileNameThe obj file for the mesh.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseMesh() [2/2]

void ModelComponent::initaliseMesh ( std::string  objFileName,
std::string  textureFileName 
)

A function to initalise a mesh with a texture.

Parameters
objFileNameThe obj file for the mesh.
textureFileNameThe name of the texture file.
Here is the call graph for this function:

◆ initalisePrimitive()

void ModelComponent::initalisePrimitive ( Primitives::PrimativeType  primType)

A function to initalise a mesh using a primiative type.

Parameters
primTypeThe primitive type for the mesh.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseShaders() [1/3]

void ModelComponent::initaliseShaders ( std::string  vertexShaderFileName,
std::string  fragmentShaderFileName 
)

A function to initalise the shaders to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!!

Parameters
vertexShaderFileNameThe vertex shader to use.
fragmentShaderFileNameThe fragment shader to use.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initaliseShaders() [2/3]

void ModelComponent::initaliseShaders ( std::string  vertexShaderFileName,
float  inR,
float  inG,
float  inB 
)

A function to initalise the shaders to use a colour with the mesh. MUST BE RUN AFTER MESH INITALISE!!!

Parameters
vertexShaderFileNameThe vertex shader to use.
inRThe colour red value.
inGThe colour green value.
inBThe colour blue value.
Here is the call graph for this function:

◆ initaliseShaders() [3/3]

void ModelComponent::initaliseShaders ( std::string  vertexShaderFileName,
Vec3  inDiffuse,
Vec3  inAmbient 
)

A function to initalise the shaders to use with the mesh. MUST BE RUN AFTER MESH INITALISE!!!

Parameters
vertexShaderFileNameThe vertex shader to use.
inDiffuseThe diffuse colour value.
inAmbientThe ambient colour value.
Here is the call graph for this function:

◆ initaliseUniforms()

void ModelComponent::initaliseUniforms ( )

A function to initlaise the uniforms.

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

◆ onAwake()

void ModelComponent::onAwake ( )
virtual

A virtual function for the componets awake.

Reimplemented from Component.

Here is the caller graph for this function:

◆ onDestroy()

void ModelComponent::onDestroy ( )
virtual

A virtual function for the componets destroy.

Reimplemented from Component.

Here is the caller graph for this function:

◆ onRender()

void ModelComponent::onRender ( )
virtual

A function for the model render.

Reimplemented from Component.

Here is the call graph for this function:

◆ setAmbient()

void ModelComponent::setAmbient ( Vec3  inAmb)

A function to set the ambient value.

◆ setColour()

void ModelComponent::setColour ( )

A function to set the colour.

Here is the caller graph for this function:

◆ setDiffuse()

void ModelComponent::setDiffuse ( Vec3  inDif)

A function to set the diffuse value.

Here is the caller graph for this function:

Member Data Documentation

◆ ambient

Vec3 ModelComponent::ambient
private

The ambient and diffuse values.

◆ colour

bool ModelComponent::colour
private

◆ diffuse

Vec3 ModelComponent::diffuse
private

◆ mat4Uniforms

std::unordered_map<std::string, float*> ModelComponent::mat4Uniforms
private

The Uniform locations for the shader program.

◆ meshID

std::string ModelComponent::meshID
private

The mesh for the Model.

◆ shaderID

std::string ModelComponent::shaderID
private

The Shader for the Model.

◆ textured

bool ModelComponent::textured
private

A boolean for if textured.

◆ vec3Uniforms

std::unordered_map<std::string, Vec3> ModelComponent::vec3Uniforms
private

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