예제 #1
0
파일: material.cpp 프로젝트: koeleck/grapro
bool Material::isCompatible(const Material& other) const
{
    if (this == &other)
        return true;

    // compatible, if using the same textures, or one uses textures and the
    // other doesn't, or both don't use any textures at all
    if (hasDiffuseTexture() && other.hasDiffuseTexture()) {
        if (getDiffuseTexture() != other.getDiffuseTexture())
            return false;
    }
    if (hasSpecularTexture() && other.hasSpecularTexture()) {
        if (getSpecularTexture() != other.getSpecularTexture())
            return false;
    }
    if (hasEmissiveTexture() && other.hasEmissiveTexture()) {
        if (getEmissiveTexture() != other.getEmissiveTexture())
            return false;

    }
    if (hasGlossyTexture() && other.hasGlossyTexture()) {
        if (getGlossyTexture() != other.getGlossyTexture())
            return false;
    }
    if (hasAlphaTexture() && other.hasAlphaTexture()) {
        if (getAlphaTexture() != other.getAlphaTexture())
            return false;
    }
    if (hasNormalTexture() && other.hasNormalTexture()) {
        if (getNormalTexture() != other.getNormalTexture())
            return false;
    }
    if (hasAmbientTexture() && other.hasAmbientTexture()) {
        if (getAmbientTexture() != other.getAmbientTexture())
            return false;
    }

    return true;
}
예제 #2
0
	std::vector<const Image *> Material::getTextures() const
	{
		std::vector<const Image *> textures = {getDiffuseTexture(), getNormalTexture()};

		return textures;
	}