本文整理汇总了Java中com.google.vr.sdk.base.Eye类的典型用法代码示例。如果您正苦于以下问题:Java Eye类的具体用法?Java Eye怎么用?Java Eye使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Eye类属于com.google.vr.sdk.base包,在下文中一共展示了Eye类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
checkGLError("colorParam");
// Apply the eye transformation to the camera.
Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
// Set the position of the light
Matrix.multiplyMV(lightPosInEyeSpace, 0, view, 0, LIGHT_POS_IN_WORLD_SPACE, 0);
// Build the ModelView and ModelViewProjection matrices
// for calculating cube position and light.
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(modelView, 0, view, 0, modelCube, 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
drawCube();
// Set modelView for the floor, so we draw floor in the correct location
Matrix.multiplyMM(modelView, 0, view, 0, modelFloor, 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
drawFloor();
}
示例2: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
// TODO: Do something with the head and/or eye transform (e.g. pan the photo around)
// For now, just reset the view matrix, so that the photo is in the center at all times.
Matrix.setIdentityM(view, 0);
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
if (eye.getType() == 1) {
Matrix.multiplyMM(modelView, 0, view, 0, rectLeftEye.getModelMatrix(), 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
rectLeftEye.draw(modelViewProjection);
} else {
Matrix.multiplyMM(modelView, 0, view, 0, rectRightEye.getModelMatrix(), 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
rectRightEye.draw(modelViewProjection);
}
}
示例3: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
// Clear the color buffer set above by glClearColor.
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);
//need this otherwise, it will over right stuff and the cube will look wrong!
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
// Apply the eye transformation to the camera.
Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
// combine the model with the view matrix to create the modelview matreix
Matrix.multiplyMM(modelview, 0, view, 0, mRotationMatrix, 0);
// combine the model-view with the projection matrix
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
//finally draw the cube with the full Model-view-projection matrix.
mCube.draw(mMVPMatrix);
}
示例4: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
checkGLError("colorParam");
// Apply the eye transformation to the camera.
Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
// Set the position of the light
Matrix.multiplyMV(lightPosInEyeSpace, 0, view, 0, LIGHT_POS_IN_WORLD_SPACE, 0);
// Build the ModelView and ModelViewProjection matrices
// for calculating cube position and light.
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(modelView, 0, view, 0, modelCube, 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
drawCube();
// Set modelView for the floor, so we draw floor in the correct location
Matrix.multiplyMM(modelView, 0, view, 0, modelFloor, 0);
Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
drawFloor();
}
示例5: render
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
public void render(Scene scene, Eye eye, Renderer3d renderer3d) {
// Allow concurrence separating matices
if (eye.getType() == Eye.Type.LEFT) {
MatrixUtils.copyMatrix(eye.getPerspective(scene.camera.getNear(), scene.camera.getFar()), leftProjectionMatrix);
MatrixUtils.multiply(eye.getEyeView(), scene.camera.viewMatrix, leftViewMatrix);
renderer3d.render(scene, leftProjectionMatrix, leftViewMatrix);
} else {
MatrixUtils.copyMatrix(eye.getPerspective(scene.camera.getNear(), scene.camera.getFar()), rightProjectionMatrix);
MatrixUtils.multiply(eye.getEyeView(), scene.camera.viewMatrix, rightViewMatrix);
renderer3d.render(scene, rightProjectionMatrix, rightViewMatrix);
}
}
示例6: render
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
@Override
public void render(Eye eye, Renderer3d renderer3d) {
eyeRender.render(scenes.get(sceneIndex), eye, renderer3d);
renderer3d.render(sceneHUD);
}
示例7: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
screenController.render(eye, renderer3d);
}
示例8: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
float[] eyeView = eye.getEyeView();
renderer.render(perspective, eyeView);
}
示例9: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
Viewport curView = eye.getViewport();
Viewport initViewport = new Viewport();
initViewport.setViewport(curView.x, curView.y, curView.width, curView.height);
FieldOfView curFov = eye.getFov();
FieldOfView initFov = new FieldOfView(curFov.getLeft(), curFov.getRight(), curFov.getBottom(), curFov.getTop());
// Change to camera resolution for scene render
eye.getViewport().setViewport(0, 0, mPreviewSize.getWidth(), mPreviewSize.getHeight());
eye.getFov().setAngles((float)mFov.x / 2.0f, (float)mFov.x / 2.0f, (float)mFov.y / 2.0f, (float)mFov.y / 2.0f);
eye.getViewport().setGLViewport();
eye.getViewport().setGLScissor();
eye.setProjectionChanged();
// Apply the eye transformation to the camera.
float[] viewMat = new float[16];
Matrix.multiplyMM(viewMat, 0, eye.getEyeView(), 0, mCamera, 0);
// Get the perspective matrix for 3D objects rendering
// Create FOV identical to physical
float[] perspective = new float[16];
perspective = eye.getPerspective(Z_NEAR, Z_FAR);
//Matrix.perspectiveM(perspective, 0, (float)mFov.y, (float)mPreviewSize.getWidth() / (float)mPreviewSize.getHeight(), Z_NEAR, Z_FAR);
// FieldOfView physFov = new FieldOfView((float)mFov.x, (float)mFov.x, (float)mFov.y, (float)mFov.y);
// physFov.toPerspectiveMatrix(Z_NEAR, Z_FAR, perspective, 0);
// First draw object scene texture through frame buffer
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFboIdObjects);
if (eye.getType() == Eye.Type.LEFT) {
GLES20.glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
} else {
GLES20.glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
}
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
//GLES20.glViewport(0, 0, mPreviewSize.getWidth(), mPreviewSize.getHeight());
//GLES20.glViewport(0, 0, 100, 100);
drawObjects(viewMat, perspective);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, DEFAULT_FBO_ID);
// Change back to initial res
eye.getViewport().setViewport(initViewport.x, initViewport.y, initViewport.width, initViewport.height);
eye.getFov().setAngles(initFov.getLeft(), initFov.getRight(), initFov.getBottom(), initFov.getTop());
eye.getViewport().setGLViewport();
eye.getViewport().setGLScissor();
eye.setProjectionChanged();
// Recalculate the perspective matrix for vr view
perspective = eye.getPerspective(Z_NEAR, Z_FAR);
// Matrix.perspectiveM(perspective, 0, eye.getFov().getTop(), (float)eye.getViewport().width / (float)eye.getViewport().height, Z_NEAR, Z_FAR);
// Now draw actual screen for cardboard viewer
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
//eye.getViewport().setGLViewport();
screenRenderer.draw(viewMat, perspective);
}
示例10: onDrawEye
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
// Clear the color buffer set above by glClearColor.
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT | GLES30.GL_DEPTH_BUFFER_BIT);
//need this otherwise, it will over right stuff and the cube will look wrong!
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
// Apply the eye transformation to the camera.
Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);
// Set the position of the light
Matrix.multiplyMV(lightPosInEyeSpace, 0, view, 0, LIGHT_POS_IN_WORLD_SPACE, 0);
// combine the model with the view matrix to create the modelview matreix
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix0, 0);
// combine the model-view with the projection matrix
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
//finally draw the cube with the full Model-view-projection matrix.
mCube.draw(mMVPMatrix);
//now create the mvp matrix for cube2 and then draw it.
// combine the model with the view matrix to create the modelview matreix
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix1, 0);
// combine the model-view with the projection matrix
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mPyramid.draw(mMVPMatrix);
//now the next 5
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix2, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mPyramid.draw(mMVPMatrix);
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix3, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mCube.draw(mMVPMatrix);
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix4, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mCube.draw(mMVPMatrix);
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix5, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mCube.draw(mMVPMatrix);
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix6, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mPyramid.draw(mMVPMatrix);
Matrix.multiplyMM(modelview, 0, view, 0, CubeMatrix7, 0);
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mPyramid.draw(mMVPMatrix);
//now calculate for the floor
Matrix.multiplyMM(modelview, 0, view, 0, modelFloor, 0);
// combine the model-view with the projection matrix
Matrix.multiplyMM(mMVPMatrix, 0, perspective, 0, modelview, 0);
mFloor.drawFloor(mMVPMatrix, modelFloor, modelview, lightPosInEyeSpace);
}
示例11: render
import com.google.vr.sdk.base.Eye; //导入依赖的package包/类
public void render(Eye eye, Renderer3d renderer3d);