public static void FlashGeometry3D(ISceneGraph isceneGraph_0, IGeometry igeometry_0) { IDisplay3D display3D = isceneGraph_0 as IDisplay3D; display3D.AddFlashFeature(igeometry_0); display3D.FlashFeatures(); }
public void EndFlight() { this.bool_0 = false; ISceneGraph sceneGraph = this._plugin.SceneGraph; IPoint point = new Point(); System.Drawing.Rectangle rectangle = default(System.Drawing.Rectangle); if (ToolSceneFly.GetClientRect(this._plugin.ActiveViewer.hWnd, ref rectangle) != 0) { object obj; object obj2; sceneGraph.Locate(sceneGraph.ActiveViewer, rectangle.Right / 2, rectangle.Bottom / 2, esriScenePickMode.esriScenePickAll, true, out point, out obj, out obj2); } ICamera camera = this._plugin.Camera; if (point != null) { camera.Target = point; camera.Observer = this.ipoint_0; } camera.RollAngle = 0.0; camera.PropertiesChanged(); ToolSceneFly.SetCursor(this.cursor_1.Handle.ToInt32()); this.int_0 = 0; }
public Character(ISceneGraph sceneGraph, Texture2D texture, Dictionary <AnimationKey, Animation> animation) : base(texture, animation) { this.SceneGraph = sceneGraph; this.NoClip = false; this.ObjectCollision += new GameObjectCollisionEventHandler(Character_ObjectCollision); }
private void 影像叠加ToolStripMenuItem_Click(object sender, System.EventArgs e) { ISceneGraph pSceneGraph = this.axSceneControl1.SceneGraph; IScene pScene = pSceneGraph.Scene; ILayer layer = pScene.get_Layer(0); ITinLayer tinLayer = layer as ITinLayer; layer = pScene.get_Layer(1); IRasterLayer rasterLayer = layer as IRasterLayer; ITinAdvanced tinAdvanced; ISurface surface; tinAdvanced = tinLayer.Dataset as ITinAdvanced; surface = tinAdvanced.Surface; ILayerExtensions layerExtensions = (ILayerExtensions)rasterLayer; I3DProperties i3dProperties = null; for (int i = 0; i < layerExtensions.ExtensionCount; i++) { if (layerExtensions.get_Extension(i) is I3DProperties) { i3dProperties = (I3DProperties)layerExtensions.get_Extension(i); } }//get 3d properties from extension i3dProperties.BaseOption = esriBaseOption.esriBaseSurface; i3dProperties.BaseSurface = surface; i3dProperties.Apply3DProperties(rasterLayer); pSceneGraph.RefreshViewers(); }
public override void OnMouseUp(int int_0, int int_1, int int_2, int int_3) { ISceneGraph sceneGraph = this._plugin.SceneGraph; IPoint point; object obj; object obj2; sceneGraph.Locate(sceneGraph.ActiveViewer, int_2, int_3, esriScenePickMode.esriScenePickAll, true, out point, out obj, out obj2); if (point != null) { ICamera camera = this._plugin.Camera; if (camera.ProjectionType == esri3DProjectionType.esriOrthoProjection) { camera.Target = point; sceneGraph.ActiveViewer.Redraw(true); } else { IPoint target = camera.Target; IPoint observer = camera.Observer; camera.Target = point; camera.PolarUpdate(1.0, 0.0, 0.0, true); IPoint observer2 = camera.Observer; double num; double num2; sceneGraph.GetDrawingTimeInfo(out num, out num2); if (num < 0.01) { num = 0.01; } int num3 = (int)(2.0 / num); if (num3 < 1) { num3 = 1; } if (num3 > 60) { num3 = 60; } double num4 = (observer2.X - observer.X) / (double)num3; double num5 = (observer2.Y - observer.Y) / (double)num3; double num6 = (observer2.Z - observer.Z) / (double)num3; double num7 = (point.X - target.X) / (double)num3; double num8 = (point.Y - target.Y) / (double)num3; double num9 = (point.Z - target.Z) / (double)num3; for (int i = 0; i < num3; i++) { observer2.X = observer.X + (double)i * num4; observer2.Y = observer.Y + (double)i * num5; observer2.Z = observer.Z + (double)i * num6; point.X = target.X + (double)i * num7; point.Y = target.Y + (double)i * num8; point.Z = target.Z + (double)i * num9; camera.Observer = observer2; camera.Target = point; sceneGraph.ActiveViewer.Redraw(true); } } } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // set ScreenHeight ScreenHeight = GraphicsDevice.Viewport.Height; // set ScreenWidth ScreenWidth = GraphicsDevice.Viewport.Width; // set cameraPos cameraPos = new Vector3(ScreenWidth / 2, 0, 0); // initialise a new sceneGraph sceneGraph = new SceneGraph(); // initialise a new sceneManager sceneManager = new SceneManager(sceneGraph); // initialise a new collisionManager collisionManager = new CollisionManager(sceneManager); // initialise a new inputManager inputManager = new InputManager(); // Initialise render manager _renderManager = new RenderManager(graphics, sceneManager, Content); // Initialise audio manager _audioManager = new SoundManager(Content); // initialise a new aiComponontManager aiComponentManager = new AIComponentManager(inputManager, _audioManager, sceneManager, Content); // initialise a new entityManager entityManager = new EntityManager(collisionManager, sceneGraph, aiComponentManager); // set headerLoaction backgroundLocation = new Vector2(-ScreenWidth / 2, 0); backgroundLocation2 = new Vector2(backgroundLocation.X + ScreenWidth + 1, 0); backgroundLocation3 = new Vector2(-ScreenWidth / 2, 0); backgroundLocation4 = new Vector2(-ScreenWidth / 2, 0); // initialise base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // set ScreenHeight ScreenHeight = GraphicsDevice.Viewport.Height; // set ScreenWidth ScreenWidth = GraphicsDevice.Viewport.Width; // set cameraPos cameraPos = new Vector3(ScreenWidth / 2, 0, 0); // initialise a new sceneGraph sceneGraph = new SceneGraph(); // initialise a new sceneManager sceneManager = new SceneManager(sceneGraph); // initialise a new collisionManager collisionManager = new CollisionManager(sceneManager); // initialise a new inputManager inputManager = new InputManager(); // initialise a new aiComponontManager aiComponentManager = new AIComponentManager(inputManager); // initialise a new entityManager entityManager = new EntityManager(collisionManager, sceneGraph, aiComponentManager); // initialise a new engineDemo gameDemo = new GameDemo(); // run engineDemo initialise method gameDemo.Initialise(entityManager, sceneManager, collisionManager, aiComponentManager, inputManager, sceneGraph); // add input listeners to the engineDemo inputManager.AddListener(((IKeyboardListener)gameDemo).OnNewKeyboardInput); inputManager.AddListener(((IMouseListener)gameDemo).OnNewMouseInput); // set headerLoaction headerLocation = new Vector2(-ScreenWidth / 2, 0); // initialise base.Initialize(); }
public static IGraphicsContainer3D Add3DGraphicsLayer(string string_0, ISceneGraph isceneGraph_0) { IGraphicsContainer3D result = null; IScene scene = isceneGraph_0.Scene; bool flag = false; if (scene.LayerCount > 0) { IEnumLayer enumLayer = scene.get_Layers(null, true); enumLayer.Reset(); for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next()) { if (layer.Name == string_0 && layer is IGraphicsContainer3D) { result = (layer as IGraphicsContainer3D); flag = true; break; } } } if (!flag) { ILayer layer2 = new GraphicsLayer3D(); layer2.Name = string_0; scene.AddLayer(layer2, true); result = (layer2 as IGraphicsContainer3D); Utils3D.RefreshApp(isceneGraph_0); } return(result); }
public Character(ISceneGraph sceneGraph, Texture2D texture, Dictionary<AnimationKey, Animation> animation) : base(texture, animation) { this.SceneGraph = sceneGraph; this.NoClip = false; this.ObjectCollision += new GameObjectCollisionEventHandler(Character_ObjectCollision); }
public override void OnClick() { ISceneGraph sceneGraph = this._plugin.SceneGraph; ICamera camera = this._plugin.Camera; camera.SetDefaultsMBB(sceneGraph.Extent); sceneGraph.ActiveViewer.Redraw(true); }
public static void RemoveGroupElement(IGroupElement igroupElement_0, ISceneGraph isceneGraph_0) { if (igroupElement_0.ElementCount > 0) { igroupElement_0.ClearElements(); IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D; graphicsContainer3D.DeleteElement(igroupElement_0 as IElement); } }
/// <summary> /// 三维要数闪烁 /// </summary> /// <param name="pGeometry">输入的要素</param> /// <param name="pSceneGraph"></param> public static void FlashGeometry(IGeometry pGeometry, ISceneGraph pSceneGraph) { IDisplay3D pDisplay3D = (IDisplay3D)pSceneGraph; ISpatialReference pSpatialReference = pSceneGraph.Scene.SpatialReference; pGeometry.SpatialReference = pSpatialReference; pDisplay3D.AddFlashFeature(pGeometry); pDisplay3D.FlashFeatures(); }
/// <summary> /// Constructor for the class EntityManager /// </summary> /// <param name="pCollisionManager"></param> /// <param name="pSceneGraph"></param> public EntityManager(ICollisionManager pCollisionManager, ISceneGraph pSceneGraph, IAIComponentManager pAIComponentManager) { // initialise entity list _entityList = new List <IEntity>(); // initialise collision manager _collisionManager = pCollisionManager; // initialuse AI component Manager _AIComponentManager = pAIComponentManager; // initialise the sceneGraph _sceneGraph = pSceneGraph; }
public static IPoint XYToPoint(ISceneGraph isceneGraph_0, int int_0, int int_1) { IPoint result = null; ISceneViewer activeViewer = isceneGraph_0.ActiveViewer; object obj; object obj2; isceneGraph_0.Locate(activeViewer, int_0, int_1, esriScenePickMode.esriScenePickGeography, true, out result, out obj, out obj2); obj = null; obj2 = null; return(result); }
/// <summary> /// 刷新指定图层 /// </summary> /// <param name="pObject"></param> public void RefreshLayer(object pObject) { if (this.m_sceneControl == null) { return; } ISceneGraph pSceneGragh = m_sceneControl.SceneGraph; pSceneGragh.Invalidate(pObject, true, false); pSceneGragh.ActiveViewer.Redraw(true); pSceneGragh.RefreshViewers(); }
public override void OnClick() { //Get the scene graph ISceneGraph pSceneGraph = (ISceneGraph)m_pSceneHookHelper.SceneGraph; //Get the scene viewer's camera ICamera pCamera = (ICamera)m_pSceneHookHelper.Camera; //Position the camera to see the full extent of the scene graph pCamera.SetDefaultsMBB(pSceneGraph.Extent); //Redraw the scene viewer pSceneGraph.ActiveViewer.Redraw(true); }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { //Get the scene graph ISceneGraph pSceneGraph = m_pSceneHookHelper.SceneGraph; //Get the scene IScene pScene = (IScene)m_pSceneHookHelper.Scene; IPoint pPoint; object pOwner, pObject; //Translate screen coordinates into a 3D point pSceneGraph.Locate(pSceneGraph.ActiveViewer, X, Y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out pOwner, out pObject); //Get a selection environment ISelectionEnvironment pSelectionEnv; pSelectionEnv = new SelectionEnvironmentClass(); if (Shift == 0) { pSelectionEnv.CombinationMethod = ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultNew; //Clear previous selection if (pOwner == null) { pScene.ClearSelection(); return; } } else { pSelectionEnv.CombinationMethod = ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultAdd; } //If the layer is a selectable feature layer if (pOwner is IFeatureLayer) { IFeatureLayer pFeatureLayer = (IFeatureLayer)pOwner; if (pFeatureLayer.Selectable == true) { //Select by Shape pScene.SelectByShape(pPoint, pSelectionEnv, false); } } //Refresh the scene viewer pSceneGraph.RefreshViewers(); }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { //Get the scene graph ISceneGraph pSceneGraph = (ISceneGraph)m_pSceneHookHelper.SceneGraph; IPoint pPoint; object pOwner, pObject; //Translate screen coordinates into a 3D point pSceneGraph.Locate(pSceneGraph.ActiveViewer, X, Y, esriScenePickMode.esriScenePickGraphics, false, out pPoint, out pOwner, out pObject); IGraphicsSelection pGraphicsSelection; if (pObject == null) { if (Shift == 0) { //Unselect selected graphics from the //basic graphics layer and each layer pGraphicsSelection = pSceneGraph.Scene.BasicGraphicsLayer as IGraphicsSelection; pGraphicsSelection.UnselectAllElements(); for (int i = 0; i < pSceneGraph.Scene.LayerCount - 1; i++) { ILayer pLayer = (ILayer)pSceneGraph.Scene.get_Layer(i); pGraphicsSelection = pLayer as IGraphicsSelection; pGraphicsSelection.UnselectAllElements(); } } } else { pGraphicsSelection = pOwner as IGraphicsSelection; //Unselect any selected graphics if (Shift == 0) { pGraphicsSelection.UnselectAllElements(); } //Select element IElement pElement = (IElement)pObject; pGraphicsSelection.SelectElement(pElement); } //Refresh the scene viewer pSceneGraph.ActiveViewer.Redraw(false); }
public static IEnumLayer GetMapLayers(ISceneGraph isceneGraph_0) { IBasicMap basicMap = isceneGraph_0.Scene as IBasicMap; IEnumLayer result; if (basicMap.LayerCount == 0) { result = null; } else { result = basicMap.get_Layers(null, true); } return(result); }
public void SpawnAtMe() { ISceneGraph graph = CreateSceneGraphScaffolding(); Vector2 objPosition = new Vector2(32, 64); GameObjectCounter obj = new GameObjectCounter(); obj.SceneGraph = graph; obj.Position = objPosition; GameObjectCounter spawn = new GameObjectCounter(); obj.SpawnAtMe(spawn); Assert.That(graph.RootGraph.Contains(spawn)); }
public static FolderNode GetOrCreateFolderHierarchy(ISceneGraph graph, string path) { // Validate arguments if (graph == null || string.IsNullOrEmpty(path)) { throw new ArgumentException(); } var names = path.Split('/'); if (names.Count() == 0) { throw new ArgumentException(path); } foreach (var name in names) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException(path); } } // Since graph.Roots is not a node, we have to handle it node separately var parent = graph.Roots.OfType <FolderNode>().FirstOrDefault(n => n.Name == names[0]); if (parent == null) { parent = new FolderNode(graph, names[0]); graph.Roots.Add(parent); } // Create folder nodes foreach (var name in names.Skip(1)) { var folder = parent.Children.OfType <FolderNode>().FirstOrDefault(n => n.Name == name) ?? null; if (folder == null) { folder = new FolderNode(graph, name); } folder.SetParent(parent); parent = folder; } return(parent); }
/// <summary> /// 初始化的一些方法 /// </summary> public void Init(AxSceneControl axSceneControl) { if (axSceneControl != null) { try { this.m_axSceneControl = axSceneControl; m_sceneControl = axSceneControl.Object as ISceneControl; m_SceneGraph = m_sceneControl.SceneGraph; m_Scene = m_sceneControl.Scene; m_SceneViewer = m_SceneGraph.ActiveViewer; m_Camera = m_sceneControl.Camera; } catch (Exception e) { } } }
// method to initialise the class public void Initialise(IEntityManager pEntityManager, ISceneManager pSceneManager, ICollisionManager pCollisionManager, IAIComponentManager pAiComponentManager, IInputManager pInputManager, ISceneGraph pSceneGraph) { sceneGraph = pSceneGraph; collisionManager = pCollisionManager; entityManager = pEntityManager; sceneManager = pSceneManager; inputManager = pInputManager; aiComponentManager = pAiComponentManager; _platformSpawn = new List <Vector2>(); _platformSSpawn = new List <Vector2>(); _platformEndLSpawn = new List <Vector2>(); _platformEndRSpawn = new List <Vector2>(); _wallSpawn = new List <Vector2>(); _hostileSpawn = new List <Vector2>(); _sawSpawn = new List <Vector2>(); _goldSpawn = new List <Vector2>(); // Populate spawn arrays LoadLevel(); }
public static IPoint XYToFeature(ISceneGraph isceneGraph_0, int int_0, int int_1, out IFeature ifeature_0, out IFeatureLayer ifeatureLayer_0) { ifeature_0 = null; ifeatureLayer_0 = null; ISceneViewer activeViewer = isceneGraph_0.ActiveViewer; IPoint result; object obj; object obj2; isceneGraph_0.Locate(activeViewer, int_0, int_1, esriScenePickMode.esriScenePickGeography, true, out result, out obj, out obj2); if (obj2 != null && obj2 is IFeature) { ifeature_0 = (obj2 as IFeature); ifeatureLayer_0 = (obj as IFeatureLayer); } obj = null; obj2 = null; return(result); }
public static IPoint XYToPoint2(ISceneGraph isceneGraph_0, int int_0, int int_1, esriScenePickMode esriScenePickMode_0) { IPoint result = null; ISceneViewer activeViewer = isceneGraph_0.ActiveViewer; IHit3DSet hit3DSet; isceneGraph_0.LocateMultiple(activeViewer, int_0, int_1, esriScenePickMode_0, true, out hit3DSet); if (hit3DSet != null) { hit3DSet.OnePerLayer(); IArray hits = hit3DSet.Hits; for (int i = 0; i <= hits.Count - 1; i++) { IHit3D hit3D = hits.get_Element(i) as IHit3D; result = hit3D.Point; } } return(result); }
public static ISurface GetCurrentSurface(ISceneGraph isceneGraph_0) { IBasicMap basicMap = isceneGraph_0.Scene as IBasicMap; short num = 0; ISurface result; while ((int)num < basicMap.LayerCount) { ISurface surfaceFromLayer = SurfaceInfo.GetSurfaceFromLayer(basicMap.get_Layer((int)num)); if (surfaceFromLayer != null) { result = surfaceFromLayer; return(result); } num += 1; } result = null; return(result); }
private void FrmIllumination_Load(object sender, EventArgs e) { pScene = pscenecontrol.Scene; pSceneGraph = pScene.SceneGraph; pVector3D = pSceneGraph.SunVector; //lblAziumth.Text = pVector3D.Azimuth.ToString(); //lblaltitude.Text = pVector3D.Inclination.ToString(); //lblcontrast.Text = pSceneGraph.Contrast.ToString(); azimuth = pVector3D.Azimuth; altitude = pVector3D.Inclination; contrast = pSceneGraph.Contrast; ksAzimuth.Value = (decimal)getdegrees(pVector3D.Azimuth); ksAltitude.Value = (decimal)getdegrees(pVector3D.Inclination); trackcontrast.Value = pSceneGraph.Contrast; lblAziumth.Text = ksAzimuth.Value.ToString(); lblaltitude.Text = ksAltitude.Value.ToString(); lblcontrast.Text = trackcontrast.Value.ToString(); n++; }
public override void OnLoad(OpenGL gl) { gl.Enable(OpenGL.GL_CULL_FACE); gl.Enable(OpenGL.GL_DEPTH_TEST); gl.Enable(OpenGL.GL_BLEND); gl.BlendFunc(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.OneMinusSourceAlpha); _camera = new OrthographicCamera(); _camera.View *= Mat4.RotateY(Angle.FromDegrees(15)); _shader = new BasicShader(gl); _modelUniform = gl.GetUniformLocation(_shader.Handle, "Model"); _viewUniform = gl.GetUniformLocation(_shader.Handle, "View"); _projectionUniform = gl.GetUniformLocation(_shader.Handle, "Projection"); _graph = new OpenGLSceneGraph(); _graph.Nodes.Add(new CoordinateSystemLeaf(gl, _shader, _model.Features.OfType<CoordinateSystem>())); _graph.Nodes.Add(new DatumPlaneLeaf(gl, _shader, _model.Features.OfType<DatumPlane>())); _graph.Nodes.Add(new GeometryLeaf(gl, _shader)); }
public override void OnMouseUp(int int_0, int int_1, int int_2, int int_3) { ISceneGraph sceneGraph = this._plugin.SceneGraph; IPoint point; object obj; object obj2; sceneGraph.Locate(sceneGraph.ActiveViewer, int_2, int_3, esriScenePickMode.esriScenePickAll, true, out point, out obj, out obj2); if (point != null) { ICamera camera = this._plugin.Camera; IPoint observer = camera.Observer; double num; double num2; sceneGraph.GetDrawingTimeInfo(out num, out num2); if (num < 0.01) { num = 0.01; } int num3 = (int)(2.0 / num); if (num3 < 1) { num3 = 1; } if (num3 > 60) { num3 = 60; } double num4 = (point.X - observer.X) / (double)num3; double num5 = (point.Y - observer.Y) / (double)num3; double num6 = (point.Z - observer.Z) / (double)num3; for (int i = 0; i <= num3; i++) { point.X = observer.X + (double)i * num4; point.Y = observer.Y + (double)i * num5; point.Z = observer.Z + (double)i * num6; camera.Observer = point; sceneGraph.ActiveViewer.Redraw(true); } } }
public static ILayer GetLayerByName(ISceneGraph isceneGraph_0, string string_0) { IBasicMap basicMap = isceneGraph_0.Scene as IBasicMap; ILayer result; if (basicMap.LayerCount > 0) { IEnumLayer enumLayer = basicMap.get_Layers(null, true); enumLayer.Reset(); for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next()) { if (layer.Name.ToUpper() == string_0.ToUpper()) { ILayer layer2 = layer; result = layer2; return(result); } } } result = null; return(result); }
public void EndFlight() { m_bInUse = false; //Get the scene graph ISceneGraph pSceneGraph = (ISceneGraph)m_pSceneHookHelper.SceneGraph; IPoint pPointTgt; pPointTgt = new PointClass(); object pOwner, pObject; Rectangle rect = new Rectangle(); //Windows API call to get windows client coordinates if (GetClientRect(m_pSceneHookHelper.ActiveViewer.hWnd, ref rect) != 0) { //Translate coordinates into a 3D point pSceneGraph.Locate(pSceneGraph.ActiveViewer, rect.Right / 2, rect.Bottom / 2, esriScenePickMode.esriScenePickAll, true, out pPointTgt, out pOwner, out pObject); } //Get the camera ICamera pCamera = (ICamera)m_pSceneHookHelper.Camera; if (pPointTgt != null) { //Reposition target and observer pCamera.Target = pPointTgt; pCamera.Observer = m_pPointObs; } //Set the angle of the camera about the line //of sight between the observer and target pCamera.RollAngle = 0; pCamera.PropertiesChanged(); //Windows API call to set cursor SetCursor(m_moveFlyCur.Handle.ToInt32()); m_iSpeed = 0; }
public EntityNode(ISceneGraph graph, Session session, Entity entity) : base(graph) { m_Session = session; m_WorldManager = m_Session.GetManager <IWorldManager>(); m_EntityManager = m_WorldManager.EntityManager; m_ComponentCache = m_Session.GetManager <UnityComponentCacheManager>(); Entity = entity; Guid = m_WorldManager.GetEntityGuid(entity); if (m_EntityManager.HasComponent <SiblingIndex>(Entity)) { Index = m_EntityManager.GetComponentData <SiblingIndex>(Entity); } else { Index = new SiblingIndex { Index = int.MaxValue }; m_EntityManager.AddComponentData(Entity, Index); } }
public GameObjectCollisionSpawn(ISceneGraph sceneGraph) : base() { }