1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-18 02:34:57 +00:00

remove unused QuadTrail

This commit is contained in:
fgenesis 2022-05-12 17:35:39 +02:00
parent ca4d56b620
commit ad36f6cf99
4 changed files with 0 additions and 203 deletions

View file

@ -15,8 +15,4 @@
// this is defined.)
//#define AQUARIA_SAVE_MAPVIS_RAW
// Interesting, old test stuff
//#define AQ_TEST_QUADTRAIL
#endif //__AQUARIA_COMPILE_CONFIG_H__

View file

@ -63,8 +63,6 @@ set(BBGE_SRCS
Quad.h
QuadGrid.cpp
QuadGrid.h
QuadTrail.cpp
QuadTrail.h
ReadXML.cpp
ReadXML.h
Rect.h

View file

@ -1,132 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "QuadTrail.h"
#include <assert.h>
#include "RenderBase.h"
QuadTrail::QuadTrail(int maxPoints, float pointDist)
: RenderObject()
, numPoints(0)
, maxPoints(maxPoints)
, pointDist(pointDist)
{
quadTrailAlphaEffect = QTAE_NORMAL;
cull = false;
repeatTexture = 1;
lifeRate = 0.5;
}
void QuadTrail::addPoint(const Vector &point)
{
if (numPoints > 0)
{
if ((points.back().point - point).isLength2DIn(pointDist))
{
backOffset = point - points.back().point;
return;
}
}
QuadTrailPoint p;
p.point = point;
points.push_back(p);
numPoints++;
if (numPoints >= maxPoints)
points.pop_front();
backOffset.x = 0;
backOffset.y = 0;
}
void QuadTrail::onRender()
{
if (numPoints < 2) return;
int c = 0;
Vector p, diff, dl, dr;
Vector lastPoint;
const float texScale = texture ? float(numPoints*pointDist)/texture->width : 1.0f;
glBegin(GL_QUAD_STRIP);
for (Points::iterator i = points.begin(); i != points.end(); i++)
{
if (quadTrailAlphaEffect == QTAE_NORMAL)
{
glColor4f(1, 1, 1, (*i).life);
}
if (c == 0)
{
lastPoint = (*i).point;
c++;
continue;
}
p = (*i).point;
if (c == numPoints-1)
p += backOffset;
diff = p - lastPoint;
//possible opt here
if (texture)
diff.setLength2D(texture->width*0.5f);
else
diff.setLength2D(32);
dl = diff.getPerpendicularLeft();
dr = diff.getPerpendicularRight();
glTexCoord2f(0, (float(c)/numPoints)*texScale);
glVertex2f(p.x+dl.x, p.y+dl.y);
glTexCoord2f(1, (float(c+1)/numPoints)*texScale);
glVertex2f(p.x+dr.x, p.y+dr.y);
c++;
lastPoint = (*i).point;
}
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
glPointSize(4);
glColor4f(0, 1, 0, 0.5);
glBegin(GL_POINTS);
for (Points::iterator i = points.begin(); i != points.end(); i++)
{
glVertex2f((*i).point.x, (*i).point.y);
}
glEnd();
}
void QuadTrail::onUpdate(float dt)
{
RenderObject::onUpdate(dt);
for (Points::iterator i = points.begin(); i != points.end(); i++)
{
(*i).life -= dt * lifeRate;
if ((*i).life <= 0)
(*i).life = 0;
}
}

View file

@ -1,65 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef QUADTRAIL_H
#define QUADTRAIL_H
#include "RenderObject.h"
enum QuadTrailAlphaEffect
{
QTAE_NONE = 0,
QTAE_NORMAL = 1
};
struct QuadTrailPoint
{
QuadTrailPoint()
{
life = 1;
}
Vector point;
float life;
};
class QuadTrail : public RenderObject
{
public:
QuadTrail(int maxPoints, float pointDist);
void addPoint(const Vector &point);
QuadTrailAlphaEffect quadTrailAlphaEffect;
float lifeRate;
protected:
Vector backOffset;
int numPoints;
int maxPoints;
float pointDist;
typedef std::list<QuadTrailPoint> Points;
Points points;
void onRender();
void onUpdate(float dt);
};
#endif