Remove shadows and invert dx sign in zoomed mode.

This commit is contained in:
Jason Sams
2009-07-17 12:28:27 -07:00
parent c1ea948ee8
commit 7df07026e8
3 changed files with 1 additions and 60 deletions

View File

@@ -32,7 +32,6 @@ int main(void* con, int ft, int launchID)
int col;
int imageID;
int iconCount;
int pressure;
float f = loadF(2, 0);
pfClearColor(0.0f, 0.0f, 0.0f, f);
@@ -57,48 +56,16 @@ int main(void* con, int ft, int launchID)
float diam = 8.f;// + curve * 2.f;
float scale = 1.0f / zoom;
pressure = loadI32(0, STATE_PRESSURE);
if (pressure) {
contextBindProgramFragmentStore(NAMED_PFSShadow);
// compute the projected shadow
float x = loadI32(0, STATE_POS_X) / 1000.f;
float y = loadI32(0, STATE_POS_Y) / 1000.f;
float s = loadI32(0, STATE_PRESSURE) / 1000.f;
s = s * 3.f;
float dxdy1 = (x - 0.5f - s) / (1.001f - y);
float dxdy2 = (x - 0.5f + s) / (1.001f - y);
float xlt = y * dxdy1 + x;
float xrt = y * dxdy2 + x;
float yb = (0.5f - y) * 5.f + 0.2f;
drawQuad(xlt, 5.f, 1,
xrt, 5.f, 1,
x + s, yb, 1,
x - s, yb, 1);
contextBindProgramFragmentStore(NAMED_PFS);
}
rot = rot * scale;
float rotStep = 20.0f / 180.0f * 3.14f * scale;
//pressure = loadI32(0, 2);
rowCount = 4;
iconCount = 32;//loadI32(0, 1);
while (iconCount) {
float tmpSin = sinf(rot);
float tmpCos = cosf(rot);
//tmpCos = tmpCos * curve;
float tx1 = tmpSin * diam - (tmpCos * scale);
float tx2 = tx1 + (tmpCos * scale * 2.f);
float tz1 = tmpCos * diam + (tmpSin * scale);
float tz2 = tz1 - (tmpSin * scale * 2.f);

View File

@@ -70,18 +70,6 @@ public class RolloRS {
mAllocState.data(mAllocStateBuf);
}
public void setShadow(float x, float y, float size) {
// x and y are normalized at this point.
mAllocStateBuf[STATE_POS_X] = (int)(x * 1000);
mAllocStateBuf[STATE_POS_Y] = (int)(y * 1000);
mAllocStateBuf[STATE_PRESSURE] = (int)(size * 1000);
//Log.e("rs","shadow x=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
//" y=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
//" s=" + Integer.toString(mAllocStateBuf[STATE_PRESSURE]));
mAllocState.data(mAllocStateBuf);
}
public void setZoom(float z) {
//Log.e("rs", "zoom " + Float.toString(z));
@@ -104,7 +92,6 @@ public class RolloRS {
private RenderScript.Sampler mSampler;
private RenderScript.ProgramFragmentStore mPFSBackground;
private RenderScript.ProgramFragmentStore mPFSShadow;
private RenderScript.ProgramFragment mPFBackground;
private RenderScript.ProgramFragment mPFImages;
private RenderScript.ProgramVertex mPV;
@@ -153,16 +140,6 @@ public class RolloRS {
mPFSBackground = mRS.programFragmentStoreCreate();
mPFSBackground.setName("PFS");
mRS.programFragmentStoreBegin(null, null);
mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
mRS.programFragmentStoreDitherEnable(false);
mRS.programFragmentStoreDepthMask(true);
mRS.programFragmentStoreColorMask(false, false, false, false);
mPFSShadow = mRS.programFragmentStoreCreate();
mPFSShadow.setName("PFSShadow");
mPVAlloc = new ProgramVertexAlloc(mRS);
mRS.programVertexBegin(null, null);
mRS.programVertexSetTextureMatrixEnable(true);

View File

@@ -90,7 +90,6 @@ public class RolloView extends RSSurfaceView {
mRender.setTouch(ret);
if((ny > 0.85f) || mControlMode) {
mRender.setShadow(0, 0, 0);
mFlingMode = false;
// Projector control
@@ -107,7 +106,7 @@ public class RolloView extends RSSurfaceView {
mControlMode = false;
}
}
mColumn += dx * 3;// * zoom;
mColumn += -dx * 2.3;// * zoom;
mColumn += -(mZoom - zoom) * (nx - 0.5f) * 2 * zoom;
mZoom = zoom;
@@ -155,10 +154,8 @@ public class RolloView extends RSSurfaceView {
mFlingMode = true;
mFlingX = nx;
mFlingY = ny;
//mRender.setShadow(nx, ny, ev.getSize());
} else {
mFlingMode = false;
mRender.setShadow(nx, ny, 0);
}
}