CSEngine
Loading...
Searching...
No Matches
CSE::Vertex Class Reference

Public Member Functions

 Vertex (int index, vec3 position, VertexSkinData *weightsData=nullptr)
 
int getIndex ()
 
float getLength ()
 
bool isSet ()
 
bool hasSameTextureAndNormal (int textureIndexOther, int normalIndexOther)
 
void setTextureIndex (int textureIndex)
 
void setNormalIndex (int normalIndex)
 
vec3 getPosition ()
 
int getTextureIndex ()
 
int getNormalIndex ()
 
VertexgetDuplicateVertex ()
 
void setDuplicateVertex (Vertex *duplicateVertex)
 
VertexSkinDatagetWeightsData () const
 
void addTangent (vec3 tangent)
 
void averageTangents ()
 
const vec3getAvgTangent () const
 

Detailed Description

Definition at line 10 of file Vertex.h.

Constructor & Destructor Documentation

◆ Vertex()

CSE::Vertex::Vertex ( int  index,
vec3  position,
VertexSkinData weightsData = nullptr 
)
inline

Definition at line 12 of file Vertex.h.

12 {
13 m_index = index;
14 m_position = position;
15 m_weightsData = weightsData;
16 // std::cout << "index = " << index << '\n';
17 }

◆ ~Vertex()

CSE::Vertex::~Vertex ( )
inline

Definition at line 19 of file Vertex.h.

19 {
20
21 }

Member Function Documentation

◆ addTangent()

void CSE::Vertex::addTangent ( vec3  tangent)
inline

Definition at line 71 of file Vertex.h.

71 {
72 m_tangents.push_back(tangent);
73 }

◆ averageTangents()

void CSE::Vertex::averageTangents ( )
inline

Definition at line 75 of file Vertex.h.

75 {
76 if (m_tangents.empty()) {
77 return;
78 }
79 for (vec3 tangent : m_tangents) {
80 m_avgTangent += tangent;
81 }
82 m_avgTangent.Normalize();
83 }

◆ getAvgTangent()

const vec3 & CSE::Vertex::getAvgTangent ( ) const
inline

Definition at line 85 of file Vertex.h.

85 {
86 return m_avgTangent;
87 }

◆ getDuplicateVertex()

Vertex * CSE::Vertex::getDuplicateVertex ( )
inline

Definition at line 59 of file Vertex.h.

59 {
60 return m_duplicateVertex;
61 }

◆ getIndex()

int CSE::Vertex::getIndex ( )
inline

Definition at line 23 of file Vertex.h.

23 {
24 return m_index;
25 }

◆ getLength()

float CSE::Vertex::getLength ( )
inline

Definition at line 27 of file Vertex.h.

27 {
28 return m_length;
29 }

◆ getNormalIndex()

int CSE::Vertex::getNormalIndex ( )
inline

Definition at line 55 of file Vertex.h.

55 {
56 return m_normalIndex;
57 }

◆ getPosition()

vec3 CSE::Vertex::getPosition ( )
inline

Definition at line 47 of file Vertex.h.

47 {
48 return m_position;
49 }

◆ getTextureIndex()

int CSE::Vertex::getTextureIndex ( )
inline

Definition at line 51 of file Vertex.h.

51 {
52 return m_textureIndex;
53 }

◆ getWeightsData()

VertexSkinData * CSE::Vertex::getWeightsData ( ) const
inline

Definition at line 67 of file Vertex.h.

67 {
68 return m_weightsData;
69 }

◆ hasSameTextureAndNormal()

bool CSE::Vertex::hasSameTextureAndNormal ( int  textureIndexOther,
int  normalIndexOther 
)
inline

Definition at line 35 of file Vertex.h.

35 {
36 return textureIndexOther == m_textureIndex && normalIndexOther == m_normalIndex;
37 }

◆ isSet()

bool CSE::Vertex::isSet ( )
inline

Definition at line 31 of file Vertex.h.

31 {
32 return m_textureIndex != -1 && m_normalIndex != -1;
33 }

◆ setDuplicateVertex()

void CSE::Vertex::setDuplicateVertex ( Vertex duplicateVertex)
inline

Definition at line 63 of file Vertex.h.

63 {
64 m_duplicateVertex = duplicateVertex;
65 }

◆ setNormalIndex()

void CSE::Vertex::setNormalIndex ( int  normalIndex)
inline

Definition at line 43 of file Vertex.h.

43 {
44 m_normalIndex = normalIndex;
45 }

◆ setTextureIndex()

void CSE::Vertex::setTextureIndex ( int  textureIndex)
inline

Definition at line 39 of file Vertex.h.

39 {
40 m_textureIndex = textureIndex;
41 }

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