Program Listing for File Material.h

Program Listing for File Material.h#

Return to documentation for file (include/Karana/Scene/Material.h)

/*
*Copyright(c)2024-2025KaranaDynamicsPtyLtd.Allrightsreserved.
*
*NOTICETOUSER:
*
*Thissourcecodeand/ordocumentation(the"LicensedMaterials")is
*theconfidentialandproprietaryinformationofKaranaDynamicsInc.
*UseoftheseLicensedMaterialsisgovernedbythetermsandconditions
*ofaseparatesoftwarelicenseagreementbetweenKaranaDynamicsandthe
*Licensee("LicenseAgreement").Unlessexpresslypermittedunderthat
*agreement,anyreproduction,modification,distribution,ordisclosure
*oftheLicensedMaterials,inwholeorinpart,toanythirdparty
*withoutthepriorwrittenconsentofKaranaDynamicsisstrictlyprohibited.
*
*THELICENSEDMATERIALSAREPROVIDED"ASIS"WITHOUTWARRANTYOFANYKIND.
*KARANADYNAMICSDISCLAIMSALLWARRANTIES,EXPRESSORIMPLIED,INCLUDING
*BUTNOTLIMITEDTOWARRANTIESOFMERCHANTABILITY,NON-INFRINGEMENT,AND
*FITNESSFORAPARTICULARPURPOSE.
*
*INNOEVENTSHALLKARANADYNAMICSBELIABLEFORANYDAMAGESWHATSOEVER,
*INCLUDINGBUTNOTLIMITEDTOLOSSOFPROFITS,DATA,ORUSE,EVENIF
*ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,WHETHERINCONTRACT,TORT,
*OROTHERWISEARISINGOUTOFORINCONNECTIONWITHTHELICENSEDMATERIALS.
*
*U.S.GovernmentEndUsers:TheLicensedMaterialsarea"commercialitem"
*asdefinedat48C.F.R.2.101,andareprovidedtotheU.S.Government
*onlyasacommercialenditemunderthetermsofthislicense.
*
*AnyuseoftheLicensedMaterialsinindividualorcommercialsoftwaremust
*include,intheuserdocumentationandinternalsourcecodecomments,
*thisNotice,Disclaimer,andU.S.GovernmentUseProvision.
*/


#pragmaonce
#include"Karana/KCore/Base.h"
#include"Karana/KCore/SharedPointer.h"
#include"Karana/Scene/Color.h"
#include"Karana/Scene/Texture.h"
#include<variant>

namespaceKarana::Scene{
structPhysicalMaterialInfo{
Colorcolor=Color::GRAY;

Karana::Core::ks_ptr<constTexture>colorMap=nullptr;

floatmetalness=0.0;

Karana::Core::ks_ptr<constGrayscaleTexture>metalnessMap=nullptr;

floatroughness=1.0;

Karana::Core::ks_ptr<constGrayscaleTexture>roughnessMap=nullptr;

Karana::Core::ks_ptr<constTexture>normalMap=nullptr;
};

classPhysicalMaterial:publicKarana::Core::Base{
public:
PhysicalMaterial(constPhysicalMaterialInfo&mat);

~PhysicalMaterial();

staticKarana::Core::ks_ptr<PhysicalMaterial>create(constPhysicalMaterialInfo&mat);

constPhysicalMaterialInfoinfo;
};

structPhongMaterialInfo{
Colorcolor=Color::GRAY;

Karana::Core::ks_ptr<constTexture>colorMap=nullptr;

ColorambientColor=Color::GRAY;

Karana::Core::ks_ptr<constTexture>ambientColorMap=nullptr;

ColorspecularColor=Color::BLACK;

Karana::Core::ks_ptr<constTexture>specularColorMap=nullptr;

ColoremissiveColor=Color::BLACK;

Karana::Core::ks_ptr<constTexture>emissiveColorMap=nullptr;
};

classPhongMaterial:publicKarana::Core::Base{
public:
PhongMaterial(constPhongMaterialInfo&mat);

~PhongMaterial();

staticKarana::Core::ks_ptr<PhongMaterial>create(constPhongMaterialInfo&mat);

constPhongMaterialInfoinfo;
};

usingVarMaterial=
std::variant<Karana::Core::ks_ptr<PhysicalMaterial>,Karana::Core::ks_ptr<PhongMaterial>>;

constVarMaterial&defaultMaterial();

}//namespaceKarana::Scene