Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="engine"></param>
        public RenderSystem(Game Game) : base(Game)
        {
            Counters = new RenderCounters();

            Width           = 1024;
            Height          = 768;
            Fullscreen      = false;
            StereoMode      = StereoMode.Disabled;
            InterlacingMode = InterlacingMode.HorizontalLR;
            UseDebugDevice  = false;
            VSyncInterval   = 1;
            MsaaEnabled     = false;
            UseFXAA         = true;

            this.Device = Game.GraphicsDevice;

            spriteEngine  = new SpriteEngine(this);
            filter        = new Filter(this);
            ssaoFilter    = new SsaoFilter(this);
            hdrFilter     = new HdrFilter(this);
            dofFilter     = new DofFilter(this);
            lightRenderer = new LightRenderer(this);
            sceneRenderer = new SceneRenderer(this);
            sky           = new Sky(this);
            bitonicSort   = new BitonicSort(this);
            vtSystem      = new VTSystem(this);

            Game.Config.ExposeConfig(lightRenderer, "LightRenderer", "light");
            Game.Config.ExposeConfig(ssaoFilter, "SSAO", "ssao");
            Game.Config.ExposeConfig(vtSystem, "VirtualTexture", "vt");

            Device.DisplayBoundsChanged += (s, e) => {
                DisplayBoundsChanged?.Invoke(s, e);
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sequntually imprints enqued tiles to physical texture.
        /// </summary>
        /// <param name="physicalPage"></param>
        public void Update(VTSystem vtSystem, float dt)
        {
            foreach (var stamp in stamps)
            {
                float jitter = rand.NextFloat(-StampJitterAmplitude, StampJitterAmplitude);

                stamp.Value.AdvanceStamping(vtSystem, dt, jitter);
            }

            stamps = stamps.Where(pair => !pair.Value.IsFullyStamped).ToDictionary(pair => pair.Key, pair => pair.Value);
        }
Ejemplo n.º 3
0
            /// <summary>
            /// Update internal counters and sets GPU data if necessary
            /// </summary>
            /// <param name="physicalPage"></param>
            /// <param name="dt"></param>
            public void AdvanceStamping(VTSystem vtSystem, float dt, float jitter)
            {
                timer -= dt;

                if (timer <= 0)
                {
                    vtSystem.PhysicalPages0.SetData(Rectangle, Tile.GetGpuData(0));
                    vtSystem.PhysicalPages1.SetData(Rectangle, Tile.GetGpuData(1));
                    vtSystem.PhysicalPages2.SetData(Rectangle, Tile.GetGpuData(2));
                    counter++;
                    timer = StampTimeInterval + jitter;
                }
            }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="baseDirectory"></param>
        public VTTileLoader(VTSystem vt, IStorage storage)
        {
            this.storage = storage;
            this.vt      = vt;

                        #if USE_PRIORITY_QUEUE
            requestQueue = new ConcurrentPriorityQueue <int, VTAddress>();
                        #else
            requestQueue = new ConcurrentQueue <VTAddress>();
                        #endif

            loadedTiles = new ConcurrentQueue <VTTile>();

            loaderThread              = new Thread(new ThreadStart(LoaderTask));
            loaderThread.Name         = "VT Tile Loader Thread";
            loaderThread.IsBackground = true;
            loaderThread.Start();
        }