Preparazione controllo visibilità collezioni
This commit is contained in:
@@ -11,10 +11,17 @@ struct collection{
|
|||||||
|
|
||||||
|
|
||||||
class CollectionInterface{
|
class CollectionInterface{
|
||||||
|
protected:
|
||||||
|
float transparency = 1.0;
|
||||||
|
bool isVisible = true;
|
||||||
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) = 0;
|
||||||
|
float getTransparency() {
|
||||||
|
return transparency;
|
||||||
|
}
|
||||||
|
virtual bool setVisibility(bool c);
|
||||||
virtual ~CollectionInterface(){};
|
virtual ~CollectionInterface(){};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ 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;
|
||||||
void setVisibility(bool c);
|
bool setVisibility(bool c) override;
|
||||||
bool setTransparency(float alpha) override;
|
bool setTransparency(float alpha) override;
|
||||||
collection create(ReferencePlane plane) override;
|
collection create(ReferencePlane plane) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,42 +18,43 @@ Lower_Body::Lower_Body(rb::Vector3 pos,std::vector<gamba_data> data){
|
|||||||
collection Lower_Body::create(ReferencePlane plane){
|
collection Lower_Body::create(ReferencePlane plane){
|
||||||
collection coll;
|
collection coll;
|
||||||
|
|
||||||
sx->setTransparency(1);
|
sx->setTransparency(transparency);
|
||||||
dx->setTransparency(1);
|
dx->setTransparency(transparency);
|
||||||
|
t->setTransparency(transparency);
|
||||||
|
|
||||||
coll.joints.push_back(jsx);
|
if (isVisible){
|
||||||
coll.joints.push_back(jdx);
|
coll.joints.push_back(jsx);
|
||||||
|
coll.joints.push_back(jdx);
|
||||||
|
|
||||||
switch (plane)
|
switch (plane)
|
||||||
{
|
{
|
||||||
case ReferencePlane::XZN:
|
case ReferencePlane::XZN:
|
||||||
dx->setTransparency(0.5);
|
dx->setTransparency(0.5 * transparency);
|
||||||
dx->setDirection(Direction::L);
|
dx->setDirection(Direction::L);
|
||||||
sx->setDirection(Direction::R);
|
sx->setDirection(Direction::R);
|
||||||
coll = coll + dx->create(plane);
|
coll = coll + dx->create(plane);
|
||||||
coll = coll + sx->create(plane);
|
coll = coll + sx->create(plane);
|
||||||
break;
|
break;
|
||||||
case ReferencePlane::XZ:
|
case ReferencePlane::XZ:
|
||||||
sx->setTransparency(0.5);
|
sx->setTransparency(0.5 * transparency);
|
||||||
dx->setDirection(Direction::R);
|
dx->setDirection(Direction::R);
|
||||||
sx->setDirection(Direction::L);
|
sx->setDirection(Direction::L);
|
||||||
coll = coll + sx->create(plane);
|
coll = coll + sx->create(plane);
|
||||||
coll = coll + dx->create(plane);
|
coll = coll + dx->create(plane);
|
||||||
break;
|
break;
|
||||||
case ReferencePlane::YZ:
|
case ReferencePlane::YZ:
|
||||||
sx->setDirection(Direction::R);
|
sx->setDirection(Direction::R);
|
||||||
dx->setDirection(Direction::L);
|
dx->setDirection(Direction::L);
|
||||||
coll = coll + dx->create(plane);
|
coll = coll + dx->create(plane);
|
||||||
coll = coll + sx->create(plane);
|
coll = coll + sx->create(plane);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
coll.pieces.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
coll.pieces.push_back(t);
|
|
||||||
|
|
||||||
return coll;
|
return coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,14 +66,13 @@ Lower_Body::~Lower_Body(){
|
|||||||
delete jsx;
|
delete jsx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lower_Body::setVisibility(bool c){
|
bool Lower_Body::setVisibility(bool c){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Lower_Body::setTransparency(float alpha){
|
bool Lower_Body::setTransparency(float alpha){
|
||||||
if (!sx->setTransparency(alpha)) return false;
|
if (alpha < 0 || alpha > 1) return false;
|
||||||
dx->setTransparency(alpha);
|
transparency = alpha;
|
||||||
t->setTransparency(alpha);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user