Exemplo n.º 1
0
        /// <summary>
        /// Checks if an object is visible and adds it to the render queue
        /// </summary>
        /// <param name="camera">Current camera</param>
        /// <param name="movable">IMovable instance</param>
        internal void ProcessesVisibleObject(Camera camera, IMovable movable)
        {
            movable.FrustumCulling(camera);

            if (movable.IsRendered)
                movable.UpdateRenderQueue(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a camera to the manager
        /// </summary>
        /// <param name="name">Name of the camera</param>
        public Camera CreateCamera(string name)
        {
            Camera cam;
            if (_cameras.TryGetValue(name, out cam)) return cam;

            cam = new Camera(name, _owner);
            _cameras.Add(name, cam);

            return cam;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Performs a frustum culling against a specified camera
 /// </summary>
 /// <param name="camera">Camera</param>
 public virtual void FrustumCulling(Camera camera)
 {
     _inCameraSight = camera.Frustum.Intersect(_worldAabb);
 }
Exemplo n.º 4
0
 /// <summary>
 /// <remarks>Not supported for the Camera class </remarks>
 /// </summary>
 /// <param name="camera">Camera</param>
 void IMovable.FrustumCulling(Camera camera)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Renders a scene graph into a viewport
        /// </summary>
        /// <param name="vp">Viewport in which the rendering is sent</param>
        /// <param name="cam">Camera representing the point of view</param>
        /// <param name="queue">Queue of objects to render</param>
        internal void Render(Viewport vp, Camera cam, RenderQueue queue)
        {
            BeginRender();

            _renderingTechnique.Render(vp, cam, queue);

            EndRender();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Remove a camera
 /// </summary>
 /// <param name="camera">Camera to remove</param>
 /// <returns>Return true if the camera was removed, otherwise false</returns>
 public bool RemoveCamera(Camera camera)
 {
     return _cameras.Remove(camera.Name);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Finds all the visible objects in the scene
 /// </summary>
 /// <param name="cam">Current camera</param>
 private void FindVisibleObjects(Camera cam)
 {
     _root.FindVisibleObjects(cam, _queue, true);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Draws the entire scene
        /// </summary>
        public void RenderScene(Viewport vp, Camera cam)
        {
            Clean();

            UpdateGraph();
            FindVisibleObjects(cam);
            _renderer.Render(vp, cam, _queue);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Finds all visible objects attached to this scene node
        /// </summary>
        /// <param name="cam">Current camera</param>
        /// <param name="queue">Current render queue</param>
        /// <param name="addChildren">Boolean indicating if the search goes through childrens</param>
        internal void FindVisibleObjects(Camera cam, RenderQueue queue, bool addChildren)
        {
            for (int i = 0; i < _movablesList.Count; i++)
                queue.ProcessesVisibleObject(cam, _movablesList[i]);

            if (addChildren)
            {
                for (int j = 0; j < Childrens.Count; j++)
                    ((SceneNode)Childrens[j]).FindVisibleObjects(cam, queue, true);
            }
        }