本文整理汇总了C++中ShadeContext::ReflectVector方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::ReflectVector方法的具体用法?C++ ShadeContext::ReflectVector怎么用?C++ ShadeContext::ReflectVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::ReflectVector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shade
void DumMtl::Shade(ShadeContext& sc)
{
Color lightCol;
Color diffwk(0.0f,0.0f,0.0f);
Color specwk(0.0f,0.0f,0.0f);
Point3 N = sc.Normal();
Point3 R = sc.ReflectVector();
LightDesc *l;
for (int i = 0; i<sc.nLights; i++) {
l = sc.Light(i);
register float NL, diffCoef;
Point3 L;
if (!l->Illuminate(sc, N, lightCol, L, NL, diffCoef))
continue;
// diffuse
if (l->affectDiffuse)
diffwk += diffCoef*lightCol;
// specular
if (l->affectSpecular) {
float c = DotProd(L,R);
if (c>0.0f) {
c = (float)pow((double)c, (double)phongexp);
specwk += c*lightCol*NL; // multiply by NL to SOFTEN
}
}
}
sc.out.t = Color(0.0f,0.0f,0.0f);
sc.out.c = (.3f*sc.ambientLight + diffwk)*diff + specwk*spec;
}
示例2: PreShade
void Matte::PreShade(ShadeContext& sc, IReshadeFragment* pFrag)
{
// save reflection texture
if ( reflmap ){
AColor rcol;
if (reflmap->HandleOwnViewPerturb()) {
sc.TossCache(reflmap);
rcol = reflmap->EvalColor(sc);
} else
rcol = sc.EvalEnvironMap(reflmap, sc.ReflectVector());
pFrag->AddColorChannel( rcol );
}
}
示例3: Shade
// if this function changes, please also check SupportsReShading, PreShade and PostShade
// end - ke/mjm - 03.16.00 - merge reshading code
// [attilas|29.5.2000] if this function changes, please also check EvalColorStdChannel
void Matte::Shade(ShadeContext& sc)
{
Color c,t, shadowClr;
float atten;
float reflA;
// > 6/15/02 - 11:12am --MQM--
// for renderer prepass, we need to at least call
// illuminate so that Light Tracer can cache shading
if ( SHADECONTEXT_IS_PREPASS( sc ) )
{
Color lightCol;
Point3 L;
float NL = 0.0f, diffCoef = 0.0f;
LightDesc *l = NULL;
for ( int i = 0; i < sc.nLights; i++ )
{
l = sc.Light( i );
if ( NULL != l )
l->Illuminate( sc, sc.Normal(), lightCol, L, NL, diffCoef );
}
return;
}
#ifdef _DEBUG
IPoint2 sp = sc.ScreenCoord();
if ( sp.x == stopX && sp.y == stopY )
sp.x = stopX;
#endif
if (gbufID) sc.SetGBufferID(gbufID);
IllumParams ip( 1, &shadowIllumOutStr);
IllumParams ipNS(0, NULL);
ip.ClearInputs(); ip.ClearOutputs();
ipNS.ClearInputs(); ipNS.ClearOutputs();
ip.hasComponents = ipNS.hasComponents = HAS_MATTE_MTL;
// get background color & transparency
if (!opaque) sc.Execute(0x1000); // DS: 6/24/99:use black bg when AA filtering (#192348)
sc.GetBGColor(c, t, fogBG&&(!fogObjDepth) );
if (!opaque) sc.Execute(0x1001); // DS: 6/24/99:use black bg when AA filtering (#192348)
if (shadowBG && sc.shadow) {
/********
sc.shadow = 0;
Color col0 = sc.DiffuseIllum();
sc.shadow = 1;
Color scol = sc.DiffuseIllum();
float f = Intens(col0);
atten = (f>0.0f)?Intens(scol)/f:1.0f;
if (atten>1.0f) atten = 1.0f/atten;
********/
atten = IllumShadow( sc, shadowClr );
atten = amblev + (1.0f-amblev) * atten;
// key on black user-set shadow clr
if( gUseLocalShadowClr || col.r != 0.0f || col.g != 0.0f || col.b != 0.0f )
shadowClr = col;
ipNS.finalC = ipNS.diffIllumOut = c;
c *= atten;
ip.diffIllumOut = c;
shadowClr *= 1.0f - atten;
ip.finalC = sc.out.c = c + shadowClr;
ip.SetUserIllumOutput( 0, shadowClr );
if (shadowAlpha)
t *= atten;
} else {
sc.out.c =
ipNS.finalC = ipNS.diffIllumOut = ip.finalC = ip.diffIllumOut = c;
}
// add the reflections
if (reflmap && useReflMap) {
AColor rcol;
if (reflmap->HandleOwnViewPerturb()) {
sc.TossCache(reflmap);
rcol = reflmap->EvalColor(sc);
} else
rcol = sc.EvalEnvironMap(reflmap, sc.ReflectVector());
Color rc;
rc = Color(rcol.r,rcol.g,rcol.b)*reflAmt;
ip.reflIllumOut = ipNS.reflIllumOut = rc;
if( additiveReflection ) {
// additive compositing of reflections
sc.out.c += rc; ip.finalC += rc; ipNS.finalC += rc;
} else {
reflA = Intens( rc );
// over compositing of reflections
sc.out.c = (1.0f - reflA) * sc.out.c + rc;
ip.finalC = (1.0f - reflA) * ip.finalC + rc;
//.........这里部分代码省略.........
示例4: switch
//????????????????????????????????????????????????????????????????????????
// The stdID parameter doesn't really have a meaning in this case.
//
bool Matte::EvalMonoStdChannel
(
ShadeContext& sc, // describes context of evaluation
int stdID, // must be ID_AM, ect
float& outVal // output var
)
{
switch ( stdID )
{
case ID_BU: // Bump (value 8)
case ID_RR: // Refraction (value 10)
case ID_DP: // Displacement (value 11)
case ID_SI: // Self-illumination (value 5)
case ID_FI: // Filter color (value 7)
return false;
break;
case ID_RL: // Reflection (value 9)
if ( sc.doMaps &&
reflmap &&
useReflMap &&
reflmap->IsOutputMeaningful(sc) )
{
if ( reflmap->HandleOwnViewPerturb() )
{
sc.TossCache(reflmap);
outVal = reflmap->EvalMono(sc);
}
else
{
AColor rcol;
rcol = sc.EvalEnvironMap( reflmap, sc.ReflectVector() );
Color rc;
rc = Color(rcol.r,rcol.g,rcol.b)*reflAmt;
outVal = Intens(rc);
}
}
else
return false;
break;
case ID_AM: // Ambient (value 0)
outVal = Intens( GetAmbient() );
break;
case ID_DI: // Diffuse (value 1)
outVal = Intens( GetDiffuse() );
break;
case ID_SP: // Specular (value 2)
outVal = Intens( GetSpecular() );
break;
case ID_SH: // Shininess (value 3). In R3 and later this is called Glossiness.
outVal = GetShininess();
break;
case ID_SS: // Shininess strength (value 4). In R3 and later this is called Specular Level.
outVal = GetShinStr();
break;
case ID_OP: // Opacity (value 6)
outVal = GetXParency();
break;
default:
// Should never happen
//DbgAssert( false );
return false;
break;
}
return true;
}