Example Triangle Pog

This commit is contained in:
2022-10-18 22:02:03 -07:00
parent 8698ef318b
commit e08684de19
21 changed files with 525 additions and 10 deletions

View 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;
};
}