Esempio n. 1
0
        protected override void Initialize()
        {
            ModelDrawer = new InstancedModelDrawer(this);

            ConstraintDrawer = new LineDrawer(this);
            ConstraintDrawer.DisplayTypes.Add(typeof(GrabSpring), typeof(DisplayGrabSpring));
            ConstraintDrawer.DisplayTypes.Add(typeof(MotorizedGrabSpring), typeof(DisplayMotorizedGrabSpring));

            ContactDrawer          = new ContactDrawer(this);
            BoundingBoxDrawer      = new BoundingBoxDrawer(this);
            SimulationIslandDrawer = new SimulationIslandDrawer(this);

            base.Initialize();
        }
Esempio n. 2
0
        public BEPUPhysicsRenderer(IManagerServiceProvider sceneInterface)
        {
            _sceneInterface     = sceneInterface;
            ManagerProcessOrder = 100;

            ModelDrawer            = new InstancedModelDrawer(Application.Instance);
            ContactDrawer          = new ContactDrawer(Application.Instance);
            BoundingBoxDrawer      = new BoundingBoxDrawer(Application.Instance);
            SimulationIslandDrawer = new SimulationIslandDrawer(Application.Instance);

            LineDrawer = new BasicEffect(Application.Graphics.GraphicsDevice);

            Visible = true;
        }
Esempio n. 3
0
        protected override void Initialize()
        {
            if (GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef)
                ModelDrawer = new InstancedModelDrawer(this);
            else
                ModelDrawer = new BruteModelDrawer(this);

            ConstraintDrawer = new LineDrawer(this);
            ConstraintDrawer.DisplayTypes.Add(typeof(GrabSpring), typeof(DisplayGrabSpring));
            ConstraintDrawer.DisplayTypes.Add(typeof(MotorizedGrabSpring), typeof(DisplayMotorizedGrabSpring));

            ContactDrawer = new ContactDrawer(this);
            BoundingBoxDrawer = new BoundingBoxDrawer(this);
            SimulationIslandDrawer = new SimulationIslandDrawer(this);

            base.Initialize();
        }
Esempio n. 4
0
        protected override void Initialize()
        {
            int height = 600;
            int width  = 1000;

            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();



            float maxX   = GraphicsDevice.Viewport.Width;
            float maxY   = GraphicsDevice.Viewport.Height;
            float xRatio = maxX / 600;
            float yRatio = maxY / 1000;

            average = (xRatio + yRatio) / 2;


            camera = new CameraComponent(this);
            Components.Add(camera);
            Services.AddService(typeof(CameraComponent), camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);
            Services.AddService(typeof(ModelManager), modelManager);

            genComponentManager = new GeneralComponentManager(this);
            Components.Add(genComponentManager);
            Services.AddService(typeof(GeneralComponentManager), genComponentManager);

            entities = new EntityManager(this);
            Components.Add(entities);
            Services.AddService(typeof(EntityManager), entities);

            particles = new ParticleManager(this);
            Components.Add(particles);
            Services.AddService(typeof(ParticleManager), particles);

            modelDrawer = new BoundingBoxDrawer(this);

            base.Initialize();
        }
Esempio n. 5
0
        public SceneManager(Settings settings, GraphicsDevice graphicsDevice)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            this.settings  = settings;
            GraphicsDevice = graphicsDevice;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            Cameras           = new CameraCollection(InitialCameraCapacity);
            DirectionalLights = new DirectionalLightCollection(InitialDirectionalLightCapacity);
            ParticleSystems   = new ParticleSystemCollection(InitialParticleSystemCapacity);
            PostProcessors    = new PostProcessorCollection(InitialPostProcessorCapacity);

            opaqueObjects        = new List <SceneObject>(InitialSceneObjectCapacity);
            translucentObjects   = new List <SceneObject>(InitialSceneObjectCapacity);
            shadowCasters        = new List <ShadowCaster>(InitialShadowCasterCapacity);
            collectObjectsAction = new Action <Octree>(CollectObjects);

            //----------------------------------------------------------------
            // シーン描画のためのレンダ ターゲット

            var pp               = GraphicsDevice.PresentationParameters;
            var width            = pp.BackBufferWidth;
            var height           = pp.BackBufferHeight;
            var format           = pp.BackBufferFormat;
            var depthFormat      = pp.DepthStencilFormat;
            var multiSampleCount = pp.MultiSampleCount;

            RenderTarget = new RenderTarget2D(GraphicsDevice, width, height,
                                              false, format, depthFormat, multiSampleCount, RenderTargetUsage.PreserveContents);

            //----------------------------------------------------------------
            // ポストプロセッサ コンテキスト

            postProcessorContext = new PostProcessorContext(this);

            //----------------------------------------------------------------
            // ポスト プロセスのためのレンダ ターゲット

            postProcessRenderTarget = new RenderTarget2D(GraphicsDevice, width, height,
                                                         false, format, depthFormat, multiSampleCount, RenderTargetUsage.PreserveContents);

            // TODO
            octreeManager = new OctreeManager(new Vector3(256), 3);

            // TODO
            RootNode = new SceneNode(this, "Root");

#if DEBUG || TRACE
            debugBoxEffect = new BasicEffect(GraphicsDevice);
            debugBoxEffect.AmbientLightColor  = Vector3.One;
            debugBoxEffect.VertexColorEnabled = true;
            debugBoxDrawer = new BoundingBoxDrawer(GraphicsDevice);
#endif
        }