Removed RenderTarget event pointer.
This commit is contained in:
@ -14,7 +14,11 @@
|
||||
namespace Dawn {
|
||||
class RenderTarget {
|
||||
public:
|
||||
StateEvent<RenderTarget*, float_t, float_t> eventRenderTargetResized;
|
||||
StateEvent<
|
||||
RenderTarget&,
|
||||
const float_t,
|
||||
const float_t
|
||||
> eventRenderTargetResized;
|
||||
|
||||
/**
|
||||
* Return the width of the render target.
|
||||
|
@ -84,7 +84,11 @@ void Camera::onStart() {
|
||||
this->eventRenderTargetResized.invoke(rt->getWidth(), rt->getHeight());
|
||||
|
||||
// Subscribe to new render target resized.
|
||||
return evtResized = useEvent([&](RenderTarget *rt, float_t w, float_t h){
|
||||
return evtResized = useEvent([&](
|
||||
RenderTarget &rt,
|
||||
const float_t w,
|
||||
const float_t h
|
||||
) {
|
||||
this->projectionNeedsUpdating = true;
|
||||
this->eventRenderTargetResized.invoke(w, h);
|
||||
}, rt->eventRenderTargetResized);
|
||||
@ -102,7 +106,11 @@ void Camera::onStart() {
|
||||
// Sub to evt legacy, we don't invoke the useTeardown to avoid invoking
|
||||
// the state event for this camera when we don't need to.
|
||||
if(!this->getRenderTarget()) return;
|
||||
evtResized = useEvent([&](RenderTarget *rt, float_t w, float_t h){
|
||||
evtResized = useEvent([&](
|
||||
RenderTarget &rt,
|
||||
const float_t w,
|
||||
const float_t h
|
||||
) {
|
||||
this->projectionNeedsUpdating = true;
|
||||
this->eventRenderTargetResized.invoke(w, h);
|
||||
}, getRenderTarget()->eventRenderTargetResized);
|
||||
|
@ -43,7 +43,11 @@ void SimpleRenderTargetQuad::onStart() {
|
||||
);
|
||||
|
||||
// Subscribe to resize event.
|
||||
evtResized = useEvent([&](RenderTarget *target, float_t w, float_t h){
|
||||
evtResized = useEvent([&](
|
||||
RenderTarget &target,
|
||||
const float_t w,
|
||||
const float_t h
|
||||
) {
|
||||
QuadMesh::bufferQuadMesh(
|
||||
&this->meshHost->mesh,
|
||||
glm::vec2(0, 0), glm::vec2(0, 0),
|
||||
|
@ -58,7 +58,11 @@ void SubSceneCameraAlign::onStart() {
|
||||
|
||||
this->realign();
|
||||
|
||||
return evtRenderResized = useEvent([&](RenderTarget *t, float_t w, float_t h) {
|
||||
return evtRenderResized = useEvent([&](
|
||||
RenderTarget &rt,
|
||||
const float_t w,
|
||||
const float_t h
|
||||
) {
|
||||
this->realign();
|
||||
}, renderTarget->eventRenderTargetResized);
|
||||
}, this->renderTarget);
|
||||
|
@ -7,18 +7,13 @@
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
UsageLock::UsageLock() : UsageLock(&this->internalPool) {
|
||||
}
|
||||
|
||||
UsageLock::UsageLock(usagelockid_t *lockPool) {
|
||||
assertNotNull(lockPool, "Lock pool cannot be null");
|
||||
this->pool = lockPool;
|
||||
UsageLock::UsageLock() {
|
||||
this->onEmpty = []() {};
|
||||
this->onFirstLock = []() {};
|
||||
}
|
||||
|
||||
usagelockid_t UsageLock::createLock() {
|
||||
usagelockid_t lock = (*this->pool)++;
|
||||
usagelockid_t lock = this->pool++;
|
||||
this->locks.push_back(lock);
|
||||
if(this->locks.size() == 1) this->onFirstLock();
|
||||
return lock;
|
||||
|
@ -10,8 +10,7 @@ namespace Dawn {
|
||||
|
||||
class UsageLock {
|
||||
protected:
|
||||
usagelockid_t internalPool = 0;
|
||||
usagelockid_t *pool = nullptr;
|
||||
usagelockid_t pool = 0;
|
||||
std::vector<usagelockid_t> locks;
|
||||
|
||||
public:
|
||||
@ -24,13 +23,6 @@ namespace Dawn {
|
||||
*/
|
||||
UsageLock();
|
||||
|
||||
/**
|
||||
* Construct a new Usage Lock object
|
||||
*
|
||||
* @param lockPool Pool that will be used to create locks.
|
||||
*/
|
||||
UsageLock(usagelockid_t *lockPool);
|
||||
|
||||
/**
|
||||
* Creates a new lock.
|
||||
*
|
||||
|
@ -33,7 +33,7 @@ void BackBufferRenderTarget::setSize(float_t width, float_t height) {
|
||||
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->eventRenderTargetResized.invoke(this, width, height);
|
||||
this->eventRenderTargetResized.invoke(*this, width, height);
|
||||
}
|
||||
|
||||
void BackBufferRenderTarget::setClearColor(struct Color color) {
|
||||
|
@ -30,7 +30,7 @@ void TextureRenderTarget::setSize(float_t width, float_t height) {
|
||||
|
||||
// Resize texture
|
||||
this->texture.setSize((int32_t)width, (int32_t)height, TEXTURE_FORMAT_RGBA, TEXTURE_DATA_FORMAT_FLOAT);
|
||||
this->eventRenderTargetResized.invoke(this, width, height);
|
||||
this->eventRenderTargetResized.invoke(*this, width, height);
|
||||
|
||||
// Create Frame Buffer
|
||||
glGenFramebuffers(1, &this->fboId);
|
||||
|
Reference in New Issue
Block a user