diff --git a/app/src/main/java/com/google/ar/core/examples/java/common/framework/RWT/RWTRenderer.java b/app/src/main/java/com/google/ar/core/examples/java/common/framework/RWT/RWTRenderer.java index da0bad2..3fadba8 100644 --- a/app/src/main/java/com/google/ar/core/examples/java/common/framework/RWT/RWTRenderer.java +++ b/app/src/main/java/com/google/ar/core/examples/java/common/framework/RWT/RWTRenderer.java @@ -2,10 +2,13 @@ import android.opengl.GLSurfaceView.Renderer; +import com.google.ar.core.Session; +import com.google.ar.core.examples.java.common.framework.model3D.Universe; import com.google.ar.core.examples.java.common.framework.view3D.Camera3D; import com.google.ar.core.examples.java.common.framework.view3D.Viewer3D; import com.google.ar.core.examples.java.common.java3d.GraphicsContext3D; import com.google.ar.core.examples.java.common.java3d.Light; +import com.google.ar.core.examples.java.helloar.HelloArActivity; import java.util.ArrayList; @@ -14,23 +17,27 @@ public class RWTRenderer implements Renderer { protected Viewer3D viewer; - protected Camera3D camera; + protected Session session; + protected HelloArActivity helloArActivity; + protected Universe universe; protected GraphicsContext3D gc3D = null; - public RWTRenderer() { + public RWTRenderer(Session session, HelloArActivity helloArActivity) { super(); + this.session = session; + this.helloArActivity = helloArActivity; } - public void attachCamera(Camera3D camera) { - // onSurfaceCreated()より先に呼ばれる - this.camera = camera; - viewer = new Viewer3D(camera); - } +// public void attachCamera(Camera3D camera) { +// // onSurfaceCreated()より先に呼ばれる +// this.camera = camera; +// viewer = new Viewer3D(camera); +// } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { gc3D = new GraphicsContext3D(gl); - ArrayList lights = camera.getUniverse().getLights(); + ArrayList lights = universe.getLights(); for (int i = 0; i < lights.size(); i++){ Light l = lights.get(i); gc3D.setLight(l,i); @@ -51,17 +58,19 @@ @Override public void onDrawFrame(GL10 gl) { - if (gc3D == null) { - gc3D = new GraphicsContext3D(gl); - viewer.setGraphicsContext3D(gc3D); - } else { - viewer.setGraphicsContext3D(gc3D.setGL10(gl)); - } - viewer.onDrawFrame(); +// if (gc3D == null) { +// gc3D = new GraphicsContext3D(gl); +// viewer.setGraphicsContext3D(gc3D); +// } else { +// viewer.setGraphicsContext3D(gc3D.setGL10(gl)); +// } +// viewer.onDrawFrame(); +// +// // 3Dモデルのレンダリング +// gc3D.pushMatrix(); +// universe.render(viewer); +// gc3D.popMatrix(); - // 3Dモデルのレンダリング - gc3D.pushMatrix(); - camera.getUniverse().render(viewer); - gc3D.popMatrix(); + helloArActivity.onDrawFrame(gl); } }