Example #1
0
 public override void OnInitializeSceneInterface(SceneInterface sceneInterface)
 {
     #if DEBUG
     SynapseGaming.SunBurn.Engine.Editor.SunBurnEditor editor = new SynapseGaming.SunBurn.Engine.Editor.SunBurnEditor(sceneInterface, true);
     sceneInterface.AddManager(editor);
     #endif
 }
Example #2
0
        /// <summary>
        ///   Creates the unique SceneInterface instance used accross the entire Application.
        /// </summary>
        protected virtual void CreateSceneInterface()
        {
            _sceneInterface = new SceneInterface();

            _sceneInterface.Unload();
            _sceneInterface.AddManager(new ResourceManager(_sceneInterface));
            _sceneInterface.AddManager(new CameraManager(_sceneInterface));
            _sceneInterface.AddManager(new ObjectManager(_sceneInterface));
            _sceneInterface.AddManager(new LightManager(_sceneInterface));

#if WINDOWS_PHONE
            _sceneInterface.AddManager(new LightMapManager(_sceneInterface)); // required by WP7 projects to render properly.
#endif

            InitializeSunBurn();

            _sceneInterface.ApplyPreferences(SunBurnSystemPreferences);
        }
Example #3
0
        /// <summary>
        ///   Adds the Forward or Deferred SunBurn Renderers to the SunBurn SceneInterface.
        /// </summary>
        /// <param name = "renderer">Forward or Deferred</param>
        /// <remarks>
        ///   This method needs to be called once ideally in the overrided CreateSceneInterface() method.
        /// </remarks>
        protected void CreateRenderer(Renderers renderer)
        {
#if SUNBURN_PRO && !WINDOWS_PHONE
            switch (renderer)
            {
            case Renderers.Forward:
            {
                _sceneInterface.AddManager(new RenderManager(_sceneInterface));
                _sceneInterface.AddManager(new ShadowMapManager(_sceneInterface));
                break;
            }

            case Renderers.Deferred:
            {
                _sceneInterface.AddManager(new DeferredRenderManager(_sceneInterface));
                _sceneInterface.AddManager(new DeferredShadowMapManager(_sceneInterface));
                break;
            }
            }
#else
            _sceneInterface.AddManager(new RenderManager(_sceneInterface));
#if !WINDOWS_PHONE
            _sceneInterface.AddManager(new ShadowMapManager(_sceneInterface));
#endif
#endif
        }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        protected Game_cl()
            : base()
        {
            mGraphics = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";

            // Required for lighting system.
            Components.Add(new SplashScreenGameComponent(this, mGraphics));

            // Create the lighting system.
            mLightingSystemManager = new LightingSystemManager(Services, Content);

            mSceneState = new SceneState();
            mEnvironment = new SceneEnvironment();

            mSceneInterface = new SceneInterface(mGraphics);
            mSceneInterface.CreateDefaultManagers(false);
            mSceneInterface.AddManager(new ObjectManager_cl());

            // Create the sprite manager used to create and organize sprite containers for 2D rendering.
            mSpriteManager = new SpriteManager(mGraphics);
            mSceneInterface.AddManager(mSpriteManager);

            mFrameBuffers = new FrameBuffers(mGraphics, DetailPreference.Low, DetailPreference.Low);
            mSceneInterface.ResourceManager.AssignOwnership(mFrameBuffers);
            mStaticSceneEffects = new List<SceneEffect>();

            //mView = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward, Vector3.Up);
            //mProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000f);

            mCameraEntity = new Entity_cl();

            #if WORLD_EDITOR
            mWorldEditor = new WorldEditor_cl();
            #endif

            mManagers = new List<BaseManager_cl>();
            mRandom = new Random();
            mTimer = new FNA.Core.Timer_cl();

            mBaseInstance = this;
            mIsPlayingGame = true;
        }
Example #5
0
        public StarterGame()
        {
            // Default XNA setup.
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Required for lighting system.
            graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;

            // Required for lighting system.
            splashScreenGameComponent = new SplashScreenGameComponent(this);
            Components.Add(splashScreenGameComponent);

            // Create the lighting system.
            sunBurnCoreSystem = new SunBurnCoreSystem(Services, Content);
            sceneState = new SceneState();

            // Create the scene interface. Acts as a service provider containing all scene managers
            // and returning them by type (including custom managers). Also acts as a component
            // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering,
            // Unload, ...) are automatically called on all contained managers.
            //
            // This design allows managers to be plugged-in like modular components and for managers
            // to easily be added, removed, or replaced with custom implementations.
            //
            SceneInterface = new SceneInterface();
            SceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true);

            SpriteManager = new SpriteManager(SceneInterface);
            SceneInterface.AddManager(SpriteManager);

            // Create the frame buffers used for rendering (sized to the backbuffer) and
            // assign them to the ResourceManager so we don't have to worry about cleanup.
            frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.Medium);
            SceneInterface.ResourceManager.AssignOwnership(frameBuffers);

            physicsManager.RegisterPhysicsBody(Character);
            collisionManager.RegisterCollisionBody(Character);

            // Post console messages letting the user know how to open the SunBurn Editor.
            SceneInterface.ShowConsole = true;
            SystemConsole.AddMessage("Welcome to the SunBurn Engine.", 4);
            SystemConsole.AddMessage("Use an Xbox controller or the W, A, S, D keys to navigate the scene.", 8);
            SystemConsole.AddMessage("Press F11 to open the SunBurn Editor.", 12);
        }