當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderManager.getForcedRenderState方法代碼示例

本文整理匯總了Java中com.jme3.renderer.RenderManager.getForcedRenderState方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderManager.getForcedRenderState方法的具體用法?Java RenderManager.getForcedRenderState怎麽用?Java RenderManager.getForcedRenderState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.renderer.RenderManager的用法示例。


在下文中一共展示了RenderManager.getForcedRenderState方法的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.getForcedRenderState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。