Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/includes/pipelinetask.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ENGINE_EXPORT PipelineTask : public Object {
PipelineTask();
~PipelineTask();

virtual void exec(PipelineContext *context);
virtual void exec(PipelineContext &context);

virtual void resize(int width, int height);

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/ambientocclusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AmbientOcclusion : public PipelineTask {
~AmbientOcclusion();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setSettings(const PostProcessSettings &settings) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/antialiasing.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AntiAliasing : public PipelineTask {
AntiAliasing();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setInput(int index, Texture *texture) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Bloom : public PipelineTask {
Bloom();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void resize(int32_t width, int32_t height) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/deferredlighting.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DeferredLighting : public PipelineTask {
DeferredLighting();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setInput(int index, Texture *texture) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/gbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GBuffer : public PipelineTask {
GBuffer();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

private:
RenderTarget *m_gbuffer;
Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/guilayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GuiLayer : public PipelineTask {
void showUiAsSceneView(bool flag);

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setInput(int index, Texture *source) override;

Expand Down
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/reflections.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Reflections : public PipelineTask {
Reflections();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setInput(int index, Texture *texture) override;

Expand Down
14 changes: 8 additions & 6 deletions engine/includes/pipelinetasks/shadowmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class ShadowMap : public PipelineTask {
ShadowMap();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void areaLightUpdate(PipelineContext *context, AreaLight *light, list<Renderable *> &components);
void directLightUpdate(PipelineContext *context, DirectLight *light, list<Renderable *> &components, const Camera &camera);
void pointLightUpdate(PipelineContext *context, PointLight *light, list<Renderable *> &components);
void spotLightUpdate(PipelineContext *context, SpotLight *light, list<Renderable *> &components);
void areaLightUpdate(PipelineContext &context, AreaLight *light, list<Renderable *> &components);
void directLightUpdate(PipelineContext &context, DirectLight *light, list<Renderable *> &components, const Camera &camera);
void pointLightUpdate(PipelineContext &context, PointLight *light, list<Renderable *> &components);
void spotLightUpdate(PipelineContext &context, SpotLight *light, list<Renderable *> &components);

void cleanShadowCache();

RenderTarget *requestShadowTiles(uint32_t id, uint32_t lod, int32_t *x, int32_t *y, int32_t *w, int32_t *h, uint32_t count);
RenderTarget *requestShadowTiles(PipelineContext &context, uint32_t id, uint32_t lod, int32_t *x, int32_t *y, int32_t *w, int32_t *h, uint32_t count);

private:
unordered_map<uint32_t, pair<RenderTarget *, vector<AtlasNode *>>> m_tiles;
Expand All @@ -44,6 +44,8 @@ class ShadowMap : public PipelineTask {

float m_bias;

uint32_t m_shadowResolution;

};

#endif // SHADOWMAP_H
2 changes: 1 addition & 1 deletion engine/includes/pipelinetasks/translucent.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Translucent : public PipelineTask {
Translucent();

private:
void exec(PipelineContext *context) override;
void exec(PipelineContext &context) override;

void setInput(int index, Texture *texture) override;

Expand Down
10 changes: 5 additions & 5 deletions engine/src/components/spotlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ void SpotLight::drawGizmosSelected() {
float radius = tan(DEG2RAD * m_angle * 0.5f) * distance;

Matrix4 m(t->worldPosition(), t->worldQuaternion() * Quaternion(Vector3(1, 0, 0), 90), Vector3(1.0f));
Gizmos::drawCircle(t->worldQuaternion() * Vector3(0.0f, 0.0f, distance), radius, gizmoColor(), m);
Gizmos::drawCircle(t->worldQuaternion() * Vector3(0.0f, 0.0f, -distance), radius, gizmoColor(), m);

Gizmos::drawLines({Vector3(),
Vector3( 0.0f, radius, distance),
Vector3( 0.0f,-radius, distance),
Vector3( radius, 0.0f, distance),
Vector3(-radius, 0.0f, distance)},
Vector3( 0.0f, radius, -distance),
Vector3( 0.0f,-radius, -distance),
Vector3( radius, 0.0f, -distance),
Vector3(-radius, 0.0f, -distance)},
{0, 1, 0, 2, 0, 3, 0, 4}, gizmoColor(), t->worldTransform());
}
22 changes: 11 additions & 11 deletions engine/src/editor/viewport/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@ class Outline : public PipelineTask {
}

private:
void exec(PipelineContext *context) override {
void exec(PipelineContext &context) override {
if(m_combineMaterial && m_controller) {
CommandBuffer *buffer = context->buffer();
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("Outline");

buffer->setRenderTarget(m_outlineTarget);
buffer->clearRenderTarget();
RenderList filter;
for(auto actor : m_controller->selected()) {
for(auto it : context->culledComponents()) {
for(auto it : context.culledComponents()) {
Renderable *component = dynamic_cast<Renderable *>(it);
if(component && component->actor()->isInHierarchy(static_cast<Actor *>(actor))) {
filter.push_back(component);
}
}
}
context->drawRenderers(CommandBuffer::RAYCAST, filter);
context.drawRenderers(CommandBuffer::RAYCAST, filter);

buffer->setRenderTarget(m_resultTarget);
buffer->drawMesh(Matrix4(), PipelineContext::defaultPlane(), 0, CommandBuffer::UI, m_combineMaterial);
Expand Down Expand Up @@ -196,7 +196,7 @@ class GridRender : public PipelineTask {
}

private:
void exec(PipelineContext *context) override {
void exec(PipelineContext &context) override {
Camera *camera = Camera::current();

Transform *t = camera->transform();
Expand Down Expand Up @@ -275,7 +275,7 @@ class GridRender : public PipelineTask {
m_grid->setFloat("scale", &m_scale);
m_grid->setFloat("width", &width);

CommandBuffer *buffer = context->buffer();
CommandBuffer *buffer = context.buffer();

buffer->beginDebugMarker("GridRender");

Expand Down Expand Up @@ -335,8 +335,8 @@ class GizmoRender : public PipelineTask {
}

private:
void exec(PipelineContext *context) override {
CommandBuffer *buffer = context->buffer();
void exec(PipelineContext &context) override {
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("GizmoRender");

Gizmos::clear();
Expand Down Expand Up @@ -400,15 +400,15 @@ class DebugRender : public PipelineTask {
}

private:
void exec(PipelineContext *context) override {
void exec(PipelineContext &context) override {
if(!m_buffers.empty()) {
CommandBuffer *buffer = context->buffer();
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("DebugRender");
buffer->setScreenProjection(0, 0, m_width, m_height);

int i = 0;
for(auto &it : m_buffers) {
it.second->setTexture("texture0", context->textureBuffer(it.first));
it.second->setTexture("texture0", context.textureBuffer(it.first));

float width = m_width * 0.25f;
float height = m_height * 0.25f;
Expand Down
2 changes: 1 addition & 1 deletion engine/src/pipelinecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void PipelineContext::draw(Camera *camera) {

for(auto it : m_renderTasks) {
if(it->isEnabled()) {
it->exec(this);
it->exec(*this);
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/pipelinetask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PipelineTask::~PipelineTask() {
/*!
The task will be executed for the provided \a context.
*/
void PipelineTask::exec(PipelineContext *context) {
void PipelineTask::exec(PipelineContext &context) {
A_UNUSED(context);
}
/*!
Expand Down
4 changes: 2 additions & 2 deletions engine/src/pipelinetasks/ambientocclusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ AmbientOcclusion::~AmbientOcclusion() {
m_noiseTexture->deleteLater();
}

void AmbientOcclusion::exec(PipelineContext *context) {
CommandBuffer *buffer = context->buffer();
void AmbientOcclusion::exec(PipelineContext &context) {
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("AmbientOcclusion");

if(m_occlusion) {
Expand Down
4 changes: 2 additions & 2 deletions engine/src/pipelinetasks/antialiasing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ AntiAliasing::AntiAliasing() :

}

void AntiAliasing::exec(PipelineContext *context) {
void AntiAliasing::exec(PipelineContext &context) {
if(m_material) {
CommandBuffer *buffer = context->buffer();
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("AntiAliasing");

buffer->setRenderTarget(m_resultTarget);
Expand Down
4 changes: 2 additions & 2 deletions engine/src/pipelinetasks/bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Bloom::Bloom() :
m_outputs.push_back(make_pair("Result", nullptr));
}

void Bloom::exec(PipelineContext *context) {
void Bloom::exec(PipelineContext &context) {
if(m_material) {
CommandBuffer *buffer = context->buffer();
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("Bloom");

Texture *texture(m_outputs.front().second);
Expand Down
8 changes: 4 additions & 4 deletions engine/src/pipelinetasks/deferredlighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ DeferredLighting::DeferredLighting() :
m_outputs.push_back(make_pair("Result", nullptr));
}

void DeferredLighting::exec(PipelineContext *context) {
CommandBuffer *buffer = context->buffer();
void DeferredLighting::exec(PipelineContext &context) {
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("DeferredLighting");

buffer->setRenderTarget(m_lightPass);
// Light pass
for(auto it : context->sceneLights()) {
for(auto it : context.sceneLights()) {
BaseLight *light = static_cast<BaseLight *>(it);

Mesh *mesh = PipelineContext::defaultCube();
Expand Down Expand Up @@ -82,7 +82,7 @@ void DeferredLighting::exec(PipelineContext *context) {
Quaternion q(t->worldQuaternion());

Vector3 position(m[12], m[13], m[14]);
Vector3 direction(q * Vector3(0.0f, 0.0f,-1.0f));
Vector3 direction(q * Vector3(0.0f, 0.0f, 1.0f));

float distance = static_cast<SpotLight *>(light)->attenuationDistance();
float angle = static_cast<SpotLight *>(light)->outerAngle();
Expand Down
10 changes: 5 additions & 5 deletions engine/src/pipelinetasks/gbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ GBuffer::GBuffer() :
}
}

void GBuffer::exec(PipelineContext *context) {
CommandBuffer *buffer = context->buffer();
void GBuffer::exec(PipelineContext &context) {
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("GBuffer Pass");

buffer->setViewport(0, 0, m_width, m_height);
context->cameraReset();
context.cameraReset();

buffer->setRenderTarget(m_gbuffer);
buffer->clearRenderTarget(true, context->currentCamera()->color());
buffer->clearRenderTarget(true, context.currentCamera()->color());

context->drawRenderers(CommandBuffer::DEFAULT, context->culledComponents());
context.drawRenderers(CommandBuffer::DEFAULT, context.culledComponents());

buffer->endDebugMarker();
}
8 changes: 4 additions & 4 deletions engine/src/pipelinetasks/guilayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ GuiLayer::GuiLayer() :
m_outputs.push_back(make_pair("Result", nullptr));
}

void GuiLayer::exec(PipelineContext *context) {
CommandBuffer *buffer = context->buffer();
void GuiLayer::exec(PipelineContext &context) {
CommandBuffer *buffer = context.buffer();

buffer->beginDebugMarker("GuiLayer");

if(!m_uiAsSceneView) {
buffer->setScreenProjection(0, 0, m_width, m_height);
} else {
context->cameraReset();
context.cameraReset();
}

for(auto it : context->uiComponents()) {
for(auto it : context.uiComponents()) {
it->draw(*buffer, CommandBuffer::UI);
}

Expand Down
4 changes: 2 additions & 2 deletions engine/src/pipelinetasks/reflections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Reflections::Reflections() :
}
}

void Reflections::exec(PipelineContext *context) {
CommandBuffer *buffer = context->buffer();
void Reflections::exec(PipelineContext &context) {
CommandBuffer *buffer = context.buffer();
buffer->beginDebugMarker("Reflections");

if(m_slrMaterial) { // sslr step
Expand Down
Loading