diff --git a/engines/stark/gfx/openglsactor.cpp b/engines/stark/gfx/openglsactor.cpp index 5b943524879..1e3a903835d 100644 --- a/engines/stark/gfx/openglsactor.cpp +++ b/engines/stark/gfx/openglsactor.cpp @@ -50,8 +50,7 @@ OpenGLSActorRenderer::~OpenGLSActorRenderer() { delete _shadowShader; } -void OpenGLSActorRenderer::render(const Math::Vector3d &position, float direction, const LightEntryArray &lights, - bool castsShadow, uint32 maxShadowLength) { +void OpenGLSActorRenderer::render(const Math::Vector3d &position, float direction, const LightEntryArray &lights, uint32 maxShadowLength) { if (_modelIsDirty) { // Update the OpenGL Buffer Objects if required clearVertices(); @@ -117,7 +116,7 @@ void OpenGLSActorRenderer::render(const Math::Vector3d &position, float directio _shader->unbind(); - if (castsShadow && StarkSettings->getBoolSetting(Settings::kShadow)) { + if (_castsShadow && StarkSettings->getBoolSetting(Settings::kShadow)) { glEnable(GL_BLEND); glEnable(GL_STENCIL_TEST); diff --git a/engines/stark/gfx/openglsactor.h b/engines/stark/gfx/openglsactor.h index 82477bc5a3f..6693c9b5da2 100644 --- a/engines/stark/gfx/openglsactor.h +++ b/engines/stark/gfx/openglsactor.h @@ -43,8 +43,7 @@ public: OpenGLSActorRenderer(OpenGLSDriver *gfx); virtual ~OpenGLSActorRenderer(); - void render(const Math::Vector3d &position, float direction, const LightEntryArray &lights, - bool castsShadow, uint32 maxShadowLength) override; + void render(const Math::Vector3d &position, float direction, const LightEntryArray &lights, uint32 maxShadowLength) override; protected: typedef Common::HashMap FaceBufferMap; diff --git a/engines/stark/gfx/renderentry.cpp b/engines/stark/gfx/renderentry.cpp index 412984ebae7..50a8e27bc1b 100644 --- a/engines/stark/gfx/renderentry.cpp +++ b/engines/stark/gfx/renderentry.cpp @@ -45,7 +45,6 @@ RenderEntry::RenderEntry(Resources::ItemVisual *owner, const Common::String &nam _direction3D(0.0), _sortKey(0.0), _clickable(true), - _castsShadow(false), _maxShadowLength(0) { } @@ -62,7 +61,7 @@ void RenderEntry::render(const LightEntryArray &lights) { VisualActor *actor = _visual->get(); if (actor) { - actor->render(_position3D, _direction3D, lights, _castsShadow, _maxShadowLength); + actor->render(_position3D, _direction3D, lights, _maxShadowLength); } VisualProp *prop = _visual->get(); diff --git a/engines/stark/gfx/renderentry.h b/engines/stark/gfx/renderentry.h index b5f572fbc56..8bac7040e2a 100644 --- a/engines/stark/gfx/renderentry.h +++ b/engines/stark/gfx/renderentry.h @@ -74,7 +74,6 @@ public: void setPosition3D(const Math::Vector3d &position, float direction); void setSortKey(float sortKey); void setClickable(bool clickable); - void setcastsShadow(bool cast) { _castsShadow = cast; } void setMaxShadowLength(uint32 length) { _maxShadowLength = length; } /** Gets the position */ @@ -118,7 +117,6 @@ protected: float _sortKey; bool _clickable; - bool _castsShadow; uint32 _maxShadowLength; }; diff --git a/engines/stark/resources/item.cpp b/engines/stark/resources/item.cpp index a56cf37d5b5..bdb72d1899b 100644 --- a/engines/stark/resources/item.cpp +++ b/engines/stark/resources/item.cpp @@ -1041,15 +1041,16 @@ Gfx::RenderEntry *ModelItem::getRenderEntry(const Common::Point &positionOffset) visual = getVisual(); } - _renderEntry->setVisual(visual); - _renderEntry->setPosition3D(_position3D, _direction3D); - _renderEntry->setSortKey(getSortKey()); - + VisualActor *actor = visual->get(); Resources::Anim *anim = getAnim(); if (anim && anim->getSubType() == Anim::kAnimSkeleton) { Resources::AnimSkeleton *animSkeleton = Resources::Object::cast(anim); - _renderEntry->setcastsShadow(animSkeleton->castsShadow()); + actor->setCastShadow(animSkeleton->castsShadow()); } + + _renderEntry->setVisual(visual); + _renderEntry->setPosition3D(_position3D, _direction3D); + _renderEntry->setSortKey(getSortKey()); } else { _renderEntry->setVisual(nullptr); } diff --git a/engines/stark/visual/actor.cpp b/engines/stark/visual/actor.cpp index 308f297dd2b..063131b9734 100644 --- a/engines/stark/visual/actor.cpp +++ b/engines/stark/visual/actor.cpp @@ -39,7 +39,8 @@ VisualActor::VisualActor() : _textureSetFacial(nullptr), _time(0), _modelIsDirty(true), - _faceTextureName(' ') { + _faceTextureName(' '), + _castsShadow(false) { } VisualActor::~VisualActor() { diff --git a/engines/stark/visual/actor.h b/engines/stark/visual/actor.h index da489b2d2fe..318f6ffc73f 100644 --- a/engines/stark/visual/actor.h +++ b/engines/stark/visual/actor.h @@ -64,9 +64,10 @@ public: void setTime(uint32 time); void resetBlending(); + void setCastShadow(bool cast) { _castsShadow = cast; } + bool intersectRay(const Math::Ray &ray, const Math::Vector3d &position, float direction); - virtual void render(const Math::Vector3d &position, float direction, const Common::Array &lights, - bool castChadow, uint32 maxShadowLength) = 0; + virtual void render(const Math::Vector3d &position, float direction, const Common::Array &lights, uint32 maxShadowLength) = 0; protected: AnimHandler *_animHandler; @@ -76,6 +77,7 @@ protected: char _faceTextureName; uint32 _time; bool _modelIsDirty; + bool _castsShadow; Math::Matrix4 getModelMatrix(const Math::Vector3d &position, float direction); const Gfx::Texture *resolveTexture(const Material *material) const;