vtk类之vtkTextureMapToPlane:纹理映射算法, 映射2D平面上的纹理
2013-01-07 19:32
681 查看
产生映射点集合到2D平面表面的纹理坐标
vtkTextureMapToPlane是一个筛选器,将 2D 纹理坐标生成映射输入的纹理数据集点至一个2D平面上。范围可以是用户指定或自动生成的。(2D平面是由自动生成计算2D平面的中心 )。请注意生成的纹理坐标 (0,1) 之间的范围。
实例:
运行结果:
vtkTextureMapToPlane是一个筛选器,将 2D 纹理坐标生成映射输入的纹理数据集点至一个2D平面上。范围可以是用户指定或自动生成的。(2D平面是由自动生成计算2D平面的中心 )。请注意生成的纹理坐标 (0,1) 之间的范围。
实例:
#-*- coding: UTF-8 -*- #------------------------------------------------------------------------------- # Name: 模块2 # Purpose: # # Author: ankier # # Created: 07-01-2013 # Copyright: (c) Ankier 2013 # Licence: <your licence> #------------------------------------------------------------------------------- from ActorFactory import ActorFactory from vtk import * class TextureMapToPlaneActorFactory(ActorFactory): def __init__(self): ActorFactory.__init__(self) #定义一块板子 self.__PlaneSource = vtkPlaneSource() self.__PlaneSource.SetOrigin(-50, -50, 0) self.__PlaneSource.SetPoint1(50, -50 , 0) self.__PlaneSource.SetPoint2(-50 , 50 , 0) self.__PlaneSource.SetXResolution(50) self.__PlaneSource.SetYResolution(50) #设置板子的纹理映射类 self.__TexturePlane= vtkTextureMapToPlane() self.__TexturePlane.SetInput(self.__PlaneSource.GetOutput()) #设置纹理类。 self.__Texture = vtkTexture() self.__Texture.InterpolateOn() #设置Poly Data,从纹理映射器重,得到被filter的输出数据 self.__PolyDataMapper = vtkPolyDataMapper() self.__PolyDataMapper.SetInput(self.__TexturePlane.GetOutput()) def __del__(self): del self.__PolyDataMapper del self.__Texture def __ReadJPEG(self): read = vtkJPEGReader() read.SetFileName("D:\\girl.jpg") self.__Texture.SetInput(read.GetOutput()) def _MakeActors(self): self.__ReadJPEG() actor = self._NewActor() actor.SetMapper(self.__PolyDataMapper) actor.SetTexture(self.__Texture) return [actor]
运行结果:
相关文章推荐
- vtk类之vtkTextureMapToCylinder:纹理映射算法, 映射圆柱体纹理
- VTK纹理映射之vtkTransformTextureCoods
- 二维纹理 Texture 2D
- 【Visual C++】游戏开发笔记三十 DirectX11 2D纹理映射知识全攻略
- 渲染到纹理(Render To Texture, RTT)详解
- vtk类之vtkPlaneSource:创建一个平面的poly data
- AtCoder Regular Contest 092 C - 2D Plane 2N Points 贪心 匈牙利算法模板
- 渲染到纹理(Render To Texture, RTT)详解
- VTK图形处理之自定义纹理映射Filter
- 什么是渲染目标(render target)&& 渲染到纹理(Render To Texture, RTT)详解
- vtk类之vtkPlane:用法向量和原点决定一个立体控件中平面的隐函数的一个实现
- hibernate一对多映射时异常Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @Collection
- Unity 用户手册用户指南二维纹理 (Texture 2D)
- OGRE Demo_RenderToTexture 渲染到纹理
- Android_mapValueFromRangeToRange_值映射_解析
- 【Visual C++】游戏开发笔记三十 DirectX11 2D纹理映射知识全攻略
- 【AtCoder Regular Contest 092】C.2D Plane 2N Points(二分图匹配,匈牙利算法)
- AtCoder Regular Contest 092 C - 2D Plane 2N Points 贪心 匈牙利算法模板
- OGRE Demo_RenderToTexture 渲染到纹理
- AtCoder - 2D Plane 2N Points 二分图匹配 匈牙利算法模版