Walls And Holes  1
SimpleTexturedObject Class Reference

The SimpleTexturedObject class represents an object with Phong lighting information and a single texture. More...

#include <simpletexturedobject.h>

Inheritance diagram for SimpleTexturedObject:
Collaboration diagram for SimpleTexturedObject:

Public Types

using Triangle = Triplet< unsigned int, unsigned int, unsigned int >
 
using TriangleTexCoords = Triplet< QVector2D, QVector2D, QVector2D >
 

Signals

void objectUpdated ()
 Emitted when the object is updated. It is assumed that isCommitted() is true. More...
 

Public Member Functions

 SimpleTexturedObject ()
 Creates an empty object. Use the setter methods below to set up data, and then call commit() when done. More...
 
virtual ~SimpleTexturedObject ()
 
void commit ()
 Call this method after setting all of the object's information. This will commit the information and allow it to be rendered. More...
 
void setTriangleInfo (QVector< QVector3D > positions, QVector< QVector3D > normals, QVector< Triangle > triangles)
 Sets up face information for the object. More...
 
void setMaterialInfo (float ambient, float diffuse, float specular, float shininess)
 Sets up material information for the object. Uses the same material for each vertex. More...
 
void setMaterialInfo (QVector< float > ambient, QVector< float > diffuse, QVector< float > specular, QVector< float > shininess)
 Sets up per-vertex materials for the object. More...
 
void setTextureInfo (QVector< TriangleTexCoords > texCoords, SharedImageAndSource image)
 Sets up texture information for the object. More...
 
bool isCommitted () const
 
int getNumVertices () const
 Returns the number of vertices in the vertex array. This may not be the same as the number of vertices when the object is rendered (it may be that the triangle array is unrolled). More...
 
int getNumTriangles () const
 
const QVector< QVector3D > & getVertices () const
 
const QVector< QVector3D > & getFaceNormals () const
 
const QVector< Triangle > & getTriangles () const
 
const QVector< float > & getVertexAmbient () const
 
const QVector< float > & getVertexDiffuse () const
 
const QVector< float > & getVertexSpecular () const
 
const QVector< float > & getVertexShininess () const
 
const QVector< TriangleTexCoords > & getFaceTexCoords () const
 
const QImage & getImage () const
 
float getAmbient () const
 
float getDiffuse () const
 
float getSpecular () const
 
float getShininess () const
 
QString getMaterialName () const
 
SharedImageAndSource getImageAndSource () const
 

Detailed Description

The SimpleTexturedObject class represents an object with Phong lighting information and a single texture.

Member Typedef Documentation

◆ Triangle

using SimpleTexturedObject::Triangle = Triplet<unsigned int, unsigned int, unsigned int>

◆ TriangleTexCoords

using SimpleTexturedObject::TriangleTexCoords = Triplet<QVector2D, QVector2D, QVector2D>

Constructor & Destructor Documentation

◆ SimpleTexturedObject()

SimpleTexturedObject::SimpleTexturedObject ( )

Creates an empty object. Use the setter methods below to set up data, and then call commit() when done.

◆ ~SimpleTexturedObject()

SimpleTexturedObject::~SimpleTexturedObject ( )
virtual

Member Function Documentation

◆ commit()

void SimpleTexturedObject::commit ( )

Call this method after setting all of the object's information. This will commit the information and allow it to be rendered.

Here is the call graph for this function:

◆ getAmbient()

float SimpleTexturedObject::getAmbient ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDiffuse()

float SimpleTexturedObject::getDiffuse ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFaceNormals()

const QVector< QVector3D > & SimpleTexturedObject::getFaceNormals ( ) const
Here is the call graph for this function:

◆ getFaceTexCoords()

const QVector< SimpleTexturedObject::TriangleTexCoords > & SimpleTexturedObject::getFaceTexCoords ( ) const
Here is the call graph for this function:

◆ getImage()

const QImage & SimpleTexturedObject::getImage ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getImageAndSource()

SharedImageAndSource SimpleTexturedObject::getImageAndSource ( ) const
Here is the caller graph for this function:

◆ getMaterialName()

QString SimpleTexturedObject::getMaterialName ( ) const
Here is the call graph for this function:

◆ getNumTriangles()

int SimpleTexturedObject::getNumTriangles ( ) const
Here is the caller graph for this function:

◆ getNumVertices()

int SimpleTexturedObject::getNumVertices ( ) const

Returns the number of vertices in the vertex array. This may not be the same as the number of vertices when the object is rendered (it may be that the triangle array is unrolled).

Returns
Equal to getVertices().size() if isCommitted() is true. In any case, equal to the size of the positions array last passed to setTriangleInfo().
Here is the caller graph for this function:

◆ getShininess()

float SimpleTexturedObject::getShininess ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSpecular()

float SimpleTexturedObject::getSpecular ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTriangles()

const QVector< SimpleTexturedObject::Triangle > & SimpleTexturedObject::getTriangles ( ) const
Here is the call graph for this function:

◆ getVertexAmbient()

const QVector< float > & SimpleTexturedObject::getVertexAmbient ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVertexDiffuse()

const QVector< float > & SimpleTexturedObject::getVertexDiffuse ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVertexShininess()

const QVector< float > & SimpleTexturedObject::getVertexShininess ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVertexSpecular()

const QVector< float > & SimpleTexturedObject::getVertexSpecular ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVertices()

const QVector< QVector3D > & SimpleTexturedObject::getVertices ( ) const
Here is the call graph for this function:

◆ isCommitted()

bool SimpleTexturedObject::isCommitted ( ) const
Here is the caller graph for this function:

◆ objectUpdated

void SimpleTexturedObject::objectUpdated ( )
signal

Emitted when the object is updated. It is assumed that isCommitted() is true.

Here is the caller graph for this function:

◆ setMaterialInfo() [1/2]

void SimpleTexturedObject::setMaterialInfo ( float  ambient,
float  diffuse,
float  specular,
float  shininess 
)

Sets up material information for the object. Uses the same material for each vertex.

Assumes setTriangleInfo() has been called.

Parameters
ambientThe ambient parameter.
diffuseThe diffuse parameter.
specularThe specular parameter.
shininessThe shininess parameter.
Here is the call graph for this function:

◆ setMaterialInfo() [2/2]

void SimpleTexturedObject::setMaterialInfo ( QVector< float >  ambient,
QVector< float >  diffuse,
QVector< float >  specular,
QVector< float >  shininess 
)

Sets up per-vertex materials for the object.

Assumes setTriangleInfo() has been called.

Parameters
ambientThe ambient parameter.
diffuseThe diffuse parameter.
specularThe specular parameter.
shininessThe shininess parameter.
Here is the call graph for this function:

◆ setTextureInfo()

void SimpleTexturedObject::setTextureInfo ( QVector< TriangleTexCoords texCoords,
SharedImageAndSource  image 
)

Sets up texture information for the object.

Assumes setTriangleInfo() has been called.

Parameters
texCoordsTexture coordinates for each triangle.
imageThe image (texture) for the object.
Here is the call graph for this function:

◆ setTriangleInfo()

void SimpleTexturedObject::setTriangleInfo ( QVector< QVector3D >  positions,
QVector< QVector3D >  normals,
QVector< Triangle triangles 
)

Sets up face information for the object.

Parameters
positionsA list of vertex positions.
normalsA list of face normals. Should be parallel to triangles array.
trianglesA list of triangles. Each triangle is a triplet of indices into the positions array.

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