diff options
author | Jason Sams <rjsams@android.com> | 2009-12-23 14:35:29 -0800 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-12-23 14:35:29 -0800 |
commit | 718cd1f322ee5b62b6a49cb36195bcb18a5ab711 (patch) | |
tree | f2f8c9db5a8141eafa2f1547634d7586fdc6ef04 /graphics/java/android/renderscript/SimpleMesh.java | |
parent | ceedafacdb87307234c84196a12eeb6e657d6220 (diff) |
Element restructuring. Add support for new basic Element types including the RS objects and vectors(2-4). In theory this paves the way for maintaining type info for RS objects, passing elements for GLSL uiforms/attribs/varyings, and supporting nested structures.
This will break some apps, checkings for other projects will follow to unbreak them.
Diffstat (limited to 'graphics/java/android/renderscript/SimpleMesh.java')
-rw-r--r-- | graphics/java/android/renderscript/SimpleMesh.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java index f45074e23b24..8589a3e2898a 100644 --- a/graphics/java/android/renderscript/SimpleMesh.java +++ b/graphics/java/android/renderscript/SimpleMesh.java @@ -313,28 +313,38 @@ public class SimpleMesh extends BaseObj { public SimpleMesh create() { Element.Builder b = new Element.Builder(mRS); int floatCount = mVtxSize; - if (mVtxSize == 2) { - b.addFloatXY(); - } else { - b.addFloatXYZ(); - } + b.add(Element.createAttrib(mRS, + Element.DataType.FLOAT_32, + Element.DataKind.POSITION, + mVtxSize), "position"); if ((mFlags & COLOR) != 0) { floatCount += 4; - b.addFloatRGBA(); + b.add(Element.createAttrib(mRS, + Element.DataType.FLOAT_32, + Element.DataKind.COLOR, + 4), "color"); } if ((mFlags & TEXTURE_0) != 0) { floatCount += 2; - b.addFloatST(); + b.add(Element.createAttrib(mRS, + Element.DataType.FLOAT_32, + Element.DataKind.TEXTURE, + 2), "texture"); } if ((mFlags & NORMAL) != 0) { floatCount += 3; - b.addFloatNorm(); + b.add(Element.createAttrib(mRS, + Element.DataType.FLOAT_32, + Element.DataKind.NORMAL, + 3), "normal"); } mElement = b.create(); + android.util.Log.e("rs", "sm create size=" + (mVtxCount / floatCount) + ", count=" + mVtxCount); + Builder smb = new Builder(mRS); smb.addVertexType(mElement, mVtxCount / floatCount); - smb.setIndexType(Element.INDEX_16(mRS), mIndexCount); + smb.setIndexType(Element.createIndex(mRS), mIndexCount); smb.setPrimitive(Primitive.TRIANGLE); SimpleMesh sm = smb.create(); |