本文整理汇总了Java中com.google.vr.sdk.base.GvrActivity类的典型用法代码示例。如果您正苦于以下问题:Java GvrActivity类的具体用法?Java GvrActivity怎么用?Java GvrActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GvrActivity类属于com.google.vr.sdk.base包,在下文中一共展示了GvrActivity类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: MyScreenController
import com.google.vr.sdk.base.GvrActivity; //导入依赖的package包/类
public MyScreenController(GvrActivity ctx) {
buttonLeft = new VRTextureButton(2, 2, "arrow_left.png", new VRTextureButton.VRClickListener() {
@Override
public void onClickListener() {
sceneIndex--;
if (sceneIndex < 0) {
sceneIndex = scenes.size() - 1;
}
}
});
buttonLeft.setPosition(-3, -3, -10);
buttonRight = new VRTextureButton(2, 2, "arrow_right.png", new VRTextureButton.VRClickListener() {
@Override
public void onClickListener() {
sceneIndex++;
if (sceneIndex >= scenes.size()) {
sceneIndex = 0;
}
}
});
buttonRight.setPosition(3, -3, -10);
//
// The distortion correction can be done at the vertex level adding a Shader Plugin to the scene
//
ShaderPlugin lensDistortionCorrection = null;
if (VRActivity.USE_VERTEX_DISPLACEMENT_LENS_DISTORTION) {
GvrView gvrView = ctx.getGvrView();
float coefs[] = PincushionUtils.approximateInverse(gvrView.getGvrViewerParams().getDistortion());
float maxRadius = PincushionUtils.getMaxRadius(gvrView.getScreenParams(), gvrView.getGvrViewerParams());
lensDistortionCorrection = new LensDistortionShaderPlugin(coefs[0], coefs[1], coefs[2], coefs[3], coefs[4], coefs[5], maxRadius * maxRadius);
}
Scene scene = new ObjLoaderScene(ctx);
scene.addChild(buttonLeft.object3d);
scene.addChild(buttonRight.object3d);
if (VRActivity.USE_VERTEX_DISPLACEMENT_LENS_DISTORTION) {
scene.setShaderPlugin(lensDistortionCorrection);
}
scenes.add(scene);
scene = new CubesScene(ctx);
scene.addChild(buttonLeft.object3d);
scene.addChild(buttonRight.object3d);
if (VRActivity.USE_VERTEX_DISPLACEMENT_LENS_DISTORTION) {
scene.setShaderPlugin(lensDistortionCorrection);
}
scenes.add(scene);
sceneHUD = new CrossHudScene();
}
开发者ID:mobialia,项目名称:jmini3d-vr-demo,代码行数:52,代码来源:MyScreenController.java
注:本文中的com.google.vr.sdk.base.GvrActivity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论