Level H Engine
|
A class that handles the model component. More...
#include <ModelComponent.h>
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... | |
![]() | |
virtual | ~Component () |
A virtual destructor. More... | |
std::weak_ptr< GameObject > | getGameObject () |
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, Vec3 > | vec3Uniforms |
Vec3 | ambient |
The ambient and diffuse values. More... | |
Vec3 | diffuse |
Additional Inherited Members | |
![]() | |
std::string | id |
The ID of the component type. More... | |
A class that handles the model component.
|
virtual |
A virtual destructor.
void ModelComponent::addMat4Uniform | ( | std::string | uniformID, |
float * | matPointer | ||
) |
A function to add a matrix 4 uniform.
uniformID | The ID of the uniform. |
matPointer | A pointer to the matrix array. |
void ModelComponent::addVec3Uniform | ( | std::string | uniformID, |
Vec3 | vec | ||
) |
A function to initlaise the uniforms.
|
inline |
A function to get the mesh ID.
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!!!
vertexShaderFileName | The vertex shader to use. |
inColour | The default colour shader to use. |
void ModelComponent::initaliseHeightmap | ( | std::string | fileName | ) |
A function to initalise a mesh with a heightmap.
fileName | The image file for the heightmap. |
void ModelComponent::initaliseHeightmap | ( | std::string | fileName, |
std::string | textureFileName | ||
) |
A function to initalise a mesh with a heightmap ad a texture.
fileName | The image file for the heightmap. |
textureFileName | The name of the texture file. |
void ModelComponent::initaliseMesh | ( | std::string | objFileName | ) |
A function to initalise a mesh without a texture.
objFileName | The obj file for the mesh. |
void ModelComponent::initaliseMesh | ( | std::string | objFileName, |
std::string | textureFileName | ||
) |
A function to initalise a mesh with a texture.
objFileName | The obj file for the mesh. |
textureFileName | The name of the texture file. |
void ModelComponent::initalisePrimitive | ( | Primitives::PrimativeType | primType | ) |
A function to initalise a mesh using a primiative type.
primType | The primitive type for the mesh. |
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!!!
vertexShaderFileName | The vertex shader to use. |
fragmentShaderFileName | The fragment shader to use. |
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!!!
vertexShaderFileName | The vertex shader to use. |
inR | The colour red value. |
inG | The colour green value. |
inB | The colour blue value. |
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!!!
vertexShaderFileName | The vertex shader to use. |
inDiffuse | The diffuse colour value. |
inAmbient | The ambient colour value. |
void ModelComponent::initaliseUniforms | ( | ) |
A function to initlaise the uniforms.
|
virtual |
A virtual function for the componets awake.
Reimplemented from Component.
|
virtual |
A virtual function for the componets destroy.
Reimplemented from Component.
|
virtual |
A function for the model render.
Reimplemented from Component.
void ModelComponent::setAmbient | ( | Vec3 | inAmb | ) |
A function to set the ambient value.
void ModelComponent::setColour | ( | ) |
A function to set the colour.
void ModelComponent::setDiffuse | ( | Vec3 | inDif | ) |
A function to set the diffuse value.
|
private |
The ambient and diffuse values.
|
private |
|
private |
|
private |
The Uniform locations for the shader program.
|
private |
The mesh for the Model.
|
private |
The Shader for the Model.
|
private |
A boolean for if textured.
|
private |