diff options
| author | Alex Sakhartchouk <alexst@google.com> | 2010-07-01 17:10:01 -0700 |
|---|---|---|
| committer | Alex Sakhartchouk <alexst@google.com> | 2010-07-01 17:10:01 -0700 |
| commit | 359f0324a761abae0977a35c0e072e409aecd544 (patch) | |
| tree | affe898eb3c3705aaa5122e8d8055f073cc859f9 /src/com/android/wallpaper | |
| parent | 977561203a4e03bd7adaf3764a4400301ac60b6c (diff) | |
| download | android_packages_wallpapers_Basic-359f0324a761abae0977a35c0e072e409aecd544.tar.gz android_packages_wallpapers_Basic-359f0324a761abae0977a35c0e072e409aecd544.tar.bz2 android_packages_wallpapers_Basic-359f0324a761abae0977a35c0e072e409aecd544.zip | |
Removing SimpleMesh out of wallpapers.
Change-Id: Id1d941a6aa7db07a055b893a393fa2b26afedac1
Diffstat (limited to 'src/com/android/wallpaper')
| -rw-r--r-- | src/com/android/wallpaper/fall/FallRS.java | 10 | ||||
| -rw-r--r-- | src/com/android/wallpaper/fall/ScriptC_Fall.java | 6 | ||||
| -rw-r--r-- | src/com/android/wallpaper/galaxy/GalaxyRS.java | 13 | ||||
| -rw-r--r-- | src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java | 6 | ||||
| -rw-r--r-- | src/com/android/wallpaper/grass/GrassRS.java | 19 | ||||
| -rw-r--r-- | src/com/android/wallpaper/grass/ScriptC_Grass.java | 6 |
6 files changed, 28 insertions, 32 deletions
diff --git a/src/com/android/wallpaper/fall/FallRS.java b/src/com/android/wallpaper/fall/FallRS.java index c3ce5b4..1029d7e 100644 --- a/src/com/android/wallpaper/fall/FallRS.java +++ b/src/com/android/wallpaper/fall/FallRS.java @@ -25,7 +25,7 @@ import android.renderscript.ProgramVertex; import android.renderscript.Allocation; import android.renderscript.Sampler; import android.renderscript.Type; -import android.renderscript.SimpleMesh; +import android.renderscript.Mesh; import android.renderscript.Script; import static android.renderscript.Sampler.Value.LINEAR; import static android.renderscript.Sampler.Value.CLAMP; @@ -80,7 +80,7 @@ class FallRS extends RenderScriptScene { private int mMeshHeight; @SuppressWarnings({"FieldCanBeLocal"}) - private SimpleMesh mMesh; + private Mesh mMesh; private WorldState mWorldState; private ScriptC_Fall mScript; @@ -159,7 +159,7 @@ class FallRS extends RenderScriptScene { } private void createMesh() { - SimpleMesh.TriangleMeshBuilder tmb = new SimpleMesh.TriangleMeshBuilder(mRS, 2, 0); + Mesh.TriangleMeshBuilder tmb = new Mesh.TriangleMeshBuilder(mRS, 2, 0); final int width = mWidth > mHeight ? mHeight : mWidth; final int height = mWidth > mHeight ? mWidth : mHeight; @@ -195,7 +195,7 @@ class FallRS extends RenderScriptScene { } } - mMesh = tmb.create(); + mMesh = tmb.create(true); mMeshWidth = wResolution + 1; mMeshHeight = hResolution + 1; @@ -371,7 +371,7 @@ class FallRS extends RenderScriptScene { sb.setShader(t); sb.addConstant(mUniformAlloc.getType()); - sb.addInput(mMesh.getVertexType(0).getElement()); + sb.addInput(mMesh.getVertexAllocation(0).getType().getElement()); mPvWater = sb.create(); mPvWater.bindAllocation(mPvOrthoAlloc); mPvWater.bindConstants(mUniformAlloc, 1); diff --git a/src/com/android/wallpaper/fall/ScriptC_Fall.java b/src/com/android/wallpaper/fall/ScriptC_Fall.java index 61ed4d7..a67f531 100644 --- a/src/com/android/wallpaper/fall/ScriptC_Fall.java +++ b/src/com/android/wallpaper/fall/ScriptC_Fall.java @@ -192,13 +192,13 @@ public class ScriptC_Fall extends ScriptC { } private final static int mExportVarIdx_g_WaterMesh = 15; - private SimpleMesh mExportVar_g_WaterMesh; - public void set_g_WaterMesh(SimpleMesh v) { + private Mesh mExportVar_g_WaterMesh; + public void set_g_WaterMesh(Mesh v) { mExportVar_g_WaterMesh = v; setVar(mExportVarIdx_g_WaterMesh, (v == null) ? 0 : v.getID()); } - public SimpleMesh get_g_WaterMesh() { + public Mesh get_g_WaterMesh() { return mExportVar_g_WaterMesh; } diff --git a/src/com/android/wallpaper/galaxy/GalaxyRS.java b/src/com/android/wallpaper/galaxy/GalaxyRS.java index 429e159..89daa40 100644 --- a/src/com/android/wallpaper/galaxy/GalaxyRS.java +++ b/src/com/android/wallpaper/galaxy/GalaxyRS.java @@ -24,7 +24,7 @@ import android.renderscript.ProgramRaster; import android.renderscript.Allocation; import android.renderscript.Sampler; import android.renderscript.Element; -import android.renderscript.SimpleMesh; +import android.renderscript.Mesh; import android.renderscript.Primitive; import android.renderscript.Type; import static android.renderscript.ProgramStore.DepthFunc.*; @@ -44,7 +44,7 @@ class GalaxyRS extends RenderScriptScene { private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options(); private ProgramVertex.MatrixAllocation mPvOrthoAlloc; private ProgramVertex.MatrixAllocation mPvProjectionAlloc; - private SimpleMesh mParticlesMesh; + private Mesh mParticlesMesh; private ScriptC_Galaxy mScript; GalaxyRS(int width, int height) { @@ -77,14 +77,13 @@ class GalaxyRS extends RenderScriptScene { private void createParticlesMesh() { ScriptField_Particle p = new ScriptField_Particle(mRS, PARTICLES_COUNT); - final SimpleMesh.Builder meshBuilder = new SimpleMesh.Builder(mRS); - final int vertexSlot = meshBuilder.addVertexType(p.getType()); - meshBuilder.setPrimitive(Primitive.POINT); + final Mesh.AllocationBuilder meshBuilder = new Mesh.AllocationBuilder(mRS); + final int vertexSlot = meshBuilder.addVertexAllocation(p.getAllocation()); + meshBuilder.addIndexType(Primitive.POINT); mParticlesMesh = meshBuilder.create(); mScript.set_gParticlesMesh(mParticlesMesh); mScript.bind_Particles(p); - mParticlesMesh.bindVertexAllocation(p.getAllocation(), 0); } @Override @@ -184,7 +183,7 @@ class GalaxyRS extends RenderScriptScene { " varColor.a = 1.0;\n" + "}\n"; sb.setShader(t); - sb.addInput(mParticlesMesh.getVertexType(0).getElement()); + sb.addInput(mParticlesMesh.getVertexAllocation(0).getType().getElement()); ProgramVertex pvs = sb.create(); pvs.bindAllocation(mPvProjectionAlloc); mScript.set_gPVStars(pvs); diff --git a/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java b/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java index 05def7c..01c1a9b 100644 --- a/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java +++ b/src/com/android/wallpaper/galaxy/ScriptC_Galaxy.java @@ -137,13 +137,13 @@ public class ScriptC_Galaxy extends ScriptC { } private final static int mExportVarIdx_gParticlesMesh = 10; - private SimpleMesh mExportVar_gParticlesMesh; - public void set_gParticlesMesh(SimpleMesh v) { + private Mesh mExportVar_gParticlesMesh; + public void set_gParticlesMesh(Mesh v) { mExportVar_gParticlesMesh = v; setVar(mExportVarIdx_gParticlesMesh, (v == null) ? 0 : v.getID()); } - public SimpleMesh get_gParticlesMesh() { + public Mesh get_gParticlesMesh() { return mExportVar_gParticlesMesh; } diff --git a/src/com/android/wallpaper/grass/GrassRS.java b/src/com/android/wallpaper/grass/GrassRS.java index 610b3ac..07abbdb 100644 --- a/src/com/android/wallpaper/grass/GrassRS.java +++ b/src/com/android/wallpaper/grass/GrassRS.java @@ -30,7 +30,7 @@ import android.renderscript.ScriptC; import android.renderscript.Type; import android.renderscript.Dimension; import android.renderscript.Element; -import android.renderscript.SimpleMesh; +import android.renderscript.Mesh; import android.renderscript.Primitive; import static android.renderscript.Sampler.Value.*; import android.content.Context; @@ -65,7 +65,7 @@ class GrassRS extends RenderScriptScene { //private Allocation mBladesBuffer; private Allocation mBladesIndicies; - private SimpleMesh mBladesMesh; + private Mesh mBladesMesh; private ScriptC_Grass mScript; @@ -196,16 +196,13 @@ class GrassRS extends RenderScriptScene { private void createMesh() { mVertexBuffer = new ScriptField_Vertex(mRS, mVerticies * 2); - final SimpleMesh.Builder meshBuilder = new SimpleMesh.Builder(mRS); - final int vertexSlot = meshBuilder.addVertexType(mVertexBuffer.getType()); - meshBuilder.setIndexType(Element.U16(mRS), mIndicies); - meshBuilder.setPrimitive(Primitive.TRIANGLE); - mBladesMesh = meshBuilder.create(); + final Mesh.AllocationBuilder meshBuilder = new Mesh.AllocationBuilder(mRS); + meshBuilder.addVertexAllocation(mVertexBuffer.getAllocation()); + + mBladesIndicies = Allocation.createSized(mRS, Element.U16(mRS), mIndicies); + meshBuilder.addIndexAllocation(mBladesIndicies, Primitive.TRIANGLE); - //mBladesBuffer = mBladesMesh.createVertexAllocation(vertexSlot); - mBladesMesh.bindVertexAllocation(mVertexBuffer.getAllocation(), 0); - mBladesIndicies = mBladesMesh.createIndexAllocation(); - mBladesMesh.bindIndexAllocation(mBladesIndicies); + mBladesMesh = meshBuilder.create(); short[] idx = new short[mIndicies]; int idxIdx = 0; diff --git a/src/com/android/wallpaper/grass/ScriptC_Grass.java b/src/com/android/wallpaper/grass/ScriptC_Grass.java index 78ae264..8b4877f 100644 --- a/src/com/android/wallpaper/grass/ScriptC_Grass.java +++ b/src/com/android/wallpaper/grass/ScriptC_Grass.java @@ -236,13 +236,13 @@ public class ScriptC_Grass extends ScriptC { } private final static int mExportVarIdx_gBladesMesh = 19; - private SimpleMesh mExportVar_gBladesMesh; - public void set_gBladesMesh(SimpleMesh v) { + private Mesh mExportVar_gBladesMesh; + public void set_gBladesMesh(Mesh v) { mExportVar_gBladesMesh = v; setVar(mExportVarIdx_gBladesMesh, (v == null) ? 0 : v.getID()); } - public SimpleMesh get_gBladesMesh() { + public Mesh get_gBladesMesh() { return mExportVar_gBladesMesh; } |
