diff options
| -rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 4 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/SimpleMesh.java | 354 | ||||
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 35 | ||||
| -rw-r--r-- | libs/rs/ScriptC_Modelviewer.java | 118 | ||||
| -rw-r--r-- | libs/rs/java/ModelViewer/res/raw/robot.a3d | bin | 144504 -> 144500 bytes | |||
| -rw-r--r-- | libs/rs/rs.spec | 33 | ||||
| -rw-r--r-- | libs/rs/rsMesh.cpp | 89 | ||||
| -rw-r--r-- | libs/rs/rsMesh.h | 4 | ||||
| -rw-r--r-- | libs/rs/rsScriptC_LibGL.cpp | 39 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_graphics.rsh | 2 |
10 files changed, 0 insertions, 678 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index c7e8ca5..fcc6cbb 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -190,10 +190,6 @@ public class RenderScript { native void nMeshBindVertex(int id, int alloc, int slot); native void nMeshBindIndex(int id, int alloc, int prim, int slot); - native int nSimpleMeshCreate(int batchID, int idxID, int[] vtxID, int prim); - native void nSimpleMeshBindVertex(int id, int alloc, int slot); - native void nSimpleMeshBindIndex(int id, int alloc); - native void nAnimationBegin(int attribCount, int keyframeCount); native void nAnimationAdd(float time, float[] attribs); native int nAnimationCreate(); diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java deleted file mode 100644 index 38d0736..0000000 --- a/graphics/java/android/renderscript/SimpleMesh.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) 2008 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 android.renderscript; - -import android.util.Config; -import android.util.Log; - -/** - * @hide - * - **/ -public class SimpleMesh extends BaseObj { - Type[] mVertexTypes; - Type mIndexType; - //Type mBatcheType; - Primitive mPrimitive; - - SimpleMesh(int id, RenderScript rs) { - super(rs); - mID = id; - } - - public void bindVertexAllocation(Allocation a, int slot) { - mRS.validate(); - mRS.nSimpleMeshBindVertex(mID, a.mID, slot); - } - - public void bindIndexAllocation(Allocation a) { - mRS.validate(); - mRS.nSimpleMeshBindIndex(mID, a.mID); - } - - public Allocation createVertexAllocation(int slot) { - mRS.validate(); - return Allocation.createTyped(mRS, mVertexTypes[slot]); - } - - public Allocation createIndexAllocation() { - mRS.validate(); - return Allocation.createTyped(mRS, mIndexType); - } - - public Type getVertexType(int slot) { - return mVertexTypes[slot]; - } - - public Type getIndexType() { - return mIndexType; - } - - public static class Builder { - RenderScript mRS; - - class Entry { - Type t; - Element e; - int size; - } - - int mVertexTypeCount; - Entry[] mVertexTypes; - Entry mIndexType; - //Entry mBatchType; - Primitive mPrimitive; - - - public Builder(RenderScript rs) { - mRS = rs; - mVertexTypeCount = 0; - mVertexTypes = new Entry[16]; - mIndexType = new Entry(); - } - - public int addVertexType(Type t) throws IllegalStateException { - if (mVertexTypeCount >= mVertexTypes.length) { - throw new IllegalStateException("Max vertex types exceeded."); - } - - int addedIndex = mVertexTypeCount; - mVertexTypes[mVertexTypeCount] = new Entry(); - mVertexTypes[mVertexTypeCount].t = t; - mVertexTypeCount++; - return addedIndex; - } - - public int addVertexType(Element e, int size) throws IllegalStateException { - if (mVertexTypeCount >= mVertexTypes.length) { - throw new IllegalStateException("Max vertex types exceeded."); - } - - int addedIndex = mVertexTypeCount; - mVertexTypes[mVertexTypeCount] = new Entry(); - mVertexTypes[mVertexTypeCount].e = e; - mVertexTypes[mVertexTypeCount].size = size; - mVertexTypeCount++; - return addedIndex; - } - - public void setIndexType(Type t) { - mIndexType.t = t; - mIndexType.e = null; - mIndexType.size = 0; - } - - public void setIndexType(Element e, int size) { - mIndexType.t = null; - mIndexType.e = e; - mIndexType.size = size; - } - - public void setPrimitive(Primitive p) { - mPrimitive = p; - } - - - Type newType(Element e, int size) { - Type.Builder tb = new Type.Builder(mRS, e); - tb.add(Dimension.X, size); - return tb.create(); - } - - static synchronized SimpleMesh internalCreate(RenderScript rs, Builder b) { - Type[] toDestroy = new Type[18]; - int toDestroyCount = 0; - - int indexID = 0; - if (b.mIndexType.t != null) { - indexID = b.mIndexType.t.mID; - } else if (b.mIndexType.size != 0) { - b.mIndexType.t = b.newType(b.mIndexType.e, b.mIndexType.size); - indexID = b.mIndexType.t.mID; - toDestroy[toDestroyCount++] = b.mIndexType.t; - } - - int[] IDs = new int[b.mVertexTypeCount]; - for(int ct=0; ct < b.mVertexTypeCount; ct++) { - if (b.mVertexTypes[ct].t != null) { - IDs[ct] = b.mVertexTypes[ct].t.mID; - } else { - b.mVertexTypes[ct].t = b.newType(b.mVertexTypes[ct].e, b.mVertexTypes[ct].size); - IDs[ct] = b.mVertexTypes[ct].t.mID; - toDestroy[toDestroyCount++] = b.mVertexTypes[ct].t; - } - } - - int id = rs.nSimpleMeshCreate(0, indexID, IDs, b.mPrimitive.mID); - for(int ct=0; ct < toDestroyCount; ct++) { - toDestroy[ct].destroy(); - } - - return new SimpleMesh(id, rs); - } - - public SimpleMesh create() { - mRS.validate(); - SimpleMesh sm = internalCreate(mRS, this); - sm.mVertexTypes = new Type[mVertexTypeCount]; - for(int ct=0; ct < mVertexTypeCount; ct++) { - sm.mVertexTypes[ct] = mVertexTypes[ct].t; - } - sm.mIndexType = mIndexType.t; - sm.mPrimitive = mPrimitive; - return sm; - } - } - - public static class TriangleMeshBuilder { - float mVtxData[]; - int mVtxCount; - short mIndexData[]; - int mIndexCount; - RenderScript mRS; - Element mElement; - - float mNX = 0; - float mNY = 0; - float mNZ = -1; - float mS0 = 0; - float mT0 = 0; - float mR = 1; - float mG = 1; - float mB = 1; - float mA = 1; - - int mVtxSize; - int mFlags; - - public static final int COLOR = 0x0001; - public static final int NORMAL = 0x0002; - public static final int TEXTURE_0 = 0x0100; - - public TriangleMeshBuilder(RenderScript rs, int vtxSize, int flags) { - mRS = rs; - mVtxCount = 0; - mIndexCount = 0; - mVtxData = new float[128]; - mIndexData = new short[128]; - mVtxSize = vtxSize; - mFlags = flags; - - if (vtxSize < 2 || vtxSize > 3) { - throw new IllegalArgumentException("Vertex size out of range."); - } - } - - private void makeSpace(int count) { - if ((mVtxCount + count) >= mVtxData.length) { - float t[] = new float[mVtxData.length * 2]; - System.arraycopy(mVtxData, 0, t, 0, mVtxData.length); - mVtxData = t; - } - } - - private void latch() { - if ((mFlags & COLOR) != 0) { - makeSpace(4); - mVtxData[mVtxCount++] = mR; - mVtxData[mVtxCount++] = mG; - mVtxData[mVtxCount++] = mB; - mVtxData[mVtxCount++] = mA; - } - if ((mFlags & TEXTURE_0) != 0) { - makeSpace(2); - mVtxData[mVtxCount++] = mS0; - mVtxData[mVtxCount++] = mT0; - } - if ((mFlags & NORMAL) != 0) { - makeSpace(3); - mVtxData[mVtxCount++] = mNX; - mVtxData[mVtxCount++] = mNY; - mVtxData[mVtxCount++] = mNZ; - } - } - - public void addVertex(float x, float y) { - if (mVtxSize != 2) { - throw new IllegalStateException("add mistmatch with declared components."); - } - makeSpace(2); - mVtxData[mVtxCount++] = x; - mVtxData[mVtxCount++] = y; - latch(); - } - - public void addVertex(float x, float y, float z) { - if (mVtxSize != 3) { - throw new IllegalStateException("add mistmatch with declared components."); - } - makeSpace(3); - mVtxData[mVtxCount++] = x; - mVtxData[mVtxCount++] = y; - mVtxData[mVtxCount++] = z; - latch(); - } - - public void setTexture(float s, float t) { - if ((mFlags & TEXTURE_0) == 0) { - throw new IllegalStateException("add mistmatch with declared components."); - } - mS0 = s; - mT0 = t; - } - - public void setNormal(float x, float y, float z) { - if ((mFlags & NORMAL) == 0) { - throw new IllegalStateException("add mistmatch with declared components."); - } - mNX = x; - mNY = y; - mNZ = z; - } - - public void setColor(float r, float g, float b, float a) { - if ((mFlags & COLOR) == 0) { - throw new IllegalStateException("add mistmatch with declared components."); - } - mR = r; - mG = g; - mB = b; - mA = a; - } - - public void addTriangle(int idx1, int idx2, int idx3) { - if((idx1 >= mVtxCount) || (idx1 < 0) || - (idx2 >= mVtxCount) || (idx2 < 0) || - (idx3 >= mVtxCount) || (idx3 < 0)) { - throw new IllegalStateException("Index provided greater than vertex count."); - } - if ((mIndexCount + 3) >= mIndexData.length) { - short t[] = new short[mIndexData.length * 2]; - System.arraycopy(mIndexData, 0, t, 0, mIndexData.length); - mIndexData = t; - } - mIndexData[mIndexCount++] = (short)idx1; - mIndexData[mIndexCount++] = (short)idx2; - mIndexData[mIndexCount++] = (short)idx3; - } - - public SimpleMesh create() { - Element.Builder b = new Element.Builder(mRS); - int floatCount = mVtxSize; - b.add(Element.createVector(mRS, - Element.DataType.FLOAT_32, - mVtxSize), "position"); - if ((mFlags & COLOR) != 0) { - floatCount += 4; - b.add(Element.F32_4(mRS), "color"); - } - if ((mFlags & TEXTURE_0) != 0) { - floatCount += 2; - b.add(Element.F32_2(mRS), "texture0"); - } - if ((mFlags & NORMAL) != 0) { - floatCount += 3; - b.add(Element.F32_3(mRS), "normal"); - } - mElement = b.create(); - - Builder smb = new Builder(mRS); - smb.addVertexType(mElement, mVtxCount / floatCount); - smb.setIndexType(Element.U16(mRS), mIndexCount); - smb.setPrimitive(Primitive.TRIANGLE); - SimpleMesh sm = smb.create(); - - Allocation vertexAlloc = sm.createVertexAllocation(0); - Allocation indexAlloc = sm.createIndexAllocation(); - sm.bindVertexAllocation(vertexAlloc, 0); - sm.bindIndexAllocation(indexAlloc); - - vertexAlloc.data(mVtxData); - vertexAlloc.uploadToBufferObject(); - - indexAlloc.data(mIndexData); - indexAlloc.uploadToBufferObject(); - - return sm; - } - } -} - diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index a6d2489..cbc24c4 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -1377,37 +1377,6 @@ nMeshBindIndex(JNIEnv *_env, jobject _this, jint s, jint alloc, jint primID, jin // --------------------------------------------------------------------------- -static jint -nSimpleMeshCreate(JNIEnv *_env, jobject _this, jint batchID, jint indexID, jintArray vtxIDs, jint primID) -{ - RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - jint len = _env->GetArrayLength(vtxIDs); - LOG_API("nSimpleMeshCreate, con(%p), batchID(%i), indexID(%i), vtxIDs.len(%i), primID(%i)", - con, batchID, indexID, len, primID); - jint *ptr = _env->GetIntArrayElements(vtxIDs, NULL); - int id = (int)rsSimpleMeshCreate(con, (void *)batchID, (void *)indexID, (void **)ptr, len, primID); - _env->ReleaseIntArrayElements(vtxIDs, ptr, 0/*JNI_ABORT*/); - return id; -} - -static void -nSimpleMeshBindVertex(JNIEnv *_env, jobject _this, jint s, jint alloc, jint slot) -{ - RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - LOG_API("nSimpleMeshBindVertex, con(%p), Mesh(%p), Alloc(%p), slot(%i)", con, (RsMesh)s, (RsAllocation)alloc, slot); - rsSimpleMeshBindVertex(con, (RsMesh)s, (RsAllocation)alloc, slot); -} - -static void -nSimpleMeshBindIndex(JNIEnv *_env, jobject _this, jint s, jint alloc) -{ - RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); - LOG_API("nSimpleMeshBindIndex, con(%p), Mesh(%p), Alloc(%p)", con, (RsMesh)s, (RsAllocation)alloc); - rsSimpleMeshBindIndex(con, (RsMesh)s, (RsAllocation)alloc); -} - -// --------------------------------------------------------------------------- - static const char *classPathName = "android/renderscript/RenderScript"; @@ -1536,10 +1505,6 @@ static JNINativeMethod methods[] = { {"nSamplerSet", "(II)V", (void*)nSamplerSet }, {"nSamplerCreate", "()I", (void*)nSamplerCreate }, -{"nSimpleMeshCreate", "(II[II)I", (void*)nSimpleMeshCreate }, -{"nSimpleMeshBindVertex", "(III)V", (void*)nSimpleMeshBindVertex }, -{"nSimpleMeshBindIndex", "(II)V", (void*)nSimpleMeshBindIndex }, - {"nMeshCreate", "(II)I", (void*)nMeshCreate }, {"nMeshBindVertex", "(III)V", (void*)nMeshBindVertex }, {"nMeshBindIndex", "(IIII)V", (void*)nMeshBindIndex }, diff --git a/libs/rs/ScriptC_Modelviewer.java b/libs/rs/ScriptC_Modelviewer.java deleted file mode 100644 index 083fb60..0000000 --- a/libs/rs/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/libs/rs/java/ModelViewer/res/raw/robot.a3d b/libs/rs/java/ModelViewer/res/raw/robot.a3d Binary files differindex 430fe95..d220c81 100644 --- a/libs/rs/java/ModelViewer/res/raw/robot.a3d +++ b/libs/rs/java/ModelViewer/res/raw/robot.a3d diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec index 172ba66..136c05d 100644 --- a/libs/rs/rs.spec +++ b/libs/rs/rs.spec @@ -491,45 +491,12 @@ MeshBindIndex { 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/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp index 4f90f36..d1b5581 100644 --- a/libs/rs/rsMesh.cpp +++ b/libs/rs/rsMesh.cpp @@ -38,16 +38,11 @@ Mesh::Mesh(Context *rsc) : ObjectBase(rsc) mPrimitives = NULL; mPrimitivesCount = 0; mVertexBuffers = NULL; - mVertexTypes = NULL; mVertexBufferCount = 0; } Mesh::~Mesh() { - if(mVertexTypes) { - delete[] mVertexTypes; - } - if(mVertexBuffers) { delete[] mVertexBuffers; } @@ -80,11 +75,6 @@ void Mesh::renderPrimitive(Context *rsc, uint32_t primIndex) const { 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 @@ void Mesh::uploadAll(Context *rsc) 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 @@ void Mesh::serialize(OStream *stream) const else { stream->addU32(0); } - - if(prim->mPrimitiveBuffer.get()) { - stream->addU32(1); - prim->mPrimitiveBuffer->serialize(stream); - } - else { - stream->addU32(0); - } } } @@ -236,13 +215,6 @@ Mesh *Mesh::createFromStream(Context *rsc, IStream *stream) 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 @@ RsMesh rsi_MeshCreate(Context *rsc, uint32_t vtxCount, uint32_t idxCount) sm->mVertexBufferCount = vtxCount; sm->mVertexBuffers = new ObjectBaseRef<Allocation>[vtxCount]; - sm->mVertexTypes = new ObjectBaseRef<const Type>[vtxCount]; return sm; } @@ -300,64 +271,4 @@ void rsi_MeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primTy 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/libs/rs/rsMesh.h b/libs/rs/rsMesh.h index 66174b7..765a971 100644 --- a/libs/rs/rsMesh.h +++ b/libs/rs/rsMesh.h @@ -36,7 +36,6 @@ public: // 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 @@ public: 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/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp index 7185009..e9971a2 100644 --- a/libs/rs/rsScriptC_LibGL.cpp +++ b/libs/rs/rsScriptC_LibGL.cpp @@ -40,18 +40,6 @@ using namespace android::renderscript; ////////////////////////////////////////////////////////////////////////////// -// IO routines -////////////////////////////////////////////////////////////////////////////// - -static void SC_updateSimpleMesh(RsMesh mesh) -{ - GET_TLS(); - Mesh *sm = static_cast<Mesh *>(mesh); - sm->uploadAll(rsc); -} - - -////////////////////////////////////////////////////////////////////////////// // Context ////////////////////////////////////////////////////////////////////////////// @@ -220,26 +208,6 @@ static void SC_drawRect(float x1, float y1, 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 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "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 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "rsgBindFont", (void *)&SC_BindFont }, - - ////////////////////////////////////// - // IO - { "updateSimpleMesh", (void *)&SC_updateSimpleMesh }, - // misc { "color", (void *)&SC_color }, diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh index 1f1f1ac..4dc351d 100644 --- a/libs/rs/scriptc/rs_graphics.rsh +++ b/libs/rs/scriptc/rs_graphics.rsh @@ -29,8 +29,6 @@ extern void rsgDrawQuad(float x1, float y1, float z1, float x2, float y2, float 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); |
