Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Triangle.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_TRIANGLE_H 00012 #define OPENCAL_TRIANGLE_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 00017 #include <OpenCAL/Vector3.h> 00018 using OpenCAL::Utils::Vector3; 00019 #include <OpenCAL/Material.h> 00020 using OpenCAL::Utils::Material; 00021 #include <OpenCAL/Texture.h> 00022 using OpenCAL::Utils::Texture; 00023 00024 00025 namespace OpenCAL 00026 { 00027 // Forward declarations 00028 class Vertex; 00029 00033 class OPENCAL_API Triangle 00034 { 00035 protected: 00036 // Member variables 00037 Vertex *m_vertices[3]; 00038 Vector3 m_normal; 00039 bool m_normalValid; 00040 Material *m_material; 00041 00042 public: 00043 // Constructors and destructor 00044 //Triangle(); 00045 Triangle(Vertex *a, Vertex *b, Vertex *c); 00046 virtual ~Triangle(); 00047 00048 // Get functions 00049 Vertex *getVertex(unsigned int i) { return m_vertices[i]; } 00050 const Vertex *getVertex(unsigned int i) const { return m_vertices[i]; } 00051 const Vector3 &getNormal(); 00052 bool isNormalValid() const { return m_normalValid; } 00053 const Material *getMaterial() const { return m_material; } 00054 Material *getMaterial() { return m_material; } 00055 bool hasMaterial() const { return (m_material != 0); } 00056 00057 // Set functions 00058 void setMaterial(Material *material) { m_material = material; } 00059 00060 // Other functions 00061 void invalidateNormal() { m_normalValid = false; } 00062 void calculateNormal(); 00063 float getArea() const; 00064 Vector3 getMidpoint() const; 00065 }; 00066 } 00067 00068 #endif // OPENCAL_TRIANGLE_H

Generated on Sun Aug 15 19:19:23 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8