public static void MoveForward(ref DX.Vector3 position, ref DX.Vector3 angles, float speed) { DX.Vector3 v = new DX.Vector3(); v.X += (float)System.Math.Sin(angles.X); v.Y += (float)System.Math.Cos(angles.Z); v.Z -= (float)System.Math.Tan(angles.Y); v.Normalize(); position += v * speed; v = DX.Vector3.Empty; }
public static void GetBoundingBox(D3D.Mesh mesh, out DX.Vector3 min, out DX.Vector3 max) { MeshObject.GetBoundingBox(mesh, 1.0f, out min, out max); }
public static void GetBoundingBox(D3D.Mesh mesh, float scale, out DX.Vector3 min, out DX.Vector3 max) { D3D.VertexBuffer verts = mesh.VertexBuffer; DX.GraphicsStream stream = verts.Lock(0, 0, D3D.LockFlags.None); D3D.Geometry.ComputeBoundingBox(stream, mesh.NumberVertices, mesh.VertexFormat, out min, out max); verts.Unlock(); stream = null; verts = null; }
public bool Intersect(DX.Vector3 rayPos, DX.Vector3 rayDir, out D3D.IntersectInformation closeHit, out D3D.IntersectInformation[] allHits) { return this._mesh.Intersect(rayPos, rayDir, out closeHit, out allHits); }
public bool Intersect(DX.Vector3 rayPos, DX.Vector3 rayDir, out D3D.IntersectInformation[] AllHits) { D3D.IntersectInformation dummy; return this.Intersect(rayPos, rayDir, out dummy, out AllHits); }
public bool Intersect(DX.Vector3 rayPos, DX.Vector3 rayDir, out D3D.IntersectInformation closeHit) { D3D.IntersectInformation[] dummy; return this.Intersect(rayPos, rayDir, out closeHit, out dummy); }
/// <summary> /// Determines if a given ray intersects this mesh. /// </summary> /// <param name="rayPos">The ray's point of origin.</param> /// <param name="rayDir">The ray's direction of travel.</param> /// <returns>A bool value indicating true if the ray passes through the mesh. Otherwise, false.</returns> public bool Intersect(DX.Vector3 rayPos, DX.Vector3 rayDir) { D3D.IntersectInformation dummy1; D3D.IntersectInformation[] dummy2; return this.Intersect(rayPos, rayDir, out dummy1, out dummy2); }
/// <summary> /// Helper method that converts a DX Matrix to our Matrix4. /// </summary> /// <param name="d3dMat"></param> /// <returns></returns> private Matrix4 ConvertD3DMatrix(ref DX.Matrix d3dMat) { Matrix4 mat = Matrix4.Zero; mat.m00 = d3dMat.M11; mat.m10 = d3dMat.M12; mat.m20 = d3dMat.M13; mat.m30 = d3dMat.M14; mat.m01 = d3dMat.M21; mat.m11 = d3dMat.M22; mat.m21 = d3dMat.M23; mat.m31 = d3dMat.M24; mat.m02 = d3dMat.M31; mat.m12 = d3dMat.M32; mat.m22 = d3dMat.M33; mat.m32 = d3dMat.M34; mat.m03 = d3dMat.M41; mat.m13 = d3dMat.M42; mat.m23 = d3dMat.M43; mat.m33 = d3dMat.M44; return mat; }