diff options
| author | 2009-07-02 15:09:27 -0700 | |
|---|---|---|
| committer | 2009-07-02 15:09:27 -0700 | |
| commit | 4244afa87edf8f2dde0f053f31f39f54c0fa1783 (patch) | |
| tree | 473fd78029bb27ef6aa5ee8c67e39d6356cb0454 /libs/rs/java | |
| parent | aabd00960f3b98c3c5636d99212343d71956a1d1 (diff) | |
Add support for multitexture and fix allocation ref counting bug in RS. Add plaque to rollo and leave it disabled due to ugly appearance.
Diffstat (limited to 'libs/rs/java')
| -rw-r--r-- | libs/rs/java/Rollo/res/raw/rollo.c | 10 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java | 36 |
2 files changed, 38 insertions, 8 deletions
diff --git a/libs/rs/java/Rollo/res/raw/rollo.c b/libs/rs/java/Rollo/res/raw/rollo.c index 64a0d0fcd30c..f181e4972f72 100644 --- a/libs/rs/java/Rollo/res/raw/rollo.c +++ b/libs/rs/java/Rollo/res/raw/rollo.c @@ -25,13 +25,13 @@ int main(void* con, int ft, int launchID) int pressure; - iconCount = 38;//loadI32(0, 1); rotStep = 20 * 0x10000; pressure = loadI32(0, 2); rowCount = 4; - rot = (-20 + loadI32(0, 0)) * 0x10000; + iconCount = loadI32(0, 1); + rot = (-20 + loadI32(0, 0)) * 0x10000; while (iconCount) { tmpSin = sinx(rot); tmpCos = cosx(rot); @@ -45,9 +45,7 @@ int main(void* con, int ft, int launchID) for (y = 0; (y < rowCount) && iconCount; y++) { ty1 = (y * 0x30000) - 0x48000; ty2 = ty1 + 0x20000; - pfBindTexture(NAMED_PF, 0, loadI32(1, y)); - drawQuad(tx1, ty1, tz1, tx2, ty1, tz2, tx2, ty2, tz2, @@ -57,8 +55,6 @@ int main(void* con, int ft, int launchID) rot = rot + rotStep; } - //renderTriangleMesh(con, NAMED_MeshCard); - //renderTriangleMesh(con, NAMED_MeshTab); - return 1; + 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 003a2a06e54e..91f25c2725bd 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java @@ -69,6 +69,7 @@ public class RolloRS { private RenderScript.ProgramVertex mPV; private ProgramVertexAlloc mPVAlloc; private RenderScript.Allocation[] mIcons; + private RenderScript.Allocation mIconPlate; private int[] mAllocStateBuf; private RenderScript.Allocation mAllocState; @@ -79,7 +80,9 @@ public class RolloRS { private void initNamed() { mRS.samplerBegin(); mRS.samplerSet(RenderScript.SamplerParam.FILTER_MIN, - RenderScript.SamplerValue.LINEAR_MIP_LINEAR); + RenderScript.SamplerValue.LINEAR);//_MIP_LINEAR); + mRS.samplerSet(RenderScript.SamplerParam.FILTER_MAG, + RenderScript.SamplerValue.LINEAR); mRS.samplerSet(RenderScript.SamplerParam.WRAP_MODE_S, RenderScript.SamplerValue.CLAMP); mRS.samplerSet(RenderScript.SamplerParam.WRAP_MODE_T, @@ -89,10 +92,13 @@ public class RolloRS { mRS.programFragmentBegin(null, null); mRS.programFragmentSetTexEnable(0, true); + //mRS.programFragmentSetTexEnable(1, true); //mRS.programFragmentSetEnvMode(0, RS_TEX_ENV_MODE_REPLACE); + //mRS.programFragmentSetEnvMode(1, RS_TEX_ENV_MODE_MODULATE); mPFImages = mRS.programFragmentCreate(); mPFImages.setName("PF"); mPFImages.bindSampler(mSampler, 0); + mPFImages.bindSampler(mSampler, 1); mRS.programFragmentStoreBegin(null, null); mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS); @@ -148,6 +154,34 @@ public class RolloRS { mAllocIconIDBuf[ct] = mIcons[ct].getID(); } mAllocIconID.data(mAllocIconIDBuf); + + RenderScript.Element e = mRS.elementGetPredefined(RenderScript.ElementPredefined.RGB_565); + mRS.typeBegin(e); + mRS.typeAdd(RenderScript.Dimension.X, 64); + mRS.typeAdd(RenderScript.Dimension.Y, 64); + RenderScript.Type t = mRS.typeCreate(); + mIconPlate = mRS.allocationCreateTyped(t); + //t.destroy(); + //e.destroy(); + + int tmp[] = new int[64 * 32]; + for(int ct = 0; ct < (64*32); ct++) { + tmp[ct] = 7 | (13 << 5) | (7 << 11); + tmp[ct] = tmp[ct] | (tmp[ct] << 16); + } + for(int ct = 0; ct < 32; ct++) { + tmp[ct] = 0; + tmp[ct + (63*32)] = 0; + } + for(int ct = 0; ct < 64; ct++) { + tmp[ct * 32] = 0; + tmp[ct * 32 + 31] = 0; + } + mIconPlate.data(tmp); + Log.e("xx", "plate"); + mIconPlate.uploadToTexture(0); + mIconPlate.setName("Plate"); + mPFImages.bindTexture(mIconPlate, 0); } } |