Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5af236ad44 | |||
| 7fadd4a9ef | |||
| 5588ccee31 | |||
| c48d0505fc | |||
| 2dfd574814 |
+1
-1
@@ -53,7 +53,7 @@ target_compile_options(common INTERFACE
|
|||||||
|
|
||||||
set(METHODS_PATH "./src/*/methods/*.cpp")
|
set(METHODS_PATH "./src/*/methods/*.cpp")
|
||||||
|
|
||||||
set(VERSION "V10")
|
set(VERSION "V11")
|
||||||
|
|
||||||
file(GLOB_RECURSE METHODS_SRC "${METHODS_PATH}")
|
file(GLOB_RECURSE METHODS_SRC "${METHODS_PATH}")
|
||||||
add_executable(main${VERSION} ./src/Main.cpp ${METHODS_SRC} )
|
add_executable(main${VERSION} ./src/Main.cpp ${METHODS_SRC} )
|
||||||
|
|||||||
@@ -58,16 +58,20 @@ 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
|
- Modificata la funzione update di pezzi e collezioni per implementare controllo sul tempo
|
||||||
- Aggiunta finestra con slider per selezione moltiplicatore del tempo
|
- Aggiunta finestra con slider per selezione moltiplicatore del tempo
|
||||||
|
|
||||||
## Nella versione v0.10
|
## Nella versione v1.0
|
||||||
- Aggiunta controllo texture
|
- Aggiunta controllo texture
|
||||||
- Aggiunta pavimento
|
- Aggiunta pavimento
|
||||||
- Refactoring generale
|
- Refactoring generale
|
||||||
- Definizione main finale (non più di test)
|
- Definizione main finale (non più di test)
|
||||||
|
|
||||||
|
## Nella versione v1.1
|
||||||
|
- Aggiunta controllo visibilità collezioni su GUI
|
||||||
|
- Refactoring collezioni
|
||||||
|
|
||||||
# Per compilare:
|
# Per compilare:
|
||||||
|
|
||||||
cmake --build
|
cmake --build
|
||||||
|
|
||||||
# Per lanciare:
|
# Per lanciare:
|
||||||
|
|
||||||
./build/bin/mainV10
|
./build/bin/mainV11
|
||||||
|
|||||||
+8
-4
@@ -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,14 @@ 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,639
|
||||||
Size=400,30
|
Size=400,30
|
||||||
|
|
||||||
|
[Window][Set overlap]
|
||||||
|
Pos=500,31
|
||||||
|
Size=300,70
|
||||||
|
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
@@ -11,10 +11,27 @@ 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) {
|
||||||
|
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(){};
|
virtual ~CollectionInterface(){};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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;
|
||||||
void setVisibility(bool c);
|
|
||||||
bool setTransparency(float alpha) override;
|
|
||||||
collection create(ReferencePlane plane) 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 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,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 Gamba::getZ_Acc(){
|
||||||
|
|
||||||
float totZ_Acc = 0;
|
float totZ_Acc = 0;
|
||||||
/*
|
|
||||||
for (auto i : sensori){
|
|
||||||
totZ_Acc += i->getZ_Acc();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
totZ_Acc = sensori[0]->getZ_Acc() + sensori[1]->getZ_Acc();
|
totZ_Acc = sensori[0]->getZ_Acc() + sensori[1]->getZ_Acc();
|
||||||
//printf("TotAccGamba %f\n", totZ_Acc);
|
|
||||||
|
|
||||||
return 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 Lower_Body::create(ReferencePlane plane){
|
||||||
collection coll;
|
collection coll;
|
||||||
|
|
||||||
sx->setTransparency(1);
|
sx->setTransparency(transparency);
|
||||||
dx->setTransparency(1);
|
dx->setTransparency(transparency);
|
||||||
|
t->setTransparency(transparency);
|
||||||
|
|
||||||
|
if (isVisible){
|
||||||
|
coll.joints.push_back(jsx);
|
||||||
|
coll.joints.push_back(jdx);
|
||||||
|
|
||||||
coll.joints.push_back(jsx);
|
switch (plane)
|
||||||
coll.joints.push_back(jdx);
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
switch (plane)
|
default:
|
||||||
{
|
break;
|
||||||
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;
|
|
||||||
|
|
||||||
default:
|
coll.pieces.push_back(t);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
coll.pieces.push_back(t);
|
|
||||||
|
|
||||||
return coll;
|
return coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,16 +66,6 @@ Lower_Body::~Lower_Body(){
|
|||||||
delete jsx;
|
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){
|
void Lower_Body::update(sf::Clock cl, float multiplier){
|
||||||
float sxAcc = sx->getZ_Acc() ;
|
float sxAcc = sx->getZ_Acc() ;
|
||||||
|
|||||||
+28
-2
@@ -5,6 +5,7 @@
|
|||||||
#include "collections/headers/collection_interface.hpp"
|
#include "collections/headers/collection_interface.hpp"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <imgui-SFML.h>
|
#include <imgui-SFML.h>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
template <typename T1, typename T2>
|
||||||
double dist(sf::Vector2<T1> p1, sf::Vector2<T2> p2)
|
double dist(sf::Vector2<T1> p1, sf::Vector2<T2> p2)
|
||||||
@@ -301,6 +302,8 @@ void doGUI(State &gs)
|
|||||||
ImGuiWindowFlags_NoCollapse|
|
ImGuiWindowFlags_NoCollapse|
|
||||||
ImGuiWindowFlags_NoTitleBar;
|
ImGuiWindowFlags_NoTitleBar;
|
||||||
|
|
||||||
|
|
||||||
|
// Finestra gestione posizione dati
|
||||||
ImGui::Begin("Set data position", 0,sdp_flags);
|
ImGui::Begin("Set data position", 0,sdp_flags);
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.3);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.3);
|
||||||
ImGui::SliderScalar("Start", ImGuiDataType_U32 ,gs.intervalMinLimit,&zero,gs.intervalMajLimit);
|
ImGui::SliderScalar("Start", ImGuiDataType_U32 ,gs.intervalMinLimit,&zero,gs.intervalMajLimit);
|
||||||
@@ -345,9 +348,29 @@ void doGUI(State &gs)
|
|||||||
*gs.tMul = TimeMul[Timeid];
|
*gs.tMul = TimeMul[Timeid];
|
||||||
ImGui::End();
|
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();
|
sf::Vector2u wsize = gs.window.getSize();
|
||||||
@@ -355,8 +378,11 @@ void doGUI(State &gs)
|
|||||||
ImGui::SetWindowSize("Set data position",ImVec2(wsize.x,30));
|
ImGui::SetWindowSize("Set data position",ImVec2(wsize.x,30));
|
||||||
ImGui::SetWindowPos("Set visualization plane",ImVec2(wsize.x-400,0));
|
ImGui::SetWindowPos("Set visualization plane",ImVec2(wsize.x-400,0));
|
||||||
ImGui::SetWindowSize("Set visualization plane",ImVec2(400,30));
|
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::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);
|
ImGui::SFML::Render(gs.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user