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


Java RenderQueue.ShadowMode方法代码示例

本文整理汇总了Java中com.jme3.renderer.queue.RenderQueue.ShadowMode方法的典型用法代码示例。如果您正苦于以下问题:Java RenderQueue.ShadowMode方法的具体用法?Java RenderQueue.ShadowMode怎么用?Java RenderQueue.ShadowMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.renderer.queue.RenderQueue的用法示例。


在下文中一共展示了RenderQueue.ShadowMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderShadow

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * If a spatial is not inside the eye frustum, it
 * is still rendered in the shadow frustum (shadow casting queue)
 * through this recursive method.
 */
private void renderShadow(Spatial s, RenderQueue rq) {
    if (s instanceof Node) {
        Node n = (Node) s;
        List<Spatial> children = n.getChildren();
        for (int i = 0; i < children.size(); i++) {
            renderShadow(children.get(i), rq);
        }
    } else if (s instanceof Geometry) {
        Geometry gm = (Geometry) s;

        RenderQueue.ShadowMode shadowMode = s.getShadowMode();
        if (shadowMode != RenderQueue.ShadowMode.Off && shadowMode != RenderQueue.ShadowMode.Receive) {
            //forcing adding to shadow cast mode, culled objects doesn't have to be in the receiver queue
            rq.addToShadowQueue(gm, RenderQueue.ShadowMode.Cast);
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:RenderManager.java

示例2: createKlatch

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
public static Node createKlatch(NamedNodeMap map, AssetManager manager) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
    String klatchFile = getAttrContent("klatch", map);
    if (klatchFile == null || klatchFile.length() == 0) {
        return null;
    }
    AssetInfo info = manager.locateAsset(new AssetKey(klatchFile));
    Node klatch = new Node();
    GameSceneLoader.loadScene(info.openStream(), manager, klatch);

    String name = getAttrContent("name", map);
    String shadowMode = getAttrContent("shadowmode", map);

    try {
        klatch.setName(name);
        RenderQueue.ShadowMode sm = RenderQueue.ShadowMode.valueOf(shadowMode);
        klatch.setShadowMode(sm);
    } catch (IllegalArgumentException ex) {
    }
    return klatch;
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:21,代码来源:GameSceneLoader.java

示例3: getShadowMode

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * @return The shadow mode of this spatial, if the local shadow
 * mode is set to inherit, then the parent's shadow mode is returned.
 *
 * @see Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode)
 * @see ShadowMode
 */
public RenderQueue.ShadowMode getShadowMode() {
    if (shadowMode != RenderQueue.ShadowMode.Inherit) {
        return shadowMode;
    } else if (parent != null) {
        return parent.getShadowMode();
    } else {
        return ShadowMode.Off;
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:Spatial.java

示例4: renderScene

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * Flattens the given scene graph into the ViewPort's RenderQueue,
 * checking for culling as the call goes down the graph recursively.
 * <p>
 * First, the scene is checked for culling based on the <code>Spatial</code>s
 * {@link Spatial#setCullHint(com.jme3.scene.Spatial.CullHint) cull hint},
 * if the camera frustum contains the scene, then this method is recursively
 * called on its children.
 * <p>
 * When the scene's leaves or {@link Geometry geometries} are reached,
 * they are each enqueued into the 
 * {@link ViewPort#getQueue() ViewPort's render queue}.
 * <p>
 * In addition to enqueuing the visible geometries, this method
 * also scenes which cast or receive shadows, by putting them into the
 * RenderQueue's 
 * {@link RenderQueue#addToShadowQueue(com.jme3.scene.Geometry, com.jme3.renderer.queue.RenderQueue.ShadowMode) 
 * shadow queue}. Each Spatial which has its 
 * {@link Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) shadow mode}
 * set to not off, will be put into the appropriate shadow queue, note that
 * this process does not check for frustum culling on any 
 * {@link ShadowMode#Cast shadow casters}, as they don't have to be
 * in the eye camera frustum to cast shadows on objects that are inside it.
 * 
 * @param scene The scene to flatten into the queue
 * @param vp The ViewPort provides the {@link ViewPort#getCamera() camera}
 * used for culling and the {@link ViewPort#getQueue() queue} used to 
 * contain the flattened scene graph.
 */
public void renderScene(Spatial scene, ViewPort vp) {
    if (scene.getParent() == null) {
        vp.getCamera().setPlaneState(0);
    }
    // check culling first.
    if (!scene.checkCulling(vp.getCamera())) {
        // move on to shadow-only render
        if (scene.getShadowMode() != RenderQueue.ShadowMode.Off || scene instanceof Node) {
            renderShadow(scene, vp.getQueue());
        }
        return;
    }

    scene.runControlRender(this, vp);
    if (scene instanceof Node) {
        // recurse for all children
        Node n = (Node) scene;
        List<Spatial> children = n.getChildren();
        //saving cam state for culling
        int camState = vp.getCamera().getPlaneState();
        for (int i = 0; i < children.size(); i++) {
            //restoring cam state before proceeding children recusively
            vp.getCamera().setPlaneState(camState);
            renderScene(children.get(i), vp);

        }
    } else if (scene instanceof Geometry) {

        // add to the render queue
        Geometry gm = (Geometry) scene;
        if (gm.getMaterial() == null) {
            throw new IllegalStateException("No material is set for Geometry: " + gm.getName());
        }

        vp.getQueue().addToQueue(gm, scene.getQueueBucket());

        // add to shadow queue if needed
        RenderQueue.ShadowMode shadowMode = scene.getShadowMode();
        if (shadowMode != RenderQueue.ShadowMode.Off) {
            vp.getQueue().addToShadowQueue(gm, shadowMode);
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:73,代码来源:RenderManager.java

示例5: renderScene

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * Flattens the given scene graph into the ViewPort's RenderQueue,
 * checking for culling as the call goes down the graph recursively.
 * <p>
 * First, the scene is checked for culling based on the <code>Spatial</code>s
 * {@link Spatial#setCullHint(com.jme3.scene.Spatial.CullHint) cull hint},
 * if the camera frustum contains the scene, then this method is recursively
 * called on its children.
 * <p>
 * When the scene's leaves or {@link Geometry geometries} are reached,
 * they are each enqueued into the 
 * {@link ViewPort#getQueue() ViewPort's render queue}.
 * <p>
 * In addition to enqueuing the visible geometries, this method
 * also scenes which cast or receive shadows, by putting them into the
 * RenderQueue's 
 * {@link RenderQueue#addToShadowQueue(com.jme3.scene.Geometry, com.jme3.renderer.queue.RenderQueue.ShadowMode) 
 * shadow queue}. Each Spatial which has its 
 * {@link Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) shadow mode}
 * set to not off, will be put into the appropriate shadow queue, note that
 * this process does not check for frustum culling on any 
 * {@link ShadowMode#Cast shadow casters}, as they don't have to be
 * in the eye camera frustum to cast shadows on objects that are inside it.
 * 
 * @param scene The scene to flatten into the queue
 * @param vp The ViewPort provides the {@link ViewPort#getCamera() camera}
 * used for culling and the {@link ViewPort#getQueue() queue} used to 
 * contain the flattened scene graph.
 */
public void renderScene(Spatial scene, ViewPort vp) {
    if (scene.getParent() == null) {
        vp.getCamera().setPlaneState(0);
    }
    // check culling first.
    if (!scene.checkCulling(vp.getCamera())) {
        // move on to shadow-only render
        if ((scene.getShadowMode() != RenderQueue.ShadowMode.Off || scene instanceof Node) && scene.getCullHint()!=Spatial.CullHint.Always) {
            renderShadow(scene, vp.getQueue());
        }
        return;
    }

    scene.runControlRender(this, vp);
    if (scene instanceof Node) {
        // recurse for all children
        Node n = (Node) scene;
        List<Spatial> children = n.getChildren();
        //saving cam state for culling
        int camState = vp.getCamera().getPlaneState();
        for (int i = 0; i < children.size(); i++) {
            //restoring cam state before proceeding children recusively
            vp.getCamera().setPlaneState(camState);
            renderScene(children.get(i), vp);

        }
    } else if (scene instanceof Geometry) {

        // add to the render queue
        Geometry gm = (Geometry) scene;
        if (gm.getMaterial() == null) {
            throw new IllegalStateException("No material is set for Geometry: " + gm.getName());
        }

        vp.getQueue().addToQueue(gm, scene.getQueueBucket());

        // add to shadow queue if needed
        RenderQueue.ShadowMode shadowMode = scene.getShadowMode();
        if (shadowMode != RenderQueue.ShadowMode.Off) {
            vp.getQueue().addToShadowQueue(gm, shadowMode);
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:73,代码来源:RenderManager.java

示例6: setShadowMode

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * Sets the shadow mode of the spatial
 * The shadow mode determines how the spatial should be shadowed,
 * when a shadowing technique is used. See the
 * documentation for the class {@link ShadowMode} for more information.
 *
 * @see ShadowMode
 *
 * @param shadowMode The local shadow mode to set.
 */
public void setShadowMode(RenderQueue.ShadowMode shadowMode) {
    this.shadowMode = shadowMode;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:14,代码来源:Spatial.java

示例7: getLocalShadowMode

import com.jme3.renderer.queue.RenderQueue; //导入方法依赖的package包/类
/**
 * @return The locally set shadow mode
 *
 * @see Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode)
 */
public RenderQueue.ShadowMode getLocalShadowMode() {
    return shadowMode;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:9,代码来源:Spatial.java


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