本文整理汇总了C++中TextureOutput类的典型用法代码示例。如果您正苦于以下问题:C++ TextureOutput类的具体用法?C++ TextureOutput怎么用?C++ TextureOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextureOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReplaceReference
void Output::Init() {
ivalid.SetEmpty();
if (texout) texout->Reset();
else ReplaceReference( 1, GetNewDefaultTextureOutput());
texout->SetRollupOpen(1);
mapOn[0] = 1;
}
示例2: ReplaceReference
void Noise::Init() {
if (xyzGen) xyzGen->Reset();
else ReplaceReference( XYZGEN_REF, GetNewDefaultXYZGen());
if (texout) texout->Reset();
else ReplaceReference( TEXOUT_REF, GetNewDefaultTextureOutput());
ivalid.SetEmpty();
cacheValid.SetEmpty();
macroRecorder->Disable(); // disable macrorecorder during reset
SetColor(0, Color(0.0f,0.0f,0.0f), TimeValue(0));
SetColor(1, Color(1.0f,1.0f,1.0f), TimeValue(0));
noiseType = NOISE_REGULAR;
#ifndef RENDER_VER
RegisterDistanceDefault(_T("Noise Params"), _T("Size"), DEFAULT_NOISE_SIZE, IN_TO_M(DEFAULT_NOISE_SIZE));
float size = GetDistanceDefault(_T("Noise Params"), _T("Size"));
SetSize(size, TimeValue(0));
#else
SetSize(DEFAULT_NOISE_SIZE, TimeValue(0));
#endif
SetPhase(.0f,TimeValue(0));
SetLevels(3.0f,TimeValue(0));
pblock->SetValue(noise_hithresh,0,1.0f);
macroRecorder->Enable();
for (int i=0; i<NSUBTEX; i++)
mapOn[i] = 1;
}
示例3: ReplaceReference
void CellTex::Init()
{
if (xyzGen) xyzGen->Reset();
else ReplaceReference(1, GetNewDefaultXYZGen());
if (texout) texout->Reset();
else ReplaceReference(2, GetNewDefaultTextureOutput());
RegisterDistanceDefault(_T("Cellular Params"), _T("Size"), 5.0f, IN_TO_M(5.0f));
float size = GetDistanceDefault(_T("Cellular Params"), _T("Size"));
pblock->SetValue(cellular_size,0,size);
/*
pblock->SetValue(PB_CELLCOL,0,Point3(1,1,1));
pblock->SetValue(PB_DIVCOL1,0,Point3(.5f,.5f,.5f));
pblock->SetValue(PB_DIVCOL2,0,Point3(0,0,0));
pblock->SetValue(PB_SIZE,0,5.0f);
pblock->SetValue(PB_SPREAD,0,0.5f);
pblock->SetValue(PB_LOW,0,0.0f);
pblock->SetValue(PB_MID,0,0.5f);
pblock->SetValue(PB_HIGH,0,1.0f);
pblock->SetValue(PB_FRACT,0,0);
pblock->SetValue(PB_ITER,0,3.0f);
pblock->SetValue(PB_USECELLMAP,0,1);
pblock->SetValue(PB_USEDIV1MAP,0,1);
pblock->SetValue(PB_USEDIV2MAP,0,1);
pblock->SetValue(PB_SMOOTH,0,0.1f);
pblock->SetValue(PB_ADAPT,0,1);
if (paramDlg)
paramDlg->pmap->SetParamBlock(pblock);
*/
fract = 0;
ivalid.SetEmpty();
}
示例4: ReplaceReference
void Gradient::Init()
{
if (uvGen) uvGen->Reset();
else ReplaceReference( UVGEN_REF, GetNewDefaultUVGen());
if (texout) texout->Reset();
else ReplaceReference( TEXOUT_REF, GetNewDefaultTextureOutput());
ivalid.SetEmpty();
}
示例5: EvalColor
AColor CellTex::EvalColor(ShadeContext& sc)
{
// Get object point
Point3 p,dp;
if (gbufID) sc.SetGBufferID(gbufID);
xyzGen->GetXYZ(sc,p,dp);
p += ptOffset;
p = p/size;
// Eval maps
Color cellC, div1C, div2C;
if (useCellMap && subTex[0]) cellC = subTex[0]->EvalColor(sc);
else cellC = cellCol;
if (useDiv1Map && subTex[1]) div1C = subTex[1]->EvalColor(sc);
else div1C = divCol1;
if (useDiv2Map && subTex[2]) div2C = subTex[2]->EvalColor(sc);
else div2C = divCol2;
// Evaluate cell function
float dist[2];
int ids[2];
float u;
if (type) {
if (fract) FractalCellFunction(p,iterations,rough,2,dist,ids);
else CellFunction(p,2,dist,ids);
u = 1.0f - (dist[1]-dist[0])/spread;
} else {
if (fract) FractalCellFunction(p,iterations,rough,1,dist,ids);
else CellFunction(p,1,dist,ids);
u = dist[0]/spread;
}
// Vari cell color
if (var>0.0f) {
float vr = RandFromCellID(ids[0])*var + varOff;
cellC.r = cellC.r*vr;
cellC.g = cellC.g*vr;
cellC.b = cellC.b*vr;
cellC.ClampMinMax();
}
if (u<low) return texout->Filter(RGBA(cellC));
if (u>high) return texout->Filter(RGBA(div2C));
if (u<mid) {
u = (u-low)/(midMinuslow);
return texout->Filter(RGBA(div1C*u + (1.0f-u)*cellC));
} else {
u = (u-mid)/(highMinusmid);
return texout->Filter(RGBA(div2C*u + (1.0f-u)*div1C));
}
}
示例6: 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;
}
示例7: CreateParamDlg
ParamDlg* Output::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) {
// create the rollout dialogs
IAutoMParamDlg* masterDlg = maskCD.CreateParamDlgs(hwMtlEdit, imp, this);
texoutDlg = texout->CreateParamDlg(hwMtlEdit, imp);
// add the secondary dialogs to the master
masterDlg->AddDlg(texoutDlg);
return masterDlg;
}
示例8: 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;
}
示例9: 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;
}
示例10: CreateParamDlg
ParamDlg* CellTex::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)
{
// paramDlg = new CellTexParamDlg(this,imp,hwMtlEdit);
// return paramDlg;
// create the rollout dialogs
xyzGenDlg = xyzGen->CreateParamDlg(hwMtlEdit, imp);
IAutoMParamDlg* masterDlg = cellTexCD.CreateParamDlgs(hwMtlEdit, imp, this);
texoutDlg = texout->CreateParamDlg(hwMtlEdit, imp);
// add the secondary dialogs to the master
masterDlg->AddDlg(xyzGenDlg);
masterDlg->AddDlg(texoutDlg);
// celTex_param_blk.SetUserDlgProc(new NoiseDlgProc(this));
return masterDlg;
}
示例11: EvalNormalPerturb
Point3 Gradient::EvalNormalPerturb(ShadeContext& sc)
{
Point3 dPdu, dPdv;
if (!sc.doMaps) return Point3(0,0,0);
if (gbufID) sc.SetGBufferID(gbufID);
Point2 dM = uvGen->EvalDeriv(sc,&mysamp);
uvGen->GetBumpDP(sc,dPdu,dPdv);
#if 0
// Blinn's algorithm
Point3 N = sc.Normal();
Point3 uVec = CrossProd(N,dPdv);
Point3 vVec = CrossProd(N,dPdu);
Point3 np = -dM.x*uVec+dM.y*vVec;
#else
// Lazy algorithm
Point3 np = dM.x*dPdu+dM.y*dPdv;
// return texout->Filter(dM.x*dPdu+dM.y*dPdv);
#endif
Texmap* sub[3];
for (int i=0; i<3; i++)
sub[i] = mapOn[i]?subTex[i]:NULL;
if (sub[0]||sub[1]||sub[2]) {
// d((1-k)*a + k*b ) = dk*(b-a) + k*(db-da) + da
float a,b,k;
Point3 da,db;
Point2 UV, dUV;
uvGen->GetUV(sc, UV,dUV);
k = gradFunc(UV.x,UV.y);
if (k<=center) {
k = k/center;
EVALSUBPERTURB(a,da,2);
EVALSUBPERTURB(b,db,1);
}
else {
k = (k-center)/(1.0f-center);
EVALSUBPERTURB(a,da,1);
EVALSUBPERTURB(b,db,0);
}
np = (b-a)*np + k*(db-da) + da;
}
return texout->Filter(np);
}
示例12: Update
void Gradient::Update(TimeValue t, Interval& valid)
{
if (!ivalid.InInterval(t)) {
ivalid.SetInfinite();
uvGen->Update(t,ivalid);
texout->Update(t,ivalid);
pblock->GetValue( grad_color1, t, col[0], ivalid );
col[0].ClampMinMax();
pblock->GetValue( grad_color2, t, col[1], ivalid );
col[1].ClampMinMax();
pblock->GetValue( grad_color3, t, col[2], ivalid );
col[2].ClampMinMax();
pblock->GetValue( grad_map1_on, t, mapOn[0], ivalid);
pblock->GetValue( grad_map2_on, t, mapOn[1], ivalid);
pblock->GetValue( grad_map3_on, t, mapOn[2], ivalid);
pblock->GetValue( grad_type, t, type, ivalid );
pblock->GetValue( grad_noise_type, t, noiseType, ivalid );
pblock->GetValue( grad_amount, t, amount, ivalid );
pblock->GetValue( grad_size, t, size, ivalid );
pblock->GetValue( grad_phase, t, phase, ivalid );
pblock->GetValue( grad_center, t, center, ivalid );
pblock->GetValue( grad_levels, t, levels, ivalid );
pblock->GetValue( grad_high_thresh, t, high, ivalid );
pblock->GetValue( grad_low_thresh, t, low, ivalid );
pblock->GetValue( grad_thresh_smooth, t, smooth, ivalid );
if (low>high) {
float temp = low;
low = high;
high = temp;
}
hminusl = (high-low);
sd = hminusl*0.5f*smooth;
if (size!=0.0f) size1 = 20.0f/size;
else size1 = 0.0f;
for (int i=0; i<NSUBTEX; i++) {
if (subTex[i])
subTex[i]->Update(t,ivalid);
}
EnableStuff();
}
valid &= ivalid;
}
示例13: Update
void Output::Update(TimeValue t, Interval& valid) {
if (Param1)
{
pblock->SetValue( output_map1_on, 0, mapOn[0]);
Param1 = FALSE;
}
if (!ivalid.InInterval(t)) {
ivalid.SetInfinite();
texout->Update(t,ivalid);
pblock->GetValue( output_map1_on, t, mapOn[0], ivalid);
for (int i=0; i<NSUBTEX; i++) {
if (subTex[i])
subTex[i]->Update(t,ivalid);
}
}
valid &= ivalid;
}
示例14: CreateParamDlg
ParamDlg* Noise::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) {
// JBW: the main difference here is the automatic creation of a ParamDlg by the new
// ClassDesc2 function CreateParamDlgs(). This mirrors the way BeginEditParams()
// can be redirected to the ClassDesc2 for automatic ParamMap2 management. In this
// case a special subclass of ParamDlg, AutoMParamDlg, defined in IParamm2.h, is
// created. It can act as a 'master' ParamDlg to which you can add any number of
// secondary dialogs and it will make sure all the secondary dialogs are kept
// up-to-date and deleted as necessary.
// create the rollout dialogs
xyzGenDlg = xyzGen->CreateParamDlg(hwMtlEdit, imp);
IAutoMParamDlg* masterDlg = noiseCD.CreateParamDlgs(hwMtlEdit, imp, this);
texoutDlg = texout->CreateParamDlg(hwMtlEdit, imp);
// add the secondary dialogs to the master
masterDlg->AddDlg(xyzGenDlg);
masterDlg->AddDlg(texoutDlg);
noise_param_blk.SetUserDlgProc(new NoiseDlgProc(this));
EnableStuff();
return masterDlg;
}
示例15: 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);
}