コード例 #1
0
        /// <summary>
        /// Draws the node.
        /// </summary>
        /// <param name="time">Time snapshot</param>
        /// <param name="renderer">The renderer that draws the node.</param>
        internal void DoDraw(GameTime time, SceneRenderer renderer)
        {
            foreach (var comp in this.Components)
            {
                if (comp.Enabled)
                {
                    comp.PreRender(time, renderer);
                }
            }

            foreach (var comp in this.Components)
            {
                if (comp.Enabled)
                {
                    comp.Render(time, renderer);
                }
            }

            // Pass the draw call to all children.
            foreach (var child in this.Children)
            {
                child.DoDraw(time, renderer);
            }

            foreach (var comp in this.Components)
            {
                if (comp.Enabled)
                {
                    comp.PostRender(time, renderer);
                }
            }
        }
コード例 #2
0
 internal void PostRender(GameTime time, SceneRenderer renderer)
 {
     if (!this.Enabled)
     {
         return;
     }
     this.OnPostRender(time, renderer);
 }
コード例 #3
0
 /// <summary>
 /// Renders the scene node.
 /// </summary>
 /// <param name="time">Time snapshot</param>
 /// <param name="renderer">The renderer that is used for drawing.</param>
 protected override void OnRender(GameTime time, SceneRenderer renderer)
 {
     if (this.Model == null)
     {
         return;
     }
     renderer.Draw(this.Model, this.Node.Transform.WorldTransform, this.Node.Material);
 }
コード例 #4
0
 /// <summary>
 /// Draws the sky.
 /// </summary>
 /// <param name="renderer"></param>
 /// <param name="camera"></param>
 public override void Draw(SceneRenderer renderer, Camera camera)
 {
     GL.ClearColor(
         this.Color.R,
         this.Color.G,
         this.Color.B,
         this.Color.A);
     GL.Clear(ClearBufferMask.ColorBufferBit);
 }
コード例 #5
0
ファイル: Scene.cs プロジェクト: PlumpMath/OpenWorld.Engine
        /// <summary>
        /// Draws the whole scene.
        /// </summary>
        /// <param name="camera">The camera setting for the scene.</param>
        /// <param name="renderer">The renderer that draws the the scene.</param>
        /// <param name="time">Time snapshot</param>
        public void Draw(Camera camera, SceneRenderer renderer, GameTime time)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }
            if (renderer == null)
            {
                throw new ArgumentNullException("renderer");
            }

            renderer.Begin();
            this.root.DoDraw(time, renderer);
            renderer.End(this, camera);
        }
コード例 #6
0
ファイル: Scene.cs プロジェクト: PlumpMath/OpenWorld.Engine
        /// <summary>
        /// Instantiates a new scene.
        /// </summary>
        /// <param name="flags">Specifies the behaviour of the world.</param>
        public Scene(SceneCreationFlags flags)
        {
            this.root            = SceneNode.CreateRoot(this);
            this.defaultRenderer = new SimpleRenderer();

            if (flags.HasFlag(SceneCreationFlags.EnablePhysics))
            {
                this.CollisionConfiguration = new DefaultCollisionConfiguration();
                this.Dispatcher             = new CollisionDispatcher(this.CollisionConfiguration);
                this.Broadphase             = new DbvtBroadphase();
                this.Broadphase.OverlappingPairCache.SetInternalGhostPairCallback(new GhostPairCallback());

                this.world = new DiscreteDynamicsWorld(this.Dispatcher, this.Broadphase, null, this.CollisionConfiguration);

                // Register physics handler
                Game.Current.UpdateNonScene += this.UpdatePhysics;
            }

            Game.Current.Disposing += this.Dispose;
        }
コード例 #7
0
ファイル: Sky.cs プロジェクト: PlumpMath/OpenWorld.Engine
 /// <summary>
 /// Draws the sky.
 /// </summary>
 /// <param name="renderer">The renderer that is drawing the sky.</param>
 /// <param name="camera">The camera that shows the sky.</param>
 public abstract void Draw(SceneRenderer renderer, Camera camera);
コード例 #8
0
 /// <summary>
 /// Postprocesses rendering of the scene node.
 /// </summary>
 /// <param name="time">Time snapshot</param>
 /// <param name="renderer">The renderer that is used for drawing.</param>
 protected virtual void OnPostRender(GameTime time, SceneRenderer renderer)
 {
 }
コード例 #9
0
 /// <summary>
 /// Renders the scene node.
 /// </summary>
 /// <param name="time">Time snapshot</param>
 /// <param name="renderer">The renderer that is used for drawing.</param>
 protected override void OnRender(GameTime time, SceneRenderer renderer)
 {
     renderer.Light(this.Node.Transform.WorldPosition, this);
 }
コード例 #10
0
 internal SceneNodeDrawEventArgs(GameTime time, SceneRenderer renderer)
 {
     this.time     = time;
     this.renderer = renderer;
 }