Cleanup pass on the mesh api change.
Removed all the simple mesh related calls and temporary objects.

Change-Id: Ic64a72a894e0314f216f10e1cfc0d45b17e2e182
diff --git a/ScriptC_Modelviewer.java b/ScriptC_Modelviewer.java
deleted file mode 100644
index 083fb60..0000000
--- a/ScriptC_Modelviewer.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.modelviewer;
-
-import android.renderscript.*;
-import android.content.res.Resources;
-import android.util.Log;
-
-public class ScriptC_Modelviewer extends ScriptC {
-    // Constructor
-    public  ScriptC_Modelviewer(RenderScript rs, Resources resources, int id, boolean isRoot) {
-        super(rs, resources, id, isRoot);
-    }
-
-    private final static int mExportVarIdx_gPVBackground = 0;
-    private ProgramVertex mExportVar_gPVBackground;
-    public void set_gPVBackground(ProgramVertex v) {
-        mExportVar_gPVBackground = v;
-        setVar(mExportVarIdx_gPVBackground, (v == null) ? 0 : v.getID());
-    }
-
-    public ProgramVertex get_gPVBackground() {
-        return mExportVar_gPVBackground;
-    }
-
-    private final static int mExportVarIdx_gPFBackground = 1;
-    private ProgramFragment mExportVar_gPFBackground;
-    public void set_gPFBackground(ProgramFragment v) {
-        mExportVar_gPFBackground = v;
-        setVar(mExportVarIdx_gPFBackground, (v == null) ? 0 : v.getID());
-    }
-
-    public ProgramFragment get_gPFBackground() {
-        return mExportVar_gPFBackground;
-    }
-
-    private final static int mExportVarIdx_gTGrid = 2;
-    private Allocation mExportVar_gTGrid;
-    public void set_gTGrid(Allocation v) {
-        mExportVar_gTGrid = v;
-        setVar(mExportVarIdx_gTGrid, (v == null) ? 0 : v.getID());
-    }
-
-    public Allocation get_gTGrid() {
-        return mExportVar_gTGrid;
-    }
-
-    private final static int mExportVarIdx_gTestMesh = 3;
-    private SimpleMesh mExportVar_gTestMesh;
-    public void set_gTestMesh(SimpleMesh v) {
-        mExportVar_gTestMesh = v;
-        setVar(mExportVarIdx_gTestMesh, (v == null) ? 0 : v.getID());
-    }
-
-    public SimpleMesh get_gTestMesh() {
-        return mExportVar_gTestMesh;
-    }
-
-    private final static int mExportVarIdx_gPFSBackground = 4;
-    private ProgramStore mExportVar_gPFSBackground;
-    public void set_gPFSBackground(ProgramStore v) {
-        mExportVar_gPFSBackground = v;
-        setVar(mExportVarIdx_gPFSBackground, (v == null) ? 0 : v.getID());
-    }
-
-    public ProgramStore get_gPFSBackground() {
-        return mExportVar_gPFSBackground;
-    }
-
-    private final static int mExportVarIdx_gRotate = 5;
-    private float mExportVar_gRotate;
-    public void set_gRotate(float v) {
-        mExportVar_gRotate = v;
-        setVar(mExportVarIdx_gRotate, v);
-    }
-
-    public float get_gRotate() {
-        return mExportVar_gRotate;
-    }
-
-    private final static int mExportVarIdx_gItalic = 6;
-    private Font mExportVar_gItalic;
-    public void set_gItalic(Font v) {
-        mExportVar_gItalic = v;
-        setVar(mExportVarIdx_gItalic, v);
-    }
-
-    public Font get_gItalic() {
-        return mExportVar_gItalic;
-    }
-
-    private final static int mExportVarIdx_gTextAlloc = 7;
-    private Allocation mExportVar_gTextAlloc;
-    public void set_gTextAlloc(Allocation v) {
-        mExportVar_gTextAlloc = v;
-        setVar(mExportVarIdx_gTextAlloc, (v == null) ? 0 : v.getID());
-    }
-
-    public Allocation get_gTextAlloc() {
-        return mExportVar_gTextAlloc;
-    }
-
-}
-
diff --git a/java/ModelViewer/res/raw/robot.a3d b/java/ModelViewer/res/raw/robot.a3d
index 430fe95..d220c81 100644
--- a/java/ModelViewer/res/raw/robot.a3d
+++ b/java/ModelViewer/res/raw/robot.a3d
Binary files differ
diff --git a/rs.spec b/rs.spec
index 172ba66..136c05d 100644
--- a/rs.spec
+++ b/rs.spec
@@ -491,45 +491,12 @@
 	param uint32_t slot
 	}
 
-MeshBindPrimitive {
-	param RsMesh mesh
-	param RsAllocation prim
-	param uint32_t primType
-	param uint32_t slot
-	}
-
 MeshBindVertex {
 	param RsMesh mesh
 	param RsAllocation vtx
 	param uint32_t slot
 	}
 
-SimpleMeshCreate {
-	ret RsMesh
-	param RsAllocation prim
-	param RsAllocation index
-	param RsAllocation *vtx
-	param uint32_t vtxCount
-	param uint32_t primType
-	}
-
-
-SimpleMeshBindIndex {
-	param RsMesh mesh
-	param RsAllocation idx
-	}
-
-SimpleMeshBindPrimitive {
-	param RsMesh mesh
-	param RsAllocation prim
-	}
-
-SimpleMeshBindVertex {
-	param RsMesh mesh
-	param RsAllocation vtx
-	param uint32_t slot
-	}
-
 AnimationCreate {
 	param const float *inValues
 	param const float *outValues
diff --git a/rsMesh.cpp b/rsMesh.cpp
index 4f90f36..d1b5581 100644
--- a/rsMesh.cpp
+++ b/rsMesh.cpp
@@ -38,16 +38,11 @@
     mPrimitives = NULL;
     mPrimitivesCount = 0;
     mVertexBuffers = NULL;
-    mVertexTypes = NULL;
     mVertexBufferCount = 0;
 }
 
 Mesh::~Mesh()
 {
-    if(mVertexTypes) {
-        delete[] mVertexTypes;
-    }
-
     if(mVertexBuffers) {
         delete[] mVertexBuffers;
     }
@@ -80,11 +75,6 @@
         return;
     }
 
-    if (prim->mPrimitiveBuffer.get()) {
-        renderPrimitiveRange(rsc, primIndex, 0, prim->mPrimitiveBuffer->getType()->getDimX());
-        return;
-    }
-
     renderPrimitiveRange(rsc, primIndex, 0, mVertexBuffers[0]->getType()->getDimX());
 }
 
@@ -133,9 +123,6 @@
         if (mPrimitives[ct]->mIndexBuffer.get()) {
             mPrimitives[ct]->mIndexBuffer->deferedUploadToBufferObject(rsc);
         }
-        if (mPrimitives[ct]->mPrimitiveBuffer.get()) {
-            mPrimitives[ct]->mPrimitiveBuffer->deferedUploadToBufferObject(rsc);
-        }
     }
 
     rsc->checkError("Mesh::uploadAll");
@@ -183,14 +170,6 @@
         else {
             stream->addU32(0);
         }
-
-        if(prim->mPrimitiveBuffer.get()) {
-            stream->addU32(1);
-            prim->mPrimitiveBuffer->serialize(stream);
-        }
-        else {
-            stream->addU32(0);
-        }
     }
 }
 
@@ -236,13 +215,6 @@
                 Allocation *indexAlloc = Allocation::createFromStream(rsc, stream);
                 prim->mIndexBuffer.set(indexAlloc);
             }
-
-            // Check to see if the primitive buffer was stored
-            uint32_t isPrimitivePresent = stream->loadU32();
-            if(isPrimitivePresent) {
-                Allocation *primitiveAlloc = Allocation::createFromStream(rsc, stream);
-                prim->mPrimitiveBuffer.set(primitiveAlloc);
-            }
         }
     }
 
@@ -277,7 +249,6 @@
 
     sm->mVertexBufferCount = vtxCount;
     sm->mVertexBuffers = new ObjectBaseRef<Allocation>[vtxCount];
-    sm->mVertexTypes = new ObjectBaseRef<const Type>[vtxCount];
 
     return sm;
 }
@@ -300,64 +271,4 @@
     sm->updateGLPrimitives();
 }
 
-void rsi_MeshBindPrimitive(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primType, uint32_t slot)
-{
-    Mesh *sm = static_cast<Mesh *>(mv);
-    rsAssert(slot < sm->mPrimitivesCount);
-
-    sm->mPrimitives[slot]->mPrimitiveBuffer.set((Allocation *)va);
-    sm->mPrimitives[slot]->mPrimitive = (RsPrimitive)primType;
-    sm->updateGLPrimitives();
-}
-
-
-// Route all the simple mesh through mesh
-
-RsMesh rsi_SimpleMeshCreate(Context *rsc, RsType prim, RsType idx, RsType *vtx, uint32_t vtxCount, uint32_t primType)
-{
-    Mesh *sm = new Mesh(rsc);
-    sm->incUserRef();
-
-    sm->mPrimitivesCount = 1;
-    sm->mPrimitives = new Mesh::Primitive_t *[sm->mPrimitivesCount];
-    sm->mPrimitives[0] = new Mesh::Primitive_t;
-
-    sm->mPrimitives[0]->mIndexType.set((const Type *)idx);
-    sm->mPrimitives[0]->mPrimitiveType.set((const Type *)prim);
-    sm->mPrimitives[0]->mPrimitive = (RsPrimitive)primType;
-    sm->updateGLPrimitives();
-
-    sm->mVertexBufferCount = vtxCount;
-    sm->mVertexTypes = new ObjectBaseRef<const Type>[vtxCount];
-    sm->mVertexBuffers = new ObjectBaseRef<Allocation>[vtxCount];
-    for (uint32_t ct=0; ct < vtxCount; ct++) {
-        sm->mVertexTypes[ct].set((const Type *)vtx[ct]);
-    }
-
-    return sm;
-}
-
-void rsi_SimpleMeshBindVertex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t slot)
-{
-    Mesh *sm = static_cast<Mesh *>(mv);
-    rsAssert(slot < sm->mVertexBufferCount);
-
-    sm->mVertexBuffers[slot].set((Allocation *)va);
-}
-
-void rsi_SimpleMeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va)
-{
-    Mesh *sm = static_cast<Mesh *>(mv);
-    sm->mPrimitives[0]->mIndexBuffer.set((Allocation *)va);
-}
-
-void rsi_SimpleMeshBindPrimitive(Context *rsc, RsMesh mv, RsAllocation va)
-{
-    Mesh *sm = static_cast<Mesh *>(mv);
-    sm->mPrimitives[0]->mPrimitiveBuffer.set((Allocation *)va);
-}
-
-
-
-
 }}
diff --git a/rsMesh.h b/rsMesh.h
index 66174b7..765a971 100644
--- a/rsMesh.h
+++ b/rsMesh.h
@@ -36,7 +36,6 @@
     // Position, normal, texcoord, etc could either be strided in one allocation
     // of provided separetely in multiple ones
     ObjectBaseRef<Allocation> *mVertexBuffers;
-    ObjectBaseRef<const Type> *mVertexTypes;
     uint32_t mVertexBufferCount;
 
     // Either mIndexBuffer, mPrimitiveBuffer or both could have a NULL reference
@@ -44,9 +43,6 @@
     struct Primitive_t
     {
         ObjectBaseRef<Allocation> mIndexBuffer;
-        ObjectBaseRef<Allocation> mPrimitiveBuffer;
-        ObjectBaseRef<const Type> mIndexType;
-        ObjectBaseRef<const Type> mPrimitiveType;
 
         RsPrimitive mPrimitive;
         uint32_t mGLPrimitive;
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 7185009..e9971a2 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -40,18 +40,6 @@
 
 
 //////////////////////////////////////////////////////////////////////////////
-// IO routines
-//////////////////////////////////////////////////////////////////////////////
-
-static void SC_updateSimpleMesh(RsMesh mesh)
-{
-    GET_TLS();
-    Mesh *sm = static_cast<Mesh *>(mesh);
-    sm->uploadAll(rsc);
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
 // Context
 //////////////////////////////////////////////////////////////////////////////
 
@@ -220,26 +208,6 @@
                 x1, y1, z);
 }
 
-static void SC_drawSimpleMesh(RsMesh vsm)
-{
-    GET_TLS();
-    Mesh *sm = static_cast<Mesh *>(vsm);
-    if (!rsc->setupCheck()) {
-        return;
-    }
-    sm->renderPrimitive(rsc, 0);
-}
-
-static void SC_drawSimpleMeshRange(RsMesh vsm, uint32_t start, uint32_t len)
-{
-    GET_TLS();
-    Mesh *sm = static_cast<Mesh *>(vsm);
-    if (!rsc->setupCheck()) {
-        return;
-    }
-    sm->renderPrimitiveRange(rsc, 0, start, len);
-}
-
 static void SC_drawMesh(RsMesh vsm)
 {
     GET_TLS();
@@ -402,8 +370,6 @@
     { "rsgDrawQuadTexCoords", (void *)&SC_drawQuadTexCoords },
     //{ "drawSprite", (void *)&SC_drawSprite },
     { "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace },
-    { "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh },
-    { "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange },
 
     { "_Z11rsgDrawMesh7rs_mesh", (void *)&SC_drawMesh },
     { "_Z11rsgDrawMesh7rs_meshi", (void *)&SC_drawMeshPrimitive },
@@ -417,11 +383,6 @@
 
     { "rsgBindFont", (void *)&SC_BindFont },
 
-
-    //////////////////////////////////////
-    // IO
-    { "updateSimpleMesh", (void *)&SC_updateSimpleMesh },
-
     // misc
     { "color", (void *)&SC_color },
 
diff --git a/scriptc/rs_graphics.rsh b/scriptc/rs_graphics.rsh
index 1f1f1ac..4dc351d 100644
--- a/scriptc/rs_graphics.rsh
+++ b/scriptc/rs_graphics.rsh
@@ -29,8 +29,6 @@
 extern void rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4);
 //extern void rsgDrawSprite(float x, float y, float z, float w, float h);
 extern void rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
-extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism);
-extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism, int start, int len);
 
 extern void __attribute__((overloadable)) rsgDrawMesh(rs_mesh ism);
 extern void __attribute__((overloadable)) rsgDrawMesh(rs_mesh ism, int primitiveIndex);