modelloader, colorprint
This commit is contained in:
		
							parent
							
								
									a853e102eb
								
							
						
					
					
						commit
						06b187e8a1
					
				|  | @ -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); | ||||
|  |  | |||
|  | @ -3,6 +3,8 @@ | |||
| 
 | ||||
| #include <SDL.h> | ||||
| #include <SDL_opengl.h> | ||||
| #include <iostream> | ||||
| #include <string> | ||||
| 
 | ||||
| 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); | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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<polygon.size(); i++) { | ||||
| // 			std::cout << "whee nr " <<i << std::endl;
 | ||||
| // 			polygon[i].print();
 | ||||
| // 			std::cout << "Stat: " << polygon.size() << " " << vertex.size() << " " << mapcoord.size() << " " << normal.size() << std::endl;
 | ||||
| // 			glNormal3f(normal.at(    (unsigned short)polygon[i].x));
 | ||||
| // 			glColor3f(mat.diffuse.r, mat.diffuse.g, mat.diffuse.b);
 | ||||
| 			glColorGLC(mat.ambient); | ||||
| // 			std::cout << mat.ambient.r << ", " << mat.ambient.g << ", " << mat.ambient.b << std::endl;
 | ||||
| 
 | ||||
| 			glColorGLC(mat.diffuse); | ||||
| 			 | ||||
| 
 | ||||
| 			glNormal3f(normal.at(i)); | ||||
| 				 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 seba
						seba