Part one - removed references and smart pointers

This commit is contained in:
2022-11-11 19:08:46 -08:00
parent 4c2fc4cfcf
commit 42645883cd
76 changed files with 3899 additions and 3707 deletions

View File

@ -1,83 +1,83 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/SceneItemComponent.hpp"
#include "display/RenderTarget.hpp"
namespace Dawn {
enum CameraType {
CAMERA_TYPE_ORTHONOGRAPHIC,
CAMERA_TYPE_PERSPECTIVE
};
class Camera : public SceneItemComponent {
protected:
std::shared_ptr<RenderTarget> target = nullptr;
void onRenderTargetResize(RenderTarget &target, float_t w, float_t h);
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(SceneItem &item);
/**
* Updates the projection matrix.
*/
void updateProjection();
/**
* Returns the intended render target for this camera to render to, will
* automatically revert to the back buffer if no frame buffer is provided.
*
* @return The target render target framebuffer.
*/
RenderTarget & getRenderTarget();
/**
* Updates the render target for the camera to use.
*
* @param renderTarget Render target for this camera to draw to.
*/
void setRenderTarget(std::shared_ptr<RenderTarget> renderTarget);
/**
* 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 onStart() override;
/**
* Disposes a previously initialized camera.
*/
~Camera();
};
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/SceneItemComponent.hpp"
#include "display/RenderTarget.hpp"
namespace Dawn {
enum CameraType {
CAMERA_TYPE_ORTHONOGRAPHIC,
CAMERA_TYPE_PERSPECTIVE
};
class Camera : public SceneItemComponent {
protected:
RenderTarget *target = nullptr;
void onRenderTargetResize(RenderTarget *target, float_t w, float_t h);
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(SceneItem *item);
/**
* Updates the projection matrix.
*/
void updateProjection();
/**
* Returns the intended render target for this camera to render to, will
* automatically revert to the back buffer if no frame buffer is provided.
*
* @return The target render target framebuffer.
*/
RenderTarget * getRenderTarget();
/**
* Updates the render target for the camera to use.
*
* @param renderTarget Render target for this camera to draw to.
*/
void setRenderTarget(RenderTarget *renderTarget);
/**
* 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 onStart() override;
/**
* Disposes a previously initialized camera.
*/
~Camera();
};
}