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

get rid of beforeScaleOffset

This commit is contained in:
fgenesis 2023-08-26 00:58:47 +02:00
parent c959b9f6d6
commit 048a787cb1
4 changed files with 7 additions and 17 deletions

View file

@ -126,16 +126,13 @@ RenderObject* RenderObject::getTopParent() const
static glm::mat4 matrixChain(const RenderObject *ro)
{
glm::mat4 tranformMatrix = glm::scale(
glm::translate(
glm::rotate(
glm::translate(
ro->getParent() ? matrixChain(ro->getParent()) : glm::mat4(1.0f),
glm::vec3(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0)
),
ro->rotation.z + ro->rotationOffset.z,
glm::vec3(0.0f, 0.0f, 1.0f)
glm::rotate(
glm::translate(
ro->getParent() ? matrixChain(ro->getParent()) : glm::mat4(1.0f),
glm::vec3(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0)
),
glm::vec3(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0.0f)
ro->rotation.z + ro->rotationOffset.z,
glm::vec3(0.0f, 0.0f, 1.0f)
),
glm::vec3(ro->scale.x, ro->scale.y, 0.0f)
);
@ -154,7 +151,6 @@ static void matrixChain(RenderObject *ro)
glTranslatef(ro->position.x+ro->offset.x, ro->position.y+ro->offset.y, 0);
glRotatef(ro->rotation.z+ro->rotationOffset.z, 0, 0, 1);
glTranslatef(ro->beforeScaleOffset.x, ro->beforeScaleOffset.y, 0);
glScalef(ro->scale.x, ro->scale.y, 0);
if (ro->isfh())
{
@ -465,7 +461,6 @@ nofollow:
if (isfh())
glRotatef(180, 0, 1, 0);
glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z);
const Vector renderScale = scale * rs.scale;
glScalef(renderScale.x, renderScale.y, 1);
glTranslatef(internalOffset.x, internalOffset.y, internalOffset.z);
@ -732,7 +727,6 @@ void RenderObject::onUpdate(float dt)
alpha.update(dt);
offset.update(dt);
internalOffset.update(dt);
beforeScaleOffset.update(dt);
rotationOffset.update(dt);
bool hasChildrenToDelete = false;

View file

@ -252,7 +252,7 @@ public:
InterpolatedVector scale;
InterpolatedVector color, alpha;
InterpolatedVector rotation;
InterpolatedVector offset, rotationOffset, internalOffset, beforeScaleOffset;
InterpolatedVector offset, rotationOffset, internalOffset;
InterpolatedVector velocity, gravity;
CountedPtr<Texture> texture;

View file

@ -172,7 +172,6 @@ private:
struct TileData
{
float x, y, scalex, scaley;
//float beforeScaleOffsetX, beforeScaleOffsetY; // almost always 0. // TODO: this is nasty, ideally get rid of this
float rotation;
unsigned flags; // TileFlags
unsigned tag; // FIXME: make this int

View file

@ -156,9 +156,6 @@ void TileRender::onRender(const RenderState& rs) const
default: ; // both or none set, nothing to do
}
// this is only relevant in editor mode and is always 0 otherwise
//glTranslatef(tile.beforeScaleOffsetX, tile.beforeScaleOffsetY, 0);
glScalef(sw, sh, 1);