diff options
| author | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
|---|---|---|
| committer | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
| commit | bd0027e737c6512397f841c22786274ed74b927f (patch) | |
| tree | f7ffbdb8f3741bb7f24635616cc189cba5cb865c /vrayPlug/plugin/shaveVrayTriShadeable.cpp | |
| download | shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip | |
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'vrayPlug/plugin/shaveVrayTriShadeable.cpp')
| -rw-r--r-- | vrayPlug/plugin/shaveVrayTriShadeable.cpp | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/vrayPlug/plugin/shaveVrayTriShadeable.cpp b/vrayPlug/plugin/shaveVrayTriShadeable.cpp new file mode 100644 index 0000000..417a611 --- /dev/null +++ b/vrayPlug/plugin/shaveVrayTriShadeable.cpp @@ -0,0 +1,151 @@ +// Shave and a Haircut +// (c) 2019 Epic Games +// US Patent 6720962 + +/********************************************************************** + *< + FILE: shaveVrayTriShadeable.cpp -- implementation file + + DESCRIPTION: Used to shade the instanced surface + + CREATED BY: Vladimir Dubovoy <[email protected]> + + HISTORY: created 13-05-2010 + + *> + **********************************************************************/ + +#include "shaveVrayTriShadeable.h" + +shaveVrayTriShadeable::shaveVrayTriShadeable(shaveVrayTriVoxelPrim *hair) +{ + _prim() = hair; +} + +shaveVrayTriShadeable::~shaveVrayTriShadeable() +{ + freeBSDFpool(); +} +/* +| from Shadeable +*/ +void shaveVrayTriShadeable::shade(VR::VRayContext &rc) +{ + BSDFShadeable::shade(rc); + + if (VUtils::hasNonFiniteLanes(rc.mtlresult.color)) { + rc.mtlresult.color.makeZero(); + } +//#ifdef USE_WHITE_TRI_BRDF +// VR::Color c = VR::Color(1.0f, 1.0f, 1.0f); +// rc.mtlresult.color *= c; +//#else +// BSDFShadeable::shade(rc); +//#endif + + //rc.mtlresult.color.r = 1.0f; + //rc.mtlresult.color.g = 0.0f; + //rc.mtlresult.color.b = 0.0f; + + //rc.mtlresult.alpha.r = 0.0f; + //rc.mtlresult.alpha.g = 0.0f; + //rc.mtlresult.alpha.b = 0.0f; + + //rc.mtlresult.transp.r = 0.f; + //rc.mtlresult.transp.g = 0.f; + //rc.mtlresult.transp.b = 0.f; + + //rc.mtlresult.alphaTransp.r = 0.0f; + //rc.mtlresult.alphaTransp.g = 0.0f; + //rc.mtlresult.alphaTransp.b = 0.0f; +} +/* +| from Shadeable +*/ +tchar* shaveVrayTriShadeable::getName(VR::VRayContext &rc) +{ + return const_cast<tchar*>("shaveVrayTriShadeable"); +} + +VR::BSDFSampler* shaveVrayTriShadeable::newBSDF (const VR::VRayContext &rc, VR::BSDFFlags flags) +{ +#ifdef USE_WHITE_TRI_BRDF + VR::WhiteBRDF *bsdf = _bsdfPool().newBRDF(rc); + return bsdf; +#else + #error not implemented + //shaveVrayBaseBSDF *bsdf = _bsdfPool().newBRDF(rc); + //if (!bsdf) + // return NULL; + + //int strandIdx = rc.rayresult.faceIndex; + //VR::Color diffCol = VR::Color(0.0f, 1.0f, 0.0f); //just green to see if somthing goes wrong + + //int segmentIdx=(int) rc.rayresult.extraf; + + //if(prim()->IsColorConst(strandIdx)) + // prim()->GetRootColor(strandIdx,diffCol); + //else + // prim()->GetInterpColor(segmentIdx, strandIdx,diffCol); + + //VR::Color specCol = VR::Color(1.0f, 1.0f, 1.0f); + + //float opacity = 1.0f; + //if(prim()->GetTipFade()) + // opacity = prim()->GetInterpOpacity(segmentIdx,strandIdx); + //else + // opacity = prim()->GetOpacity(strandIdx); + // + ////transparency + //float t=1.0f-opacity; + //VR::Color trsp = VR::Color(t, t, t); + + ////ambient color [not used yet] + //VR::Color ambientCol = prim()->GetAmbient(); + + ////abient/diffuse factor + //float ambDiff = prim()->GetAmbDiff(strandIdx); + + ////glossines + //float gloss = prim()->GetGlossiness(strandIdx); + + //float splvl = prim()->GetSpecLevel(strandIdx); + + //VR::Vector hairDir=prim()->GetHairDir(rc.rayresult.origPoint, segmentIdx, strandIdx); + + //bsdf->init(rc,specCol,diffCol,ambientCol,ambDiff,splvl,gloss,0,trsp, hairDir, t); + + //return bsdf; +#endif +} + +void shaveVrayTriShadeable::deleteBSDF(const VR::VRayContext &rc, VR::BSDFSampler *bsdf) +{ + if(!bsdf) + return; +#ifdef USE_WHITE_TRI_BRDF + VR::WhiteBRDF *dbsdf = static_cast<VR::WhiteBRDF*>(bsdf); +#else + #error not implemented + //shaveVrayBaseBSDF* dbsdf = static_cast<shaveVrayBaseBSDF*>(bsdf); +#endif + _bsdfPool().deleteBRDF(rc, dbsdf); +} + +#if defined(VRAY40) +int shaveVrayTriShadeable::getBSDFFlags() +{ + return VR::bsdfFlag_none; +} +#endif + +void shaveVrayTriShadeable::initBSDFpool(VR::VRayCore *vray) +{ + const VR::VRaySequenceData &sdata=vray->getSequenceData(); + _bsdfPool().init(sdata.maxRenderThreads); +} + +void shaveVrayTriShadeable::freeBSDFpool() +{ + _bsdfPool().freeMem(); +} |