本文整理汇总了C#中RenderHelper.RenderSceneReflectionRefration方法的典型用法代码示例。如果您正苦于以下问题:C# RenderHelper.RenderSceneReflectionRefration方法的具体用法?C# RenderHelper.RenderSceneReflectionRefration怎么用?C# RenderHelper.RenderSceneReflectionRefration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderHelper
的用法示例。
在下文中一共展示了RenderHelper.RenderSceneReflectionRefration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PreDrawPhase
public override void PreDrawPhase(GameTime gt, IWorld world, IObject obj, RenderHelper render, ICamera cam)
{
render.ValidateSamplerStates();
Matrix view = cam.View;
Matrix projection = cam.Projection;
//REFRACAO
Plane refractionClipPlane;
if (cam.Position.Y > -plane.D)
{
refractionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref view, ref projection, true);
}
else
{
refractionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref view, ref projection, false);
}
render.PushRenderTarget(refractionRT);
render.Clear(Color.Black);
render.RenderSceneReflectionRefration(world, gt, new List<IObject>() { obj }, ref view, ref projection, true, true,refractionClipPlane);
refractionMap = render.PopRenderTarget()[0].RenderTarget as Texture2D;
//REFLEXAO
Matrix m = Matrix.CreateReflection(plane);
Vector3 pos;
Vector3 target;
Vector3 up;
pos = Vector3.Transform(cam.Position, m);
target = Vector3.Transform(cam.Target, m);
up = Vector3.Transform(cam.Up, m);
reflectiveViewMatrix = Matrix.CreateLookAt(pos, target, up);
Plane reflectionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref reflectiveViewMatrix, ref projection, false);
render.PushRenderTarget(reflectionRT);
render.Clear(Color.Black);
render.PushRasterizerState(RasterizerState.CullClockwise);
render.RenderSceneReflectionRefration(world, gt, new List<IObject>() { obj }, ref reflectiveViewMatrix, ref projection, true, true,reflectionClipPlane);
render.PopRasterizerState();
reflectionMap = render.PopRenderTarget()[0].RenderTarget as Texture2D;
}