本文整理汇总了C++中ShadeContext::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::Execute方法的具体用法?C++ ShadeContext::Execute怎么用?C++ ShadeContext::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::Execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostShade
void Matte::PostShade(ShadeContext& sc, IReshadeFragment* pFrag, int& nextTexIndex, IllumParams*)
{
Color c,t;
float atten;
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 = amblev+(1.0f-amblev)*atten;
// sc.out.c = c*atten + (1.0f-atten)*col;
Color shadowClr;
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;
c *= atten;
shadowClr *= 1.0f - atten;
sc.out.c = c + shadowClr;
if (shadowAlpha)
t *= atten;
} else
sc.out.c = c;
sc.out.t = opaque ? black : t;
Clamp(sc.out.t);
// code for compositing: -1 for opaque , else -2
sc.out.ior = (opaque) ? -1.0f : -2.0f;
if( reflmap ){
if( useReflMap ){
Color rc = pFrag->GetColorChannel( nextTexIndex++ );
sc.out.c += rc * reflAmt;
} else {
nextTexIndex++; // skip
}
}
}
示例2: 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;
//.........这里部分代码省略.........