亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dxmutmisc.cs

?? VC中使用C#作為腳本引擎編程
?? CS
?? 第 1 頁 / 共 5 頁
字號:
                case NativeMethods.WindowMessage.LeftButtonDown:
                case NativeMethods.WindowMessage.RightButtonDoubleClick:
                case NativeMethods.WindowMessage.RightButtonDown:
                case NativeMethods.WindowMessage.MiddleButtonDoubleClick:
                case NativeMethods.WindowMessage.MiddleButtonDown:
                {
                    // Compute the drag rectangle in screen coord.
                    System.Drawing.Point cursor = new System.Drawing.Point(
                        NativeMethods.LoWord((uint)lParam.ToInt32()),
                        NativeMethods.HiWord((uint)lParam.ToInt32()));

                    // Update the variable state
                    if ( ((msg == NativeMethods.WindowMessage.LeftButtonDown) ||
                        (msg == NativeMethods.WindowMessage.LeftButtonDoubleClick) )
                        && dragRectangle.Contains(cursor) )
                    {
                        isMouseLButtonDown = true; currentButtonMask |= (int)MouseButtonMask.Left;
                    }
                    if ( ((msg == NativeMethods.WindowMessage.MiddleButtonDown) ||
                        (msg == NativeMethods.WindowMessage.MiddleButtonDoubleClick) )
                        && dragRectangle.Contains(cursor) )
                    {
                        isMouseMButtonDown = true; currentButtonMask |= (int)MouseButtonMask.Middle;
                    }
                    if ( ((msg == NativeMethods.WindowMessage.RightButtonDown) ||
                        (msg == NativeMethods.WindowMessage.RightButtonDoubleClick) )
                        && dragRectangle.Contains(cursor) )
                    {
                        isMouseRButtonDown = true; currentButtonMask |= (int)MouseButtonMask.Right;
                    }

                    // Capture the mouse, so if the mouse button is 
                    // released outside the window, we'll get the button up messages
                    NativeMethods.SetCapture(hWnd);

                    lastMousePosition = System.Windows.Forms.Cursor.Position;
                    return true;
                }
                case NativeMethods.WindowMessage.LeftButtonUp:
                case NativeMethods.WindowMessage.RightButtonUp:
                case NativeMethods.WindowMessage.MiddleButtonUp:
                {
                    // Update member var state
                    if (msg == NativeMethods.WindowMessage.LeftButtonUp) { isMouseLButtonDown = false; currentButtonMask &= ~(int)MouseButtonMask.Left; }
                    if (msg == NativeMethods.WindowMessage.RightButtonUp) { isMouseRButtonDown = false; currentButtonMask &= ~(int)MouseButtonMask.Right; }
                    if (msg == NativeMethods.WindowMessage.MiddleButtonUp) { isMouseMButtonDown = false; currentButtonMask &= ~(int)MouseButtonMask.Middle; }

                    // Release the capture if no mouse buttons are down
                    if (!isMouseLButtonDown && !isMouseMButtonDown && !isMouseRButtonDown)
                    {
                        NativeMethods.ReleaseCapture();
                    }
                }
                    break;

                // Handle the mouse wheel
                case NativeMethods.WindowMessage.MouseWheel:
                    mouseWheelDelta = NativeMethods.HiWord((uint)wParam.ToInt32()) / 120;
                    break;
            }

            return false;
        }


        /// <summary>
        /// Reset the camera's position back to the default
        /// </summary>
        public virtual void Reset()
        {
            SetViewParameters(defaultEye, defaultLookAt);
        }

        /// <summary>
        /// Client can call this to change the position and direction of camera
        /// </summary>
        public unsafe virtual void SetViewParameters(Vector3 eyePt, Vector3 lookAtPt)
        {
            // Store the data
            defaultEye = eye = eyePt;
            defaultLookAt = lookAt = lookAtPt;

            // Calculate the view matrix
            viewMatrix = Matrix.LookAtLH(eye, lookAt, UpDirection);

            // Get the inverted matrix
            Matrix inverseView = Matrix.Invert(viewMatrix);

            // The axis basis vectors and camera position are stored inside the 
            // position matrix in the 4 rows of the camera's world matrix.
            // To figure out the yaw/pitch of the camera, we just need the Z basis vector
            Vector3* pZBasis = (Vector3*)&inverseView.M31;
            cameraYawAngle = (float)Math.Atan2(pZBasis->X, pZBasis->Z);
            float len = (float)Math.Sqrt(pZBasis->Z * pZBasis->Z + pZBasis->X * pZBasis->X);
            cameraPitchAngle = -(float)Math.Atan2(pZBasis->Y, len);
        }

        /// <summary>
        /// Calculates the projection matrix based on input params
        /// </summary>
        public virtual void SetProjectionParameters(float fov, float aspect, float near, float far)
        {
            // Set attributes for the projection matrix
            fieldOfView = fov;
            aspectRatio = aspect;
            nearPlane = near;
            farPlane = far;

            projMatrix = Matrix.PerspectiveFovLH(fov, aspect, near, far);
        }

        /// <summary>
        /// Figure out the mouse delta based on mouse movement
        /// </summary>
        protected void UpdateMouseDelta(float elapsedTime)
        {
            // Get the current mouse position
            System.Drawing.Point current = System.Windows.Forms.Cursor.Position;

            // Calculate how far it's moved since the last frame
            System.Drawing.Point delta = new System.Drawing.Point(current.X - lastMousePosition.X,
                current.Y - lastMousePosition.Y);

            // Record the current position for next time
            lastMousePosition = current;

            if (isResetCursorAfterMove)
            {
                // Set position of camera to center of desktop, 
                // so it always has room to move.  This is very useful
                // if the cursor is hidden.  If this isn't done and cursor is hidden, 
                // then invisible cursor will hit the edge of the screen 
                // and the user can't tell what happened
                System.Windows.Forms.Screen activeScreen = System.Windows.Forms.Screen.PrimaryScreen;
                System.Drawing.Point center = new System.Drawing.Point(activeScreen.Bounds.Width / 2,
                    activeScreen.Bounds.Height / 2);
                System.Windows.Forms.Cursor.Position = center;
                lastMousePosition = center;
            }

            // Smooth the relative mouse data over a few frames so it isn't 
            // jerky when moving slowly at low frame rates.
            float percentOfNew = 1.0f / framesToSmoothMouseData;
            float percentOfOld = 1.0f - percentOfNew;
            mouseDelta.X = mouseDelta.X*percentOfNew + delta.X*percentOfNew;
            mouseDelta.Y = mouseDelta.Y*percentOfNew + delta.Y*percentOfNew;

            rotationVelocity = mouseDelta * rotationScaler;
        }

        /// <summary>
        /// Figure out the velocity based on keyboard input & drag if any
        /// </summary>
        protected void UpdateVelocity(float elapsedTime)
        {
            Vector3 accel = Vector3.Empty;

            if (isEnablePositionMovement)
            {
                // Update acceleration vector based on keyboard state
                if (keys[(int)CameraKeys.MoveForward])
                    accel.Z += 1.0f;
                if (keys[(int)CameraKeys.MoveBackward])
                    accel.Z -= 1.0f;
                if (isEnableYAxisMovement)
                {
                    if (keys[(int)CameraKeys.MoveUp])
                        accel.Y += 1.0f;
                    if (keys[(int)CameraKeys.MoveDown])
                        accel.Y -= 1.0f;
                }
                if (keys[(int)CameraKeys.StrafeRight])
                    accel.X += 1.0f;
                if (keys[(int)CameraKeys.StrafeLeft])
                    accel.X -= 1.0f;
            }
            // Normalize vector so if moving 2 dirs (left & forward), 
            // the camera doesn't move faster than if moving in 1 dir
            accel.Normalize();
            // Scale the acceleration vector
            accel *= moveScaler;

            if (isMovementDrag)
            {
                // Is there any acceleration this frame?
                if (accel.LengthSq() > 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
                    velocity = accel;
                    dragTimer = totalDragTimeToZero;
                    velocityDrag = accel * (1 / dragTimer);
                }
                else
                {
                    // If no key being pressed, then slowly decrease velocity to 0
                    if (dragTimer > 0)
                    {
                        velocity -= (velocityDrag * elapsedTime);
                        dragTimer -= elapsedTime;
                    }
                    else
                    {
                        // Zero velocity
                        velocity = Vector3.Empty;
                    }
                }
            }
            else
            {
                // No drag, so immediately change the velocity
                velocity = accel;
            }
        }

        /// <summary>
        /// Clamps V to lie inside boundaries
        /// </summary>
        protected void ConstrainToBoundary(ref Vector3 v)
        {
            // Constrain vector to a bounding box 
            v.X = Math.Max(v.X, minBoundary.X);
            v.Y = Math.Max(v.Y, minBoundary.Y);
            v.Z = Math.Max(v.Z, minBoundary.Z);

            v.X = Math.Min(v.X, maxBoundary.X);
            v.Y = Math.Min(v.Y, maxBoundary.Y);
            v.Z = Math.Min(v.Z, maxBoundary.Z);

        }
    }

    /// <summary>
    /// Simple first person camera class that moves and rotates.
    /// It allows yaw and pitch but not roll.  It uses keyboard and 
    /// cursor to respond to keyboard and mouse input and updates the 
    /// view matrix based on input.  
    /// </summary>
    public class FirstPersonCamera : Camera
    {    
        // Mask to determine which button to enable for rotation
        protected int activeButtonMask = (int)(MouseButtonMask.Left | MouseButtonMask.Middle | MouseButtonMask.Right);
        // World matrix of the camera (inverse of the view matrix)
        protected Matrix cameraWorld;

        /// <summary>
        /// Update the view matrix based on user input & elapsed time
        /// </summary>
        public override void FrameMove(float elapsedTime)
        {
            // Reset the camera if necessary
            if (keys[(int)CameraKeys.Reset])
                Reset();

            // Get the mouse movement (if any) if the mouse buttons are down
            if ((activeButtonMask & currentButtonMask) != 0)
                UpdateMouseDelta(elapsedTime);

            // Get amount of velocity based on the keyboard input and drag (if any)
            UpdateVelocity(elapsedTime);

            // Simple euler method to calculate position delta
            Vector3 posDelta = velocity * elapsedTime;

            // If rotating the camera 
            if ((activeButtonMask & currentButtonMask) != 0)
            {
                // Update the pitch & yaw angle based on mouse movement
                float yawDelta   = rotationVelocity.X;
                float pitchDelta = rotationVelocity.Y;

                // Invert pitch if requested
                if (isInvertPitch)
                    pitchDelta = -pitchDelta;

                cameraPitchAngle += pitchDelta;
                cameraYawAngle   += yawDelta;

                // Limit pitch to straight up or straight down
                cameraPitchAngle = Math.Max(-(float)Math.PI/2.0f,  cameraPitchAngle);
                cameraPitchAngle = Math.Min(+(float)Math.PI/2.0f,  cameraPitchAngle);
            }

            // Make a rotation matrix based on the camera's yaw & pitch
            Matrix cameraRotation = Matrix.RotationYawPitchRoll(cameraYawAngle, cameraPitchAngle, 0 );

            // Transform vectors based on camera's rotation matrix
            Vector3 localUp = new Vector3(0,1,0);
            Vector3 localAhead = new Vector3(0,0,1);
            Vector3 worldUp = Vector3.TransformCoordinate(localUp, cameraRotation);
            Vector3 worldAhead = Vector3.TransformCoordinate(localAhead, cameraRotation);

            // Transform the position delta by the camera's rotation 
            Vector3 posDeltaWorld = Vector3.TransformCoordinate(posDelta, cameraRotation);
            if (!isEnableYAxisMovement)
                posDeltaWorld.Y = 0.0f;

            // Move the eye position 
            eye += posDeltaWorld;
            if (isClipToBoundary)
                ConstrainToBoundary(ref eye);

            // Update the lookAt position based on the eye position 
            lookAt = eye + worldAhead;

            // Update the view matrix
            viewMatrix = Matrix.LookAtLH(eye, lookAt, worldUp);
            cameraWorld = Matrix.Invert(viewMatrix);
        }

        /// <summary>
        /// Enable or disable each of the mouse buttons for rotation drag.
        /// </summary>
        public void SetRotationButtons(bool left, bool middle, bool right)
        {
            activeButtonMask = (left ? (int)MouseButtonMask.Left : 0) |
                (mi

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品嫩草影院久久| 在线免费一区三区| 精品福利一区二区三区| 蜜臀a∨国产成人精品| 日韩午夜精品视频| 久久精品免费观看| 日韩精品一区二| 国产馆精品极品| 中文字幕五月欧美| 欧美性一级生活| 免费成人在线播放| 中文乱码免费一区二区| 色综合天天综合在线视频| 亚洲成人av中文| 精品国产乱码久久| 波多野结衣在线一区| 一区二区三区高清| 欧美成人video| 成人动漫av在线| 亚洲一线二线三线久久久| 日韩一级高清毛片| 成人黄色软件下载| 日韩vs国产vs欧美| 国产亚洲综合在线| 欧美亚洲高清一区二区三区不卡| 日韩精品一二三区| 欧美激情自拍偷拍| 欧美浪妇xxxx高跟鞋交| 国产在线播放一区三区四| 中文字幕在线观看一区二区| 制服丝袜亚洲网站| 亚洲欧美区自拍先锋| 亚洲小说春色综合另类电影| 成人一区在线看| 亚洲小说春色综合另类电影| 精品国产一区二区三区不卡 | 国产一区二区在线观看视频| 国产精品久久久久久福利一牛影视 | 亚洲精品videosex极品| 日韩一区二区精品在线观看| 成人91在线观看| 美国一区二区三区在线播放| 国产精品免费人成网站| 欧美一级片免费看| 91麻豆文化传媒在线观看| 精品一区二区三区在线播放视频| 亚洲色图视频免费播放| 26uuu精品一区二区三区四区在线| 91麻豆高清视频| 国产一区二区免费视频| 五月婷婷久久丁香| 亚洲欧美成人一区二区三区| 久久久精品tv| 欧美一区二区三区免费观看视频| 色综合久久六月婷婷中文字幕| 国产剧情一区在线| 奇米影视7777精品一区二区| 亚洲精品ww久久久久久p站| 国产三级欧美三级日产三级99| 这里是久久伊人| 91麻豆精品在线观看| 国产91色综合久久免费分享| 日韩福利视频网| 亚洲综合男人的天堂| 国产精品传媒视频| 国产视频在线观看一区二区三区| 欧美va在线播放| 日韩亚洲欧美在线| 欧美美女激情18p| 在线观看视频91| 91香蕉视频mp4| av午夜一区麻豆| 丁香五精品蜜臀久久久久99网站| 国内不卡的二区三区中文字幕| 日韩精品成人一区二区三区| 亚洲bt欧美bt精品| 亚洲午夜激情网站| 亚洲一区二区高清| 亚洲香蕉伊在人在线观| 一区二区在线观看av| 日韩理论片在线| 亚洲免费av网站| 亚洲视频1区2区| 亚洲精品你懂的| 一区二区在线免费| 午夜日韩在线观看| 三级影片在线观看欧美日韩一区二区| 午夜精品一区二区三区免费视频 | 亚洲激情五月婷婷| 亚洲精品国产a| 一区二区三区四区视频精品免费 | 欧美亚洲另类激情小说| 欧美日韩国产一二三| 制服丝袜亚洲色图| 欧美精品一区二区三区视频| 欧美精品一区二区三区在线播放| 国产午夜亚洲精品不卡| 国产精品久久久久影院亚瑟| 中文av一区特黄| 一区二区三区四区五区视频在线观看| 亚洲第一福利视频在线| 免费在线观看精品| 国产精品一线二线三线| av动漫一区二区| 欧美色男人天堂| 精品免费视频.| 国产精品国产a| 午夜精品一区二区三区三上悠亚| 久久99国产精品麻豆| 福利一区福利二区| 欧美自拍偷拍午夜视频| 精品国产一区二区三区不卡| 国产精品短视频| 热久久国产精品| 成人妖精视频yjsp地址| 欧美写真视频网站| 精品99一区二区三区| 亚洲欧美国产高清| 麻豆国产精品官网| 成人高清在线视频| 欧美久久久久久久久| 国产精品色眯眯| 日韩精品三区四区| 不卡一卡二卡三乱码免费网站| 欧美性猛交xxxx乱大交退制版 | 国产精品一区三区| 欧美日韩一区成人| 中文字幕精品一区二区精品绿巨人 | 欧美性受xxxx| 久久久一区二区三区捆绑**| 亚洲电影中文字幕在线观看| 国产一区久久久| 欧美乱妇一区二区三区不卡视频| 久久久久高清精品| 日韩精品一级中文字幕精品视频免费观看| 国产精品综合一区二区| 欧美日韩你懂得| 国产精品欧美一区喷水| 日韩在线播放一区二区| 成人福利在线看| 精品国产三级电影在线观看| 亚洲精品乱码久久久久久| 国产suv精品一区二区三区| 日韩午夜精品电影| 亚洲愉拍自拍另类高清精品| 成人性生交大片免费看中文网站| 51精品秘密在线观看| 一区二区三区产品免费精品久久75| 国产一区二区看久久| 91精品国产91热久久久做人人| 亚洲欧洲精品一区二区三区| 国产美女久久久久| 欧美不卡一区二区三区| 亚洲一二三四在线观看| 91蜜桃在线观看| 国产欧美综合在线| 国产中文字幕一区| 日韩免费电影一区| 蜜臀va亚洲va欧美va天堂| 欧美日韩国产另类一区| 亚洲嫩草精品久久| caoporen国产精品视频| 欧美激情在线一区二区| 国产精品18久久久久久久久久久久| 日韩精品影音先锋| 日韩中文欧美在线| 欧美日韩国产一二三| 午夜欧美电影在线观看| 欧美影院午夜播放| 亚洲综合久久av| 欧美日韩精品系列| 亚洲午夜免费视频| 欧美性极品少妇| 亚洲成av人影院| 欧美日本韩国一区| 日韩电影在线观看电影| 欧美一区二区三区爱爱| 毛片av一区二区| 久久久久国产一区二区三区四区| 国产美女精品人人做人人爽| 中文字幕高清不卡| 色综合久久88色综合天天6 | 亚洲成av人影院在线观看网| 欧美狂野另类xxxxoooo| 麻豆视频一区二区| 国产亚洲一二三区| 91欧美一区二区| 亚洲最新在线观看| 666欧美在线视频| 韩国成人福利片在线播放| 欧美国产精品久久| 在线观看视频一区二区欧美日韩| 午夜精品免费在线| 久久麻豆一区二区| 色综合久久中文综合久久97 | 久久久久久久久99精品| 成人黄色小视频在线观看| 一区二区在线看| 日韩一级欧美一级| 成人精品国产一区二区4080|