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


Java Light类代码示例

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


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

示例1: removeLightImpl

import com.jme3.light.Light; //导入依赖的package包/类
/**
 * The process of removing a light.
 */
@JMEThread
private void removeLightImpl(@NotNull final Light light) {

    final Node node = LIGHT_MODEL_TABLE.get(light.getType());
    if (node == null) return;

    final ObjectDictionary<Light, EditorLightNode> cachedLights = getCachedLights();
    final EditorLightNode lightModel = cachedLights.get(light);
    if (lightModel == null) return;

    lightModel.setLight(null);

    final Node lightNode = getLightNode();
    lightNode.detachChild(lightModel);
    lightNode.detachChild(notNull(lightModel.getModel()));

    getLightNodes().fastRemove(lightModel);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:AbstractSceneEditor3DState.java

示例2: buildForImpl

import com.jme3.light.Light; //导入依赖的package包/类
@Override
@FXThread
protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent, @NotNull final VBox container,
                            @NotNull final ModelChangeConsumer changeConsumer) {

    if (object instanceof DirectionalLight) {
        buildForDirectionLight((DirectionalLight) object, container, changeConsumer);
    } else if (object instanceof SpotLight) {
        buildForSpotLight((SpotLight) object, container, changeConsumer);
    } else if (object instanceof PointLight) {
        buildForPointLight((PointLight) object, container, changeConsumer);
    }

    if (object instanceof Light) {
        buildForLight((Light) object, container, changeConsumer);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:18,代码来源:LightPropertyBuilder.java

示例3: process

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

    final NodeTree<?> nodeTree = getNodeTree();

    final Light light = createLight();
    if (light.getName() == null) {
        light.setName("");
    }

    final TreeNode<?> treeNode = getNode();
    final Node element = (Node) treeNode.getElement();

    final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());
    changeConsumer.execute(new AddLightOperation(light, element));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:AbstractCreateLightAction.java

示例4: process

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

    final TreeNode<?> node = getNode();
    final Object element = node.getElement();

    if (!(element instanceof Light)) return;

    final Light light = (Light) element;

    final NodeTree<ModelChangeConsumer> nodeTree = getNodeTree();
    final TreeNode<?> parentNode = nodeTree.findParent(node);
    if (parentNode == null) return;

    final Object parent = parentNode.getElement();
    if (!(parent instanceof Node)) return;

    final ModelChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());
    changeConsumer.execute(new RemoveLightOperation(light, (Node) parent));
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:RemoveLightAction.java

示例5: notifyFXAddedChild

import com.jme3.light.Light; //导入依赖的package包/类
@Override
@FXThread
public void notifyFXAddedChild(@NotNull final Object parent, @NotNull final Object added, final int index,
                               final boolean needSelect) {

    final MA editor3DState = getEditor3DState();
    final ModelNodeTree modelNodeTree = getModelNodeTree();
    modelNodeTree.notifyAdded(parent, added, index);

    if (added instanceof Light) {
        editor3DState.addLight((Light) added);
    } else if (added instanceof AudioNode) {
        editor3DState.addAudioNode((AudioNode) added);
    } else if (added instanceof Spatial) {
        handleAddedObject((Spatial) added);
    }

    if (needSelect) {
        EXECUTOR_MANAGER.addJMETask(() -> EXECUTOR_MANAGER.addFXTask(() -> modelNodeTree.select(added)));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:AbstractSceneFileEditor.java

示例6: notifyFXRemovedChild

import com.jme3.light.Light; //导入依赖的package包/类
@Override
@FXThread
public void notifyFXRemovedChild(@NotNull final Object parent, @NotNull final Object removed) {

    final MA editor3DState = getEditor3DState();
    final ModelNodeTree modelNodeTree = getModelNodeTree();
    modelNodeTree.notifyRemoved(parent, removed);

    if (removed instanceof Light) {
        editor3DState.removeLight((Light) removed);
    } else if (removed instanceof AudioNode) {
        editor3DState.removeAudioNode((AudioNode) removed);
    } else if (removed instanceof Spatial) {
        handleRemovedObject((Spatial) removed);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:AbstractSceneFileEditor.java

示例7: testBlenderLoader

import com.jme3.light.Light; //导入依赖的package包/类
/**
 * This method loads the model using blenderLoader.
 * @param assetInfo
 *        the asset info
 * @return the loaded model
 */
private Node testBlenderLoader(AssetInfo assetInfo) {
    Node blenderModel = null;
    BlenderLoader blenderLoader = new BlenderLoader();
    try {
        LoadingResults loadingResults = blenderLoader.load(assetInfo);
        for (Node object : loadingResults.getObjects()) {
            this.rootNode.attachChild(object);
            blenderModel = object;
        }
        for (Light light : loadingResults.getLights()) {
            this.rootNode.addLight(light);
        }
        for (Camera camera : loadingResults.getCameras()) {
            LOGGER.info(camera.toString());
        }
    } catch (IOException e) {
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
    }
    return blenderModel;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:ManualBlenderTester.java

示例8: spatialTolight

import com.jme3.light.Light; //导入依赖的package包/类
private void spatialTolight(Light light) {
        if (light instanceof PointLight) {
            ((PointLight) light).setPosition(spatial.getWorldTranslation());
        }
        TempVars vars = TempVars.get();

        if (light instanceof DirectionalLight) {
            ((DirectionalLight) light).setDirection(vars.vect1.set(spatial.getWorldTranslation()).multLocal(-1.0f));
        }
        vars.release();
        //TODO add code for Spot light here when it's done
//        if( light instanceof SpotLight){
//            ((SpotLight)light).setPosition(spatial.getWorldTranslation());                
//            ((SpotLight)light).setRotation(spatial.getWorldRotation());
//        }

    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:LightControl.java

示例9: updateLightCamera

import com.jme3.light.Light; //导入依赖的package包/类
/**
 * Updates the camera view direction and position based on the light
 */
public void updateLightCamera(Camera lightCam) {
    if (target.getType() == Light.Type.Directional) {
        DirectionalLight dl = (DirectionalLight) target;
        lightCam.setParallelProjection(true);
        lightCam.setLocation(Vector3f.ZERO);
        lightCam.lookAtDirection(dl.getDirection(), Vector3f.UNIT_Y);
        lightCam.setFrustum(-1, 1, -1, 1, 1, -1);
    } else {
        PointLight pl = (PointLight) target;
        lightCam.setParallelProjection(false);
        lightCam.setLocation(pl.getPosition());
        // direction will have to be calculated automatically
        lightCam.setFrustumPerspective(45, 1, 1, 300);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:ShadowCamera.java

示例10: LightDirectionUpdate

import com.jme3.light.Light; //导入依赖的package包/类
public LightDirectionUpdate(Light light, NodeCallback gizmo) {
    this.gizmo = gizmo;
    this.light = light;
    
    try {
        getDirection = light.getClass().getMethod("getDirection");
    } catch (NoSuchMethodException ex) {
        ExceptionUtils.caughtException(ex, "The LightDirectionUpdate "
            + "Control has been added for a light which doesn't even "
            + "have a direction. This means someone has seriously "
            + "fucked up. I just hope it's not me ;)");
    }
    
    refreshLightDirection();
    initialDir.set(lightDir);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:17,代码来源:LightDirectionUpdate.java

示例11: createGizmo

import com.jme3.light.Light; //导入依赖的package包/类
public static Spatial createGizmo(AssetManager assetManager, JmeLight lightNode) {
    Light light = lightNode.getLookup().lookup(Light.class);
    if (light == null) {
        return null;
    }
    switch (light.getType()) {
        case Point:
            return createPointGizmo(assetManager, (JmePointLight) lightNode, light);
        case Spot:
            return createSpotGizmo(assetManager, (JmeSpotLight) lightNode, light);
        case Directional:
            return createDirectionalGizmo(assetManager, (JmeDirectionalLight) lightNode, light);
            
        case Probe:
            return createLightProbeGizmo(assetManager, (JmeLightProbe)lightNode);

        //  default:
        //      return createDefaultGizmo(assetManager, lightNode);
    }
    return null;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:22,代码来源:LightGizmoFactory.java

示例12: createPointGizmo

import com.jme3.light.Light; //导入依赖的package包/类
private static Node createPointGizmo(AssetManager assetManager, JmePointLight jmeLight, Light light) {
    PointLightGizmo gizmo = new PointLightGizmo(jmeLight);
    gizmo.addControl(new LightPositionUpdate(light, gizmo));
    
    Node billboardNode = new Node("billboard lightGizmo");
    billboardNode.addControl(new BillboardControl());
    gizmo.attachChild(billboardNode);
    billboardNode.attachChild(createLightBulb(assetManager));
    
    Geometry radius = RadiusShape.createShape(assetManager, "radius shape");
    radius.addControl(new LightRadiusUpdate((PointLight) light));
    radius.addControl(new LightColorUpdate(light, radius.getMaterial(), "Color"));
    billboardNode.attachChild(radius);
    
    return gizmo;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:17,代码来源:LightGizmoFactory.java

示例13: createDirectionalGizmo

import com.jme3.light.Light; //导入依赖的package包/类
private static Node createDirectionalGizmo(AssetManager assetManager, JmeDirectionalLight jmeLight, Light light) {
    DirectionalLightGizmo gizmo = new DirectionalLightGizmo(jmeLight);
    gizmo.move(0, 5, 0);
    gizmo.addControl(new LightDirectionUpdate(light, gizmo));
    
    Node billboardNode = new Node("billboard lightGizmo");
    billboardNode.addControl(new BillboardControl());
    
    billboardNode.attachChild(createLightBulb(assetManager));
    
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.White);
    mat.getAdditionalRenderState().setLineWidth(2f);
    
    Geometry arrow = new Geometry("direction arrow", new Arrow(((DirectionalLight) light).getDirection().mult(5f)));
    arrow.setMaterial(mat);
    arrow.addControl(new LightColorUpdate(light, arrow.getMaterial(), "Color"));
    
    gizmo.attachChild(arrow);
    gizmo.attachChild(billboardNode);
    
    jmeLight.setGizmo(gizmo);
    return gizmo;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:25,代码来源:LightGizmoFactory.java

示例14: createSheet

import com.jme3.light.Light; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("Mesh");
    set.setName(Light.class.getName());
    Mesh obj = mesh;
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, int.class, "getId", "setId", "Id"));
    set.put(makeProperty(obj, Mesh.Mode.class, "getMode", "setMode", "Mode"));
    set.put(makeProperty(obj, float.class, "getPointSize", "setPointSize", "Point Size"));

    sheet.put(set);
    return sheet;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:21,代码来源:JmeMesh.java

示例15: createSheet

import com.jme3.light.Light; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("Light");
    set.setName(Light.class.getName());
    Light obj = light;
    if (obj == null) {
        return sheet;
    }

    createFields(Light.class, set, obj);
    // We don't want the user to mess with them
    set.remove("Frustum Check Needed");
    set.remove("Intersects Frustum");
    //set.put(makeProperty(obj, ColorRGBA.class, "getColor", "setColor", "Color"));
    sheet.put(set);
    return sheet;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:22,代码来源:JmeLight.java


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