本文整理汇总了C#中vtkRenderWindow.GetRenderers方法的典型用法代码示例。如果您正苦于以下问题:C# vtkRenderWindow.GetRenderers方法的具体用法?C# vtkRenderWindow.GetRenderers怎么用?C# vtkRenderWindow.GetRenderers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtkRenderWindow
的用法示例。
在下文中一共展示了vtkRenderWindow.GetRenderers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainPaltform_Load
// Trigger hook events
private void MainPaltform_Load(object sender, EventArgs e)
{
m_RenderWindow = renderWindowControl1.RenderWindow;
m_Renderer = m_RenderWindow.GetRenderers().GetFirstRenderer();
this.HookEvents();
}
示例2: ReadSTL
/// <summary>
/// 读取stl文件,并在窗口进行显示,并设置全局变量originalMesh
/// </summary>
private void ReadSTL()
{
//Path to vtk data must be set as an environment variable
//VTK_DATA_ROOT=""
vtkSTLReader reader = vtkSTLReader.New();
reader.SetFileName(FileFullName);
reader.Update();
mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(reader.GetOutputPort());
actor = vtkActor.New();
actor.SetMapper(mapper);
//get a reference to the renderwindow of our renderWindowControll
renderWindow = renderWindowControl1.RenderWindow;
//renderer
renderer = renderWindow.GetRenderers().GetFirstRenderer();
//移除之前所有prop
renderer.RemoveAllViewProps();
//set background color
renderer.SetBackground(0.2, 0.3, 0.4);
//add our actor to the renderer
renderer.AddActor(actor);
originalMesh = vtkPolyData.New();
originalMesh.DeepCopy(reader.GetOutput());
tb_numOfPoint.Text = originalMesh.GetNumberOfPoints().ToString();
//creat a cell picker
picker = vtkCellPicker.New();
vtkRenderWindowInteractor iren = renderWindow.GetInteractor();
iren.SetPicker(picker);
renderer.ResetCamera();
renderWindow.Render();
}
示例3: Simulation
public Simulation(vtkRenderWindow renderWindow)
{
RenderWindow = renderWindow;
Renderer = renderWindow.GetRenderers().GetFirstRenderer();
//Background
Renderer.GradientBackgroundOn();
Renderer.SetBackground((double)colorBackground.R / 255, (double)colorBackground.G / 255, (double)colorBackground.B / 255);
Renderer.SetBackground2((double)colorBackground2.R / 255, (double)colorBackground2.G / 255, (double)colorBackground2.B / 255);
//Base
baseAxes.SetTotalLength(200, 200, 200);
baseAxes.AxisLabelsOff();
Renderer.AddActor(baseAxes);
//Floor
vtkPlaneSource planeSource = vtkPlaneSource.New();
planeSource.SetOrigin(-1000.0, -1000.0, 0);
planeSource.SetPoint1(-1000.0, 1000.0, 0);
planeSource.SetPoint2(1000.0, -1000.0, 0);
planeSource.Update();
vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
vtkPolyData plane = planeSource.GetOutput();
mapper.SetInput(plane);
floor = vtkActor.New();
floor.SetMapper(mapper);
floor.GetProperty().SetColor(0.8, 0.8, 0.8);
Renderer.AddActor(floor);
//Robot1
robot1Pos = new Position(-500, 0, 0, 0, 0, 0);
//Robots.Robot1.Base = new Position(-500, 0, 0, 0, 0, 0);
robot1part1 = LoadSTL(robot1part1, @"\Robot\agilus_00.stl", Color.FromArgb(25, 25, 25));
robot1part2 = LoadSTL(robot1part2, @"\Robot\agilus_01.stl", Color.FromArgb(255, 110, 0));
robot1part3 = LoadSTL(robot1part3, @"\Robot\agilus_02.stl", Color.FromArgb(255, 110, 0));
robot1part4 = LoadSTL(robot1part4, @"\Robot\agilus_03.stl", Color.FromArgb(255, 110, 0));
robot1part5 = LoadSTL(robot1part5, @"\Robot\agilus_04.stl", Color.FromArgb(255, 110, 0));
robot1part6 = LoadSTL(robot1part6, @"\Robot\agilus_05.stl", Color.FromArgb(255, 110, 0));
robot1part7 = LoadSTL(robot1part6, @"\Robot\agilus_06.stl", Color.DarkGray);
robot1part1.SetPosition(robot1Pos.X, robot1Pos.Y, robot1Pos.Z);
Renderer.AddActor(robot1part1);
Renderer.AddActor(robot1part2);
Renderer.AddActor(robot1part3);
Renderer.AddActor(robot1part4);
Renderer.AddActor(robot1part5);
Renderer.AddActor(robot1part6);
Renderer.AddActor(robot1part7);
robot1axes1.SetTotalLength(200, 200, 200);
robot1axes1.AxisLabelsOff();
Renderer.AddActor(robot1axes1);
robot1axes2.SetTotalLength(200, 200, 200);
robot1axes2.AxisLabelsOff();
Renderer.AddActor(robot1axes2);
robot1axes3.SetTotalLength(200, 200, 200);
robot1axes3.AxisLabelsOff();
Renderer.AddActor(robot1axes3);
robot1axes4.SetTotalLength(200, 200, 200);
robot1axes4.AxisLabelsOff();
Renderer.AddActor(robot1axes4);
robot1axes5.SetTotalLength(200, 200, 200);
robot1axes5.AxisLabelsOff();
Renderer.AddActor(robot1axes5);
robot1axes6.SetTotalLength(200, 200, 200);
robot1axes6.AxisLabelsOff();
Renderer.AddActor(robot1axes6);
//Robot2
robot2Pos = new Position(1000, 0, 0, 0, 0, 0);
Robots.Robot2.Base = robot2Pos;
robot2part1 = LoadSTL(robot2part1, @"\Robot\agilus_00.stl", Color.FromArgb(25, 25, 25));
robot2part2 = LoadSTL(robot2part2, @"\Robot\agilus_01.stl", Color.FromArgb(255, 110, 0));
robot2part3 = LoadSTL(robot2part3, @"\Robot\agilus_02.stl", Color.FromArgb(255, 110, 0));
robot2part4 = LoadSTL(robot2part4, @"\Robot\agilus_03.stl", Color.FromArgb(255, 110, 0));
robot2part5 = LoadSTL(robot2part5, @"\Robot\agilus_04.stl", Color.FromArgb(255, 110, 0));
robot2part6 = LoadSTL(robot2part6, @"\Robot\agilus_05.stl", Color.FromArgb(255, 110, 0));
robot2part7 = LoadSTL(robot2part6, @"\Robot\agilus_06.stl", Color.DarkGray);
robot2part1.SetPosition(Robots.Robot2.Base.X, Robots.Robot2.Base.Y, Robots.Robot2.Base.Z);
Renderer.AddActor(robot2part1);
Renderer.AddActor(robot2part2);
Renderer.AddActor(robot2part3);
Renderer.AddActor(robot2part4);
Renderer.AddActor(robot2part5);
Renderer.AddActor(robot2part6);
Renderer.AddActor(robot2part7);
robot2axes1.SetTotalLength(200, 200, 200);
robot2axes1.AxisLabelsOff();
Renderer.AddActor(robot2axes1);
robot2axes2.SetTotalLength(200, 200, 200);
robot2axes2.AxisLabelsOff();
Renderer.AddActor(robot2axes2);
robot2axes3.SetTotalLength(200, 200, 200);
robot2axes3.AxisLabelsOff();
Renderer.AddActor(robot2axes3);
robot2axes4.SetTotalLength(200, 200, 200);
robot2axes4.AxisLabelsOff();
Renderer.AddActor(robot2axes4);
robot2axes5.SetTotalLength(200, 200, 200);
robot2axes5.AxisLabelsOff();
Renderer.AddActor(robot2axes5);
//.........这里部分代码省略.........