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


Java DirectionalLight.setColor方法代码示例

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


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

示例1: main

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
public static void main(String[] args)
{
   Logger.getLogger("").setLevel(Level.SEVERE);
   
   final SimpleApplication scene = new SimpleApplication()
   {
      @Override
      public void simpleInitApp()
      {
         getFlyByCamera().setMoveSpeed(10);
         getViewPort().setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f));
         
         DirectionalLight dl = new DirectionalLight();
         dl.setDirection(new Vector3f(0.69305897f, -0.51373863f, 0.5057093f).normalizeLocal());
         dl.setColor(new ColorRGBA(0.8f, 0.8f, 0.8f, 0.8f));
         getRootNode().addLight(dl);
         
         AmbientLight amb = new AmbientLight();
         amb.setColor(new ColorRGBA(3.7f, 3.5f, 3.9f, 1.0f));
         getRootNode().addLight(amb);
         
         onInit(this);
      }
   };
   scene.start();
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:27,代码来源:DungeonRenderer.java

示例2: 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_3.java

示例3: 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

示例4: 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

示例5: 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/animtest.blend");
    
    Spatial scene = (Spatial) assetManager.loadModel(blenderKey);
    rootNode.attachChild(scene);
    
    Spatial model = this.findNode(rootNode, "TestAnim");
    model.center();
    
    control = model.getControl(AnimControl.class);
    channel = control.createChannel();

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

示例6: simpleInitApp

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    flyCam.setMoveSpeed(20);
    Sphere sphereMesh = new Sphere(32, 32, 1);
    sphereMesh.setTextureMode(Sphere.TextureMode.Projected);
    sphereMesh.updateGeometry(32, 32, 1, false, false);
    addMesh("Sphere", sphereMesh, new Vector3f(-1, 0, 0));

    Quad quadMesh = new Quad(1, 1);
    quadMesh.updateGeometry(1, 1);
    addMesh("Quad", quadMesh, new Vector3f(1, 0, 0));

    Mesh strip = createTriangleStripMesh();
    addMesh("strip", strip, new Vector3f(0, -3, 0));
    
    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal());
    dl.setColor(ColorRGBA.White);
    rootNode.addLight(dl);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:TestTangentGen.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: createLightForCamera

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
/**
 * Create light for camera directional light.
 *
 * @return the light for the camera.
 */
@JMEThread
protected @NotNull DirectionalLight createLightForCamera() {
    final DirectionalLight directionalLight = new DirectionalLight();
    directionalLight.setColor(ColorRGBA.White);
    return directionalLight;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:12,代码来源:AdvancedAbstractEditor3DState.java

示例13: afterPropertiesSet

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    directionalLight = new DirectionalLight();
    directionalLight.setColor(ColorRGBA.White.mult(0.5f));
    directionalLight.setDirection(new Vector3f(0.0f, -1.0f, 0.0f));
    ambientLight = new AmbientLight();
    ambientLight.setColor(ColorRGBA.White.mult(0.15f));
    lights = new LinkedList<>();
    lights.add(directionalLight);
    lights.add(ambientLight);
    
    final int SHADOWMAP_SIZE = 4096;
    DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, 4);
    dlsr.setLight(directionalLight);
    dlsr.setShadowIntensity(0.3f);
    dlsr.setRenderBackFacesShadows(Boolean.TRUE);
    dlsr.setShadowCompareMode(CompareMode.Hardware);
    dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
    camera.addEffect(dlsr);      
    float initialWaterHeight = 1500f; // choose a value for your scene
    /*water = new WaterFilter(rootNode, directionalLight.getDirection());
    water.setWaterHeight(initialWaterHeight);
    camera.addNearEffect(water);*/
    
    /*DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE, 3);
     dlsf.setLight(directionalLight);
     dlsf.setEnabled(true);
     camera.addNearEffect(dlsf);*/
}
 
开发者ID:ZoltanTheHun,项目名称:SkyHussars,代码行数:30,代码来源:Lighting.java

示例14: createScene

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
private void createScene() {
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setFloat("Shininess", 1f);
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Black);
    mat.setColor("Diffuse", ColorRGBA.DarkGray);
    mat.setColor("Specular", ColorRGBA.White.mult(0.6f));
    Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    matSoil.setBoolean("UseMaterialColors", true);
    matSoil.setColor("Ambient", ColorRGBA.Black);
    matSoil.setColor("Diffuse", ColorRGBA.Black);
    matSoil.setColor("Specular", ColorRGBA.Black);
    teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
    teapot.setName("Teapot");
    teapot.setLocalScale(3);
    teapot.setMaterial(mat);


    rootNode.attachChild(teapot);
    Geometry soil = new Geometry("soil", new Box(new Vector3f(0, -1.0f, 0), 50, 1, 50));
    soil.setMaterial(matSoil);

    rootNode.attachChild(soil);
    DirectionalLight light = new DirectionalLight();
    light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
    light.setColor(ColorRGBA.White.mult(1.5f));
    rootNode.addLight(light);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:TestMotionPath.java

示例15: setUpLight

import com.jme3.light.DirectionalLight; //导入方法依赖的package包/类
private void setUpLight() {
    // We add light so we see the scene
    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White.mult(1.3f));
    rootNode.addLight(al);

    DirectionalLight dl = new DirectionalLight();
    dl.setColor(ColorRGBA.White); 
    dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());
    rootNode.addLight(dl);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:HelloCollision.java


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