コード例 #1
0
ファイル: CityRendering.cs プロジェクト: nwrush/Snowflake
        public override void Update()
        {
            base.Update();

            Mogre.Degree ang = new Mogre.Degree((int)this.data.Facing);
            this.node.Orientation = baseRotation * new Quaternion(ang, Vector3.UNIT_Y);
        }
コード例 #2
0
        protected void setupTapMotion()
        {
            float l_Wiimote1XPosition = -1 * mWidth / 32;
            float l_Wiimote2XPosition = 1 * mWidth / 32;

            float l_StartingYPosition = mHeight / 1.5f;
            float l_EndingYPosition = -1 * mHeight / 1.5f;

            float l_StartingZPosition = -1 * mWidth / 2;
            float l_EndingZPosition = mWidth / 2;

            mNode = mSceneManager.RootSceneNode.CreateChildSceneNode("WiimoteNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_WimmoteTapMotionNode = mNode.CreateChildSceneNode("WiimoteTapMotionNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_Wiimote1LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote1LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote1LineNode, "Wiimote1LineNode", new Vector3(0f, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0f, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote1LineShoeNode = l_Wiimote1LineNode.CreateChildSceneNode("Wiimote1LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote1LineShoeNode, "WiimoteLine1Shoe");
            l_Wiimote1LineNode.Translate(l_Wiimote1XPosition, 0f, 0f);
            l_Wiimote1LineNode.Translate(0, 0f, 0f);

            SceneNode l_Wiimote2LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote2LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote2LineNode, "Wiimote2LineNode", new Vector3(0, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote2LineShoeNode = l_Wiimote2LineNode.CreateChildSceneNode("Wiimote2LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote2LineShoeNode, "WiimoteLine2Shoe");
            l_Wiimote2LineNode.Translate(l_Wiimote2XPosition, 0f, 0f);

            mWiimote1SceneNode = l_Wiimote1LineShoeNode.CreateChildSceneNode("Wiimote1SceneNode",
                new Vector3(0f, 0f, 0f));

            mWiimote2SceneNode = l_Wiimote2LineShoeNode.CreateChildSceneNode("Wiimote2SceneNode",
                new Vector3(0f, 0f, 0f));

            WiimoteOrgeControlCSVParser l_Parser = new WiimoteOrgeControlCSVParser();
            l_Parser.loadShapeData(mDynamicShapes);

            int l_ShapeIndex = 0;
            SceneNode l_SceneNode = null;

            Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
            Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);

            Mogre.Degree l_DegreeRollAngle = new Mogre.Degree(30);

            foreach (WiimoteOrgeControlShape l_Shape in mDynamicShapes)
            {
                l_ShapeIndex++;

                if (l_Shape.Foot.CompareTo(ProjectCommon.ProjectConstants.SHAPE_LEFT_FOOT) == 0)
                    l_SceneNode = mWiimote1SceneNode.CreateChildSceneNode("Wiimote1Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote1XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                else
                    l_SceneNode = mWiimote2SceneNode.CreateChildSceneNode("Wiimote2Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote2XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                l_SceneNode.Scale(2f, 2f, 2f);
                l_SceneNode.Yaw(l_ShoeYawAngle);
            //                l_SceneNode.Pitch(l_ShoePitchAngle);
            //                l_SceneNode.Roll(30);

                InitialShoeRollAngle = l_SceneNode.Orientation.Roll.ValueDegrees;
                InitialShoePitchAngle = l_SceneNode.Orientation.Pitch.ValueDegrees;

                mInitialShoeAxis = l_SceneNode.Orientation;
                mInitialShoeAxis.w = InitialShoeRollAngle;

                drawShoe(l_SceneNode, "Shoe" + l_ShapeIndex);

                //TODO : Need to get back movable text
                // create entity
            //                MovableText msg = new MovableText("txt001", l_Shape.Message, "BlueHighway", 6, new ColourValue(200, 50, 200));
            //                msg.SetTextAlignment(MovableText.HorizontalAlignment.H_CENTER, MovableText.VerticalAlignment.V_ABOVE);
            //                msg.AdditionalHeight = 8.0f;

                // attach to a SceneNode
            //                l_SceneNode.AttachObject(msg);

            }

            /*
            //            SceneNode l_TestShoeNode = mNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));
                        SceneNode l_TestShoeNode = SceneManager.RootSceneNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));

                        drawShoe(l_TestShoeNode,"TestShoe");
                        l_TestShoeNode.Scale(5f, 5f, 5f);
                        Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
                        l_TestShoeNode.Yaw(l_ShoeYawAngle.ValueRadians);
                        Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);
                        l_TestShoeNode.Pitch(l_ShoePitchAngle.ValueRadians);
                        */

            mNode.Translate(new Vector3(mWidth / 8, 0f, 0f));

            Mogre.Degree l_DegreeAngle = new Mogre.Degree(-15);
            //            l_WimmoteTapMotionNode.Yaw(l_DegreeAngle.ValueRadians);
            mQuatDirection = new Quaternion(l_DegreeAngle.ValueRadians, Vector3.UNIT_Z);

            mNode.Rotate(mQuatDirection);

            mDirection = new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8).NormalisedCopy;

            mTapNodePosition = mDirection;
        }
コード例 #3
0
        public bool FrameStarted(FrameEvent evt)
        {
            if (mWiimote1SceneNode.NumChildren() == 0)
                return true;

            float move = mWalkSpeed * evt.timeSinceLastFrame;

            mWiimote1SceneNode.Translate(mDirection * move);
            mWiimote2SceneNode.Translate(mDirection * move);

            SceneNode l_CheckNode = (SceneNode)mWiimote1SceneNode.GetChild(0);

            if ((l_CheckNode.Orientation.Pitch.ValueDegrees >= (InitialShoePitchAngle + MaxRotation) && ShoeRotationAngle > 0) ||
                (l_CheckNode.Orientation.Pitch.ValueDegrees < (InitialShoePitchAngle - MaxRotation) && ShoeRotationAngle < 0))
            {
                ShoeRotationAngle = ShoeRotationAngle * -1;
            }

            //            Console.Out.WriteLine("Initial Angle = " + InitialShoeRollAngle + " : Orientation = " + l_CheckNode.Orientation.Roll.ValueDegrees + "  mShoeRotationAngle = " + ShoeRotationAngle);
            Console.Out.WriteLine("Roll = " + l_CheckNode.Orientation.Roll.ValueDegrees + " : Pitch = " + l_CheckNode.Orientation.Pitch.ValueDegrees + " : Yaw = " + l_CheckNode.Orientation.Yaw.ValueDegrees + " : ShoeRotationAngle = " + ShoeRotationAngle);

            Mogre.Degree l_DegreeAngle = new Mogre.Degree(5);

            Node.ChildNodeIterator l_Iterator1 = mWiimote1SceneNode.GetChildIterator();

            foreach (SceneNode l_Node in l_Iterator1)
            {
            //                l_Node.Pitch(l_DegreeAngle.ValueRadians,  Node.TransformSpace.TS_PARENT);
                l_Node.Pitch(l_DegreeAngle.ValueRadians);
            }

            Node.ChildNodeIterator l_Iterator2 = mWiimote2SceneNode.GetChildIterator();
            foreach (SceneNode l_Node in l_Iterator2)
            {
            //                l_Node.Pitch(l_DegreeAngle.ValueRadians,  Node.TransformSpace.TS_PARENT);
                l_Node.Pitch(l_DegreeAngle.ValueRadians);
            }

            Mogre.Degree l_VideoAngle = new Mogre.Degree(Angle360Rotation);
            if (mCubeSceneNode != null)
                mCubeSceneNode.Yaw(l_VideoAngle.ValueRadians);

            return true;
        }
コード例 #4
0
        protected void setupTapMotion()
        {
            float l_Wiimote1XPosition = -1 * mWidth / 32;
            float l_Wiimote2XPosition = 1 * mWidth / 32;

            float l_StartingYPosition = mHeight / 1.5f;
            float l_EndingYPosition   = -1 * mHeight / 1.5f;

            float l_StartingZPosition = -1 * mWidth / 2;
            float l_EndingZPosition   = mWidth / 2;

            mNode = mSceneManager.RootSceneNode.CreateChildSceneNode("WiimoteNode",
                                                                     new Vector3(0f, 0f, 0f));

            SceneNode l_WimmoteTapMotionNode = mNode.CreateChildSceneNode("WiimoteTapMotionNode",
                                                                          new Vector3(0f, 0f, 0f));

            SceneNode l_Wiimote1LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote1LineNode",
                                                                                       new Vector3(0f, 0f, 0f));

            drawLine(l_Wiimote1LineNode, "Wiimote1LineNode", new Vector3(0f, l_StartingYPosition, l_StartingZPosition),
                     new Vector3(0f, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote1LineShoeNode = l_Wiimote1LineNode.CreateChildSceneNode("Wiimote1LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));

            drawCircle(l_Wiimote1LineShoeNode, "WiimoteLine1Shoe");
            l_Wiimote1LineNode.Translate(l_Wiimote1XPosition, 0f, 0f);
            l_Wiimote1LineNode.Translate(0, 0f, 0f);

            SceneNode l_Wiimote2LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote2LineNode",
                                                                                       new Vector3(0f, 0f, 0f));

            drawLine(l_Wiimote2LineNode, "Wiimote2LineNode", new Vector3(0, l_StartingYPosition, l_StartingZPosition),
                     new Vector3(0, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote2LineShoeNode = l_Wiimote2LineNode.CreateChildSceneNode("Wiimote2LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));

            drawCircle(l_Wiimote2LineShoeNode, "WiimoteLine2Shoe");
            l_Wiimote2LineNode.Translate(l_Wiimote2XPosition, 0f, 0f);

            mWiimote1SceneNode = l_Wiimote1LineShoeNode.CreateChildSceneNode("Wiimote1SceneNode",
                                                                             new Vector3(0f, 0f, 0f));

            mWiimote2SceneNode = l_Wiimote2LineShoeNode.CreateChildSceneNode("Wiimote2SceneNode",
                                                                             new Vector3(0f, 0f, 0f));

            WiimoteOrgeControlCSVParser l_Parser = new WiimoteOrgeControlCSVParser();

            l_Parser.loadShapeData(mDynamicShapes);

            int       l_ShapeIndex = 0;
            SceneNode l_SceneNode  = null;

            Mogre.Degree l_ShoeYawAngle   = new Mogre.Degree(90);
            Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);

            Mogre.Degree l_DegreeRollAngle = new Mogre.Degree(30);


            foreach (WiimoteOrgeControlShape l_Shape in mDynamicShapes)
            {
                l_ShapeIndex++;

                if (l_Shape.Foot.CompareTo(ProjectCommon.ProjectConstants.SHAPE_LEFT_FOOT) == 0)
                {
                    l_SceneNode = mWiimote1SceneNode.CreateChildSceneNode("Wiimote1Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote1XPosition,
                                                                                                                     l_StartingYPosition * l_Shape.Time,
                                                                                                                     l_StartingZPosition * l_Shape.Time));
                }
                else
                {
                    l_SceneNode = mWiimote2SceneNode.CreateChildSceneNode("Wiimote2Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote2XPosition,
                                                                                                                     l_StartingYPosition * l_Shape.Time,
                                                                                                                     l_StartingZPosition * l_Shape.Time));
                }
                l_SceneNode.Scale(2f, 2f, 2f);
                l_SceneNode.Yaw(l_ShoeYawAngle);
//                l_SceneNode.Pitch(l_ShoePitchAngle);
//                l_SceneNode.Roll(30);

                InitialShoeRollAngle  = l_SceneNode.Orientation.Roll.ValueDegrees;
                InitialShoePitchAngle = l_SceneNode.Orientation.Pitch.ValueDegrees;

                mInitialShoeAxis   = l_SceneNode.Orientation;
                mInitialShoeAxis.w = InitialShoeRollAngle;

                drawShoe(l_SceneNode, "Shoe" + l_ShapeIndex);

                //TODO : Need to get back movable text
                // create entity
//                MovableText msg = new MovableText("txt001", l_Shape.Message, "BlueHighway", 6, new ColourValue(200, 50, 200));
//                msg.SetTextAlignment(MovableText.HorizontalAlignment.H_CENTER, MovableText.VerticalAlignment.V_ABOVE);
//                msg.AdditionalHeight = 8.0f;

                // attach to a SceneNode
//                l_SceneNode.AttachObject(msg);
            }



            /*
             * //            SceneNode l_TestShoeNode = mNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));
             *          SceneNode l_TestShoeNode = SceneManager.RootSceneNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));
             *
             *          drawShoe(l_TestShoeNode,"TestShoe");
             *          l_TestShoeNode.Scale(5f, 5f, 5f);
             *          Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
             *          l_TestShoeNode.Yaw(l_ShoeYawAngle.ValueRadians);
             *          Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);
             *          l_TestShoeNode.Pitch(l_ShoePitchAngle.ValueRadians);
             */

            mNode.Translate(new Vector3(mWidth / 8, 0f, 0f));

            Mogre.Degree l_DegreeAngle = new Mogre.Degree(-15);
            //            l_WimmoteTapMotionNode.Yaw(l_DegreeAngle.ValueRadians);
            mQuatDirection = new Quaternion(l_DegreeAngle.ValueRadians, Vector3.UNIT_Z);

            mNode.Rotate(mQuatDirection);

            mDirection = new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8).NormalisedCopy;

            mTapNodePosition = mDirection;
        }
コード例 #5
0
 public Radian(Degree d)
 {
     _value = d.ValueRadians;
 }