mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
remove RenderObject::blendEnabled and cleanup the blend code a bit
This commit is contained in:
parent
06270eaac0
commit
46010244f5
26 changed files with 111 additions and 79 deletions
|
@ -247,7 +247,7 @@ SongIconParticle::SongIconParticle(Vector color, Vector pos, size_t note)
|
||||||
setDecayRate(1);
|
setDecayRate(1);
|
||||||
|
|
||||||
//if (rand()%6 <= 2)
|
//if (rand()%6 <= 2)
|
||||||
setBlendType(RenderObject::BLEND_ADD);
|
setBlendType(BLEND_ADD);
|
||||||
|
|
||||||
float smallestDist = HUGE_VALF;
|
float smallestDist = HUGE_VALF;
|
||||||
SongIcon *closest = 0;
|
SongIcon *closest = 0;
|
||||||
|
@ -322,7 +322,7 @@ SongIcon::SongIcon(size_t note) : Quad(), note(note)
|
||||||
glow->followCamera = 1;
|
glow->followCamera = 1;
|
||||||
glow->rotation.interpolateTo(Vector(0,0,360), 10, -1);
|
glow->rotation.interpolateTo(Vector(0,0,360), 10, -1);
|
||||||
glow->alpha = 0;
|
glow->alpha = 0;
|
||||||
glow->setBlendType(RenderObject::BLEND_ADD);
|
glow->setBlendType(BLEND_ADD);
|
||||||
glow->scale = Vector(0.5, 0.5);
|
glow->scale = Vector(0.5, 0.5);
|
||||||
glow->color = dsq->getNoteColor(note);
|
glow->color = dsq->getNoteColor(note);
|
||||||
dsq->game->addRenderObject(glow, LR_PARTICLES2);
|
dsq->game->addRenderObject(glow, LR_PARTICLES2);
|
||||||
|
@ -507,7 +507,7 @@ void SongIcon::openNote()
|
||||||
q->alpha.data->path.addPathNode(0,1);
|
q->alpha.data->path.addPathNode(0,1);
|
||||||
q->alpha.startPath(glowLife);
|
q->alpha.startPath(glowLife);
|
||||||
q->color = dsq->getNoteColor(note); //*0.5f + Vector(0.5, 0.5, 0.5)
|
q->color = dsq->getNoteColor(note); //*0.5f + Vector(0.5, 0.5, 0.5)
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
q->followCamera = 1;
|
q->followCamera = 1;
|
||||||
dsq->game->addRenderObject(q, LR_HUD);
|
dsq->game->addRenderObject(q, LR_HUD);
|
||||||
q->setDecayRate(1/(glowLife+0.1f));
|
q->setDecayRate(1/(glowLife+0.1f));
|
||||||
|
@ -527,7 +527,7 @@ void SongIcon::openNote()
|
||||||
q->alpha.data->path.addPathNode(0.5f,0.2f);
|
q->alpha.data->path.addPathNode(0.5f,0.2f);
|
||||||
q->alpha.data->path.addPathNode(0,1);
|
q->alpha.data->path.addPathNode(0,1);
|
||||||
q->alpha.startPath(glowLife);
|
q->alpha.startPath(glowLife);
|
||||||
//q->setBlendType(RenderObject::BLEND_ADD);
|
//q->setBlendType(BLEND_ADD);
|
||||||
q->followCamera = 1;
|
q->followCamera = 1;
|
||||||
dsq->game->addRenderObject(q, LR_HUD);
|
dsq->game->addRenderObject(q, LR_HUD);
|
||||||
q->setDecayRate(1/(glowLife+0.1f));
|
q->setDecayRate(1/(glowLife+0.1f));
|
||||||
|
|
|
@ -132,7 +132,7 @@ void Credits::applyState()
|
||||||
slides[i] = new Quad("credits/slide-" + numToZeroString(i, 4), Vector(400, 300));
|
slides[i] = new Quad("credits/slide-" + numToZeroString(i, 4), Vector(400, 300));
|
||||||
slides[i]->alpha = 0;
|
slides[i]->alpha = 0;
|
||||||
slides[i]->followCamera = 1;
|
slides[i]->followCamera = 1;
|
||||||
slides[i]->setBlendType(RenderObject::BLEND_ADD);
|
slides[i]->setBlendType(BLEND_ADD);
|
||||||
addRenderObject(slides[i], LR_ENTITIES);
|
addRenderObject(slides[i], LR_ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,8 +311,10 @@ void DSQ::loadElementEffects()
|
||||||
{
|
{
|
||||||
efxType = EFX_ALPHA;
|
efxType = EFX_ALPHA;
|
||||||
float to_x, time, loop, pingPong, ease;
|
float to_x, time, loop, pingPong, ease;
|
||||||
is >> e.blendType >> e.alpha.x >> to_x >> time >> loop >> pingPong >> ease;
|
int blend;
|
||||||
|
is >> blend >> e.alpha.x >> to_x >> time >> loop >> pingPong >> ease;
|
||||||
e.alpha.interpolateTo(to_x, time, loop, pingPong, ease);
|
e.alpha.interpolateTo(to_x, time, loop, pingPong, ease);
|
||||||
|
e.blendType = blend < _BLEND_MAXSIZE ? (BlendType)blend : BLEND_DISABLED;
|
||||||
}
|
}
|
||||||
e.type = efxType;
|
e.type = efxType;
|
||||||
elementEffects.push_back(e);
|
elementEffects.push_back(e);
|
||||||
|
@ -330,7 +332,7 @@ ElementEffect DSQ::getElementEffectByIndex(size_t e)
|
||||||
ElementEffect empty;
|
ElementEffect empty;
|
||||||
empty.type = EFX_NONE;
|
empty.type = EFX_NONE;
|
||||||
empty.alpha = 0;
|
empty.alpha = 0;
|
||||||
empty.blendType = 0;
|
empty.blendType = BLEND_DEFAULT;
|
||||||
empty.color = 0;
|
empty.color = 0;
|
||||||
empty.segsx = empty.segsy = 0;
|
empty.segsx = empty.segsy = 0;
|
||||||
empty.segs_dgmx = empty.segs_dgmy = 0;
|
empty.segs_dgmx = empty.segs_dgmy = 0;
|
||||||
|
@ -1135,7 +1137,7 @@ void DSQ::init()
|
||||||
cursorGlow->setTexture("glow");
|
cursorGlow->setTexture("glow");
|
||||||
cursorGlow->setWidthHeight(48, 48);
|
cursorGlow->setWidthHeight(48, 48);
|
||||||
cursorGlow->alpha = 0;
|
cursorGlow->alpha = 0;
|
||||||
cursorGlow->setBlendType(RenderObject::BLEND_ADD);
|
cursorGlow->setBlendType(BLEND_ADD);
|
||||||
}
|
}
|
||||||
cursor->addChild(cursorGlow, PM_NONE, RBP_OFF);
|
cursor->addChild(cursorGlow, PM_NONE, RBP_OFF);
|
||||||
addRenderObject(cursorGlow, LR_CURSOR);
|
addRenderObject(cursorGlow, LR_CURSOR);
|
||||||
|
@ -1207,7 +1209,7 @@ void DSQ::init()
|
||||||
sceneColorOverlay->position = Vector(400,300);
|
sceneColorOverlay->position = Vector(400,300);
|
||||||
sceneColorOverlay->color = Vector(1,1,1);
|
sceneColorOverlay->color = Vector(1,1,1);
|
||||||
sceneColorOverlay->alpha = 1;
|
sceneColorOverlay->alpha = 1;
|
||||||
sceneColorOverlay->setBlendType(RenderObject::BLEND_MULT);
|
sceneColorOverlay->setBlendType(BLEND_MULT);
|
||||||
sceneColorOverlay->autoWidth = AUTO_VIRTUALWIDTH;
|
sceneColorOverlay->autoWidth = AUTO_VIRTUALWIDTH;
|
||||||
sceneColorOverlay->autoHeight = AUTO_VIRTUALHEIGHT;
|
sceneColorOverlay->autoHeight = AUTO_VIRTUALHEIGHT;
|
||||||
sceneColorOverlay->followCamera = 1;
|
sceneColorOverlay->followCamera = 1;
|
||||||
|
@ -2135,7 +2137,7 @@ void DSQ::clickRingEffect(Vector pos, int type, Vector color, float ut)
|
||||||
|
|
||||||
q->color = color;
|
q->color = color;
|
||||||
|
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
|
|
||||||
q->alpha.ensureData();
|
q->alpha.ensureData();
|
||||||
q->alpha.data->path.addPathNode(0, 0);
|
q->alpha.data->path.addPathNode(0, 0);
|
||||||
|
@ -2163,7 +2165,7 @@ void DSQ::clickRingEffect(Vector pos, int type, Vector color, float ut)
|
||||||
q->scale = Vector(5,5);
|
q->scale = Vector(5,5);
|
||||||
q->scale.interpolateTo(Vector(1,1), t);
|
q->scale.interpolateTo(Vector(1,1), t);
|
||||||
|
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
|
|
||||||
q->color = color;
|
q->color = color;
|
||||||
|
|
||||||
|
@ -2250,7 +2252,7 @@ void DSQ::doSavePoint(const Vector &position)
|
||||||
glow->setTexture("save-point-glow");
|
glow->setTexture("save-point-glow");
|
||||||
glow->alpha = 0;
|
glow->alpha = 0;
|
||||||
glow->alpha.interpolateTo(0.5f, 1, 1, true, true);
|
glow->alpha.interpolateTo(0.5f, 1, 1, true, true);
|
||||||
glow->setBlendType(RenderObject::BLEND_ADD);
|
glow->setBlendType(BLEND_ADD);
|
||||||
glow->position = position;
|
glow->position = position;
|
||||||
glow->scale = Vector(1,1)*1.25f;
|
glow->scale = Vector(1,1)*1.25f;
|
||||||
glow->setLife(3);
|
glow->setLife(3);
|
||||||
|
@ -4008,7 +4010,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
|
||||||
q->alpha.data->path.addPathNode(0.75f, 0.75f);
|
q->alpha.data->path.addPathNode(0.75f, 0.75f);
|
||||||
q->alpha.data->path.addPathNode(0, 1);
|
q->alpha.data->path.addPathNode(0, 1);
|
||||||
q->alpha.startPath(t);
|
q->alpha.startPath(t);
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
q->setTexture("particles/EnergyRing");
|
q->setTexture("particles/EnergyRing");
|
||||||
if (target)
|
if (target)
|
||||||
q->setPositionSnapTo(&target->position);
|
q->setPositionSnapTo(&target->position);
|
||||||
|
@ -4031,7 +4033,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
|
||||||
q->alpha.data->path.addPathNode(0.75f, 0.75f);
|
q->alpha.data->path.addPathNode(0.75f, 0.75f);
|
||||||
q->alpha.data->path.addPathNode(0, 1);
|
q->alpha.data->path.addPathNode(0, 1);
|
||||||
q->alpha.startPath(t);
|
q->alpha.startPath(t);
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
q->setTexture("particles/EnergyPart");
|
q->setTexture("particles/EnergyPart");
|
||||||
if (target)
|
if (target)
|
||||||
q->setPositionSnapTo(&target->position);
|
q->setPositionSnapTo(&target->position);
|
||||||
|
@ -4054,7 +4056,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
|
||||||
|
|
||||||
q->alpha.data->path.addPathNode(0, 1);
|
q->alpha.data->path.addPathNode(0, 1);
|
||||||
q->alpha.startPath(t);
|
q->alpha.startPath(t);
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
q->rotation.z = rand()%360;
|
q->rotation.z = rand()%360;
|
||||||
q->setTexture("particles/EnergyRing");
|
q->setTexture("particles/EnergyRing");
|
||||||
|
|
||||||
|
@ -4074,7 +4076,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
|
||||||
|
|
||||||
q->alpha.data->path.addPathNode(0, 1);
|
q->alpha.data->path.addPathNode(0, 1);
|
||||||
q->alpha.startPath(t);
|
q->alpha.startPath(t);
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
|
|
||||||
q->setTexture("particles/EnergyDeltas");
|
q->setTexture("particles/EnergyDeltas");
|
||||||
q->rotation.z = rand()%360;
|
q->rotation.z = rand()%360;
|
||||||
|
|
|
@ -233,7 +233,7 @@ void Element::setElementEffectByIndex(int eidx)
|
||||||
{
|
{
|
||||||
deleteGrid();
|
deleteGrid();
|
||||||
|
|
||||||
setBlendType(RenderObject::BLEND_DEFAULT);
|
setBlendType(BLEND_DEFAULT);
|
||||||
alpha.stop();
|
alpha.stop();
|
||||||
alpha = 1;
|
alpha = 1;
|
||||||
|
|
||||||
|
|
|
@ -2509,7 +2509,7 @@ void Entity::render()
|
||||||
scale = bscale;
|
scale = bscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::doGlint(const Vector &position, const Vector &scale, const std::string &tex, RenderObject::BlendTypes bt)
|
void Entity::doGlint(const Vector &position, const Vector &scale, const std::string &tex, BlendType bt)
|
||||||
{
|
{
|
||||||
float glintTime = 0.4f;
|
float glintTime = 0.4f;
|
||||||
Quad *glint = new Quad;
|
Quad *glint = new Quad;
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
|
|
||||||
bool hasTarget(int t=0);
|
bool hasTarget(int t=0);
|
||||||
bool isTargetInRange(int range, size_t t=0);
|
bool isTargetInRange(int range, size_t t=0);
|
||||||
void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", RenderObject::BlendTypes bt=BLEND_DEFAULT);
|
void doGlint(const Vector &position, const Vector &scale=Vector(2,2), const std::string &tex="Glint", BlendType bt=BLEND_DEFAULT);
|
||||||
Entity *getTargetEntity(int t=0);
|
Entity *getTargetEntity(int t=0);
|
||||||
void setTargetEntity(Entity *e, int t=0);
|
void setTargetEntity(Entity *e, int t=0);
|
||||||
|
|
||||||
|
|
|
@ -1507,7 +1507,7 @@ bool Game::loadSceneXML(std::string scene)
|
||||||
std::string backdrop = level->Attribute("backdrop");
|
std::string backdrop = level->Attribute("backdrop");
|
||||||
backdropQuad = new Quad;
|
backdropQuad = new Quad;
|
||||||
backdropQuad->setTexture(backdrop);
|
backdropQuad->setTexture(backdrop);
|
||||||
backdropQuad->blendEnabled = false;
|
backdropQuad->setBlendType(BLEND_DISABLED);
|
||||||
|
|
||||||
if (level->Attribute("bd-x") && level->Attribute("bd-y"))
|
if (level->Attribute("bd-x") && level->Attribute("bd-y"))
|
||||||
{
|
{
|
||||||
|
@ -2242,9 +2242,9 @@ void Game::createGradient()
|
||||||
}
|
}
|
||||||
addRenderObject(grad, LR_BACKDROP);
|
addRenderObject(grad, LR_BACKDROP);
|
||||||
if (bg)
|
if (bg)
|
||||||
bg->blendEnabled = true;
|
bg->setBlendType(BLEND_DEFAULT);
|
||||||
if (bg2)
|
if (bg2)
|
||||||
bg2->blendEnabled = true;
|
bg2->setBlendType(BLEND_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2711,7 +2711,7 @@ void Game::applyState()
|
||||||
|
|
||||||
bg = new Quad;
|
bg = new Quad;
|
||||||
{
|
{
|
||||||
bg->blendEnabled = false;
|
bg->setBlendType(BLEND_DISABLED);
|
||||||
bg->position = Vector(400, 300, -2/*-0.09f*/);
|
bg->position = Vector(400, 300, -2/*-0.09f*/);
|
||||||
//bg->color = Vector(0.9, 0.9, 0.9);
|
//bg->color = Vector(0.9, 0.9, 0.9);
|
||||||
bg->setTexture("missingImage");
|
bg->setTexture("missingImage");
|
||||||
|
@ -2805,7 +2805,7 @@ void Game::applyState()
|
||||||
controlHint_shine->alphaMod = 0.3f;
|
controlHint_shine->alphaMod = 0.3f;
|
||||||
controlHint_shine->setWidthHeight(core->getVirtualWidth(), 100);
|
controlHint_shine->setWidthHeight(core->getVirtualWidth(), 100);
|
||||||
controlHint_shine->alpha = 0;
|
controlHint_shine->alpha = 0;
|
||||||
controlHint_shine->setBlendType(RenderObject::BLEND_ADD);
|
controlHint_shine->setBlendType(BLEND_ADD);
|
||||||
}
|
}
|
||||||
addRenderObject(controlHint_shine, LR_HELP);
|
addRenderObject(controlHint_shine, LR_HELP);
|
||||||
|
|
||||||
|
@ -2906,7 +2906,7 @@ void Game::applyState()
|
||||||
GridRender *blackRender = new GridRender(OT_BLACK);
|
GridRender *blackRender = new GridRender(OT_BLACK);
|
||||||
blackRender->color = Vector(0, 0, 0);
|
blackRender->color = Vector(0, 0, 0);
|
||||||
//blackRender->alpha = 0;
|
//blackRender->alpha = 0;
|
||||||
blackRender->blendEnabled = false;
|
blackRender->setBlendType(BLEND_DISABLED);
|
||||||
addRenderObject(blackRender, LR_ELEMENTS4);
|
addRenderObject(blackRender, LR_ELEMENTS4);
|
||||||
|
|
||||||
miniMapRender = new MiniMapRender;
|
miniMapRender = new MiniMapRender;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef GAMEENUMS_H
|
#ifndef GAMEENUMS_H
|
||||||
#define GAMEENUMS_H
|
#define GAMEENUMS_H
|
||||||
|
|
||||||
|
#include "EngineEnums.h"
|
||||||
|
|
||||||
|
|
||||||
// Note: although this is a bitmask, only one of these values may be set at a time!
|
// Note: although this is a bitmask, only one of these values may be set at a time!
|
||||||
// This is because GridRender and most Lua scripts check via ==, not for bits set (Lua 5.1 doesn't have bit ops)
|
// This is because GridRender and most Lua scripts check via ==, not for bits set (Lua 5.1 doesn't have bit ops)
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
bool wavy_flip;
|
bool wavy_flip;
|
||||||
InterpolatedVector alpha;
|
InterpolatedVector alpha;
|
||||||
InterpolatedVector color;
|
InterpolatedVector color;
|
||||||
int blendType;
|
BlendType blendType;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EmoteData
|
struct EmoteData
|
||||||
|
|
|
@ -30,14 +30,11 @@ GridRender::GridRender(ObsType obsType) : RenderObject()
|
||||||
cull = false;
|
cull = false;
|
||||||
alpha = 0.5f;
|
alpha = 0.5f;
|
||||||
this->obsType = obsType;
|
this->obsType = obsType;
|
||||||
blendEnabled = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridRender::onUpdate(float dt)
|
void GridRender::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
RenderObject::onUpdate(dt);
|
RenderObject::onUpdate(dt);
|
||||||
if (obsType != OT_BLACK) { blendEnabled = true; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void doRenderGrid(int x, int startCol, int endCol)
|
inline static void doRenderGrid(int x, int startCol, int endCol)
|
||||||
|
|
|
@ -712,7 +712,7 @@ SongSlot::SongSlot(int songSlot) : AquariaGuiQuad(), songSlot(songSlot)
|
||||||
|
|
||||||
glow = new Quad("particles/glow", Vector(0,0));
|
glow = new Quad("particles/glow", Vector(0,0));
|
||||||
glow->setWidthHeight(128, 128);
|
glow->setWidthHeight(128, 128);
|
||||||
glow->setBlendType(RenderObject::BLEND_ADD);
|
glow->setBlendType(BLEND_ADD);
|
||||||
glow->alpha = 0;
|
glow->alpha = 0;
|
||||||
addChild(glow, PM_POINTER);
|
addChild(glow, PM_POINTER);
|
||||||
|
|
||||||
|
@ -2512,7 +2512,7 @@ void InGameMenu::create()
|
||||||
menuIconGlow->alphaMod = 0.4f;
|
menuIconGlow->alphaMod = 0.4f;
|
||||||
menuIconGlow->alpha = 0;
|
menuIconGlow->alpha = 0;
|
||||||
menuIconGlow->setWidthHeight(80, 80);
|
menuIconGlow->setWidthHeight(80, 80);
|
||||||
menuIconGlow->setBlendType(RenderObject::BLEND_ADD);
|
menuIconGlow->setBlendType(BLEND_ADD);
|
||||||
menuIconGlow->followCamera = 1;
|
menuIconGlow->followCamera = 1;
|
||||||
game->addRenderObject(menuIconGlow, LR_MENU);
|
game->addRenderObject(menuIconGlow, LR_MENU);
|
||||||
|
|
||||||
|
@ -4153,7 +4153,7 @@ void InGameMenu::update(float dt)
|
||||||
|
|
||||||
float t = 0.5;
|
float t = 0.5;
|
||||||
Quad *q = new Quad("particles/glow", Vector(400+237*menuBg->scale.x,300-52*menuBg->scale.x)+notePos);
|
Quad *q = new Quad("particles/glow", Vector(400+237*menuBg->scale.x,300-52*menuBg->scale.x)+notePos);
|
||||||
q->setBlendType(RenderObject::BLEND_ADD);
|
q->setBlendType(BLEND_ADD);
|
||||||
q->scale = Vector(5,5);
|
q->scale = Vector(5,5);
|
||||||
q->alpha.ensureData();
|
q->alpha.ensureData();
|
||||||
q->alpha.data->path.addPathNode(0, 0);
|
q->alpha.data->path.addPathNode(0, 0);
|
||||||
|
|
|
@ -139,7 +139,7 @@ void Intro::createMeteor(int layer, Vector pos, Vector off, Vector sz)
|
||||||
m->rotationOffset.interpolateTo(Vector(0,0,-360), 2.5, -1);
|
m->rotationOffset.interpolateTo(Vector(0,0,-360), 2.5, -1);
|
||||||
m->rotation.z = rand()%360;
|
m->rotation.z = rand()%360;
|
||||||
Quad *g = new Quad("particles/glow", Vector(0,0));
|
Quad *g = new Quad("particles/glow", Vector(0,0));
|
||||||
g->setBlendType(RenderObject::BLEND_ADD);
|
g->setBlendType(BLEND_ADD);
|
||||||
g->scale = Vector(24, 24);
|
g->scale = Vector(24, 24);
|
||||||
g->alpha = 0.5;
|
g->alpha = 0.5;
|
||||||
g->color = Vector(1, 0.5, 0.5);
|
g->color = Vector(1, 0.5, 0.5);
|
||||||
|
@ -800,7 +800,7 @@ void Intro::update(float dt)
|
||||||
Quad *mom = new Quad("gameover-0004", Vector(400,300));
|
Quad *mom = new Quad("gameover-0004", Vector(400,300));
|
||||||
mom->setWidthHeight(600,600);
|
mom->setWidthHeight(600,600);
|
||||||
mom->alphaMod = 0.035f;
|
mom->alphaMod = 0.035f;
|
||||||
mom->setBlendType(RenderObject::BLEND_ADD);
|
mom->setBlendType(BLEND_ADD);
|
||||||
mom->alpha = 0;
|
mom->alpha = 0;
|
||||||
mom->alpha.interpolateTo(1, 5);
|
mom->alpha.interpolateTo(1, 5);
|
||||||
mom->followCamera = 1;
|
mom->followCamera = 1;
|
||||||
|
|
|
@ -158,7 +158,7 @@ public:
|
||||||
addChild(glow, PM_POINTER, RBP_ON);
|
addChild(glow, PM_POINTER, RBP_ON);
|
||||||
glow->setWidthHeight(48, 64);
|
glow->setWidthHeight(48, 64);
|
||||||
glow->alpha = 0;
|
glow->alpha = 0;
|
||||||
glow->setBlendType(RenderObject::BLEND_ADD);
|
glow->setBlendType(BLEND_ADD);
|
||||||
scale = Vector(0.5, 0.5);
|
scale = Vector(0.5, 0.5);
|
||||||
scale.interpolateTo(Vector(1,1), 0.5, 0, 0, 1);
|
scale.interpolateTo(Vector(1,1), 0.5, 0, 0, 1);
|
||||||
|
|
||||||
|
|
|
@ -599,6 +599,13 @@ Bone *bone(lua_State *L, int slot = 1)
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
BlendType getBlendType(lua_State *L, int slot = 1)
|
||||||
|
{
|
||||||
|
int bt = lua_tointeger(L, slot);
|
||||||
|
return (BlendType)((bt >= BLEND_DEFAULT && bt < _BLEND_MAXSIZE) ? bt : BLEND_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
Path *pathFromName(lua_State *L, int slot = 1)
|
Path *pathFromName(lua_State *L, int slot = 1)
|
||||||
{
|
{
|
||||||
|
@ -1230,14 +1237,16 @@ luaFunc(obj_setBlendType)
|
||||||
{
|
{
|
||||||
RenderObject *r = robj(L);
|
RenderObject *r = robj(L);
|
||||||
if (r)
|
if (r)
|
||||||
r->setBlendType(lua_tointeger(L, 2));
|
{
|
||||||
|
r->setBlendType(getBlendType(L, 2));
|
||||||
|
}
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
luaFunc(obj_getBlendType)
|
luaFunc(obj_getBlendType)
|
||||||
{
|
{
|
||||||
RenderObject *r = robj(L);
|
RenderObject *r = robj(L);
|
||||||
luaReturnInt(r ? r->blendType : 0);
|
luaReturnInt(r ? r->getBlendType() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
luaFunc(obj_setTexture)
|
luaFunc(obj_setTexture)
|
||||||
|
@ -8134,7 +8143,7 @@ luaFunc(entity_partBlendType)
|
||||||
{
|
{
|
||||||
ScriptedEntity *e = scriptedEntity(L);
|
ScriptedEntity *e = scriptedEntity(L);
|
||||||
if (e)
|
if (e)
|
||||||
e->partMap[getString(L, 2)]->setBlendType(lua_tointeger(L, 3));
|
e->partMap[getString(L, 2)]->setBlendType(getBlendType(L, 3));
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8338,7 +8347,7 @@ luaFunc(entity_doGlint)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
if (e)
|
if (e)
|
||||||
e->doGlint(e->position, Vector(2,2), getString(L,2), (RenderObject::BlendTypes)lua_tointeger(L, 3));
|
e->doGlint(e->position, Vector(2,2), getString(L,2), getBlendType(L, 3));
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11302,11 +11311,12 @@ static const struct {
|
||||||
luaConstant(SONG_ANIMA),
|
luaConstant(SONG_ANIMA),
|
||||||
luaConstant(SONG_MAX),
|
luaConstant(SONG_MAX),
|
||||||
|
|
||||||
luaConstantFromClass(BLEND_DEFAULT, RenderObject),
|
luaConstant(BLEND_DISABLED),
|
||||||
luaConstantFromClass(BLEND_ADD, RenderObject),
|
luaConstant(BLEND_DEFAULT),
|
||||||
{"BLEND_ADDITIVE", RenderObject::BLEND_ADD},
|
luaConstant(BLEND_ADD),
|
||||||
luaConstantFromClass(BLEND_SUB, RenderObject),
|
{"BLEND_ADDITIVE", BLEND_ADD},
|
||||||
luaConstantFromClass(BLEND_MULT, RenderObject),
|
luaConstant(BLEND_SUB),
|
||||||
|
luaConstant(BLEND_MULT),
|
||||||
|
|
||||||
{"ENDING_NAIJACAVE", 10},
|
{"ENDING_NAIJACAVE", 10},
|
||||||
{"ENDING_NAIJACAVEDONE", 11},
|
{"ENDING_NAIJACAVEDONE", 11},
|
||||||
|
|
|
@ -50,7 +50,7 @@ ShotData::ShotData()
|
||||||
segScale = Vector(1,1);
|
segScale = Vector(1,1);
|
||||||
numSegs = 0;
|
numSegs = 0;
|
||||||
segDist = 16;
|
segDist = 16;
|
||||||
blendType = RenderObject::BLEND_DEFAULT;
|
blendType = BLEND_DEFAULT;
|
||||||
collideRadius = 8;
|
collideRadius = 8;
|
||||||
damageType = DT_ENEMY_ENERGYBLAST;
|
damageType = DT_ENEMY_ENERGYBLAST;
|
||||||
lifeTime = 8;
|
lifeTime = 8;
|
||||||
|
@ -177,7 +177,7 @@ void ShotData::bankLoad(const std::string &file, const std::string &path)
|
||||||
std::string bt;
|
std::string bt;
|
||||||
inf >> bt;
|
inf >> bt;
|
||||||
if (bt == "BLEND_ADD")
|
if (bt == "BLEND_ADD")
|
||||||
blendType = RenderObject::BLEND_ADD;
|
blendType = BLEND_ADD;
|
||||||
}
|
}
|
||||||
else if (token == "Damage")
|
else if (token == "Damage")
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ void Shot::applyShotData(ShotData *shotData)
|
||||||
Quad *flame = new Quad;
|
Quad *flame = new Quad;
|
||||||
flame->setTexture(shotData->segTexture);
|
flame->setTexture(shotData->segTexture);
|
||||||
flame->scale = shotData->segScale - Vector(shotData->segTaper, shotData->segTaper)*(i);
|
flame->scale = shotData->segScale - Vector(shotData->segTaper, shotData->segTaper)*(i);
|
||||||
flame->setBlendType(this->blendType);
|
flame->setBlendType(this->getBlendType());
|
||||||
flame->alpha = 0.5;
|
flame->alpha = 0.5;
|
||||||
dsq->game->addRenderObject(flame, LR_PARTICLES);
|
dsq->game->addRenderObject(flame, LR_PARTICLES);
|
||||||
segments[i] = flame;
|
segments[i] = flame;
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct ShotData
|
||||||
std::string hitPrt, trailPrt, firePrt, bouncePrt;
|
std::string hitPrt, trailPrt, firePrt, bouncePrt;
|
||||||
std::string spawnEntity;
|
std::string spawnEntity;
|
||||||
BounceType bounceType;
|
BounceType bounceType;
|
||||||
int blendType;
|
BlendType blendType;
|
||||||
bool segments;
|
bool segments;
|
||||||
float damage;
|
float damage;
|
||||||
float maxSpeed, homing, homingMax;
|
float maxSpeed, homing, homingMax;
|
||||||
|
|
|
@ -200,7 +200,7 @@ void GameOver::applyState()
|
||||||
shockLines->setTexture("shock-lines");
|
shockLines->setTexture("shock-lines");
|
||||||
shockLines->position = Vector(400,300);
|
shockLines->position = Vector(400,300);
|
||||||
shockLines->setWidthHeight(800, 600);
|
shockLines->setWidthHeight(800, 600);
|
||||||
shockLines->setBlendType(RenderObject::BLEND_ADD);
|
shockLines->setBlendType(BLEND_ADD);
|
||||||
shockLines->scale.interpolateTo(Vector(4,4), 1);
|
shockLines->scale.interpolateTo(Vector(4,4), 1);
|
||||||
}
|
}
|
||||||
addRenderObject(shockLines, LR_BACKGROUND);
|
addRenderObject(shockLines, LR_BACKGROUND);
|
||||||
|
|
12
BBGE/Base.h
12
BBGE/Base.h
|
@ -40,6 +40,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define OVERRIDE
|
#define OVERRIDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace internal
|
||||||
|
{
|
||||||
|
template <typename T, size_t N>
|
||||||
|
char (&_ArraySizeHelper( T (&a)[N]))[N];
|
||||||
|
|
||||||
|
template<size_t n>
|
||||||
|
struct NotZero { static const size_t value = n; };
|
||||||
|
template<>
|
||||||
|
struct NotZero<0> {};
|
||||||
|
}
|
||||||
|
#define Countof(a) (internal::NotZero<(sizeof(internal::_ArraySizeHelper(a)))>::value)
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
//#pragma warning(disable:4786)
|
//#pragma warning(disable:4786)
|
||||||
|
|
|
@ -26,6 +26,7 @@ set(BBGE_SRCS
|
||||||
Effects.cpp
|
Effects.cpp
|
||||||
Effects.h
|
Effects.h
|
||||||
Emitter.cpp
|
Emitter.cpp
|
||||||
|
EngineEnums.h
|
||||||
Event.cpp
|
Event.cpp
|
||||||
Event.h
|
Event.h
|
||||||
FmodOpenALBridge.cpp
|
FmodOpenALBridge.cpp
|
||||||
|
|
6
BBGE/EngineEnums.h
Normal file
6
BBGE/EngineEnums.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef BBGE_ENGINE_ENUMS_H
|
||||||
|
#define BBGE_ENGINE_ENUMS_H
|
||||||
|
|
||||||
|
enum BlendType { BLEND_DISABLED = -1, BLEND_DEFAULT = 0, BLEND_ADD, BLEND_SUB, BLEND_MULT, _BLEND_MAXSIZE };
|
||||||
|
|
||||||
|
#endif
|
|
@ -330,7 +330,7 @@ void ParticleEffect::bankLoad(const std::string &file, const std::string &path)
|
||||||
if (blendType == "Add")
|
if (blendType == "Add")
|
||||||
currentEmitter->data.blendType = BLEND_ADD;
|
currentEmitter->data.blendType = BLEND_ADD;
|
||||||
else if (blendType == "Sub")
|
else if (blendType == "Sub")
|
||||||
currentEmitter->data.blendType = RenderObject::BLEND_SUB;
|
currentEmitter->data.blendType = BLEND_SUB;
|
||||||
}
|
}
|
||||||
else if (token == "Width")
|
else if (token == "Width")
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct SpawnParticleData
|
||||||
float life;
|
float life;
|
||||||
InterpolatedVector spawnRate;
|
InterpolatedVector spawnRate;
|
||||||
std::string texture;
|
std::string texture;
|
||||||
RenderObject::BlendTypes blendType;
|
BlendType blendType;
|
||||||
float counter;
|
float counter;
|
||||||
float spawnTimeOffset;
|
float spawnTimeOffset;
|
||||||
bool spawnLocal;
|
bool spawnLocal;
|
||||||
|
|
|
@ -55,26 +55,27 @@ int RenderObject::getTopLayer()
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct BlendParams
|
||||||
|
{
|
||||||
|
GLenum src, dst;
|
||||||
|
};
|
||||||
|
static const BlendParams s_blendParams[] =
|
||||||
|
{
|
||||||
|
{ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA },
|
||||||
|
{ GL_SRC_ALPHA, GL_ONE },
|
||||||
|
{ GL_ZERO, GL_SRC_ALPHA },
|
||||||
|
{ GL_ZERO, GL_SRC_COLOR },
|
||||||
|
};
|
||||||
|
|
||||||
void RenderObject::applyBlendType()
|
void RenderObject::applyBlendType()
|
||||||
{
|
{
|
||||||
if (blendEnabled)
|
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
||||||
|
|
||||||
|
if (_blendType >= BLEND_DEFAULT)
|
||||||
{
|
{
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
switch (blendType)
|
const BlendParams& bp = s_blendParams[_blendType];
|
||||||
{
|
glBlendFunc(bp.src, bp.dst);
|
||||||
case BLEND_DEFAULT:
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
break;
|
|
||||||
case BLEND_ADD:
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
|
|
||||||
break;
|
|
||||||
case BLEND_SUB:
|
|
||||||
glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
|
|
||||||
break;
|
|
||||||
case BLEND_MULT:
|
|
||||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -145,7 +146,6 @@ RenderObject::RenderObject()
|
||||||
|
|
||||||
pm = PM_NONE;
|
pm = PM_NONE;
|
||||||
|
|
||||||
blendEnabled = true;
|
|
||||||
texture = 0;
|
texture = 0;
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
|
@ -158,7 +158,7 @@ RenderObject::RenderObject()
|
||||||
_dead = false;
|
_dead = false;
|
||||||
_hidden = false;
|
_hidden = false;
|
||||||
fadeAlphaWithLife = false;
|
fadeAlphaWithLife = false;
|
||||||
blendType = BLEND_DEFAULT;
|
_blendType = BLEND_DEFAULT;
|
||||||
|
|
||||||
followCamera = 0;
|
followCamera = 0;
|
||||||
stateData = 0;
|
stateData = 0;
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define RENDER_OBJECT_H
|
#define RENDER_OBJECT_H
|
||||||
|
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
#include "EngineEnums.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
#include "ScriptObject.h"
|
#include "ScriptObject.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -117,9 +118,13 @@ public:
|
||||||
{
|
{
|
||||||
this->decayRate = newdecayRate;
|
this->decayRate = newdecayRate;
|
||||||
}
|
}
|
||||||
void setBlendType (unsigned char bt)
|
void setBlendType (BlendType bt)
|
||||||
{
|
{
|
||||||
blendType = bt;
|
_blendType = bt;
|
||||||
|
}
|
||||||
|
inline BlendType getBlendType() const
|
||||||
|
{
|
||||||
|
return (BlendType)_blendType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,7 +233,6 @@ public:
|
||||||
|
|
||||||
// TODO: this should be a bitmask
|
// TODO: this should be a bitmask
|
||||||
bool fadeAlphaWithLife;
|
bool fadeAlphaWithLife;
|
||||||
bool blendEnabled;
|
|
||||||
bool renderBeforeParent;
|
bool renderBeforeParent;
|
||||||
bool updateAfterParent;
|
bool updateAfterParent;
|
||||||
bool shareAlphaWithChildren;
|
bool shareAlphaWithChildren;
|
||||||
|
@ -244,6 +248,8 @@ public:
|
||||||
|
|
||||||
unsigned char pm; // unsigned char to save space
|
unsigned char pm; // unsigned char to save space
|
||||||
|
|
||||||
|
char _blendType;
|
||||||
|
|
||||||
|
|
||||||
InterpolatedVector position, scale, color, alpha, rotation;
|
InterpolatedVector position, scale, color, alpha, rotation;
|
||||||
InterpolatedVector offset, rotationOffset, internalOffset, beforeScaleOffset;
|
InterpolatedVector offset, rotationOffset, internalOffset, beforeScaleOffset;
|
||||||
|
@ -251,11 +257,6 @@ public:
|
||||||
|
|
||||||
CountedPtr<Texture> texture;
|
CountedPtr<Texture> texture;
|
||||||
|
|
||||||
|
|
||||||
enum BlendTypes { BLEND_DEFAULT = 0, BLEND_ADD, BLEND_SUB, BLEND_MULT };
|
|
||||||
unsigned char blendType;
|
|
||||||
|
|
||||||
|
|
||||||
float life;
|
float life;
|
||||||
float followCamera;
|
float followCamera;
|
||||||
float alphaMod;
|
float alphaMod;
|
||||||
|
|
|
@ -1492,7 +1492,8 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
if (bone->Attribute("blend"))
|
if (bone->Attribute("blend"))
|
||||||
{
|
{
|
||||||
//if (bone->Attribute("blend")=="add")
|
//if (bone->Attribute("blend")=="add")
|
||||||
newb->blendType = blendType = BLEND_ADD;
|
newb->setBlendType(BLEND_ADD);
|
||||||
|
//this->setBlendType(BLEND_ADD); // FIXME: seems wrong to do this here -- fg
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bone->Attribute("alpha"))
|
if (bone->Attribute("alpha"))
|
||||||
|
|
|
@ -34,7 +34,7 @@ SpawnParticleData::SpawnParticleData()
|
||||||
useSpawnRate = false;
|
useSpawnRate = false;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
life = 1;
|
life = 1;
|
||||||
blendType = RenderObject::BLEND_DEFAULT;
|
blendType = BLEND_DEFAULT;
|
||||||
spawnRate = 1;
|
spawnRate = 1;
|
||||||
scale = Vector(1,1,1);
|
scale = Vector(1,1,1);
|
||||||
width = 64;
|
width = 64;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue