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


C# Location.CrossProduct方法代码示例

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


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

示例1: RenderPass_Setup

 /// <summary>
 /// Set up the rendering engine.
 /// </summary>
 public void RenderPass_Setup()
 {
     Location camup = CameraUp();
     BEPUutilities.Quaternion cammod = CameraModifier();
     Location camforward = ForwardVec;
     camup = new Location(BEPUutilities.Quaternion.Transform(camup.ToBVector(), cammod));
     camforward = new Location(BEPUutilities.Quaternion.Transform(camforward.ToBVector(), cammod));
     CameraForward = camforward;
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, CurrentFBO);
     GL.DrawBuffer(CurrentFBO == 0 ? DrawBufferMode.Back : DrawBufferMode.ColorAttachment0);
     StandardBlend();
     GL.Enable(EnableCap.DepthTest);
     RenderTextures = true;
     GL.ClearBuffer(ClearBuffer.Color, 0, ClearColor);
     GL.ClearBuffer(ClearBuffer.Depth, 0, new float[] { 1.0f });
     cameraBasePos = CameraPos;
     cameraAdjust = -camforward.CrossProduct(camup) * 0.25;
     RenderRelative = CameraPos;
     SetViewport();
     CameraTarget = CameraPos + camforward;
     OffsetWorld = Matrix4d.CreateTranslation(ClientUtilities.ConvertD(-CameraPos));
     Matrix4 proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(TheClient.CVars.r_fov.ValueF),
         (float)Width / (float)Height, TheClient.CVars.r_znear.ValueF, TheClient.CVars.r_zfar.ValueF); // TODO: View3D-level vars?
     Location bx = TheClient.CVars.r_3d_enable.ValueB ? (cameraAdjust) : Location.Zero;
     Matrix4 view = Matrix4.LookAt(ClientUtilities.Convert(bx), ClientUtilities.Convert(bx + camforward), ClientUtilities.Convert(camup));
     PrimaryMatrix = view * proj;
     if (TheClient.CVars.r_3d_enable.ValueB)
     {
         Matrix4 view2 = Matrix4.LookAt(ClientUtilities.Convert(-cameraAdjust), ClientUtilities.Convert(-cameraAdjust + camforward), ClientUtilities.Convert(camup));
         PrimaryMatrix_OffsetFor3D = view2 * proj;
     }
     Matrix4d projd = Matrix4d.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(TheClient.CVars.r_fov.ValueF),
         (float)Width / (float)Height, TheClient.CVars.r_znear.ValueF, TheClient.CVars.r_zfar.ValueF); // TODO: View3D-level vars?
     Location bxd = TheClient.CVars.r_3d_enable.ValueB ? (CameraPos + cameraAdjust) : CameraPos;
     Matrix4d viewd = Matrix4d.LookAt(ClientUtilities.ConvertD(bxd), ClientUtilities.ConvertD(bxd + camforward), ClientUtilities.ConvertD(camup));
     PrimaryMatrixd = viewd * projd;
     Matrix4d PrimaryMatrix_OffsetFor3Dd = Matrix4d.Identity;
     if (TheClient.CVars.r_3d_enable.ValueB)
     {
         Matrix4d view2d = Matrix4d.LookAt(ClientUtilities.ConvertD(CameraPos - cameraAdjust), ClientUtilities.ConvertD(CameraPos - cameraAdjust + camforward), ClientUtilities.ConvertD(camup));
         PrimaryMatrix_OffsetFor3Dd = view2d * projd;
     }
     camFrust = new Frustum(PrimaryMatrixd);
     cf2 = new Frustum(PrimaryMatrix_OffsetFor3Dd);
     CFrust = camFrust;
     CheckError("AfterSetup");
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:50,代码来源:View3D.cs

示例2: LookAtLH

 public static Matrix LookAtLH(Location start, Location end, Location up)
 {
     Location zAxis = (end - start).Normalize();
     Location xAxis = up.CrossProduct(zAxis).Normalize();
     Location yAxis = zAxis.CrossProduct(xAxis);
     return new Matrix((double)xAxis.X, (double)yAxis.X, (double)zAxis.X, 0, (double)xAxis.Y,
         (double)yAxis.Y, (double)zAxis.Y, 0, (double)xAxis.Z, (double)yAxis.Z, (double)zAxis.Z, 0,
         (double)-xAxis.Dot(start), (double)-yAxis.Dot(start), (double)-zAxis.Dot(start), 1);
 }
开发者ID:Morphan1,项目名称:Voxalia,代码行数:9,代码来源:Utilities.cs


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