1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

first step towards making the render process const

This commit is contained in:
fgenesis 2022-05-19 05:17:00 +02:00
parent 46010244f5
commit b6fb6944f6
67 changed files with 208 additions and 399 deletions

View file

@ -35,7 +35,7 @@ const int KEYFRAME_POS_Y = 570;
class TimelineRender : public RenderObject
{
void onRender()
void onRender() const OVERRIDE
{
glLineWidth(1);
glBegin(GL_LINES);

View file

@ -4447,7 +4447,7 @@ void Avatar::doShieldSong()
activateAura(AURA_SHIELD);
}
void Avatar::render()
void Avatar::render() const
{
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)
{
Entity::onEnterState(action);

View file

@ -211,7 +211,7 @@ public:
float biteDelay, urchinDelay, jellyDelay;
bool movingOn;
void render();
void render() const OVERRIDE;
void activateAura(AuraType aura);
void stopAura();
void setHeadTexture(const std::string &name, float t=0);
@ -434,7 +434,6 @@ protected:
void onUpdate(float dt);
void onRender();
Quad *glow;
bool swimming;

View file

@ -105,7 +105,7 @@ void Beam::trace()
}
void Beam::onRender()
void Beam::onRender() const
{
Vector diff = endPos - position;

View file

@ -27,7 +27,7 @@ public:
void setBeamWidth(float w);
protected:
float beamWidth;
void onRender();
void onRender() const OVERRIDE;
void onEndOfLife();
void onUpdate(float dt);
};

View file

@ -34,15 +34,7 @@ CurrentRender::CurrentRender() : RenderObject()
rippleDelay = 2;
}
void CurrentRender::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
}
void CurrentRender::onRender()
void CurrentRender::onRender() const
{
// note: Leave cull_face disabled!?
//glDisable(GL_CULL_FACE);

View file

@ -283,7 +283,7 @@ void Element::setElementEffectByIndex(int eidx)
}
}
void Element::render()
void Element::render() const
{
if (!elementActive) return;
if (dsq->game->isSceneEditorActive() && this->bgLayer == dsq->game->sceneEditor.bgLayer

View file

@ -66,7 +66,7 @@ public:
size_t templateIdx;
int bgLayer;
Element *bgLayerNext;
void render();
void render() const OVERRIDE;
ElementFlag elementFlag;
void fillGrid();
bool isElementActive() { return elementActive; }

View file

@ -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 bscale = scale;

View file

@ -73,7 +73,7 @@ public:
Vector vel;
InterpolatedVector vel2;
float activationRadius;
void render();
void render() const OVERRIDE;
void update(float dt);
void spawnParticlesFromCollisionMask(const char *p, unsigned intv=1, int layer = LR_PARTICLES, float rotz = 0);

View file

@ -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;
Vector camPos = core->cameraPos;
@ -145,7 +145,7 @@ void SongLineRender::clear()
pts.clear();
}
void SongLineRender::onRender()
void SongLineRender::onRender() const
{
int w=core->getWindowWidth();

View file

@ -39,7 +39,7 @@ public:
protected:
ObsType obsType;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
class MiniMapRender : public RenderObject
@ -67,8 +67,8 @@ protected:
bool doRender;
float lightLevel;
void onUpdate(float dt);
void onRender();
void renderIcon(MinimapIcon *ico, const Vector& pos);
void onRender() const OVERRIDE;
void renderIcon(const MinimapIcon *ico, const Vector& pos) const;
InterpolatedVector lerp;
@ -115,7 +115,6 @@ protected:
void clearVis(WorldMapTile *tile);
bool on;
void onUpdate(float dt);
void onRender();
Quad *bg;
unsigned char *savedTexData;
bool mb;
@ -128,7 +127,7 @@ class PathRender : public RenderObject
public:
PathRender();
protected:
void onRender();
void onRender() const OVERRIDE;
};
class CurrentRender : public RenderObject
@ -137,8 +136,7 @@ public:
CurrentRender();
protected:
float rippleDelay;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
class SteamRender : public RenderObject
@ -147,8 +145,7 @@ public:
SteamRender();
protected:
float rippleDelay;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
struct SongLinePoint
@ -164,7 +161,7 @@ public:
void newPoint(const Vector &pt, const Vector &color);
void clear();
protected:
void onRender();
void onRender() const OVERRIDE;
std::vector<SongLinePoint> pts;
};

View file

@ -73,7 +73,7 @@ HairNode *Hair::getHairNode(int idx)
return h;
}
void Hair::onRender()
void Hair::onRender() const
{

View file

@ -56,7 +56,7 @@ public:
protected:
float segmentLength;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
#endif

View file

@ -26,43 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#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()
{
@ -71,8 +35,6 @@ Intro::Intro() : StateObject()
void Intro::applyState()
{
quitFlag = false;
dsq->jiggleCursor();
dsq->cursor->alpha = 0;
//core->sound->streamOgg("sc/theme", 0);
@ -97,8 +59,6 @@ void Intro::removeState()
void Intro::endIntro()
{
quitFlag = true;
dsq->overlay->color.stop();
dsq->overlay->alpha.stop();

View file

@ -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());
}
void MiniMapRender::onRender()
void MiniMapRender::onRender() const
{
glBindTexture(GL_TEXTURE_2D, 0);
@ -499,9 +499,6 @@ void MiniMapRender::onRender()
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
glEnd();
texMinimapBtm->unbind();
if (lightLevel > 0)
{
texWaterBit->apply();
@ -587,10 +584,7 @@ void MiniMapRender::onRender()
}
}
}
texWaterBit->unbind();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, 0);
}
}
@ -642,9 +636,6 @@ void MiniMapRender::onRender()
glVertex2f(-hsz, -hsz);
glEnd();
texNaija->unbind();
glBindTexture(GL_TEXTURE_2D, 0);
glColor4f(1,1,1,1);
texMinimapTop->apply();
@ -658,10 +649,6 @@ void MiniMapRender::onRender()
glTexCoord2f(0, 0);
glVertex2f(-miniMapGuiSize, -miniMapGuiSize);
glEnd();
texMinimapTop->unbind();
glBindTexture(GL_TEXTURE_2D, 0);
const int curHealthSteps = int((lerp.x/2) * healthSteps);
const int maxHealthSteps = int((dsq->game->avatar->maxHealth/10.0f) * healthSteps);
@ -731,8 +718,6 @@ void MiniMapRender::onRender()
}
glEnd();
texHealthBar->unbind();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1,1,1,1);
@ -752,17 +737,12 @@ void MiniMapRender::onRender()
glVertex2f(x-healthMarkerSize, y-healthMarkerSize);
glEnd();
texMarker->unbind();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
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)
return;

View file

@ -30,7 +30,7 @@ PathRender::PathRender() : RenderObject()
alpha = 0.5f;
}
void PathRender::onRender()
void PathRender::onRender() const
{
const size_t pathcount = dsq->game->getNumPaths();
if (pathcount == 0)

View file

@ -441,10 +441,3 @@ void SchoolFish::onUpdate(float dt)
}
}
void SchoolFish::onRender()
{
FlockEntity::onRender();
}

View file

@ -45,7 +45,6 @@ protected:
void onEnterState(int action);
void onUpdate(float dt);
void onRender();
float avoidTime;

View file

@ -51,7 +51,7 @@ public:
void destroy();
protected:
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
#endif

View file

@ -34,12 +34,7 @@ SteamRender::SteamRender() : RenderObject()
setBlendType(BLEND_ADD);
}
void SteamRender::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
}
void SteamRender::onRender()
void SteamRender::onRender() const
{

View file

@ -49,7 +49,7 @@ void Strand::onUpdate(float dt)
updateSegments(position);
}
void Strand::onRender()
void Strand::onRender() const
{
const int numSegments = segments.size();
if (numSegments == 0) return;

View file

@ -129,7 +129,7 @@ void ToolTip::onUpdate(float dt)
}
}
void ToolTip::render()
void ToolTip::render() const
{
if (!game->getInGameMenu()->recipeMenu.on && toolTipsOn)
{

View file

@ -35,14 +35,14 @@ public:
void setAreaFromCenter(const Vector &center, int width, int height);
void setCircularAreaFromCenter(const Vector &center, int diameter);
void render();
void render() const OVERRIDE;
static bool toolTipsOn;
bool required;
protected:
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
int areaType;
Vector areaCenter;

View file

@ -46,10 +46,8 @@ WaterSurfaceRender::WaterSurfaceRender() : Quad()
shareAlphaWithChildren = 0;
}
void WaterSurfaceRender::render()
void WaterSurfaceRender::onUpdate(float dt)
{
if (dsq->game->waterLevel.x > 0)
{
@ -100,20 +98,9 @@ void WaterSurfaceRender::render()
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{
qSurface->alphaMod = 0.5;
Quad::render();
}
else
{
Quad::render();
}
Quad::render();
}
else
{
@ -124,25 +111,12 @@ void WaterSurfaceRender::render()
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())
{
const float reflectSize = 97;
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 coordDiv = 768;
const float v0 = 1 + reflectOffset - (reflectPos * core->globalScale.x) / coordDiv;
@ -153,25 +127,31 @@ void WaterSurfaceRender::onRender()
upperLeftTextureCoordinates.x = 0;
lowerRightTextureCoordinates.x = core->frameBuffer.getWidthP();
}
}
void WaterSurfaceRender::render() const
{
if (dsq->game->waterLevel.x > 0)
Quad::render();
}
Quad::onRender();
glBindTexture(GL_TEXTURE_2D, 0);
void WaterSurfaceRender::onRender() const
{
if (dsq->game->waterLevel == 0) return;
if (dsq->useFrameBuffer && dsq->frameBuffer.isInited())
{
dsq->frameBuffer.bindTexture();
}
else
{
glColor4f(0.4f, 0.7f, 0.8f, 0.2f);
Quad::onRender();
glBindTexture(GL_TEXTURE_2D, 0);
glColor4f(0.4f, 0.7f, 0.8f, 0.2f);
}
RenderObject::lastTextureApplied = 0;
Quad::onRender();
glBindTexture(GL_TEXTURE_2D, 0);
RenderObject::lastTextureApplied = 0;
}

View file

@ -27,10 +27,11 @@ class WaterSurfaceRender : public Quad
{
public:
WaterSurfaceRender();
void render();
void render() const OVERRIDE;
protected:
Quad *qSurface, *qLine, *qLine2;
void onRender();
void onRender() const OVERRIDE;
void onUpdate(float dt) OVERRIDE;
};
#endif

View file

@ -135,7 +135,7 @@ void Web::onUpdate(float dt)
}
}
void Web::onRender()
void Web::onRender() const
{
glBindTexture(GL_TEXTURE_2D, 0);

View file

@ -44,7 +44,7 @@ protected:
void onEndOfLife();
std::vector<Vector> points;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
};
#endif

View file

@ -110,16 +110,12 @@ public:
followCamera = 1;
}
void render()
{
setProperPosition();
Quad::render();
}
protected:
Vector truePosition;
void setProperPosition()
void onUpdate(float dt) OVERRIDE
{
Quad::onUpdate(dt);
Vector wp = parent->getWorldCollidePosition(truePosition);
Vector diff = wp - core->center;
@ -177,12 +173,6 @@ public:
float spawnBitTimer;
void render()
{
Quad::render();
}
protected:
BeaconData *beaconData;
@ -1241,11 +1231,6 @@ Vector WorldMapRender::getWorldToTile(WorldMapTile *tile, Vector position, bool
return p;
}
void WorldMapRender::onRender()
{
RenderObject::onRender();
}
bool WorldMapRender::isOn()
{
return this->on;

View file

@ -168,7 +168,7 @@ void AfterEffectManager::destroyEffect(int id)
openSpots.push_back(id);
}
void AfterEffectManager::render()
void AfterEffectManager::render() const
{
assert(core->frameBuffer.isInited());
@ -187,7 +187,7 @@ void AfterEffectManager::render()
glPopMatrix();
}
void AfterEffectManager::renderGrid()
void AfterEffectManager::renderGrid() const
{
int firstShader = -1;
@ -206,9 +206,6 @@ void AfterEffectManager::renderGrid()
}
}
screenWidth = core->getWindowWidth();
screenHeight = core->getWindowHeight();
float percentX, percentY;
percentX = (float)screenWidth/(float)textureWidth;
percentY = (float)screenHeight/(float)textureHeight;
@ -263,8 +260,8 @@ void AfterEffectManager::renderGrid()
{
// From here on: secondary shader passes.
// We just outputted to the backup buffer...
FrameBuffer *fbIn = &core->frameBuffer;
FrameBuffer *fbOut = &backupBuffer;
const FrameBuffer *fbIn = &core->frameBuffer;
const FrameBuffer *fbOut = &backupBuffer;
for(int i = firstShader + 1; i <= lastShader; ++i)
@ -345,7 +342,7 @@ void AfterEffectManager::renderGrid()
// renderGridPoints();
}
void AfterEffectManager::renderGridPoints()
void AfterEffectManager::renderGridPoints() const
{
glColor4f(0.0f,0.0f,0.0f,1.0f);
for (int i = 0; i < (xDivs); i++)

View file

@ -88,9 +88,9 @@ public:
void resetGrid();
void render();
void renderGrid();
void renderGridPoints();
void render() const;
void renderGrid() const;
void renderGridPoints() const;
void loadShaders();
void unloadShaders(); // unloads shaders but keeps code and data intact, so that they can be reloaded.

View file

@ -67,6 +67,7 @@ namespace internal
#pragma warning(disable:4505) // unreferenced local function has been removed
#pragma warning(disable:4702) // unreachable code
#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:4389) // signed/unsigned mismatch

View file

@ -70,12 +70,9 @@ void BmpFont::load(const std::string &file, float scale, bool loadTexture)
loaded = true;
}
Texture *fontTextureTest = 0;
BitmapText::BitmapText(BmpFont *bmpFont)
{
this->bmpFont = bmpFont;
bfePass =0;
bfe = BFE_NONE;
currentScrollLine = currentScrollChar = 0;
scrollDelay = 0;
@ -186,11 +183,6 @@ void BitmapText::formatText()
colorIndices.clear();
}
void BitmapText::setBitmapFontEffect(BitmapFontEffect bfe)
{
this->bfe = bfe;
}
void BitmapText::updateWordColoring()
{
colorIndices.resize(lines.size());
@ -231,7 +223,6 @@ void BitmapText::setFontSize(float sz)
void BitmapText::onUpdate(float dt)
{
bfePass = 0;
RenderObject::onUpdate(dt);
if (scrollDelay > 0 && scrolling)
{
@ -275,7 +266,7 @@ Vector BitmapText::getColorIndex(size_t i, size_t j)
return c;
}
void BitmapText::onRender()
void BitmapText::onRender() const
{
if (!bmpFont) return;
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();
if (fontTextureTest) fontTextureTest->apply();
if (bmpFont->overrideTexture) bmpFont->overrideTexture->apply();
float y=0;
@ -350,25 +339,6 @@ void BitmapText::reloadDevice()
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()
{
scrolling = false;

View file

@ -27,13 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
namespace glfont { class GLFont; }
enum BitmapFontEffect
{
BFE_NONE = 0,
BFE_SHADOWBLUR = 1,
BFE_MAX
};
struct BmpFont
{
BmpFont();
@ -69,8 +62,6 @@ public:
Vector getColorIndex(size_t i, size_t j);
void updateWordColoring();
void autoKern();
void setBitmapFontEffect(BitmapFontEffect bfe);
void render();
virtual float getHeight();
void unloadDevice();
void reloadDevice();
@ -82,8 +73,6 @@ public:
protected:
float scrollSpeed;
BmpFont *bmpFont;
int bfePass;
BitmapFontEffect bfe;
void onUpdate(float dt);
float scrollDelay;
bool scrolling;
@ -93,7 +82,7 @@ protected:
float alignWidth;
void formatText();
float fontDrawSize;
void onRender();
void onRender() const OVERRIDE;
typedef std::vector<std::string> Lines;
Lines lines;
typedef std::vector<Vector> ColorIndices;

View file

@ -119,7 +119,6 @@ public:
void remove(RenderObject* r);
void moveToFront(RenderObject *r);
void moveToBack(RenderObject *r);
void setCull(bool cull);
void renderPass(int pass);
void reloadDevice();
@ -162,13 +161,13 @@ public:
float followCamera;
int followCameraLock;
bool cull;
bool update;
Vector color;
protected:
inline void renderOneObject(RenderObject *robj);
inline void renderOneObject(const RenderObject *robj);
RenderObjects renderObjects;
size_t objectCount;
@ -211,8 +210,6 @@ public:
bool isShuttingDown();
bool isWindowFocus();
void instantQuit();
void cacheRender();
void reloadResources();
@ -263,12 +260,12 @@ public:
void clearGarbage();
bool isNested() { return nestedMains > 1; }
int getNestedMains() { return nestedMains; }
bool isNested() const { return nestedMains > 1; }
int getNestedMains() const { return nestedMains; }
void quitNestedMain();
int getWindowWidth() { return width; }
int getWindowHeight() { return height; }
int getWindowWidth() const { return width; }
int getWindowHeight() const { return height; }
unsigned getTicks();

View file

@ -131,7 +131,7 @@ void DarkLayer::preRender()
}
}
void DarkLayer::render()
void DarkLayer::render() const
{
if (renderLayer != -1)
{

View file

@ -32,7 +32,7 @@ public:
void toggle(bool on);
void setLayers(int layer, int renderLayer);
void preRender();
void render();
void render() const;
int getLayer();
int getRenderLayer();
bool isUsed();

View file

@ -130,7 +130,7 @@ void DebugFont::setText(const std::string &text)
formatText();
}
void DebugFont::onRender()
void DebugFont::onRender() const
{
const float vspc = 1.5;

View file

@ -40,7 +40,7 @@ public:
protected:
float fontDrawSize, textWidth;
void formatText();
void onRender();
void onRender() const OVERRIDE;
std::string text;
std::vector<std::string> lines;
Align align;

View file

@ -69,7 +69,7 @@ void PostProcessingFX::disable(FXTypes type)
enabled[int(type)] = false;
}
void PostProcessingFX::render()
void PostProcessingFX::render() const
{
if(!core->frameBuffer.isInited())
return;

View file

@ -37,7 +37,7 @@ public:
void init();
void update(float dt);
void preRender();
void render();
void render() const;
void toggle(FXTypes type);
void enable(FXTypes type);
void disable(FXTypes type);

View file

@ -222,12 +222,7 @@ void Emitter::removeParticle(Particle *p)
}
void Emitter::render()
{
Quad::render();
}
void Emitter::onRender()
void Emitter::onRender() const
{
if (particles.empty()) return;
@ -250,7 +245,7 @@ void Emitter::onRender()
{
Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 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;
if (p->active)
@ -319,7 +314,7 @@ void Emitter::onRender()
else
{
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;
if (p->active)

View file

@ -204,20 +204,20 @@ void FrameBuffer::reloadDevice()
init(_w, _h, _fitToScreen);
}
void FrameBuffer::startCapture()
void FrameBuffer::startCapture() const
{
assert(inited);
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
void FrameBuffer::endCapture()
void FrameBuffer::endCapture() const
{
assert(inited);
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
}
void FrameBuffer::bindTexture()
void FrameBuffer::bindTexture() const
{
assert(inited);
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );

View file

@ -31,9 +31,9 @@ public:
~FrameBuffer();
bool init(int width, int height, bool fitToScreen=false);
bool isInited() { return inited; }
void startCapture();
void endCapture();
void bindTexture();
void startCapture() const;
void endCapture() const;
void bindTexture() const;
int getWidth() { return w; }
int getHeight() { return h; }
float getWidthP();

View file

@ -58,7 +58,7 @@ void Gradient::makeHorizontal(Vector c1, Vector c2)
ulc3 = c1;
}
void Gradient::onRender()
void Gradient::onRender() const
{

View file

@ -35,7 +35,7 @@ public:
int autoWidth, autoHeight;
protected:
void onRender();
void onRender() const OVERRIDE;
Vector ulc0, ulc1, ulc2, ulc3;
};

View file

@ -439,9 +439,3 @@ void ParticleEffect::stop()
(*i)->stop();
}
}
void ParticleEffect::onRender()
{
RenderObject::onRender();
}

View file

@ -125,8 +125,6 @@ public:
SpawnParticleData data;
void render();
void start();
void stop();
@ -138,7 +136,7 @@ public:
bool hasRot;
protected:
Vector currentSpawn, lastSpawn;
void onRender();
void onRender() const OVERRIDE;
void spawnParticle(float perc=1);
void onUpdate(float dt);
@ -170,7 +168,6 @@ protected:
bool waitForParticles;
void onUpdate(float dt);
void onRender();
float effectLife, effectLifeCounter;
bool running;

View file

@ -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())));
}
@ -228,7 +228,7 @@ void Quad::destroy()
RenderObject::destroy();
}
bool Quad::isCoordinateInside(Vector coord, int minSize)
bool Quad::isCoordinateInside(Vector coord, int minSize) const
{
Vector realscale = getRealScale();
int hw = fabsf((width)*realscale.x)*0.5f;
@ -250,7 +250,7 @@ bool Quad::isCoordinateInside(Vector coord, int minSize)
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 hh = fabsf((height)*getRealScale().y)*0.5f;
@ -270,7 +270,7 @@ bool Quad::isCoordinateInsideWorld(const Vector &coord, int minSize)
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 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)
return;
@ -422,7 +422,7 @@ void Quad::repeatTextureToFill(bool on)
}
void Quad::onRender()
void Quad::onRender() const
{
if (!renderQuad) return;
@ -657,7 +657,7 @@ CollideQuad::~CollideQuad()
{
}
void CollideQuad::renderCollision()
void CollideQuad::renderCollision() const
{
if (collideRadius > 0)
{

View file

@ -36,7 +36,7 @@ protected:
int w, h, w2, h2;
int lineSize;
void onRender();
void onRender() const OVERRIDE;
};
class Quad : public RenderObject
@ -46,9 +46,9 @@ public:
Quad();
void createGrid(int x, int y);
void destroy();
bool isCoordinateInside(Vector coord, int minSize=0);
bool isCoordinateInsideWorld(const Vector &coord, int minSize=0);
bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h);
bool isCoordinateInside(Vector coord, int minSize=0) const;
bool isCoordinateInsideWorld(const Vector &coord, int minSize=0) const;
bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h) const;
void flipVertical();
void flipHorizontal();
@ -65,7 +65,7 @@ public:
bool isRepeatingTextureToFill() const { return repeatingTextureToFill; }
void setGridPoints(bool vert, const std::vector<Vector> &points);
virtual void createStrip(bool stripVert, int num);
float getStripSegmentSize();
float getStripSegmentSize() const;
void resetStrip();
Vector ** getDrawGrid() { return drawGrid; }
@ -87,7 +87,8 @@ public:
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;
std::vector<Vector>strip;
Vector texOff;
@ -103,7 +104,7 @@ protected:
void resetGrid();
void updateGrid(float dt);
void renderGrid();
void renderGrid() const;
float drawGridOffsetX;
@ -116,7 +117,7 @@ protected:
static Vector renderBorderColor;
void onSetTexture();
void onRender();
void onRender() const OVERRIDE;
void onUpdate(float dt);
private:
bool doUpdateGrid;
@ -142,7 +143,7 @@ class CollideQuad : public Quad
public:
CollideQuad();
virtual ~CollideQuad();
virtual void renderCollision() OVERRIDE;
virtual void renderCollision() const OVERRIDE;
float collideRadius;
};

View file

@ -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);
@ -88,8 +88,8 @@ void QuadGrid::onRender()
const size_t H = quadsY();
for(size_t y = 0; y < H; ++y)
{
Point * const row0 = &_points[y * NX];
Point * const row1 = row0 + NX;
const Point * const row0 = &_points[y * NX];
const Point * const row1 = row0 + NX;
for(size_t x = 0; x < W; ++x)
{
glBegin(GL_QUADS);

View file

@ -42,7 +42,7 @@ public:
return _points[y * _w + x];
}
virtual void onRender();
virtual void onRender() const OVERRIDE;
virtual void onUpdate(float dt);
virtual void onSetTexture();

View file

@ -46,7 +46,7 @@ void RenderObject::toggleAlpha(float t)
alpha.interpolateTo(0,t);
}
int RenderObject::getTopLayer()
int RenderObject::getTopLayer() const
{
if (parent)
{
@ -67,7 +67,7 @@ static const BlendParams s_blendParams[] =
{ GL_ZERO, GL_SRC_COLOR },
};
void RenderObject::applyBlendType()
void RenderObject::applyBlendType() const
{
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)
{
@ -98,13 +98,13 @@ void RenderObject::setColorMult(const Vector &color, const float alpha)
this->savedAlpha = this->alpha.x;
this->color *= color;
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);
}
}
void RenderObject::clearColorMult()
void RenderObject::clearColorMult() const
{
if (!colorIsSaved)
{
@ -116,7 +116,7 @@ void RenderObject::clearColorMult()
this->color.z = this->savedColor.z;
this->alpha.x = this->savedAlpha;
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();
}
@ -177,12 +177,12 @@ RenderObject::~RenderObject()
freeMotionBlur();
}
Vector RenderObject::getWorldPosition()
Vector RenderObject::getWorldPosition() const
{
return getWorldCollidePosition();
}
RenderObject* RenderObject::getTopParent()
RenderObject* RenderObject::getTopParent() const
{
RenderObject *p = parent;
RenderObject *lastp=0;
@ -194,7 +194,7 @@ RenderObject* RenderObject::getTopParent()
return lastp;
}
bool RenderObject::isPieceFlippedHorizontal()
bool RenderObject::isPieceFlippedHorizontal() const
{
RenderObject *p = getTopParent();
if (p)
@ -203,13 +203,13 @@ bool RenderObject::isPieceFlippedHorizontal()
}
Vector RenderObject::getInvRotPosition(const Vector &vec)
Vector RenderObject::getInvRotPosition(const Vector &vec) const
{
glPushMatrix();
glLoadIdentity();
std::vector<RenderObject*>chain;
RenderObject *p = this;
std::vector<const RenderObject*>chain;
const RenderObject *p = this;
while(p)
{
chain.push_back(p);
@ -286,7 +286,7 @@ static void matrixChain(RenderObject *ro)
}
#endif
float RenderObject::getWorldRotation()
float RenderObject::getWorldRotation() const
{
Vector up = getWorldCollidePosition(Vector(0,1));
Vector orig = getWorldPosition();
@ -295,7 +295,7 @@ float RenderObject::getWorldRotation()
return rot;
}
Vector RenderObject::getWorldPositionAndRotation()
Vector RenderObject::getWorldPositionAndRotation() const
{
Vector up = getWorldCollidePosition(Vector(0,1));
Vector orig = getWorldPosition();
@ -303,7 +303,7 @@ Vector RenderObject::getWorldPositionAndRotation()
return orig;
}
Vector RenderObject::getWorldCollidePosition(const Vector &vec)
Vector RenderObject::getWorldCollidePosition(const Vector &vec) const
{
#ifdef BBGE_USE_GLM
glm::mat4 transformMatrix = glm::translate(
@ -386,7 +386,7 @@ void RenderObject::destroy()
texture = NULL;
}
Vector RenderObject::getRealPosition()
Vector RenderObject::getRealPosition() const
{
if (parent)
{
@ -395,7 +395,7 @@ Vector RenderObject::getRealPosition()
return position + offset;
}
Vector RenderObject::getRealScale()
Vector RenderObject::getRealScale() const
{
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;
do
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;
do
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)
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))
return true;
@ -502,7 +502,7 @@ bool RenderObject::hasRenderPass(const int pass)
return false;
}
void RenderObject::render()
void RenderObject::render() const
{
if (isHidden()) return;
@ -557,7 +557,7 @@ void RenderObject::render()
renderCall();
}
void RenderObject::renderCall()
void RenderObject::renderCall() const
{
position += offset;
@ -645,7 +645,7 @@ void RenderObject::renderCall()
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)
(*i)->render();
@ -704,7 +704,7 @@ void RenderObject::renderCall()
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)
(*i)->render();
@ -717,7 +717,7 @@ void RenderObject::renderCall()
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);
return Vector(sinf(a),cosf(a));
}
// HACK: this is probably a slow implementation
Vector RenderObject::getForward()
Vector RenderObject::getForward() const
{
Vector v = getWorldCollidePosition(Vector(0,-1, 0));
Vector r = v - getWorldCollidePosition();
@ -869,7 +869,7 @@ Vector RenderObject::getForward()
return r;
}
Vector RenderObject::getAbsoluteRotation()
Vector RenderObject::getAbsoluteRotation() const
{
Vector r = rotation;
if (parent)
@ -1058,7 +1058,7 @@ void RenderObject::addChild(RenderObject *r, ParentManaged pm, RenderBeforeParen
r->parent = this;
}
StateData *RenderObject::getStateData()
StateData *RenderObject::getStateData() const
{
if (parent)
{
@ -1073,7 +1073,7 @@ void RenderObject::setOverrideCullRadius(float 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();

View file

@ -82,13 +82,18 @@ struct MotionBlurData
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
{
public:
friend class Core;
RenderObject();
virtual ~RenderObject();
virtual void render();
virtual void render() const;
void setTexturePointer(CountedPtr<Texture> t)
{
@ -137,8 +142,8 @@ public:
bool isfv() const { return _fv; }
// recursive
bool isfhr();
bool isfvr();
bool isfhr() const;
bool isfvr() const;
size_t getIdx() const { return idx; }
void setIdx(size_t newidx) { this->idx = newidx; }
@ -156,10 +161,10 @@ public:
return w*w + h*h;
}
int getTopLayer();
int getTopLayer() const;
void setColorMult(const Vector &color, const float alpha);
void clearColorMult();
void setColorMult(const Vector &color, const float alpha) const; // HACK: const
void clearColorMult() const; // HACK: const
void enableMotionBlur(int sz=10, int off=5);
void disableMotionBlur();
@ -167,42 +172,40 @@ public:
void addChild(RenderObject *r, ParentManaged pm, RenderBeforeParent rbp = RBP_NONE, ChildOrder order = CHILD_BACK);
void removeChild(RenderObject *r);
Vector getRealPosition();
Vector getRealScale();
Vector getRealPosition() const;
Vector getRealScale() const;
StateData *getStateData();
StateData *getStateData() const;
// HACK: This is defined in RenderObject_inline.h because it needs
// the class Core definition. --achurch
inline bool isOnScreen();
bool isCoordinateInRadius(const Vector &pos, float r);
inline bool isOnScreen() const;
const RenderObject &operator=(const RenderObject &r);
bool isCoordinateInRadius(const Vector &pos, float r) const;
void toggleCull(bool value);
void safeKill();
Vector getWorldPosition();
Vector getWorldCollidePosition(const Vector &vec=Vector(0,0,0));
Vector getInvRotPosition(const Vector &vec);
bool isPieceFlippedHorizontal();
Vector getWorldPosition() const;
Vector getWorldCollidePosition(const Vector &vec=Vector(0,0,0)) const;
Vector getInvRotPosition(const Vector &vec) const;
bool isPieceFlippedHorizontal() const;
RenderObject *getTopParent();
RenderObject *getTopParent() const;
virtual void onAnimationKeyPassed(int key){}
Vector getAbsoluteRotation();
float getWorldRotation();
Vector getWorldPositionAndRotation(); // more efficient shortcut, returns rotation in vector z component
Vector getNormal();
Vector getForward();
Vector getAbsoluteRotation() const;
float getWorldRotation() const;
Vector getWorldPositionAndRotation() const; // more efficient shortcut, returns rotation in vector z component
Vector getNormal() const;
Vector getForward() const;
void setOverrideCullRadius(float ovr);
void setRenderPass(int pass) { renderPass = pass; }
int getRenderPass() { return renderPass; }
int getRenderPass() const { return renderPass; }
void setOverrideRenderPass(int pass) { overrideRenderPass = pass; }
int getOverrideRenderPass() { return overrideRenderPass; }
int getOverrideRenderPass() const { return overrideRenderPass; }
enum { RENDER_ALL=314, OVERRIDE_NONE=315 };
// Defined in RenderObject_inline.h
@ -210,7 +213,7 @@ public:
void lookAt(const Vector &pos, float t, float minAngle, float maxAngle, float offset=0);
inline RenderObject *getParent() const {return parent;}
void applyBlendType();
void applyBlendType() const;
void fhTo(bool fh);
void addDeathNotify(RenderObject *r);
virtual void unloadDevice();
@ -251,14 +254,16 @@ public:
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 velocity, gravity;
CountedPtr<Texture> texture;
float life;
float followCamera;
mutable float followCamera;
float alphaMod;
float updateCull;
int layer;
@ -272,9 +277,9 @@ public:
float overrideCullRadiusSqr;
// --- This is hack and should not exist ---
bool colorIsSaved; // Used for both color and alpha
Vector savedColor; // Saved values from setColorMult()
float savedAlpha;
mutable bool colorIsSaved; // Used for both color and alpha
mutable Vector savedColor; // Saved values from setColorMult()
mutable float savedAlpha;
float width, height; // Only used by Quads, but stored here for getCullRadius()
@ -290,7 +295,7 @@ protected:
virtual void onFH(){}
virtual void onFV(){}
virtual void onSetTexture(){}
virtual void onRender(){}
virtual void onRender() const {}
virtual void onUpdate(float dt);
virtual void deathNotify(RenderObject *r);
virtual void onEndOfLife() {}
@ -298,10 +303,10 @@ protected:
void updateLife(float dt);
// 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();
virtual void renderCollision();
inline void renderCall() const;
virtual void renderCollision() const;
typedef std::list<RenderObject*> RenderObjectList;
RenderObjectList deathNotifications;
@ -309,6 +314,9 @@ protected:
size_t idx; // index in layer
StateData *stateData;
MotionBlurData *motionBlur;
private:
const RenderObject &operator=(const RenderObject &r); // undefined
};
#endif

View file

@ -30,7 +30,6 @@ RenderObjectLayer::RenderObjectLayer()
visible = true;
startPass = endPass = 0;
followCameraLock = FCL_NONE;
cull = true;
update = true;
color = Vector(1,1,1);
@ -46,11 +45,6 @@ RenderObjectLayer::~RenderObjectLayer()
{
}
void RenderObjectLayer::setCull(bool cull)
{
this->cull = cull;
}
void RenderObjectLayer::add(RenderObject* r)
{
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++;
if (robj->getParent() || robj->alpha.x == 0)
return;
if (!this->cull || !robj->cull || robj->isOnScreen())
if (!robj->cull || robj->isOnScreen())
{
robj->render();
core->renderObjectCount++;

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef RENDEROBJECT_INLINE_H
#define RENDEROBJECT_INLINE_H
inline bool RenderObject::isOnScreen()
inline bool RenderObject::isOnScreen() const
{
if (followCamera == 1) return true;

View file

@ -40,7 +40,7 @@ void OutlineRect::setLineSize(int ls)
lineSize = ls;
}
void OutlineRect::onRender()
void OutlineRect::onRender() const
{
glLineWidth(lineSize);
glBegin(GL_LINES);

View file

@ -101,7 +101,7 @@ void RoundedRect::onUpdate(float dt)
}
}
void RoundedRect::onRender()
void RoundedRect::onRender() const
{
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;
glLineWidth(1);

View file

@ -43,7 +43,7 @@ public:
protected:
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
bool canMove;
static RoundedRect *moving;
@ -61,7 +61,7 @@ public:
EventPtr event;
protected:
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
TTFText *label;
int width, height, radius;

View file

@ -111,7 +111,7 @@ bool ScreenTransition::isGoing()
return alpha.isInterpolating();
}
void ScreenTransition::onRender()
void ScreenTransition::onRender() const
{
if (alpha.x == 0) return;

View file

@ -38,7 +38,7 @@ protected:
void destroyTexture();
int textureWidth, textureHeight;
int windowWidth, windowHeight;
void onRender();
void onRender() const OVERRIDE;
float width, height;

View file

@ -297,7 +297,7 @@ void Bone::spawnParticlesFromCollisionMask(const char *p, unsigned intv, int lay
}
}
void Bone::renderCollision()
void Bone::renderCollision() const
{
if (!collisionMask.empty())
{

View file

@ -94,7 +94,7 @@ public:
void spawnParticlesFromCollisionMask(const char *p, unsigned intv, int layer, float rotz = 0);
Vector getCollisionMaskNormal(size_t index);
virtual void renderCollision() OVERRIDE;
virtual void renderCollision() const OVERRIDE;
protected:
std::vector<ParticleEffect*> emitters;

View file

@ -223,11 +223,6 @@ void TTFText::updateFormatting()
lineHeight = font->font->LineHeight();
}
void TTFText::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
}
float TTFText::getLineHeight()
{
return lineHeight;
@ -245,7 +240,7 @@ int TTFText::findLine(const std::string &label)
return 0;
}
void TTFText::onRender()
void TTFText::onRender() const
{

View file

@ -58,8 +58,7 @@ protected:
float lineHeight;
void updateAlign();
Align align;
void onUpdate(float dt);
void onRender();
void onRender() const OVERRIDE;
void updateFormatting();
std::string originalText;

View file

@ -284,7 +284,7 @@ bool Texture::load(std::string file, bool mipmap)
return ok;
}
void Texture::apply(bool repeatOverride)
void Texture::apply(bool repeatOverride) const
{
glBindTexture(GL_TEXTURE_2D, textures[0]);
if (repeat || repeatOverride)
@ -307,10 +307,6 @@ void Texture::apply(bool repeatOverride)
}
}
void Texture::unbind()
{
}
struct GlTexFormat
{
int internalformat, format, type;

View file

@ -40,8 +40,7 @@ public:
~Texture();
bool load(std::string file, bool mipmap);
void apply(bool repeatOverride=false);
void unbind();
void apply(bool repeatOverride=false) const;
void unload();
int getPixelWidth();
@ -51,7 +50,8 @@ public:
int width, height;
bool repeat, repeating;
bool repeat;
mutable bool repeating; // modified during rendering
unsigned textures[1];