diff options
Diffstat (limited to 'Build/source/utils/asymptote/material.h')
-rw-r--r-- | Build/source/utils/asymptote/material.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/Build/source/utils/asymptote/material.h b/Build/source/utils/asymptote/material.h index 8ae0c067b45..4a07229046c 100644 --- a/Build/source/utils/asymptote/material.h +++ b/Build/source/utils/asymptote/material.h @@ -16,47 +16,44 @@ inline bool operator < (const glm::vec4& m1, const glm::vec4& m2) { (m1[3] < m2[3])))))); } +inline glm::vec4 GLparameters(GLfloat shininess, GLfloat metallic, + GLfloat fresnel0) { + return glm::vec4(shininess,metallic,fresnel0,0.0); +} + struct Material { public: - glm::vec4 diffuse, ambient, emissive, specular; - GLfloat shininess; - GLfloat padding[3]; - + glm::vec4 diffuse,emissive,specular; + glm::vec4 parameters; Material() {} - Material(const glm::vec4& diffuse, const glm::vec4& ambient, - const glm::vec4& emissive, const glm::vec4& specular, - double shininess) : - diffuse(diffuse), ambient(ambient), emissive(emissive), specular(specular), - shininess(128*shininess) {} + Material(const glm::vec4& diffuse, const glm::vec4& emissive, + const glm::vec4& specular, double shininess, double metallic, double fresnel0) : + diffuse(diffuse), emissive(emissive), specular(specular), + parameters(GLparameters(shininess,metallic,fresnel0)) {} Material(Material const& m): - diffuse(m.diffuse), ambient(m.ambient), emissive(m.emissive), - specular(m.specular), shininess(m.shininess) {} + diffuse(m.diffuse), emissive(m.emissive), + specular(m.specular), parameters(m.parameters) {} ~Material() {} Material& operator=(Material const& m) { diffuse=m.diffuse; - ambient=m.ambient; emissive=m.emissive; specular=m.specular; - shininess=m.shininess; + parameters=m.parameters; return *this; } - friend bool operator < (const Material& m1, const Material& m2) { return m1.diffuse < m2.diffuse || (m1.diffuse == m2.diffuse && - (m1.ambient < m2.ambient || - (m1.ambient == m2.ambient && (m1.emissive < m2.emissive || (m1.emissive == m2.emissive && (m1.specular < m2.specular || (m1.specular == m2.specular && - (m1.shininess < m2.shininess)))))))); + (m1.parameters < m2.parameters)))))); } - }; extern size_t Nmaterials; // Number of materials compiled in shader |