diff options
| author | 2009-07-15 18:34:11 -0700 | |
|---|---|---|
| committer | 2009-07-15 18:34:11 -0700 | |
| commit | 4cc8c7dd8ebaf38f8f6ad1a9f924f3ea9ad2295d (patch) | |
| tree | 440e62b73a81149b7a15827a10689cc1408daa1e | |
| parent | 49763e42460d87c51485311507a45e5da636f2a5 (diff) | |
| parent | 7aa4f3a16355848e3cdf01642aca68416e80fd14 (diff) | |
Merge change 7489
* changes:
More test app work
| -rw-r--r-- | libs/rs/Android.mk | 2 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/AndroidManifest.xml | 2 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/rollo2.c | 67 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java | 7 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/src/com/android/rollo/RolloView.java | 4 | ||||
| -rw-r--r-- | libs/rs/rsContext.cpp | 7 | ||||
| -rw-r--r-- | libs/rs/rsFileA3D.cpp | 30 | ||||
| -rw-r--r-- | libs/rs/rsMesh.h | 3 |
8 files changed, 118 insertions, 4 deletions
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk index f5297f8d07ba..5f4787198cf5 100644 --- a/libs/rs/Android.mk +++ b/libs/rs/Android.mk @@ -85,10 +85,12 @@ LOCAL_SRC_FILES:= \ rsContext.cpp \ rsDevice.cpp \ rsElement.cpp \ + rsFileA3D.cpp \ rsLight.cpp \ rsLocklessFifo.cpp \ rsObjectBase.cpp \ rsMatrix.cpp \ + rsMesh.cpp \ rsProgram.cpp \ rsProgramFragment.cpp \ rsProgramFragmentStore.cpp \ diff --git a/libs/rs/java/Rollo/AndroidManifest.xml b/libs/rs/java/Rollo/AndroidManifest.xml index da160a37a343..127a140d2397 100644 --- a/libs/rs/java/Rollo/AndroidManifest.xml +++ b/libs/rs/java/Rollo/AndroidManifest.xml @@ -3,7 +3,7 @@ package="com.android.rollo"> <application android:label="Rollo"> <activity android:name="Rollo" - android:theme="@android:style/Theme.Black.NoTitleBar"> + android:theme="@android:style/Theme.Translucent"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> diff --git a/libs/rs/java/Rollo/res/raw/rollo2.c b/libs/rs/java/Rollo/res/raw/rollo2.c new file mode 100644 index 000000000000..b04ea73e53f6 --- /dev/null +++ b/libs/rs/java/Rollo/res/raw/rollo2.c @@ -0,0 +1,67 @@ +#pragma version(1) +#pragma stateVertex(PV) +#pragma stateFragment(PF) +#pragma stateFragmentStore(PFS) + +void drawLoop(int x, int y, int z, int rot) +{ + int ct; + int tx; + int ty; + int tmpSin; + int tmpCos; + int sz; + + for (ct = 0; ct < 10; ct ++) { + tmpSin = sinx((ct * 36 + rot) * 0x10000); + tmpCos = cosx((ct * 36 + rot) * 0x10000); + + ty = y + tmpCos * 4; + tx = x + tmpSin * 4; + pfBindTexture(NAMED_PF, 0, loadI32(1, ct & 3)); + + sz = 0xc000; + drawQuad(tx - sz, ty - sz, z, + tx + sz, ty - sz, z, + tx + sz, ty + sz, z, + tx - sz, ty + sz, z); + } +} + +int main(void* con, int ft, int launchID) +{ + int rowCount; + int x; + int y; + int row; + int col; + int imageID; + int tx1; + int ty1; + int tz1; + int tx2; + int ty2; + int tz2; + int tmpSin; + int tmpCos; + int iconCount; + int pressure; + + int ringCount; + + + + rotStep = 16 * 0x10000; + pressure = loadI32(0, 2); + rowCount = 4; + + iconCount = loadI32(0, 1); + rot = (-20 + loadI32(0, 0)) * 0x10000; + + for (ringCount = 0; ringCount < 5; ringCount++) { + drawLoop(0, 0, 0x90000 + (ringCount * 0x80000)); + } + + return 0; +} + diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java index 91f25c2725bd..d0867023968f 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java @@ -190,8 +190,9 @@ public class RolloRS { private void initRS() { mRS.scriptCBegin(); - mRS.scriptCSetClearColor(0.0f, 0.0f, 0.1f, 1.0f); - mRS.scriptCSetScript(mRes, R.raw.rollo); + mRS.scriptCSetClearColor(0.0f, 0.0f, 0.1f, 0.5f); + //mRS.scriptCSetScript(mRes, R.raw.rollo); + mRS.scriptCSetScript(mRes, R.raw.rollo2); mRS.scriptCSetRoot(true); mScript = mRS.scriptCCreate(); @@ -202,6 +203,8 @@ public class RolloRS { mScript.bindAllocation(mAllocIconID, 1); setPosition(0, 0); + //RenderScript.File f = mRS.fileOpen("/sdcard/test.a3d"); + mRS.contextBindRootScript(mScript); } } diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java index 27d2dd67d11e..4b0520bb1295 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java @@ -37,6 +37,7 @@ import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.KeyEvent; import android.view.MotionEvent; +import android.graphics.PixelFormat; public class RolloView extends RSSurfaceView { @@ -44,6 +45,7 @@ public class RolloView extends RSSurfaceView { super(context); //setFocusable(true); + getHolder().setFormat(PixelFormat.TRANSLUCENT); } private RenderScript mRS; @@ -55,6 +57,8 @@ public class RolloView extends RSSurfaceView { mRS = createRenderScript(); mRender = new RolloRS(); mRender.init(mRS, getResources(), w, h); + + } @Override diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index 4025ff81a008..78b8bf89e9e8 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -35,9 +35,16 @@ void Context::initEGL() EGLint s_configAttribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, +#if 1 + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, +#else EGL_RED_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, +#endif EGL_DEPTH_SIZE, 16, EGL_NONE }; diff --git a/libs/rs/rsFileA3D.cpp b/libs/rs/rsFileA3D.cpp index f669417d11cb..86d294bf3160 100644 --- a/libs/rs/rsFileA3D.cpp +++ b/libs/rs/rsFileA3D.cpp @@ -261,9 +261,12 @@ void FileA3D::processChunk_Primitive(Context *rsc, IO *io, A3DIndexEntry *ie) p->mIndexCount = io->loadU32(); uint32_t vertIdx = io->loadU32(); + p->mRestartCounts = io->loadU16(); uint32_t bits = io->loadU8(); p->mType = (RsPrimitive)io->loadU8(); + LOGE("processChunk_Primitive count %i, bits %i", p->mIndexCount, bits); + p->mVerticies = (Mesh::Verticies_t *)mIndex[vertIdx].mRsObj; p->mIndicies = new uint16_t[p->mIndexCount]; @@ -279,6 +282,27 @@ void FileA3D::processChunk_Primitive(Context *rsc, IO *io, A3DIndexEntry *ie) p->mIndicies[ct] = io->loadU32(); break; } + LOGE(" idx %i", p->mIndicies[ct]); + } + + if (p->mRestartCounts) { + p->mRestarts = new uint16_t[p->mRestartCounts]; + for (uint32_t ct = 0; ct < p->mRestartCounts; ct++) { + switch(bits) { + case 8: + p->mRestarts[ct] = io->loadU8(); + break; + case 16: + p->mRestarts[ct] = io->loadU16(); + break; + case 32: + p->mRestarts[ct] = io->loadU32(); + break; + } + LOGE(" idx %i", p->mRestarts[ct]); + } + } else { + p->mRestarts = NULL; } ie->mRsObj = p; @@ -289,16 +313,17 @@ void FileA3D::processChunk_Verticies(Context *rsc, IO *io, A3DIndexEntry *ie) Mesh::Verticies_t *cv = new Mesh::Verticies_t; cv->mAllocationCount = io->loadU32(); cv->mAllocations = new Allocation *[cv->mAllocationCount]; + LOGE("processChunk_Verticies count %i", cv->mAllocationCount); for (uint32_t ct = 0; ct < cv->mAllocationCount; ct++) { uint32_t i = io->loadU32(); cv->mAllocations[ct] = (Allocation *)mIndex[i].mRsObj; + LOGE(" idx %i", i); } ie->mRsObj = cv; } void FileA3D::processChunk_Element(Context *rsc, IO *io, A3DIndexEntry *ie) { - LOGE("processChunk_Element ie %p", ie); rsi_ElementBegin(rsc); uint32_t count = io->loadU32(); @@ -320,6 +345,8 @@ void FileA3D::processChunk_ElementSource(Context *rsc, IO *io, A3DIndexEntry *ie uint32_t index = io->loadU32(); uint32_t count = io->loadU32(); + LOGE("processChunk_ElementSource count %i, index %i", count, index); + RsElement e = (RsElement)mIndex[index].mRsObj; RsAllocation a = rsi_AllocationCreateSized(rsc, e, count); @@ -328,6 +355,7 @@ void FileA3D::processChunk_ElementSource(Context *rsc, IO *io, A3DIndexEntry *ie float * data = (float *)alloc->getPtr(); while(count--) { *data = io->loadF(); + LOGE(" %f", *data); data++; } ie->mRsObj = alloc; diff --git a/libs/rs/rsMesh.h b/libs/rs/rsMesh.h index 1db36e1aa635..be207a3adab0 100644 --- a/libs/rs/rsMesh.h +++ b/libs/rs/rsMesh.h @@ -57,6 +57,9 @@ public: uint32_t mIndexCount; uint16_t *mIndicies; + + uint32_t mRestartCounts; + uint16_t *mRestarts; }; Verticies_t * mVerticies; |