예제 #1
0
        public static void TwoMovingObjects()
        {
            Cube cube1 = new Cube();
            Cube cube2 = new Cube();
            ShaderModelRenderer sm1 = new ShaderModelRenderer(cube1);
            ShaderModelRenderer sm2 = new ShaderModelRenderer(cube2, sm1.ShaderProgram);

            using (WorldWindow game = new WorldWindow()
            {
                Title = "TwoMovingObjects"
            })
            {
                game.Camera.LookAt(new Vector3(-4, 4, -4), new Vector3());
                game.Models.Add(sm1);
                game.Models.Add(sm2);
                float time = 0;
                game.UpdateFrame += (o, e) =>
                {
                    time          += (float)e.Time;
                    cube1.Position = new Vector3(-1, 0.5f * (float)Math.Sin(time), 0);
                    cube1.Rotation = new Vector3(0.3f * time, 0.1f * time, 0);

                    cube2.Position = new Vector3(1, -0.5f * (float)Math.Sin(time), 0);
                    cube2.Rotation = new Vector3(0.3f * time, 0.1f * time, 0);
                };
                game.Run();
            }
        }
예제 #2
0
        /**
         * Constructs a new <code>WorldWindowGLCanvas</code> on the default graphics device and shares graphics resources
         * with another <code>WorldWindow</code>.
         *
         * @param shareWith a <code>WorldWindow</code> with which to share graphics resources.
         *
         * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser,
         *      javax.media.opengl.GLContext, java.awt.GraphicsDevice)
         */
        public WorldWindowGLCanvas(WorldWindow shareWith)
        {
            base(Configuration.getRequiredGLCapabilities(), new BasicGLCapabilitiesChooser(), null);

            if (shareWith != null)
            {
                this.setSharedContext(shareWith.getContext());
            }

            try
            {
                this.wwd = ((WorldWindowGLDrawable)WorldWind.createConfigurationComponent(AVKey.WORLD_WINDOW_CLASS_NAME));
                this.wwd.initDrawable(this);
                if (shareWith != null)
                {
                    this.wwd.initGpuResourceCache(shareWith.getGpuResourceCache());
                }
                else
                {
                    this.wwd.initGpuResourceCache(WorldWindowImpl.createGpuResourceCache());
                }
                this.createView();
                this.createDefaultInputHandler();
                WorldWind.addPropertyChangeListener(WorldWind.SHUTDOWN_EVENT, this);
                this.wwd.endInitialization();
            }
            catch (Exception e)
            {
                String message = Logging.getMessage("Awt.WorldWindowGLSurface.UnabletoCreateWindow");
                Logging.logger().severe(message);
                throw new WWRuntimeException(message, e);
            }
        }
예제 #3
0
 public Form(WorldWindow ww, double dblLatitude, double dblLongitude, double dblAltitude)
 {
     this.ww           = ww;
     this.dblLatitude  = (float)dblLatitude;
     this.dblLongitude = (float)dblLongitude;
     this.dblAltitude  = (float)dblAltitude;
 }
예제 #4
0
        public static void SquareGridTest()
        {
            using (WorldWindow game = new WorldWindow())
            {
                Vector3 eye = new Vector3(-4, 4, -4);
                game.Camera.LookAt(eye, new Vector3());


                SquareGrid          grid = new SquareGrid(4, 4, 2.3f, 1.1f);
                ShaderModelRenderer sm   = new ShaderModelRenderer(grid);

                game.Models.Add(sm);


                UserInterface ui = new UserInterface(game);

                float time = 0;
                game.UpdateFrame += (o, e) =>
                {
                    time += (float)e.Time;
                    double fps = e.Time == 0 ? 1000 : 1.0 / e.Time;
                    ui.PrintCommonStats(e.Time);
                };

                game.Run(30);
            }
        }
예제 #5
0
        internal DAPBrowserMapBuilder(WorldWindow worldWindow, Server server, IBuilder parent, int height, int size)
            : base("Browser map for " + server.Name, worldWindow, parent)
        {
            m_oServer = server;

            m_iHeight            = height;
            m_iTextureSizePixels = size;
        }
예제 #6
0
 public static void EmptyWindow()
 {
     using (WorldWindow game = new WorldWindow()
     {
         Title = "EmptyWindow"
     })
         game.Run(30);
 }
예제 #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public CompassLayer(string LayerName, string pluginPath, WorldWindow worldWindow) : base(LayerName)
 {
     this.pluginPath     = Path.Combine(pluginPath, @"Plugins\Compass\");
     this.world          = worldWindow.CurrentWorld;
     this.drawArgs       = worldWindow.DrawArgs;
     this.RenderPriority = RenderPriority.Custom;
     ReadSettings();
 }
예제 #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        public StereoLayer(string LayerName, WorldWindow worldWindow)
            : base(LayerName)
        {
            this.RenderPriority = RenderPriority.Icons;
            this.worldWin       = worldWindow;

            worldWindow.DrawArgs.device.DeviceLost += new EventHandler(OnDeviceLost);
        }
예제 #9
0
 public WMSZoomBuilder(WMSLayer layer, string cachePath, WorldWindow worldWindow, IBuilder parent)
 {
     m_wmsLayer     = layer;
     m_WorldWindow  = worldWindow;
     m_strCacheRoot = cachePath;
     m_Parent       = parent;
     m_oWorld       = m_WorldWindow.CurrentWorld;
     m_strName      = layer.Title;
 }
예제 #10
0
 static void MoveModels(WorldWindow game, float time, Vector3[] posOffsets)
 {
     for (int i = 0; i < posOffsets.Length; i++)
     {
         MovableModel cube = game.Models[i].Model as MovableModel;
         cube.Position = new Vector3(posOffsets[i].X, (float)Math.Sin(time + posOffsets[i].Y), posOffsets[i].Z);
         cube.Rotation = new Vector3(0.5f * time, 0.1f * time, 0);
     }
 }
예제 #11
0
 /// <summary>
 /// Constructor
 /// </summary>
 public GlobeIconLayer(string LayerName, string pluginPath, WorldWindow worldWindow)
     : base(LayerName)
 {
     this.pluginPath     = pluginPath;
     this.pluginName     = LayerName;
     this.world          = worldWindow.CurrentWorld;
     this.drawArgs       = worldWindow.DrawArgs;
     this.RenderPriority = RenderPriority.Custom;
     this.texturePath    = Path.Combine(MainApplication.DirectoryPath, "Data/Earth/BmngBathy");
     ReadSettings();
 }
예제 #12
0
 public virtual void Select()
 {
     if (selected)
     {
         return;
     }
     gameController.pointer.SetSelectIndicatorPosition(Util.Vector3ToCoords(transform.position), new Coords(1, 1));
     buildingInfoWindow = Instantiate(buildingInfoWindowObj, transform.position, Quaternion.identity, this.transform).GetComponent <WorldWindow>();
     buildingInfoWindow.Initialize(this);
     selected = true;
 }
예제 #13
0
        public string presetFileName;                                // preset file (will overide defaults)

        /// <summary>
        /// Constructor
        /// </summary>
        public SkyGradientLayer(string LayerName, string pluginPath, WorldWindow worldWindow) : base(LayerName)
        {
            this.pluginPath       = pluginPath;
            this.pluginName       = LayerName;
            this.world            = worldWindow.CurrentWorld;
            this.settingsFileName = this.world.Name + ".ini";
            this.drawArgs         = worldWindow.DrawArgs;
            //this.RenderPriority = RenderPriority.AtmosphericImages;
            this.RenderPriority = RenderPriority.SurfaceImages;
            ReadSettings();
        }
예제 #14
0
        public StatisticsPanel(WorldWindow wwd, Dimension size)
        {
            // Make a panel at a specified size.
            super(new BorderLayout());

            this.wwd = wwd;
            this.makePanel(size);
            wwd.setPerFrameStatisticsKeys(PerformanceStatistic.ALL_STATISTICS_SET);

            wwd.addRenderingListener(new RenderingListener()
            {
예제 #15
0
 internal GeorefImageLayerBuilder(string strFileName, bool bTmp, WorldWindow oWorldWindow, IBuilder parent)
     : base(Path.GetFileName(strFileName), oWorldWindow, parent)
 {
     if (strFileName == null)
     {
         throw new ArgumentNullException("strFileName");
     }
     m_strFileName      = strFileName;
     m_bIsTmp           = bTmp;
     m_strCacheFileName = Path.Combine(GetCachePath(), Path.GetFileNameWithoutExtension(strFileName) + ".png");
     m_blMissingFile    = !File.Exists(m_strFileName);
 }
예제 #16
0
        internal void GoToLookAt(WorldWindow oTarget)
        {
            KMLLookAt oView = m_oSourceFile.Document.View as KMLLookAt;

            if (oView != null)
            {
                oTarget.GoToLatLonHeadingViewRange(oView.Latitude, oView.Longitude, oView.Heading, oView.Range);
            }
            else
            {
                oTarget.GoToBoundingBox(m_oBounds, false);
            }
        }
예제 #17
0
        internal DAPQuadLayerBuilder(DataSet dataSet, WorldWindow worldWindow, Server server, IBuilder parent, int height, int size, double lvl0tilesize, int levels)
            : base(dataSet.Title, worldWindow, parent)
        {
            m_hDataSet = dataSet;
            m_oServer  = server;

            m_iHeight              = height;
            m_iTextureSizePixels   = size;
            this.LevelZeroTileSize = lvl0tilesize;
            m_iLevels              = levels;

            m_blUseXMLMeta = !String.IsNullOrEmpty(m_hDataSet.Stylesheet);
        }
        public DashboardController(WorldWindow wwd, Component component)
        {
            if (wwd == null)
            {
                String msg = Logging.getMessage("nullValue.WorldWindow");
                Logging.logger().severe(msg);
                throw new ArgumentException(msg);
            }

            this.wwd       = wwd;
            this.component = component;
            wwd.getInputHandler().addMouseListener(this);
        }
예제 #19
0
        public TestForm()
        {
            Application.DoEvents();
            InitializeComponent();

            this.SuspendLayout();
            this._worldWindow      = new WorldWindow();
            this._worldWindow.Dock = System.Windows.Forms.DockStyle.Fill;
            this._worldWindow.Name = "worldWindow1";
            this.Controls.Add(this._worldWindow);
            this.ResumeLayout();

            this._worldWindow.Render();
        }
예제 #20
0
        internal AddImageTile(WorldWind.WorldWindow worldWindow, LayerGeneration.IBuilder oParent)
        {
            m_worldWind = worldWindow;
            m_oParent   = oParent;
            InitializeComponent();

            // collect the pages and leave only the start page
            for (int i = 0; i < tabCtl.TabPages.Count; i++)
            {
                m_tabPages.Add(tabCtl.TabPages[i]);
            }
            tabCtl.TabPages.Clear();
            tabCtl.TabPages.Add(m_tabPages[0]);
        }
예제 #21
0
        public static UserInterfaceSimpleTextbox AddUI(WorldWindow game)
        {
            UserInterfaceSimpleTextbox ui = new UserInterfaceSimpleTextbox();

            ui.BoxBackground = Color.FromArgb(0, 0, 0, 0);
            ShaderModelRenderer sm = new ShaderModelRenderer(ui)
            {
                VertexShaderFilaneme   = "Shaders/vs_tex.glsl",
                FragmentShaderFilename = "Shaders/fs_tex.glsl",
            };

            game.Models.Add(sm);
            return(ui);
        }
예제 #22
0
        public static void ThreeShaders()
        {
            Cube cube1 = new Cube();
            Cube cube2 = new ColouredCube();
            Cube cube3 = new TexturedCube();
            ShaderModelRenderer sm1 = new ShaderModelRenderer(cube1);
            ShaderModelRenderer sm2 = new ShaderModelRenderer(cube2)
            {
                VertexShaderFilaneme = "Shaders/vs_col.glsl"
            };
            ShaderModelRenderer sm3 = new ShaderModelRenderer(cube3)
            {
                VertexShaderFilaneme   = "Shaders/vs_tex.glsl",
                FragmentShaderFilename = "Shaders/fs_tex.glsl"
            };

            using (WorldWindow game = new WorldWindow()
            {
                Title = "ThreeShaders"
            })
            {
                game.Camera.LookAt(new Vector3(-4, 4, -4), new Vector3());

                (cube3 as TexturedCube).TextureID = TextureLoader.LoadImage("Textures/opentksquare.png");

                game.Models.Add(sm1);
                game.Models.Add(sm2);
                game.Models.Add(sm3);

                UserInterface ui = new UserInterface(game);

                float time = 0;
                game.UpdateFrame += (o, e) =>
                {
                    time          += (float)e.Time;
                    cube1.Position = new Vector3(2, 0.05f * (float)Math.Sin(time), 0);
                    cube1.Rotation = new Vector3(0.3f * time, 0.1f * time, 0);

                    cube2.Position = new Vector3(0, 0.05f * (float)Math.Sin(time), 2);
                    cube2.Rotation = new Vector3(0.3f * time, 0.1f * time, 0);

                    cube3.Position = new Vector3(0, 0.05f * (float)Math.Sin(time), 0);
                    cube3.Rotation = new Vector3(0.3f * time, 0.1f * time, 0);

                    ui.PrintCommonStats(e.Time);
                };
                game.Run();
            }
        }
예제 #23
0
 internal KMLLayerBuilder(String strFilename, String strLayerName, WorldWindow oWorldWindow, IBuilder oParent, GeographicBoundingBox oBounds)
     : base(strLayerName, oWorldWindow, oParent)
 {
     m_strInitFilename = strFilename;
     if (File.Exists(m_strInitFilename))
     {
         m_oSourceFile = new KMLFile(strFilename);
         m_oRenderable = KMLCreation.CreateKMLLayer(m_oSourceFile, oWorldWindow.CurrentWorld, out m_oBounds);
         if (oBounds != null)
         {
             m_oBounds = oBounds;
         }
         m_oRenderable.RenderPriority = RenderPriority.TerrainMappedImages;
     }
 }
예제 #24
0
        public static void SingleObect()
        {
            Cube cube = new Cube();
            ShaderModelRenderer sm = new ShaderModelRenderer(cube);

            using (WorldWindow game = new WorldWindow()
            {
                Title = "SingleMovingObject"
            })
            {
                game.Camera.LookAt(new Vector3(-4, 4, -4), new Vector3());
                game.Models.Add(sm);
                game.Run();
            }
        }
예제 #25
0
        public ExternalLayerManager(WorldWindow ww, MenuItem menuItem)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            parentMenuItem = menuItem;

            m_WorldWindow = ww;



            m_UpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_UpdateTimer_Elapsed);
            m_UpdateTimer.Start();
        }
예제 #26
0
        public static void TextboxInterface()
        {
            using (WorldWindow game = new WorldWindow())
            {
                Vector3 eye = new Vector3(0, 2, 0);
                game.Camera.LookAt(eye, eye * 0.8f);
                UserInterface ui = new UserInterface(game);

                game.UpdateFrame += (o, e) =>
                {
                    ui.PrintCommonStats(e.Time);
                };

                game.Run(30);
            }
        }
        public void dispose()
        {
            if (this.dialog != null)
            {
                this.dialog.dispose();
                this.dialog = null;
            }

            if (this.wwd.getInputHandler() != null)
            {
                this.wwd.getInputHandler().removeMouseListener(this);
            }
            this.wwd = null;

            this.component = null;
        }
예제 #28
0
		public ExternalLayerManager(WorldWindow ww, MenuItem menuItem)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			parentMenuItem = menuItem;

			m_WorldWindow = ww;

			
			
			m_UpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_UpdateTimer_Elapsed);
			m_UpdateTimer.Start();
		}
예제 #29
0
        public int refreshHours      = 3;                                       // How often to refresh cloud map

        /// <summary>
        /// Constructor
        /// </summary>
        public GlobalCloudsLayer(string LayerName, string pluginPath, WorldWindow worldWindow) : base(LayerName)
        {
            this.pluginPath     = pluginPath;
            this.world          = worldWindow.CurrentWorld;
            this.drawArgs       = worldWindow.DrawArgs;
            this.RenderPriority = RenderPriority.AtmosphericImages;
            //CleanupHistory();
            CleanupJpg();
            FindLatest();
            ReadSettings();
            if (textureFileName == "" && latestFileName != "")
            {
                textureFileName = latestFileName;
            }

            //MessageBox.Show("Server url : " + GetServerUrl(),"Info.", MessageBoxButtons.OK, MessageBoxIcon.Error );
        }
예제 #30
0
 internal NltQuadLayerBuilder(string name, int height, bool isTerrainMapped, GeographicBoundingBox boundary,
                              double levelZeroTileSize, int levels, int textureSize, string serverURL, string dataSetName, string imageExtension,
                              byte opacity, WorldWindow worldWindow, IBuilder parent)
     : base(name, worldWindow, parent)
 {
     distAboveSurface            = height;
     terrainMapped               = isTerrainMapped;
     m_hBoundary                 = boundary;
     m_bOpacity                  = opacity;
     m_strWorldName              = worldWindow.CurrentWorld.Name;
     m_iLevels                   = levels;
     m_iTextureSizePixels        = textureSize;
     m_dLevelZeroTileSizeDegrees = levelZeroTileSize;
     m_strServerUrl              = serverURL;
     m_strDatasetName            = dataSetName;
     m_strImageExt               = imageExtension;
 }
예제 #31
0
        public NRLMontereyGlobal(WorldWindow ww, string cacheDirectory, string xmlFile)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            m_WorldWindow = ww;

            loadNrlDataSets(xmlFile, this.treeView1);

            this.m_CacheDirectory = cacheDirectory;
            if (!Directory.Exists(this.m_CacheDirectory))
            {
                Directory.CreateDirectory(this.m_CacheDirectory);
            }

            this.animationTimer.Elapsed += new System.Timers.ElapsedEventHandler(animationTimer_Elapsed);
        }