当前位置: 首页>>代码示例>>C++>>正文


C++ ShadeContext::ScreenUV方法代码示例

本文整理汇总了C++中ShadeContext::ScreenUV方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::ScreenUV方法的具体用法?C++ ShadeContext::ScreenUV怎么用?C++ ShadeContext::ScreenUV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShadeContext的用法示例。


在下文中一共展示了ShadeContext::ScreenUV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:29,代码来源:mrTwoSidedShader.cpp

示例2: 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);
}
开发者ID:johnburnett,项目名称:UVWtoRGB,代码行数:52,代码来源:UVtex.cpp


注:本文中的ShadeContext::ScreenUV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。