本文整理汇总了Java中com.jme3.light.PointLight类的典型用法代码示例。如果您正苦于以下问题:Java PointLight类的具体用法?Java PointLight怎么用?Java PointLight使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PointLight类属于com.jme3.light包,在下文中一共展示了PointLight类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildForImpl
import com.jme3.light.PointLight; //导入依赖的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);
}
}
示例2: buildForPointLight
import com.jme3.light.PointLight; //导入依赖的package包/类
@FXThread
private void buildForPointLight(@NotNull final PointLight light, @NotNull final VBox container,
@NotNull final ModelChangeConsumer changeConsumer) {
final Vector3f position = light.getPosition().clone();
final float radius = light.getRadius();
final Vector3FPropertyControl<ModelChangeConsumer, PointLight> positionControl =
new Vector3FPropertyControl<>(position, Messages.MODEL_PROPERTY_LOCATION, changeConsumer);
positionControl.setApplyHandler(PointLight::setPosition);
positionControl.setSyncHandler(PointLight::getPosition);
positionControl.setEditObject(light);
final FloatPropertyControl<ModelChangeConsumer, PointLight> radiusControl =
new FloatPropertyControl<>(radius, Messages.MODEL_PROPERTY_RADIUS, changeConsumer);
radiusControl.setApplyHandler(PointLight::setRadius);
radiusControl.setSyncHandler(PointLight::getRadius);
radiusControl.setMinMax(0, Integer.MAX_VALUE);
radiusControl.setEditObject(light);
FXUtils.addToPane(positionControl, container);
buildSplitLine(container);
FXUtils.addToPane(radiusControl, container);
}
示例3: simpleInitApp
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(32, 32, 1);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 1, false, false);
TangentBinormalGenerator.generate(sphMesh);
Geometry sphere = new Geometry("Rock Ball", sphMesh);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
mat.setColor("Ambient", ColorRGBA.DarkGray);
mat.setColor("Diffuse", ColorRGBA.White);
mat.setBoolean("UseMaterialColors", true);
sphere.setMaterial(mat);
rootNode.attachChild(sphere);
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(4f, 0f, 0f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White);
rootNode.addLight(al);
}
示例4: simpleInitApp
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Quad quadMesh = new Quad(1, 1);
Geometry sphere = new Geometry("Rock Ball", quadMesh);
Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m");
sphere.setMaterial(mat);
TangentBinormalGenerator.generate(sphere);
rootNode.attachChild(sphere);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
// DirectionalLight dl = new DirectionalLight();
// dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal());
// dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f));
// rootNode.addLight(dl);
}
示例5: simpleInitApp
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(32, 32, 1);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 1, false, false);
TangentBinormalGenerator.generate(sphMesh);
Geometry sphere = new Geometry("Rock Ball", sphMesh);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
sphere.setMaterial(mat);
rootNode.attachChild(sphere);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
// DirectionalLight dl = new DirectionalLight();
// dl.setDirection(new Vector3f(1,-1,1).normalizeLocal());
// dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f));
// rootNode.addLight(dl);
}
示例6: spatialTolight
import com.jme3.light.PointLight; //导入依赖的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());
// }
}
示例7: updateLightCamera
import com.jme3.light.PointLight; //导入依赖的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);
}
}
示例8: createPointGizmo
import com.jme3.light.PointLight; //导入依赖的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;
}
示例9: createSheet
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
//TODO: multithreading..
Sheet sheet = super.createSheet();
Sheet.Set set = Sheet.createPropertiesSet();
set.setDisplayName("PointLight");
set.setName(PointLight.class.getName());
PointLight obj = pointLight;//getLookup().lookup(Spatial.class);
if (obj == null) {
return sheet;
}
set.put(makeProperty(obj, Vector3f.class, "getPosition", "setPosition", "Position"));
set.put(makeProperty(obj, float.class, "getRadius", "setRadius", "Radius"));
sheet.put(set);
return sheet;
}
示例10: controlUpdate
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void controlUpdate(float tpf) {
if(spatial!=null&&light!=null){
TempVars vars=TempVars.get();
try{
if(light instanceof PointLight){
((PointLight)light).setPosition(spatial.getWorldTranslation());
}else if(light instanceof DirectionalLight){
((DirectionalLight)light).setDirection(spatial.getWorldRotation().multLocal(vars.vect1.set(Vector3f.UNIT_Z)));
}else if(light instanceof SpotLight){
((SpotLight)light).setPosition(spatial.getWorldTranslation());
((SpotLight)light).setDirection(spatial.getWorldRotation().multLocal(vars.vect1.set(Vector3f.UNIT_Z)));
}
}finally{
vars.release();
}
}
}
示例11: simpleInitApp
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Spatial signpost = (Spatial) assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml"));
signpost.setMaterial( (Material) assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"));
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial( (Material) assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
// flourescent main light
pl = new PointLight();
pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal());
dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f));
rootNode.addLight(dl);
}
示例12: spatialTolight
import com.jme3.light.PointLight; //导入依赖的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));
}
if (light instanceof SpotLight) {
((SpotLight) light).setPosition(spatial.getWorldTranslation());
((SpotLight) light).setDirection(spatial.getWorldRotation().multLocal(vars.vect1.set(Vector3f.UNIT_Y).multLocal(-1)));
}
vars.release();
}
示例13: activate
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public void activate(Player player) {
if (!isPlaced) return;
isActive = !isActive;
if (isActive) {
light = new PointLight();
light.setColor(lightColor);
light.setRadius(lightRadius);
light.setPosition(getLocation().add(LIGHT_OFFSET));
world.getNode().addLight(light);
slow = new SlowInRadius(getLocation(), slowRadius, slowPower);
// if you are not the client, create the slow effect
if(world.getWorldType() != WorldType.CLIENT)
world.makeLocalEffect(slow);
} else {
onDeactivate();
}
}
示例14: getEditableProperties
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {
final List<EditableProperty<?, ?>> result = super.getEditableProperties();
result.add(new SimpleProperty<>(POINT_LIGHT_FROM_SCENE, "Point light", this,
makeGetter(this, PointLight.class, "getLight"),
makeSetter(this, PointLight.class, "setLight")));
return result;
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder-extension,代码行数:11,代码来源:EditablePointLightFromSceneShadowFilter.java
示例15: getName
import com.jme3.light.PointLight; //导入依赖的package包/类
@Override
@FromAnyThread
public @NotNull String getName() {
final PointLight element = getElement();
final String name = element.getName();
return StringUtils.isEmpty(name) ? Messages.MODEL_FILE_EDITOR_NODE_POINT_LIGHT : name;
}