本文整理汇总了C++中ShadeContext::InMtlEditor方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::InMtlEditor方法的具体用法?C++ ShadeContext::InMtlEditor怎么用?C++ ShadeContext::InMtlEditor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::InMtlEditor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: EvalNormalPerturb
Point3 CellTex::EvalNormalPerturb(ShadeContext& sc)
{
Point3 p,dp;
xyzGen->GetXYZ(sc,p,dp);
p += ptOffset;
Point3 np(0.0f,0.0f,0.0f);
float dpsq = DotProd(dp,dp);
float d = CellFunc(p,dpsq,np,sc.InMtlEditor());
Texmap* sub0 = (useCellMap && subTex[0])?subTex[0]:NULL;
Texmap* sub1 = (useDiv1Map && subTex[1])?subTex[1]:NULL;
Texmap* sub2 = (useDiv2Map && subTex[2])?subTex[2]:NULL;
if (d<low) {
if (sub0)
np = sub0->EvalNormalPerturb(sc);
}
else
if (d>high) {
if (sub2)
np = sub2->EvalNormalPerturb(sc);
}
else {
Point3 M[3];
xyzGen->GetBumpDP(sc,M);
np = Point3( DotProd(np,M[0]),DotProd(np,M[1]),DotProd(np,M[2]));
if (d<mid) {
if (sub0||sub1) {
float a,b;
Point3 da,db;
// d((1-k)*a + k*b ) = dk*(b-a) + k*(db-da) + da
d = (d-low)/(midMinuslow);
// div1C*u + (1.0f-u)*cellC) ;
if (sub0) {
a = sub0->EvalMono(sc);
da = sub0->EvalNormalPerturb(sc);
}
else {
a = 1.0f;
da = Point3(0.0f,0.0f,0.0f);
}
if (sub1) {
b = sub1->EvalMono(sc);
db = sub1->EvalNormalPerturb(sc);
}
else {
b = 1.0f;
db = Point3(0.0f,0.0f,0.0f);
}
np = (b-a)*np + d*(db-da) + da;
}
}
else {
if (sub1 || sub2) {
float a,b;
Point3 da,db;
// div2C*u + (1.0f-u)*div1C);
d = (d-mid)/(highMinusmid);
if (sub1) {
a = sub1->EvalMono(sc);
da = sub1->EvalNormalPerturb(sc);
}
else {
a = 1.0f;
da = Point3(0.0f,0.0f,0.0f);
}
if (sub2) {
b = sub2->EvalMono(sc);
db = sub2->EvalNormalPerturb(sc);
}
else {
b = 1.0f;
db = Point3(0.0f,0.0f,0.0f);
}
np = (b-a)*np + d*(db-da)+ da;
}
}
}
// float d = CellFunc(p,dpsq,np,sc.InMtlEditor());
// Point3 tmp;
// float div = type ? -0.1875f : 0.0375f;
// Point3 DP[3];
// xyzGen->GetBumpDP(sc,DP);
// np.x = (CellFunc(p+DP[0],dpsq,tmp,sc.InMtlEditor()) - d)/div;
// np.y = (CellFunc(p+DP[1],dpsq,tmp,sc.InMtlEditor()) - d)/div;
// np.z = (CellFunc(p+DP[2],dpsq,tmp,sc.InMtlEditor()) - d)/div;
if (type) np = np * -0.5f;
return texout->Filter(sc.VectorFromNoScale(np,REF_OBJECT));
}