Started upgrading things to new state
This commit is contained in:
@ -17,34 +17,32 @@ namespace Dawn {
|
||||
|
||||
class Camera : public SceneItemComponent {
|
||||
protected:
|
||||
RenderTarget *target = nullptr;
|
||||
bool_t projectionNeedsUpdating = true;
|
||||
glm::mat4 projection;
|
||||
|
||||
void onRenderTargetResize(RenderTarget *target, float_t w, float_t h);
|
||||
|
||||
public:
|
||||
Event<float_t, float_t> eventRenderTargetResized;
|
||||
|
||||
static Camera * create(Scene *scene) {
|
||||
auto item = scene->createSceneItem();
|
||||
auto cam = item->addComponent<Camera>();
|
||||
return cam;
|
||||
}
|
||||
|
||||
glm::mat4 projection;
|
||||
StateProperty<RenderTarget*> renderTarget;
|
||||
StateProperty<float_t> fov;
|
||||
StateProperty<enum CameraType> type;
|
||||
|
||||
// Perspective
|
||||
enum CameraType type = CAMERA_TYPE_PERSPECTIVE;
|
||||
float_t fov = 0.785398f;// 45 degrees
|
||||
StateProperty<float_t> orthoLeft;
|
||||
StateProperty<float_t> orthoRight;
|
||||
StateProperty<float_t> orthoBottom;
|
||||
StateProperty<float_t> orthoTop;
|
||||
|
||||
// Ortho
|
||||
float_t orthoLeft = 0.0f;
|
||||
float_t orthoRight = 1.0f;
|
||||
float_t orthoBottom = 0.0f;
|
||||
float_t orthoTop = 1.0f;
|
||||
StateProperty<float_t> clipNear;
|
||||
StateProperty<float_t> clipFar;
|
||||
|
||||
// Shared
|
||||
float_t clipNear = 0.001f;
|
||||
float_t clipFar = 50.0f;
|
||||
Event<float_t, float_t> eventRenderTargetResized;
|
||||
StateEvent<float_t, float_t> event2RenderTargetResized;
|
||||
|
||||
/**
|
||||
* Create a new Camera Component.
|
||||
@ -54,9 +52,11 @@ namespace Dawn {
|
||||
Camera(SceneItem *item);
|
||||
|
||||
/**
|
||||
* Updates the projection matrix.
|
||||
* Returns the current projection matrix.
|
||||
*
|
||||
* @return Projection matrix for this camera.
|
||||
*/
|
||||
void updateProjection();
|
||||
glm::mat4 getProjection();
|
||||
|
||||
/**
|
||||
* Returns the intended render target for this camera to render to, will
|
||||
@ -66,13 +66,6 @@ namespace Dawn {
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user