fix container box representation ( fix it )
This commit is contained in:
@@ -65,6 +65,7 @@ ContainerBox::ContainerBox(ContainerBox::Content *content)
|
||||
this->InstallPipe();
|
||||
d->m_UpdateSignal = Object::connect(
|
||||
this->m_model.get(), &uLib::Object::Updated, this, &ContainerBox::Update);
|
||||
this->Update();
|
||||
}
|
||||
|
||||
ContainerBox::~ContainerBox() { delete d; }
|
||||
@@ -81,13 +82,18 @@ void ContainerBox::Update() {
|
||||
|
||||
vtkProp3D *prop = vtkProp3D::SafeDownCast(this->GetProp());
|
||||
if (prop) {
|
||||
// Apply the full volume matrix (TRS * m_LocalT)
|
||||
// Apply the TRS matrix to the assembly
|
||||
vtkNew<vtkMatrix4x4> m;
|
||||
Matrix4fToVtk(this->m_model->GetMatrix(), m);
|
||||
prop->SetUserMatrix(m);
|
||||
prop->Modified();
|
||||
}
|
||||
|
||||
// Apply the local shape transformation (Size/Origin) to the cube actor
|
||||
vtkNew<vtkMatrix4x4> localM;
|
||||
Matrix4fToVtk(this->m_model->GetLocalMatrix(), localM);
|
||||
d->m_Cube->SetUserMatrix(localM);
|
||||
|
||||
// Delegate rest of update (appearance, render, etc)
|
||||
ConnectionBlock blocker(d->m_UpdateSignal);
|
||||
this->Prop3D::Update();
|
||||
@@ -121,11 +127,11 @@ void ContainerBox::InstallPipe() {
|
||||
Content *c = this->m_model;
|
||||
|
||||
// CUBE
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper =
|
||||
vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
cube->SetBounds(0, 1, 0, 1, 0, 1);
|
||||
// cube->SetBounds(-0.5, 0.5, -0.5, 0.5, -0.5, 0.5);
|
||||
mapper->SetInputConnection(cube->GetOutputPort());
|
||||
mapper->Update();
|
||||
d->m_Cube->SetMapper(mapper);
|
||||
|
||||
Reference in New Issue
Block a user