protected void UpdateVelocity(double fElapsedTime) { XMVector vMouseDelta = m_vMouseDelta; XMVector vRotVelocity = vMouseDelta * m_fRotationScaler; m_vRotVelocity = vRotVelocity; XMVector vKeyboardDirection = m_vKeyboardDirection; XMVector vAccel = vKeyboardDirection; // Normalize vector so if moving 2 dirs (left & forward), // the camera doesn't move faster than if moving in 1 dir vAccel = XMVector3.Normalize(vAccel); // Scale the acceleration vector vAccel *= m_fMoveScaler; if (m_bMovementDrag) { // Is there any acceleration this frame? if (XMVector3.LengthSquare(vAccel).X > 0) { // If so, then this means the user has pressed a movement key // so change the velocity immediately to acceleration // upon keyboard input. This isn't normal physics // but it will give a quick response to keyboard input m_vVelocity = vAccel; m_fDragTimer = m_fTotalDragTimeToZero; m_vVelocityDrag = vAccel / (float)m_fDragTimer; } else { // If no key being pressed, then slowly decrease velocity to 0 if (m_fDragTimer > 0) { // Drag until timer is <= 0 XMVector vVelocity = m_vVelocity; XMVector vVelocityDrag = m_vVelocityDrag; vVelocity -= vVelocityDrag * (float)fElapsedTime; m_vVelocity = vVelocity; m_fDragTimer -= fElapsedTime; } else { // Zero velocity m_vVelocity = XMVector.Zero; } } } else { // No drag, so immediately change the velocity m_vVelocity = vAccel; } }
public void CreateWindowSizeDependentResources() { const float adaptive_scale_in_pixels = 15.0f; this.m_tess_edge_len_scale = new XMFloat2( this.deviceResources.BackBufferWidth * 0.5f / adaptive_scale_in_pixels, this.deviceResources.BackBufferHeight * 0.5f / adaptive_scale_in_pixels); }
public SimpleVertex(XMFloat3 pos, XMFloat2 tex) { this.Pos = pos; this.Tex = tex; }
public BasicVertex(XMFloat3 position, XMFloat3 normal, XMFloat2 textureCoordinates) { this.Position = position; this.Normal = normal; this.TextureCoordinates = textureCoordinates; }