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


Java LightList类代码示例

本文整理汇总了Java中com.jme3.light.LightList的典型用法代码示例。如果您正苦于以下问题:Java LightList类的具体用法?Java LightList怎么用?Java LightList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onEnable

import com.jme3.light.LightList; //导入依赖的package包/类
@Override
protected void onEnable() {
    super.onEnable();

    final Node pbrScene = getPbrScene();

    if (pbrScene == null) {
        return;
    }

    final LightList lightList = pbrScene.getLocalLightList();

    for (int i = 0; i < lightList.size(); i++) {
        if (lightList.get(i) == lightProbe) {
            return;
        }
    }

    pbrScene.addLight(lightProbe);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:21,代码来源:StaticLightProbeSceneAppState.java

示例2: enableLightProbe

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Enable PBR Light probe.
 */
@JMEThread
public void enableLightProbe() {

    final LightProbe lightProbe = getLightProbe();

    if (lightProbe == null) {
        return;
    }

    final LightList lightList = rootNode.getLocalLightList();

    for (int i = 0; i < lightList.size(); i++) {
        if (lightList.get(i) == lightProbe) {
            return;
        }
    }

    rootNode.addLight(lightProbe);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:Editor.java

示例3: getChildren

import com.jme3.light.LightList; //导入依赖的package包/类
@Override
@FXThread
public @NotNull Array<TreeNode<?>> getChildren(@NotNull final NodeTree<?> nodeTree) {

    final Array<TreeNode<?>> result = ArrayFactory.newArray(TreeNode.class);
    final Spatial element = getElement();

    final LightList lightList = element.getLocalLightList();
    lightList.forEach(light -> {
        if (!(light instanceof InvisibleObject)) {
            result.add(FACTORY_REGISTRY.createFor(light));
        }
    });

    final int numControls = element.getNumControls();

    for (int i = 0; i < numControls; i++) {
        final Control control = element.getControl(i);
        result.add(FACTORY_REGISTRY.createFor(control));
    }

    return result;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:24,代码来源:SpatialTreeNode.java

示例4: read

import com.jme3.light.LightList; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);

    name = ic.readString("name", null);
    worldBound = (BoundingVolume) ic.readSavable("world_bound", null);
    cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);
    queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class,
            RenderQueue.Bucket.Inherit);
    shadowMode = ic.readEnum("shadow_mode", ShadowMode.class,
            ShadowMode.Inherit);

    localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);

    localLights = (LightList) ic.readSavable("lights", null);
    localLights.setOwner(this);

    //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
    //the AnimControl creates the SkeletonControl for old files and add it to the spatial.
    //The SkeletonControl must be the last in the stack so we add the list of all other control before it.
    //When backward compatibility won't be needed anymore this can be replaced by : 
    //controls = ic.readSavableArrayList("controlsList", null));
    controls.addAll(0, ic.readSavableArrayList("controlsList", null));

    userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:Spatial.java

示例5: read

import com.jme3.light.LightList; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);

    name = ic.readString("name", null);
    worldBound = (BoundingVolume) ic.readSavable("world_bound", null);
    cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);
    batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit);
    queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class,
            RenderQueue.Bucket.Inherit);
    shadowMode = ic.readEnum("shadow_mode", ShadowMode.class,
            ShadowMode.Inherit);

    localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);

    localLights = (LightList) ic.readSavable("lights", null);
    localLights.setOwner(this);

    //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
    //the AnimControl creates the SkeletonControl for old files and add it to the spatial.
    //The SkeletonControl must be the last in the stack so we add the list of all other control before it.
    //When backward compatibility won't be needed anymore this can be replaced by : 
    //controls = ic.readSavableArrayList("controlsList", null));
    controls.addAll(0, ic.readSavableArrayList("controlsList", null));

    userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:27,代码来源:Spatial.java

示例6: addLight

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Collect all lights.
 *
 * @param spatial   the spatial
 * @param container the container
 */
public static void addLight(@NotNull final Spatial spatial, @NotNull final Array<Light> container) {

    final LightList lightList = spatial.getLocalLightList();
    lightList.forEach(container::add);

    if (!(spatial instanceof Node)) return;

    final Node node = (Node) spatial;

    for (final Spatial children : node.getChildren()) {
        addLight(children, container);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:20,代码来源:NodeUtils.java

示例7: Spatial

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Constructor instantiates a new <code>Spatial</code> object setting the
 * rotation, translation and scale value to defaults.
 *
 * @param name
 *            the name of the scene element. This is required for
 *            identification and comparison purposes.
 */
protected Spatial(String name) {
    this.name = name;
    this.visible = true;
    localTransform = new Transform();
    worldTransform = new Transform();

    localLights = new LightList(this);
    worldLights = new LightList(this);

    localOverrides = new SafeArrayList<>(MatParamOverride.class);
    worldOverrides = new SafeArrayList<>(MatParamOverride.class);
    refreshFlags |= RF_BOUND;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:Spatial.java

示例8: read

import com.jme3.light.LightList; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);

    name = ic.readString("name", null);
    worldBound = (BoundingVolume) ic.readSavable("world_bound", null);
    cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);
    batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit);
    queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class,
            RenderQueue.Bucket.Inherit);
    shadowMode = ic.readEnum("shadow_mode", ShadowMode.class,
            ShadowMode.Inherit);

    localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);

    localLights = (LightList) ic.readSavable("lights", null);
    localLights.setOwner(this);

    ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null);
    if (localOverridesList == null) {
        localOverrides = new SafeArrayList<>(MatParamOverride.class);
    } else {
        localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList);
    }
    worldOverrides = new SafeArrayList<>(MatParamOverride.class);

    //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
    //the AnimControl creates the SkeletonControl for old files and add it to the spatial.
    //The SkeletonControl must be the last in the stack so we add the list of all other control before it.
    //When backward compatibility won't be needed anymore this can be replaced by :
    //controls = ic.readSavableArrayList("controlsList", null));
    controls.addAll(0, ic.readSavableArrayList("controlsList", null));

    userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:35,代码来源:Spatial.java

示例9: setLighting

import com.jme3.light.LightList; //导入依赖的package包/类
public void setLighting(LightList list) {
    if (list == null || list.size() == 0) {
        // turn off lighting
        //glDisable(GL_LIGHTING);
        return;
    }

    //glEnable(GL_LIGHTING);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:LwjglGL1Renderer.java

示例10: Spatial

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Serialization only. Do not use.
 */
public Spatial() {
    localTransform = new Transform();
    worldTransform = new Transform();

    localLights = new LightList(this);
    worldLights = new LightList(this);

    refreshFlags |= RF_BOUND;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:Spatial.java

示例11: getAmbientColor

import com.jme3.light.LightList; //导入依赖的package包/类
private ColorRGBA getAmbientColor(LightList lightList) {
    ambientLightColor.set(0, 0, 0, 1);
    for (int j = 0; j < lightList.size(); j++) {
        Light l = lightList.get(j);
        if (l instanceof AmbientLight) {
            ambientLightColor.addLocal(l.getColor());
        }
    }
    ambientLightColor.a = 1.0f;
    return ambientLightColor;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:Material.java

示例12: updateLightListUniforms

import com.jme3.light.LightList; //导入依赖的package包/类
@Override
  protected int updateLightListUniforms(Shader shader, Geometry g, LightList lightList, int numLights, RenderManager rm, int startIndex) {
    shader.getUniform("m_StartIndex").setValue(VarType.Int, startIndex);
//    if (startIndex != 0){
////        Int ActiveDirectionalShadows
////        Int ActivePointShadows
////        Int ActiveSpotShadows
//        shader.getUniform("m_ActiveDirectionalShadows").setValue(VarType.Int, 0);
//        shader.getUniform("m_ActivePointShadows").setValue(VarType.Int, 0);
//        shader.getUniform("m_ActiveSpotShadows").setValue(VarType.Int, 0);
//    }
    return super.updateLightListUniforms(shader, g, lightList, numLights, rm, startIndex);
  }
 
开发者ID:Perjin,项目名称:PreFrameShadowRenderer,代码行数:14,代码来源:ShadowMaterial.java

示例13: setLighting

import com.jme3.light.LightList; //导入依赖的package包/类
public void setLighting(LightList list) {
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:3,代码来源:LwjglRenderer.java

示例14: updateLightListUniforms

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Uploads the lights in the light list as two uniform arrays.<br/><br/>
 *      * <p>
 * <code>uniform vec4 g_LightColor[numLights];</code><br/>
 * // g_LightColor.rgb is the diffuse/specular color of the light.<br/>
 * // g_Lightcolor.a is the type of light, 0 = Directional, 1 = Point, <br/>
 * // 2 = Spot. <br/>
 * <br/>
 * <code>uniform vec4 g_LightPosition[numLights];</code><br/>
 * // g_LightPosition.xyz is the position of the light (for point lights)<br/>
 * // or the direction of the light (for directional lights).<br/>
 * // g_LightPosition.w is the inverse radius (1/r) of the light (for attenuation) <br/>
 * </p>
 */
protected void updateLightListUniforms(Shader shader, Geometry g, int numLights) {
    if (numLights == 0){ // this shader does not do lighting, ignore.
        return;
    }

    LightList lightList = g.getWorldLightList();
    Uniform lightColor = shader.getUniform("g_LightColor");
    Uniform lightPos = shader.getUniform("g_LightPosition");
    lightColor.setVector4Length(numLights);
    lightPos.setVector4Length(numLights);

    Uniform ambientColor = shader.getUniform("g_AmbientLightColor");
    ambientColor.setValue(VarType.Vector4, getAmbientColor(lightList));
    
    int lightIndex = 0;
    
    for (int i = 0; i < numLights; i++) {
        if (lightList.size() <= i) {
            lightColor.setVector4InArray(0f, 0f, 0f, 0f, lightIndex);
            lightPos.setVector4InArray(0f, 0f, 0f, 0f, lightIndex);
        } else {
            Light l = lightList.get(i);
            ColorRGBA color = l.getColor();
            lightColor.setVector4InArray(color.getRed(),
                    color.getGreen(),
                    color.getBlue(),
                    l.getType().getId(),
                    i);

            switch (l.getType()) {
                case Directional:
                    DirectionalLight dl = (DirectionalLight) l;
                    Vector3f dir = dl.getDirection();
                    lightPos.setVector4InArray(dir.getX(), dir.getY(), dir.getZ(), -1, lightIndex);
                    break;
                case Point:
                    PointLight pl = (PointLight) l;
                    Vector3f pos = pl.getPosition();
                    float invRadius = pl.getRadius();
                    if (invRadius != 0) {
                        invRadius = 1f / invRadius;
                    }
                    lightPos.setVector4InArray(pos.getX(), pos.getY(), pos.getZ(), invRadius, lightIndex);
                    break;
                case Ambient:
                    // skip this light. Does not increase lightIndex
                    continue;
                default:
                    throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
            }
        }
        
        lightIndex++;
    }
    
    while (lightIndex < numLights){
        lightColor.setVector4InArray(0f, 0f, 0f, 0f, lightIndex);
        lightPos.setVector4InArray(0f, 0f, 0f, 0f, lightIndex);
        
        lightIndex++;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:77,代码来源:Material.java

示例15: setLighting

import com.jme3.light.LightList; //导入依赖的package包/类
public void setLighting(LightList lights) {
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:3,代码来源:NullRenderer.java


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