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/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章