예제 #1
0
 public HmdView(string name, HMD hmd) : base(name, null, null)
 {
     myHmd          = hmd;
     myLeftEyeView  = new Graphics.View("Left Eye", myHmd.myCameras[0], myHmd.myCameras[0].viewport());
     myRightEyeView = new Graphics.View("Right Eye", myHmd.myCameras[1], myHmd.myCameras[1].viewport());
     addSibling(myLeftEyeView);
     addSibling(myRightEyeView);
 }
예제 #2
0
        private void glControl1_Load(object sender, EventArgs e)
        {
            glControl1.VSync = true;

            myViewPort           = new Viewport(0, 0, glControl1.Width, glControl1.Height);
            myCamera             = new Camera(myViewPort);
            myCameraEventHandler = new CameraEventHandler(myCamera);

            myCamera.position = new Vector3(-1, 1, -1);
            myCamera.lookAt(Vector3.Zero);

            myParticleSystem = ParticleManager.loadDefinition("../data/particleSystems/ringOfFire.json");
            particleSystemPropGrid.SelectedObject = myParticleSystem;
            updateFeatureCollection();

            GL.ClearColor(0.2f, 0.2f, 0.2f, 1.0f);

            //setup the rendering scene
            myView = new Graphics.View("Main View", myCamera, myViewPort);
            Pass p = new Pass("model", "forward-lighting");

            p.clearTarget = true;
            p.filter      = new TypeFilter(new List <String>()
            {
                "light", "staticModel", "skinnedModel", "particle"
            });
            myView.addPass(p);

            //create the default font
            myFont = FontManager.findFont("FREESANS");

            //add the view
            Renderer.views[myView.name] = myView;

            //add the ground plane
            //Renderer.renderables.Add(new SimpleModel(SimpleModel.SimpleModelType.TEXURED_PLANE, new Vector3(0f, 0f, 0f), 10.0f, Color4.White));
            Renderer.renderables.Add(myParticleSystem);

            //setup the timer
            myRenderTimer.Interval = 5;
            myRenderTimer.Tick    += renderTimerElapsed;
            myRenderTimer.Start();

            myIsLoaded = true;
        }
        public void Render(Graphics.BoundingVolumesRenderer bvRenderer, 
            View view,
            Scene scene,
            Common.Pathing.NavMesh navMesh,
            int activeFrame)
        {
            if (Settings.VisualBoundings)
            {
                foreach (var v in scene.AllEntities)
                    if(v.ActiveInMain == activeFrame)
                        bvRenderer.Draw(Matrix.Identity,
                            v.VisibilityWorldBounding,
                            Color.Orange);
            }

            if (Settings.PhysicsBoundings)
            {
                bvRenderer.DrawFullChains = Settings.PhysicsBoundingsFullChains;
                foreach (var v in scene.AllEntities)
                    if (v is Client.Game.Map.GameEntity &&
                        v.ActiveInMain == activeFrame &&
                        (!Settings.PhysicsBoundingsHideGround || !(v is Client.Game.Map.GroundPiece)))
                        bvRenderer.Draw(Matrix.Identity,
                            ((Client.Game.Map.GameEntity)v).PhysicsLocalBounding != null ?
                            Common.Boundings.Transform(((Client.Game.Map.GameEntity)v).PhysicsLocalBounding, v.WorldMatrix)
                            : null,
                            Color.Blue);
                bvRenderer.DrawFullChains = true;
            }

            if (Settings.PathMesh)
                bvRenderer.Draw(Matrix.Identity, navMesh.BoundingRegion, Color.White);

            if (Settings.AggroRange)
            {
                foreach (var v in scene.AllEntities)
                    if (v.ActiveInMain == activeFrame && v is Map.NPC)
                        view.DrawCircle(scene.Camera, Matrix.Identity,
                            ((Map.NPC)v).Position, ((Map.NPC)v).InRangeRadius, 12, Color.Red);
            }
        }
 /// <summary>
 /// Usefull to get a test project up and running quickly. See any TestProject for a usage reference
 /// </summary>
 public static void QuickStartSimpleWindow(View view, String title = "", int width = 800, int height = 600, 
     System.Windows.Forms.Form window = null, GraphicsDevice.GraphicsDevice graphicsDevice = null)
 {
     if (String.IsNullOrEmpty(title))
         title = Path.GetFileNameWithoutExtension(System.Windows.Forms.Application.ExecutablePath);
     using (window = window ?? new System.Windows.Forms.Form())
     {
         window.Text = title;
         window.Width = width;
         window.Height = height;
         Graphics.GraphicsDevice.SettingsUtilities.Initialize(Graphics.GraphicsDevice.DeviceMode.Windowed);
         Application.Init(window);
         view.Dock = DockStyle.Fill;
         view.GraphicsDevice = graphicsDevice ?? new GraphicsDevice9();
         view.GraphicsDevice.Settings = new Settings
         {
             DeviceMode = DeviceMode.Windowed,
             AntiAliasing = MultisampleType.EightSamples,
             Resolution = new Resolution {Width = width, Height = height},
         };
         window.Controls.Add(view);
         System.Windows.Forms.Application.Run(window);
     }
 }
 /// <summary>
 /// Do not use, used internally by view automatically
 /// </summary>
 public static void RegisterView(View view)
 {
     viewes.Add(view);
 }
 public WorldViewProbe(View view, Camera camera)
 {
     this.View = view;
     this.Camera = camera;
     WorldProbe = new Common.EmptyWorldProbe();
 }