| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chromoting.cardboard; | 5 package org.chromium.chromoting.cardboard; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.graphics.Point; | 8 import android.graphics.Point; |
| 9 import android.graphics.PointF; | 9 import android.graphics.PointF; |
| 10 import android.opengl.GLES20; | 10 import android.opengl.GLES20; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 mEyePointModelMatrix = new float[16]; | 117 mEyePointModelMatrix = new float[16]; |
| 118 mEyePointCombinedMatrix = new float[16]; | 118 mEyePointCombinedMatrix = new float[16]; |
| 119 mPhotosphereCombinedMatrix = new float[16]; | 119 mPhotosphereCombinedMatrix = new float[16]; |
| 120 | 120 |
| 121 mForwardVector = new float[3]; | 121 mForwardVector = new float[3]; |
| 122 } | 122 } |
| 123 | 123 |
| 124 private void initializeRedrawCallback() { | 124 private void initializeRedrawCallback() { |
| 125 mActivity.runOnUiThread(new Runnable() { | 125 mActivity.runOnUiThread(new Runnable() { |
| 126 public void run() { | 126 public void run() { |
| 127 mClient.provideRedrawCallback(new Runnable() { | 127 mClient.getDisplay().provideRedrawCallback(new Runnable() { |
| 128 @Override | 128 @Override |
| 129 public void run() { | 129 public void run() { |
| 130 mDesktop.reloadTexture(); | 130 mDesktop.reloadTexture(); |
| 131 mCursor.reloadTexture(); | 131 mCursor.reloadTexture(); |
| 132 } | 132 } |
| 133 }); | 133 }); |
| 134 | 134 |
| 135 mClient.redrawGraphics(); | 135 mClient.getDisplay().redrawGraphics(); |
| 136 } | 136 } |
| 137 }); | 137 }); |
| 138 } | 138 } |
| 139 | 139 |
| 140 @Override | 140 @Override |
| 141 public void onSurfaceCreated(EGLConfig config) { | 141 public void onSurfaceCreated(EGLConfig config) { |
| 142 // Set the background clear color to black. | 142 // Set the background clear color to black. |
| 143 GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); | 143 GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| 144 | 144 |
| 145 // Use culling to remove back faces. | 145 // Use culling to remove back faces. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 theta = Math.atan(mDesktop.getHalfWidth() | 425 theta = Math.atan(mDesktop.getHalfWidth() |
| 426 / (DESKTOP_POSITION_Z - mCameraPosition)); | 426 / (DESKTOP_POSITION_Z - mCameraPosition)); |
| 427 } | 427 } |
| 428 | 428 |
| 429 // Calculate current looking angle. | 429 // Calculate current looking angle. |
| 430 double phi = Math.atan(mForwardVector[0] / mForwardVector[2]); | 430 double phi = Math.atan(mForwardVector[0] / mForwardVector[2]); |
| 431 | 431 |
| 432 return Math.abs(phi) > FARAWAY_ANGLE_RATIO * Math.abs(theta); | 432 return Math.abs(phi) > FARAWAY_ANGLE_RATIO * Math.abs(theta); |
| 433 } | 433 } |
| 434 } | 434 } |
| OLD | NEW |