/** * 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); } }
/** * 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; }
/** * 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()); }
/** * 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; }
/** * 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); }
/** * 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; }
/** @return The OpenGL draw mode (e.g. GL_TRIANGLES). */ public int getDrawMode() { return NativeRenderData.getDrawMode(getNative()); }
/** * 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); }
/** @return {@code true} if {@code GL_BLEND} is enabled, {@code false} if not. */ public boolean getAlphaBlend() { return NativeRenderData.getAlphaBlend(getNative()); }
/** * 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); }
/** @return {@code true} if {@code GL_DEPTH_TEST} is enabled, {@code false} if not. */ public boolean getDepthTest() { return NativeRenderData.getDepthTest(getNative()); }
/** * Set the rendering options bit mask. * * @param renderMask The rendering options bit mask. * @see GVRRenderMaskBit */ public void setRenderMask(int renderMask) { NativeRenderData.setRenderMask(getNative(), renderMask); }
/** * @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()); }
/** * Add a render {@link GVRRenderPass pass} to this RenderData. * * @param pass */ public void addPass(GVRRenderPass pass) { mRenderPassList.add(pass); NativeRenderData.addPass(getNative(), pass.getNative()); }
/** * @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()); }
/** * 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); }
/** @return {@code true} if {@code GL_POLYGON_OFFSET_FILL} is enabled, {@code false} if not. */ public boolean getOffset() { return NativeRenderData.getOffset(getNative()); }
/** * Set the order in which this mesh will be rendered. * * @param renderingOrder See {@link GVRRenderingOrder} */ public void setRenderingOrder(int renderingOrder) { NativeRenderData.setRenderingOrder(getNative(), renderingOrder); }
/** * @return The order in which this mesh will be rendered. * @see GVRRenderingOrder */ public int getRenderingOrder() { return NativeRenderData.getRenderingOrder(getNative()); }
/** * 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); }
/** * 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); }
/** * Get the rendering options bit mask. * * @return The rendering options bit mask. * @see GVRRenderMaskBit */ public int getRenderMask() { return NativeRenderData.getRenderMask(getNative()); }