summaryrefslogtreecommitdiffstats
path: root/src/Data/Triangle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Triangle.h')
-rw-r--r--src/Data/Triangle.h42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/Data/Triangle.h b/src/Data/Triangle.h
index e3e6130..0c17834 100644
--- a/src/Data/Triangle.h
+++ b/src/Data/Triangle.h
@@ -22,66 +22,50 @@
#include "Vertex.h"
#include "TexCoords.h"
+#include <libxml++/nodes/element.h>
namespace ZoomEdit {
namespace Data {
class Triangle {
private:
+ xmlpp::Element *triangleNode;
+ xmlpp::Element *vertexNodes[3];
+ xmlpp::Element *normalNodes[3];
+ xmlpp::Element *texCoordsNodes[3];
+ xmlpp::Attribute *visibleNode;
+
Vertex vertices[3];
Vector normals[3];
TexCoords texCoords[3];
bool visible;
- public:
- Triangle(bool vis = true) : visible(vis) {}
-
- Triangle(Vertex v0, Vertex v1, Vertex v2, bool vis = true) : visible(vis) {
- vertices[0] = v0; vertices[1] = v1; vertices[2] = v2;
- }
-
- Triangle(Vertex v[3], bool vis = true) : visible(vis) {
- vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2];
- }
-
- Triangle(Vertex v[3], Vector n[3], bool vis = true) : visible(vis) {
- vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2];
- normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2];
- }
-
- Triangle(Vertex v[3], TexCoords t[3], bool vis = true) : visible(vis) {
- vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2];
- texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2];
- }
+ Vertex loadVertex(xmlpp::Element *node) const;
+ Vector loadVector(xmlpp::Element *node) const;
+ TexCoords loadTexCoords(xmlpp::Element *node) const;
- Triangle(Vertex v[3], Vector n[3], TexCoords t[3], bool vis = true) : visible(vis) {
- vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2];
- normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2];
- texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2];
- }
+ public:
+ Triangle(xmlpp::Element *node);
- Vertex& getVertex(unsigned int i) {return vertices[i%3];}
const Vertex& getVertex(unsigned int i) const {return vertices[i%3];}
void setVertex(unsigned int i, Vertex v) {vertices[i%3] = v;}
void setVertices(Vertex v[3]) {
vertices[0] = v[0]; vertices[1] = v[1]; vertices[2] = v[2];
}
- Vector& getNormal(unsigned int i) {return normals[i%3];}
const Vector& getNormal(unsigned int i) const {return normals[i%3];}
void setNormal(unsigned int i, Vector n) {normals[i%3] = n;}
void setNormals(Vector n[3]) {
normals[0] = n[0]; normals[1] = n[1]; normals[2] = n[2];
}
- TexCoords& getTexCoords(unsigned int i) {return texCoords[i%3];}
const TexCoords& getTexCoords(unsigned int i) const {return texCoords[i%3];}
void getTexCoords(unsigned int i, TexCoords t) {texCoords[i%3] = t;}
void getTexCoords(TexCoords t[3]) {
texCoords[0] = t[0]; texCoords[1] = t[1]; texCoords[2] = t[2];
}
- bool isVisible() {return visible;}
+ bool isVisible() const {return visible;}
void setVisible(bool vis) {visible = vis;}
};