//
//  CameraNode.hpp
//  Meteor
//
//  Created by Cesar Parent on 11/09/2015.
//  Copyright © 2015 Cesar Parent. All rights reserved.
//

#ifndef CameraNode_hpp
#define CameraNode_hpp

#include "Layer.h"

NS_BEGIN

class Scene;

/*!
 * @brief           A node that specifies where a scene is drawn from.
 * @ingroup         gameobjects
 * @details         When a camera node is in the node tree and is set as a scene's camera using
 *                  Scene::setCamera(ARC<CameraNode>), the scene is rendered from the camera node's
 *                  perspective. Because the camera is a node, it can be moved like any other object
 *                  using Node's API and actions.
 *
 *                  When a scene uses a camera, it is rendered so that the camera is in the middle
 *                  of the scene's frame. Moving, scaling and rotating the camera will move, scale
 *                  and rotate the scene's view as follows:
 *                  
 *                  * Upscaling the camera will broaden its field of view, as if a physical camera
 *                      zoomed out.
 *                  * rotating the camera one way will make all objects in the view appears as if
 *                      they were rotated the other way around.
 */
class CameraNode : public Layer {
    
    friend class Scene;
    
public:
    
    CameraNode();
    
    
    virtual ~CameraNode();
    
    void draw(RendererProtocol& renderer) override;

    
    mat33
    cameraTransform();
    
private:
    
    mat33   _cameraTransform;
    
    Scene*  _scene;
};


NS_END

#endif /* CameraNode_hpp */
