Beispiel #1
0
        private void Init()
        {
            context = new ObjectGL.CachingImpl.Context(gl, nativeGraphicsContext);
            var pclWorkarounds = new PclWorkarounds();
            var textureLoader = new TextureLoader(assetManager);
            var spritefont = new Spritefont(settings, context, textureLoader);
            var statisticsRenderer = new OnScreenClientStatisticsRenderer(spritefont);
            var statistics = new ClientStatistics(statisticsRenderer);
            var byteArrayPool = new ByteArrayPool();
            var streamReceiver = settings.AreFromFile
                ? (IStreamReceiver)new AssetStreamReceiver(assetManager, byteArrayPool, "stream.dat")
                : new TcpStreamReceiver(pclWorkarounds, settings, byteArrayPool);
            streamReceivingStage = new StreamReceivingStage(pclWorkarounds, streamReceiver);
            cpuDecompressionStage = new CpuDecompressionStage(pclWorkarounds, statistics, byteArrayPool);
            var mainThreadBorderStage = new MainThreadBorderStage(statistics);
            var textureInitializer = new TextureInitializer();
            //var textureRenderer = new TextureRenderer(pclWorkarounds, settings, context);
            var gpuProcessingStage = new GpuProcessingStage(pclWorkarounds, statistics, settings, context, textureInitializer);
            var timedBufferingStage = new TimeBufferingStage(settings, statistics, context);
            mainLoop = new MainLoop(pclWorkarounds, statistics, settings, context, this, mainThreadBorderStage, timedBufferingStage, statisticsRenderer, textureLoader);

            //statisticsRenderer.ShowForm();

            PipelineBuilder
                .BeginWith(streamReceivingStage)
                .ContinueWith(cpuDecompressionStage)
                .ContinueWith(mainThreadBorderStage)
                .ContinueWith(gpuProcessingStage)
                .EndWith(timedBufferingStage);

            cpuDecompressionStage.Start();
            streamReceivingStage.Start();
        }
Beispiel #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            context = new Context(gl, nativeGraphicsContext);
            var pclWorkarounds = new PclWorkarounds();
            var settings = new ClientSettings();
            var textureLoader = new TextureLoader();
            var spritefont = new Spritefont(settings, context, textureLoader);
            var statisticsRenderer = new OnScreenClientStatisticsRenderer(spritefont);
            //var statisticsRenderer = new FormClientStatisticsRenderer();
            var statistics = new ClientStatistics(statisticsRenderer);
            var byteArrayPool = new ByteArrayPool();
            var streamReceiver = settings.AreFromFile
                ? (IStreamReceiver)new FileStreamReceiver(pclWorkarounds, byteArrayPool, fileName ?? "stream.dat")
                : new TcpStreamReceiver(pclWorkarounds, settings, byteArrayPool);
            streamReceivingStage = new StreamReceivingStage(pclWorkarounds, streamReceiver);
            cpuDecompressionStage = new CpuDecompressionStage(pclWorkarounds, statistics, byteArrayPool);
            var mainThreadBorderStage = new MainThreadBorderStage(statistics);
            var textureInitializer = new TextureInitializer();
            var gpuProcessingStage = new GpuProcessingStage(pclWorkarounds, statistics, settings, context, textureInitializer);
            var timedBufferingStage = new TimeBufferingStage(settings, statistics, context);
            mainLoop = new MainLoop(pclWorkarounds, statistics, settings, context, this, mainThreadBorderStage, timedBufferingStage, statisticsRenderer, textureLoader);

            //statisticsRenderer.ShowForm();

            PipelineBuilder
                .BeginWith(streamReceivingStage)
                .ContinueWith(cpuDecompressionStage)
                .ContinueWith(mainThreadBorderStage)
                .ContinueWith(gpuProcessingStage)
                .EndWith(timedBufferingStage);

            cpuDecompressionStage.Start();
            streamReceivingStage.Start();
        }