mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
remove overrideRenderPass completely
Also removes Lua functions: - obj_setOverrideRenderPass() * entity_setRenderPass() is now the same as obj_setRenderPass(), without the special case alternate name in Lua
This commit is contained in:
parent
1a90625979
commit
f466e1e7c8
5 changed files with 22 additions and 70 deletions
|
@ -3629,14 +3629,12 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
|||
|
||||
setCanLeaveWater(true);
|
||||
|
||||
debugLog("setOverrideRenderPass");
|
||||
debugLog("setRenderPass");
|
||||
|
||||
setOverrideRenderPass(1);
|
||||
setRenderPass(1);
|
||||
|
||||
debugLog("Done those");
|
||||
/*
|
||||
setRenderPass(2);
|
||||
*/
|
||||
|
||||
rippleDelay = 0;
|
||||
ripples = false;
|
||||
fallGravityTimer = 0;
|
||||
|
@ -3700,7 +3698,6 @@ Avatar::Avatar() : Entity(), ActionMapper()
|
|||
debugLog("Avatar 3");
|
||||
hair = new Hair();
|
||||
hair->setTexture("Naija/Cape");
|
||||
hair->setOverrideRenderPass(1);
|
||||
hair->setRenderPass(1);
|
||||
dsq->game->addRenderObject(hair, LR_ENTITIES);
|
||||
|
||||
|
|
|
@ -251,6 +251,8 @@ Entity::Entity()
|
|||
stopSoundsOnDeath = false;
|
||||
minimapIcon = 0;
|
||||
|
||||
renderPass = RENDER_ALL;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2479,6 +2481,15 @@ void Entity::doEntityAvoidance(float dt, int range, float mod, Entity *ignore)
|
|||
|
||||
void Entity::render(const RenderState& rsold) const
|
||||
{
|
||||
// This is special-cased for entities:
|
||||
// An entity that has a renderpass set is supposed to apply this to all
|
||||
// children regardless of their setting.
|
||||
// (In earlier versions this functionality was implemented via an overrideRenderPass
|
||||
// but that doesn't exist anymore)
|
||||
// -> Wait for the correct pass until we even bother to try rendering this entity
|
||||
if(renderPass != RENDER_ALL && rsold.pass != renderPass)
|
||||
return;
|
||||
|
||||
InterpolatedVector bscale = scale;
|
||||
|
||||
scale *= flipScale;
|
||||
|
@ -2500,6 +2511,12 @@ void Entity::render(const RenderState& rsold) const
|
|||
rs.color *= multColor;
|
||||
rs.alpha *= alpha.x;
|
||||
|
||||
// if we have an override render pass set:
|
||||
// from this point, render all children in this pass
|
||||
// regardless of what they specify
|
||||
if(renderPass != RENDER_ALL && rs.pass == renderPass)
|
||||
rs.pass = RENDER_ALL;
|
||||
|
||||
Quad::render(rs);
|
||||
|
||||
renderBorder = false;
|
||||
|
|
|
@ -1622,15 +1622,6 @@ luaFunc(obj_setRenderPass)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(obj_setOverrideRenderPass)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
int pass = lua_tointeger(L, 2);
|
||||
if (r)
|
||||
r->setOverrideRenderPass(pass);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(obj_fh)
|
||||
{
|
||||
RenderObject *r = robj(L);
|
||||
|
@ -2049,7 +2040,6 @@ luaFunc(quad_getBorderAlpha)
|
|||
RO_FUNC(getter, prefix, setUpdateCull ) \
|
||||
RO_FUNC(getter, prefix, getUpdateCull ) \
|
||||
RO_FUNC(getter, prefix, setRenderPass ) \
|
||||
RO_FUNC(getter, prefix, setOverrideRenderPass ) \
|
||||
RO_FUNC(getter, prefix, setPositionX ) \
|
||||
RO_FUNC(getter, prefix, setPositionY ) \
|
||||
RO_FUNC(getter, prefix, enableMotionBlur ) \
|
||||
|
@ -5009,17 +4999,6 @@ luaFunc(entity_setEntityLayer)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
// Note that this overrides the generic obj_setRenderPass function for entities.
|
||||
// (It's registered as "entity_setRenderPass" to Lua)
|
||||
luaFunc(entity_setRenderPass_override)
|
||||
{
|
||||
Entity *e = entity(L);
|
||||
int pass = lua_tointeger(L, 2);
|
||||
if (e)
|
||||
e->setOverrideRenderPass(pass);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
// intended to be used for setting max health and refilling it all
|
||||
luaFunc(entity_setHealth)
|
||||
{
|
||||
|
@ -10973,7 +10952,6 @@ static const struct {
|
|||
|
||||
{"bone_getPosition", l_bone_getWorldPosition},
|
||||
{ "entity_delete", l_entity_delete_override },
|
||||
{ "entity_setRenderPass", l_entity_setRenderPass_override },
|
||||
{ "beam_setPosition", l_beam_setPosition_override },
|
||||
|
||||
// -- deprecated/compatibility related functions below here --
|
||||
|
|
|
@ -59,7 +59,6 @@ RenderObject::RenderObject()
|
|||
useOldDT = false;
|
||||
|
||||
ignoreUpdate = false;
|
||||
overrideRenderPass = OVERRIDE_NONE;
|
||||
renderPass = 0;
|
||||
overrideCullRadiusSqr = 0;
|
||||
repeatTexture = false;
|
||||
|
@ -436,23 +435,7 @@ bool RenderObject::isVisibleInPass(int pass) const
|
|||
assert(!parent); // This check should be done for root objects only
|
||||
assert(pass != RENDER_ALL); // why call this when we already know we don't do passes
|
||||
|
||||
if (this->overrideRenderPass != OVERRIDE_NONE)
|
||||
{
|
||||
// FIXME: overrideRenderPass is not applied to the
|
||||
// node itself in the original check (below); is
|
||||
// that intentional? Doing the same thing here
|
||||
// for the time being. --achurch
|
||||
if (pass != this->renderPass
|
||||
&& pass != this->overrideRenderPass)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasRenderPass(pass))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return hasRenderPass(pass);
|
||||
}
|
||||
|
||||
void RenderObject::render(const RenderState& rs) const
|
||||
|
@ -579,7 +562,6 @@ void RenderObject::renderCall(const RenderState& rs) const
|
|||
|
||||
if (texture)
|
||||
{
|
||||
|
||||
if (texture->textures[0] != lastTextureApplied || repeatTexture != lastTextureRepeat)
|
||||
{
|
||||
texture->apply(repeatTexture);
|
||||
|
@ -597,22 +579,7 @@ void RenderObject::renderCall(const RenderState& rs) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool doRender = true;
|
||||
if (rs.pass != RENDER_ALL)
|
||||
{
|
||||
int pass = renderPass;
|
||||
RenderObject *top = getTopParent();
|
||||
if (top)
|
||||
{
|
||||
if (top->overrideRenderPass != OVERRIDE_NONE)
|
||||
pass = top->overrideRenderPass;
|
||||
}
|
||||
|
||||
doRender = (rs.pass == pass);
|
||||
}
|
||||
|
||||
if (doRender)
|
||||
if (rs.pass == RENDER_ALL || rs.pass == renderPass)
|
||||
{
|
||||
// RenderState color applies to everything in the scene graph,
|
||||
// so that needs to be multiplied in unconditionally
|
||||
|
|
|
@ -205,8 +205,6 @@ public:
|
|||
void setOverrideCullRadius(float ovr);
|
||||
void setRenderPass(int pass) { renderPass = pass; }
|
||||
int getRenderPass() const { return renderPass; }
|
||||
void setOverrideRenderPass(int pass) { overrideRenderPass = pass; }
|
||||
int getOverrideRenderPass() const { return overrideRenderPass; }
|
||||
enum { RENDER_ALL=314, OVERRIDE_NONE=315 };
|
||||
|
||||
// Defined in RenderObject_inline.h
|
||||
|
@ -269,11 +267,6 @@ public:
|
|||
float decayRate;
|
||||
float maxLife;
|
||||
|
||||
// When a root RenderObject has overrideRenderPass set,
|
||||
// the override applies the same pass to ALL RenderObjects in the hierarchy.
|
||||
// For non-root objects, it has no effect.
|
||||
int overrideRenderPass;
|
||||
|
||||
// In layers that have multi-pass rendering enabled, the object will only be rendered
|
||||
// in this pass (single-pass layers always render, regardless of this setting).
|
||||
int renderPass;
|
||||
|
|
Loading…
Reference in a new issue