本文整理汇总了C++中ShadeContext::SetGBufferID方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::SetGBufferID方法的具体用法?C++ ShadeContext::SetGBufferID怎么用?C++ ShadeContext::SetGBufferID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::SetGBufferID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvalColor
// --- Methods inherited from Texmap ---
RGBA Water::EvalColor(ShadeContext& sc) {
float d;
float q[3];
Point3 p, dp;
if (gbufID)
sc.SetGBufferID(gbufID);
xyzGen->GetXYZ(sc, p, dp);
q[0] = p.x;
q[1] = p.y;
q[2] = p.z;
d = ScalarWave(q);
if (d>1.0f) d = 1.0f;
// If we have sub-texmaps and they are enabled, get the colors from
// the sub-texmaps, otherwise get them from the color swatch
RGBA c0 = (mapOn[0]&&subTex[0]) ? subTex[0]->EvalColor(sc): col[0];
RGBA c1 = (mapOn[1]&&subTex[1]) ? subTex[1]->EvalColor(sc): col[1];
Col24 c;
Col24 col1 = Col24FromColor(c0);
Col24 col2 = Col24FromColor(c1);
lerp_color(&c, &col1, &col2, d);
return ColorFromCol24(c);
}
示例2: 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;
}
示例3: EvalColor
// --- Methods inherited from Texmap ---
RGBA Smoke::EvalColor(ShadeContext& sc) {
float d;
Point3 p, dp;
if (gbufID)
sc.SetGBufferID(gbufID);
xyzGen->GetXYZ(sc, p, dp);
if (size == 0.0f)
size = 1.0f;
d = SmokeFunc(p/size, iter);
// If we have sub-texmaps and they are enabled, get the colors from
// the sub-texmaps, otherwise get them from the color swatch
RGBA c0 = (mapOn[0]&&subTex[0]) ? subTex[0]->EvalColor(sc): col[0];
RGBA c1 = (mapOn[1]&&subTex[1]) ? subTex[1]->EvalColor(sc): col[1];
Col24 c;
Col24 col1 = Col24FromColor(c0);
Col24 col2 = Col24FromColor(c1);
lerp_color(&c, &col1, &col2, d);
return ColorFromCol24(c);
}
示例4: EvalColor
// --- Methods inherited from Texmap ---
RGBA Stucco::EvalColor(ShadeContext& sc) {
float f;
Point3 p, dp;
if (gbufID)
sc.SetGBufferID(gbufID);
xyzGen->GetXYZ(sc, p, dp);
if (size == 0.0f)
size = 0.0001f;
p /= size;
float scl = compscl(dp, size);
f = Func(p, scl);
// If we have sub-texmaps and they are enabled, get the colors from
// the sub-texmaps, otherwise get them from the color swatch
RGBA c0 = (mapOn[0]&&subTex[0]) ? subTex[0]->EvalColor(sc): col[0];
RGBA c1 = (mapOn[1]&&subTex[1]) ? subTex[1]->EvalColor(sc): col[1];
Col24 c;
Col24 col1 = Col24FromColor(c0);
Col24 col2 = Col24FromColor(c1);
lerp_color(&c, &col1, &col2, f);
return ColorFromCol24(c);
}
示例5: EvalColor
// --- Methods inherited from Texmap ---
RGBA Speckle::EvalColor(ShadeContext& sc) {
// After being evaluated, if a map or material has a non-zero gbufID,
// it should call ShadeContext::SetGBuffer() to store it into
// the shade context.
if (gbufID)
sc.SetGBufferID(gbufID);
// Use the XYZGen instance to get a transformed point from the
// ShadeContext.
Point3 p, dp;
xyzGen->GetXYZ(sc, p, dp);
if (size == 0.0f)
size = 0.0001f;
p *= SCALE_FACTOR/size;
float d = SpeckleFunc(p);
if (d>1.0f) d = 1.0f;
// If we have sub-texmaps and they are enabled, get the colors from
// the sub-texmaps, otherwise get them from the color swatch
RGBA c0 = (mapOn[0]&&subTex[0]) ? subTex[0]->EvalColor(sc): col[0];
RGBA c1 = (mapOn[1]&&subTex[1]) ? subTex[1]->EvalColor(sc): col[1];
// Composite the colors together and return the result.
return (1.0f-d)*c0 + d*c1;
}
示例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: EvalMono
float Mask::EvalMono(ShadeContext& sc) {
if (gbufID) sc.SetGBufferID(gbufID);
float m = 1.0f;
if (subTex[1]&&mapOn[1]) {
m = subTex[1]->EvalMono(sc);
if (invertMask) m = 1.0f-m;
}
float c0 = subTex[0]&&mapOn[0]? subTex[0]->EvalMono(sc): 1.0f;
return m*c0;
}
示例8: EvalNormalPerturb
Point3 Mask::EvalNormalPerturb(ShadeContext& sc) {
if (gbufID) sc.SetGBufferID(gbufID);
float m = 1.0f;
if (subTex[1]&&mapOn[1]) {
m = subTex[1]->EvalMono(sc);
if (invertMask) m = 1.0f-m;
}
Point3 p0 = subTex[0]&&mapOn[0]? subTex[0]->EvalNormalPerturb(sc): Point3(0.0f,0.0f,0.0f);
return m*p0;
}
示例9: EvalColor
AColor BerconTile::EvalColor(ShadeContext& sc) {
Point3 p;
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);
// Evaulate maps and tiling parameters
TileParam t = EvalParameters(sc);
// UVW, Distortion and size
berconXYZ.get(sc,p);
if (useDistortion) p += getDistVector(sc);
p /= tileSize;
// Caluclate tiling
TilePoint tp = Tile::draw(p, t);
// Calculate color
if (tp.d < -.5f) // First check if we are on edge
c = mapOn[1]&&subtex[1]?subtex[1]->EvalColor(sc): col[1];
else {
RGBA c1, c2;
if (tileParam.mapUV || tileParam.tileID || tileParam.center) { // Then if we map UV coordinates
BerconSC bsc = BerconSC(&sc);
if (tileParam.mapUV)
bsc.setUV1(tp.uvw, uvChan);
if (tileParam.center)
bsc.setUV2(tp.center, uvChan2);
if (tileParam.tileID)
bsc.setMultiTexture((float)tp.id);
c1 = getColor(bsc, 0);
if (lockEdge) c2 = getColor(bsc, 1);
else c2 = getColor(bsc, 2);
} else { // Normal eval
c1 = getColor(sc, 0);
if (lockEdge) c2 = getColor(sc, 1);
else c2 = getColor(sc, 2);
}
c = (1.0f-tp.d)*c2 + tp.d*c1;
}
c = texout->Filter(c);
// Cache
sc.PutCache(this,c);
return c;
}
示例10: EvalColor
AColor Gradient::EvalColor(ShadeContext& sc) {
if (!sc.doMaps)
return black;
AColor c;
if (sc.GetCache(this,c))
return c;
if (gbufID) sc.SetGBufferID(gbufID);
c = texout->Filter(uvGen->EvalUVMap(sc,&mysamp));
sc.PutCache(this,c);
return c;
}
示例11: EvalMono
float Gradient::EvalMono(ShadeContext& sc) {
if (!sc.doMaps)
return 0.0f;
float f;
if (sc.GetCache(this,f))
return f;
if (gbufID) sc.SetGBufferID(gbufID);
f = texout->Filter(uvGen->EvalUVMapMono(sc,&mysamp));
sc.PutCache(this,f);
return f;
}
示例12: EvalColor
// --- Methods inherited from Texmap ---
RGBA Planet::EvalColor(ShadeContext& sc) {
float d, x, y, z;
RGBA color;
// After being evaluated, if a map or material has a non-zero gbufID,
// it should call ShadeContext::SetGBuffer() to store it into
// the shade context.
if (gbufID)
sc.SetGBufferID(gbufID);
// Use the XYZGen instance to get a transformed point from the
// ShadeContext.
Point3 p, dp;
xyzGen->GetXYZ(sc, p, dp);
if (size == 0.0f)
size = 0.0001f;
x = p.x/size;
y = p.y/size;
z = p.z/size;
d = NoiseFunc(x, y, z);
if (d < land) {
float frac;
int index;
d = d/land*3.0f;
index = (int)d;
frac = d-(float)index;
if (index < 2)
color = (1.0f-frac)*col[index]+frac*col[index+1];
else {
if (blend)
color = (1.0f-frac)*col[2]+frac*col[3];
else
color = col[2];
}
}
else {
float divfac, frac;
int index;
divfac = 1.0f-land;
if (divfac==0.0) divfac = .000001f;
d = (d-land)/divfac*5;
index = (int)d;
frac = d-(float)index;
if (index < 4)
color = (1.0f-frac)*col[index+3]+frac*col[index+4];
else
color = col[7];
}
return color;
}
示例13: EvalNormalPerturb
Point3 Splat::EvalNormalPerturb(ShadeContext& sc) {
float del, d, f;
Point3 p, dp, np;
if (gbufID)
sc.SetGBufferID(gbufID);
xyzGen->GetXYZ(sc, p, dp);
d = splatter(p);
del = 0.1f;
// float strength = (abs((int)col[1].r-(int)col[0].r)+
// abs((int)col[1].g-(int)col[0].g)+
// abs((int)col[1].b-(int)col[0].b)); ///100.0f; // 756.0f
// f = strength/del;
f = 1.0f/del;
Point3 M[3];
xyzGen->GetBumpDP(sc,M);
np.x = f*(splatter(p+del*M[0]) - d);
np.y = f*(splatter(p+del*M[1]) - d);
np.z = f*(splatter(p+del*M[2]) - d);
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 np;
}
示例14: EvalColor
AColor UVtex::EvalColor(ShadeContext& sc) {
if (gbufID) sc.SetGBufferID(gbufID);
#if MAX_RELEASE > 3100
Point3 uvw;
if (uvChannel < 0)
{
if (sc.InMtlEditor())
{
Point2 a, b;
sc.ScreenUV(a, b);
uvw = Point3(a.x, a.y, 0.0f);
} else if (sc.globContext != NULL && sc.NodeID() >= 0)
{
RenderInstance* ri = sc.globContext->GetRenderInstance(sc.NodeID());
Mesh* m = ri->mesh;
if (m->mapSupport(uvChannel))
{
Point3 bc = sc.BarycentricCoords();
int i = sc.FaceNumber();
UVVert* v = m->mapVerts(uvChannel);
TVFace* f = m->mapFaces(uvChannel);
uvw = v[f[i].t[0]] * bc.x +
v[f[i].t[1]] * bc.y +
v[f[i].t[2]] * bc.z;
} else {
uvw = Point3(0.0,0.0,0.0);
}
} else {
uvw = Point3(0.0,0.0,0.0);
}
} else {
uvw = sc.UVW(uvChannel);
}
#else
Point3 uvw = sc.UVW(uvChannel);
#endif
if (clampUVW) {
uvw.x = Clamp(uvw.x);
uvw.y = Clamp(uvw.y);
uvw.z = Clamp(uvw.z);
} else {
uvw.x = mod(uvw.x, 1.0000001f);
uvw.y = mod(uvw.y, 1.0000001f);
uvw.z = mod(uvw.z, 1.0000001f);
}
return EvalUVtex(uvw);
}
示例15: EvalNormalPerturb
Point3 Water::EvalNormalPerturb(ShadeContext& sc) {
if (gbufID)
sc.SetGBufferID(gbufID);
Point3 p, dp, np;
xyzGen->GetXYZ(sc, p, dp);
VectorWave(p, np);
Point3 M[3];
xyzGen->GetBumpDP(sc,M);
np = Point3( DotProd(np,M[0]),DotProd(np,M[1]),DotProd(np,M[2]));
return sc.VectorFromNoScale(np,REF_OBJECT);
}