Loading libs/rs/java/ModelViewer/res/raw/robot.a3d +28 B (141 KiB) File changed.No diff preview for this file type. View original file View changed file libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java +4 −5 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -123,7 +123,6 @@ public class SceneGraphRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } Loading Loading @@ -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); } Loading libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java +2 −3 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ public class SimpleModelRS { mRotation += 360; } mScript.set_gRotate(-(float)mRotation); mScript.set_gRotate((float)mRotation); mLastX = x; mLastY = y; Loading @@ -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); Loading @@ -119,7 +119,6 @@ public class SimpleModelRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } Loading libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs +6 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading Loading
libs/rs/java/ModelViewer/res/raw/robot.a3d +28 B (141 KiB) File changed.No diff preview for this file type. View original file View changed file
libs/rs/java/ModelViewer/src/com/android/modelviewer/SceneGraphRS.java +4 −5 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -123,7 +123,6 @@ public class SceneGraphRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } Loading Loading @@ -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); } Loading
libs/rs/java/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java +2 −3 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ public class SimpleModelRS { mRotation += 360; } mScript.set_gRotate(-(float)mRotation); mScript.set_gRotate((float)mRotation); mLastX = x; mLastY = y; Loading @@ -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); Loading @@ -119,7 +119,6 @@ public class SimpleModelRS { mPVA = new ProgramVertex.MatrixAllocation(mRS); mPVBackground.bindAllocation(mPVA); mPVA.setupProjectionNormalized(mWidth, mHeight); mScript.set_gPVBackground(mPVBackground); } Loading
libs/rs/java/ModelViewer/src/com/android/modelviewer/scenegraph.rs +4 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/rs/java/ModelViewer/src/com/android/modelviewer/simplemodel.rs +6 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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); Loading