mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 03:33:48 +00:00
remove Quad::createStrip(), related members, and cleanup Bone strip handling
Saves some work when rendering EVERY SINGLE QUAD in the game
This commit is contained in:
parent
80d23900de
commit
693223552d
5 changed files with 16 additions and 91 deletions
|
@ -642,10 +642,6 @@ void AnimationEditor::moveBoneStripPoint(const Vector &mov)
|
||||||
}
|
}
|
||||||
|
|
||||||
b->strip[selectedStripPoint] = sel->changeStrip[selectedStripPoint] += mov*0.006f;
|
b->strip[selectedStripPoint] = sel->changeStrip[selectedStripPoint] += mov*0.006f;
|
||||||
sel->setGridPoints(sel->stripVert, sel->strip);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,13 +64,6 @@ void Quad::setSegs(int x, int y, float dgox, float dgoy, float dgmx, float dgmy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quad::createStrip(bool vert, int num)
|
|
||||||
{
|
|
||||||
strip.resize(num);
|
|
||||||
stripVert = vert;
|
|
||||||
resetStrip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Quad::createGrid(int xd, int yd)
|
void Quad::createGrid(int xd, int yd)
|
||||||
{
|
{
|
||||||
deleteGrid();
|
deleteGrid();
|
||||||
|
@ -134,29 +127,6 @@ void Quad::setGridPoints(bool vert, const std::vector<Vector> &points)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Quad::getStripSegmentSize() const
|
|
||||||
{
|
|
||||||
return (1.0f/(float(strip.size())));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Quad::resetStrip()
|
|
||||||
{
|
|
||||||
if (!stripVert)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < strip.size(); i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
float v = (i/(float(strip.size())));
|
|
||||||
strip[i].x = v;
|
|
||||||
strip[i].y = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorLog("VERTICAL STRIP NOT SUPPORTED ^_-");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Quad::resetGrid()
|
void Quad::resetGrid()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < xDivs; i++)
|
for (size_t i = 0; i < xDivs; i++)
|
||||||
|
@ -422,44 +392,9 @@ void Quad::onRender(const RenderState& rs) const
|
||||||
if (!renderQuad) return;
|
if (!renderQuad) return;
|
||||||
|
|
||||||
|
|
||||||
float _w2 = width*0.5f;
|
const float _w2 = width*0.5f;
|
||||||
float _h2 = height*0.5f;
|
const float _h2 = height*0.5f;
|
||||||
|
|
||||||
if (!strip.empty())
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const float texBits = 1.0f / (strip.size()-1);
|
|
||||||
|
|
||||||
glBegin(GL_QUAD_STRIP);
|
|
||||||
|
|
||||||
if (!stripVert)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < strip.size(); i++)
|
|
||||||
{
|
|
||||||
glTexCoord2f(texBits*i, 0);
|
|
||||||
glVertex2f(strip[i].x*width-_w2, strip[i].y*_h2*10 - _h2);
|
|
||||||
glTexCoord2f(texBits*i, 1);
|
|
||||||
glVertex2f(strip[i].x*width-_w2, strip[i].y*_h2*10 + _h2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
|
||||||
glColor4f(1,0,0,1);
|
|
||||||
glPointSize(64);
|
|
||||||
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
for (size_t i = 0; i < strip.size(); i++)
|
|
||||||
{
|
|
||||||
glVertex2f((strip[i].x*width)-_w2, strip[i].y*height);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!drawGrid)
|
if (!drawGrid)
|
||||||
{
|
{
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
@ -482,7 +417,6 @@ void Quad::onRender(const RenderState& rs) const
|
||||||
{
|
{
|
||||||
renderGrid(rs);
|
renderGrid(rs);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (renderBorder)
|
if (renderBorder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,10 +62,7 @@ public:
|
||||||
void repeatTextureToFill(bool on);
|
void repeatTextureToFill(bool on);
|
||||||
void refreshRepeatTextureToFill();
|
void refreshRepeatTextureToFill();
|
||||||
bool isRepeatingTextureToFill() const { return repeatTexture; }
|
bool isRepeatingTextureToFill() const { return repeatTexture; }
|
||||||
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);
|
|
||||||
float getStripSegmentSize() const;
|
|
||||||
void resetStrip();
|
|
||||||
Vector ** getDrawGrid() { return drawGrid; }
|
Vector ** getDrawGrid() { return drawGrid; }
|
||||||
|
|
||||||
void reloadDevice();
|
void reloadDevice();
|
||||||
|
@ -88,8 +85,6 @@ public:
|
||||||
|
|
||||||
bool renderQuad, renderCenter;
|
bool renderQuad, renderCenter;
|
||||||
mutable bool renderBorder; // TODO: should be part of render state
|
mutable bool renderBorder; // TODO: should be part of render state
|
||||||
bool stripVert;
|
|
||||||
std::vector<Vector>strip;
|
|
||||||
Vector texOff;
|
Vector texOff;
|
||||||
|
|
||||||
float borderAlpha;
|
float borderAlpha;
|
||||||
|
|
|
@ -84,6 +84,7 @@ Bone::Bone() : CollideQuad()
|
||||||
reverse = false;
|
reverse = false;
|
||||||
selectable = true;
|
selectable = true;
|
||||||
originalRenderPass = 0;
|
originalRenderPass = 0;
|
||||||
|
stripVert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleEffect *Bone::getEmitter(unsigned slot) const
|
ParticleEffect *Bone::getEmitter(unsigned slot) const
|
||||||
|
@ -134,7 +135,6 @@ void Bone::createStrip(bool vert, int num)
|
||||||
stripVert = vert;
|
stripVert = vert;
|
||||||
gridType = GRID_SET;
|
gridType = GRID_SET;
|
||||||
changeStrip.resize(num);
|
changeStrip.resize(num);
|
||||||
setGridPoints(vert, strip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -603,7 +603,6 @@ bool AnimationLayer::createTransitionAnimation(const std::string& anim, float ti
|
||||||
b.x = s->bones[i]->position.x;
|
b.x = s->bones[i]->position.x;
|
||||||
b.y = s->bones[i]->position.y;
|
b.y = s->bones[i]->position.y;
|
||||||
b.rot = s->bones[i]->rotation.z;
|
b.rot = s->bones[i]->rotation.z;
|
||||||
b.strip = s->bones[i]->strip;
|
|
||||||
b.sx = s->bones[i]->scale.x;
|
b.sx = s->bones[i]->scale.x;
|
||||||
b.sy = s->bones[i]->scale.y;
|
b.sy = s->bones[i]->scale.y;
|
||||||
k.keyframes.push_back(b);
|
k.keyframes.push_back(b);
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
void setSegmentProps(int minDist, int maxDist, bool reverse);
|
void setSegmentProps(int minDist, int maxDist, bool reverse);
|
||||||
Vector segmentOffset;
|
Vector segmentOffset;
|
||||||
|
|
||||||
|
bool stripVert;
|
||||||
bool fileRenderQuad;
|
bool fileRenderQuad;
|
||||||
bool selectable;
|
bool selectable;
|
||||||
int originalRenderPass; // stores the render pass originally set in the XML file. For AC_RESET_PASS.
|
int originalRenderPass; // stores the render pass originally set in the XML file. For AC_RESET_PASS.
|
||||||
|
|
Loading…
Reference in a new issue