5
5
6
6
__BEGIN_YAFRAY
7
7
8
- shinyDiffuseMat_t::shinyDiffuseMat_t (const color_t &col , const color_t &srcol , float diffuse , float transp, float transl, float sp_refl , float emit ):
8
+ shinyDiffuseMat_t::shinyDiffuseMat_t (const color_t &diffuseColor , const color_t &mirrorColor , float diffuseStrength , float transp, float transl, float mirrorStrength , float emitStrength ):
9
9
mIsTransparent(false ), mIsTranslucent(false ), mIsMirror(false ), mIsDiffuse(false ), mHasFresnelEffect(false ),
10
- mDiffuseShader(0 ), mBumpShader(0 ), mTransparencyShader(0 ), mTranslucencyShader(0 ), mMirrorShader(0 ), mMirrorColorShader(0 ), mDiffuseColor(col ), mMirrorColor(srcol ),
11
- mMirrorStrength(sp_refl ), mTransparencyStrength(transp), mTranslucencyStrength(transl), mDiffuseStrength(diffuse ), mUseOrenNayar(false ), nBSDF(0 )
10
+ mDiffuseShader(0 ), mBumpShader(0 ), mTransparencyShader(0 ), mTranslucencyShader(0 ), mMirrorShader(0 ), mMirrorColorShader(0 ), mDiffuseColor(diffuseColor ), mMirrorColor(mirrorColor ),
11
+ mMirrorStrength(mirrorStrength ), mTransparencyStrength(transp), mTranslucencyStrength(transl), mDiffuseStrength(diffuseStrength ), mUseOrenNayar(false ), nBSDF(0 )
12
12
{
13
- mEmitColor = emit*col ;
14
- mEmitStrength = emit ;
13
+ mEmitColor = emitStrength * diffuseColor ;
14
+ mEmitStrength = emitStrength ;
15
15
bsdfFlags = BSDF_NONE;
16
16
if (mEmitStrength > 0 .f ) bsdfFlags |= BSDF_EMIT;
17
17
}
@@ -461,34 +461,37 @@ CFLOAT shinyDiffuseMat_t::getAlpha(const renderState_t &state, const surfacePoin
461
461
462
462
material_t * shinyDiffuseMat_t::factory (paraMap_t ¶ms, std::list<paraMap_t> ¶msList, renderEnvironment_t &render)
463
463
{
464
- shinyDiffuseMat_t *mat;
465
- color_t col=1 .f , srCol=1 .f ;
466
- const std::string *name=0 ;
467
- float transparency=0 .f , emit=0 .f , translucency=0 .f ;
468
- float sp_refl=0 .f ;
469
- bool fresnEff=false ;
464
+ // / Material Parameters
465
+ color_t diffuseColor=1 .f ;
466
+ color_t mirrorColor=1 .f ;
467
+ CFLOAT diffuseStrength=1 .f ;
468
+ float transparencyStrength=0 .f ;
469
+ float translucencyStrength=0 .f ;
470
+ float mirrorStrength=0 .f ;
471
+ float emitStrength = 0 .f ;
472
+ bool fresnelEffect=false ;
470
473
double IOR = 1.33 , filt=1.0 ;
471
- CFLOAT diffuse=1 .f ;
472
- // bool error=false;
473
- params.getParam (" color" , col);
474
- params.getParam (" mirror_color" , srCol);
475
- params.getParam (" transparency" , transparency);
476
- params.getParam (" translucency" , translucency);
477
- params.getParam (" diffuse_reflect" , diffuse);
478
- params.getParam (" specular_reflect" , sp_refl);
479
- params.getParam (" emit" , emit);
474
+ params.getParam (" color" , diffuseColor);
475
+ params.getParam (" mirror_color" , mirrorColor);
476
+ params.getParam (" transparency" , transparencyStrength);
477
+ params.getParam (" translucency" , translucencyStrength);
478
+ params.getParam (" diffuse_reflect" , diffuseStrength);
479
+ params.getParam (" specular_reflect" , mirrorStrength);
480
+ params.getParam (" emit" , emitStrength);
480
481
params.getParam (" IOR" , IOR);
481
- params.getParam (" fresnel_effect" , fresnEff );
482
+ params.getParam (" fresnel_effect" , fresnelEffect );
482
483
params.getParam (" transmit_filter" , filt);
483
484
// !!remember to put diffuse multiplier in material itself!
484
- mat = new shinyDiffuseMat_t (col, srCol, diffuse, transparency, translucency, sp_refl, emit );
485
+ shinyDiffuseMat_t * mat = new shinyDiffuseMat_t (diffuseColor, mirrorColor, diffuseStrength, transparencyStrength, translucencyStrength, mirrorStrength, emitStrength );
485
486
mat->mTransmitFilterStrength = filt;
486
487
487
- if (fresnEff )
488
+ if (fresnelEffect )
488
489
{
489
490
mat->mIOR_Squared = IOR * IOR;
490
491
mat->mHasFresnelEffect = true ;
491
492
}
493
+
494
+ const std::string *name=0 ;
492
495
if (params.getParam (" diffuse_brdf" , name))
493
496
{
494
497
if (*name == " oren_nayar" )
@@ -499,6 +502,7 @@ material_t* shinyDiffuseMat_t::factory(paraMap_t ¶ms, std::list<paraMap_t> &
499
502
}
500
503
}
501
504
505
+ // / Material Shader Nodes
502
506
std::vector<shaderNode_t *> roots;
503
507
std::map<std::string, shaderNode_t *> nodeList;
504
508
@@ -537,12 +541,13 @@ material_t* shinyDiffuseMat_t::factory(paraMap_t ¶ms, std::list<paraMap_t> &
537
541
if (mat->mTransparencyShader ) mat->getNodeList (mat->mTransparencyShader , colorNodes);
538
542
if (mat->mTranslucencyShader ) mat->getNodeList (mat->mTranslucencyShader , colorNodes);
539
543
540
- mat->filterNodes (colorNodes, mat->allViewdep , VIEW_DEP);
544
+ mat->filterNodes (colorNodes, mat->allViewdep , VIEW_DEP);
541
545
mat->filterNodes (colorNodes, mat->allViewindep , VIEW_INDEP);
542
546
543
547
if (mat->mBumpShader ) mat->getNodeList (mat->mBumpShader , mat->bumpNodes );
544
548
}
545
549
550
+
546
551
mat->config ();
547
552
548
553
// ===!!!=== test <<< This test should go, is useless, DT
0 commit comments