本文整理汇总了C#中ShadingState.transformNormalObjectToWorld方法的典型用法代码示例。如果您正苦于以下问题:C# ShadingState.transformNormalObjectToWorld方法的具体用法?C# ShadingState.transformNormalObjectToWorld怎么用?C# ShadingState.transformNormalObjectToWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadingState
的用法示例。
在下文中一共展示了ShadingState.transformNormalObjectToWorld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: prepareShadingState
public void prepareShadingState(ShadingState state)
{
state.init();
state.getRay().getPoint(state.getPoint());
Instance parent = state.getInstance();
Point3 n = state.transformWorldToObject(state.getPoint());
state.getNormal().set(n.x * (2 * n.x * n.x - 1), n.y * (2 * n.y * n.y - 1), n.z * (2 * n.z * n.z - 1));
state.getNormal().normalize();
state.setShader(parent.getShader(0));
state.setModifier(parent.getModifier(0));
// into world space
Vector3 worldNormal = state.transformNormalObjectToWorld(state.getNormal());
state.getNormal().set(worldNormal);
state.getNormal().normalize();
state.getGeoNormal().set(state.getNormal());
// create basis in world space
state.setBasis(OrthoNormalBasis.makeFromW(state.getNormal()));
}
示例2: modify
public void modify(ShadingState state)
{
Point3 p = state.transformWorldToObject(state.getPoint());
p.x *= size;
p.y *= size;
p.z *= size;
Vector3 normal = state.transformNormalWorldToObject(state.getNormal());
double f0 = f(p.x, p.y, p.z);
double fx = f(p.x + .0001, p.y, p.z);
double fy = f(p.x, p.y + .0001, p.z);
double fz = f(p.x, p.y, p.z + .0001);
normal.x -= scale * (float)((fx - f0) / .0001);
normal.y -= scale * (float)((fy - f0) / .0001);
normal.z -= scale * (float)((fz - f0) / .0001);
normal.normalize();
state.getNormal().set(state.transformNormalObjectToWorld(normal));
state.getNormal().normalize();
state.setBasis(OrthoNormalBasis.makeFromW(state.getNormal()));
}