mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 22:44:32 +00:00
first step towards making the render process const
This commit is contained in:
parent
46010244f5
commit
b6fb6944f6
67 changed files with 209 additions and 400 deletions
|
@ -35,7 +35,7 @@ const int KEYFRAME_POS_Y = 570;
|
||||||
|
|
||||||
class TimelineRender : public RenderObject
|
class TimelineRender : public RenderObject
|
||||||
{
|
{
|
||||||
void onRender()
|
void onRender() const OVERRIDE
|
||||||
{
|
{
|
||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
|
|
@ -4447,7 +4447,7 @@ void Avatar::doShieldSong()
|
||||||
activateAura(AURA_SHIELD);
|
activateAura(AURA_SHIELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::render()
|
void Avatar::render() const
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dsq->continuity.form == FORM_SPIRIT && !skeletalSprite.getParent())
|
if (dsq->continuity.form == FORM_SPIRIT && !skeletalSprite.getParent())
|
||||||
|
@ -4462,11 +4462,6 @@ void Avatar::render()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::onRender()
|
|
||||||
{
|
|
||||||
Entity::onRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Avatar::onEnterState(int action)
|
void Avatar::onEnterState(int action)
|
||||||
{
|
{
|
||||||
Entity::onEnterState(action);
|
Entity::onEnterState(action);
|
||||||
|
|
|
@ -211,7 +211,7 @@ public:
|
||||||
float biteDelay, urchinDelay, jellyDelay;
|
float biteDelay, urchinDelay, jellyDelay;
|
||||||
bool movingOn;
|
bool movingOn;
|
||||||
|
|
||||||
void render();
|
void render() const OVERRIDE;
|
||||||
void activateAura(AuraType aura);
|
void activateAura(AuraType aura);
|
||||||
void stopAura();
|
void stopAura();
|
||||||
void setHeadTexture(const std::string &name, float t=0);
|
void setHeadTexture(const std::string &name, float t=0);
|
||||||
|
@ -434,7 +434,6 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
|
||||||
|
|
||||||
Quad *glow;
|
Quad *glow;
|
||||||
bool swimming;
|
bool swimming;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void Beam::trace()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Beam::onRender()
|
void Beam::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector diff = endPos - position;
|
Vector diff = endPos - position;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
void setBeamWidth(float w);
|
void setBeamWidth(float w);
|
||||||
protected:
|
protected:
|
||||||
float beamWidth;
|
float beamWidth;
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
void onEndOfLife();
|
void onEndOfLife();
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,15 +34,7 @@ CurrentRender::CurrentRender() : RenderObject()
|
||||||
rippleDelay = 2;
|
rippleDelay = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentRender::onUpdate(float dt)
|
void CurrentRender::onRender() const
|
||||||
{
|
|
||||||
RenderObject::onUpdate(dt);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CurrentRender::onRender()
|
|
||||||
{
|
{
|
||||||
// note: Leave cull_face disabled!?
|
// note: Leave cull_face disabled!?
|
||||||
//glDisable(GL_CULL_FACE);
|
//glDisable(GL_CULL_FACE);
|
||||||
|
|
|
@ -283,7 +283,7 @@ void Element::setElementEffectByIndex(int eidx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::render()
|
void Element::render() const
|
||||||
{
|
{
|
||||||
if (!elementActive) return;
|
if (!elementActive) return;
|
||||||
if (dsq->game->isSceneEditorActive() && this->bgLayer == dsq->game->sceneEditor.bgLayer
|
if (dsq->game->isSceneEditorActive() && this->bgLayer == dsq->game->sceneEditor.bgLayer
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
size_t templateIdx;
|
size_t templateIdx;
|
||||||
int bgLayer;
|
int bgLayer;
|
||||||
Element *bgLayerNext;
|
Element *bgLayerNext;
|
||||||
void render();
|
void render() const OVERRIDE;
|
||||||
ElementFlag elementFlag;
|
ElementFlag elementFlag;
|
||||||
void fillGrid();
|
void fillGrid();
|
||||||
bool isElementActive() { return elementActive; }
|
bool isElementActive() { return elementActive; }
|
||||||
|
|
|
@ -2474,7 +2474,7 @@ void Entity::doEntityAvoidance(float dt, int range, float mod, Entity *ignore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::render()
|
void Entity::render() const
|
||||||
{
|
{
|
||||||
InterpolatedVector bcolor = color;
|
InterpolatedVector bcolor = color;
|
||||||
InterpolatedVector bscale = scale;
|
InterpolatedVector bscale = scale;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
Vector vel;
|
Vector vel;
|
||||||
InterpolatedVector vel2;
|
InterpolatedVector vel2;
|
||||||
float activationRadius;
|
float activationRadius;
|
||||||
void render();
|
void render() const OVERRIDE;
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
void spawnParticlesFromCollisionMask(const char *p, unsigned intv=1, int layer = LR_PARTICLES, float rotz = 0);
|
void spawnParticlesFromCollisionMask(const char *p, unsigned intv=1, int layer = LR_PARTICLES, float rotz = 0);
|
||||||
|
|
|
@ -53,7 +53,7 @@ inline static void doRenderGrid(int x, int startCol, int endCol)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridRender::onRender()
|
void GridRender::onRender() const
|
||||||
{
|
{
|
||||||
const signed char obsType = this->obsType;
|
const signed char obsType = this->obsType;
|
||||||
Vector camPos = core->cameraPos;
|
Vector camPos = core->cameraPos;
|
||||||
|
@ -145,7 +145,7 @@ void SongLineRender::clear()
|
||||||
pts.clear();
|
pts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongLineRender::onRender()
|
void SongLineRender::onRender() const
|
||||||
{
|
{
|
||||||
int w=core->getWindowWidth();
|
int w=core->getWindowWidth();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
ObsType obsType;
|
ObsType obsType;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MiniMapRender : public RenderObject
|
class MiniMapRender : public RenderObject
|
||||||
|
@ -67,8 +67,8 @@ protected:
|
||||||
bool doRender;
|
bool doRender;
|
||||||
float lightLevel;
|
float lightLevel;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
void renderIcon(MinimapIcon *ico, const Vector& pos);
|
void renderIcon(const MinimapIcon *ico, const Vector& pos) const;
|
||||||
|
|
||||||
InterpolatedVector lerp;
|
InterpolatedVector lerp;
|
||||||
|
|
||||||
|
@ -115,7 +115,6 @@ protected:
|
||||||
void clearVis(WorldMapTile *tile);
|
void clearVis(WorldMapTile *tile);
|
||||||
bool on;
|
bool on;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
|
||||||
Quad *bg;
|
Quad *bg;
|
||||||
unsigned char *savedTexData;
|
unsigned char *savedTexData;
|
||||||
bool mb;
|
bool mb;
|
||||||
|
@ -128,7 +127,7 @@ class PathRender : public RenderObject
|
||||||
public:
|
public:
|
||||||
PathRender();
|
PathRender();
|
||||||
protected:
|
protected:
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CurrentRender : public RenderObject
|
class CurrentRender : public RenderObject
|
||||||
|
@ -137,8 +136,7 @@ public:
|
||||||
CurrentRender();
|
CurrentRender();
|
||||||
protected:
|
protected:
|
||||||
float rippleDelay;
|
float rippleDelay;
|
||||||
void onUpdate(float dt);
|
void onRender() const OVERRIDE;
|
||||||
void onRender();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SteamRender : public RenderObject
|
class SteamRender : public RenderObject
|
||||||
|
@ -147,8 +145,7 @@ public:
|
||||||
SteamRender();
|
SteamRender();
|
||||||
protected:
|
protected:
|
||||||
float rippleDelay;
|
float rippleDelay;
|
||||||
void onUpdate(float dt);
|
void onRender() const OVERRIDE;
|
||||||
void onRender();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SongLinePoint
|
struct SongLinePoint
|
||||||
|
@ -164,7 +161,7 @@ public:
|
||||||
void newPoint(const Vector &pt, const Vector &color);
|
void newPoint(const Vector &pt, const Vector &color);
|
||||||
void clear();
|
void clear();
|
||||||
protected:
|
protected:
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
std::vector<SongLinePoint> pts;
|
std::vector<SongLinePoint> pts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ HairNode *Hair::getHairNode(int idx)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::onRender()
|
void Hair::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
float segmentLength;
|
float segmentLength;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,43 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "SkeletalSprite.h"
|
#include "SkeletalSprite.h"
|
||||||
|
|
||||||
|
|
||||||
//class Mappy;
|
|
||||||
|
|
||||||
namespace IntroStuff
|
|
||||||
{
|
|
||||||
//Mappy *m;
|
|
||||||
bool quitFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace IntroStuff;
|
|
||||||
|
|
||||||
/*
|
|
||||||
class Mappy : public RenderObject, public ActionMapper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Mappy() : RenderObject(), ActionMapper() {}
|
|
||||||
void render() {}
|
|
||||||
//bool isOnScreen() { return false; }
|
|
||||||
void action(int id, int state)
|
|
||||||
{
|
|
||||||
ActionMapper::action(id, state);
|
|
||||||
if (!quitFlag)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
quitFlag = true;
|
|
||||||
dsq->quitNestedMain();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
void onUpdate(float dt)
|
|
||||||
{
|
|
||||||
ActionMapper::onUpdate(dt);
|
|
||||||
RenderObject::onUpdate(dt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
Intro::Intro() : StateObject()
|
Intro::Intro() : StateObject()
|
||||||
{
|
{
|
||||||
|
@ -71,8 +35,6 @@ Intro::Intro() : StateObject()
|
||||||
|
|
||||||
void Intro::applyState()
|
void Intro::applyState()
|
||||||
{
|
{
|
||||||
quitFlag = false;
|
|
||||||
|
|
||||||
dsq->jiggleCursor();
|
dsq->jiggleCursor();
|
||||||
dsq->cursor->alpha = 0;
|
dsq->cursor->alpha = 0;
|
||||||
//core->sound->streamOgg("sc/theme", 0);
|
//core->sound->streamOgg("sc/theme", 0);
|
||||||
|
@ -97,8 +59,6 @@ void Intro::removeState()
|
||||||
|
|
||||||
void Intro::endIntro()
|
void Intro::endIntro()
|
||||||
{
|
{
|
||||||
quitFlag = true;
|
|
||||||
|
|
||||||
dsq->overlay->color.stop();
|
dsq->overlay->color.stop();
|
||||||
dsq->overlay->alpha.stop();
|
dsq->overlay->alpha.stop();
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ void MiniMapRender::onUpdate(float dt)
|
||||||
toggleOn && dsq->game->avatar && dsq->game->avatar->getState() != Entity::STATE_TITLE && !(dsq->disableMiniMapOnNoInput && !dsq->game->avatar->isInputEnabled());
|
toggleOn && dsq->game->avatar && dsq->game->avatar->getState() != Entity::STATE_TITLE && !(dsq->disableMiniMapOnNoInput && !dsq->game->avatar->isInputEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniMapRender::onRender()
|
void MiniMapRender::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
@ -499,9 +499,6 @@ void MiniMapRender::onRender()
|
||||||
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
|
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
texMinimapBtm->unbind();
|
|
||||||
|
|
||||||
|
|
||||||
if (lightLevel > 0)
|
if (lightLevel > 0)
|
||||||
{
|
{
|
||||||
texWaterBit->apply();
|
texWaterBit->apply();
|
||||||
|
@ -587,10 +584,7 @@ void MiniMapRender::onRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texWaterBit->unbind();
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,9 +636,6 @@ void MiniMapRender::onRender()
|
||||||
glVertex2f(-hsz, -hsz);
|
glVertex2f(-hsz, -hsz);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
texNaija->unbind();
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
texMinimapTop->apply();
|
texMinimapTop->apply();
|
||||||
|
@ -658,10 +649,6 @@ void MiniMapRender::onRender()
|
||||||
glTexCoord2f(0, 0);
|
glTexCoord2f(0, 0);
|
||||||
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
|
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
texMinimapTop->unbind();
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
|
|
||||||
const int curHealthSteps = int((lerp.x/2) * healthSteps);
|
const int curHealthSteps = int((lerp.x/2) * healthSteps);
|
||||||
const int maxHealthSteps = int((dsq->game->avatar->maxHealth/10.0f) * healthSteps);
|
const int maxHealthSteps = int((dsq->game->avatar->maxHealth/10.0f) * healthSteps);
|
||||||
|
@ -731,8 +718,6 @@ void MiniMapRender::onRender()
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
texHealthBar->unbind();
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
|
@ -752,17 +737,12 @@ void MiniMapRender::onRender()
|
||||||
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
|
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
texMarker->unbind();
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
glColor4f(1,1,1,1);
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniMapRender::renderIcon(MinimapIcon *ico, const Vector& pos)
|
void MiniMapRender::renderIcon(const MinimapIcon *ico, const Vector& pos) const
|
||||||
{
|
{
|
||||||
if(!ico->tex)
|
if(!ico->tex)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,7 +30,7 @@ PathRender::PathRender() : RenderObject()
|
||||||
alpha = 0.5f;
|
alpha = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathRender::onRender()
|
void PathRender::onRender() const
|
||||||
{
|
{
|
||||||
const size_t pathcount = dsq->game->getNumPaths();
|
const size_t pathcount = dsq->game->getNumPaths();
|
||||||
if (pathcount == 0)
|
if (pathcount == 0)
|
||||||
|
|
|
@ -441,10 +441,3 @@ void SchoolFish::onUpdate(float dt)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchoolFish::onRender()
|
|
||||||
{
|
|
||||||
FlockEntity::onRender();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ protected:
|
||||||
|
|
||||||
void onEnterState(int action);
|
void onEnterState(int action);
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
|
||||||
|
|
||||||
float avoidTime;
|
float avoidTime;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
void destroy();
|
void destroy();
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,12 +34,7 @@ SteamRender::SteamRender() : RenderObject()
|
||||||
setBlendType(BLEND_ADD);
|
setBlendType(BLEND_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamRender::onUpdate(float dt)
|
void SteamRender::onRender() const
|
||||||
{
|
|
||||||
RenderObject::onUpdate(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SteamRender::onRender()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ void Strand::onUpdate(float dt)
|
||||||
updateSegments(position);
|
updateSegments(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Strand::onRender()
|
void Strand::onRender() const
|
||||||
{
|
{
|
||||||
const int numSegments = segments.size();
|
const int numSegments = segments.size();
|
||||||
if (numSegments == 0) return;
|
if (numSegments == 0) return;
|
||||||
|
|
|
@ -129,7 +129,7 @@ void ToolTip::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTip::render()
|
void ToolTip::render() const
|
||||||
{
|
{
|
||||||
if (!game->getInGameMenu()->recipeMenu.on && toolTipsOn)
|
if (!game->getInGameMenu()->recipeMenu.on && toolTipsOn)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,14 +35,14 @@ public:
|
||||||
void setAreaFromCenter(const Vector ¢er, int width, int height);
|
void setAreaFromCenter(const Vector ¢er, int width, int height);
|
||||||
void setCircularAreaFromCenter(const Vector ¢er, int diameter);
|
void setCircularAreaFromCenter(const Vector ¢er, int diameter);
|
||||||
|
|
||||||
void render();
|
void render() const OVERRIDE;
|
||||||
|
|
||||||
static bool toolTipsOn;
|
static bool toolTipsOn;
|
||||||
|
|
||||||
bool required;
|
bool required;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt) OVERRIDE;
|
||||||
|
|
||||||
int areaType;
|
int areaType;
|
||||||
Vector areaCenter;
|
Vector areaCenter;
|
||||||
|
|
|
@ -46,10 +46,8 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
|
||||||
shareAlphaWithChildren = 0;
|
shareAlphaWithChildren = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterSurfaceRender::render()
|
void WaterSurfaceRender::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (dsq->game->waterLevel.x > 0)
|
if (dsq->game->waterLevel.x > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -100,20 +98,9 @@ void WaterSurfaceRender::render()
|
||||||
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
||||||
{
|
{
|
||||||
qSurface->alphaMod = 0.5;
|
qSurface->alphaMod = 0.5;
|
||||||
Quad::render();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
Quad::render();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Quad::render();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -124,25 +111,12 @@ void WaterSurfaceRender::render()
|
||||||
qLine2->alpha = 0;
|
qLine2->alpha = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void WaterSurfaceRender::onRender()
|
|
||||||
{
|
|
||||||
if (dsq->game->waterLevel == 0) return;
|
|
||||||
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
|
||||||
{
|
|
||||||
dsq->frameBuffer.bindTexture();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
||||||
{
|
{
|
||||||
const float reflectSize = 97;
|
const float reflectSize = 97;
|
||||||
const float reflectPos = (dsq->game->waterLevel.x - core->cameraPos.y)
|
const float reflectPos = (dsq->game->waterLevel.x - core->cameraPos.y)
|
||||||
+ (dsq->game->waterLevel.x - core->screenCenter.y) / 3;
|
+ (dsq->game->waterLevel.x - core->screenCenter.y) / 3;
|
||||||
const float reflectOffset = -0.03f;
|
const float reflectOffset = -0.03f;
|
||||||
const float coordDiv = 768;
|
const float coordDiv = 768;
|
||||||
const float v0 = 1 + reflectOffset - (reflectPos * core->globalScale.x) / coordDiv;
|
const float v0 = 1 + reflectOffset - (reflectPos * core->globalScale.x) / coordDiv;
|
||||||
|
@ -153,25 +127,31 @@ void WaterSurfaceRender::onRender()
|
||||||
|
|
||||||
upperLeftTextureCoordinates.x = 0;
|
upperLeftTextureCoordinates.x = 0;
|
||||||
lowerRightTextureCoordinates.x = core->frameBuffer.getWidthP();
|
lowerRightTextureCoordinates.x = core->frameBuffer.getWidthP();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaterSurfaceRender::render() const
|
||||||
|
{
|
||||||
|
if (dsq->game->waterLevel.x > 0)
|
||||||
|
Quad::render();
|
||||||
|
}
|
||||||
|
|
||||||
Quad::onRender();
|
void WaterSurfaceRender::onRender() const
|
||||||
|
{
|
||||||
|
if (dsq->game->waterLevel == 0) return;
|
||||||
|
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
{
|
||||||
|
dsq->frameBuffer.bindTexture();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
glColor4f(0.4f, 0.7f, 0.8f, 0.2f);
|
|
||||||
Quad::onRender();
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
glColor4f(0.4f, 0.7f, 0.8f, 0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Quad::onRender();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
RenderObject::lastTextureApplied = 0;
|
RenderObject::lastTextureApplied = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,11 @@ class WaterSurfaceRender : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaterSurfaceRender();
|
WaterSurfaceRender();
|
||||||
void render();
|
void render() const OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
Quad *qSurface, *qLine, *qLine2;
|
Quad *qSurface, *qLine, *qLine2;
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
|
void onUpdate(float dt) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -135,7 +135,7 @@ void Web::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Web::onRender()
|
void Web::onRender() const
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
void onEndOfLife();
|
void onEndOfLife();
|
||||||
std::vector<Vector> points;
|
std::vector<Vector> points;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,16 +110,12 @@ public:
|
||||||
followCamera = 1;
|
followCamera = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void render()
|
|
||||||
{
|
|
||||||
setProperPosition();
|
|
||||||
Quad::render();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Vector truePosition;
|
Vector truePosition;
|
||||||
void setProperPosition()
|
void onUpdate(float dt) OVERRIDE
|
||||||
{
|
{
|
||||||
|
Quad::onUpdate(dt);
|
||||||
|
|
||||||
Vector wp = parent->getWorldCollidePosition(truePosition);
|
Vector wp = parent->getWorldCollidePosition(truePosition);
|
||||||
Vector diff = wp - core->center;
|
Vector diff = wp - core->center;
|
||||||
|
|
||||||
|
@ -177,12 +173,6 @@ public:
|
||||||
float spawnBitTimer;
|
float spawnBitTimer;
|
||||||
|
|
||||||
|
|
||||||
void render()
|
|
||||||
{
|
|
||||||
|
|
||||||
Quad::render();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BeaconData *beaconData;
|
BeaconData *beaconData;
|
||||||
|
|
||||||
|
@ -1241,11 +1231,6 @@ Vector WorldMapRender::getWorldToTile(WorldMapTile *tile, Vector position, bool
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldMapRender::onRender()
|
|
||||||
{
|
|
||||||
RenderObject::onRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WorldMapRender::isOn()
|
bool WorldMapRender::isOn()
|
||||||
{
|
{
|
||||||
return this->on;
|
return this->on;
|
||||||
|
|
|
@ -168,7 +168,7 @@ void AfterEffectManager::destroyEffect(int id)
|
||||||
openSpots.push_back(id);
|
openSpots.push_back(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AfterEffectManager::render()
|
void AfterEffectManager::render() const
|
||||||
{
|
{
|
||||||
assert(core->frameBuffer.isInited());
|
assert(core->frameBuffer.isInited());
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void AfterEffectManager::render()
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AfterEffectManager::renderGrid()
|
void AfterEffectManager::renderGrid() const
|
||||||
{
|
{
|
||||||
|
|
||||||
int firstShader = -1;
|
int firstShader = -1;
|
||||||
|
@ -206,9 +206,6 @@ void AfterEffectManager::renderGrid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screenWidth = core->getWindowWidth();
|
|
||||||
screenHeight = core->getWindowHeight();
|
|
||||||
|
|
||||||
float percentX, percentY;
|
float percentX, percentY;
|
||||||
percentX = (float)screenWidth/(float)textureWidth;
|
percentX = (float)screenWidth/(float)textureWidth;
|
||||||
percentY = (float)screenHeight/(float)textureHeight;
|
percentY = (float)screenHeight/(float)textureHeight;
|
||||||
|
@ -263,8 +260,8 @@ void AfterEffectManager::renderGrid()
|
||||||
{
|
{
|
||||||
// From here on: secondary shader passes.
|
// From here on: secondary shader passes.
|
||||||
// We just outputted to the backup buffer...
|
// We just outputted to the backup buffer...
|
||||||
FrameBuffer *fbIn = &core->frameBuffer;
|
const FrameBuffer *fbIn = &core->frameBuffer;
|
||||||
FrameBuffer *fbOut = &backupBuffer;
|
const FrameBuffer *fbOut = &backupBuffer;
|
||||||
|
|
||||||
|
|
||||||
for(int i = firstShader + 1; i <= lastShader; ++i)
|
for(int i = firstShader + 1; i <= lastShader; ++i)
|
||||||
|
@ -345,7 +342,7 @@ void AfterEffectManager::renderGrid()
|
||||||
// renderGridPoints();
|
// renderGridPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AfterEffectManager::renderGridPoints()
|
void AfterEffectManager::renderGridPoints() const
|
||||||
{
|
{
|
||||||
glColor4f(0.0f,0.0f,0.0f,1.0f);
|
glColor4f(0.0f,0.0f,0.0f,1.0f);
|
||||||
for (int i = 0; i < (xDivs); i++)
|
for (int i = 0; i < (xDivs); i++)
|
||||||
|
|
|
@ -88,9 +88,9 @@ public:
|
||||||
|
|
||||||
void resetGrid();
|
void resetGrid();
|
||||||
|
|
||||||
void render();
|
void render() const;
|
||||||
void renderGrid();
|
void renderGrid() const;
|
||||||
void renderGridPoints();
|
void renderGridPoints() const;
|
||||||
|
|
||||||
void loadShaders();
|
void loadShaders();
|
||||||
void unloadShaders(); // unloads shaders but keeps code and data intact, so that they can be reloaded.
|
void unloadShaders(); // unloads shaders but keeps code and data intact, so that they can be reloaded.
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace internal
|
||||||
#pragma warning(disable:4505) // unreferenced local function has been removed
|
#pragma warning(disable:4505) // unreferenced local function has been removed
|
||||||
#pragma warning(disable:4702) // unreachable code
|
#pragma warning(disable:4702) // unreachable code
|
||||||
#pragma warning(disable:4127) // conditional expression is constant
|
#pragma warning(disable:4127) // conditional expression is constant
|
||||||
|
#pragma warning(disable:26812) // unscoped enum
|
||||||
//#pragma warning(disable:4706) // assignment within conditional expression
|
//#pragma warning(disable:4706) // assignment within conditional expression
|
||||||
|
|
||||||
//#pragma warning(disable:4389) // signed/unsigned mismatch
|
//#pragma warning(disable:4389) // signed/unsigned mismatch
|
||||||
|
|
|
@ -70,12 +70,9 @@ void BmpFont::load(const std::string &file, float scale, bool loadTexture)
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture *fontTextureTest = 0;
|
|
||||||
BitmapText::BitmapText(BmpFont *bmpFont)
|
BitmapText::BitmapText(BmpFont *bmpFont)
|
||||||
{
|
{
|
||||||
this->bmpFont = bmpFont;
|
this->bmpFont = bmpFont;
|
||||||
bfePass =0;
|
|
||||||
bfe = BFE_NONE;
|
|
||||||
|
|
||||||
currentScrollLine = currentScrollChar = 0;
|
currentScrollLine = currentScrollChar = 0;
|
||||||
scrollDelay = 0;
|
scrollDelay = 0;
|
||||||
|
@ -186,11 +183,6 @@ void BitmapText::formatText()
|
||||||
colorIndices.clear();
|
colorIndices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::setBitmapFontEffect(BitmapFontEffect bfe)
|
|
||||||
{
|
|
||||||
this->bfe = bfe;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitmapText::updateWordColoring()
|
void BitmapText::updateWordColoring()
|
||||||
{
|
{
|
||||||
colorIndices.resize(lines.size());
|
colorIndices.resize(lines.size());
|
||||||
|
@ -231,7 +223,6 @@ void BitmapText::setFontSize(float sz)
|
||||||
|
|
||||||
void BitmapText::onUpdate(float dt)
|
void BitmapText::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
bfePass = 0;
|
|
||||||
RenderObject::onUpdate(dt);
|
RenderObject::onUpdate(dt);
|
||||||
if (scrollDelay > 0 && scrolling)
|
if (scrollDelay > 0 && scrolling)
|
||||||
{
|
{
|
||||||
|
@ -275,7 +266,7 @@ Vector BitmapText::getColorIndex(size_t i, size_t j)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::onRender()
|
void BitmapText::onRender() const
|
||||||
{
|
{
|
||||||
if (!bmpFont) return;
|
if (!bmpFont) return;
|
||||||
float top_color[3] = {bmpFont->fontTopColor.x*color.x, bmpFont->fontTopColor.y*color.y, bmpFont->fontTopColor.z*color.z};
|
float top_color[3] = {bmpFont->fontTopColor.x*color.x, bmpFont->fontTopColor.y*color.y, bmpFont->fontTopColor.z*color.z};
|
||||||
|
@ -287,8 +278,6 @@ void BitmapText::onRender()
|
||||||
|
|
||||||
bmpFont->font->Begin();
|
bmpFont->font->Begin();
|
||||||
|
|
||||||
if (fontTextureTest) fontTextureTest->apply();
|
|
||||||
|
|
||||||
if (bmpFont->overrideTexture) bmpFont->overrideTexture->apply();
|
if (bmpFont->overrideTexture) bmpFont->overrideTexture->apply();
|
||||||
|
|
||||||
float y=0;
|
float y=0;
|
||||||
|
@ -350,25 +339,6 @@ void BitmapText::reloadDevice()
|
||||||
setText(this->text);
|
setText(this->text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::render()
|
|
||||||
{
|
|
||||||
RenderObject::render();
|
|
||||||
if (!bfePass)
|
|
||||||
{
|
|
||||||
if (bfe == BFE_SHADOWBLUR)
|
|
||||||
{
|
|
||||||
InterpolatedVector oldAlpha = alpha, oldPos = position;
|
|
||||||
Vector adjust(rand()%5-2, rand()%5-2+2);
|
|
||||||
position += adjust;
|
|
||||||
alpha *= 0.4f;
|
|
||||||
bfePass = 1;
|
|
||||||
RenderObject::render();
|
|
||||||
alpha = oldAlpha;
|
|
||||||
position = oldPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitmapText::stopScrollingText()
|
void BitmapText::stopScrollingText()
|
||||||
{
|
{
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
|
|
|
@ -27,13 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
namespace glfont { class GLFont; }
|
namespace glfont { class GLFont; }
|
||||||
|
|
||||||
enum BitmapFontEffect
|
|
||||||
{
|
|
||||||
BFE_NONE = 0,
|
|
||||||
BFE_SHADOWBLUR = 1,
|
|
||||||
BFE_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BmpFont
|
struct BmpFont
|
||||||
{
|
{
|
||||||
BmpFont();
|
BmpFont();
|
||||||
|
@ -69,8 +62,6 @@ public:
|
||||||
Vector getColorIndex(size_t i, size_t j);
|
Vector getColorIndex(size_t i, size_t j);
|
||||||
void updateWordColoring();
|
void updateWordColoring();
|
||||||
void autoKern();
|
void autoKern();
|
||||||
void setBitmapFontEffect(BitmapFontEffect bfe);
|
|
||||||
void render();
|
|
||||||
virtual float getHeight();
|
virtual float getHeight();
|
||||||
void unloadDevice();
|
void unloadDevice();
|
||||||
void reloadDevice();
|
void reloadDevice();
|
||||||
|
@ -82,8 +73,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
float scrollSpeed;
|
float scrollSpeed;
|
||||||
BmpFont *bmpFont;
|
BmpFont *bmpFont;
|
||||||
int bfePass;
|
|
||||||
BitmapFontEffect bfe;
|
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
float scrollDelay;
|
float scrollDelay;
|
||||||
bool scrolling;
|
bool scrolling;
|
||||||
|
@ -93,7 +82,7 @@ protected:
|
||||||
float alignWidth;
|
float alignWidth;
|
||||||
void formatText();
|
void formatText();
|
||||||
float fontDrawSize;
|
float fontDrawSize;
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
typedef std::vector<std::string> Lines;
|
typedef std::vector<std::string> Lines;
|
||||||
Lines lines;
|
Lines lines;
|
||||||
typedef std::vector<Vector> ColorIndices;
|
typedef std::vector<Vector> ColorIndices;
|
||||||
|
|
15
BBGE/Core.h
15
BBGE/Core.h
|
@ -119,7 +119,6 @@ public:
|
||||||
void remove(RenderObject* r);
|
void remove(RenderObject* r);
|
||||||
void moveToFront(RenderObject *r);
|
void moveToFront(RenderObject *r);
|
||||||
void moveToBack(RenderObject *r);
|
void moveToBack(RenderObject *r);
|
||||||
void setCull(bool cull);
|
|
||||||
void renderPass(int pass);
|
void renderPass(int pass);
|
||||||
void reloadDevice();
|
void reloadDevice();
|
||||||
|
|
||||||
|
@ -162,13 +161,13 @@ public:
|
||||||
float followCamera;
|
float followCamera;
|
||||||
|
|
||||||
int followCameraLock;
|
int followCameraLock;
|
||||||
bool cull;
|
|
||||||
bool update;
|
bool update;
|
||||||
|
|
||||||
Vector color;
|
Vector color;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void renderOneObject(RenderObject *robj);
|
inline void renderOneObject(const RenderObject *robj);
|
||||||
|
|
||||||
RenderObjects renderObjects;
|
RenderObjects renderObjects;
|
||||||
size_t objectCount;
|
size_t objectCount;
|
||||||
|
@ -211,8 +210,6 @@ public:
|
||||||
bool isShuttingDown();
|
bool isShuttingDown();
|
||||||
bool isWindowFocus();
|
bool isWindowFocus();
|
||||||
|
|
||||||
void instantQuit();
|
|
||||||
|
|
||||||
void cacheRender();
|
void cacheRender();
|
||||||
|
|
||||||
void reloadResources();
|
void reloadResources();
|
||||||
|
@ -263,12 +260,12 @@ public:
|
||||||
void clearGarbage();
|
void clearGarbage();
|
||||||
|
|
||||||
|
|
||||||
bool isNested() { return nestedMains > 1; }
|
bool isNested() const { return nestedMains > 1; }
|
||||||
int getNestedMains() { return nestedMains; }
|
int getNestedMains() const { return nestedMains; }
|
||||||
void quitNestedMain();
|
void quitNestedMain();
|
||||||
|
|
||||||
int getWindowWidth() { return width; }
|
int getWindowWidth() const { return width; }
|
||||||
int getWindowHeight() { return height; }
|
int getWindowHeight() const { return height; }
|
||||||
|
|
||||||
unsigned getTicks();
|
unsigned getTicks();
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ void DarkLayer::preRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarkLayer::render()
|
void DarkLayer::render() const
|
||||||
{
|
{
|
||||||
if (renderLayer != -1)
|
if (renderLayer != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
void toggle(bool on);
|
void toggle(bool on);
|
||||||
void setLayers(int layer, int renderLayer);
|
void setLayers(int layer, int renderLayer);
|
||||||
void preRender();
|
void preRender();
|
||||||
void render();
|
void render() const;
|
||||||
int getLayer();
|
int getLayer();
|
||||||
int getRenderLayer();
|
int getRenderLayer();
|
||||||
bool isUsed();
|
bool isUsed();
|
||||||
|
|
|
@ -130,7 +130,7 @@ void DebugFont::setText(const std::string &text)
|
||||||
formatText();
|
formatText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugFont::onRender()
|
void DebugFont::onRender() const
|
||||||
{
|
{
|
||||||
const float vspc = 1.5;
|
const float vspc = 1.5;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
float fontDrawSize, textWidth;
|
float fontDrawSize, textWidth;
|
||||||
void formatText();
|
void formatText();
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
std::string text;
|
std::string text;
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
Align align;
|
Align align;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void PostProcessingFX::disable(FXTypes type)
|
||||||
enabled[int(type)] = false;
|
enabled[int(type)] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessingFX::render()
|
void PostProcessingFX::render() const
|
||||||
{
|
{
|
||||||
if(!core->frameBuffer.isInited())
|
if(!core->frameBuffer.isInited())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void preRender();
|
void preRender();
|
||||||
void render();
|
void render() const;
|
||||||
void toggle(FXTypes type);
|
void toggle(FXTypes type);
|
||||||
void enable(FXTypes type);
|
void enable(FXTypes type);
|
||||||
void disable(FXTypes type);
|
void disable(FXTypes type);
|
||||||
|
|
|
@ -222,12 +222,7 @@ void Emitter::removeParticle(Particle *p)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Emitter::render()
|
void Emitter::onRender() const
|
||||||
{
|
|
||||||
Quad::render();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Emitter::onRender()
|
|
||||||
{
|
{
|
||||||
if (particles.empty()) return;
|
if (particles.empty()) return;
|
||||||
|
|
||||||
|
@ -250,7 +245,7 @@ void Emitter::onRender()
|
||||||
{
|
{
|
||||||
Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 1);
|
Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 1);
|
||||||
float alphaMult = data.inheritAlpha ? pe->alpha.x : 1;
|
float alphaMult = data.inheritAlpha ? pe->alpha.x : 1;
|
||||||
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
|
for (Particles::const_iterator i = particles.begin(); i != particles.end(); i++)
|
||||||
{
|
{
|
||||||
Particle *p = *i;
|
Particle *p = *i;
|
||||||
if (p->active)
|
if (p->active)
|
||||||
|
@ -319,7 +314,7 @@ void Emitter::onRender()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
|
for (Particles::const_iterator i = particles.begin(); i != particles.end(); i++)
|
||||||
{
|
{
|
||||||
Particle *p = *i;
|
Particle *p = *i;
|
||||||
if (p->active)
|
if (p->active)
|
||||||
|
|
|
@ -204,20 +204,20 @@ void FrameBuffer::reloadDevice()
|
||||||
init(_w, _h, _fitToScreen);
|
init(_w, _h, _fitToScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::startCapture()
|
void FrameBuffer::startCapture() const
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::endCapture()
|
void FrameBuffer::endCapture() const
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::bindTexture()
|
void FrameBuffer::bindTexture() const
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
|
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
|
||||||
|
|
|
@ -31,9 +31,9 @@ public:
|
||||||
~FrameBuffer();
|
~FrameBuffer();
|
||||||
bool init(int width, int height, bool fitToScreen=false);
|
bool init(int width, int height, bool fitToScreen=false);
|
||||||
bool isInited() { return inited; }
|
bool isInited() { return inited; }
|
||||||
void startCapture();
|
void startCapture() const;
|
||||||
void endCapture();
|
void endCapture() const;
|
||||||
void bindTexture();
|
void bindTexture() const;
|
||||||
int getWidth() { return w; }
|
int getWidth() { return w; }
|
||||||
int getHeight() { return h; }
|
int getHeight() { return h; }
|
||||||
float getWidthP();
|
float getWidthP();
|
||||||
|
|
|
@ -58,7 +58,7 @@ void Gradient::makeHorizontal(Vector c1, Vector c2)
|
||||||
ulc3 = c1;
|
ulc3 = c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gradient::onRender()
|
void Gradient::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
int autoWidth, autoHeight;
|
int autoWidth, autoHeight;
|
||||||
protected:
|
protected:
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
Vector ulc0, ulc1, ulc2, ulc3;
|
Vector ulc0, ulc1, ulc2, ulc3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -439,9 +439,3 @@ void ParticleEffect::stop()
|
||||||
(*i)->stop();
|
(*i)->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleEffect::onRender()
|
|
||||||
{
|
|
||||||
RenderObject::onRender();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,6 @@ public:
|
||||||
|
|
||||||
SpawnParticleData data;
|
SpawnParticleData data;
|
||||||
|
|
||||||
void render();
|
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
@ -138,7 +136,7 @@ public:
|
||||||
bool hasRot;
|
bool hasRot;
|
||||||
protected:
|
protected:
|
||||||
Vector currentSpawn, lastSpawn;
|
Vector currentSpawn, lastSpawn;
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
void spawnParticle(float perc=1);
|
void spawnParticle(float perc=1);
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
|
|
||||||
|
@ -170,7 +168,6 @@ protected:
|
||||||
bool waitForParticles;
|
bool waitForParticles;
|
||||||
|
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
|
||||||
|
|
||||||
float effectLife, effectLifeCounter;
|
float effectLife, effectLifeCounter;
|
||||||
bool running;
|
bool running;
|
||||||
|
|
|
@ -134,7 +134,7 @@ void Quad::setGridPoints(bool vert, const std::vector<Vector> &points)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Quad::getStripSegmentSize()
|
float Quad::getStripSegmentSize() const
|
||||||
{
|
{
|
||||||
return (1.0f/(float(strip.size())));
|
return (1.0f/(float(strip.size())));
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void Quad::destroy()
|
||||||
RenderObject::destroy();
|
RenderObject::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Quad::isCoordinateInside(Vector coord, int minSize)
|
bool Quad::isCoordinateInside(Vector coord, int minSize) const
|
||||||
{
|
{
|
||||||
Vector realscale = getRealScale();
|
Vector realscale = getRealScale();
|
||||||
int hw = fabsf((width)*realscale.x)*0.5f;
|
int hw = fabsf((width)*realscale.x)*0.5f;
|
||||||
|
@ -250,7 +250,7 @@ bool Quad::isCoordinateInside(Vector coord, int minSize)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Quad::isCoordinateInsideWorld(const Vector &coord, int minSize)
|
bool Quad::isCoordinateInsideWorld(const Vector &coord, int minSize) const
|
||||||
{
|
{
|
||||||
int hw = fabsf((width)*getRealScale().x)*0.5f;
|
int hw = fabsf((width)*getRealScale().x)*0.5f;
|
||||||
int hh = fabsf((height)*getRealScale().y)*0.5f;
|
int hh = fabsf((height)*getRealScale().y)*0.5f;
|
||||||
|
@ -270,7 +270,7 @@ bool Quad::isCoordinateInsideWorld(const Vector &coord, int minSize)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Quad::isCoordinateInsideWorldRect(const Vector &coord, int w, int h)
|
bool Quad::isCoordinateInsideWorldRect(const Vector &coord, int w, int h) const
|
||||||
{
|
{
|
||||||
int hw = w*0.5f;
|
int hw = w*0.5f;
|
||||||
int hh = h*0.5f;
|
int hh = h*0.5f;
|
||||||
|
@ -319,7 +319,7 @@ void Quad::updateGrid(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quad::renderGrid()
|
void Quad::renderGrid() const
|
||||||
{
|
{
|
||||||
if (xDivs < 2 || yDivs < 2)
|
if (xDivs < 2 || yDivs < 2)
|
||||||
return;
|
return;
|
||||||
|
@ -422,7 +422,7 @@ void Quad::repeatTextureToFill(bool on)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quad::onRender()
|
void Quad::onRender() const
|
||||||
{
|
{
|
||||||
if (!renderQuad) return;
|
if (!renderQuad) return;
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ CollideQuad::~CollideQuad()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollideQuad::renderCollision()
|
void CollideQuad::renderCollision() const
|
||||||
{
|
{
|
||||||
if (collideRadius > 0)
|
if (collideRadius > 0)
|
||||||
{
|
{
|
||||||
|
|
19
BBGE/Quad.h
19
BBGE/Quad.h
|
@ -36,7 +36,7 @@ protected:
|
||||||
int w, h, w2, h2;
|
int w, h, w2, h2;
|
||||||
int lineSize;
|
int lineSize;
|
||||||
|
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Quad : public RenderObject
|
class Quad : public RenderObject
|
||||||
|
@ -46,9 +46,9 @@ public:
|
||||||
Quad();
|
Quad();
|
||||||
void createGrid(int x, int y);
|
void createGrid(int x, int y);
|
||||||
void destroy();
|
void destroy();
|
||||||
bool isCoordinateInside(Vector coord, int minSize=0);
|
bool isCoordinateInside(Vector coord, int minSize=0) const;
|
||||||
bool isCoordinateInsideWorld(const Vector &coord, int minSize=0);
|
bool isCoordinateInsideWorld(const Vector &coord, int minSize=0) const;
|
||||||
bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h);
|
bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h) const;
|
||||||
|
|
||||||
void flipVertical();
|
void flipVertical();
|
||||||
void flipHorizontal();
|
void flipHorizontal();
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
bool isRepeatingTextureToFill() const { return repeatingTextureToFill; }
|
bool isRepeatingTextureToFill() const { return repeatingTextureToFill; }
|
||||||
void setGridPoints(bool vert, const std::vector<Vector> &points);
|
void setGridPoints(bool vert, const std::vector<Vector> &points);
|
||||||
virtual void createStrip(bool stripVert, int num);
|
virtual void createStrip(bool stripVert, int num);
|
||||||
float getStripSegmentSize();
|
float getStripSegmentSize() const;
|
||||||
void resetStrip();
|
void resetStrip();
|
||||||
Vector ** getDrawGrid() { return drawGrid; }
|
Vector ** getDrawGrid() { return drawGrid; }
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ public:
|
||||||
|
|
||||||
char autoWidth, autoHeight; // char to save space
|
char autoWidth, autoHeight; // char to save space
|
||||||
|
|
||||||
bool renderQuad, renderBorder, renderCenter;
|
bool renderQuad, renderCenter;
|
||||||
|
mutable bool renderBorder; // TODO: should be part of render state
|
||||||
bool stripVert;
|
bool stripVert;
|
||||||
std::vector<Vector>strip;
|
std::vector<Vector>strip;
|
||||||
Vector texOff;
|
Vector texOff;
|
||||||
|
@ -103,7 +104,7 @@ protected:
|
||||||
|
|
||||||
void resetGrid();
|
void resetGrid();
|
||||||
void updateGrid(float dt);
|
void updateGrid(float dt);
|
||||||
void renderGrid();
|
void renderGrid() const;
|
||||||
|
|
||||||
|
|
||||||
float drawGridOffsetX;
|
float drawGridOffsetX;
|
||||||
|
@ -116,7 +117,7 @@ protected:
|
||||||
static Vector renderBorderColor;
|
static Vector renderBorderColor;
|
||||||
|
|
||||||
void onSetTexture();
|
void onSetTexture();
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
private:
|
private:
|
||||||
bool doUpdateGrid;
|
bool doUpdateGrid;
|
||||||
|
@ -142,7 +143,7 @@ class CollideQuad : public Quad
|
||||||
public:
|
public:
|
||||||
CollideQuad();
|
CollideQuad();
|
||||||
virtual ~CollideQuad();
|
virtual ~CollideQuad();
|
||||||
virtual void renderCollision() OVERRIDE;
|
virtual void renderCollision() const OVERRIDE;
|
||||||
|
|
||||||
float collideRadius;
|
float collideRadius;
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,7 +75,7 @@ static inline void drawOnePoint(const QuadGrid::Point& p, float ox, float oy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QuadGrid::onRender()
|
void QuadGrid::onRender() const
|
||||||
{
|
{
|
||||||
glColor4f(color.x, color.y, color.z, alpha.x * alphaMod);
|
glColor4f(color.x, color.y, color.z, alpha.x * alphaMod);
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ void QuadGrid::onRender()
|
||||||
const size_t H = quadsY();
|
const size_t H = quadsY();
|
||||||
for(size_t y = 0; y < H; ++y)
|
for(size_t y = 0; y < H; ++y)
|
||||||
{
|
{
|
||||||
Point * const row0 = &_points[y * NX];
|
const Point * const row0 = &_points[y * NX];
|
||||||
Point * const row1 = row0 + NX;
|
const Point * const row1 = row0 + NX;
|
||||||
for(size_t x = 0; x < W; ++x)
|
for(size_t x = 0; x < W; ++x)
|
||||||
{
|
{
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
return _points[y * _w + x];
|
return _points[y * _w + x];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onRender();
|
virtual void onRender() const OVERRIDE;
|
||||||
virtual void onUpdate(float dt);
|
virtual void onUpdate(float dt);
|
||||||
virtual void onSetTexture();
|
virtual void onSetTexture();
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ void RenderObject::toggleAlpha(float t)
|
||||||
alpha.interpolateTo(0,t);
|
alpha.interpolateTo(0,t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RenderObject::getTopLayer()
|
int RenderObject::getTopLayer() const
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ static const BlendParams s_blendParams[] =
|
||||||
{ GL_ZERO, GL_SRC_COLOR },
|
{ GL_ZERO, GL_SRC_COLOR },
|
||||||
};
|
};
|
||||||
|
|
||||||
void RenderObject::applyBlendType()
|
void RenderObject::applyBlendType() const
|
||||||
{
|
{
|
||||||
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
compile_assert(Countof(s_blendParams) == _BLEND_MAXSIZE);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void RenderObject::applyBlendType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::setColorMult(const Vector &color, const float alpha)
|
void RenderObject::setColorMult(const Vector &color, const float alpha) const
|
||||||
{
|
{
|
||||||
if (colorIsSaved)
|
if (colorIsSaved)
|
||||||
{
|
{
|
||||||
|
@ -98,13 +98,13 @@ void RenderObject::setColorMult(const Vector &color, const float alpha)
|
||||||
this->savedAlpha = this->alpha.x;
|
this->savedAlpha = this->alpha.x;
|
||||||
this->color *= color;
|
this->color *= color;
|
||||||
this->alpha.x *= alpha;
|
this->alpha.x *= alpha;
|
||||||
for (Children::iterator i = children.begin(); i != children.end(); i++)
|
for (Children::const_iterator i = children.begin(); i != children.end(); i++)
|
||||||
{
|
{
|
||||||
(*i)->setColorMult(color, alpha);
|
(*i)->setColorMult(color, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::clearColorMult()
|
void RenderObject::clearColorMult() const
|
||||||
{
|
{
|
||||||
if (!colorIsSaved)
|
if (!colorIsSaved)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ void RenderObject::clearColorMult()
|
||||||
this->color.z = this->savedColor.z;
|
this->color.z = this->savedColor.z;
|
||||||
this->alpha.x = this->savedAlpha;
|
this->alpha.x = this->savedAlpha;
|
||||||
this->colorIsSaved = false;
|
this->colorIsSaved = false;
|
||||||
for (Children::iterator i = children.begin(); i != children.end(); i++)
|
for (Children::const_iterator i = children.begin(); i != children.end(); i++)
|
||||||
{
|
{
|
||||||
(*i)->clearColorMult();
|
(*i)->clearColorMult();
|
||||||
}
|
}
|
||||||
|
@ -177,12 +177,12 @@ RenderObject::~RenderObject()
|
||||||
freeMotionBlur();
|
freeMotionBlur();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getWorldPosition()
|
Vector RenderObject::getWorldPosition() const
|
||||||
{
|
{
|
||||||
return getWorldCollidePosition();
|
return getWorldCollidePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderObject* RenderObject::getTopParent()
|
RenderObject* RenderObject::getTopParent() const
|
||||||
{
|
{
|
||||||
RenderObject *p = parent;
|
RenderObject *p = parent;
|
||||||
RenderObject *lastp=0;
|
RenderObject *lastp=0;
|
||||||
|
@ -194,7 +194,7 @@ RenderObject* RenderObject::getTopParent()
|
||||||
return lastp;
|
return lastp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::isPieceFlippedHorizontal()
|
bool RenderObject::isPieceFlippedHorizontal() const
|
||||||
{
|
{
|
||||||
RenderObject *p = getTopParent();
|
RenderObject *p = getTopParent();
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -203,13 +203,13 @@ bool RenderObject::isPieceFlippedHorizontal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector RenderObject::getInvRotPosition(const Vector &vec)
|
Vector RenderObject::getInvRotPosition(const Vector &vec) const
|
||||||
{
|
{
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
std::vector<RenderObject*>chain;
|
std::vector<const RenderObject*>chain;
|
||||||
RenderObject *p = this;
|
const RenderObject *p = this;
|
||||||
while(p)
|
while(p)
|
||||||
{
|
{
|
||||||
chain.push_back(p);
|
chain.push_back(p);
|
||||||
|
@ -286,7 +286,7 @@ static void matrixChain(RenderObject *ro)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float RenderObject::getWorldRotation()
|
float RenderObject::getWorldRotation() const
|
||||||
{
|
{
|
||||||
Vector up = getWorldCollidePosition(Vector(0,1));
|
Vector up = getWorldCollidePosition(Vector(0,1));
|
||||||
Vector orig = getWorldPosition();
|
Vector orig = getWorldPosition();
|
||||||
|
@ -295,7 +295,7 @@ float RenderObject::getWorldRotation()
|
||||||
return rot;
|
return rot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getWorldPositionAndRotation()
|
Vector RenderObject::getWorldPositionAndRotation() const
|
||||||
{
|
{
|
||||||
Vector up = getWorldCollidePosition(Vector(0,1));
|
Vector up = getWorldCollidePosition(Vector(0,1));
|
||||||
Vector orig = getWorldPosition();
|
Vector orig = getWorldPosition();
|
||||||
|
@ -303,7 +303,7 @@ Vector RenderObject::getWorldPositionAndRotation()
|
||||||
return orig;
|
return orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getWorldCollidePosition(const Vector &vec)
|
Vector RenderObject::getWorldCollidePosition(const Vector &vec) const
|
||||||
{
|
{
|
||||||
#ifdef BBGE_USE_GLM
|
#ifdef BBGE_USE_GLM
|
||||||
glm::mat4 transformMatrix = glm::translate(
|
glm::mat4 transformMatrix = glm::translate(
|
||||||
|
@ -386,7 +386,7 @@ void RenderObject::destroy()
|
||||||
texture = NULL;
|
texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getRealPosition()
|
Vector RenderObject::getRealPosition() const
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ Vector RenderObject::getRealPosition()
|
||||||
return position + offset;
|
return position + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getRealScale()
|
Vector RenderObject::getRealScale() const
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
@ -466,9 +466,9 @@ void RenderObject::disableMotionBlur()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::isfhr()
|
bool RenderObject::isfhr() const
|
||||||
{
|
{
|
||||||
RenderObject *p = this;
|
const RenderObject *p = this;
|
||||||
bool fh = false;
|
bool fh = false;
|
||||||
do
|
do
|
||||||
if (p->isfh())
|
if (p->isfh())
|
||||||
|
@ -478,9 +478,9 @@ bool RenderObject::isfhr()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::isfvr()
|
bool RenderObject::isfvr() const
|
||||||
{
|
{
|
||||||
RenderObject *p = this;
|
const RenderObject *p = this;
|
||||||
bool fv = false;
|
bool fv = false;
|
||||||
do
|
do
|
||||||
if (p->isfv())
|
if (p->isfv())
|
||||||
|
@ -490,11 +490,11 @@ bool RenderObject::isfvr()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::hasRenderPass(const int pass)
|
bool RenderObject::hasRenderPass(const int pass) const
|
||||||
{
|
{
|
||||||
if (pass == renderPass)
|
if (pass == renderPass)
|
||||||
return true;
|
return true;
|
||||||
for (Children::iterator i = children.begin(); i != children.end(); i++)
|
for (Children::const_iterator i = children.begin(); i != children.end(); i++)
|
||||||
{
|
{
|
||||||
if (!(*i)->isDead() && (*i)->hasRenderPass(pass))
|
if (!(*i)->isDead() && (*i)->hasRenderPass(pass))
|
||||||
return true;
|
return true;
|
||||||
|
@ -502,7 +502,7 @@ bool RenderObject::hasRenderPass(const int pass)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::render()
|
void RenderObject::render() const
|
||||||
{
|
{
|
||||||
if (isHidden()) return;
|
if (isHidden()) return;
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ void RenderObject::render()
|
||||||
renderCall();
|
renderCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::renderCall()
|
void RenderObject::renderCall() const
|
||||||
{
|
{
|
||||||
position += offset;
|
position += offset;
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ void RenderObject::renderCall()
|
||||||
glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z);
|
glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z);
|
||||||
|
|
||||||
|
|
||||||
for (Children::iterator i = children.begin(); i != children.end(); i++)
|
for (Children::const_iterator i = children.begin(); i != children.end(); i++)
|
||||||
{
|
{
|
||||||
if (!(*i)->isDead() && (*i)->renderBeforeParent)
|
if (!(*i)->isDead() && (*i)->renderBeforeParent)
|
||||||
(*i)->render();
|
(*i)->render();
|
||||||
|
@ -704,7 +704,7 @@ void RenderObject::renderCall()
|
||||||
onRender();
|
onRender();
|
||||||
|
|
||||||
|
|
||||||
for (Children::iterator i = children.begin(); i != children.end(); i++)
|
for (Children::const_iterator i = children.begin(); i != children.end(); i++)
|
||||||
{
|
{
|
||||||
if (!(*i)->isDead() && !(*i)->renderBeforeParent)
|
if (!(*i)->isDead() && !(*i)->renderBeforeParent)
|
||||||
(*i)->render();
|
(*i)->render();
|
||||||
|
@ -717,7 +717,7 @@ void RenderObject::renderCall()
|
||||||
position -= offset;
|
position -= offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObject::renderCollision()
|
void RenderObject::renderCollision() const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,14 +852,14 @@ void RenderObject::safeKill()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getNormal()
|
Vector RenderObject::getNormal() const
|
||||||
{
|
{
|
||||||
float a = MathFunctions::toRadians(getAbsoluteRotation().z);
|
float a = MathFunctions::toRadians(getAbsoluteRotation().z);
|
||||||
return Vector(sinf(a),cosf(a));
|
return Vector(sinf(a),cosf(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: this is probably a slow implementation
|
// HACK: this is probably a slow implementation
|
||||||
Vector RenderObject::getForward()
|
Vector RenderObject::getForward() const
|
||||||
{
|
{
|
||||||
Vector v = getWorldCollidePosition(Vector(0,-1, 0));
|
Vector v = getWorldCollidePosition(Vector(0,-1, 0));
|
||||||
Vector r = v - getWorldCollidePosition();
|
Vector r = v - getWorldCollidePosition();
|
||||||
|
@ -869,7 +869,7 @@ Vector RenderObject::getForward()
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector RenderObject::getAbsoluteRotation()
|
Vector RenderObject::getAbsoluteRotation() const
|
||||||
{
|
{
|
||||||
Vector r = rotation;
|
Vector r = rotation;
|
||||||
if (parent)
|
if (parent)
|
||||||
|
@ -1058,7 +1058,7 @@ void RenderObject::addChild(RenderObject *r, ParentManaged pm, RenderBeforeParen
|
||||||
r->parent = this;
|
r->parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StateData *RenderObject::getStateData()
|
StateData *RenderObject::getStateData() const
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
|
@ -1073,7 +1073,7 @@ void RenderObject::setOverrideCullRadius(float ovr)
|
||||||
overrideCullRadiusSqr = ovr * ovr;
|
overrideCullRadiusSqr = ovr * ovr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderObject::isCoordinateInRadius(const Vector &pos, float r)
|
bool RenderObject::isCoordinateInRadius(const Vector &pos, float r) const
|
||||||
{
|
{
|
||||||
Vector d = pos-getRealPosition();
|
Vector d = pos-getRealPosition();
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,18 @@ struct MotionBlurData
|
||||||
|
|
||||||
class RenderObjectLayer;
|
class RenderObjectLayer;
|
||||||
|
|
||||||
|
// FIXME: -- fg
|
||||||
|
// I've scattered a few mutables across this class
|
||||||
|
// These should be part of some struct that gets passed along the render() calls
|
||||||
|
// instead of updating the actual class members
|
||||||
|
|
||||||
class RenderObject : public ScriptObject
|
class RenderObject : public ScriptObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class Core;
|
friend class Core;
|
||||||
RenderObject();
|
RenderObject();
|
||||||
virtual ~RenderObject();
|
virtual ~RenderObject();
|
||||||
virtual void render();
|
virtual void render() const;
|
||||||
|
|
||||||
void setTexturePointer(CountedPtr<Texture> t)
|
void setTexturePointer(CountedPtr<Texture> t)
|
||||||
{
|
{
|
||||||
|
@ -137,8 +142,8 @@ public:
|
||||||
bool isfv() const { return _fv; }
|
bool isfv() const { return _fv; }
|
||||||
|
|
||||||
// recursive
|
// recursive
|
||||||
bool isfhr();
|
bool isfhr() const;
|
||||||
bool isfvr();
|
bool isfvr() const;
|
||||||
|
|
||||||
size_t getIdx() const { return idx; }
|
size_t getIdx() const { return idx; }
|
||||||
void setIdx(size_t newidx) { this->idx = newidx; }
|
void setIdx(size_t newidx) { this->idx = newidx; }
|
||||||
|
@ -156,10 +161,10 @@ public:
|
||||||
return w*w + h*h;
|
return w*w + h*h;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTopLayer();
|
int getTopLayer() const;
|
||||||
|
|
||||||
void setColorMult(const Vector &color, const float alpha);
|
void setColorMult(const Vector &color, const float alpha) const; // HACK: const
|
||||||
void clearColorMult();
|
void clearColorMult() const; // HACK: const
|
||||||
|
|
||||||
void enableMotionBlur(int sz=10, int off=5);
|
void enableMotionBlur(int sz=10, int off=5);
|
||||||
void disableMotionBlur();
|
void disableMotionBlur();
|
||||||
|
@ -167,42 +172,40 @@ public:
|
||||||
void addChild(RenderObject *r, ParentManaged pm, RenderBeforeParent rbp = RBP_NONE, ChildOrder order = CHILD_BACK);
|
void addChild(RenderObject *r, ParentManaged pm, RenderBeforeParent rbp = RBP_NONE, ChildOrder order = CHILD_BACK);
|
||||||
void removeChild(RenderObject *r);
|
void removeChild(RenderObject *r);
|
||||||
|
|
||||||
Vector getRealPosition();
|
Vector getRealPosition() const;
|
||||||
Vector getRealScale();
|
Vector getRealScale() const;
|
||||||
|
|
||||||
StateData *getStateData();
|
StateData *getStateData() const;
|
||||||
|
|
||||||
// HACK: This is defined in RenderObject_inline.h because it needs
|
// HACK: This is defined in RenderObject_inline.h because it needs
|
||||||
// the class Core definition. --achurch
|
// the class Core definition. --achurch
|
||||||
inline bool isOnScreen();
|
inline bool isOnScreen() const;
|
||||||
|
|
||||||
bool isCoordinateInRadius(const Vector &pos, float r);
|
bool isCoordinateInRadius(const Vector &pos, float r) const;
|
||||||
|
|
||||||
const RenderObject &operator=(const RenderObject &r);
|
|
||||||
|
|
||||||
void toggleCull(bool value);
|
void toggleCull(bool value);
|
||||||
|
|
||||||
void safeKill();
|
void safeKill();
|
||||||
|
|
||||||
Vector getWorldPosition();
|
Vector getWorldPosition() const;
|
||||||
Vector getWorldCollidePosition(const Vector &vec=Vector(0,0,0));
|
Vector getWorldCollidePosition(const Vector &vec=Vector(0,0,0)) const;
|
||||||
Vector getInvRotPosition(const Vector &vec);
|
Vector getInvRotPosition(const Vector &vec) const;
|
||||||
bool isPieceFlippedHorizontal();
|
bool isPieceFlippedHorizontal() const;
|
||||||
|
|
||||||
RenderObject *getTopParent();
|
RenderObject *getTopParent() const;
|
||||||
|
|
||||||
virtual void onAnimationKeyPassed(int key){}
|
virtual void onAnimationKeyPassed(int key){}
|
||||||
|
|
||||||
Vector getAbsoluteRotation();
|
Vector getAbsoluteRotation() const;
|
||||||
float getWorldRotation();
|
float getWorldRotation() const;
|
||||||
Vector getWorldPositionAndRotation(); // more efficient shortcut, returns rotation in vector z component
|
Vector getWorldPositionAndRotation() const; // more efficient shortcut, returns rotation in vector z component
|
||||||
Vector getNormal();
|
Vector getNormal() const;
|
||||||
Vector getForward();
|
Vector getForward() const;
|
||||||
void setOverrideCullRadius(float ovr);
|
void setOverrideCullRadius(float ovr);
|
||||||
void setRenderPass(int pass) { renderPass = pass; }
|
void setRenderPass(int pass) { renderPass = pass; }
|
||||||
int getRenderPass() { return renderPass; }
|
int getRenderPass() const { return renderPass; }
|
||||||
void setOverrideRenderPass(int pass) { overrideRenderPass = pass; }
|
void setOverrideRenderPass(int pass) { overrideRenderPass = pass; }
|
||||||
int getOverrideRenderPass() { return overrideRenderPass; }
|
int getOverrideRenderPass() const { return overrideRenderPass; }
|
||||||
enum { RENDER_ALL=314, OVERRIDE_NONE=315 };
|
enum { RENDER_ALL=314, OVERRIDE_NONE=315 };
|
||||||
|
|
||||||
// Defined in RenderObject_inline.h
|
// Defined in RenderObject_inline.h
|
||||||
|
@ -210,7 +213,7 @@ public:
|
||||||
|
|
||||||
void lookAt(const Vector &pos, float t, float minAngle, float maxAngle, float offset=0);
|
void lookAt(const Vector &pos, float t, float minAngle, float maxAngle, float offset=0);
|
||||||
inline RenderObject *getParent() const {return parent;}
|
inline RenderObject *getParent() const {return parent;}
|
||||||
void applyBlendType();
|
void applyBlendType() const;
|
||||||
void fhTo(bool fh);
|
void fhTo(bool fh);
|
||||||
void addDeathNotify(RenderObject *r);
|
void addDeathNotify(RenderObject *r);
|
||||||
virtual void unloadDevice();
|
virtual void unloadDevice();
|
||||||
|
@ -251,14 +254,16 @@ public:
|
||||||
char _blendType;
|
char _blendType;
|
||||||
|
|
||||||
|
|
||||||
InterpolatedVector position, scale, color, alpha, rotation;
|
mutable InterpolatedVector position, scale;
|
||||||
|
mutable InterpolatedVector color, alpha; // HACK: mutable should go! this is for setColorMult()
|
||||||
|
mutable InterpolatedVector rotation;
|
||||||
InterpolatedVector offset, rotationOffset, internalOffset, beforeScaleOffset;
|
InterpolatedVector offset, rotationOffset, internalOffset, beforeScaleOffset;
|
||||||
InterpolatedVector velocity, gravity;
|
InterpolatedVector velocity, gravity;
|
||||||
|
|
||||||
CountedPtr<Texture> texture;
|
CountedPtr<Texture> texture;
|
||||||
|
|
||||||
float life;
|
float life;
|
||||||
float followCamera;
|
mutable float followCamera;
|
||||||
float alphaMod;
|
float alphaMod;
|
||||||
float updateCull;
|
float updateCull;
|
||||||
int layer;
|
int layer;
|
||||||
|
@ -272,9 +277,9 @@ public:
|
||||||
float overrideCullRadiusSqr;
|
float overrideCullRadiusSqr;
|
||||||
|
|
||||||
// --- This is hack and should not exist ---
|
// --- This is hack and should not exist ---
|
||||||
bool colorIsSaved; // Used for both color and alpha
|
mutable bool colorIsSaved; // Used for both color and alpha
|
||||||
Vector savedColor; // Saved values from setColorMult()
|
mutable Vector savedColor; // Saved values from setColorMult()
|
||||||
float savedAlpha;
|
mutable float savedAlpha;
|
||||||
|
|
||||||
|
|
||||||
float width, height; // Only used by Quads, but stored here for getCullRadius()
|
float width, height; // Only used by Quads, but stored here for getCullRadius()
|
||||||
|
@ -290,7 +295,7 @@ protected:
|
||||||
virtual void onFH(){}
|
virtual void onFH(){}
|
||||||
virtual void onFV(){}
|
virtual void onFV(){}
|
||||||
virtual void onSetTexture(){}
|
virtual void onSetTexture(){}
|
||||||
virtual void onRender(){}
|
virtual void onRender() const {}
|
||||||
virtual void onUpdate(float dt);
|
virtual void onUpdate(float dt);
|
||||||
virtual void deathNotify(RenderObject *r);
|
virtual void deathNotify(RenderObject *r);
|
||||||
virtual void onEndOfLife() {}
|
virtual void onEndOfLife() {}
|
||||||
|
@ -298,10 +303,10 @@ protected:
|
||||||
void updateLife(float dt);
|
void updateLife(float dt);
|
||||||
|
|
||||||
// Is this object or any of its children rendered in pass "pass"?
|
// Is this object or any of its children rendered in pass "pass"?
|
||||||
bool hasRenderPass(const int pass);
|
bool hasRenderPass(const int pass) const;
|
||||||
|
|
||||||
inline void renderCall();
|
inline void renderCall() const;
|
||||||
virtual void renderCollision();
|
virtual void renderCollision() const;
|
||||||
|
|
||||||
typedef std::list<RenderObject*> RenderObjectList;
|
typedef std::list<RenderObject*> RenderObjectList;
|
||||||
RenderObjectList deathNotifications;
|
RenderObjectList deathNotifications;
|
||||||
|
@ -309,6 +314,9 @@ protected:
|
||||||
size_t idx; // index in layer
|
size_t idx; // index in layer
|
||||||
StateData *stateData;
|
StateData *stateData;
|
||||||
MotionBlurData *motionBlur;
|
MotionBlurData *motionBlur;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const RenderObject &operator=(const RenderObject &r); // undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,6 @@ RenderObjectLayer::RenderObjectLayer()
|
||||||
visible = true;
|
visible = true;
|
||||||
startPass = endPass = 0;
|
startPass = endPass = 0;
|
||||||
followCameraLock = FCL_NONE;
|
followCameraLock = FCL_NONE;
|
||||||
cull = true;
|
|
||||||
update = true;
|
update = true;
|
||||||
|
|
||||||
color = Vector(1,1,1);
|
color = Vector(1,1,1);
|
||||||
|
@ -46,11 +45,6 @@ RenderObjectLayer::~RenderObjectLayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderObjectLayer::setCull(bool cull)
|
|
||||||
{
|
|
||||||
this->cull = cull;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderObjectLayer::add(RenderObject* r)
|
void RenderObjectLayer::add(RenderObject* r)
|
||||||
{
|
{
|
||||||
size_t size = renderObjects.size();
|
size_t size = renderObjects.size();
|
||||||
|
@ -234,13 +228,13 @@ void RenderObjectLayer::reloadDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void RenderObjectLayer::renderOneObject(RenderObject *robj)
|
inline void RenderObjectLayer::renderOneObject(const RenderObject *robj)
|
||||||
{
|
{
|
||||||
core->totalRenderObjectCount++;
|
core->totalRenderObjectCount++;
|
||||||
if (robj->getParent() || robj->alpha.x == 0)
|
if (robj->getParent() || robj->alpha.x == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!this->cull || !robj->cull || robj->isOnScreen())
|
if (!robj->cull || robj->isOnScreen())
|
||||||
{
|
{
|
||||||
robj->render();
|
robj->render();
|
||||||
core->renderObjectCount++;
|
core->renderObjectCount++;
|
||||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifndef RENDEROBJECT_INLINE_H
|
#ifndef RENDEROBJECT_INLINE_H
|
||||||
#define RENDEROBJECT_INLINE_H
|
#define RENDEROBJECT_INLINE_H
|
||||||
|
|
||||||
inline bool RenderObject::isOnScreen()
|
inline bool RenderObject::isOnScreen() const
|
||||||
{
|
{
|
||||||
if (followCamera == 1) return true;
|
if (followCamera == 1) return true;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void OutlineRect::setLineSize(int ls)
|
||||||
lineSize = ls;
|
lineSize = ls;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutlineRect::onRender()
|
void OutlineRect::onRender() const
|
||||||
{
|
{
|
||||||
glLineWidth(lineSize);
|
glLineWidth(lineSize);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
|
|
|
@ -101,7 +101,7 @@ void RoundedRect::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoundedRect::onRender()
|
void RoundedRect::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
int w2 = width/2;
|
int w2 = width/2;
|
||||||
|
@ -257,7 +257,7 @@ void RoundButton::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoundButton::onRender()
|
void RoundButton::onRender() const
|
||||||
{
|
{
|
||||||
int w2 = width/2, h2 = height/2;
|
int w2 = width/2, h2 = height/2;
|
||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
|
|
||||||
bool canMove;
|
bool canMove;
|
||||||
static RoundedRect *moving;
|
static RoundedRect *moving;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
EventPtr event;
|
EventPtr event;
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
|
|
||||||
TTFText *label;
|
TTFText *label;
|
||||||
int width, height, radius;
|
int width, height, radius;
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool ScreenTransition::isGoing()
|
||||||
return alpha.isInterpolating();
|
return alpha.isInterpolating();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTransition::onRender()
|
void ScreenTransition::onRender() const
|
||||||
{
|
{
|
||||||
if (alpha.x == 0) return;
|
if (alpha.x == 0) return;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
||||||
void destroyTexture();
|
void destroyTexture();
|
||||||
int textureWidth, textureHeight;
|
int textureWidth, textureHeight;
|
||||||
int windowWidth, windowHeight;
|
int windowWidth, windowHeight;
|
||||||
void onRender();
|
void onRender() const OVERRIDE;
|
||||||
float width, height;
|
float width, height;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ void Bone::spawnParticlesFromCollisionMask(const char *p, unsigned intv, int lay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bone::renderCollision()
|
void Bone::renderCollision() const
|
||||||
{
|
{
|
||||||
if (!collisionMask.empty())
|
if (!collisionMask.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
void spawnParticlesFromCollisionMask(const char *p, unsigned intv, int layer, float rotz = 0);
|
void spawnParticlesFromCollisionMask(const char *p, unsigned intv, int layer, float rotz = 0);
|
||||||
Vector getCollisionMaskNormal(size_t index);
|
Vector getCollisionMaskNormal(size_t index);
|
||||||
|
|
||||||
virtual void renderCollision() OVERRIDE;
|
virtual void renderCollision() const OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<ParticleEffect*> emitters;
|
std::vector<ParticleEffect*> emitters;
|
||||||
|
|
|
@ -223,11 +223,6 @@ void TTFText::updateFormatting()
|
||||||
lineHeight = font->font->LineHeight();
|
lineHeight = font->font->LineHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTFText::onUpdate(float dt)
|
|
||||||
{
|
|
||||||
RenderObject::onUpdate(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
float TTFText::getLineHeight()
|
float TTFText::getLineHeight()
|
||||||
{
|
{
|
||||||
return lineHeight;
|
return lineHeight;
|
||||||
|
@ -245,7 +240,7 @@ int TTFText::findLine(const std::string &label)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTFText::onRender()
|
void TTFText::onRender() const
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,7 @@ protected:
|
||||||
float lineHeight;
|
float lineHeight;
|
||||||
void updateAlign();
|
void updateAlign();
|
||||||
Align align;
|
Align align;
|
||||||
void onUpdate(float dt);
|
void onRender() const OVERRIDE;
|
||||||
void onRender();
|
|
||||||
void updateFormatting();
|
void updateFormatting();
|
||||||
|
|
||||||
std::string originalText;
|
std::string originalText;
|
||||||
|
|
|
@ -284,7 +284,7 @@ bool Texture::load(std::string file, bool mipmap)
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::apply(bool repeatOverride)
|
void Texture::apply(bool repeatOverride) const
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
glBindTexture(GL_TEXTURE_2D, textures[0]);
|
||||||
if (repeat || repeatOverride)
|
if (repeat || repeatOverride)
|
||||||
|
@ -307,10 +307,6 @@ void Texture::apply(bool repeatOverride)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::unbind()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GlTexFormat
|
struct GlTexFormat
|
||||||
{
|
{
|
||||||
int internalformat, format, type;
|
int internalformat, format, type;
|
||||||
|
|
|
@ -40,8 +40,7 @@ public:
|
||||||
~Texture();
|
~Texture();
|
||||||
|
|
||||||
bool load(std::string file, bool mipmap);
|
bool load(std::string file, bool mipmap);
|
||||||
void apply(bool repeatOverride=false);
|
void apply(bool repeatOverride=false) const;
|
||||||
void unbind();
|
|
||||||
void unload();
|
void unload();
|
||||||
|
|
||||||
int getPixelWidth();
|
int getPixelWidth();
|
||||||
|
@ -51,7 +50,8 @@ public:
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
bool repeat, repeating;
|
bool repeat;
|
||||||
|
mutable bool repeating; // modified during rendering
|
||||||
|
|
||||||
unsigned textures[1];
|
unsigned textures[1];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue