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


Java GVRTexture类代码示例

本文整理汇总了Java中org.gearvrf.GVRTexture的典型用法代码示例。如果您正苦于以下问题:Java GVRTexture类的具体用法?Java GVRTexture怎么用?Java GVRTexture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: NaviWebViewSceneObject

import org.gearvrf.GVRTexture; //导入依赖的package包/类
/**
 * Shows a web page on a {@linkplain GVRSceneObject scene object} with an
 * arbitrarily complex geometry.
 *
 * @param gvrContext
 *            current {@link GVRContext}
 * @param mesh
 *            a {@link GVRMesh} - see
 *            {@link GVRContext#loadMesh(org.gearvrf.GVRAndroidResource)}
 *            and {@link GVRContext#createQuad(float, float)}
 * @param webView
 *            an Android {@link WebView}
 */
public NaviWebViewSceneObject(GVRContext gvrContext, GVRMesh mesh,
        WebView webView) {
    super(gvrContext, mesh);

    mWebView = webView;
    gvrContext.registerDrawFrameListener(this);

    GVRTexture texture = new GVRExternalTexture(gvrContext);
    GVRMaterial material = new GVRMaterial(gvrContext, GVRShaderType.OES.ID);
    material.setMainTexture(texture);
    getRenderData().setMaterial(material);

    mSurfaceTexture = new SurfaceTexture(texture.getId());
    mSurface = new Surface(mSurfaceTexture);
    mSurfaceTexture.setDefaultBufferSize(mWebView.getWidth(),
            mWebView.getHeight());
}
 
开发者ID:mrgrimnevil,项目名称:browser-vr,代码行数:31,代码来源:NaviWebViewSceneObject.java

示例2: onInit

import org.gearvrf.GVRTexture; //导入依赖的package包/类
@Override
public void onInit(GVRContext gvrContext) throws Throwable {

    //Load texture
    GVRTexture texture = gvrContext.getAssetLoader().loadTexture(new GVRAndroidResource(gvrContext, R.drawable.__default_splash_screen__));

    //Create a rectangle with the texture we just loaded
    GVRSceneObject quad = new GVRSceneObject(gvrContext, 4, 2, texture);
    quad.getTransform().setPosition(0, 0, -3);

    //Add rectangle to the scene
    gvrContext.getMainScene().addSceneObject(quad);
}
 
开发者ID:nitosan,项目名称:GearVRf-template,代码行数:14,代码来源:MainActivity.java

示例3: createMesh

import org.gearvrf.GVRTexture; //导入依赖的package包/类
public static GVRSceneObject createMesh(int meshID, int textureID) {
    if (s_Context == null) {
        Log.e(TAG, "GVRContext is not initialized");
        return null;
    }

    GVRMesh mesh = s_Context.getAssetLoader().loadMesh(new GVRAndroidResource(s_Context, meshID));
    GVRTexture texture = s_Context.getAssetLoader().loadTexture(new GVRAndroidResource(s_Context, textureID));
    GVRSceneObject sceneObject = new GVRSceneObject(s_Context, mesh, texture);

    return sceneObject;
}
 
开发者ID:nitosan,项目名称:GearVRf-template,代码行数:13,代码来源:Gvr.java

示例4: setGradient

import org.gearvrf.GVRTexture; //导入依赖的package包/类
public void setGradient(int[] colors, float[] stops) {
    GVRTexture texture;
    if (stops != null)
        texture = new Gradient().generate(mContext, colors, stops);
    else
        texture = new Gradient().generate(mContext, colors);

    GVRMaterial material = new GVRMaterial(mContext);
    material.setMainTexture(texture);

    for (int i = 0; i < 2; i++) {
        objects[i].getRenderData().setMaterial(material);
    }
}
 
开发者ID:mrgrimnevil,项目名称:browser-vr,代码行数:15,代码来源:Background.java

示例5: Button

import org.gearvrf.GVRTexture; //导入依赖的package包/类
public Button(GVRContext mContext, String name, int resId) {
    GVRTexture texture = mContext.loadTexture(
            new GVRAndroidResource(mContext, resId ));

    sceneObject = new GVRSceneObject(mContext, 0.3f, 0.3f, texture);
    sceneObject.getRenderData().getMaterial().setOpacity(DEFAULT_OPACITY);

    this.name = name;
    sceneObject.setName(name);

    // TODO: set texture, etc
}
 
开发者ID:mrgrimnevil,项目名称:browser-vr,代码行数:13,代码来源:Button.java

示例6: EditTextSceneObject

import org.gearvrf.GVRTexture; //导入依赖的package包/类
/**
 * Shows a {@link TextView} on a {@linkplain GVRSceneObject scene object}.
 *
 * @param gvrContext
 *            current {@link GVRContext}
 * @param mesh
 *            A {@link GVRMesh} - see
 *            {@link GVRContext#loadMesh(org.gearvrf.GVRAndroidResource)}
 *            and {@link GVRContext#createQuad(float, float)}.
 *
 *            Please note that this mesh controls the size of your scene
 *            object, and it is independent of the size of the internal
 *            {@code TextView}: a large mismatch between the scene object's
 *            size and the view's size will result in 'spidery' or 'blocky'
 *            text.
 * @param gvrActivity
 *            a {@link GVRActivity}
 * @param viewWidth
 *            Width of the {@link TextView}
 * @param viewHeight
 *            Height of the {@link TextView}
 * @param text
 *            {@link CharSequence} to show on the textView
 */
public EditTextSceneObject(GVRContext gvrContext, GVRMesh mesh,
        GVRActivity gvrActivity, int viewWidth, int viewHeight,
        CharSequence text) {
    super(gvrContext, mesh);

    mTextView = new EditText(gvrActivity);
    mTextView.setLayoutParams(new LayoutParams(viewWidth, viewHeight));
    mTextView.measure(viewWidth, viewHeight);
    mTextView.setBackgroundColor(Color.TRANSPARENT);
    mTextView.setText(text);
    mTextView.setVisibility(View.VISIBLE);

    mTextViewContainer = new LinearLayout(gvrActivity);
    mTextViewContainer.addView(mTextView);
    mTextViewContainer.measure(viewWidth, viewHeight);
    mTextViewContainer.layout(0, 0, viewWidth, viewHeight);
    mTextViewContainer.setVisibility(View.VISIBLE);

    gvrContext.registerDrawFrameListener(mFrameListener);

    GVRTexture texture = new GVRExternalTexture(gvrContext);
    GVRMaterial material = new GVRMaterial(gvrContext, GVRShaderType.OES.ID);
    material.setMainTexture(texture);
    getRenderData().setMaterial(material);

    mSurfaceTexture = new SurfaceTexture(texture.getId());
    mSurface = new Surface(mSurfaceTexture);
    mSurfaceTexture.setDefaultBufferSize(mTextViewContainer.getWidth(),
            mTextViewContainer.getHeight());
}
 
开发者ID:mrgrimnevil,项目名称:browser-vr,代码行数:55,代码来源:EditTextSceneObject.java

示例7: Cursor

import org.gearvrf.GVRTexture; //导入依赖的package包/类
public Cursor(GVRContext gvrContext) {
    GVRTexture texture = gvrContext.loadTexture(
            new GVRAndroidResource( gvrContext, R.raw.cross) );

    sceneObject = new GVRSceneObject(gvrContext, 0.05f, 0.05f, texture);

    sceneObject.getRenderData().setDepthTest(false);
    sceneObject.getRenderData().setRenderingOrder(100000);

    this.setDistance( distance );
}
 
开发者ID:mrgrimnevil,项目名称:browser-vr,代码行数:12,代码来源:Cursor.java


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