Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
V3DModel Class Reference

Basic 3D Model with a single texture. More...

#include <V3DModel.h>

Inheritance diagram for V3DModel:
V3DObject VBase

Public Types

typedef V3DObject VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 
- Public Types inherited from V3DObject
typedef VBase VSUPERCLASS
 Used to call parent class functions when they are overrided in class.
 

Public Member Functions

 V3DModel (sf::Vector3f position, sf::Vector3f rotation, sf::Vector3f scale)
 
 V3DModel (float posX=0, float posY=0, float posZ=0, float rotX=0, float rotY=0, float rotZ=0, float scaleX=1, float scaleY=1, float scaleZ=1)
 
bool LoadModelData (const V3DVertexArray &vertexArray, const std::vector< unsigned int > &indexArray=std::vector< unsigned int >())
 
bool LoadTexture (const sf::String &filename)
 
bool LoadTexture (const sf::Texture &tex)
 
virtual void UpdateShader (V3DShader *shader, V3DCamera *camera) override
 
virtual void Destroy () override
 Destroys object and any data that must be destroyed.
 
virtual void Draw (sf::RenderTarget &RenderTarget) override
 
- Public Member Functions inherited from V3DObject
 V3DObject (sf::Vector3f position, sf::Vector3f rotation, sf::Vector3f scale)
 
 V3DObject (float posX=0, float posY=0, float posZ=0, float rotX=0, float rotY=0, float rotZ=0, float scaleX=1, float scaleY=1, float scaleZ=1)
 
sf::Vector3f GetMinimum ()
 
sf::Vector3f GetMaximum ()
 
virtual void Reset (sf::Vector3f newPos)
 
virtual void Reset (float x, float y, float z)
 
virtual void Hurt (float damage)
 
virtual void Update (float dt) override
 
- Public Member Functions inherited from VBase
virtual void Kill ()
 
virtual void Revive ()
 Revives the object by setting both alive and exists back to true.
 

Static Public Member Functions

static void GenerateDefaultTexture ()
 Function to generate default texture.
 
- Static Public Member Functions inherited from VBase
static const wchar_t * VString (const char *fmt,...)
 
static void VLog (const char *fmt,...)
 
static void VLogError (const char *fmt,...)
 
static void VClearLog ()
 

Public Attributes

V3DMaterialMaterial
 Surface Material for Lighting.
 
- Public Attributes inherited from V3DObject
sf::Vector3f Position
 Position Transform.
 
sf::Vector3f Rotation
 Rotation Transform.
 
sf::Vector3f Scale
 Scale transform.
 
sf::Vector3f Last
 Last Position.
 
sf::Vector3f AngleVelocity
 Velocity of Rotation.
 
sf::Vector3f AngleAcceleration
 Acceleration of Rotation.
 
sf::Vector3f AngleDrag
 Drag of Rotation.
 
sf::Vector3f AngleMax
 Max Velocity of Rotation.
 
bool Moves = true
 If true, position and rotation transforms will be updated.
 
sf::Vector3f Velocity
 Velocity of Movement.
 
sf::Vector3f Acceleration
 Acceleration of Movement.
 
sf::Vector3f Drag
 Drag of Movement.
 
sf::Vector3f MaxVelocity
 Max Velocity of Movement.
 
float Health = 100
 Standard health value (object dies if health is <= 0)
 
float Radius
 Radius from the centre of the object as a sphere.
 
sf::Vector3f Origin
 Centre of the 3D object, useful for collisions.
 
- Public Attributes inherited from VBase
bool active = true
 Base can be updated using Update if true.
 
bool visible = true
 Base can be rendered using Draw if true.
 
bool alive = true
 Helper member that is mainly used filter out behaviours to objects which aren't alive in the scene.
 
bool exists = true
 Base can be updated and rendered if true, else it would no longer be treated as being part of the scene.
 
VType type = NONE
 Base object type, typically set in the constructor of an inherited object to specify what type it is.
 
uint32_t RefCount = 0
 Counts the amount of times the object is referenced in groups, ensures an object is only destroyed when no longer part of a single group.
 

Static Public Attributes

static unsigned int DefaultTexture
 A generated 1x1 White texture. If no texture is loaded, then this will be used.
 

Protected Member Functions

virtual void updateTransform () override
 Update the tranform.
 
- Protected Member Functions inherited from V3DObject
virtual void updateMotion (float dt)
 

Protected Attributes

unsigned int vao
 Vertex Array Object ID.
 
unsigned int vertexVBO
 Vertex Buffer Object for Vertices.
 
unsigned int indexVBO
 Vertex Buffer Object for Indices.
 
unsigned int drawCount
 Depending on input, the amount of vertices or indices that are needed to be drawn for this object.
 
sf::Texture texture
 Single texture for this model.
 
glm::mat4 transform
 Model Matrix.
 
- Protected Attributes inherited from V3DObject
sf::Vector3f minimum
 Minimum size of the object bounding box.
 
sf::Vector3f maximum
 Maximum size of the object bounding box.
 

Detailed Description

Basic 3D Model with a single texture.

Constructor & Destructor Documentation

◆ V3DModel() [1/2]

V3DModel::V3DModel ( sf::Vector3f  position,
sf::Vector3f  rotation,
sf::Vector3f  scale 
)
Parameters
positionPosition of the sprite.
rotationAngle of the object.
scaleScale of the object.

◆ V3DModel() [2/2]

V3DModel::V3DModel ( float  posX = 0,
float  posY = 0,
float  posZ = 0,
float  rotX = 0,
float  rotY = 0,
float  rotZ = 0,
float  scaleX = 1,
float  scaleY = 1,
float  scaleZ = 1 
)
Parameters
posXX position of the object.
posYY position of the object.
posZZ position of the object.
rotXX angle of the object.
rotYY angle of the object.
rotZZ angle of the object.
scaleXX scale of the object.
scaleYY scale of the object.
scaleZZ scale of the object.

Member Function Documentation

◆ Draw()

virtual void V3DModel::Draw ( sf::RenderTarget &  RenderTarget)
overridevirtual

Draws 3D object.

Parameters
RenderTargetThe game's sf::RenderTarget object to render data onto.

Reimplemented from V3DObject.

◆ LoadModelData()

bool V3DModel::LoadModelData ( const V3DVertexArray vertexArray,
const std::vector< unsigned int > &  indexArray = std::vector< unsigned int >() 
)

Loads the model from arrays.

Parameters
vertexArrayThe list of vertices to load into the model.
indexArrayThe list of indices to load for the model. If model only has vertex data then this is ignored for loading and rendering the model.

◆ LoadTexture() [1/2]

bool V3DModel::LoadTexture ( const sf::String &  filename)

Loads a texture for the 3D model. If no texture is loaded than the default texture is used.

Parameters
filenameThe file path and name of the texture file.

◆ LoadTexture() [2/2]

bool V3DModel::LoadTexture ( const sf::Texture &  tex)

Loads a texture for the 3D model. If no texture is loaded than the default texture is used.

Parameters
texThe sf::Texture object that is being used as the texture.

◆ UpdateShader()

virtual void V3DModel::UpdateShader ( V3DShader shader,
V3DCamera camera 
)
overridevirtual

Updates the shader with the current camera and object specific values.

Parameters
shaderThe scene shader.
cameraThe scene camera.

Reimplemented from V3DObject.


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