@Override protected void initScene() { // Remember to call super.initScene() to allow TangoRajawaliArRenderer to set-up super.initScene(); // Add a directional light in an arbitrary direction DirectionalLight light = new DirectionalLight(1, 0.2, -1); light.setColor(1, 1, 1); light.setPower(0.8f); light.setPosition(3, 2, 4); getCurrentScene().addLight(light); // Set-up a material: green with application of the light Material material = new Material(); material.setColor(0xff009900); material.enableLighting(true); material.setDiffuseMethod(new DiffuseMethod.Lambert()); // Build a pyramid and place it roughly in front and a bit to the right Object3D object1 = new NPrism(4, 0f, 0.2f, 0.2f); object1.setMaterial(material); object1.setPosition(-0.25, 0, -1); getCurrentScene().addChild(object1); // Build a sphere and place it roughly in front and a bit to the left object1 = new Sphere(0.1f, 24, 24); object1.setMaterial(material); object1.setPosition(0.25, 0, -1); getCurrentScene().addChild(object1); }
@Override public void initScene() { getCurrentScene().setBackgroundColor(Color.GRAY); Object3D o = new Sphere(1, 10, 10); o.setMaterial(new Material()); o.setColor(Color.RED); o.setPosition(-1, 0, 0); getCurrentScene().addChild(o); o = new Sphere(1, 10, 10); o.setMaterial(new Material()); o.setColor(Color.GREEN); o.setPosition(0, 0, 0); getCurrentScene().addChild(o); o = new Sphere(1, 10, 10); o.setMaterial(new Material()); o.setColor(Color.BLUE); o.setPosition(1, 0, 0); getCurrentScene().addChild(o); }
@Override protected void initScene() { try { DirectionalLight light = new DirectionalLight(); light.setLookAt(1, -1, 1); light.enableLookAt(); light.setPower(1.5f); getCurrentScene().addLight(light); light = new DirectionalLight(); light.setLookAt(-1, 1, -1); light.enableLookAt(); light.setPower(1.5f); getCurrentScene().addLight(light); DebugVisualizer debugViz = new DebugVisualizer(this); debugViz.addChild(new GridFloor()); getCurrentScene().addChild(debugViz); final LoaderAWD parser = new LoaderAWD(mContext.getResources(), mTextureManager, R.raw.awd_suzanne); parser.parse(); final Object3D monkey = parser.getParsedObject(); Material material = new Material(); material.enableLighting(true); material.setDiffuseMethod(new DiffuseMethod.Lambert()); material.setColor(0x990000); monkey.setMaterial(material); getCurrentScene().addChild(monkey); material = new Material(); material.enableLighting(true); material.setDiffuseMethod(new DiffuseMethod.Lambert()); material.setColor(0x999900); Object3D monkey2 = monkey.clone(); monkey2.setMaterial(material); monkey2.setPosition(-3, 3, 3); getCurrentScene().addChild(monkey2); ArcballCamera arcball = new ArcballCamera(mContext, ((Activity) mContext).findViewById(R.id.content_frame)); arcball.setPosition(4, 4, 4); getCurrentScene().replaceAndSwitchCamera(getCurrentCamera(), arcball); } catch (Exception e) { e.printStackTrace(); } }