• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LightList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: updateLightListUniforms

import com.jme3.light.LightList; //导入依赖的package包/类
@Deprecated
protected void updateLightListUniforms(Shader shader, Geometry g, int numLights) {
    if (numLights == 0) { // this shader does not do lighting, ignore.
        return;
    }
    
    LightList worldLightList = g.getWorldLightList();
    ColorRGBA ambLightColor = new ColorRGBA(0f, 0f, 0f, 1f);
    lightList.ensureCapacity(worldLightList.size());
    
    for (int i = 0; i < worldLightList.size(); i++) {
        Light light = worldLightList.get(i);
        if (light instanceof AmbientLight) {
            ambLightColor.addLocal(light.getColor());
        } else {
            lightList.add(light);
        }
    }
    numLights = lightList.size();
    this.setInt("NumLights", numLights);
    Uniform lightColor = shader.getUniform("g_LightColor");
    Uniform lightPos = shader.getUniform("g_LightPosition");
    Uniform lightDir = shader.getUniform("g_LightDirection");
    lightColor.setVector4Length(4);
    lightPos.setVector4Length(4);
    lightDir.setVector4Length(4);

    Uniform ambientColor = shader.getUniform("g_AmbientLightColor");
    ambLightColor.a = 1.0f;
    ambientColor.setValue(VarType.Vector4, ambLightColor);
    
    for (int i = 0; i < numLights; i++) {
        
        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, i);
                break;
            case Point:
                PointLight pl = (PointLight) l;
                Vector3f pos = pl.getPosition();
                float invRadius = pl.getInvRadius();
                lightPos.setVector4InArray(pos.getX(), pos.getY(), pos.getZ(), invRadius, i);
                break;
            case Spot:
                SpotLight sl = (SpotLight) l;
                Vector3f pos2 = sl.getPosition();
                Vector3f dir2 = sl.getDirection();
                float invRange = sl.getInvSpotRange();
                float spotAngleCos = sl.getPackedAngleCos();

                lightPos.setVector4InArray(pos2.getX(), pos2.getY(), pos2.getZ(), invRange, i);
                lightDir.setVector4InArray(dir2.getX(), dir2.getY(), dir2.getZ(), spotAngleCos, i);
                break;
            default:
                throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
        }
    }
    lightList.clear();
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:70,代码来源:SPLightMaterial.java


示例17: setLighting

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

        gl.glEnable(gl.GL_LIGHTING);
        gl.glShadeModel(gl.GL_SMOOTH);

        float[] temp = new float[4];

        // reset model view to specify
        // light positions in world space
        // instead of model space
//        gl.glPushMatrix();
//        gl.glLoadIdentity();

        for (int i = 0; i < list.size() + 1; i++) {

            int lightId = gl.GL_LIGHT0 + i;

            if (list.size() <= i) {
                // goes beyond the num lights we need
                // disable it
                gl.glDisable(lightId);
                break;
            }

            Light l = list.get(i);

            if (!l.isEnabled()) {
                gl.glDisable(lightId);
                continue;
            }

            ColorRGBA color = l.getColor();
            color.toArray(temp);

            gl.glEnable(lightId);
            gl.glLightfv(lightId, gl.GL_DIFFUSE, temp, 0);
            gl.glLightfv(lightId, gl.GL_SPECULAR, temp, 0);

            ColorRGBA.Black.toArray(temp);
            gl.glLightfv(lightId, gl.GL_AMBIENT, temp, 0);

            switch (l.getType()) {
                case Directional:
                    DirectionalLight dl = (DirectionalLight) l;
                    dl.getDirection().toArray(temp);
                    temp[3] = 0f; // marks to GL its a directional light
                    gl.glLightfv(lightId, gl.GL_POSITION, temp, 0);
                    break;
                case Point:
                    PointLight pl = (PointLight) l;
                    pl.getPosition().toArray(temp);
                    temp[3] = 1f; // marks to GL its a point light
                    gl.glLightfv(lightId, gl.GL_POSITION, temp, 0);
                    break;
            }

        }

        // restore modelview to original value
//        gl.glPopMatrix();
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:67,代码来源:JoglRenderer.java


示例18: setLighting

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

        gl.glEnable(GLLightingFunc.GL_LIGHTING);
        gl.getGL2().glShadeModel(GLLightingFunc.GL_SMOOTH);

        float[] temp = new float[4];

        // reset model view to specify
        // light positions in world space
        // instead of model space
        // gl.glPushMatrix();
        // gl.glLoadIdentity();

        for (int i = 0; i < list.size() + 1; i++) {

            int lightId = GLLightingFunc.GL_LIGHT0 + i;

            if (list.size() <= i) {
                // goes beyond the num lights we need
                // disable it
                gl.glDisable(lightId);
                break;
            }

            Light l = list.get(i);

            if (!l.isEnabled()) {
                gl.glDisable(lightId);
                continue;
            }

            ColorRGBA color = l.getColor();
            color.toArray(temp);

            gl.glEnable(lightId);
            gl.getGL2().glLightfv(lightId, GLLightingFunc.GL_DIFFUSE, temp, 0);
            gl.getGL2().glLightfv(lightId, GLLightingFunc.GL_SPECULAR, temp, 0);

            ColorRGBA.Black.toArray(temp);
            gl.getGL2().glLightfv(lightId, GLLightingFunc.GL_AMBIENT, temp, 0);

            switch (l.getType()) {
                case Directional:
                    DirectionalLight dl = (DirectionalLight) l;
                    dl.getDirection().toArray(temp);
                    temp[3] = 0f; // marks to GL its a directional light
                    gl.getGL2().glLightfv(lightId, GLLightingFunc.GL_POSITION, temp, 0);
                    break;
                case Point:
                    PointLight pl = (PointLight) l;
                    pl.getPosition().toArray(temp);
                    temp[3] = 1f; // marks to GL its a point light
                    gl.getGL2().glLightfv(lightId, GLLightingFunc.GL_POSITION, temp, 0);
                    break;
            }

        }
        // restore modelview to original value
        // gl.glPopMatrix();
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:69,代码来源:JoglRenderer.java


示例19: getLocalLightList

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Returns the local {@link LightList}, which are the lights
 * that were directly attached to this <code>Spatial</code> through the
 * {@link #addLight(com.jme3.light.Light) } and
 * {@link #removeLight(com.jme3.light.Light) } methods.
 *
 * @return The local light list
 */
public LightList getLocalLightList() {
    return localLights;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:12,代码来源:Spatial.java


示例20: getWorldLightList

import com.jme3.light.LightList; //导入依赖的package包/类
/**
 * Returns the world {@link LightList}, containing the lights
 * combined from all this <code>Spatial's</code> parents up to and including
 * this <code>Spatial</code>'s lights.
 *
 * @return The combined world light list
 */
public LightList getWorldLightList() {
    return worldLights;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:11,代码来源:Spatial.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JDBC4MysqlPooledConnection类代码示例发布时间:2022-05-23
下一篇:
Java Nullable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap