本文整理汇总了Java中com.jme3.util.SkyFactory类的典型用法代码示例。如果您正苦于以下问题:Java SkyFactory类的具体用法?Java SkyFactory怎么用?Java SkyFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SkyFactory类属于com.jme3.util包,在下文中一共展示了SkyFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initScene
import com.jme3.util.SkyFactory; //导入依赖的package包/类
private void initScene() {
//init cam location
cam.setLocation(new Vector3f(0, 10, 10));
cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
//init scene
sceneNode = new Node("Scene");
mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
geom.setMaterial(mat);
sceneNode.attachChild(geom);
// load sky
sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
rootNode.attachChild(sceneNode);
//add lightPos Geometry
Sphere lite=new Sphere(8, 8, 3.0f);
lightSphere=new Geometry("lightsphere", lite);
lightSphere.setMaterial(mat);
lightSphere.setLocalTranslation(lightPos);
rootNode.attachChild(lightSphere);
}
示例2: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void simpleInitApp() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
/*
Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png");
Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png");
Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png");
Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png");
Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png");
Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png");
*/
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
示例3: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void simpleInitApp() {
/*
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
*/
Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png");
Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png");
Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png");
Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png");
Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png");
Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
示例4: loadSkyBoxes
import com.jme3.util.SkyFactory; //导入依赖的package包/类
/**
* Loads up the sky boxes into fields, ready to use
* @param am
* The asset manager used to load the textures from
*/
private void loadSkyBoxes(AssetManager am){
daySkyBox = SkyFactory.createSky(am,
am.loadTexture("/Textures/skybox/day_right.jpg"),
am.loadTexture("/Textures/skybox/day_left.jpg"),
am.loadTexture("/Textures/skybox/day_back.jpg"),
am.loadTexture("/Textures/skybox/day_front.jpg"),
am.loadTexture("/Textures/skybox/day_top.jpg"),
am.loadTexture("/Textures/skybox/day_top.jpg"));
nightSkyBox = SkyFactory.createSky(am,
am.loadTexture("/Textures/skybox/night_right.jpg"),
am.loadTexture("/Textures/skybox/night_left.jpg"),
am.loadTexture("/Textures/skybox/night_back.jpg"),
am.loadTexture("/Textures/skybox/night_front.jpg"),
am.loadTexture("/Textures/skybox/night_top.jpg"),
am.loadTexture("/Textures/skybox/night_bottom.jpg"));
daySkyBox.setShadowMode(ShadowMode.Off);
nightSkyBox.setShadowMode(ShadowMode.Off);
}
示例5: createSky
import com.jme3.util.SkyFactory; //导入依赖的package包/类
/**
* Create a cube-mapped sky using six textures.
*
* @param assetManager from which to load materials
* @param west texture for the western face of the cube
* @param east texture for the eastern face of the cube
* @param north texture for the northern face of the cube
* @param south texture for the southern face of the cube
* @param up texture for the top face of the cube
* @param down texture for the bottom face of the cube
* @param normalScale The normal scale is multiplied by the 3D normal to get
* a texture coordinate. Use Vector3f.UNIT_XYZ to not apply and
* transformation to the normal.
* @param sphereRadius the sky sphere's radius: for the sky to be visible,
* its radius must fall between the near and far planes of the camera's
* frustrum
* @return a new spatial representing the sky, ready to be attached to the
* scene graph
*/
public static @NotNull Spatial createSky(@NotNull final AssetManager assetManager, @NotNull final Texture west,
@NotNull final Texture east, @NotNull final Texture north,
@NotNull final Texture south, @NotNull final Texture up,
@NotNull final Texture down, @NotNull final Vector3f normalScale,
float sphereRadius) {
Image westImg = west.getImage();
Image eastImg = east.getImage();
Image northImg = north.getImage();
Image southImg = south.getImage();
Image upImg = up.getImage();
Image downImg = down.getImage();
checkImagesForCubeMap(westImg, eastImg, northImg, southImg, upImg, downImg);
Image cubeImage = new Image(westImg.getFormat(), westImg.getWidth(), westImg.getHeight(), null, westImg.getColorSpace());
cubeImage.addData(westImg.getData(0));
cubeImage.addData(eastImg.getData(0));
cubeImage.addData(downImg.getData(0));
cubeImage.addData(upImg.getData(0));
cubeImage.addData(southImg.getData(0));
cubeImage.addData(northImg.getData(0));
TextureCubeMap cubeMap = new TextureCubeMap(cubeImage);
return createSky(assetManager, cubeMap, normalScale, SkyFactory.EnvMapType.CubeMap, sphereRadius);
}
示例6: AdvancedPBRWithStudioSky3DEditorState
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public AdvancedPBRWithStudioSky3DEditorState(@NotNull final T fileEditor) {
super(fileEditor);
final AssetManager assetManager = EDITOR.getAssetManager();
final Geometry sky = (Geometry) SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr",
SkyFactory.EnvMapType.EquirectMap);
final Node stateNode = getStateNode();
stateNode.attachChild(sky);
}
示例7: prepareScene
import com.jme3.util.SkyFactory; //导入依赖的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;
}
示例8: createSky
import com.jme3.util.SkyFactory; //导入依赖的package包/类
private void createSky() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
示例9: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void simpleInitApp() {
this.flyCam.setMoveSpeed(10);
Node mainScene=new Node();
cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
// load sky
mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
// create the geometry and attach it
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
} else {
assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
}
Spatial scene = assetManager.loadModel("main.scene");
DirectionalLight sun = new DirectionalLight();
Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
sun.setDirection(lightDir);
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
mainScene.attachChild(scene);
rootNode.attachChild(mainScene);
fpp=new FilterPostProcessor(assetManager);
//fpp.setNumSamples(4);
fog=new FogFilter();
fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f));
fog.setFogDistance(155);
fog.setFogDensity(2.0f);
fpp.addFilter(fog);
viewPort.addProcessor(fpp);
initInputs();
}
示例10: setupSkyBox
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void setupSkyBox() {
Texture envMap;
if (renderer.getCaps().contains(Caps.FloatTexture)) {
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr");
} else {
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
}
rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1, -1, -1), true));
}
示例11: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
@Override
public void simpleInitApp() {
final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o");
TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true);
key.setGenerateMips(true);
key.setAsCube(true);
final Texture tex = assetManager.loadTexture(key);
for (Spatial geom : buggy.getChildren()) {
if (geom instanceof Geometry) {
Material m = ((Geometry) geom).getMaterial();
m.setTexture("EnvMap", tex);
m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f));
}
}
flyCam.setEnabled(false);
ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f));
buggy.addControl(chaseCam);
rootNode.attachChild(buggy);
rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false));
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
bf.setBloomIntensity(2.3f);
bf.setExposurePower(0.6f);
fpp.addFilter(bf);
viewPort.addProcessor(fpp);
}
示例12: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void simpleInitApp() {
this.flyCam.setMoveSpeed(10);
// load sky
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
File file = new File("wildhouse.zip");
if (!file.exists()) {
useHttp = true;
}
// create the geometry and attach it
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
} else {
assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
}
Spatial scene = assetManager.loadModel("main.scene");
AmbientLight al = new AmbientLight();
scene.addLight(al);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(0.69077975f, -0.6277887f, -0.35875428f).normalizeLocal());
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
rootNode.attachChild(scene);
}
示例13: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach(bulletAppState);
// bulletAppState.getPhysicsSpace().enableDebug(assetManager);
bulletAppState.getPhysicsSpace().setAccuracy(1f/30f);
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
PssmShadowRenderer pssmr = new PssmShadowRenderer(assetManager, 2048, 3);
pssmr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
pssmr.setLambda(0.55f);
pssmr.setShadowIntensity(0.6f);
pssmr.setCompareMode(CompareMode.Hardware);
pssmr.setFilterMode(FilterMode.Bilinear);
viewPort.addProcessor(pssmr);
setupKeys();
createTerrain();
buildPlayer();
DirectionalLight dl = new DirectionalLight();
dl.setColor(new ColorRGBA(1.0f, 0.94f, 0.8f, 1f).multLocal(1.3f));
dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
rootNode.addLight(dl);
Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
DirectionalLight dl2 = new DirectionalLight();
dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
dl2.setDirection(lightDir2);
rootNode.addLight(dl2);
}
示例14: setupSkyBox
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void setupSkyBox(){
Texture envMap;
if (renderer.getCaps().contains(Caps.FloatTexture)){
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr");
}else{
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
}
rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1,-1,-1), true));
}
示例15: simpleInitApp
import com.jme3.util.SkyFactory; //导入依赖的package包/类
public void simpleInitApp() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}