Program Listing for File Material.h#
↰ Return to documentation for file (include/Karana/Scene/Material.h)
/*
*Copyright(c)2024-2026KaranaDynamicsPtyLtd.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<const Texture>color_map=nullptr;
floatmetalness=0.0;
Karana::Core::ks_ptr<const GrayscaleTexture>metalness_map=nullptr;
floatroughness=1.0;
Karana::Core::ks_ptr<const GrayscaleTexture>roughness_map=nullptr;
Karana::Core::ks_ptr<const Texture>normal_map=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<const Texture>color_map=nullptr;
Colorambient_color=Color::GRAY;
Karana::Core::ks_ptr<const Texture>ambient_color_map=nullptr;
Colorspecular_color=Color::BLACK;
Karana::Core::ks_ptr<const Texture>specular_color_map=nullptr;
Coloremissive_color=Color::BLACK;
Karana::Core::ks_ptr<const Texture>emissive_color_map=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