Skip to content

Commit

Permalink
lowest quality 2
Browse files Browse the repository at this point in the history
  • Loading branch information
atupone committed Dec 14, 2024
1 parent d62f1f8 commit a28557c
Show file tree
Hide file tree
Showing 36 changed files with 67 additions and 1,373 deletions.
1 change: 0 additions & 1 deletion include/BZDBCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class BZDBCache
static Bool lighting;
static Bool smooth;
static Bool colorful;
static Int flagChunks;
static Bool animatedTreads;
static Int radarStyle;
static Float radarTankPixels;
Expand Down
1 change: 0 additions & 1 deletion include/OpenGLGState.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ class OpenGLGStateBuilder
void resetAlphaFunc();
void setTexture(const int texture);
void setTextureMatrix(const GLfloat* matrix);
void setTextureEnvMode(GLenum mode = GL_MODULATE);
void setMaterial(const OpenGLMaterial& material);
void setBlending(GLenum sFactor = GL_SRC_ALPHA,
GLenum dFactor = GL_ONE_MINUS_SRC_ALPHA);
Expand Down
53 changes: 0 additions & 53 deletions include/SphereSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,59 +100,6 @@ class SphereLodSceneNode : public SphereSceneNode
};


/******************************************************************************/

const int SphereRes = 8;
const int SphereLowRes = 6;

class SphereBspSceneNode;

class SphereBspSceneNode : public SphereSceneNode
{
public:
SphereBspSceneNode(const glm::vec3 &pos, GLfloat radius);
~SphereBspSceneNode();

void addRenderNodes(SceneRenderer&);
void addShadowNodes(SceneRenderer&);

protected:
GLfloat getRadius() const
{
return radius;
}

private:
void freeParts();

protected:
class SphereBspRenderNode : public RenderNode
{
friend class SphereBspSceneNode;
public:
SphereBspRenderNode(const SphereBspSceneNode*);
~SphereBspRenderNode();
void setHighResolution(bool);
void setBaseIndex(int index);
void render() override;
const glm::vec3 &getPosition() const override;
private:
const SphereBspSceneNode* sceneNode;
bool highResolution;
int baseIndex;
static glm::vec3 geom[2 * SphereRes * (SphereRes + 1)];
static glm::vec3 lgeom[SphereLowRes * (SphereLowRes + 1)];
};
friend class SphereBspRenderNode;

private:
SphereBspRenderNode renderNode;
};


/******************************************************************************/


#endif // BZF_SPHERE_SCENE_NODE_H

// Local Variables: ***
Expand Down
6 changes: 2 additions & 4 deletions include/TankGeometryMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ void deleteLists();

GLuint getPartList(TankGeometryEnums::TankShadow shadow,
TankGeometryEnums::TankPart part,
TankGeometryEnums::TankSize size,
TankGeometryEnums::TankLOD lod);
TankGeometryEnums::TankSize size);

int getPartTriangleCount(TankGeometryEnums::TankShadow shadow,
TankGeometryEnums::TankPart part,
TankGeometryEnums::TankSize size,
TankGeometryEnums::TankLOD lod);
TankGeometryEnums::TankSize size);

const glm::vec3 &getScaleFactor(TankGeometryEnums::TankSize size);
}
Expand Down
5 changes: 0 additions & 5 deletions include/TankSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ class TankSceneNode : public SceneNode

void renderRadar() override;

static void setMaxLOD(int maxLevel);

void setDeathOverride( TankDeathOverride* o)
{
deathOverride = o;
Expand All @@ -171,7 +169,6 @@ class TankSceneNode : public SceneNode
void setShadow();
void setRadar(bool);
void setTreads(bool);
void setTankLOD(TankGeometryEnums::TankLOD);
void setTankSize(TankGeometryEnums::TankSize);
void sortOrder(bool above, bool towards, bool left);
void setNarrowWithDepth(bool narrow);
Expand All @@ -191,7 +188,6 @@ class TankSceneNode : public SceneNode

protected:
const TankSceneNode* sceneNode;
TankGeometryEnums::TankLOD drawLOD;
TankGeometryEnums::TankSize drawSize;
const glm::vec4 *color;
GLfloat alpha;
Expand Down Expand Up @@ -241,7 +237,6 @@ class TankSceneNode : public SceneNode
OpenGLLight jumpJetsGroundLights[4];
OpenGLGState jumpJetsGState;

static int maxLevel;
static const int numLOD;
static glm::vec3 jumpJetsModel[4];
};
Expand Down
96 changes: 4 additions & 92 deletions src/bzflag/BackgroundRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ BackgroundRenderer::BackgroundRenderer() :
cloudsList = INVALID_GL_LIST_ID;
sunXFormList = INVALID_GL_LIST_ID;
starXFormList = INVALID_GL_LIST_ID;
simpleGroundList[0] = INVALID_GL_LIST_ID;
simpleGroundList[1] = INVALID_GL_LIST_ID;
simpleGroundList[2] = INVALID_GL_LIST_ID;
simpleGroundList[3] = INVALID_GL_LIST_ID;

// initialize global to class stuff
if (!init)
Expand Down Expand Up @@ -488,7 +484,7 @@ void BackgroundRenderer::makeCelestialLists(const SceneRenderer& renderer)
sun2[2] = sunDirection[2] * cosf(moonAltitude) - sun2[0] * sinf(moonAltitude);
const float limbAngle = atan2f(sun2[2], sun2[1]);

const int moonSegements = BZDB.evalInt("moonSegments");
const int moonSegements = 64;
moonList = glGenLists(1);
glNewList(moonList, GL_COMPILE);
{
Expand Down Expand Up @@ -600,7 +596,6 @@ void BackgroundRenderer::renderGroundEffects(SceneRenderer& renderer,
drawGroundReceivers(renderer);
}

if (renderer.useQuality() > 1)
{
// light the mountains (so that they get dark when the sun goes down).
// don't do zbuffer test since they occlude all drawn before them and
Expand Down Expand Up @@ -876,7 +871,7 @@ void BackgroundRenderer::drawSky(SceneRenderer& renderer, bool mirror)
{
glPushMatrix();

const bool doSkybox = haveSkybox && (renderer.useQuality() >= 2);
const bool doSkybox = haveSkybox;

if (!doSkybox)
{
Expand Down Expand Up @@ -1020,10 +1015,9 @@ void BackgroundRenderer::drawGround()
groundGState[styleIndex].setState();
}

if (RENDERER.useQuality() >= 2)
{
drawGroundCentered();
else
glCallList(simpleGroundList[styleIndex]);
}
}
}

Expand Down Expand Up @@ -1510,14 +1504,9 @@ void BackgroundRenderer::doFreeDisplayLists()
weather.freeContext();
EFFECTS.freeContext();

// simpleGroundList[1] && simpleGroundList[3] are copies of [0] & [2]
simpleGroundList[1] = INVALID_GL_LIST_ID;
simpleGroundList[3] = INVALID_GL_LIST_ID;

// delete the single lists
GLuint* const lists[] =
{
&simpleGroundList[0], &simpleGroundList[2],
&cloudsList, &sunList, &sunXFormList,
&moonList, &starList, &starXFormList
};
Expand Down Expand Up @@ -1605,83 +1594,6 @@ void BackgroundRenderer::doInitDisplayLists()
for (i = 0; i < 4; i++)
groundPlane[i] = glm::vec3(groundSize * squareShape[i], 0.0f);

{
GLfloat xmin, xmax;
GLfloat ymin, ymax;
GLfloat xdist, ydist;
GLfloat xtexmin, xtexmax;
GLfloat ytexmin, ytexmax;
GLfloat xtexdist, ytexdist;
glm::vec2 vec;

#define GROUND_DIVS (4) //FIXME -- seems to be enough

xmax = groundPlane[0][0];
ymax = groundPlane[0][1];
xmin = groundPlane[2][0];
ymin = groundPlane[2][1];
xdist = (xmax - xmin) / (float)GROUND_DIVS;
ydist = (ymax - ymin) / (float)GROUND_DIVS;

renderer.getGroundUV (groundPlane[0], vec);
xtexmax = vec[0];
ytexmax = vec[1];
renderer.getGroundUV (groundPlane[2], vec);
xtexmin = vec[0];
ytexmin = vec[1];
xtexdist = (xtexmax - xtexmin) / (float)GROUND_DIVS;
ytexdist = (ytexmax - ytexmin) / (float)GROUND_DIVS;

simpleGroundList[2] = glGenLists(1);
glNewList(simpleGroundList[2], GL_COMPILE);
{
for (i = 0; i < GROUND_DIVS; i++)
{
GLfloat yoff, ytexoff;

yoff = ymin + ydist * (GLfloat)i;
ytexoff = ytexmin + ytexdist * (GLfloat)i;

glBegin(GL_TRIANGLE_STRIP);

glTexCoord2f(xtexmin, ytexoff + ytexdist);
glVertex2f(xmin, yoff + ydist);
glTexCoord2f(xtexmin, ytexoff);
glVertex2f(xmin, yoff);

for (j = 0; j < GROUND_DIVS; j++)
{
GLfloat xoff, xtexoff;

xoff = xmin + xdist * (GLfloat)(j + 1);
xtexoff = xtexmin + xtexdist * (GLfloat)(j + 1);

glTexCoord2f(xtexoff, ytexoff + ytexdist);
glVertex2f(xoff, yoff + ydist);
glTexCoord2f(xtexoff, ytexoff);
glVertex2f(xoff, yoff);
}
glEnd();
}
}
glEndList();
}

simpleGroundList[0] = glGenLists(1);
glNewList(simpleGroundList[0], GL_COMPILE);
{
glBegin(GL_TRIANGLE_STRIP);
glVertex(groundPlane[0]);
glVertex(groundPlane[1]);
glVertex(groundPlane[3]);
glVertex(groundPlane[2]);
glEnd();
}
glEndList();

simpleGroundList[1] = simpleGroundList[0];
simpleGroundList[3] = simpleGroundList[2];

//
// clouds
//
Expand Down
1 change: 0 additions & 1 deletion src/bzflag/BackgroundRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class BackgroundRenderer
// stuff for ground
OpenGLGState groundGState[4];
OpenGLGState invGroundGState[4];
GLuint simpleGroundList[4];
int groundTextureID;
const GLfloat* groundTextureMatrix;

Expand Down
8 changes: 0 additions & 8 deletions src/bzflag/DisplayMenu.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,7 @@ void DisplayMenu::callback(HUDuiControl* w, const void* data)
BZDB.set("lighting", list->getIndex() == 0 ? "0" : "1");
BZDB.set("tesselation", list->getIndex() == 2 ? "1" : "0");
if (oldLighting != BZDBCache::lighting)
{
BZDB.set("texturereplace", (!BZDBCache::lighting &&
sceneRenderer->useQuality() < 2) ? "1" : "0");
BZDB.setPersistent("texturereplace", false);
sceneRenderer->notifyStyleChange();
}
break;
}
case '5':
Expand Down Expand Up @@ -449,9 +444,6 @@ void DisplayMenu::callback(HUDuiControl* w, const void* data)
sceneRenderer->setQuality(list->getIndex());
if (list->getIndex() >= 3)
setSceneDatabase();
BZDB.set("texturereplace", (!BZDBCache::lighting &&
sceneRenderer->useQuality() < 2) ? "1" : "0");
BZDB.setPersistent("texturereplace", false);
sceneRenderer->notifyStyleChange();
break;
case '7':
Expand Down
2 changes: 1 addition & 1 deletion src/bzflag/LocalPlayer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ bool LocalPlayer::fireShot()
server->sendPlayerUpdate(this);
server->sendBeginShot(firingInfo);

if (BZDB.isTrue("enableLocalShotEffect") && SceneRenderer::instance().useQuality() >= 2)
if (BZDB.isTrue("enableLocalShotEffect"))
EFFECTS.addShotEffect(getColor(), firingInfo.shot.pos, getAngle(), getVelocity());

if (gettingSound)
Expand Down
6 changes: 3 additions & 3 deletions src/bzflag/Player.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Player::Player(const PlayerId& _id, TeamColor _team,
registered(false),
verified(false),
playerList(false),
pausedSphere(nullptr),
lastVisualTeam(NoTeam),
team(_team),
type(_type),
Expand Down Expand Up @@ -109,10 +110,9 @@ Player::Player(const PlayerId& _id, TeamColor _team,
tankIDLNode = new TankIDLSceneNode(tankNode);
changeTeam(team);
const float sphereRad = (1.5f * BZDBCache::tankRadius);
if (RENDERER.useQuality() >= 2)
{
pausedSphere = new SphereLodSceneNode(state.pos, sphereRad);
else
pausedSphere = new SphereBspSceneNode(state.pos, sphereRad);
}
pausedSphere->setColor(0.0f, 0.0f, 0.0f, 0.5f);
}

Expand Down
Loading

0 comments on commit a28557c

Please sign in to comment.