#ifndef _HAIR_VR_BASE_BSDF_H_ #define _HAIR_VR_BASE_BSDF_H_ // Shave and a Haircut // (c) 2019 Epic Games // US Patent 6720962 /********************************************************************** *< FILE: shaveVrayBaseBSDF.h ( was HairVrBaseBSDF.h ) DESCRIPTION: Generic class for BSDFs CREATED BY: Vladimir Dubovoy HISTORY: created 09-09-2008 ( as part of 3ds Max + VRay hair shaders) merged 31-03-2010 *> **********************************************************************/ //#include //ShadeContext //#include //#include //#include //#include //#include #include "utils.h" #include "vrayplugins.h" #include "brdfs.h" #include "hairAPIvray.h" #include "vray3_compat.h" class shaveVrayBaseBSDF : public IShaveVrayBSDF //public VR::BRDFSampler, //public VR::BSDFSampler { public: // Initialization void init(const VR::VRayContext &rc, const VR::Color &reflectionColor, const VR::Color &diffuseColor, const VR::Color &ambientColor, const VR::Color &specularTint, const VR::Color &specularTint2, float ambDiff, float specularLevel, float reflectionGlossiness, int subdivs, const VR::Color &transp, const VR::ShadeVec &hairDir, float requiredTransparency, bool cameraVisibility, bool reflVisibility, bool refrVisibility, bool lightVisibility, bool giVisibility, float selfshadow, bool recvshadow) VRAY_OVERRIDE; // From BRDFSampler VR::ShadeCol getDiffuseColor(VR::ShadeCol &lightColor) VRAY_OVERRIDE; VR::ShadeCol getLightMult (VR::ShadeCol &lightColor) VRAY_OVERRIDE; VR::ShadeCol getTransparency(const VR::VRayContext &rc) VRAY_OVERRIDE; VR::ShadeCol eval(const VR::VRayContext &rc, const VR::ShadeVec &direction, VR::ShadeCol &lightColor, VR::ShadeCol &origLightColor, float probLight, int flags) VRAY_OVERRIDE; void traceForward(VR::VRayContext &rc, int doDiffuse) VRAY_OVERRIDE; VR::RenderChannelsInfo* getRenderChannels() VRAY_OVERRIDE; // From BSDFSampler VR::BRDFSampler *getBRDF(VR::BSDFSide side) VRAY_OVERRIDE; protected: //const member access inline const VR::ShadeCol& reflect_filter() const {return m_reflect_filter;} inline const VR::ShadeCol& transparency() const {return m_transparency;} inline const VR::ShadeCol& diffuse() const {return m_diffuse;} inline const VR::ShadeCol& ambient() const {return m_ambient;} inline const VR::ShadeCol& spec_tint() const {return m_spec_tint;} inline const VR::ShadeCol& spec_tint2() const {return m_spec_tint2;} inline const VR::ShadeVec& normal() const {return m_normal; } inline const VR::ShadeVec& gnormal() const {return m_gnormal;} inline VR::real glossiness() const {return m_glossiness;} inline bool combineSampling() const {return m_combineSampling;} inline float ambdiff() const {return m_ambdiff;} inline float speclvl() const {return m_speclvl;} inline bool cameraVisibility() const {return m_cameraVisibility;} inline bool lightVisibility() const {return m_lightVisibility;} inline bool giVisibility() const {return m_giVisibility;} //member access inline VR::ShadeCol& _reflect_filter() {return m_reflect_filter;} inline VR::ShadeCol& _transparency() {return m_transparency;} inline VR::ShadeCol& _diffuse() {return m_diffuse;} inline VR::ShadeCol& _ambient() {return m_ambient;} inline VR::ShadeCol& _spec_tint() {return m_spec_tint;} inline VR::ShadeCol& _spec_tint2() {return m_spec_tint2;} inline VR::ShadeVec& _normal() {return m_normal; } inline VR::ShadeVec& _gnormal() {return m_gnormal;} inline VR::real& _glossiness() {return m_glossiness;} inline bool& _combineSampling() {return m_combineSampling;} inline float& _ambdiff() {return m_ambdiff;} inline float& _speclvl() {return m_speclvl;} inline bool& _cameraVisibility() {return m_cameraVisibility;} inline bool& _lightVisibility() {return m_lightVisibility;} inline bool& _giVisibility() {return m_giVisibility;} private: VR::ShadeCol m_reflect_filter; VR::ShadeCol m_transparency; VR::ShadeCol m_diffuse; VR::ShadeCol m_ambient; VR::ShadeCol m_spec_tint; VR::ShadeCol m_spec_tint2; VR::real m_glossiness; float m_ambdiff; float m_speclvl; bool m_combineSampling; bool m_cameraVisibility; bool m_lightVisibility; bool m_giVisibility; VR::ShadeVec m_normal; VR::ShadeVec m_gnormal; VR::ShadeVec hairDir; float currentTransp; float requiredTransparency; bool isGatherPoint; }; #endif //endof_HAIR_VR_BASE_BSDF_H_