本文整理汇总了Java中com.jme3.scene.shape.Sphere类的典型用法代码示例。如果您正苦于以下问题:Java Sphere类的具体用法?Java Sphere怎么用?Java Sphere使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Sphere类属于com.jme3.scene.shape包,在下文中一共展示了Sphere类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BaseMaterialEditor3DState
import com.jme3.scene.shape.Sphere; //导入依赖的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());
}
示例2: createGeometry
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
protected @NotNull Geometry createGeometry(@NotNull final ScenePresentable.PresentationType presentationType) {
final Material material = new Material(EDITOR.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", ColorRGBA.Yellow);
material.getAdditionalRenderState().setWireframe(true);
Geometry geometry;
switch (presentationType) {
case SPHERE: {
geometry = new Geometry("Sphere", new Sphere(8, 8, 1));
break;
}
default: {
geometry = new Geometry("Box", new Box(1, 1, 1));
}
}
geometry.setMaterial(material);
return geometry;
}
示例3: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的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);
}
示例4: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(14, 14, 1);
Material solidColor = (Material) assetManager.loadAsset("Common/Materials/RedColor.j3m");
for (int y = -5; y < 5; y++){
for (int x = -5; x < 5; x++){
Geometry sphere = new Geometry("sphere", sphMesh);
sphere.setMaterial(solidColor);
sphere.setLocalTranslation(x * 2, 0, y * 2);
rootNode.attachChild(sphere);
}
}
cam.setLocation(new Vector3f(0, 5, 0));
cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
}
示例5: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bullet = new Sphere(32, 32, 0.4f, true, false);
bullet.setTextureMode(TextureMode.Projected);
bulletCollisionShape = new SphereCollisionShape(0.4f);
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
setupKeys();
// Add a physics character to the world
physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f,1.8f), .1f);
physicsCharacter.setPhysicsLocation(new Vector3f(3, 6, 0));
Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
model.scale(0.25f);
model.addControl(physicsCharacter);
getPhysicsSpace().add(physicsCharacter);
rootNode.attachChild(model);
}
示例6: initScene
import com.jme3.scene.shape.Sphere; //导入依赖的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);
}
示例7: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的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);
}
示例8: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的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);
}
示例9: simpleInitApp
import com.jme3.scene.shape.Sphere; //导入依赖的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);
}
示例10: assignPoints
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
private void assignPoints(AssetManager assetManager) {
Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
defaultMaterial.setColor("Color", ColorRGBA.DarkGray);
for (int i = -10; i <= 10; ++i) {
Geometry g = new Geometry("", new Sphere(3, 3, 0.05f));
g.setLocalTranslation(i, 0, 0);
g.setMaterial(defaultMaterial);
this.attachChild(g);
g = new Geometry("", new Sphere(3, 3, 0.05f));
g.setLocalTranslation(0, i, 0);
g.setMaterial(defaultMaterial);
this.attachChild(g);
g = new Geometry("", new Sphere(3, 3, 0.05f));
g.setLocalTranslation(0, 0, i);
g.setMaterial(defaultMaterial);
this.attachChild(g);
}
}
示例11: VisibleBone
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
public VisibleBone(Bone bone, Vector3f parentLocation, Quaternion parentRotation, AssetManager assetManager) {
Material redMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
redMat.setColor("Color", ColorRGBA.Red);
Material whiteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
whiteMat.setColor("Color", ColorRGBA.White);
Geometry g = new Geometry(bone.getName(), new Sphere(9, 9, 0.01f));
globalPosition = bone.getLocalPosition().add(parentLocation);
g.setLocalTranslation(globalPosition);
g.setLocalRotation(bone.getLocalRotation().mult(parentRotation));
g.setMaterial(redMat);
this.attachChild(g);
if (bone.getChildren() != null) {
for (Bone child : bone.getChildren()) {
VisibleBone vb = new VisibleBone(child, bone.getLocalPosition(), bone.getLocalRotation(), assetManager);
this.attachChild(vb);
Line line = new Line(globalPosition, vb.globalPosition);
line.setLineWidth(2);
Geometry geom = new Geometry("", line);
geom.setMaterial(whiteMat);
this.attachChild(geom);
}
}
}
示例12: init
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
private void init() {
SceneApplication.getApplication().addSceneListener(this);
Sphere sphMesh = new Sphere(32, 32, 2.5f);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 2.5f, false, false);
Logger log = Logger.getLogger(TangentBinormalGenerator.class.getName());
log.setLevel(Level.SEVERE);
TangentBinormalGenerator.generate(sphMesh);
sphere = new Geometry("previewSphere", sphMesh);
sphere.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_X));
Box boxMesh = new Box(1.75f, 1.75f, 1.75f);
TangentBinormalGenerator.generate(boxMesh);
box = new Geometry("previewBox", boxMesh);
box.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.DEG_TO_RAD * 30, Vector3f.UNIT_X).multLocal(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Y)));
Quad quadMesh = new Quad(4.5f, 4.5f);
TangentBinormalGenerator.generate(quadMesh);
quad = new Geometry("previewQuad", quadMesh);
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
currentGeom = sphere;
init = true;
}
示例13: createLightProbeGizmo
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
private static Spatial createLightProbeGizmo(AssetManager assetManager, JmeLightProbe probe){
LightProbeGizmo gizmo = new LightProbeGizmo(probe);//new Node("Environment debug Node");
gizmo.addControl(new LightPositionUpdate(probe.getLightProbe(), gizmo));
gizmo.addControl(new LightProbeUpdate(probe));
Sphere s = new Sphere(16, 16, 0.5f);
Geometry debugGeom = new Geometry(probe.getLightProbe().getName(), s);
Material debugMaterial = new Material(assetManager, "Common/MatDefs/Misc/reflect.j3md");
debugGeom.setMaterial(debugMaterial);
Spatial debugBounds = ProbeRadiusShape.createShape(assetManager);
gizmo.attachChild(debugGeom);
gizmo.attachChild(debugBounds);
return gizmo;
}
示例14: doCreateSpatial
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
@Override
protected Spatial doCreateSpatial(Node parent) {
NewGeometrySettings cfg = new NewGeometrySettings();
Sphere b = new Sphere(
cfg.getSphereZSamples()
, cfg.getSpherRadialSamples()
, cfg.getSphereRadius()
, cfg.getSphereUseEvenSlices()
, cfg.getSphereInterior()
);
b.setMode(cfg.getSphereMode());
Geometry geom = new Geometry(cfg.getSphereName(), b);
Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
ColorRGBA c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
mat.setColor("Color", c);
geom.setMaterial(mat);
parent.attachChild(geom);
return geom;
}
示例15: initEntity
import com.jme3.scene.shape.Sphere; //导入依赖的package包/类
@Override
public void initEntity() {
super.initEntity();
if (sound == null) {
return;
}
if (debug) {
debugNode = new Geometry("debugAudioEnvDistance", new Sphere(20, 20, sound.getData().getMaxDistance()));
debugNode.setMaterial(createDebugMaterial(ColorRGBA.Green));
sound.attachChild(debugNode);
debugInnerNode = new Geometry("debugAudioEnvRefDistance", new Sphere(20, 20, sound.getData().getRefDistance()));
debugInnerNode.setMaterial(createDebugMaterial(ColorRGBA.Red));
sound.attachChild(debugInnerNode);
}
if (isEnabled()) {
SoundManager.getInstance().addAndPlay(sound);
}
}