From 35a3888c94c4e811252c4c392202a0ea7f546b5b Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sat, 7 May 2016 00:47:45 +0200 Subject: [PATCH] Remove RenderObject::collidePosition and related code This was always (0, 0) and optionally used for bones if defined in skeletal files. None of the official skeletal files used this, so this should be safe to remove. --- Aquaria/Game.cpp | 1 - BBGE/RenderObject.cpp | 4 ++-- BBGE/RenderObject.h | 1 - BBGE/SkeletalSprite.cpp | 18 ++---------------- BBGE/SkeletalSprite.h | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Aquaria/Game.cpp b/Aquaria/Game.cpp index 6e605c3..48cf9ae 100644 --- a/Aquaria/Game.cpp +++ b/Aquaria/Game.cpp @@ -2767,7 +2767,6 @@ void Game::generateCollisionMask(Quad *q, float overrideCollideRadius /* = 0 */) #ifdef BBGE_BUILD_OPENGL if (q->texture) { - q->collidePosition = Vector(0,0,0); if (overrideCollideRadius) q->collideRadius = overrideCollideRadius; else diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index faa0f7d..9b3ae0c 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -364,7 +364,7 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec) #ifdef BBGE_USE_GLM glm::mat4 transformMatrix = glm::translate( matrixChain(this), - glm::vec3(collidePosition.x + vec.x, collidePosition.y + vec.y, 0.0f) + glm::vec3(vec.x, vec.y, 0.0f) ); return Vector(transformMatrix[3][0], transformMatrix[3][1], 0); @@ -374,7 +374,7 @@ Vector RenderObject::getWorldCollidePosition(const Vector &vec) glLoadIdentity(); matrixChain(this); - glTranslatef(collidePosition.x+vec.x, collidePosition.y+vec.y, 0); + glTranslatef(vec.x, vec.y, 0); float m[16]; glGetFloatv(GL_MODELVIEW_MATRIX, m); diff --git a/BBGE/RenderObject.h b/BBGE/RenderObject.h index 0886a59..c25c0d8 100644 --- a/BBGE/RenderObject.h +++ b/BBGE/RenderObject.h @@ -282,7 +282,6 @@ public: #endif float collideRadius; - Vector collidePosition; std::vector collisionMask; std::vector transformedCollisionMask; diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index 4c903fe..c83f228 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -969,9 +969,6 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn) } bone->SetAttribute("crects", os.str().c_str()); } - std::ostringstream os; - os << this->bones[i]->collidePosition.x << " " << this->bones[i]->collidePosition.y; - bone->SetAttribute("cp", os.str().c_str()); if (this->bones[i]->rbp) bone->SetAttribute("rbp", this->bones[i]->rbp); if (this->bones[i]->originalRenderPass) @@ -1129,7 +1126,7 @@ Bone *SkeletalSprite::getBoneByIdx(int idx) return 0; } -Bone *SkeletalSprite::initBone(int idx, std::string gfx, int pidx, int rbp, std::string name, float cr, bool fh, bool fv, const Vector &cp) +Bone *SkeletalSprite::initBone(int idx, std::string gfx, int pidx, int rbp, std::string name, float cr, bool fh, bool fv) { Bone *b = new Bone; b->boneIdx = idx; @@ -1140,7 +1137,6 @@ Bone *SkeletalSprite::initBone(int idx, std::string gfx, int pidx, int rbp, std: b->renderBeforeParent = rbp; b->pidx = pidx; b->collideRadius = cr; - b->collidePosition = cp; b->name = name; //core->generateCollisionMask(b); if (fh) @@ -1381,7 +1377,6 @@ void SkeletalSprite::loadSkeletal(const std::string &fn) int pidx = -1, rbp=0, cr=0, fh=0, fv=0; std::string name; - Vector cp; if (bone->Attribute("pidx")) pidx = atoi(bone->Attribute("pidx")); if (bone->Attribute("rbp")) @@ -1395,18 +1390,9 @@ void SkeletalSprite::loadSkeletal(const std::string &fn) fh = atoi(bone->Attribute("fh")); if (bone->Attribute("fv")) fv = atoi(bone->Attribute("fv")); - if (bone->Attribute("cp")) - { - SimpleIStringStream is(bone->Attribute("cp")); - is >> cp.x >> cp.y; - } - - - - std::string gfx = bone->Attribute("gfx"); - Bone *newb = initBone(idx, gfx, pidx, rbp, name, cr, fh, fv, cp); + Bone *newb = initBone(idx, gfx, pidx, rbp, name, cr, fh, fv); if (bone->Attribute("offx")) newb->offset.x = atoi(bone->Attribute("offx")); if (bone->Attribute("offy")) diff --git a/BBGE/SkeletalSprite.h b/BBGE/SkeletalSprite.h index 50c8bb3..8a59887 100644 --- a/BBGE/SkeletalSprite.h +++ b/BBGE/SkeletalSprite.h @@ -278,7 +278,7 @@ protected: int selectedBone; friend class AnimationLayer; std::vector animLayers; - Bone* initBone(int idx, std::string gfx, int pidx, int rbp=0, std::string name="", float cr=0, bool fh=false, bool fv=false, const Vector &cp=Vector(0,0,0)); + Bone* initBone(int idx, std::string gfx, int pidx, int rbp=0, std::string name="", float cr=0, bool fh=false, bool fv=false); void deleteBones(); void onUpdate(float dt); };