diff options
| -rw-r--r-- | libs/rs/java/ModelViewer/res/raw/robot.a3d | bin | 144500 -> 144528 bytes | |||
| -rw-r--r-- | libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java | 9 | ||||
| -rw-r--r-- | libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java | 5 | ||||
| -rw-r--r-- | libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs | 4 | ||||
| -rw-r--r-- | libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs | 8 | ||||
| -rw-r--r-- | libs/rs/java/Samples/res/raw/torus.a3d | bin | 571236 -> 571248 bytes |
6 files changed, 16 insertions, 10 deletions
diff --git a/libs/rs/java/ModelViewer/res/raw/robot.a3d b/libs/rs/java/ModelViewer/res/raw/robot.a3d Binary files differindex 2d7d32b6fb02..f48895cd8451 100644 --- a/libs/rs/java/ModelViewer/res/raw/robot.a3d +++ b/libs/rs/java/ModelViewer/res/raw/robot.a3d diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java index 9672a6a604bb..85c1d42de4da 100644 --- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java +++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java @@ -105,7 +105,7 @@ public class SceneGraphRS { bs.setMin(Sampler.Value.LINEAR); bs.setMag(Sampler.Value.LINEAR); bs.setWrapS(Sampler.Value.CLAMP); - bs.setWrapT(Sampler.Value.WRAP); + bs.setWrapT(Sampler.Value.CLAMP); mSampler = bs.create(); ProgramFragment.Builder b = new ProgramFragment.Builder(mRS); @@ -123,7 +123,6 @@ public class SceneGraphRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); - mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } @@ -159,14 +158,14 @@ public class SceneGraphRS { mGroup1.addChild(mRobot1); mGroup1.addChild(mRobot2); - mGroup1.setTransform(0, new Float4(0.0f, 0.0f, 5.0f, 0.0f), TransformType.TRANSLATE); + mGroup1.setTransform(0, new Float4(0.0f, 0.0f, -15.0f, 0.0f), TransformType.TRANSLATE); mGroup1.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, 15.0f), TransformType.ROTATE); - mRobot1.setTransform(0, new Float4(-2.0f, -0.5f, 0.0f, 0.0f), TransformType.TRANSLATE); + mRobot1.setTransform(0, new Float4(-3.0f, -0.5f, 0.0f, 0.0f), TransformType.TRANSLATE); mRobot1.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, 20.0f), TransformType.ROTATE); mRobot1.setTransform(2, new Float4(0.2f, 0.2f, 0.2f, 0.0f), TransformType.SCALE); - mRobot2.setTransform(0, new Float4(2.0f, 0.0f, 0.0f, 0.0f), TransformType.TRANSLATE); + mRobot2.setTransform(0, new Float4(3.0f, 0.0f, 0.0f, 0.0f), TransformType.TRANSLATE); mRobot2.setTransform(1, new Float4(0.0f, 1.0f, 0.0f, -20.0f), TransformType.ROTATE); mRobot2.setTransform(2, new Float4(0.3f, 0.3f, 0.3f, 0.0f), TransformType.SCALE); } diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java index b8b0119e779c..d8d1a6e01039 100644 --- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java +++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java @@ -79,7 +79,7 @@ public class SimpleModelRS { mRotation += 360; } - mScript.set_gRotate(-(float)mRotation); + mScript.set_gRotate((float)mRotation); mLastX = x; mLastY = y; @@ -101,7 +101,7 @@ public class SimpleModelRS { bs.setMin(Sampler.Value.LINEAR); bs.setMag(Sampler.Value.LINEAR); bs.setWrapS(Sampler.Value.CLAMP); - bs.setWrapT(Sampler.Value.WRAP); + bs.setWrapT(Sampler.Value.CLAMP); mSampler = bs.create(); ProgramFragment.Builder b = new ProgramFragment.Builder(mRS); @@ -119,7 +119,6 @@ public class SimpleModelRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); - mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs index c7944386e6b9..ce6bb1e02d7c 100644 --- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs +++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs @@ -71,6 +71,10 @@ int root(int launchID) { rsgClearDepth(1.0f); rsgBindProgramVertex(gPVBackground); + rs_matrix4x4 proj; + float aspect = (float)rsgGetWidth() / (float)rsgGetHeight(); + rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f); + rsgProgramVertexLoadProjectionMatrix(&proj); rsgBindProgramFragment(gPFBackground); rsgBindProgramStore(gPFSBackground); diff --git a/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs b/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs index adb609c1eb0c..43be2667fe65 100644 --- a/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs +++ b/libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs @@ -46,6 +46,10 @@ int root(int launchID) { rsgClearDepth(1.0f); rsgBindProgramVertex(gPVBackground); + rs_matrix4x4 proj; + float aspect = (float)rsgGetWidth() / (float)rsgGetHeight(); + rsMatrixLoadPerspective(&proj, 30.0f, aspect, 0.1f, 100.0f); + rsgProgramVertexLoadProjectionMatrix(&proj); rsgBindProgramFragment(gPFBackground); rsgBindProgramStore(gPFSBackground); @@ -54,9 +58,9 @@ int root(int launchID) { rs_matrix4x4 matrix; rsMatrixLoadIdentity(&matrix); // Position our model on the screen - rsMatrixTranslate(&matrix, 0.0f, -0.3f, 1.2f); + rsMatrixTranslate(&matrix, 0.0f, -0.3f, -10.0f); rsMatrixScale(&matrix, 0.2f, 0.2f, 0.2f); - rsMatrixRotate(&matrix, -25.0f, 1.0f, 0.0f, 0.0f); + rsMatrixRotate(&matrix, 25.0f, 1.0f, 0.0f, 0.0f); rsMatrixRotate(&matrix, gRotate, 0.0f, 1.0f, 0.0f); rsgProgramVertexLoadModelMatrix(&matrix); diff --git a/libs/rs/java/Samples/res/raw/torus.a3d b/libs/rs/java/Samples/res/raw/torus.a3d Binary files differindex d09bc136ace9..0322b01be8a8 100644 --- a/libs/rs/java/Samples/res/raw/torus.a3d +++ b/libs/rs/java/Samples/res/raw/torus.a3d |