Exemple #1
0
BRDFMaterial::BRDFMaterial(const BRDFMaterial& other) :
    Material(other), IBRDFMaterial(), baseColor(other.baseColor), metallic(other.metallic), specular(other.specular), roughness(other.roughness)
{
    // Textures cannot be cloned, just replaced.

    //

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_BASE_COLOR - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->baseColor->getSampler()->getSampler(), this->baseColor->getImageView()->getImageView(), this->baseColor->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_METALLIC - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->metallic->getSampler()->getSampler(), this->metallic->getImageView()->getImageView(), this->metallic->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_SPECULAR - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->specular->getSampler()->getSampler(), this->specular->getImageView()->getImageView(), this->specular->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_ROUGHNESS - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->roughness->getSampler()->getSampler(), this->roughness->getImageView()->getImageView(), this->roughness->getImage()->getImageLayout());
}
Exemple #2
0
void PhongMaterial::setSpecularShininess(const ITextureSP& specularShininess)
{
    this->specularShininess = specularShininess;

    if (this->specularShininess.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_SPECULAR_SHININESS - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->specularShininess->getSampler()->getSampler(), this->specularShininess->getImageView()->getImageView(), this->specularShininess->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #3
0
void PhongMaterial::setDiffuse(const ITextureSP& diffuse)
{
    this->diffuse = diffuse;

    if (this->diffuse.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_DIFFUSE - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->diffuse->getSampler()->getSampler(), this->diffuse->getImageView()->getImageView(), this->diffuse->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #4
0
void PhongMaterial::setAmbient(const ITextureSP& ambient)
{
    this->ambient = ambient;

    if (this->ambient.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_AMBIENT - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->ambient->getSampler()->getSampler(), this->ambient->getImageView()->getImageView(), this->ambient->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #5
0
void PhongMaterial::setEmissive(const ITextureSP& emissive)
{
    this->emissive = emissive;

    if (this->emissive.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->emissive->getSampler()->getSampler(), this->emissive->getImageView()->getImageView(), this->emissive->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #6
0
void PhongMaterial::setNormal(const ITextureSP& normal)
{
    this->normal = normal;

    if (this->normal.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_NORMAL - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->normal->getSampler()->getSampler(), this->normal->getImageView()->getImageView(), this->normal->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #7
0
void PhongMaterial::setDisplacement(const ITextureSP& displacement)
{
    this->displacement = displacement;

    if (this->displacement.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_DISPLACEMENT - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->displacement->getSampler()->getSampler(), this->displacement->getImageView()->getImageView(), this->displacement->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #8
0
void PhongMaterial::setAlpha(const ITextureSP& alpha)
{
    this->alpha = alpha;

    if (this->alpha.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_ALPHA - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->alpha->getSampler()->getSampler(), this->alpha->getImageView()->getImageView(), this->alpha->getMemoryImage()->getImage()->getImageLayout());
    }
}
Exemple #9
0
void BRDFMaterial::setRoughness(const ITextureSP& roughness)
{
    this->roughness = roughness;

    if (this->roughness.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_ROUGHNESS - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->roughness->getSampler()->getSampler(), this->roughness->getImageView()->getImageView(), this->roughness->getImage()->getImageLayout());
    }
}
Exemple #10
0
void BRDFMaterial::setSpecular(const ITextureSP& specular)
{
    this->specular = specular;

    if (this->specular.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_SPECULAR - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->specular->getSampler()->getSampler(), this->specular->getImageView()->getImageView(), this->specular->getImage()->getImageLayout());
    }
}
Exemple #11
0
void BRDFMaterial::setMetallic(const ITextureSP& metallic)
{
    this->metallic = metallic;

    if (this->metallic.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_METALLIC - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->metallic->getSampler()->getSampler(), this->metallic->getImageView()->getImageView(), this->metallic->getImage()->getImageLayout());
    }
}
Exemple #12
0
void BRDFMaterial::setBaseColor(const ITextureSP& baseColor)
{
    this->baseColor = baseColor;

    if (this->baseColor.get())
    {
        updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_BRDF_BASE_COLOR - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->baseColor->getSampler()->getSampler(), this->baseColor->getImageView()->getImageView(), this->baseColor->getImage()->getImageLayout());
    }
}
Exemple #13
0
PhongMaterial::PhongMaterial(const PhongMaterial& other) :
    IPhongMaterial(), name(other.name), alpha(other.alpha), displacement(other.displacement), normal(other.normal), ambient(other.ambient), emissive(other.emissive), diffuse(other.diffuse), specular(other.specular), specularShininess(other.specularShininess), transparent(other.transparent), descriptorPool(), descriptorSets(), nodeName(), allDescriptorPools(), allDescriptorSets()
{
    // Textures cannot be cloned, just replaced.

    descriptorPool = descriptorPoolCreate(other.descriptorPool->getDevice(), other.descriptorPool->getFlags(), other.descriptorPool->getMaxSets(), other.descriptorPool->getPoolSizeCount(), other.descriptorPool->getPoolSizes());

    if (!descriptorPool.get())
    {
        destroy();

        return;
    }

    descriptorSets = descriptorSetsCreate(descriptorPool->getDevice(), descriptorPool->getDescriptorPool(), other.descriptorSets->getDescriptorSetCount(), other.descriptorSets->getSetLayouts());

    if (!descriptorSets.get())
    {
    	destroy();

        return;
    }

    //

    if (other.allDescriptorPools.size() != other.allDescriptorSets.size())
    {
    	destroy();

        return;
    }


    for (size_t i = 0; i < other.allDescriptorPools.size(); i++)
    {
    	auto currentDescriptorPool = descriptorPoolCreate(other.allDescriptorPools.valueAt(i)->getDevice(), other.allDescriptorPools.valueAt(i)->getFlags(), other.allDescriptorPools.valueAt(i)->getMaxSets(), other.allDescriptorPools.valueAt(i)->getPoolSizeCount(), other.allDescriptorPools.valueAt(i)->getPoolSizes());

        if (!currentDescriptorPool.get())
        {
        	destroy();

            return;
        }

        allDescriptorPools[other.allDescriptorPools.keyAt(i)] = currentDescriptorPool;

        //

        auto currentDescriptorSets = descriptorSetsCreate(currentDescriptorPool->getDevice(), currentDescriptorPool->getDescriptorPool(), other.allDescriptorSets.valueAt(i)->getDescriptorSetCount(), other.allDescriptorSets.valueAt(i)->getSetLayouts());

        if (!currentDescriptorSets.get())
        {
        	destroy();

            return;
        }

        allDescriptorSets[other.allDescriptorSets.keyAt(i)] = currentDescriptorSets;
    }

    //

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->emissive->getSampler()->getSampler(), this->emissive->getImageView()->getImageView(), this->emissive->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_ALPHA - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->alpha->getSampler()->getSampler(), this->alpha->getImageView()->getImageView(), this->alpha->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_DISPLACEMENT - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->displacement->getSampler()->getSampler(), this->displacement->getImageView()->getImageView(), this->displacement->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_NORMAL - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->normal->getSampler()->getSampler(), this->normal->getImageView()->getImageView(), this->normal->getMemoryImage()->getImage()->getImageLayout());

    //

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_AMBIENT - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->ambient->getSampler()->getSampler(), this->ambient->getImageView()->getImageView(), this->ambient->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_DIFFUSE - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->diffuse->getSampler()->getSampler(), this->diffuse->getImageView()->getImageView(), this->diffuse->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_SPECULAR - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->specular->getSampler()->getSampler(), this->specular->getImageView()->getImageView(), this->specular->getMemoryImage()->getImage()->getImageLayout());

    updateDescriptorImageInfo(VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_PHONG_SPECULAR_SHININESS - VKTS_BINDING_UNIFORM_SAMPLER_FRAGMENT_EMISSIVE, this->specularShininess->getSampler()->getSampler(), this->specularShininess->getImageView()->getImageView(), this->specularShininess->getMemoryImage()->getImage()->getImageLayout());
}