Move an element from the server by changing only its transformation.
One box stands still in the centre. Four boxes go round a square about it, a step every 200 ms, each moved by SetTransMatrix(), which streams only the new matrix. The client moves the objects it already has and rebuilds no geometry.
#include <vector>
{
case 0:
break;
case 1:
break;
case 2:
break;
default:
break;
}
}
class REveTransMover :
public TTimer {
std::vector<REveElement*> fEls;
int fStep{0};
public:
REveTransMover(std::vector<REveElement *> els,
Long_t ms) :
TTimer(ms,
kTRUE), fEls(std::move(els)) {}
{
for (size_t i = 0; i < fEls.size(); ++i) {
square_pos(0.02 * fStep + i, 40,
x,
y);
fEls[i]->SetTransMatrix(t.Array());
}
++fStep;
}
};
{
b->SetMainTransparency(0);
b->SetVertex(0, -
a, -
a, z -
a);
b->SetVertex(1, -
a,
a, z -
a);
b->SetVertex(2,
a,
a, z -
a);
b->SetVertex(3,
a, -
a, z -
a);
b->SetVertex(4, -
a, -
a, z +
a);
b->SetVertex(5, -
a,
a, z +
a);
b->SetVertex(6,
a,
a, z +
a);
b->SetVertex(7,
a, -
a, z +
a);
}
void trans_update()
{
auto eveMng = REveManager::Create();
eveMng->AllowMultipleRemoteConnections(false, false);
auto still = make_box(
"Still",
kCyan, 10, 0);
eveMng->GetEventScene()->AddElement(still);
std::vector<REveElement *> movers;
for (int i = 0; i < 4; ++i) {
auto mover = make_box(
Form(
"Mover %d", i), colors[i], 6, 0);
mover->InitMainTrans();
eveMng->GetEventScene()->AddElement(mover);
movers.push_back(mover);
}
eveMng->Show();
auto timer = new REveTransMover(movers, 200);
timer->Notify();
timer->TurnOn();
}
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
short Color_t
Color number (short)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
float Float_t
Float 4 bytes (float)
double Double_t
Double 8 bytes.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
3D box with arbitrary vertices (cuboid).
RAII guard for locking Eve manager (ctor) and processing changes (dtor).
REveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
Bool_t Notify() override
Notify when timer times out.
Namespace for ROOT features in testing.
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
- Author
- Matevz Tadel
Definition in file trans_update.C.