ren->SetGradientBackground(1); //渐变色开关
ren->SetBackground(0.322, 0.341, 0.431); //颜色1
ren->SetBackground2(1.0, 1.0, 1.0); //颜色2
vtkCubeActor:
void Litho4D::showCubeActor(vtkCubeAxesActor * cubeActor)
{
cubeActor->SetCamera(ui.LithGlobalLWidget->getRenderer()->GetActiveCamera());
cubeActor->SetBounds(ui.LithGlobalLWidget->getRenderer()->ComputeVisiblePropBounds());
//开启x、y、z轴的网格线绘制
cubeActor->DrawXGridlinesOn();
cubeActor->DrawYGridlinesOn();
cubeActor->DrawZGridlinesOn();
//设置网格的颜色
cubeActor->GetXAxesGridlinesProperty()->SetColor(0, 0, 0);
cubeActor->GetYAxesGridlinesProperty()->SetColor(0, 0, 0);
cubeActor->GetZAxesGridlinesProperty()->SetColor(0, 0, 0);
cubeActor->GetTitleTextProperty(0)->SetColor(0, 0, 0);
cubeActor->GetTitleTextProperty(1)->SetColor(0, 0, 0);
cubeActor->GetTitleTextProperty(2)->SetColor(0, 0, 0);
cubeActor->GetLabelTextProperty(0)->SetColor(0, 0, 0);
cubeActor->GetLabelTextProperty(1)->SetColor(0, 0, 0);
cubeActor->GetLabelTextProperty(2)->SetColor(0, 0, 0);
cubeActor->GetXAxesLinesProperty()->SetColor(0, 0, 0);
cubeActor->GetYAxesLinesProperty()->SetColor(0, 0, 0);
cubeActor->GetZAxesLinesProperty()->SetColor(0, 0, 0);
//指定网格线呈现的样式
cubeActor->SetGridLineLocation(2);
// 不显示x、y、z轴的次刻度
cubeActor->XAxisMinorTickVisibilityOff();
cubeActor->YAxisMinorTickVisibilityOff();
cubeActor->ZAxisMinorTickVisibilityOff();
if (!IsShowAxis) {
IsShowAxis = 1;
cubeActor->SetVisibility(1);
}
else
{
IsShowAxis = 0;
cubeActor->SetVisibility(0);
}
ui.LithGlobalLWidget->getRenderer()->AddActor(cubeActor);
ui.LithGlobalLWidget->getRenderer()->ResetCamera();
ui.LithGlobalLWidget->GetRenderWindow()->Render();
}