Esempio n. 1
0
        private void DrawTexturePlane()
        {
            //load in the texture map
            vtkBMPReader bmpReader = vtkBMPReader.New();

            bmpReader.SetFileName(@"..\..\Data\masonry.bmp");
            vtkTexture atext = vtkTexture.New();

            atext.SetInputConnection(bmpReader.GetOutputPort());
            atext.InterpolateOn();

            //create a plane source and actor
            vtkPlaneSource plane = vtkPlaneSource.New();

            plane.SetPoint1(0, 0, 0);
            vtkPolyDataMapper planeMapper = vtkPolyDataMapper.New();

            planeMapper.SetInputConnection(plane.GetOutputPort());
            vtkActor planeActor = vtkActor.New();

            planeActor.SetMapper(planeMapper);
            planeActor.SetTexture(atext);

            vtkRenderer     renderer = vtkRenderer.New();
            vtkRenderWindow renWin   = myRenderWindowControl.RenderWindow;

            renWin.AddRenderer(renderer);
            renderer.AddActor(planeActor);
        }
Esempio n. 2
0
        /// <summary>
        /// Loads the Rabbit model and textures
        /// into the algorithms and textures
        /// </summary>
        public void loadRabbit()
        {
            //Set a predefined position for the eyes
            //that matches the .blend file
            eyeX = 0.057;
            eyeY = -0.311;
            eyeZ = 1.879;

            //load the rabbit model and textures if
            //they are not already loaded
            if (!rabbitLoaded)
            {
                rabbitReader.SetFileName("../../../models/rabbit.vtk");
                rabbitReader.Update();
                eyeReader.SetFileName("../../../models/rabbit_eye.vtk");
                eyeReader.Update();
                rabbitColorReader.SetFileName("../../../textures/rabbit_skin_col.png");
                rabbitColorReader.Update();
                eyeColorReader.SetFileName("../../../textures/rabbit_eye.png");
                eyeColorReader.Update();
                rabbitLoaded = true;
            }
            //Set the algorithms and textures to the
            //ouput of the readers
            animalData = rabbitReader.GetOutputPort();

            eyeData1 = eyeReader.GetOutputPort();
            eyeData2 = eyeData1;

            animalColorTexture.InterpolateOn();
            animalColorTexture.SetInputConnection(rabbitColorReader.GetOutputPort());

            deciAnimalColorTexture.InterpolateOn();
            deciAnimalColorTexture.SetInputConnection(rabbitColorReader.GetOutputPort());

            eyeColorTexture1.InterpolateOn();
            eyeColorTexture1.SetInputConnection(eyeColorReader.GetOutputPort());

            deciEyeColorTexture1.InterpolateOn();
            deciEyeColorTexture1.SetInputConnection(eyeColorReader.GetOutputPort());

            eyeColorTexture2.InterpolateOn();
            eyeColorTexture2.SetInputConnection(eyeColorReader.GetOutputPort());

            deciEyeColorTexture2.InterpolateOn();
            deciEyeColorTexture2.SetInputConnection(eyeColorReader.GetOutputPort());
        }