mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +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;
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
for (size_t i = 0; i < xDivs; i++)
|
||||
|
@ -422,66 +392,30 @@ void Quad::onRender(const RenderState& rs) const
|
|||
if (!renderQuad) return;
|
||||
|
||||
|
||||
float _w2 = width*0.5f;
|
||||
float _h2 = height*0.5f;
|
||||
const float _w2 = width*0.5f;
|
||||
const float _h2 = height*0.5f;
|
||||
|
||||
if (!strip.empty())
|
||||
if (!drawGrid)
|
||||
{
|
||||
|
||||
|
||||
|
||||
const float texBits = 1.0f / (strip.size()-1);
|
||||
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
|
||||
if (!stripVert)
|
||||
glBegin(GL_QUADS);
|
||||
{
|
||||
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();
|
||||
glTexCoord2f(upperLeftTextureCoordinates.x, 1.0f-upperLeftTextureCoordinates.y);
|
||||
glVertex2f(-_w2, +_h2);
|
||||
|
||||
glTexCoord2f(lowerRightTextureCoordinates.x, 1.0f-upperLeftTextureCoordinates.y);
|
||||
glVertex2f(+_w2, +_h2);
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
glColor4f(1,0,0,1);
|
||||
glPointSize(64);
|
||||
glTexCoord2f(lowerRightTextureCoordinates.x, 1.0f-lowerRightTextureCoordinates.y);
|
||||
glVertex2f(+_w2, -_h2);
|
||||
|
||||
glBegin(GL_POINTS);
|
||||
for (size_t i = 0; i < strip.size(); i++)
|
||||
{
|
||||
glVertex2f((strip[i].x*width)-_w2, strip[i].y*height);
|
||||
glTexCoord2f(upperLeftTextureCoordinates.x, 1.0f-lowerRightTextureCoordinates.y);
|
||||
glVertex2f(-_w2, -_h2);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!drawGrid)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
{
|
||||
glTexCoord2f(upperLeftTextureCoordinates.x, 1.0f-upperLeftTextureCoordinates.y);
|
||||
glVertex2f(-_w2, +_h2);
|
||||
|
||||
glTexCoord2f(lowerRightTextureCoordinates.x, 1.0f-upperLeftTextureCoordinates.y);
|
||||
glVertex2f(+_w2, +_h2);
|
||||
|
||||
glTexCoord2f(lowerRightTextureCoordinates.x, 1.0f-lowerRightTextureCoordinates.y);
|
||||
glVertex2f(+_w2, -_h2);
|
||||
|
||||
glTexCoord2f(upperLeftTextureCoordinates.x, 1.0f-lowerRightTextureCoordinates.y);
|
||||
glVertex2f(-_w2, -_h2);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
renderGrid(rs);
|
||||
}
|
||||
renderGrid(rs);
|
||||
}
|
||||
|
||||
if (renderBorder)
|
||||
|
|
|
@ -62,10 +62,7 @@ public:
|
|||
void repeatTextureToFill(bool on);
|
||||
void refreshRepeatTextureToFill();
|
||||
bool isRepeatingTextureToFill() const { return repeatTexture; }
|
||||
void setGridPoints(bool vert, const std::vector<Vector> &points);
|
||||
virtual void createStrip(bool stripVert, int num);
|
||||
float getStripSegmentSize() const;
|
||||
void resetStrip();
|
||||
void setGridPoints(bool vert, const std::vector<Vector>& points);
|
||||
Vector ** getDrawGrid() { return drawGrid; }
|
||||
|
||||
void reloadDevice();
|
||||
|
@ -88,8 +85,6 @@ public:
|
|||
|
||||
bool renderQuad, renderCenter;
|
||||
mutable bool renderBorder; // TODO: should be part of render state
|
||||
bool stripVert;
|
||||
std::vector<Vector>strip;
|
||||
Vector texOff;
|
||||
|
||||
float borderAlpha;
|
||||
|
|
|
@ -84,6 +84,7 @@ Bone::Bone() : CollideQuad()
|
|||
reverse = false;
|
||||
selectable = true;
|
||||
originalRenderPass = 0;
|
||||
stripVert = false;
|
||||
}
|
||||
|
||||
ParticleEffect *Bone::getEmitter(unsigned slot) const
|
||||
|
@ -134,7 +135,6 @@ void Bone::createStrip(bool vert, int num)
|
|||
stripVert = vert;
|
||||
gridType = GRID_SET;
|
||||
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.y = s->bones[i]->position.y;
|
||||
b.rot = s->bones[i]->rotation.z;
|
||||
b.strip = s->bones[i]->strip;
|
||||
b.sx = s->bones[i]->scale.x;
|
||||
b.sy = s->bones[i]->scale.y;
|
||||
k.keyframes.push_back(b);
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
void setSegmentProps(int minDist, int maxDist, bool reverse);
|
||||
Vector segmentOffset;
|
||||
|
||||
bool stripVert;
|
||||
bool fileRenderQuad;
|
||||
bool selectable;
|
||||
int originalRenderPass; // stores the render pass originally set in the XML file. For AC_RESET_PASS.
|
||||
|
|
Loading…
Reference in a new issue