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
+4 -4
View File
@@ -24,8 +24,8 @@ Pos=68,96
Size=740,472 Size=740,472
[Window][Set data position] [Window][Set data position]
Pos=0,732 Pos=0,670
Size=924,30 Size=800,30
[Window][Dear ImGui Demo/ResizableChild_478B81A3] [Window][Dear ImGui Demo/ResizableChild_478B81A3]
IsChild=1 IsChild=1
@@ -40,10 +40,10 @@ Pos=60,60
Size=353,1005 Size=353,1005
[Window][Set visualization plane] [Window][Set visualization plane]
Pos=524,0 Pos=400,0
Size=400,30 Size=400,30
[Window][Set time multiplier] [Window][Set time multiplier]
Pos=524,702 Pos=400,640
Size=400,30 Size=400,30
BIN
View File
Binary file not shown.
@@ -17,11 +17,17 @@ class CollectionInterface{
public: public:
virtual collection create(ReferencePlane plane) = 0; virtual collection create(ReferencePlane plane) = 0;
virtual void update(sf::Clock cl, float multiplier) = 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() { float getTransparency() {
return transparency; return transparency;
} }
virtual bool setVisibility(bool c); virtual void setVisibility(bool c) {
isVisible = c;
}
virtual ~CollectionInterface(){}; virtual ~CollectionInterface(){};
}; };
-1
View File
@@ -14,7 +14,6 @@ class Gamba : public CollectionInterface {
collection create(ReferencePlane plane) override; collection create(ReferencePlane plane) override;
PieceInterface* getJointPiece(); PieceInterface* getJointPiece();
void setDirection(Direction dir); void setDirection(Direction dir);
bool setTransparency(float alpha) override;
void update(sf::Clock cl, float multiplier)override {}; void update(sf::Clock cl, float multiplier)override {};
float getZ_Acc(); float getZ_Acc();
}; };
-2
View File
@@ -34,8 +34,6 @@ public:
Lower_Body(rb::Vector3 pos, std::vector<gamba_data> data); Lower_Body(rb::Vector3 pos, std::vector<gamba_data> data);
~Lower_Body(); ~Lower_Body();
void update(sf::Clock cl, float multiplier) override; void update(sf::Clock cl, float multiplier) override;
bool setVisibility(bool c) override;
bool setTransparency(float alpha) override;
collection create(ReferencePlane plane) 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 Gamba::create(ReferencePlane plane){
collection coll; collection coll;
for(auto e : pezzi){ for(auto e : pezzi){
e->setTransparency(transparency);
coll.pieces.push_back(e); coll.pieces.push_back(e);
} }
for(auto e : sensori){ for(auto e : sensori){
e->setTransparency(transparency);
coll.pieces.push_back(e); 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 Gamba::getZ_Acc(){
float totZ_Acc = 0; float totZ_Acc = 0;
-9
View File
@@ -66,15 +66,6 @@ Lower_Body::~Lower_Body(){
delete jsx; 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){ void Lower_Body::update(sf::Clock cl, float multiplier){
float sxAcc = sx->getZ_Acc() ; float sxAcc = sx->getZ_Acc() ;