当前位置: 首页>>代码示例>>Java>>正文


Java Eye.getPerspective方法代码示例

本文整理汇总了Java中com.google.vrtoolkit.cardboard.Eye.getPerspective方法的典型用法代码示例。如果您正苦于以下问题:Java Eye.getPerspective方法的具体用法?Java Eye.getPerspective怎么用?Java Eye.getPerspective使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.vrtoolkit.cardboard.Eye的用法示例。


在下文中一共展示了Eye.getPerspective方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDrawEye

import com.google.vrtoolkit.cardboard.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.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    checkGLError("mColorParam");

    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(mView, 0, eye.getEyeView(), 0, mCamera, 0);

    // Set the position of the light
    Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 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(mModelView, 0, mView, 0, mModelCube, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0, mModelView, 0);
    drawCube();

    // Set mModelView for the floor, so we draw floor in the correct location
    Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0,
        mModelView, 0);
    drawFloor();
}
 
开发者ID:kothuri2,项目名称:MoleculeVR,代码行数:31,代码来源:MainActivity.java

示例2: onDrawEye

import com.google.vrtoolkit.cardboard.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.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    checkGLError("mColorParam");

    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(mView, 0, eye.getEyeView(), 0, mCamera, 0);

    // Build the ModelView and ModelViewProjection matrices
    // for calculating cube position and light.
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0, mModelView, 0);
    drawCube();
    drawPointer();
}
 
开发者ID:zerohun,项目名称:CardboardWebBrowser,代码行数:23,代码来源:MainActivity.java

示例3: onDrawEye

import com.google.vrtoolkit.cardboard.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.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();
}
 
开发者ID:ArcadiusK,项目名称:techcrunch-disrupt-esri-android,代码行数:31,代码来源:MainActivity.java

示例4: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
    if(resetCameraFlag)
    {
        float[] invertedEye = new float[16];
        Matrix.invertM(invertedEye, 0, eye.getEyeView(), 0);
        setUpCamera();
        Matrix.multiplyMM(mCameraMatrix, 0, invertedEye, 0, mCameraMatrix, 0);
        resetCameraFlag = false;
    }
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    if(lockCameraFlag) {
        mViewMatrix = mCameraMatrix.clone();
    }else{
        Matrix.multiplyMM(mViewMatrix, 0, eye.getEyeView(), 0, mCameraMatrix, 0);
    }



    Matrix.multiplyMV(mLightPosInWorldSpace, 0, mLightModelMatrix, 0, mLightPosInModelSpace, 0);
    Matrix.multiplyMV(mLightPosInEyeSpace, 0, mViewMatrix, 0, mLightPosInWorldSpace, 0);

    mProjectionMatrix = eye.getPerspective(Z_NEAR, Z_FAR);

    GLES20.glUseProgram(mProgramHandle);
    currentContent.draw(eye);

    if(drawRedPoint) {
        drawTargetingPoint();
    }
    Util.checkGLError("Error Draw Eye");
}
 
开发者ID:triforce930,项目名称:cardboard_ui_framework,代码行数:34,代码来源:CardboardUIActivity.java

示例5: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);
    GLES20.glEnable(GLES20.GL_CULL_FACE);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);

    Matrix.multiplyMM(mTexView, 0, eye.getEyeView(), 0, camera, 0);
    Matrix.multiplyMM(mTexModelView, 0, mTexView, 0, mModel, 0);
    Matrix.multiplyMM(mTexMVP, 0, perspective, 0, mTexModelView, 0);

    drawSphere();
}
 
开发者ID:LGDeveloper,项目名称:FriendsCameraSDK-android,代码行数:15,代码来源:ImageRenderer.java

示例6: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    VrUtils.checkGLError("colorParam");
    Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0);

    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);

    Matrix.multiplyMM(modelView, 0, view, 0, modelSphere, 0);
    Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);

    drawSphere();
}
 
开发者ID:LGDeveloper,项目名称:FriendsCameraSDK-android,代码行数:15,代码来源:VideoRenderer.java

示例7: onDrawEye

import com.google.vrtoolkit.cardboard.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);
  GLES20.glEnable(GLES20.GL_CULL_FACE);
  GLES20.glCullFace(GLES20.GL_BACK);

  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);

  float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);

  checkGLError("Before drawing notes");
  int i = 0;
  for (Note o : notes) {
    o.drawNote(view, perspective, lightPosInEyeSpace);
    i++;
    checkGLError("drew a note " + i);
  }
  checkGLError("After drawing notes");

  // Set modelView for the floor, so we draw floor in the correct location
  Matrix.multiplyMM(modelView, 0, view, 0, modelFloor, 0);
  checkGLError("Multiplied once");
  Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
  checkGLError("Before drawing floor");
  drawFloor();
}
 
开发者ID:grahamrob,项目名称:note60,代码行数:39,代码来源:MainActivity.java

示例8: onDrawEye

import com.google.vrtoolkit.cardboard.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();

    float[] videoMVP =  new float[16];
    Matrix.multiplyMM(videoMVP, 0, view, 0, videoScreenModelMatrix, 0);
    Matrix.multiplyMM(videoMVP, 0, perspective, 0, videoMVP, 0);
    mVideoRenderer.setMVPMatrix(videoMVP);
    if (renderSereo)
      mVideoRenderer.render(eye.getType());
    else  //When stereo rendering turned off always render the bottom image.
      mVideoRenderer.render(1);
  }
 
开发者ID:openforeveryone,项目名称:CardboardStereoVideo,代码行数:41,代码来源:MainActivity.java

示例9: onDrawEye

import com.google.vrtoolkit.cardboard.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.glClearColor(0.5f, 0.8f, 0.9f, 1.0f); // Dark background so text shows up well.

    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);

    // 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();

    drawShapes();
}
 
开发者ID:skylight1,项目名称:VR-Map-Explorer,代码行数:32,代码来源:MainActivity.java

示例10: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
@Override
public void onDrawEye(Eye eye) {
    float[] scratch = new float[16];

    mProjectionMatrix = eye.getPerspective( 0.1f, 100 );

    // Set the camera position (View matrix)
    Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -1, 0f, 0f, 0f, 0f, 1.0f, 0.0f);

    Matrix.setIdentityM(scratch, 0);

    Matrix.multiplyMM(scratch, 0, mViewMatrix, 0, eye.getEyeView(), 0);

    Matrix.rotateM(scratch, 0, -headAngleXZ, 0, 1.0f, 0);
    Matrix.rotateM(scratch, 0, -headAngleYZ, 1.0f, 0.0f, 0);
    Matrix.rotateM(scratch, 0, -headAngleXY, 0.0f, 0.0f, 1.0f);

    // Calculate the projection and view transformation
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, scratch, 0);

    // Draw square
    mSquare.draw(mMVPMatrix);

    // Create a rotation for the triangle

    // Use the following code to generate constant rotation.
    // Leave this code out when using TouchEvents.
    // long time = SystemClock.uptimeMillis() % 4000L;
    // float angle = 0.090f * ((int) time);

    Matrix.setRotateM(mRotationMatrix, 0, mAngle, 0, 0, 1.0f);

    // Combine the rotation matrix with the projection and camera view
    // Note that the mMVPMatrix factor *must be first* in order
    // for the matrix multiplication product to be correct.
    Matrix.multiplyMM(scratch, 0, mMVPMatrix, 0, mRotationMatrix, 0);

    // Draw triangle
    mTriangle.draw(scratch);
}
 
开发者ID:TheFakeMontyOnTheRun,项目名称:adapting-OpenGLES2-sample-into-cardboard,代码行数:41,代码来源:MyGLRenderer.java

示例11: onDrawEye

import com.google.vrtoolkit.cardboard.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(modelView, 0, view, 0, modelCube2, 0);*/
    //for (int i = 0; i < modelCubes.length; i++)
   // {
     //   Matrix.multiplyMM(modelView, 0, view, 0, modelCubes[i], 0);
   // }

  //Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
  //drawCube();
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    for (int i = 0; i < modelCubes.length; i++)
    {
        Matrix.multiplyMM(modelView, 0, view, 0, modelCubes[i], 0);
        Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0);
        drawCube(i);
    }

    // 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();
}
 
开发者ID:Shounak,项目名称:InSight-HackHarvard,代码行数:45,代码来源:MainActivity.java

示例12: transform

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
public void transform( Eye eye, float angleXZ, Vec3 trans) {
    float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
    Matrix.multiplyMM(view.values, 0, eye.getEyeView(), 0, camera.values, 0);

    if (!useVRMode ) {
        Matrix.rotateM(view.values, 0, -headAngleXZ, 0, 1.0f, 0);
        Matrix.rotateM(view.values, 0, -headAngleYZ, 1.0f, 0.0f, 0);
        Matrix.rotateM(view.values, 0, -headAngleXY, 0.0f, 0.0f, 1.0f);
        Matrix.rotateM(view.values, 0, cameraNode.angleXZ, 0, 1.0f, 0);
    }

    Matrix.translateM(view.values, 0, -cameraNode.localPosition.x, -cameraNode.localPosition.y, -cameraNode.localPosition.z);
    Matrix.translateM(view.values, 0, trans.x, trans.y, trans.z);
    Matrix.multiplyMM(modelViewProjection.values, 0, perspective, 0, view.values, 0);
}
 
开发者ID:TheFakeMontyOnTheRun,项目名称:droidhunterredux,代码行数:16,代码来源:CardboardRenderer.java

示例13: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
/**
 * Draws a frame for an eye.
 *
 * @param eye The eye to render. Includes all required transformations.
 */
@Override
public synchronized void onDrawEye(Eye eye) {

    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

 GLES20.glUniform4fv(lightColorUniform, 1, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0);
 GLES20.glUniform4fv(lightDirectionUniform, 1, new float[]{flashlightX, flashlightY, -1.0f, 1.0f}, 0);
 GLES20.glUniform4fv( ambientLightUniform, 1, new float[] { 0.5f, 0.5f, 0.5f, 1.0f }, 0 );

    if ( ready ) {
        // Build the ModelView and ModelViewProjection matrices
        float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);

        GLES20.glUseProgram(defaultProgram);
        GLES20.glEnable(GLES20.GL_DEPTH_TEST);

        // Apply the eye transformation to the camera.
        Matrix.multiplyMM(view.values, 0, eye.getEyeView(), 0, camera.values, 0);

        if (!useVRMode ) {
            Matrix.rotateM(view.values, 0, -headAngleXZ, 0, 1.0f, 0);
            Matrix.rotateM(view.values, 0, -headAngleYZ, 1.0f, 0.0f, 0);
            Matrix.rotateM(view.values, 0, -headAngleXY, 0.0f, 0.0f, 1.0f);
            Matrix.rotateM(view.values, 0, cameraNode.angleXZ, 0, 1.0f, 0);
        }

        Matrix.translateM(view.values, 0, -cameraNode.localPosition.x, -cameraNode.localPosition.y, -cameraNode.localPosition.z);
        Matrix.multiplyMM(modelViewProjection.values, 0, perspective, 0, view.values, 0);

        // Set the ModelViewProjection matrix in the shader.
        GLES20.glUniformMatrix4fv(modelViewProjectionParam, 1, false, modelViewProjection.values, 0);

        float[] lightsBuffer = new float[ lights.size() * 4 ];

        int index = 0;
        Vec3 pos;
        for ( LightNode light : this.lights ) {
            pos = light.getAbsolutePosition();
            lightsBuffer[ index + 0 ] = pos.x;
            lightsBuffer[ index + 1 ] = pos.y;
            lightsBuffer[ index + 2 ] = pos.z;
            lightsBuffer[ index + 3 ] = 1;
            index += 4;
        }

        drawPerMaterialStaticMesh();
        drawMeshes(eye);
    }
}
 
开发者ID:TheFakeMontyOnTheRun,项目名称:droidhunterredux,代码行数:55,代码来源:CardboardRenderer.java

示例14: onDrawEye

import com.google.vrtoolkit.cardboard.Eye; //导入方法依赖的package包/类
@Override
public void onDrawEye(Eye eye) {

    perspective = eye.getPerspective(1f, 1e4f);
    super.onDrawFrame(null);

}
 
开发者ID:tangrams,项目名称:tangram-cardboard,代码行数:8,代码来源:CardboardMapController.java

示例15: onDrawEye

import com.google.vrtoolkit.cardboard.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("mColorParam");//dies here
    //drawVideo();


    // Apply the eye transformation to the camera.
    Matrix.multiplyMM(mView, 0, eye.getEyeView(), 0, mCamera, 0);

    // Set the position of the light
    Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 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(mModelView, 0, mView, 0, mModelCube, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0, mModelView, 0);
    if (eye.getType() == 1)
    {
        drawVideo(-0.20f);
    }
    else
    {
        drawVideo(0.20f);
    }


    drawCube();

    // Set mModelView for the floor, so we draw floor in the correct location
    Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0);
    Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0,
            mModelView, 0);

    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    drawFloor();

}
 
开发者ID:mkfuchs,项目名称:cardboardVideoSample,代码行数:54,代码来源:MainActivity.java


注:本文中的com.google.vrtoolkit.cardboard.Eye.getPerspective方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。