本文整理汇总了C#中ShadingState.getW方法的典型用法代码示例。如果您正苦于以下问题:C# ShadingState.getW方法的具体用法?C# ShadingState.getW怎么用?C# ShadingState.getW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadingState
的用法示例。
在下文中一共展示了ShadingState.getW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: prepareShadingState
public void prepareShadingState(ShadingState state)
{
state.init();
state.getRay().getPoint(state.getPoint());
Instance parent = state.getInstance();
Point3 localPoint = state.transformWorldToObject(state.getPoint());
float cx = state.getU();
float cy = state.getV();
float cz = state.getW();
state.getNormal().set(localPoint.x - cx, localPoint.y - cy, localPoint.z - cz);
state.getNormal().normalize();
float phi = (float) Math.Atan2(state.getNormal().y, state.getNormal().x);
if (phi < 0)
phi += (float)(2.0 * Math.PI);
float theta = (float) Math.Acos(state.getNormal().z);
state.getUV().y = theta / (float) Math.PI;
state.getUV().x = phi / (float) (2 * Math.PI);
Vector3 v = new Vector3();
v.x = -2 * (float) Math.PI * state.getNormal().y;
v.y = 2 * (float) Math.PI * state.getNormal().x;
v.z = 0;
state.setShader(parent.getShader(0));
state.setModifier(parent.getModifier(0));
// into world space
Vector3 worldNormal = state.transformNormalObjectToWorld(state.getNormal());
v = state.transformVectorObjectToWorld(v);
state.getNormal().set(worldNormal);
state.getNormal().normalize();
state.getGeoNormal().set(state.getNormal());
// compute basis in world space
state.setBasis(OrthoNormalBasis.makeFromWV(state.getNormal(), v));
}