示例#1
0
        void GetDimensions()
        {
            TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel;

            windowwidth  = RendererFactory.GetInstance().WindowWidth;
            windowheight = RendererFactory.GetInstance().WindowHeight;

            mapwidth  = terrain.MapWidth;
            mapheight = terrain.MapHeight;

            double mapheightwidthratio = terrain.MapHeight / terrain.MapWidth;

            minimapwidth  = 0;
            minimapheight = 0;
            if (mapheightwidthratio > 1)
            {
                minimapheight = minimapsize;
                minimapwidth  = (int)(minimapsize / mapheightwidthratio);
            }
            else
            {
                minimapwidth  = minimapsize;
                minimapheight = (int)(minimapsize * mapheightwidthratio);
            }
        }
示例#2
0
        //! Draws hardcoded platern that we start over
        //! This is a temporary function since land will be migrated to the databse
        void DrawLandscape()
        {
            IPicker3dModel picker3dmodel = RendererFactory.GetPicker3dModel();

            int i, iy;

            // Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, new float[]{(float)rand.GetRandomFloat(0,1), 0.7f, 0.2f, 1.0f});
            Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, new float[] { 0.7f, 0.7f, 0.2f, 1.0f });

            int iLandCoord = 0;

            for (iy = -10; iy <= 10; iy++)
            {
                for (i = -10; i <= 10; i++)
                {
                    LandCoords[iLandCoord] = new Vector2(-10.0F + i * 1.0F, -10.0F + iy * 1.0F);
                    picker3dmodel.AddHitTarget(new HitTargetLandCoord(iLandCoord));

                    graphics.PushMatrix();

                    graphics.Translate(-10.0F + i * 1.0F, -10.0F + iy * 1.0F, MetaverseClient.GetInstance().fHeight - 0.5);
                    graphics.DrawCube();

                    graphics.PopMatrix();
                    iLandCoord++;
                }
            }
        }
        //public void Load()
        //{
        //  Load(Config.GetInstance().defaultHeightMapFilename);
        //}

        public void Load(string filename)
        {
            //Bitmap bitmap = Bitmap.FromFile(filename) as Bitmap;
            //Bitmap bitmap = DevIL.DevIL.LoadBitmap(filename);
            ImageWrapper image  = new ImageWrapper(filename);
            int          width  = image.Width;
            int          height = image.Height;

            MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapWidth = width;
            MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapHeight = height;
            MetaverseClient.GetInstance().worldstorage.terrainmodel.Map = new double[width, height];
            LogFile.WriteLine("loaded bitmap " + width + " x " + height);
            double minheight        = Config.GetInstance().mingroundheight;
            double maxheight        = Config.GetInstance().maxgroundheight;
            double heightmultiplier = (maxheight - minheight) / 255;

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    MetaverseClient.GetInstance().worldstorage.terrainmodel.Map[i, j] = (float)(minheight +
                                                                                                heightmultiplier *
                                                                                                image.GetBlue(i, j));
                }
            }
            MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightmapFilename = filename;
            MetaverseClient.GetInstance().worldstorage.terrainmodel.OnTerrainModified();
            MainTerrainWindow.GetInstance().InfoMessage("Heightmap loaded");
        }
示例#4
0
 public HeightScaleDialog()
 {
     Glade.XML app = new Glade.XML(EnvironmentHelper.GetExeDirectory() + "/TerrainEditing.glade", "heightscaledialog", "");
     app.Autoconnect(this);
     minimumheightentry.Text = MetaverseClient.GetInstance().worldstorage.terrainmodel.MinHeight.ToString();
     maximumheightentry.Text = MetaverseClient.GetInstance().worldstorage.terrainmodel.MaxHeight.ToString();
 }
示例#5
0
        void on_btnok_clicked(object o, EventArgs e)
        {
            try
            {
                double minimumheight = Convert.ToDouble(minimumheightentry.Text);
                double maximumheight = Convert.ToDouble(maximumheightentry.Text);
                if (minimumheight >= maximumheight)
                {
                    new MessageBox(MessageBox.MessageType.Warning, "Issue:", "Maximum height should be greater than minimum height", null);
                    return;
                }
                bool Scale = radioScale.Active;
                //CmdHeightScaleChange.Operation operation = CmdHeightScaleChange.Operation.Scale;
                //if (clip)
                //{
                //operation = CmdHeightScaleChange.Operation.Clip;
                //}
                //Console.WriteLine(operation);
                //heightscaledialog.Hide();

                MetaverseClient.GetInstance().worldstorage.terrainmodel.ChangeHeightScale(minimumheight, maximumheight, Scale);

                heightscaledialog.Destroy();
            }
            //catch( Exception ex )
            catch
            {
                //Console.WriteLine(ex);
                new MessageBox(MessageBox.MessageType.Warning, "Issue:", "Maximum height should be greater than minimum height", null);
                return;
            }
        }
示例#6
0
        public void ApplyBrush(IBrushShape brushshape, int brushsize, double brushcentre_x, double brushcentre_y, bool israising, double milliseconds)
        {
            TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel;

            double[,] mesh = terrain.Map;

            int x = (int)(brushcentre_x);
            int y = (int)(brushcentre_y);

            double timemultiplier = milliseconds * speed;
            int    meshsize       = mesh.GetUpperBound(0) + 1;

            for (int i = -brushsize; i <= brushsize; i++)
            {
                for (int j = -brushsize; j <= brushsize; j++)
                {
                    int thisx = x + i;
                    int thisy = y + j;
                    if (thisx >= 0 && thisy >= 0 && thisx < meshsize &&
                        thisy < meshsize)
                    {
                        double brushshapecontribution = brushshape.GetStrength((double)i / brushsize, (double)j / brushsize);
                        if (brushshapecontribution > 0)
                        {
                            mesh[thisx, thisy] = mesh[thisx, thisy] + (mesh[x, y] - mesh[thisx, thisy]) * brushshapecontribution * timemultiplier / 50;
                        }
                    }
                }
            }
            terrain.OnHeightMapInPlaceEdited(x - brushsize, y - brushsize, x + brushsize, y + brushsize);
        }
示例#7
0
        void renderableminimap_Render(int minimapleft, int minimaptop, int minimapwidth, int minimapheight)
        {
            //Console.WriteLine("renderableminimap_Render");
            Vector3 intersectpoint = EditingHelper.GetIntersectPoint();

            if (intersectpoint != null)
            {
                Vector2 minimappos = new Vector2(intersectpoint.x * minimapwidth / MetaverseClient.GetInstance().worldstorage.terrainmodel.MapWidth,
                                                 intersectpoint.y * minimapheight / MetaverseClient.GetInstance().worldstorage.terrainmodel.MapHeight);

                //Console.WriteLine("minmappos: " + minimappos);
                //double distancefromcamera = (intersectpoint - camerapos).Det();
                GraphicsHelperFactory.GetInstance().SetMaterialColor(new Color(0, 0, 1));
                Gl.glPushMatrix();
                Gl.glDisable(Gl.GL_LIGHTING);
                Gl.glDisable(Gl.GL_CULL_FACE);
                Gl.glColor3ub(0, 0, 255);
                Gl.glBegin(Gl.GL_POINTS);
                Gl.glVertex2d(minimapleft + minimappos.x, minimaptop + minimappos.y);
                Gl.glEnd();
                Gl.glEnable(Gl.GL_CULL_FACE);
                Gl.glEnable(Gl.GL_LIGHTING);
                Gl.glColor3ub(255, 255, 255);
                //Gl.glTranslated(intersectpoint.x, intersectpoint.y, intersectpoint.z);
                //Gl.glScaled(0.01 * distancefromcamera, 0.01 * distancefromcamera, 0.01 * distancefromcamera);
                //GraphicsHelperFactory.GetInstance().DrawSphere();
                Gl.glPopMatrix();
            }
        }
示例#8
0
        void btnok_Clicked(object sender, EventArgs e)
        {
            string ipaddress  = entryserveripaddress.Text;
            string portstring = entryserverport.Text;

            if (ipaddress == "")
            {
                return;
            }
            if (portstring == "")
            {
                return;
            }
            int port = 0;

            try
            {
                port = Convert.ToInt32(portstring);
            }
            catch
            {
                return;
            }
            LogFile.WriteLine("ConnectToServerDialog, connecting to " + ipaddress + " " + port);
            MetaverseClient.GetInstance().ConnectToServer(ipaddress, port);
        }
示例#9
0
 public void ToggleObjectInSelection(Entity thisentity, bool bSelectParentObject)
 {
     // Test.Debug(  "trying to toggle selection for object refrenence " + thisentity.ToString() );
     //Entity thisentity = worldstorage.GetEntityByReference( iReference );
     if (thisentity != null)
     {
         if (thisentity.Parent != null && bSelectParentObject)
         {
             //  Test.Debug(  "This object has a parent " + thisentity.Parent.ToString() + " trying that..." );
             ToggleObjectInSelection(thisentity.Parent, true);
         }
         else
         {
             // check it's not an avatar, or, if it is, that its us :-O
             if (thisentity.GetType() != typeof(Avatar) || thisentity == MetaverseClient.GetInstance().myavatar)
             {
                 if (SelectedObjects.Contains(thisentity))
                 {
                     SelectedObjects.Remove(thisentity);
                     NotifyObservers();
                     Test.Debug("Removing object from selection");
                 }
                 else
                 {
                     Test.Debug("Adding object to selection");
                     SelectedObjects.Add(thisentity);
                     NotifyObservers();
                     Test.Debug("object added");
                 }
             }
         }
     }
 }
示例#10
0
        List <MapTextureStageModel> LoadTextureStages(string sm3directory, TdfParser.Section terrainsection)
        {
            int numstages = terrainsection.GetIntValue("numtexturestages");
            List <MapTextureStageModel> stages = new List <MapTextureStageModel>();
            TerrainModel terrainmodel          = MetaverseClient.GetInstance().worldstorage.terrainmodel;

            for (int i = 0; i < numstages; i++)
            {
                TdfParser.Section texstagesection    = terrainsection.SubSection("texstage" + i);
                string            texturename        = texstagesection.GetStringValue("source");
                string            blendertexturename = texstagesection.GetStringValue("blender");
                string            operation          = texstagesection.GetStringValue("operation").ToLower();

                int          tilesize;
                ImageWrapper splattexture = LoadSplatTexture(sm3directory, terrainsection, texturename, out tilesize);
                if (operation == "blend")
                {
                    ImageWrapper blendtexture = LoadBlendTexture(sm3directory, terrainsection, blendertexturename);
                    stages.Add(new MapTextureStageModel(MapTextureStageModel.OperationType.Blend, tilesize, splattexture, blendtexture));
                }
                else // todo: add other operations
                {
                    stages.Add(new MapTextureStageModel(MapTextureStageModel.OperationType.Replace, tilesize, splattexture));
                }
            }
            terrainmodel.texturestages = stages;
            return(stages);
        }
示例#11
0
 public EditController()
 {
     CommandCombos.GetInstance().RegisterAtLeastCommand("increaseheight", new KeyCommandHandler(handler_IncreaseHeight));
     CommandCombos.GetInstance().RegisterAtLeastCommand("decreaseheight", new KeyCommandHandler(handler_DecreaseHeight));
     MetaverseClient.GetInstance().Tick     += new MetaverseClient.TickHandler(EditController_Tick);
     ViewerState.GetInstance().StateChanged += new ViewerState.StateChangedHandler(EditController_StateChanged);
 }
示例#12
0
        void terrainmodel_TerrainModified()
        {
            TerrainModel terrainmodel = MetaverseClient.GetInstance().worldstorage.terrainmodel;

            WorldBoundingBoxMin = new Vector3(0, 0, terrainmodel.MinHeight);
            WorldBoundingBoxMax = new Vector3(terrainmodel.MapWidth, terrainmodel.MapHeight, terrainmodel.MaxHeight);
            LogFile.WriteLine("PlayerMovement, new boundingbox " + WorldBoundingBoxMin + " < (x,y,z0 < " + WorldBoundingBoxMax);
        }
示例#13
0
        public SelectionModel()
        {
            Test.Debug("Instantiating SelectionModel");

            worldstorage              = MetaverseClient.GetInstance().worldstorage;
            worldstorage.ClearEvent  += new ClearHandler(this.ClearHandler);
            worldstorage.AfterDelete += new AfterDeleteHandler(this.DeleteEntityHandler);
        }
示例#14
0
 void GotServerInfo_nowconnect( string servername, XmlCommands.ServerInfo serverinfo )
 {
     LogFile.WriteLine( "showserversdialog.GotServerInfo_nowconnect, got serverinfo: " + serverinfo );
     MetaverseClient.GetInstance().network.NewConnection += new Level2NewConnectionHandler( network_NewConnection );
     this.servername = servername;
     MetaverseClient.GetInstance().ConnectToServer(
         new IPAddress( serverinfo.IPAddress ).ToString(), serverinfo.port );
 }
示例#15
0
 public void AssignColor(int FaceNumber, Color color)
 {
     if (entity is FractalSplinePrim)
     {
         ((FractalSplinePrim)entity).SetColor(FaceNumber, color);
         MetaverseClient.GetInstance().worldstorage.OnModifyEntity(entity);
     }
 }
示例#16
0
 public void AssignTexture( int FaceNumber, Uri uri )
 {
     if( entity is FractalSplinePrim )
     {
         ((FractalSplinePrim)entity).SetTexture( FaceNumber, uri );
         MetaverseClient.GetInstance().worldstorage.OnModifyEntity(entity);
     }
 }
示例#17
0
        void Init()
        {
            int width  = (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapWidth - 1) / 64;
            int height = (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightMapHeight - 1) / 64;

            widthentry.Entry.Text  = width.ToString();
            heightentry.Entry.Text = height.ToString();
        }
示例#18
0
        public void InteractiveFreeEdit(bool bAltAxes, int x, int y)
        {
            Entity entity = selectionmodel.GetFirstSelectedEntity();

            if (entity == null)
            {
                return;
            }

            Vector3 OurPos;
            Rot     OurRot;

            if (camera.bRoamingCameraEnabled)
            {
                OurPos = camera.RoamingCameraPos;
                OurRot = camera.RoamingCameraRot;
            }
            else
            {
                Avatar ouravatar = MetaverseClient.GetInstance().myavatar;
                if (ouravatar != null)
                {
                    OurPos = ouravatar.pos;
                    OurRot = ouravatar.rot;
                }
                else
                {
                    return;
                }
            }

            double HalfWinWidth  = RendererFactory.GetInstance().WindowWidth / 2;
            double HalfWinHeight = RendererFactory.GetInstance().WindowHeight / 2;

            Vector3 translatevector = new Vector3();

            if (bAltAxes)
            {
                translatevector = new Vector3(
                    -(( double )(x - editing3d.iDragStartX)) / HalfWinWidth * 3.0,
                    -(( double )(y - editing3d.iDragStartY)) / HalfWinWidth * 3.0,
                    0
                    );
            }
            else
            {
                translatevector = new Vector3(
                    0,
                    -((double)(x - editing3d.iDragStartX)) / HalfWinWidth * 3.0,
                    -((double)(y - editing3d.iDragStartY)) / HalfWinWidth * 3.0
                    );
            }

            Vector3 PosChangeWorldAxes = translatevector * OurRot.Inverse();

            entity.pos = editing3d.startpos + PosChangeWorldAxes;
            MetaverseClient.GetInstance().worldstorage.OnModifyEntity(entity);
        }
示例#19
0
 ServerInfo()
 {
     if (MetaverseServer.GetInstance().Running)
     {
         ContextMenuController.GetInstance().RegisterPersistentContextMenu(new string[] { "Network", "&Server Info..." }, new ContextMenuHandler(ServerInfoDialog));
         //ContextMenuController.GetInstance().RegisterPersistentContextMenu( new string[] { "Network", "&Private server Info..." }, new ContextMenuHandler( PrivateServerInfoDialog ) );
         MetaverseClient.GetInstance().Tick += new MetaverseClient.TickHandler(ServerInfo_Tick);
     }
 }
示例#20
0
        UIController()
        {
            MetaverseClient.GetInstance().Tick += new MetaverseClient.TickHandler(UIController_Tick);
            Application.Init();

            contextmenu = new UIContextMenu();

            new MessageBox(MessageBox.MessageType.Info, "Movement", "Middle mouse button to mouselook, asdf or arrowkeys to move, e and c to fly", null);
        }
示例#21
0
 void on_save_sm3_activate(object o, EventArgs e)
 {
     if (MetaverseClient.GetInstance().worldstorage.terrainmodel.Sm3Filename == "")
     {
         on_save_sm3_as1_activate(o, e);
         return;
     }
     Sm3Persistence.GetInstance().SaveSm3(MetaverseClient.GetInstance().worldstorage.terrainmodel.Sm3Filename);
 }
示例#22
0
 void on_btnAddStage_clicked(object o, EventArgs e)
 {
     //MapTextureStage maptexturestage = GetSelectedMapTextureStage();
     //if (maptexturestage != null)
     //{
     MetaverseClient.GetInstance().worldstorage.terrainmodel.texturestages.Add(new MapTextureStageModel(MapTextureStageModel.OperationType.Blend));
     terrain.OnTerrainModified();
     //}
 }
示例#23
0
        void NewHeightMap(int heightmapwidth, int heightmapheight)
        {
            TerrainModel terrain = MetaverseClient.GetInstance().worldstorage.terrainmodel;

            terrain.HeightMapWidth    = heightmapwidth;
            terrain.HeightMapHeight   = heightmapheight;
            terrain.Map               = new double[terrain.HeightMapWidth, terrain.HeightMapHeight];
            terrain.HeightmapFilename = "";
            terrain.OnTerrainModified();
        }
示例#24
0
        public static void Create(object source, ContextMenuArgs e)
        {
            EntityCreationProperties buildproperties = new EntityCreationProperties(e.MouseX, e.MouseY);

            FractalSplineBox newentity = new FractalSplineBox();

            buildproperties.WriteToEntity(newentity, "Box");

            MetaverseClient.GetInstance().worldstorage.AddEntity(newentity);
        }
示例#25
0
        // need to add a publisher/subscriber to this ;-)
        public void Restore(string filename)
        {
            WorldModel worldmodel = MetaverseClient.GetInstance().worldstorage;

            //// note to self: should make these types a publisher/subscriber thing
            //XmlSerializer serializer = new XmlSerializer( worldmodel.entities.GetType(), new Type[]{
            //   typeof( Avatar ),
            //  typeof( FractalSplineCylinder ),
            //  //typeof( FractalSplineRing ),
            //  typeof( FractalSplineBox )
            // } );
            //FileStream filestream = new FileStream( filename, FileMode.Open );
            //worldmodel.entities = (EntityArrayList)serializer.Deserialize( filestream );

/*
 *          <type val="0" />
 * <position x="5.25000047684" y="7.75" z="8.75" />
 * <rotation x="0.707107126713" y="-0.707106411457" z="-1.1520197063e-007" s="6.65917468723e-007" />
 * <size x="4.75" y="10.0" z="0.10000000149" />
 * <cut x="0.0" y="1.0" />
 * <dimple x="0.0" y="1.0" />
 * <advancedcut x="0.0" y="1.0" />
 * <hollow val="0" />
 * <twist x="0" y="0" />
 * <topsize x="1.0" y="1.0" />
 * <holesize x="1.0" y="0.5" />
 * <topshear x="0.0" y="0.0" />
 * <taper x="0.0" y="0.0" />
 * <revolutions val="1.0" />
 * <radiusoffset val="0.0" />
 * <skew val="0.0" />
 * <material val="3" />
 * <hollowshape val="0" />
 */

            worldmodel.entities.Clear();
            XmlDocument primsdom = XmlHelper.OpenDom(filename);

            foreach (XmlElement primitiveelement in primsdom.DocumentElement.SelectNodes("primitive"))
            {
                FractalSplineBox newbox            = new FractalSplineBox();
                XmlElement       propertieselement = primitiveelement.SelectSingleNode("properties") as XmlElement;
                newbox.pos    = new Vector3(primitiveelement.SelectSingleNode("properties/position") as XmlElement);
                newbox.rot    = new Rot(primitiveelement.SelectSingleNode("properties/rotation") as XmlElement);
                newbox.scale  = new Vector3(primitiveelement.SelectSingleNode("properties/size") as XmlElement);
                newbox.Hollow = Convert.ToInt32((propertieselement.SelectSingleNode("hollow") as XmlElement).GetAttribute("val").ToString());
                // newbox.Twist = Convert.ToInt32( propertieselement.SelectSingleNode( "twist" ) as XmlElement ).GetAttribute("x" ).ToString() );
                newbox.TopSizeX = Convert.ToDouble((propertieselement.SelectSingleNode("topsize") as XmlElement).GetAttribute("x").ToString());
                newbox.TopSizeY = Convert.ToDouble((propertieselement.SelectSingleNode("topsize") as XmlElement).GetAttribute("y").ToString());
                newbox.CutStart = (int)(Convert.ToDouble((propertieselement.SelectSingleNode("cut") as XmlElement).GetAttribute("x").ToString()) * 200);
                newbox.CutEnd   = (int)(Convert.ToDouble((propertieselement.SelectSingleNode("cut") as XmlElement).GetAttribute("y").ToString()) * 200);
                worldmodel.entities.Add(newbox);
            }
        }
示例#26
0
 public void Save()
 {
     if (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightmapFilename != "")
     {
         Save(MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightmapFilename);
     }
     //else
     //{
     //  Save(Config.GetInstance().defaultHeightMapFilename);
     //}
 }
示例#27
0
 void on_btnHeightMapSave_clicked(object o, EventArgs e)
 {
     if (MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightmapFilename != "")
     {
         HeightMapPersistence.GetInstance().Save(MetaverseClient.GetInstance().worldstorage.terrainmodel.HeightmapFilename);
     }
     else
     {
         on_btnHeightmapSaveAs_clicked(o, e);
     }
 }
示例#28
0
 void FixedHeight_TerrainModified()
 {
     minheight = MetaverseClient.GetInstance().worldstorage.terrainmodel.MinHeight;
     maxheight = MetaverseClient.GetInstance().worldstorage.terrainmodel.MaxHeight;
     LogFile.WriteLine("FixedHeight_terrainmodified " + minheight + " " + maxheight);
     if (heightscale != null)
     {
         heightscale.SetRange(minheight, maxheight);
         lastheight = Math.Min(maxheight, lastheight);
         lastheight = Math.Max(minheight, lastheight);
     }
 }
示例#29
0
        public static void Create(object source, ContextMenuArgs e)
        {
            EntityCreationProperties buildproperties = new EntityCreationProperties(e.MouseX, e.MouseY);

            SimpleCone prim = new SimpleCone();

            prim.pos   = buildproperties.pos;
            prim.rot   = buildproperties.rot;
            prim.scale = new Vector3(0.2, 0.2, 0.2);
            prim.name  = "new cube";

            MetaverseClient.GetInstance().worldstorage.AddEntity(prim);
        }
示例#30
0
        //public void MouseDown(string command, bool down)
        //{
        //Test.Debug("Playermovement MouseDown " + e.ToString() );
        //LogFile.WriteLine("PlayerMovement.MouseDown " + down + " " + bcapturing);
        //  if (ViewerState.GetInstance().CurrentViewerState == ViewerState.ViewerStateEnum.MouseLook)
//            {
//              InMouseMoveDrag = down;
//        }
//      else
//    {
//      InMouseMoveDrag = false;
//}
        //}

        //public void MouseMove( object source, MouseEventArgs e )
        //{
        //Test.Debug("Playermovement MouseMove " + e.ToString() );
        //  if( _bcapturing )
        //{
        //  avatarzrot = startavatarzrot - (double)( e.X - istartmousex ) * fAvatarTurnSpeed;
        //avataryrot = Math.Min( Math.Max( startavataryrot + (double)( e.Y - istartmousey ) * fAvatarTurnSpeed, - 90 ), 90 );
        //UpdateAvatarObjectRotAndPos();
        //}
        //}

        //public void MouseUp( object source, MouseEventArgs e )
        //{
        //Test.Debug("Playermovement MouseUp " + e.ToString() );
        //bcapturing = false;
        //  _bcapturing = false;
        //}

        public void UpdateAvatarObjectRotAndPos()
        {
            avatarrot  = mvMath.AxisAngle2Rot(mvMath.ZAxis, (avatarzrot * Math.PI / 180));
            avatarrot *= mvMath.AxisAngle2Rot(mvMath.YAxis, avataryrot * Math.PI / 180);

            Entity avatar = MetaverseClient.GetInstance().myavatar;

            if (avatar != null)
            {
                avatar.pos = avatarpos;
                avatar.rot = avatarrot;
            }
        }