More test app work
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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" />
|
||||
|
||||
67
libs/rs/java/Rollo/res/raw/rollo2.c
Normal file
67
libs/rs/java/Rollo/res/raw/rollo2.c
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -57,6 +57,9 @@ public:
|
||||
|
||||
uint32_t mIndexCount;
|
||||
uint16_t *mIndicies;
|
||||
|
||||
uint32_t mRestartCounts;
|
||||
uint16_t *mRestarts;
|
||||
};
|
||||
|
||||
Verticies_t * mVerticies;
|
||||
|
||||
Reference in New Issue
Block a user