diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-15 19:17:49 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-07-15 19:17:49 +0200 |
commit | 54f4da87923465a5387e2e854b58616647deb7af (patch) | |
tree | fc52b1866b29393be7d61a2341f04d430c078fdd /src/graphics/common/vertex.h | |
parent | eca6d26459200d2956d64ccf8a2713d96a82c989 (diff) | |
download | colobot-54f4da87923465a5387e2e854b58616647deb7af.tar.gz colobot-54f4da87923465a5387e2e854b58616647deb7af.tar.bz2 colobot-54f4da87923465a5387e2e854b58616647deb7af.zip |
Fix in model loading; simple model viewer
- fixed model loading code
- added simple model viewer (model_test) in src/graphics/opengl/test
- added system time stamp code
- split the code in app/system modules to separate headers
- added debug messages in model loading
- minor fixes in OpenGL engine
Diffstat (limited to 'src/graphics/common/vertex.h')
-rw-r--r-- | src/graphics/common/vertex.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/graphics/common/vertex.h b/src/graphics/common/vertex.h index c6375b9..0a74587 100644 --- a/src/graphics/common/vertex.h +++ b/src/graphics/common/vertex.h @@ -23,6 +23,8 @@ #include "math/vector.h" #include "math/point.h" +#include <sstream> + namespace Gfx { /** @@ -46,6 +48,17 @@ struct Vertex Math::Vector aNormal = Math::Vector(), Math::Point aTexCoord = Math::Point()) : coord(aCoord), normal(aNormal), texCoord(aTexCoord) {} + + + //! Returns a string "(c: [...], n: [...], tc: [...])" + inline std::string ToString() const + { + std::stringstream s; + s.precision(3); + s << "(c: " << coord.ToString() << ", n: " << normal.ToString() + << ", tc: " << texCoord.ToString() << ")"; + return s.str(); + } }; /** @@ -72,6 +85,16 @@ struct VertexCol Gfx::Color aSpecular = Gfx::Color(), Math::Point aTexCoord = Math::Point()) : coord(aCoord), color(aColor), specular(aSpecular), texCoord(aTexCoord) {} + + //! Returns a string "(c: [...], col: [...], sp: [...], tc: [...])" + inline std::string ToString() const + { + std::stringstream s; + s.precision(3); + s << "(c: " << coord.ToString() << ", col: " << color.ToString() << ", sp: " + << specular.ToString() << ", tc: " << texCoord.ToString() << ")"; + return s.str(); + } }; @@ -95,6 +118,7 @@ struct VertexTex2 Math::Point aTexCoord2 = Math::Point()) : coord(aCoord), normal(aNormal), texCoord(aTexCoord), texCoord2(aTexCoord2) {} + //! Sets the fields from Gfx::Vertex with texCoord2 = (0,0) void FromVertex(const Gfx::Vertex &v) { coord = v.coord; @@ -102,6 +126,16 @@ struct VertexTex2 texCoord = v.texCoord; texCoord2 = Math::Point(); } + + //! Returns a string "(c: [...], n: [...], tc: [...], tc2: [...])" + inline std::string ToString() const + { + std::stringstream s; + s.precision(3); + s << "(c: " << coord.ToString() << ", n: " << normal.ToString() + << ", tc: " << texCoord.ToString() << ", tc2: " << texCoord2.ToString() << ")"; + return s.str(); + } }; }; // namespace Gfx |