From 06b187e8a11e79bbd4a34ffa2873d8f73d359010 Mon Sep 17 00:00:00 2001 From: seba Date: Mon, 14 Apr 2008 23:37:15 +0200 Subject: [PATCH] modelloader, colorprint --- glcolor.cpp | 4 ++++ glcolor.h | 3 +++ models/load3ds.cpp | 2 +- models/model.cpp | 18 ++++++++++-------- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/glcolor.cpp b/glcolor.cpp index c1c834d..f19ab5b 100644 --- a/glcolor.cpp +++ b/glcolor.cpp @@ -22,6 +22,10 @@ SDL_Color GLColor::getSDLColor() { return c; } +void GLColor::print(std::string m) { + std::cout << m << " Color: " << r << ", " << g << ", " << b << std::endl; +} + void glColorGLC(GLColor c) { if(c.setalpha) { glColor4f(c.r, c.g, c.b, c.a); diff --git a/glcolor.h b/glcolor.h index 145de9a..27c256d 100644 --- a/glcolor.h +++ b/glcolor.h @@ -3,6 +3,8 @@ #include #include +#include +#include class GLColor { public: @@ -15,6 +17,7 @@ class GLColor { void set(float _r, float _g, float _b, float _a=1.0f); SDL_Color getSDLColor(); + void print(std::string m=""); }; void glColorGLC(GLColor c); diff --git a/models/load3ds.cpp b/models/load3ds.cpp index 08aa5bf..9895d35 100644 --- a/models/load3ds.cpp +++ b/models/load3ds.cpp @@ -191,7 +191,7 @@ bool Load3ds::parse(Model *m) { if(modelloaded) { modobj.calcNormales(); - modobj.mat = m->findMaterial(modobj.getName()); +// modobj.mat = m->findMaterial(modobj.getName()); m->addObject(modobj); } std::cout << "Ende Load" << std::endl; diff --git a/models/model.cpp b/models/model.cpp index 6027cab..18bfb55 100644 --- a/models/model.cpp +++ b/models/model.cpp @@ -28,15 +28,17 @@ void ModelObject::calcNormales() { void ModelObject::render() { // std::cout << "render " << name << " mit " << polygon.size()<< std::endl; // std::cout << "Vertex: " << vertex.size() << std::endl; - glBegin(GL_TRIANGLES); + + if(mat.name[0]=='g') { + std::cout << "Render NOT: " << name << std::endl; + return; + } + mat.diffuse.print(mat.name); + glBegin(GL_LINES); for(unsigned int i=0; i