Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Fix lighting shader not set in drawScreenSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
scemino committed Apr 8, 2021
1 parent 3067e7e commit 9d6a212
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ void Engine::draw(ngf::RenderTarget &target, bool screenshot) const {
statesObjects.shader = &lightingShader;
lightingShader.setNumberLights(0);
lightingShader.setAmbientColor(ngf::Colors::White);
std::for_each(objects.begin(), objects.end(), [this, &target](const auto &pObj) {
m_pImpl->drawScreenSpace(*pObj, target);
std::for_each(objects.begin(), objects.end(), [this, &target, statesObjects](const auto &pObj) {
m_pImpl->drawScreenSpace(*pObj, target, statesObjects);
});

m_pImpl->_talkingState.draw(target, {});
Expand Down
3 changes: 2 additions & 1 deletion src/Engine/EngineImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ void Engine::Impl::drawDebugHotspot(const Object &object, ngf::RenderTarget &tar
arrow.draw(target, s);
}

void Engine::Impl::drawScreenSpace(const Object &object, ngf::RenderTarget &target) {
void Engine::Impl::drawScreenSpace(const Object &object, ngf::RenderTarget &target, ngf::RenderStates states) {
if (object.getScreenSpace() != ScreenSpace::Object)
return;

Expand All @@ -848,6 +848,7 @@ void Engine::Impl::drawScreenSpace(const Object &object, ngf::RenderTarget &targ

t.setPosition({pos.x, Screen::Height - pos.y});
s.transform = t.getTransform();
s.shader = states.shader;

AnimDrawable animDrawable;
animDrawable.setAnim(anim);
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/EngineImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ struct Engine::Impl {
void drawActorHotspot(ngf::RenderTarget &target) const;
void drawObjectHotspot(const Object &obj, ngf::RenderTarget &target) const;
void drawDebugHotspot(const Object &object, ngf::RenderTarget &target) const;
static void drawScreenSpace(const Object &object, ngf::RenderTarget &target) ;
static void drawScreenSpace(const Object &object, ngf::RenderTarget &target, ngf::RenderStates states);
glm::vec2 roomToScreen(const glm::vec2 &pos) const;
ngf::irect roomToScreen(const ngf::irect &rect) const;
int getCurrentActorIndex() const;
Expand Down

0 comments on commit 9d6a212

Please sign in to comment.