fixed compile errors

This commit is contained in:
gered 2011-06-07 11:43:06 -04:00
parent a95136f7b9
commit 772717f91c
4 changed files with 11 additions and 5 deletions

View file

@ -14,6 +14,7 @@ class Material
{ {
public: public:
std::string name; std::string name;
std::string textureFile;
Color ambient; Color ambient;
Color diffuse; Color diffuse;
Color specular; Color specular;

View file

@ -1,6 +1,8 @@
#include "md2.h" #include "md2.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../chunks/chunks.h" #include "../chunks/chunks.h"
Md2::Md2() Md2::Md2()

View file

@ -1,6 +1,8 @@
#include "ms3d.h" #include "ms3d.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../util/files.h" #include "../util/files.h"

View file

@ -1,6 +1,7 @@
#include "obj.h" #include "obj.h"
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
@ -386,7 +387,7 @@ bool Obj::LoadMaterialLibrary(const std::string &file, const std::string &textur
{ {
//ASSERT(currentMaterial >= 0); //ASSERT(currentMaterial >= 0);
sscanf(line.c_str(), "Ka %f %f %f", &r, &g, &b); sscanf(line.c_str(), "Ka %f %f %f", &r, &g, &b);
m_materials[currentMaterial].material->SetAmbient(RGB_24_f(r, g, b)); m_materials[currentMaterial].material->ambient = Color::FromInt(RGB_24_f(r, g, b));
} }
// Diffuse color // Diffuse color
@ -394,7 +395,7 @@ bool Obj::LoadMaterialLibrary(const std::string &file, const std::string &textur
{ {
//ASSERT(currentMaterial >= 0); //ASSERT(currentMaterial >= 0);
sscanf(line.c_str(), "Kd %f %f %f", &r, &g, &b); sscanf(line.c_str(), "Kd %f %f %f", &r, &g, &b);
m_materials[currentMaterial].material->SetDiffuse(RGB_24_f(r, g, b)); m_materials[currentMaterial].material->diffuse = Color::FromInt(RGB_24_f(r, g, b));
} }
// Specular color // Specular color
@ -402,7 +403,7 @@ bool Obj::LoadMaterialLibrary(const std::string &file, const std::string &textur
{ {
//ASSERT(currentMaterial >= 0); //ASSERT(currentMaterial >= 0);
sscanf(line.c_str(), "Ks %f %f %f", &r, &g, &b); sscanf(line.c_str(), "Ks %f %f %f", &r, &g, &b);
m_materials[currentMaterial].material->SetSpecular(RGB_24_f(r, g, b)); m_materials[currentMaterial].material->specular = Color::FromInt(RGB_24_f(r, g, b));
} }
// Alpha value // Alpha value
@ -427,7 +428,7 @@ bool Obj::LoadMaterialLibrary(const std::string &file, const std::string &textur
else if (op == "map_Ka" || op == "map_Kd") else if (op == "map_Ka" || op == "map_Kd")
{ {
//ASSERT(currentMaterial >= 0); //ASSERT(currentMaterial >= 0);
m_materials[currentMaterial].material->SetTexture(texturePath + line.substr(op.length() + 1)); m_materials[currentMaterial].material->textureFile = texturePath + line.substr(op.length() + 1);
} }
} }