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


Java DirectionalLight.setDirection方法代码示例

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


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

示例1: BaseMaterialEditor3DState

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
public BaseMaterialEditor3DState(@NotNull final T fileEditor) {
    super(fileEditor);
    this.testBox = new Geometry("Box", new Box(2, 2, 2));
    this.testSphere = new Geometry("Sphere", new Sphere(30, 30, 2));
    this.testQuad = new Geometry("Quad", new Quad(4, 4));
    this.testQuad.setLocalTranslation(QUAD_OFFSET);
    this.lightEnabled = MaterialFileEditor.DEFAULT_LIGHT_ENABLED;

    TangentGenerator.useMikktspaceGenerator(testBox);
    TangentGenerator.useMikktspaceGenerator(testSphere);
    TangentGenerator.useMikktspaceGenerator(testQuad);

    final DirectionalLight light = notNull(getLightForCamera());
    light.setDirection(LIGHT_DIRECTION);

    final EditorCamera editorCamera = notNull(getEditorCamera());
    editorCamera.setDefaultHorizontalRotation(H_ROTATION);
    editorCamera.setDefaultVerticalRotation(V_ROTATION);

    getModelNode().attachChild(getNodeForCamera());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:BaseMaterialEditor3DState.java

示例2: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
public void simpleInitApp() {
    Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");

    DirectionalLight dl = new DirectionalLight();
    dl.setColor(ColorRGBA.White);
    dl.setDirection(Vector3f.UNIT_XYZ.negate());

    rootNode.addLight(dl);
    rootNode.attachChild(teaGeom);

    // Setup first view
    cam.setParallelProjection(true);
    float aspect = (float) cam.getWidth() / cam.getHeight();
    cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize);

    inputManager.addListener(this, "Size+", "Size-");
    inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W));
    inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:TestParallelProjection.java

示例3: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    Box b = new Box(Vector3f.ZERO, 1, 1, 1);
    geom = new Geometry("Box", b);
    geom.updateModelBound();

    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    geom.setMaterial(mat);
    geom.setLocalTranslation(0,2,1);
    rootNode.attachChild(geom);
    
    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
    dl.setColor(new ColorRGBA(1,1,1,1));
    rootNode.addLight(dl);        
  
    
    flyCam.setMoveSpeed(30);
    viewPort.setBackgroundColor(ColorRGBA.Gray);   
    
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:22,代码来源:OpenGL_2.java

示例4: readDirectionalLightComponents

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
private static void readDirectionalLightComponents(DirectionalLight dl, org.w3c.dom.Node n) {
    NodeList components = n.getChildNodes();
    for (int i = 0; i < components.getLength(); ++i) {
        org.w3c.dom.Node c = components.item(i);
        if (c.getNodeName().equals("component")) {
            String id = XMLUtils.getAttribute("id", c.getAttributes());
            if ("TransformComponent".equals(id) && dl != null) {
                ComponentType ct = GlobalObjects.getInstance().getObjectsTypeCategory().getComponent(id);
                if (ct != null) {
                    PrefabComponent pc = ct.create();
                    readComponentParameters( pc, ct, c.getChildNodes());
                    if (pc instanceof TransformComponent) {
                        TransformComponent tc = (TransformComponent) pc;
                        Vector3f dir = tc.getRotation().mult(Vector3f.UNIT_X);
                        dl.setDirection(dir);
                    }
                }
            }
        }
    }

}
 
开发者ID:samynk,项目名称:DArtE,代码行数:23,代码来源:GameSceneLoader.java

示例5: makeScene

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
private void makeScene()
	{
		DirectionalLight sun = new DirectionalLight();
		sun.setColor(ColorRGBA.White);
		sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
		rootNode.addLight(sun);
		
		AmbientLight al = new AmbientLight();
        al.setColor(ColorRGBA.White.mult(1.3f));
        rootNode.addLight(al);
        
		String file ="gui_desktop/img/plane.j3o";
		
		plane = assetManager.loadModel(file);
		plane.setLocalScale(0.75f);
		
//		plane = new Geometry("blue cube", new Box(Vector3f.ZERO, 1, 1, 1));
//        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
//        mat.setColor("Color", ColorRGBA.Blue);
//        plane.setMaterial(mat);
        
		rootNode.attachChild(plane);		
	}
 
开发者ID:Jupre,项目名称:MarmaraDrone,代码行数:24,代码来源:AttitudePanel.java

示例6: toJMELight

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
public static DirectionalLight toJMELight(DirectionalLighting dl) {
	DirectionalLight res = new DirectionalLight();
	res.setColor(toColorRGBA(dl.color).multLocal((float) (dl.intensity)));

	Node world = new Node();

	Node yaw = new Node();
	world.attachChild(yaw);

	Node pitch = new Node();
	yaw.attachChild(pitch);

	Node offset = new Node();
	pitch.attachChild(offset);
	offset.setLocalTranslation(Vector3f.UNIT_X);

	pitch.rotate(0, (float) dl.pitch, 0);

	yaw.rotate(0, 0, (float) dl.yaw);
	res.setDirection(offset.getWorldTranslation());
	return res;
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:23,代码来源:TranslateUtil.java

示例7: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    flyCam.setMoveSpeed(10f);
    cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
    cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));

    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
    dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
    rootNode.addLight(dl);

    BlenderKey blenderKey = new BlenderKey("Blender/2.4x/BaseMesh_249.blend");
    
    Spatial scene = (Spatial) assetManager.loadModel(blenderKey);
    rootNode.attachChild(scene);
    
    Spatial model = this.findNode(rootNode, "BaseMesh_01");
    model.center();
    
    control = model.getControl(AnimControl.class);
    channel = control.createChannel();

    channel.setAnim("run_01");
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:25,代码来源:TestBlenderAnim.java

示例8: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    initCrossHairs();
    getRootNode().attachChild(root);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,-0.5f,-2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    getRootNode().addLight(sun);
    //add scripts which convert the physics positions to view positions
    //the scripts are executed on the render thread
    SimpleLogicManagerState logicManager = getStateManager().getState(SimpleLogicManagerState.class);
    logicManager.attach(new PhysicsToViewRotation.Logic());
    logicManager.attach(new PhysicsToViewLocation.Logic());

    ESBulletState esBulletState = stateManager.getState(ESBulletState.class);
    esBulletState.onInitialize(() -> {
        //Add Debug State to debug physics
        //As you see there are getters for physics space and so on.
        BulletDebugAppState debugAppState = new BulletDebugAppState(esBulletState.getPhysicsSpace());
        getStateManager().attach(debugAppState);

        //add a logic manager for scripts which should be executed on the physics thread
        PhysicsSimpleLogicManager physicsLogicManager = new PhysicsSimpleLogicManager();
        physicsLogicManager.initialize(entityData, esBulletState.getBulletSystem());
        //in a real application don't forget to destroy it after usage:
        //physicsLogicManager.destroy();

        ForceFieldLogic forceFieldLogic = new ForceFieldLogic();
        forceFieldLogic.initLogic(entityData, esBulletState.getBulletSystem(),
                physicsLogicManager.getPreTickLogicManager(),
                physicsLogicManager.getTickLogicManager());
        physicsLogicManager.getPreTickLogicManager().attach(forceFieldLogic);

        initWorld();
        initForceField();
    });
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:40,代码来源:ForceFieldExample.java

示例9: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    getRootNode().attachChild(root);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,-0.5f,-2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    getRootNode().addLight(sun);
    //add scripts which convert the physics positions to view positions
    //the scripts are executed on the render thread
    SimpleLogicManagerState logicManager = getStateManager().getState(SimpleLogicManagerState.class);
    logicManager.attach(new PhysicsToViewRotation.Logic());
    logicManager.attach(new PhysicsToViewLocation.Logic());

    ESBulletState esBulletState = stateManager.getState(ESBulletState.class);
    esBulletState.onInitialize(() -> {
        //add a logic manager for scripts which should be executed on the physics thread
        PhysicsSimpleLogicManager physicsLogicManager = new PhysicsSimpleLogicManager();
        physicsLogicManager.initialize(entityData, esBulletState.getBulletSystem());
        //in a real application don't forget to destroy it after usage:
        //physicsLogicManager.destroy();

        // add the character logic
        PhysicsCharacterLogic characterLogic = new PhysicsCharacterLogic();
        characterLogic.initLogic(physicsLogicManager.getPreTickLogicManager(), esBulletState.getBulletSystem());
        physicsLogicManager.getPreTickLogicManager().attach(characterLogic);

        createLevel();
        createCharacter();
        initInput();
    });
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:32,代码来源:DynamicCharacterExample.java

示例10: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    initCrossHairs();
    getRootNode().attachChild(root);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,-0.5f,-2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    getRootNode().addLight(sun);
    //add scripts which convert the physics positions to view positions
    //the scripts are executed on the render thread
    SimpleLogicManagerState logicManager = getStateManager().getState(SimpleLogicManagerState.class);
    logicManager.attach(new PhysicsToViewRotation.Logic());
    logicManager.attach(new PhysicsToViewLocation.Logic());

    ESBulletState esBulletState = stateManager.getState(ESBulletState.class);
    esBulletState.onInitialize(() -> {
        //Add Debug State to debug physics
        //As you see there are getters for physics space and so on.
        BulletDebugAppState debugAppState = new BulletDebugAppState(esBulletState.getPhysicsSpace());
        getStateManager().attach(debugAppState);

        //add a logic manager for scripts which should be executed on the physics thread
        PhysicsSimpleLogicManager physicsLogicManager = new PhysicsSimpleLogicManager();
        physicsLogicManager.initialize(entityData, esBulletState.getBulletSystem());
        //in a real application don't forget to destroy it after usage:
        //physicsLogicManager.destroy();

        ForceProducerLogic forceProducerLogic = new ForceProducerLogic();
        forceProducerLogic.initLogic(entityData, esBulletState.getBulletSystem());
        physicsLogicManager.getPreTickLogicManager().attach(forceProducerLogic);

        initWorld();
        initForceField();
    });
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:38,代码来源:ForceProducerExample.java

示例11: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    getRootNode().attachChild(root);
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,-0.5f,-2).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    getRootNode().addLight(sun);

    SimpleLogicManagerState logicManager = getStateManager().getState(SimpleLogicManagerState.class);
    logicManager.attach(new PhysicsToViewRotation.Logic());
    logicManager.attach(new PhysicsToViewLocation.Logic());

    ESBulletState esBulletState = stateManager.getState(ESBulletState.class);
    esBulletState.onInitialize(() -> {
        //we need to register the move force otherwise the force system wouldn't apply it
        esBulletState.getBulletSystem().getForceSystem().registerForce(MoveForce.class);

        //we need a logic manager for advanced logic scripts
        PhysicsSimpleLogicManager physicsLogicManager = new PhysicsSimpleLogicManager();
        physicsLogicManager.initialize(entityData, esBulletState.getBulletSystem());
        //don't forget to destroy the logic manager in a real application
        //physicsLogicManager.destroy();

        //the simple physics logic manager supports execution of logic scripts before and
        //after the physics update. We need the drag force to be executed before because it is a force.
        physicsLogicManager.getPreTickLogicManager().attach(new CharacterLogic());
        SimpleDragForceLogic sdfl = new SimpleDragForceLogic();
        sdfl.initLogic(esBulletState.getBulletSystem());
        physicsLogicManager.getPreTickLogicManager().attach(sdfl);

        //create a simple level
        createLevel();
        createCharacter();

        //create some controls
        initInput();

    });//End of onInitialize
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:40,代码来源:CustomCharacterExample.java

示例12: prepareScene

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
/**
 * Prepare a transfer processor to transfer preview result to a image view.
 *
 * @return the transfer processor.
 */
@JMEThread
private @NotNull FrameTransferSceneProcessor prepareScene() {

    final Editor editor = Editor.getInstance();
    final AssetManager assetManager = editor.getAssetManager();
    final Spatial sky = SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr",
                    SkyFactory.EnvMapType.EquirectMap);

    final DirectionalLight light = new DirectionalLight();
    light.setDirection(LIGHT_DIRECTION);

    final Node cameraNode = new Node("Camera node");
    final Node rootNode = editor.getPreviewNode();
    rootNode.addControl(this);
    rootNode.attachChild(sky);
    rootNode.addLight(light);
    rootNode.attachChild(cameraNode);
    rootNode.attachChild(modelNode);

    final Camera camera = editor.getPreviewCamera();
    final EditorCamera editorCamera = new EditorCamera(camera, cameraNode);
    editorCamera.setMaxDistance(10000);
    editorCamera.setMinDistance(0.01F);
    editorCamera.setSmoothMotion(false);
    editorCamera.setRotationSensitivity(1);
    editorCamera.setZoomSensitivity(0.2F);

    //TODO added supporting moving the camera

    processor = bind(editor, imageView, imageView, editor.getPreviewViewPort(), false);
    processor.setTransferMode(ON_CHANGES);
    processor.setEnabled(false);

    return processor;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:41,代码来源:JMEFilePreviewManager.java

示例13: postCameraUpdate

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@JMEThread
protected void postCameraUpdate(final float tpf) {

    final DirectionalLight lightForCamera = getLightForCamera();
    final EditorCamera editorCamera = getEditorCamera();

    if (editorCamera != null && lightForCamera != null && needUpdateCameraLight()) {
        final Camera camera = EDITOR.getCamera();
        lightForCamera.setDirection(camera.getDirection().normalize());
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:12,代码来源:AdvancedAbstractEditor3DState.java

示例14: makeCharacter

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
protected Spatial makeCharacter() {
    // load a character from jme3test-test-data
    Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
    golem.scale(0.5f);
    golem.setLocalTranslation(-1.0f, -1.5f, -0.6f);

    // We must add a light to make the model visible
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
    golem.addLight(sun);
    return golem;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:TestMousePick.java

示例15: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    // Create two boxes
    Mesh mesh1 = new Box(0.5f, 0.5f, 0.5f);
    geom1 = new Geometry("Box", mesh1);
    geom1.move(2, 2, -.5f);
    Material m1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    m1.setColor("Color", ColorRGBA.Blue);
    geom1.setMaterial(m1);
    rootNode.attachChild(geom1);

    // load a character from jme3test-test-data
    golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
    golem.scale(0.5f);
    golem.setLocalTranslation(-1.0f, -1.5f, -0.6f);

    // We must add a light to make the model visible
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
    golem.addLight(sun);
    rootNode.attachChild(golem);

    // Create input
    inputManager.addMapping("MoveRight", new KeyTrigger(KeyInput.KEY_L));
    inputManager.addMapping("MoveLeft", new KeyTrigger(KeyInput.KEY_J));
    inputManager.addMapping("MoveUp", new KeyTrigger(KeyInput.KEY_I));
    inputManager.addMapping("MoveDown", new KeyTrigger(KeyInput.KEY_K));

    inputManager.addListener(analogListener, new String[]{
                "MoveRight", "MoveLeft", "MoveUp", "MoveDown"
            });
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:TestTriangleCollision.java


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