Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfbe5684a5 | |||
| de272f572b | |||
| f4dd508152 | |||
| a1c8443b8e | |||
| 5af236ad44 | |||
| 7fadd4a9ef | |||
| 5588ccee31 | |||
| c48d0505fc | |||
| 2dfd574814 |
+1
-1
@@ -53,7 +53,7 @@ target_compile_options(common INTERFACE
|
||||
|
||||
set(METHODS_PATH "./src/*/methods/*.cpp")
|
||||
|
||||
set(VERSION "V10")
|
||||
set(VERSION "V11")
|
||||
|
||||
file(GLOB_RECURSE METHODS_SRC "${METHODS_PATH}")
|
||||
add_executable(main${VERSION} ./src/Main.cpp ${METHODS_SRC} )
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# FCG_VisualizzatoreCamminata
|
||||
|
||||
- # **Nella branch All_Releases ci sono tutte le release con istruzioni per la compilazione e la relazione**
|
||||
|
||||
|
||||
## Nella versione versione v0.1 è presente la base del progetto.
|
||||
|
||||
@@ -58,16 +60,23 @@ Per spostare l'intera scena si tiene premuto il tasto centrale del mouse.
|
||||
- Modificata la funzione update di pezzi e collezioni per implementare controllo sul tempo
|
||||
- Aggiunta finestra con slider per selezione moltiplicatore del tempo
|
||||
|
||||
## Nella versione v0.10
|
||||
## Nella versione v1.0
|
||||
- Aggiunta controllo texture
|
||||
- Aggiunta pavimento
|
||||
- Refactoring generale
|
||||
- Definizione main finale (non più di test)
|
||||
|
||||
## Nella versione v1.1
|
||||
- Aggiunta controllo visibilità collezioni su GUI
|
||||
- Refactoring collezioni
|
||||
|
||||
# Per compilare:
|
||||
|
||||
cmake --build
|
||||
mkdir build //se non esiste già
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . -j$(nproc)
|
||||
|
||||
# Per lanciare:
|
||||
|
||||
./build/bin/mainV10
|
||||
cd bin
|
||||
./mainV11
|
||||
|
||||
+8
-4
@@ -24,8 +24,8 @@ Pos=68,96
|
||||
Size=740,472
|
||||
|
||||
[Window][Set data position]
|
||||
Pos=0,732
|
||||
Size=924,30
|
||||
Pos=0,670
|
||||
Size=800,30
|
||||
|
||||
[Window][Dear ImGui Demo/ResizableChild_478B81A3]
|
||||
IsChild=1
|
||||
@@ -40,10 +40,14 @@ Pos=60,60
|
||||
Size=353,1005
|
||||
|
||||
[Window][Set visualization plane]
|
||||
Pos=524,0
|
||||
Pos=400,0
|
||||
Size=400,30
|
||||
|
||||
[Window][Set time multiplier]
|
||||
Pos=524,702
|
||||
Pos=400,639
|
||||
Size=400,30
|
||||
|
||||
[Window][Set overlap]
|
||||
Pos=500,31
|
||||
Size=300,70
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -11,10 +11,27 @@ struct collection{
|
||||
|
||||
|
||||
class CollectionInterface{
|
||||
protected:
|
||||
float transparency = 1.0;
|
||||
bool isVisible = true;
|
||||
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;
|
||||
};
|
||||
virtual bool getVisibility(){
|
||||
return isVisible;
|
||||
}
|
||||
virtual float getTransparency() {
|
||||
return transparency;
|
||||
}
|
||||
|
||||
virtual void setVisibility(bool c) {
|
||||
isVisible = c;
|
||||
}
|
||||
virtual ~CollectionInterface(){};
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
void setVisibility(bool c);
|
||||
bool setTransparency(float alpha) override;
|
||||
collection create(ReferencePlane plane) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -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,26 +60,10 @@ 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;
|
||||
/*
|
||||
for (auto i : sensori){
|
||||
totZ_Acc += i->getZ_Acc();
|
||||
}*/
|
||||
|
||||
totZ_Acc = sensori[0]->getZ_Acc() + sensori[1]->getZ_Acc();
|
||||
//printf("TotAccGamba %f\n", totZ_Acc);
|
||||
|
||||
return totZ_Acc;
|
||||
}
|
||||
@@ -18,42 +18,43 @@ Lower_Body::Lower_Body(rb::Vector3 pos,std::vector<gamba_data> data){
|
||||
collection Lower_Body::create(ReferencePlane plane){
|
||||
collection coll;
|
||||
|
||||
sx->setTransparency(1);
|
||||
dx->setTransparency(1);
|
||||
|
||||
sx->setTransparency(transparency);
|
||||
dx->setTransparency(transparency);
|
||||
t->setTransparency(transparency);
|
||||
|
||||
coll.joints.push_back(jsx);
|
||||
coll.joints.push_back(jdx);
|
||||
if (isVisible){
|
||||
coll.joints.push_back(jsx);
|
||||
coll.joints.push_back(jdx);
|
||||
|
||||
switch (plane)
|
||||
{
|
||||
case ReferencePlane::XZN:
|
||||
dx->setTransparency(0.5);
|
||||
dx->setDirection(Direction::L);
|
||||
sx->setDirection(Direction::R);
|
||||
coll = coll + dx->create(plane);
|
||||
coll = coll + sx->create(plane);
|
||||
break;
|
||||
case ReferencePlane::XZ:
|
||||
sx->setTransparency(0.5);
|
||||
dx->setDirection(Direction::R);
|
||||
sx->setDirection(Direction::L);
|
||||
coll = coll + sx->create(plane);
|
||||
coll = coll + dx->create(plane);
|
||||
break;
|
||||
case ReferencePlane::YZ:
|
||||
sx->setDirection(Direction::R);
|
||||
dx->setDirection(Direction::L);
|
||||
coll = coll + dx->create(plane);
|
||||
coll = coll + sx->create(plane);
|
||||
break;
|
||||
switch (plane)
|
||||
{
|
||||
case ReferencePlane::XZN:
|
||||
dx->setTransparency(0.5 * transparency);
|
||||
dx->setDirection(Direction::L);
|
||||
sx->setDirection(Direction::R);
|
||||
coll = coll + dx->create(plane);
|
||||
coll = coll + sx->create(plane);
|
||||
break;
|
||||
case ReferencePlane::XZ:
|
||||
sx->setTransparency(0.5 * transparency);
|
||||
dx->setDirection(Direction::R);
|
||||
sx->setDirection(Direction::L);
|
||||
coll = coll + sx->create(plane);
|
||||
coll = coll + dx->create(plane);
|
||||
break;
|
||||
case ReferencePlane::YZ:
|
||||
sx->setDirection(Direction::R);
|
||||
dx->setDirection(Direction::L);
|
||||
coll = coll + dx->create(plane);
|
||||
coll = coll + sx->create(plane);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
coll.pieces.push_back(t);
|
||||
}
|
||||
|
||||
coll.pieces.push_back(t);
|
||||
|
||||
return coll;
|
||||
}
|
||||
|
||||
@@ -65,16 +66,6 @@ Lower_Body::~Lower_Body(){
|
||||
delete jsx;
|
||||
}
|
||||
|
||||
void Lower_Body::setVisibility(bool c){
|
||||
|
||||
}
|
||||
|
||||
bool Lower_Body::setTransparency(float alpha){
|
||||
if (!sx->setTransparency(alpha)) return false;
|
||||
dx->setTransparency(alpha);
|
||||
t->setTransparency(alpha);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Lower_Body::update(sf::Clock cl, float multiplier){
|
||||
float sxAcc = sx->getZ_Acc() ;
|
||||
|
||||
+31
-5
@@ -5,6 +5,7 @@
|
||||
#include "collections/headers/collection_interface.hpp"
|
||||
#include <imgui.h>
|
||||
#include <imgui-SFML.h>
|
||||
#include <format>
|
||||
|
||||
template <typename T1, typename T2>
|
||||
double dist(sf::Vector2<T1> p1, sf::Vector2<T2> p2)
|
||||
@@ -300,7 +301,9 @@ void doGUI(State &gs)
|
||||
ImGuiWindowFlags_NoScrollbar|
|
||||
ImGuiWindowFlags_NoCollapse|
|
||||
ImGuiWindowFlags_NoTitleBar;
|
||||
|
||||
|
||||
|
||||
// Finestra gestione posizione dati
|
||||
ImGui::Begin("Set data position", 0,sdp_flags);
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.3);
|
||||
ImGui::SliderScalar("Start", ImGuiDataType_U32 ,gs.intervalMinLimit,&zero,gs.intervalMajLimit);
|
||||
@@ -345,9 +348,29 @@ void doGUI(State &gs)
|
||||
*gs.tMul = TimeMul[Timeid];
|
||||
ImGui::End();
|
||||
|
||||
//Finestra controllo sovrapposizione
|
||||
|
||||
|
||||
//Finestra controllo sovrapposizione (solo su collezioni)
|
||||
ImGui::Begin("Set overlap", 0,sdp_flags);
|
||||
int c = 0;
|
||||
for (auto i : gs.collections){
|
||||
std::stringstream s;
|
||||
s <<"Collezione :" << c;
|
||||
ImGui::Text(s.str().c_str());
|
||||
float tmpTr = i->getTransparency();
|
||||
if (ImGui::SliderFloat("Transparency ", &tmpTr,0.0,1.0)) {
|
||||
gs.updateCollections();
|
||||
i->setTransparency(tmpTr);
|
||||
}
|
||||
bool tmpVs = i->getVisibility();
|
||||
if (ImGui::Checkbox("is visible", &tmpVs)) {
|
||||
i->setVisibility(tmpVs);
|
||||
gs.updateCollections();
|
||||
}
|
||||
|
||||
|
||||
c++;
|
||||
ImGui::Separator();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
|
||||
sf::Vector2u wsize = gs.window.getSize();
|
||||
@@ -355,8 +378,11 @@ void doGUI(State &gs)
|
||||
ImGui::SetWindowSize("Set data position",ImVec2(wsize.x,30));
|
||||
ImGui::SetWindowPos("Set visualization plane",ImVec2(wsize.x-400,0));
|
||||
ImGui::SetWindowSize("Set visualization plane",ImVec2(400,30));
|
||||
ImGui::SetWindowPos("Set time multiplier",ImVec2(wsize.x-400,wsize.y - 60));
|
||||
ImGui::SetWindowPos("Set time multiplier",ImVec2(wsize.x-400,wsize.y - 61));
|
||||
ImGui::SetWindowSize("Set time multiplier",ImVec2(400,30));
|
||||
ImGui::SetWindowPos("Set overlap",ImVec2(wsize.x-300,31));
|
||||
ImGui::SetWindowSize("Set overlap",ImVec2(300,70*gs.collections.size()));
|
||||
|
||||
ImGui::SFML::Render(gs.window);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user