mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
STARK: Move _castsShadow from RenderEntry to VisualActor
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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<Face *, uint32> FaceBufferMap;
|
||||
|
||||
@@ -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<VisualActor>();
|
||||
if (actor) {
|
||||
actor->render(_position3D, _direction3D, lights, _castsShadow, _maxShadowLength);
|
||||
actor->render(_position3D, _direction3D, lights, _maxShadowLength);
|
||||
}
|
||||
|
||||
VisualProp *prop = _visual->get<VisualProp>();
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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<VisualActor>();
|
||||
Resources::Anim *anim = getAnim();
|
||||
if (anim && anim->getSubType() == Anim::kAnimSkeleton) {
|
||||
Resources::AnimSkeleton *animSkeleton = Resources::Object::cast<Resources::AnimSkeleton>(anim);
|
||||
_renderEntry->setcastsShadow(animSkeleton->castsShadow());
|
||||
actor->setCastShadow(animSkeleton->castsShadow());
|
||||
}
|
||||
|
||||
_renderEntry->setVisual(visual);
|
||||
_renderEntry->setPosition3D(_position3D, _direction3D);
|
||||
_renderEntry->setSortKey(getSortKey());
|
||||
} else {
|
||||
_renderEntry->setVisual(nullptr);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ VisualActor::VisualActor() :
|
||||
_textureSetFacial(nullptr),
|
||||
_time(0),
|
||||
_modelIsDirty(true),
|
||||
_faceTextureName(' ') {
|
||||
_faceTextureName(' '),
|
||||
_castsShadow(false) {
|
||||
}
|
||||
|
||||
VisualActor::~VisualActor() {
|
||||
|
||||
@@ -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<Gfx::LightEntry *> &lights,
|
||||
bool castChadow, uint32 maxShadowLength) = 0;
|
||||
virtual void render(const Math::Vector3d &position, float direction, const Common::Array<Gfx::LightEntry *> &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;
|
||||
|
||||
Reference in New Issue
Block a user