RenderScript(google API)

RenderScript

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

Element

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

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

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

        元素 的主要来源 是 从脚本 。 出口 绑定 点 数据 结构 的脚本 生成 一个 的 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/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值