本文整理汇总了C++中ShadeContext::CurTime方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::CurTime方法的具体用法?C++ ShadeContext::CurTime怎么用?C++ ShadeContext::CurTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::CurTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//????????????????????????????????????????????????????????????????????????
// The submat with a higher index "cover" the ones "below".
// If the first submat taken from the end of the array has amount == 100,
// that's al it matters. Otherwise all until the second consecutive submat
// with amount == 100 matter
//
bool CompositeMat::IsOutputConst
(
ShadeContext& sc, // describes context of evaluation
int stdID // must be ID_AM, ect
)
{
Mtl *sm = NULL;
int numSubMatOn = 0;
int numConsec = 0;
bool bIsConst = true;
Interval iv;
// Iterate through the submats in reverse order because that is
// the order of their significance
for (int i = MAX_NUM_MTLS-1; i >= 0; i--)
{
BOOL enabled;
float amount;
// The first one is always enabled
if ( i == 0 )
enabled = 1;
else
pblock2->GetValue( compmat_map_on, sc.CurTime(), enabled, iv, i-1 );
if ( enabled )
{
pblock2->GetValue( compmat_mtls, sc.CurTime(), sm, iv, i );
if ( sm != NULL )
{
numSubMatOn++;
// All of the first on is always composited
if ( i == 0 )
amount = 100.f;
else
pblock2->GetValue( compmat_amount, sc.CurTime(), amount, iv, i-1 );
if ( numSubMatOn == 1 && amount == 100.0f )
return sm->IsOutputConst( sc, stdID );
else
{
if ( amount == 100.0f )
numConsec++;
else
numConsec = 0;
bool b = sm->IsOutputConst( sc, stdID );
bIsConst = (bIsConst && b );
if ( !bIsConst )
return bIsConst;
else if ( numConsec == 2 )
return bIsConst;
}
}
}
}
return bIsConst;
}
示例2: getGradientValueDist
float BerconGradient::getGradientValueDist(ShadeContext& sc) {
switch (p_normalType) {
case 0: { // View
return -sc.P().z; //Length(sc.OrigView()); //(sc.PointTo(sc.P(), REF_CAMERA)).z;
}
case 1: { // Local X
return (sc.PointTo(sc.P(), REF_OBJECT)).x;
}
case 2: { // Local Y
return (sc.PointTo(sc.P(), REF_OBJECT)).y;
}
case 3: { // Local Z
return (sc.PointTo(sc.P(), REF_OBJECT)).z;
}
case 4: { // World X
return (sc.PointTo(sc.P(), REF_WORLD)).x;
}
case 5: { // World Y
return (sc.PointTo(sc.P(), REF_WORLD)).y;
}
case 6: { // World Z
return (sc.PointTo(sc.P(), REF_WORLD)).z;
}
case 7: { // Camera X
return sc.P().x; //(sc.PointTo(sc.P(), REF_CAMERA)).x;
}
case 8: { // Camera Y
return sc.P().y; //(sc.PointTo(sc.P(), REF_CAMERA)).y;
}
case 9: { // Camera Z
return -sc.P().z; //-(sc.PointTo(sc.P(), REF_CAMERA)).z;
}
case 10: { // To Object
if (sc.InMtlEditor() || !p_node)
return -sc.P().z; //(sc.PointTo(sc.P(), REF_CAMERA)).z;
return Length((p_node->GetNodeTM(sc.CurTime())).GetTrans() - sc.PointTo(sc.P(), REF_WORLD));
}
case 11: { // Object Z
if (sc.InMtlEditor() || !p_node)
return -sc.P().z; //(sc.PointTo(sc.P(), REF_CAMERA)).z;
Matrix3 tm = p_node->GetNodeTM(sc.CurTime());
Point3 a = tm.GetTrans() - sc.PointTo(sc.P(), REF_WORLD);
Point3 b = FNormalize(tm.GetRow(2));
return (-DotProd(b, a) / Length(b));
}
}
return 0.f;
}
示例3: PreShade
void CompositeMat::PreShade(ShadeContext& sc, IReshadeFragment* pFrag)
{
int i(0);
Mtl *submtl = NULL;
// BOOL enabled(FALSE);
char texLengths[12];
int lengthChan = pFrag->NTextures();
pFrag->AddIntChannel(0);
pFrag->AddIntChannel(0);
pFrag->AddIntChannel(0);
int nPrevTex = 3 + lengthChan;
// preshade any submaterials
for (i=0; i<MAX_NUM_MTLS; i++)
{
pblock2->GetValue(compmat_mtls, sc.CurTime(), submtl, FOREVER, i);
if (submtl){
IReshading* pReshading = (IReshading*)(submtl->GetInterface(IID_IReshading));
if( pReshading ){
pReshading->PreShade(sc, pFrag);
int nTex = pFrag->NTextures();
texLengths[i] = char( nTex - nPrevTex);
nPrevTex = nTex;
}
}
}
int* pI = (int*)&texLengths[0];
pFrag->SetIntChannel( lengthChan++, pI[0] );
pFrag->SetIntChannel( lengthChan++, pI[1] );
pFrag->SetIntChannel( lengthChan, pI[2] );
}
示例4: EvalColor
RGBA Noise::EvalColor(ShadeContext& sc) {
Point3 p,dp;
if (!sc.doMaps) return black;
AColor c;
if (sc.GetCache(this,c))
return c;
if (gbufID) sc.SetGBufferID(gbufID);
//IPoint2 ps = sc.ScreenCoord();
UpdateCache(sc.CurTime()); // DS 10/3/00
xyzGen->GetXYZ(sc,p,dp);
p /= size;
filter = sc.filterMaps;
float smw;
float limlev = LimitLevel(dp,smw);
float d = NoiseFunction(p,limlev,smw);
RGBA c0 = mapOn[0]&&subTex[0] ? subTex[0]->EvalColor(sc): col[0];
RGBA c1 = mapOn[1]&&subTex[1] ? subTex[1]->EvalColor(sc): col[1];
c = texout->Filter((1.0f-d)*c0 + d*c1);
sc.PutCache(this,c);
return c;
}
示例5: EvalColor
AColor mrTwoSidedShader::EvalColor(ShadeContext& sc) {
// Provide a good default for this (for the material editor peview)...
// Use the front color for the top half of the screen the the back color
// for the bottom half.
if(m_mainPB != NULL) {
Point2 screenUV;
Point2 screenDUV;
sc.ScreenUV(screenUV, screenDUV);
// Front map is used for top part of the image
bool useFront = (screenUV.y > 0.5f);
TimeValue t = sc.CurTime();
BOOL mapOn = m_mainPB->GetInt(useFront ? kMainPID_FrontMapOn : kMainPID_BackMapOn, t);
if(mapOn) {
Texmap* map = m_mainPB->GetTexmap(useFront ? kMainPID_FrontMap : kMainPID_BackMap, t);
if(map != NULL) {
return map->EvalColor(sc);
}
}
// Return the color only
AColor col = m_mainPB->GetAColor(useFront ? kMainPID_FrontColor : kMainPID_BackColor, t);
return col;
}
return AColor(0,0,0);
}
示例6: EvalColor
AColor BerconNoise::EvalColor(ShadeContext& sc) {
if (!sc.doMaps) return black;
AColor c;
if (sc.GetCache(this,c))
return c;
if (gbufID) sc.SetGBufferID(gbufID);
// UVW and Distortion
Point3 p, dpdx, dpdy, dp;
if(!berconXYZ.get(sc, p, dpdx, dpdy)) return AColor(0,0,0,0);
if (useDistortion)
applyDistortion(sc,p);
float nSize = (mapOn[4] && subtex[4]) ? subtex[4]->EvalMono(sc)*size : size;
p /= nSize; dpdx /= nSize; dpdy /= nSize;
Noise::alterUVW(p, uvwDist);
NoiseParams np = EvalParameters(&sc);
// Caluclate noise function
float d = sc.filterMaps ? Noise::limitedNoise(p, dpdx, dpdy, np) : Noise::limitedNoise(p, np);
if (useCurve)
d = curve->GetControlCurve(0)->GetValue(sc.CurTime(), d);
// Get colors
RGBA c0 = mapOn[0]&&subtex[0] ? subtex[0]->EvalColor(sc): col[0];
RGBA c1 = mapOn[1]&&subtex[1] ? subtex[1]->EvalColor(sc): col[1];
c = texout->Filter((1.f-d)*c0 + d*c1);
// Cache
sc.PutCache(this,c);
return c;
}
示例7: getGradientValueNormal
float BerconGradient::getGradientValueNormal(ShadeContext& sc) {
switch (p_normalType) {
case 0: { // View
return -DotProd(sc.Normal(), sc.V());
}
case 1: { // Local X
return (sc.VectorTo(sc.Normal(), REF_OBJECT)).x;
}
case 2: { // Local Y
return (sc.VectorTo(sc.Normal(), REF_OBJECT)).y;
}
case 3: { // Local Z
return (sc.VectorTo(sc.Normal(), REF_OBJECT)).z;
}
case 4: { // World X
return (sc.VectorTo(sc.Normal(), REF_WORLD)).x;
}
case 5: { // World Y
return (sc.VectorTo(sc.Normal(), REF_WORLD)).y;
}
case 6: { // World Z
return (sc.VectorTo(sc.Normal(), REF_WORLD)).z;
}
case 7: { // Camera X
return sc.Normal().x; //(sc.VectorTo(sc.Normal(), REF_CAMERA)).x;
}
case 8: { // Camera Y
return sc.Normal().y; //(sc.VectorTo(sc.Normal(), REF_CAMERA)).y;
}
case 9: { // Camera Z
return sc.Normal().z; //(sc.VectorTo(sc.Normal(), REF_CAMERA)).z;
}
case 10: { // To Object
if (sc.InMtlEditor() || !p_node)
return -DotProd(sc.Normal(), sc.V());
return DotProd(sc.Normal(), FNormalize(sc.PointFrom((p_node->GetNodeTM(sc.CurTime())).GetTrans(),REF_WORLD) - sc.P()));
}
case 11: { // Object Z
if (sc.InMtlEditor() || !p_node)
return -DotProd(sc.Normal(), sc.V());
return DotProd(sc.Normal(), FNormalize(sc.VectorFrom(p_node->GetNodeTM(sc.CurTime()).GetRow(2),REF_WORLD)));
}
}
return 0.f;
}
示例8: EvalColor
AColor BerconWood::EvalColor(ShadeContext& sc) {
Point3 p,dpdx,dpdy;
if (!sc.doMaps) return black;
// If we've already evalutated the color at this point we'll use it and stop here
AColor c;
if (sc.GetCache(this,c))
return c;
if (gbufID) sc.SetGBufferID(gbufID);
// Evaluate parameters
WoodParam wp = EvalParameters(sc);
float grainA = mapOn[19]&&subtex[19]?subtex[19]->EvalMono(sc)*grainAmount:grainAmount;
float grainF = mapOn[20]&&subtex[20]?subtex[20]->EvalMono(sc)*grainFreq:grainFreq;
// UVW, Distortion and size
berconXYZ.get(sc,p,dpdx,dpdy);
if (useDistortion)
applyDistortion(sc,p);
float wSize = mapOn[5]&&subtex[5]?subtex[5]->EvalMono(sc)*woodSize:woodSize;
p /= wSize; dpdx /= (wSize / 2.f); dpdy /= (wSize / 2.f);
// Caluclate wood function and grain
Point3 gP;
float d = sc.filterMaps? Noise::wood(p, dpdx, dpdy, gP, wp) : Noise::wood(p, gP, wp);
float g = (grainAmount > .001f) ? Fractal::grain(gP, grainA, grainF): 0.f;
// Get colors
RGBA c0 = mapOn[0]&&subtex[0] ? subtex[0]->EvalColor(sc): col[0];
RGBA c1 = mapOn[1]&&subtex[1] ? subtex[1]->EvalColor(sc): col[1];
RGBA c2 = lockGrain ? c1: (mapOn[2]&&subtex[2] ? subtex[2]->EvalColor(sc): col[2]);
// Apply curves
if (useCurve)
d = curve->GetControlCurve(0)->GetValue(sc.CurTime(), d);
// Calculate color
c = (1.0f-d)*c0 + d*c1;
c = (1.0f-g)*c + g*c2;
c = texout->Filter(c);
// Cache
sc.PutCache(this,c);
return c;
}
示例9:
void M3Mat::PreShade(ShadeContext& sc, IReshadeFragment* pFrag)
{
int i;
IReshading* pReshading;
TimeValue t = sc.CurTime();
Interval valid = FOREVER;
// get the base material value into i
pblockMat->GetValue(100, t, i, valid );
Mtl *sm1 = mTex[100];
// handle no base mat
if(sm1 == NULL)
{
return;
}
if(i==0||(i==1&&inRender))
{
for( i=0;i<100;i++)
{
float u;
pblockMat->GetValue(i,t,u,valid);
if(mTex[i]!=NULL && u!=0 && mapOn[i])
{
Mtl *comb = mTex[i];
pReshading = (IReshading*)(comb->GetInterface(IID_IReshading));
if( pReshading )
pReshading->PreShade(sc, pFrag);
}
}
pReshading = (IReshading*)(sm1->GetInterface(IID_IReshading));
if( pReshading )
pReshading->PreShade(sc, pFrag);
}
else {
// i == 1 && not inRender
pReshading = (IReshading*)(sm1->GetInterface(IID_IReshading));
if( pReshading )
pReshading->PreShade(sc, pFrag);
}
}
示例10: EvalNormalPerturb
Point3 Noise::EvalNormalPerturb(ShadeContext& sc) {
Point3 p,dp;
if (!sc.doMaps) return Point3(0,0,0);
if (gbufID) sc.SetGBufferID(gbufID);
UpdateCache(sc.CurTime()); // DS 10/3/00
xyzGen->GetXYZ(sc,p,dp);
p /= size;
filter = sc.filterMaps;
float smw;
float limlev = LimitLevel(dp,smw);
float del,d;
d = NoiseFunction(p,limlev,smw);
//del = (dp.x+dp.y+dp.z)/(size*3.0f);
del = .1f;
Point3 np;
Point3 M[3];
xyzGen->GetBumpDP(sc,M);
np.x = (NoiseFunction(p+del*M[0],limlev,smw) - d)/del;
np.y = (NoiseFunction(p+del*M[1],limlev,smw) - d)/del;
np.z = (NoiseFunction(p+del*M[2],limlev,smw) - d)/del;
np = sc.VectorFromNoScale(np, REF_OBJECT);
Texmap *sub0 = mapOn[0]?subTex[0]:NULL;
Texmap *sub1 = mapOn[1]?subTex[1]:NULL;
if (sub0||sub1) {
// d((1-k)*a + k*b ) = dk*(b-a) + k*(db-da) + da
float a,b;
Point3 da,db;
if (sub0) { a = sub0->EvalMono(sc); da = sub0->EvalNormalPerturb(sc); }
else { a = Intens(col[0]); da = Point3(0.0f,0.0f,0.0f); }
if (sub1) { b = sub1->EvalMono(sc); db = sub1->EvalNormalPerturb(sc); }
else { b = Intens(col[1]); db= Point3(0.0f,0.0f,0.0f); }
np = (b-a)*np + d*(db-da) + da;
}
else
np *= Intens(col[1])-Intens(col[0]);
return texout->Filter(np);
}
示例11: EvalMono
float Noise::EvalMono(ShadeContext& sc) {
Point3 p,dp;
if (!sc.doMaps) return 0.0f;
float f;
if (sc.GetCache(this,f))
return f;
if (gbufID) sc.SetGBufferID(gbufID);
UpdateCache(sc.CurTime()); // DS 10/3/00
xyzGen->GetXYZ(sc,p,dp);
p /= size;
filter = sc.filterMaps;
float smw;
float limlev = LimitLevel(dp, smw);
float d = NoiseFunction(p,limlev,smw);
float c0 = mapOn[0]&&subTex[0] ? subTex[0]->EvalMono(sc): Intens(col[0]);
float c1 = mapOn[1]&&subTex[1] ? subTex[1]->EvalMono(sc): Intens(col[1]);
f = texout->Filter((1.0f-d)*c0 + d*c1);
sc.PutCache(this,f);
return f;
}
示例12: EvalColor
// #################### // Color \\ ####################
AColor BerconGradient::EvalColor(ShadeContext& sc) {
// Initialize returned color
AColor res(0.0f,0.0f,0.0f,0.0f);
if (!sc.doMaps) return res;
// Use cache
if (sc.GetCache(this,res))
return res;
if (gbufID) sc.SetGBufferID(gbufID);
// Function type
float d;
if (p_type == 0) {// UVW
Point3 p;
if (!berconXYZ.get(sc, p)) return res;
d = getGradientValueUVW(p);
} else { // Others
d = getGradientValue(sc);
}
// Distortion
if (p_disOn && p_distex) d += (1.f - p_distex->EvalMono(sc) * 2.f) * p_disStr;
// Limit range
if (!limitRange(d)) return res;
// Curve
if (p_curveOn) d = curve->GetControlCurve(0)->GetValue(sc.CurTime(), d);
// Get color from gradient
res = gradient->getColor(p_reverse?1.f-d:d, sc);
// Output
res = texout->Filter(res);
// Shading ready, return results
sc.PutCache(this,res);
return res;
}
示例13: EvalNormalPerturb
Point3 BerconNoise::EvalNormalPerturb(ShadeContext& sc) {
if (!sc.doMaps) return Point3(0,0,0);
if (gbufID) sc.SetGBufferID(gbufID);
// UVW and Distortion
Point3 p, dpdx, dpdy;
Point3 M[3];
if (!berconXYZ.get(sc, p, dpdx, dpdy, M)) return Point3(0,0,0);
if (useDistortion)
applyDistortion(sc,p);
float nSize = (mapOn[4] && subtex[4]) ? subtex[4]->EvalMono(sc)*size : size;
p /= nSize;
Noise::alterUVW(p, uvwDist);
NoiseParams np = EvalParameters(&sc);
// Vector
Point3 normal;
float d = Noise::limitedNoise(p, np);
if (useCurve) {
d = curve->GetControlCurve(0)->GetValue(sc.CurTime(), d);
normal.x = (curve->GetControlCurve(0)->GetValue(sc.CurTime(), Noise::limitedNoise(p+DELTA*M[0], np)) - d) / DELTA;
normal.y = (curve->GetControlCurve(0)->GetValue(sc.CurTime(), Noise::limitedNoise(p+DELTA*M[1], np)) - d) / DELTA;
normal.z = (curve->GetControlCurve(0)->GetValue(sc.CurTime(), Noise::limitedNoise(p+DELTA*M[2], np)) - d) / DELTA;
} else {
normal.x = (Noise::limitedNoise(p+DELTA*M[0], np) - d) / DELTA;
normal.y = (Noise::limitedNoise(p+DELTA*M[1], np) - d) / DELTA;
normal.z = (Noise::limitedNoise(p+DELTA*M[2], np) - d) / DELTA;
}
normal = -sc.VectorFromNoScale(normal, REF_OBJECT);
// Eval sub maps
float f1, f2;
Point3 v1, v2;
bool maps = false;
if (subtex[0]) {
f1 = subtex[0]->EvalMono(sc);
v1 = subtex[0]->EvalNormalPerturb(sc);
maps = true;
} else {
f1 = Intens(col[0]);
v1 = Point3(0.f, 0.f, 0.f);
}
if (subtex[1]) {
f2 = subtex[1]->EvalMono(sc);
v2 = subtex[1]->EvalNormalPerturb(sc);
maps = true;
} else {
f2 = Intens(col[1]);
v2 = Point3(0.f, 0.f, 0.f);
}
// Calculate vector
if (maps)
normal = (f2-f1)*normal + d*v2 + (1.f-d)*v1;
else
normal *= f2 - f1;
return texout->Filter(normal); // Does this filter actually do something?
}
示例14: total
void M3Mat::Shade(ShadeContext& sc) {
int i;
TimeValue t = sc.CurTime();
Interval valid = FOREVER;
pblockMat->GetValue(100,t,i,FOREVER);
Mtl *sm1 = mTex[100];
float total(0.0f);
ShadeOutput sFinal( sc.out.nElements ); // get nElements correctly
ShadeOutput sDatabase[100];
// for( i = 0; i < 100; ++i )
// sDatabase[i] = sFinal;
float u[100];
// handle no base mat
if(!sm1)
{
sc.ResetOutput();
sc.out.c = black;
sc.out.t = black;
return;
}
if(i==0||(i==1&&inRender))
{
for( i=0;i<100;i++)
{
pblockMat->GetValue(i,t,u[i],valid);
u[i] /= 100.0f;
if(mTex[i]!=NULL&&u[i]!=0&&mapOn[i])
{
Mtl *comb = mTex[i];
comb->Shade(sc);
sDatabase[i] = sc.out;
sc.ResetOutput();
total += u[i];
}
}
sc.ResetOutput();
sm1->Shade(sc);
sFinal.c = black;
sFinal.t = black;
sFinal.ior = 0.0f;
for( i=0;i<100;i++)
{
if(mTex[i]!=NULL&&u[i]!=0&&mapOn[i])
{
sc.out.flags |= sDatabase[i].flags;
if(total>1.0f){
sFinal.c += u[i]/total * sDatabase[i].c;
sFinal.t += u[i]/total * sDatabase[i].t;
sFinal.ior += u[i]/total * sDatabase[i].ior;
}
else{
sFinal.c += u[i] * sDatabase[i].c;
sFinal.t += u[i] * sDatabase[i].t;
sFinal.ior += u[i] * sDatabase[i].ior;
}
}
}
if(total) {
sc.out.MixIn(sFinal, 1.0f-total);
}
}
else {
sm1->Shade(sc);
}
}
示例15: 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 CompositeMat::Shade(ShadeContext& sc)
{
Mtl *sm1 = NULL;
int id =0;
// float gamount;
if (gbufID){
sc.SetGBufferID(gbufID);
id = gbufID;
}
Interval iv;
int first = 1;
ShadeOutput out1;
int nEles = sc.NRenderElements();
for (int i = 0; i < MAX_NUM_MTLS; i++){
BOOL enabled;
float amount;
if (i==0) enabled = 1;
else pblock2->GetValue(compmat_map_on,sc.CurTime(),enabled,iv,i-1);
if (enabled){
pblock2->GetValue(compmat_mtls,sc.CurTime(),sm1,iv,i);
if (sm1 != NULL){
if (i==0) amount = 100.f;
else pblock2->GetValue(compmat_amount,sc.CurTime(),amount,iv,i-1);
amount = amount*0.01f;
int type;
if (i==0) type = 2;
else pblock2->GetValue(compmat_type,sc.CurTime(),type,iv,i-1);
if (first ==1){ // first material
first = 0;
sm1->Shade(sc); // sc.out already reset for first
out1 = sc.out;
if (type == 0){
out1.t.r += 1.0f-amount;
out1.t.g += 1.0f-amount;
out1.t.b += 1.0f-amount;
out1.c *= amount;
out1.t.ClampMinMax();
// render elements
for( int i = 0; i < nEles; ++i )
out1.elementVals[i] *= amount;
}
out1.ior *= amount;
// gamount = 1.0f-(out1.t.r + out1.t.g + out1.t.b)/3.0f;
} else { // not first material
// pblock2->GetValue(compmat_mtls,sc.CurTime(),sm2,iv,i);
// sc.out.ior = s*a.ior + f*ior;
// if (f<=0.5f) gbufId = a.gbufId;
sc.ResetOutput();
sm1->Shade(sc);
ShadeOutput out2 = sc.out;
if (type == 0){ // additive
out2.t.r += 1.0f-amount;
out2.t.g += 1.0f-amount;
out2.t.b += 1.0f-amount;
out2.c *= amount;
out2.t.ClampMinMax();
out2.ior *= amount;
float f1 = 1.0f-(out1.t.r + out1.t.g + out1.t.b)/3.0f;
float f2 = 1.0f-(out2.t.r + out2.t.g + out2.t.b)/3.0f;
out1.c = out1.c *(1.0f-f2) + out2.c * (f1);
out1.t = out1.t- (1.0f-out2.t);
out1.ior = out1.ior + out2.ior;
// if (f2 > gamount) {
// gamount = f2;
// out1.gbufId = out1.gbufId;//?? ke 6.13.00
// }
out1.t.ClampMinMax();
// render elements
for( int i = 0; i < nEles; ++i )
out1.elementVals[i] = out1.elementVals[i] * (1.0f-f2) + out2.elementVals[i] * f1;
} else if (type == 1) { // subtractive
//NB: as of 6.13.00 this is SAME as additive case
out2.t.r += 1.0f-amount;
out2.t.g += 1.0f-amount;
out2.t.b += 1.0f-amount;
out2.c *= amount;
out2.t.ClampMinMax();
out2.ior *= amount;
float f1 = 1.0f-(out1.t.r + out1.t.g + out1.t.b)/3.0f;
float f2 = 1.0f-(out2.t.r + out2.t.g + out2.t.b)/3.0f;
//.........这里部分代码省略.........