some refactoring needed by the editor
This commit is contained in:
parent
6499ffd9dd
commit
b9dc55d0cf
@ -9,11 +9,12 @@ class Texture;
|
|||||||
|
|
||||||
class PhongMaterial : public Material
|
class PhongMaterial : public Material
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
glm::vec3 kd;
|
glm::vec3 kd;
|
||||||
glm::vec3 ks;
|
glm::vec3 ks;
|
||||||
float ns;
|
float ns;
|
||||||
Texture* tex;
|
Texture* tex;
|
||||||
public:
|
|
||||||
PhongMaterial() : kd(0.5f), ks(0.5f), ns(10), tex(NULL)
|
PhongMaterial() : kd(0.5f), ks(0.5f), ns(10), tex(NULL)
|
||||||
{
|
{
|
||||||
shader = ResourceBase::getShader("phong");
|
shader = ResourceBase::getShader("phong");
|
||||||
|
@ -20,6 +20,11 @@ void PhongModule::addEntity(PhongEntity* myEntity)
|
|||||||
entities.push_back(myEntity);
|
entities.push_back(myEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhongModule::clearEntities()
|
||||||
|
{
|
||||||
|
entities.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void PhongModule::renderGL(Camera* myCamera)
|
void PhongModule::renderGL(Camera* myCamera)
|
||||||
{
|
{
|
||||||
shader->bind();
|
shader->bind();
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
PhongModule(Lights::Light* myDirLight, Lights* myPointLights);
|
PhongModule(Lights::Light* myDirLight, Lights* myPointLights);
|
||||||
|
|
||||||
void addEntity(PhongEntity* myEntity);
|
void addEntity(PhongEntity* myEntity);
|
||||||
|
void clearEntities();
|
||||||
|
|
||||||
void virtual renderGL(Camera* myCamera);
|
void virtual renderGL(Camera* myCamera);
|
||||||
};
|
};
|
||||||
|
@ -68,3 +68,13 @@ Lights* ResourceBase::getLights(const std::string &lightsName)
|
|||||||
return lights.get(lightsName);
|
return lights.get(lightsName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string ResourceBase::getMaterialName(Material* myMat)
|
||||||
|
{
|
||||||
|
return materials.getName(myMat);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ResourceBase::getTextureName(Texture* myTex)
|
||||||
|
{
|
||||||
|
return textures.getName(myTex);
|
||||||
|
}
|
||||||
|
@ -32,6 +32,9 @@ public:
|
|||||||
static PhongEntity* getEntity(const std::string &entityName);
|
static PhongEntity* getEntity(const std::string &entityName);
|
||||||
static Lights* getLights(const std::string &lightsName);
|
static Lights* getLights(const std::string &lightsName);
|
||||||
|
|
||||||
|
static std::string getMaterialName(Material* myMat);
|
||||||
|
static std::string getTextureName(Texture* myTex);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class DataBase
|
class DataBase
|
||||||
@ -56,6 +59,16 @@ protected:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getName(T* ptr)
|
||||||
|
{
|
||||||
|
for(const std::string &n : names)
|
||||||
|
{
|
||||||
|
if(ptr == get(n))
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static DataBase<Texture> textures;
|
static DataBase<Texture> textures;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user