diff --git a/src/Vtk/Math/vtkContainerBox.cpp b/src/Vtk/Math/vtkContainerBox.cpp index ac9bf89..15e337e 100644 --- a/src/Vtk/Math/vtkContainerBox.cpp +++ b/src/Vtk/Math/vtkContainerBox.cpp @@ -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 m; Matrix4fToVtk(this->m_model->GetMatrix(), m); prop->SetUserMatrix(m); prop->Modified(); } + // Apply the local shape transformation (Size/Origin) to the cube actor + vtkNew 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 mapper = vtkSmartPointer::New(); vtkSmartPointer cube = vtkSmartPointer::New(); - vtkSmartPointer mapper = - vtkSmartPointer::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);