Refactoring collezioni

This commit is contained in:
2026-06-23 11:39:36 +02:00
parent 2dfd574814
commit c48d0505fc
7 changed files with 14 additions and 28 deletions
@@ -17,11 +17,17 @@ class CollectionInterface{
public:
virtual collection create(ReferencePlane plane) = 0;
virtual void update(sf::Clock cl, float multiplier) = 0;
virtual bool setTransparency(float alpha) = 0;
virtual bool setTransparency(float alpha) {
if (alpha < 0 || alpha > 1) return false;
transparency = alpha;
return true;
};
float getTransparency() {
return transparency;
}
virtual bool setVisibility(bool c);
virtual void setVisibility(bool c) {
isVisible = c;
}
virtual ~CollectionInterface(){};
};
-1
View File
@@ -14,7 +14,6 @@ class Gamba : public CollectionInterface {
collection create(ReferencePlane plane) override;
PieceInterface* getJointPiece();
void setDirection(Direction dir);
bool setTransparency(float alpha) override;
void update(sf::Clock cl, float multiplier)override {};
float getZ_Acc();
};
-2
View File
@@ -34,8 +34,6 @@ public:
Lower_Body(rb::Vector3 pos, std::vector<gamba_data> data);
~Lower_Body();
void update(sf::Clock cl, float multiplier) override;
bool setVisibility(bool c) override;
bool setTransparency(float alpha) override;
collection create(ReferencePlane plane) override;
};
+2 -10
View File
@@ -32,9 +32,11 @@ Gamba::Gamba(rb::Vector3 pos, unsigned int* dataPos, std::string cosciaData, std
collection Gamba::create(ReferencePlane plane){
collection coll;
for(auto e : pezzi){
e->setTransparency(transparency);
coll.pieces.push_back(e);
}
for(auto e : sensori){
e->setTransparency(transparency);
coll.pieces.push_back(e);
}
@@ -58,16 +60,6 @@ void Gamba::setDirection(Direction dir){
}
}
bool Gamba::setTransparency(float alpha){
for (auto i : pezzi){
if (!i->setTransparency(alpha)) return false;
}
for (auto i : sensori){
if (!i->setTransparency(alpha)) return false;
}
return true;
}
float Gamba::getZ_Acc(){
float totZ_Acc = 0;
-9
View File
@@ -66,15 +66,6 @@ Lower_Body::~Lower_Body(){
delete jsx;
}
bool Lower_Body::setVisibility(bool c){
}
bool Lower_Body::setTransparency(float alpha){
if (alpha < 0 || alpha > 1) return false;
transparency = alpha;
return true;
}
void Lower_Body::update(sf::Clock cl, float multiplier){
float sxAcc = sx->getZ_Acc() ;