コード例 #1
0
ファイル: Part.cs プロジェクト: ext0/Flex
        private void RotationPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Engine.QueueForRenderDispatcher(() =>
            {
                if (_initialized)
                {
                    if (!e.PropertyName.Equals("NOPHYSICS"))
                    {
                        Mogre.Quaternion quaternion = new Mogre.Quaternion(_rotation.Matrix);
                        _sceneNode.SetOrientation((float)quaternion.w, (float)quaternion.x, (float)quaternion.y, (float)quaternion.z);
                        _rigidBody.SetPositionOrientation(new Mogre.Vector3(position.x + (size.x / 2), position.y + (size.y / 2), position.z + (size.z / 2)), _sceneNode.Orientation);
                    }

                    //LoadPhysicsStructure();

                    if (_showingBoundingBox)
                    {
                        Engine.QueueForNextRenderDispatcher(() =>
                        {
                        });
                    }
                }
            });
            NotifyPropertyChanged("Rotation");
        }
コード例 #2
0
        private void spin(Degree deg)
        {
            Mogre.Quaternion orient1 = control.Actor.GlobalOrientationQuaternion;

            Mogre.Vector3 rkAxis  = new Mogre.Vector3();
            Degree        rfAngle = new Degree();

            orient1.ToRotationMatrix().ToAxisAngle(out rkAxis, out rfAngle);
            Mogre.Quaternion orient2 = new Quaternion(new Radian(deg), new Mogre.Vector3(0, 1, 0));
            //control.Actor.GlobalOrientationQuaternion = orient2;
            //setOrient(orient2);
            setOrient(orient2);
        }
コード例 #3
0
        public void resetPlayer(Mogre.Vector3 loc, Mogre.Quaternion pose)
        {
            Event outevent = new Event();

            outevent._Keyword            = KeyWord.PLAYER_RESET;
            outevent._IntendedRecipients = EventTransfer.CLIENTTOCLIENT;
            outevent._Memories           = new Memories();
            outevent._Memories.Add(new Memory("", KeyWord.DATA_QUATERNION_W, pose.w.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_QUATERNION_X, pose.x.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_QUATERNION_Y, pose.y.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_QUATERNION_Z, pose.z.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_VECTOR3_X, loc.x.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_VECTOR3_Y, loc.y.ToString()));
            outevent._Memories.Add(new Memory("", KeyWord.DATA_VECTOR3_Z, loc.z.ToString()));
            this.outboxMessage(this, outevent);
        }
コード例 #4
0
        public override void ProcessParameters(Mogre.NameValuePairList parameters)
        {
            Mogre.NameValuePairList.Iterator ni;

            if ((ni = parameters.Find("Name")) != parameters.End())
            {
                this.name = ni.Value;
            }

            if ((ni = parameters.Find("Dimensions")) != parameters.End())
            {
                this.dimensions = MogreX.StringConverter.ParseVector4(ni.Value);
            }

            if ((ni = parameters.Find("Skies")) != parameters.End())
            {
                this.skies = Mogre.StringConverter.ParseBool(ni.Value);
            }

            if ((ni = parameters.Find("Shadows")) != parameters.End())
            {
                this.shadows = Mogre.StringConverter.ParseBool(ni.Value);
            }

            if ((ni = parameters.Find("Overlays")) != parameters.End())
            {
                this.overlays = Mogre.StringConverter.ParseBool(ni.Value);
            }

            if ((ni = parameters.Find("CamPosition")) != parameters.End())
            {
                this.camPosition = Mogre.StringConverter.ParseVector3(ni.Value);
            }

            if ((ni = parameters.Find("CamOrientation")) != parameters.End())
            {
                this.camOrientation = Mogre.StringConverter.ParseQuaternion(ni.Value);
            }

            if ((ni = parameters.Find("CamClipDistance")) != parameters.End())
            {
                this.camClipDistance = MogreX.StringConverter.ParseVector2(ni.Value);
            }

            if ((ni = parameters.Find("CamPolyMode")) != parameters.End())
            {
                this.camPolyMode = (Mogre.PolygonMode)Mogre.StringConverter.ParseInt(ni.Value);
                OnPropertyChanged("CamPolyMode");
            }

            if ((ni = parameters.Find("CamFOV")) != parameters.End())
            {
                this.camFOV = Mogre.StringConverter.ParseReal(ni.Value);
            }

            if ((ni = parameters.Find("Colour")) != parameters.End())
            {
                this.colour = Mogre.StringConverter.ParseColourValue(ni.Value);
            }

            this.compositorStorage.Clear();
            for (int cx = 0; cx < 100; ++cx)
            {
                string searchstr = "Compositor" + Mogre.StringConverter.ToString(cx);
                if ((ni = parameters.Find(searchstr + "Name")) != parameters.End())
                {
                    CompositorPush compData = new CompositorPush();
                    compData.Name    = ni.Value;
                    ni               = parameters.Find(searchstr + "Enabled");
                    compData.Enabled = Mogre.StringConverter.ParseBool(ni.Value);
                    this.compositorStorage.Add(compData);
                }
                else
                {
                    break;
                }
            }
        }
コード例 #5
0
ファイル: ViewportEditor.cs プロジェクト: andyhebear/likeleon
        public override void ProcessParameters(Mogre.NameValuePairList parameters)
        {
            Mogre.NameValuePairList.Iterator ni;

            if ((ni = parameters.Find("Name")) != parameters.End())
                this.name = ni.Value;

            if ((ni = parameters.Find("Dimensions")) != parameters.End())
                this.dimensions = MogreX.StringConverter.ParseVector4(ni.Value);

            if ((ni = parameters.Find("Skies")) != parameters.End())
                this.skies = Mogre.StringConverter.ParseBool(ni.Value);

            if ((ni = parameters.Find("Shadows")) != parameters.End())
                this.shadows = Mogre.StringConverter.ParseBool(ni.Value);

            if ((ni = parameters.Find("Overlays")) != parameters.End())
                this.overlays = Mogre.StringConverter.ParseBool(ni.Value);

            if ((ni = parameters.Find("CamPosition")) != parameters.End())
                this.camPosition = Mogre.StringConverter.ParseVector3(ni.Value);

            if ((ni = parameters.Find("CamOrientation")) != parameters.End())
                this.camOrientation = Mogre.StringConverter.ParseQuaternion(ni.Value);

            if ((ni = parameters.Find("CamClipDistance")) != parameters.End())
                this.camClipDistance = MogreX.StringConverter.ParseVector2(ni.Value);

            if ((ni = parameters.Find("CamPolyMode")) != parameters.End())
            {
                this.camPolyMode = (Mogre.PolygonMode)Mogre.StringConverter.ParseInt(ni.Value);
                OnPropertyChanged("CamPolyMode");
            }

            if ((ni = parameters.Find("CamFOV")) != parameters.End())
                this.camFOV = Mogre.StringConverter.ParseReal(ni.Value);

            if ((ni = parameters.Find("Colour")) != parameters.End())
                this.colour = Mogre.StringConverter.ParseColourValue(ni.Value);

            this.compositorStorage.Clear();
            for (int cx = 0; cx < 100; ++cx)
            {
                string searchstr = "Compositor" + Mogre.StringConverter.ToString(cx);
                if ((ni = parameters.Find(searchstr + "Name")) != parameters.End())
                {
                    CompositorPush compData = new CompositorPush();
                    compData.Name = ni.Value;
                    ni = parameters.Find(searchstr + "Enabled");
                    compData.Enabled = Mogre.StringConverter.ParseBool(ni.Value);
                    this.compositorStorage.Add(compData);
                }
                else
                    break;
            }
        }
コード例 #6
0
ファイル: GameCamera.cs プロジェクト: secred/Tachycardia
 public GameCamera()
 {
     //float mass = 1;
     m_Node = Core.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
     orientation = Mogre.Quaternion.IDENTITY;
 }
コード例 #7
0
ファイル: Helpers.cs プロジェクト: Serebriakov/rybrcoul-games
        /// <summary>
        /// Converts x, y and z axes rotations into quaternion.
        /// </summary>
        /// <param name="vec"></param>
        /// <returns></returns>
        public static Quaternion QFromV3(Vector3 vec)
        {
            Quaternion a = new Mogre.Quaternion(new Radian((float)(vec.x)), new Mogre.Vector3(1, 0, 0));
            Quaternion b = new Mogre.Quaternion(new Radian((float)(vec.y)), new Mogre.Vector3(0, 1, 0));
            Quaternion c = new Mogre.Quaternion(new Radian((float)(vec.z)), new Mogre.Vector3(0, 0, 1));

            Quaternion q = a * b * c;

            return q;
        }