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


Java RenderManager.updateUniformBindings方法代码示例

本文整理汇总了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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:74,代码来源:Material.java


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