RenderScript(google API)

RenderScript

RenderScript是一个基类。这个类的一个对象创建本地工作线程,用于处理来自这些对象的命令。该基类不提供任何,提供简单数据处理能力类的扩展。对于扩展功能使用派生类如RenderScriptGL

Element

        RenderScript最基本的数据类型一个元素代表一个内存分配一个单元格元素是Renderscript的基本数据类型
一个元素可以有两种形式:基本元素复杂的形式

作为基本元素
    ?单精度浮点数
    ?4浮点矢量
    ?RGB-565
    ?unsigned int类型16

        复杂的元素包含的子元素和名称的列表,表示的结构的数据可以访问的字段名称从脚本或着色定义的内存布局和有序数据对齐最基本的原始类型一个float4载体对准与sizeof(浮动)不是sizeoffloat4的在内存中元素的顺序它们被添加的顺序,根据需要与每个组件对齐无需重新排序将得到伸张。

        元素的主要来源从脚本出口绑定数据结构的脚本生成一个Renderscript元素代表由脚本导出的数据其他常见元素的来源是从位图格式


Type

Type 是一个配置模版,用来获取一些内存分配的信息,但不分配任何数据内存。他包含一个Element、一个或者很多的维度信息。

一个Type对象包含很多的维度信息,这些维度信息为X、Y、Z,LOD(Lever of detail);面(faces of a cube map).如果X=10,y=0,z=0则数据会被看作是一维数据。

LOD和面尺寸为布尔值,表示存在或不存在。



Allocation

Allocation是为renderscript分配内存的类。一个Allocation绑定了一个Type来提供用户数据存储和对象存储。这意味着,在renderscript中,所有的内存分配都由Allocation分配。

数据分配的主要方式是:对于Script脚本,数据的移如和移出。内存是用户的同步,可能存在很多的内存空间。目前这些空间是:

Script: 可被RS Scripts使用的
Graphics Texture: 对于图形纹理是可用的
Graphics Vertex:对于图形定点数据是可用的 
Graphics Constants: 对于用户着色器中的常量是可用的

例如,当创建一个分配的纹理时,用户可以指定它的内存空间作为脚本和手感。这意味着它可以被用作脚本具有约束力,且作为GPU的纹理进行渲染。脚本修改保持同步,如果使用其他的目标,它必须调用同步功能将更新推到内存的分配,否则的结果是不确定的。 

默认情况下,Android系统端更新总是??应用于脚本accessable内存的。如果不存在,然后,它们被应用到各种硬件类型的存储器。 àsyncAll()调用是必要的脚本数据后同步更新,以保持其他内存空间。 

配置数据上传两种主要方式之一。对于简单的阵列的copyfrom()函数,数组从控制代码,将它复制到从内存存储。这两种类型的检查,未选中的文件的副本提供。未经检验的变种存在,允许应用程序从控制语言不支持结构的结构数组复制。 



Allocation.MipmapControl

Controls mipmap behavior when using the bitmap creation and update functions. 
当用bitmap图片创建和更新时,控制图片的Mipmap图形属性

MIPMAP_FULL:  A Full mipmap chain will be created in script memory.  
MIPMAP_NONE:  No mipmaps will be generated and the type generated from the incoming bitmap will not contain additional LODs.  
MIPMAP_ON_SYNC_TO_TEXTURE:  The type of the allocation will be the same as MIPMAP_NONE.  

 

RenderScriptGL

RenderScript的图形派生类。扩展基类去增加Root脚本,RenderScriptGL用于显示图形输出。当系统需要更新显示当前绑定的根脚本将被调用。预计发行此脚本渲染命令重绘屏幕。


RenderScriptGL.SurfaceConfig

这个类是用来描述一个图形缓冲区的像素格式。这是用来描述的预定格式的显示表面。描述了配置内每个组件的最小和首选位深度对配置和额外的结构信息。

ProgramFragmentFixedFunction

ProgramFragmentFixedFunction is a helper class that provides a way to make a simple fragment shader without writing any GLSL code. This class allows for display of constant color, interpolated color from the vertex shader, or combinations of the both blended with results of up to two texture lookups.


Mesh

This class is a container for geometric data displayed with Renderscript. Internally, a mesh is a collection of allocations that represent vertex data (positions, normals, texture coordinates) and index data such as triangles and lines. 

Vertex data could either be interleaved within one allocation that is provided separately, as multiple allocation objects, or done as a combination of both. When a vertex channel name matches an input in the vertex program, Renderscript automatically connects the two together. 

Parts of the mesh can be rendered with either explicit index sets or primitive types. 


Mesh.AllocationBuilder

Mesh builder object. It starts empty and requires the user to add all the vertex and index allocations that comprise the mesh 

 
Mesh.Primitive

确定绘制方式

以下是几种绘制方式:

POINT
LINE
LINE_STRIP
TRIANGLE
TRIANGLE_FAN
TRIANGLE_STRIP
 

尊重劳动成果,转载请保留出处:
http://xiaxveliang.blog.163.com/blog/static/2970803420139844152392/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章