Example Triangle Pog
This commit is contained in:
57
src/dawn/scene/components/display/Camera.hpp
Normal file
57
src/dawn/scene/components/display/Camera.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/SceneItemComponent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
enum CameraType {
|
||||
CAMERA_TYPE_ORTHONOGRAPHIC,
|
||||
CAMERA_TYPE_PERSPECTIVE
|
||||
};
|
||||
|
||||
class Camera : public SceneItemComponent {
|
||||
public:
|
||||
glm::mat4 projection;
|
||||
|
||||
// Perspective
|
||||
enum CameraType type = CAMERA_TYPE_PERSPECTIVE;
|
||||
float_t fov = 0.785398f;// 45 degrees
|
||||
|
||||
// Ortho
|
||||
float_t orthoLeft = 0.0f;
|
||||
float_t orthoRight = 1.0f;
|
||||
float_t orthoBottom = 0.0f;
|
||||
float_t orthoTop = 1.0f;
|
||||
|
||||
// Shared
|
||||
float_t clipNear = 0.001f;
|
||||
float_t clipFar = 100.0f;
|
||||
|
||||
/**
|
||||
* Create a new Camera Component.
|
||||
*
|
||||
* @param item SceneItem that this component belongs to.
|
||||
*/
|
||||
Camera(std::weak_ptr<SceneItem> item);
|
||||
|
||||
/**
|
||||
* Updates the projection matrix.
|
||||
*/
|
||||
void updateProjection();
|
||||
|
||||
/**
|
||||
* Returs the aspect ratio of the camera.
|
||||
*
|
||||
* @return The aspect ratio of the camera.
|
||||
*/
|
||||
float_t getAspect();
|
||||
|
||||
/**
|
||||
* Event triggered by the scene item when the item is added to the scene.
|
||||
*/
|
||||
void start() override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user