示例#1
0
 /**
  * Set the capturer for this texture. If capturer is null, the existing capturer is removed.
  * Whether the capturer takes effect depends on the shader associated with {@code GVRMaterial}. In
  * order to support the texture capturer, a native shader should check {@code
  * RenderData::get_texture_capturer}. See {@code ExternalRendererShader} as an example.
  *
  * @param capturer The capturer.
  */
 public void setTextureCapturer(GVRTextureCapturer capturer) {
   if (capturer != null) {
     NativeRenderData.setTextureCapturer(getNative(), capturer.getNative());
   } else {
     NativeRenderData.setTextureCapturer(getNative(), 0);
   }
 }
示例#2
0
 /**
  * Disable lighting effect for the render_data. Note that it is different to GVRLight.disable().
  * GVRLight.disable turn off a light, while this method disable the lighting effect for the
  * render_data. The lighting effect is applied if and only if {@code mLight} is enabled (i.e. on)
  * AND the lighting effect is enabled for the render_data.
  */
 public void disableLight() {
   if (mLight == null) {
     throw new UnsupportedOperationException("No light is added yet.");
   }
   NativeRenderData.disableLight(getNative());
   isLightEnabled = false;
 }
示例#3
0
 /**
  * Set the {@link GVRMesh mesh} to be rendered.
  *
  * @param mesh The mesh to be rendered.
  */
 public void setMesh(GVRMesh mesh) {
   synchronized (this) {
     mMesh = mesh;
     mFutureMesh = null;
   }
   NativeRenderData.setMesh(getNative(), mesh.getNative());
 }
示例#4
0
  /**
   * Constructor.
   *
   * @param gvrContext Current {@link GVRContext}
   */
  public GVRRenderData(GVRContext gvrContext) {
    super(gvrContext, NativeRenderData.ctor());

    GVRRenderPass basePass = new GVRRenderPass(gvrContext);
    mRenderPassList = new ArrayList<GVRRenderPass>();
    addPass(basePass);
    isLightEnabled = false;
  }
示例#5
0
 /**
  * Set the draw mode for this mesh. Default is GL_TRIANGLES.
  *
  * @param drawMode
  */
 public void setDrawMode(int drawMode) {
   if (drawMode != GL_POINTS
       && drawMode != GL_LINES
       && drawMode != GL_LINE_STRIP
       && drawMode != GL_LINE_LOOP
       && drawMode != GL_TRIANGLES
       && drawMode != GL_TRIANGLE_STRIP
       && drawMode != GL_TRIANGLE_FAN) {
     throw new IllegalArgumentException(
         "drawMode must be one of GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP.");
   }
   NativeRenderData.setDrawMode(getNative(), drawMode);
 }
示例#6
0
  /**
   * Set the {@link GVRLight light} the mesh will be lit by.
   *
   * @param light The {@link GVRLight light} for rendering.
   */
  public void setLight(GVRLight light) {
    boolean supportsLight = false;

    for (int pass = 0; pass < mRenderPassList.size(); ++pass) {
      if (mRenderPassList.get(pass).getMaterial().getShaderType() == GVRShaderType.Texture.ID) {
        supportsLight = true;
        break;
      }
    }

    if (!supportsLight) {
      throw new UnsupportedOperationException("Only Texture shader can has light.");
    }

    mLight = light;
    NativeRenderData.setLight(getNative(), light.getNative());
    isLightEnabled = true;
  }
示例#7
0
 /** @return The OpenGL draw mode (e.g. GL_TRIANGLES). */
 public int getDrawMode() {
   return NativeRenderData.getDrawMode(getNative());
 }
示例#8
0
 /**
  * Set the {@code GL_BLEND} option
  *
  * @param alphaBlend {@code true} if {@code GL_BLEND} should be enabled, {@code false} if not.
  */
 public void setAlphaBlend(boolean alphaBlend) {
   NativeRenderData.setAlphaBlend(getNative(), alphaBlend);
 }
示例#9
0
 /** @return {@code true} if {@code GL_BLEND} is enabled, {@code false} if not. */
 public boolean getAlphaBlend() {
   return NativeRenderData.getAlphaBlend(getNative());
 }
示例#10
0
 /**
  * Set the {@code GL_DEPTH_TEST} option
  *
  * @param depthTest {@code true} if {@code GL_DEPTH_TEST} should be enabled, {@code false} if not.
  */
 public void setDepthTest(boolean depthTest) {
   NativeRenderData.setDepthTest(getNative(), depthTest);
 }
示例#11
0
 /** @return {@code true} if {@code GL_DEPTH_TEST} is enabled, {@code false} if not. */
 public boolean getDepthTest() {
   return NativeRenderData.getDepthTest(getNative());
 }
示例#12
0
 /**
  * Set the rendering options bit mask.
  *
  * @param renderMask The rendering options bit mask.
  * @see GVRRenderMaskBit
  */
 public void setRenderMask(int renderMask) {
   NativeRenderData.setRenderMask(getNative(), renderMask);
 }
示例#13
0
 /**
  * @return The {@code units} value passed to {@code glPolygonOffset()} if {@code
  *     GL_POLYGON_OFFSET_FILL} is enabled.
  * @see #setOffset(boolean)
  */
 public float getOffsetUnits() {
   return NativeRenderData.getOffsetUnits(getNative());
 }
示例#14
0
 /**
  * Add a render {@link GVRRenderPass pass} to this RenderData.
  *
  * @param pass
  */
 public void addPass(GVRRenderPass pass) {
   mRenderPassList.add(pass);
   NativeRenderData.addPass(getNative(), pass.getNative());
 }
示例#15
0
 /**
  * @return The {@code factor} value passed to {@code glPolygonOffset()} if {@code
  *     GL_POLYGON_OFFSET_FILL} is enabled.
  * @see #setOffset(boolean)
  */
 public float getOffsetFactor() {
   return NativeRenderData.getOffsetFactor(getNative());
 }
示例#16
0
 /**
  * Set the {@code GL_POLYGON_OFFSET_FILL} option
  *
  * @param offset {@code true} if {@code GL_POLYGON_OFFSET_FILL} should be enabled, {@code false}
  *     if not.
  */
 public void setOffset(boolean offset) {
   NativeRenderData.setOffset(getNative(), offset);
 }
示例#17
0
 /** @return {@code true} if {@code GL_POLYGON_OFFSET_FILL} is enabled, {@code false} if not. */
 public boolean getOffset() {
   return NativeRenderData.getOffset(getNative());
 }
示例#18
0
 /**
  * Set the order in which this mesh will be rendered.
  *
  * @param renderingOrder See {@link GVRRenderingOrder}
  */
 public void setRenderingOrder(int renderingOrder) {
   NativeRenderData.setRenderingOrder(getNative(), renderingOrder);
 }
示例#19
0
 /**
  * @return The order in which this mesh will be rendered.
  * @see GVRRenderingOrder
  */
 public int getRenderingOrder() {
   return NativeRenderData.getRenderingOrder(getNative());
 }
示例#20
0
 /**
  * Set the {@code units} value passed to {@code glPolygonOffset()} if {@code
  * GL_POLYGON_OFFSET_FILL} is enabled.
  *
  * @param offsetUnits Per OpenGL docs: Is multiplied by an implementation-specific value to create
  *     a constant depth offset. The initial value is 0.
  * @see #setOffset(boolean)
  */
 public void setOffsetUnits(float offsetUnits) {
   NativeRenderData.setOffsetUnits(getNative(), offsetUnits);
 }
示例#21
0
 /**
  * Set the {@code factor} value passed to {@code glPolygonOffset()} if {@code
  * GL_POLYGON_OFFSET_FILL} is enabled.
  *
  * @param offsetFactor Per OpenGL docs: Specifies a scale factor that is used to create a variable
  *     depth offset for each polygon. The initial value is 0.
  * @see #setOffset(boolean)
  */
 public void setOffsetFactor(float offsetFactor) {
   NativeRenderData.setOffsetFactor(getNative(), offsetFactor);
 }
示例#22
0
 /**
  * Get the rendering options bit mask.
  *
  * @return The rendering options bit mask.
  * @see GVRRenderMaskBit
  */
 public int getRenderMask() {
   return NativeRenderData.getRenderMask(getNative());
 }