Beispiel #1
0
 public DefaultGraphicsBlit(
     IAssetManager assetManager,
     IBackBufferDimensions backBufferDimensions)
 {
     _blitEffect           = assetManager.Get <UberEffectAsset>("effect.BuiltinSurface");
     _backBufferDimensions = backBufferDimensions;
 }
 public DefaultCanvasRenderPass(
     IBackBufferDimensions backBufferDimensions,
     IInterlacedBatchingDepthProvider interlacedBatchingDepthProvider)
 {
     _backBufferDimensions            = backBufferDimensions;
     _interlacedBatchingDepthProvider = interlacedBatchingDepthProvider;
 }
Beispiel #3
0
 public EditorCanvasRenderPass(
     IBackBufferDimensions backBufferDimensions,
     IInterlacedBatchingDepthProvider interlacedBatchingDepthProvider,
     ILoadedGame loadedGame,
     IThumbnailSampler thumbnailSampler) : base(backBufferDimensions, interlacedBatchingDepthProvider)
 {
     _loadedGame       = loadedGame;
     _thumbnailSampler = thumbnailSampler;
 }
Beispiel #4
0
        public DefaultProfilerRenderPass(
            I2DRenderUtilities renderUtilities,
            IBackBufferDimensions backBufferDimensions,
            [Optional] IConsole console)
        {
            _renderUtilities      = renderUtilities;
            _backBufferDimensions = backBufferDimensions;
            _console = console;

            Enabled     = true;
            Visualisers = new List <IProfilerVisualiser>();
            Position    = ProfilerPosition.TopLeft;
        }
Beispiel #5
0
 public DefaultRenderPipeline(
     IGraphicsBlit graphicsBlit,
     IRenderTargetBackBufferUtilities renderTargetBackBufferUtilities,
     IProfiler profiler,
     ILoadingScreen loadingScreen,
     IBackBufferDimensions backBufferDimensions,
     [FromGame] IEngineHook[] engineHooks)
 {
     _graphicsBlit = graphicsBlit;
     _renderTargetBackBufferUtilities = renderTargetBackBufferUtilities;
     _profiler                            = profiler;
     _loadingScreen                       = loadingScreen;
     _backBufferDimensions                = backBufferDimensions;
     _engineHooks                         = engineHooks;
     _standardRenderPasses                = new List <IRenderPass>();
     _postProcessingRenderPasses          = new List <IRenderPass>();
     _transientStandardRenderPasses       = new List <IRenderPass>();
     _transientPostProcessingRenderPasses = new List <IRenderPass>();
     _renderPass                          = null;
     _isFirstRenderPass                   = false;
 }
        public Default3DDeferredRenderPass(
            IHierarchy hierarchy,
            IRenderTargetBackBufferUtilities renderTargetBackBufferUtilities,
            IGraphicsBlit graphicsBlit,
            IAssetManager assetManager,
            IRenderBatcher renderBatcher,
            IBackBufferDimensions backBufferDimensions)
        {
            _hierarchy = hierarchy;
            _renderTargetBackBufferUtilities = renderTargetBackBufferUtilities;
            _graphicsBlit         = graphicsBlit;
            _renderBatcher        = renderBatcher;
            _backBufferDimensions = backBufferDimensions;
            _gbufferClearEffect   =
                assetManager.Get <EffectAsset>("effect.GBufferClear");
            _gbufferCombineEffect =
                assetManager.Get <EffectAsset>("effect.GBufferCombine");

            GBufferBlendState = BlendState.Opaque;
            ClearTarget       = true;
        }
 public BackBufferDimensionsProxy(IBackBufferDimensions marshalledBackBufferDimensions)
 {
     _marshalledBackBufferDimensions = marshalledBackBufferDimensions;
 }
Beispiel #8
0
 public PanningCamera(IBackBufferDimensions backBufferDimensions)
 {
     _backBufferDimensions = backBufferDimensions;
 }
Beispiel #9
0
        public void LoadFromPath(
            IConsoleHandle consoleHandle,
            IBaseDirectory baseDirectory,
            IBackBufferDimensions backBufferDimensions,
            string gameAssembly)
        {
            // Wrap the backbuffer dimensions service in a proxy, since GraphicsDevice can not
            // cross the AppDomain boundary.
            backBufferDimensions = new BackBufferDimensionsProxy(backBufferDimensions);

            // Load the target assembly.
            consoleHandle.LogDebug("Loading game assembly from " + gameAssembly + "...");
            var assembly = Assembly.LoadFrom(gameAssembly);

            consoleHandle.LogDebug("Constructing standard kernel...");
            var kernel = new StandardKernel();

            kernel.Bind <IRawLaunchArguments>()
            .ToMethod(x => new DefaultRawLaunchArguments(new string[0]))
            .InSingletonScope();

            // Bind our extension hook first so that it runs before everything else.
            kernel.Bind <IEngineHook>().To <ExtensionEngineHook>().InSingletonScope();

            Func <System.Reflection.Assembly, Type[]> TryGetTypes = a =>
            {
                try
                {
                    return(a.GetTypes());
                }
                catch
                {
                    return(new Type[0]);
                }
            };

            consoleHandle.LogDebug("Finding configuration classes in " + gameAssembly + "...");
            var typeSource = new List <Type>();

            foreach (var attribute in assembly.GetCustomAttributes(false))
            {
                if (attribute.GetType().FullName == "Protogame.ConfigurationAttribute")
                {
                    typeSource.Add(((ConfigurationAttribute)attribute).GameConfigurationOrServerClass);
                }
            }

            if (typeSource.Count == 0)
            {
                // Scan all types to find implementors of IGameConfiguration
                typeSource.AddRange(from type in TryGetTypes(assembly)
                                    select type);
            }

            consoleHandle.LogDebug("Found {0} configuration classes in " + gameAssembly, typeSource.Count);

            consoleHandle.LogDebug("Constructing game configurations...");
            var gameConfigurations = new List <IGameConfiguration>();

            foreach (var type in typeSource)
            {
                if (typeof(IGameConfiguration).IsAssignableFrom(type) &&
                    !type.IsInterface && !type.IsAbstract)
                {
                    gameConfigurations.Add(Activator.CreateInstance(type) as IGameConfiguration);
                }
            }

            ICoreGame game = null;
            var       hasBoundNewEventEngine = false;

            consoleHandle.LogDebug("Configuring kernel and constructing game instance ({0} configurations)...", gameConfigurations.Count);
            foreach (var configuration in gameConfigurations)
            {
                consoleHandle.LogDebug("Configuring with {0}...", configuration.GetType().FullName);

                configuration.ConfigureKernel(kernel);

                // Rebind services so the game renders correctly inside the editor.
                kernel.Rebind <IBaseDirectory>().ToMethod(x => baseDirectory).InSingletonScope();
                kernel.Rebind <IBackBufferDimensions>().ToMethod(x => backBufferDimensions).InSingletonScope();
                kernel.Rebind <IDebugRenderer>().To <DefaultDebugRenderer>().InSingletonScope();
                var bindings = kernel.GetCopyOfBindings();
                var mustBindNewEventEngine = false;
                if (bindings.ContainsKey(typeof(IEngineHook)))
                {
                    if (bindings[typeof(IEngineHook)].Any(x => x.Target == typeof(EventEngineHook)))
                    {
                        mustBindNewEventEngine = !hasBoundNewEventEngine;
                        kernel.UnbindSpecific <IEngineHook>(x => x.Target == typeof(EventEngineHook));
                    }

                    if (mustBindNewEventEngine)
                    {
                        kernel.Bind <IEngineHook>().ToMethod(ctx =>
                        {
                            _editorEventEngineHook = ctx.Kernel.Get <EditorEventEngineHook>(ctx.Parent);
                            return(_editorEventEngineHook);
                        }).InSingletonScope();
                    }
                }

                if (game == null)
                {
                    game = configuration.ConstructGame(kernel);
                }
            }

            if (game != null)
            {
                consoleHandle.LogDebug("Game instance is {0}", game.GetType().FullName);
            }

            _game          = game;
            _logShipping   = kernel.Get <ILogShipping>();
            _consoleHandle = consoleHandle;

            consoleHandle.LogDebug("LoadFromPath complete");
        }
Beispiel #10
0
 public DefaultRenderTargetBackBufferUtilities(IBackBufferDimensions backBufferDimensions)
 {
     _backBufferDimensions = backBufferDimensions;
 }
Beispiel #11
0
 public FirstPersonCamera(IBackBufferDimensions backBufferDimensions)
 {
     _backBufferDimensions = backBufferDimensions;
 }
 public ScreenDimensionsEffectSemantic(IBackBufferDimensions backBufferDimensions)
 {
     _backBufferDimensions = backBufferDimensions;
 }