void OpenContextMenu() { if (contextmenu != null) { contextmenu.Destroy(); } contextmenu = new Menu(); //MenuItem submenuitem = new MenuItem("About TestPlugin..."); //submenuitem.Activated += new EventHandler(Testpluginmenuitem_Activated); //contextmenu.Add(submenuitem); //contextmenu.Add(new MenuItem("item3")); MouseCache mousefiltermousecache = MouseCache.GetInstance(); iMouseX = mousefiltermousecache.MouseX; iMouseY = mousefiltermousecache.MouseY; entity = Picker3dController.GetInstance().GetClickedEntity(iMouseX, iMouseY); contextmenucommanditems = new List <MenuItem>(); contextmenucallbacks = new List <ContextMenuHandler>(); ContextMenuController.GetInstance().OnContextMenuPopup(this, new ContextMenuArgs(iMouseX, iMouseY, entity)); AddPersistentItems(); contextmenu.ShowAll(); contextmenu.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime); LogFile.WriteLine("after contextmenu popup"); }
public Entity GetClickedTopLevelEntity(int iMouseX, int iMouseY) { Entity clickedentity = Picker3dController.GetInstance().GetClickedEntity(iMouseX, iMouseY); if (clickedentity == null) { return(null); } while (clickedentity.Parent != null) { clickedentity = clickedentity.Parent; } return(clickedentity); }
public void AssignColorSingleFaceClick(object source, ContextMenuArgs e) { if (!(entity is Prim)) { return; } int FaceNumber = Picker3dController.GetInstance().GetClickedFace(entity as Prim, iMouseX, iMouseY); Color newcolor = DialogHelpers.GetColor(); if (newcolor != null) { AssignColor(FaceNumber, newcolor); } }
public void AssignTextureSingleFaceClick( object source, ContextMenuArgs e ) { if( ! ( entity is Prim ) ) { return; } int FaceNumber = Picker3dController.GetInstance().GetClickedFace( entity as Prim, iMouseX, iMouseY ); string filename = DialogHelpers.GetFilePath("Select image file (*.bmp,*.jpg,*.gif,*.tga):","*.JPG"); if( filename != "" ) { Console.WriteLine ( filename ); if( File.Exists( filename ) ) { AssignTexture( FaceNumber, new Uri( filename ) ); } } }
public void ToggleClickedInSelection(bool bSelectParentObject, int iMouseX, int iMouseY) { Entity entity; if (bSelectParentObject) { entity = GetClickedTopLevelEntity(iMouseX, iMouseY); } else { entity = Picker3dController.GetInstance().GetClickedEntity(iMouseX, iMouseY); } if (entity != null) { // Test.Debug( "selected is " + entity.ToString() ); ToggleObjectInSelection(entity, bSelectParentObject); } }
public override void Draw() { //Test.Debug("EntityGroup.Draw()"); IGraphicsHelper graphics = GraphicsHelperFactory.GetInstance(); //SelectionModel selectionmodel = SelectionModel.GetInstance(); Picker3dController picker3dcontroller = Picker3dController.GetInstance(); if (graphics == null) { return; } graphics.PushMatrix(); graphics.Translate(pos); bool bNeedToPopMatrix = false; bool bRotatedToGroupRot = false; //for( int iSubEntityRef = 0; iSubEntityRef < iNumSubEntities; iSubEntityRef++ ) foreach (Entity child in children) { if (!bRotatedToGroupRot) { // dont rotate first prim in elevation for avatars (looks better like this) //if( strcmp( sDeepEntityType, "AVATAR" ) != 0 ) if (true) // Just display all avatars as is for now( we should put this back in though probably) { graphics.Rotate(rot); bRotatedToGroupRot = true; } picker3dcontroller.AddHitTarget(child); child.Draw(); } if (bNeedToPopMatrix) { graphics.PopMatrix(); } } graphics.PopMatrix(); }
//! Draws all non-hardcoded objects in world - including avatars - into the 3D world of OpenGL void DrawEntities() { //Test.Debug("drawobjects"); Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, new float[] { 1.0f, 0.0f, 0.5f, 1.0f }); Gl.glEnable(Gl.GL_TEXTURE_2D); Avatar myavatar = MetaverseClient.GetInstance().myavatar; Picker3dController picker3dcontroller = Picker3dController.GetInstance(); for (int i = 0; i < worldmodel.entities.Count; i++) { if (worldmodel.entities[i].iParentReference == 0) { // dont draw own avatar in mouselook mode if (worldmodel.entities[i] != myavatar) { //LogFile.WriteLine("render entity " + i); Gl.glRasterPos3f((float)worldmodel.entities[i].pos.x, (float)worldmodel.entities[i].pos.y, (float)worldmodel.entities[i].pos.z); picker3dcontroller.AddHitTarget(worldmodel.entities[i]); worldmodel.entities[i].Draw(); picker3dcontroller.EndHitTarget(); graphics.Bind2DTexture(0); } else { Gl.glRasterPos3f((float)worldmodel.entities[i].pos.x, (float)worldmodel.entities[i].pos.y, (float)worldmodel.entities[i].pos.z); picker3dcontroller.AddHitTarget(worldmodel.entities[i]); worldmodel.entities[i].Draw(); picker3dcontroller.EndHitTarget(); graphics.Bind2DTexture(0); } } } }
void Layer2MouseEvents_MouseDown(object sender, SdlDotNet.MouseButtonEventArgs e) { targetentity = Picker3dController.GetInstance().GetClickedEntity(e.X, e.Y); }