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

View file

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

View file

@ -172,7 +172,6 @@ private:
struct TileData struct TileData
{ {
float x, y, scalex, scaley; float x, y, scalex, scaley;
//float beforeScaleOffsetX, beforeScaleOffsetY; // almost always 0. // TODO: this is nasty, ideally get rid of this
float rotation; float rotation;
unsigned flags; // TileFlags unsigned flags; // TileFlags
unsigned tag; // FIXME: make this int 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 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); glScalef(sw, sh, 1);