本文整理汇总了Java中com.jme3.renderer.RenderManager.updateUniformBindings方法的典型用法代码示例。如果您正苦于以下问题:Java RenderManager.updateUniformBindings方法的具体用法?Java RenderManager.updateUniformBindings怎么用?Java RenderManager.updateUniformBindings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.renderer.RenderManager
的用法示例。
在下文中一共展示了RenderManager.updateUniformBindings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jme3.renderer.RenderManager; //导入方法依赖的package包/类
/**
* Called by {@link RenderManager} to render the geometry by
* using this material.
*
* @param geom The geometry to render
* @param rm The render manager requesting the rendering
*/
public void render(Geometry geom, RenderManager rm) {
autoSelectTechnique(rm);
Renderer r = rm.getRenderer();
TechniqueDef techDef = technique.getDef();
if (techDef.getLightMode() == LightMode.MultiPass
&& geom.getWorldLightList().size() == 0) {
return;
}
if (rm.getForcedRenderState() != null) {
r.applyRenderState(rm.getForcedRenderState());
} else {
if (techDef.getRenderState() != null) {
r.applyRenderState(techDef.getRenderState().copyMergedTo(additionalState, mergedRenderState));
} else {
r.applyRenderState(RenderState.DEFAULT.copyMergedTo(additionalState, mergedRenderState));
}
}
// update camera and world matrices
// NOTE: setWorldTransform should have been called already
if (techDef.isUsingShaders()) {
// reset unchanged uniform flag
clearUniformsSetByCurrent(technique.getShader());
rm.updateUniformBindings(technique.getWorldBindUniforms());
}
// setup textures and uniforms
for (int i = 0; i < paramValues.size(); i++) {
MatParam param = paramValues.getValue(i);
param.apply(r, technique);
}
Shader shader = technique.getShader();
// send lighting information, if needed
switch (techDef.getLightMode()) {
case Disable:
r.setLighting(null);
break;
case SinglePass:
updateLightListUniforms(shader, geom, 4);
break;
case FixedPipeline:
r.setLighting(geom.getWorldLightList());
break;
case MultiPass:
// NOTE: Special case!
resetUniformsNotSetByCurrent(shader);
renderMultipassLighting(shader, geom, r);
// very important, notice the return statement!
return;
}
// upload and bind shader
if (techDef.isUsingShaders()) {
// any unset uniforms will be set to 0
resetUniformsNotSetByCurrent(shader);
r.setShader(shader);
}
r.renderMesh(geom.getMesh(), geom.getLodLevel(), 1);
}