本文整理汇总了Java中com.jme3.scene.shape.Torus类的典型用法代码示例。如果您正苦于以下问题:Java Torus类的具体用法?Java Torus怎么用?Java Torus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Torus类属于com.jme3.scene.shape包,在下文中一共展示了Torus类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: attachRandomGeometry
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
private void attachRandomGeometry(Node node, Material mat) {
Box box = new Box(0.25f, 0.25f, 0.25f);
Torus torus = new Torus(16, 16, 0.2f, 0.8f);
Geometry[] boxes = new Geometry[]{
new Geometry("box1", box),
new Geometry("box2", box),
new Geometry("box3", box),
new Geometry("torus1", torus),
new Geometry("torus2", torus),
new Geometry("torus3", torus)
};
for (int i = 0; i < boxes.length; i++) {
Geometry geometry = boxes[i];
geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI));
geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10);
geometry.setMaterial(mat);
node.attachChild(geometry);
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:TestCollisionShapeFactory.java
示例2: createTorus
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
private Spatial createTorus(String name, ColorRGBA color) {
Node torus = new Node(name);
// 可见的旋转圈
Material mat = MaterialUtils.createUnshaded(color);
mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
mat.getAdditionalRenderState().setDepthTest(false);
Geometry torusInner = new Geometry(name + "tours", new Torus(80, 6, 0.005f, 1.0f));
torusInner.setMaterial(mat);
// 用于优化点选
Geometry torusOuter = new Geometry(name + "picker", new Torus(20, 4, 0.15f, 1.0f));
torusOuter.setMaterial(MaterialUtils.createUnshaded());
torusOuter.setCullHint(CullHint.Always);
torus.attachChild(torusInner);
torus.attachChild(torusOuter);
return torus;
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:21,代码来源:RotationAxis.java
示例3: createMesh
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull Mesh createMesh(@NotNull final VarTable vars) {
final int circleSamples = vars.getInteger(PROPERTY_CIRCLE_SAMPLES);
final int radialSamples = vars.getInteger(PROPERTY_RADIAL_SAMPLES);
final float innerRadius = vars.getFloat(PROPERTY_INNER_RADIUS);
final float outerRadius = vars.getFloat(PROPERTY_OUTER_RADIUS);
return new Torus(circleSamples, radialSamples, innerRadius, outerRadius);
}
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:10,代码来源:CreateTorusShapeEmitterAction.java
示例4: simpleInitApp
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Torus torus = new Torus(10, 6, 1, 3);
// Torus torus = new Torus(50, 30, 1, 3);
Geometry g = new Geometry("Torus Geom", torus);
g.rotate(-FastMath.HALF_PI, 0, 0);
g.center();
// g.move(0, 1, 0);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setFloat("Shininess", 32f);
mat.setBoolean("UseMaterialColors", true);
mat.setColor("Ambient", ColorRGBA.Black);
mat.setColor("Diffuse", ColorRGBA.White);
mat.setColor("Specular", ColorRGBA.White);
// mat.setBoolean("VertexLighting", true);
// mat.setBoolean("LowQuality", true);
g.setMaterial(mat);
rootNode.attachChild(g);
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.Green);
pl.setRadius(4f);
rootNode.addLight(pl);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.Red);
dl.setDirection(new Vector3f(0, 1, 0));
rootNode.addLight(dl);
}
开发者ID:mleoking,项目名称:PhET,代码行数:36,代码来源:TestLightRadius.java
示例5: createInstrumentParts
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
@Override
protected void createInstrumentParts() {
circle = new InstrumentPart(Name + " yaw");
circle.putViewGeometry("0", new ColorRGBA(0.8f, 0.2f, 0.8f, 1), new Torus(25, 3, 0.03f, 1), true);
circle.putGripGeometry("0", new Torus(12, 3, 0.1f, 1));
circle.setOnSelection(() -> getPresenter().selectTool());
drawnNode.attachChild(circle.getViewNode());
gripNode.attachChild(circle.getGripNode());
parts.add(circle);
}
开发者ID:meltzow,项目名称:supernovae,代码行数:11,代码来源:CircleCollisionShapeInstrumentState.java
示例6: RotHandle
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
public RotHandle(Tweed tweed, Spatial target) {
super (tweed);
this.target = target;
this.dir = new Vector3f(0,1,0);
Torus handleOne = new Torus(24, 8, 0.2f, 4f); //Box( 0.1f, 0.1f, 0.1f );
g1 = new Geometry("h1", handleOne);
g1.setUserData(Tweed.CLICK, this);
Material mat1 = new Material(tweed.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor( "Color", ColorRGBA.Yellow );
g1.setMaterial(mat1);
updateScale();
attachChild(g1);
}
开发者ID:twak,项目名称:chordatlas,代码行数:20,代码来源:RotHandle.java
示例7: simpleInitApp
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Torus torus = new Torus(10, 6, 1, 3);
// Torus torus = new Torus(50, 30, 1, 3);
Geometry g = new Geometry("Torus Geom", torus);
g.rotate(-FastMath.HALF_PI, 0, 0);
g.center();
// g.move(0, 1, 0);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setFloat("Shininess", 32f);
mat.setBoolean("UseMaterialColors", true);
mat.setColor("Ambient", ColorRGBA.Black);
mat.setColor("Diffuse", ColorRGBA.White);
mat.setColor("Specular", ColorRGBA.White);
// mat.setBoolean("VertexLighting", true);
// mat.setBoolean("LowQuality", true);
g.setMaterial(mat);
rootNode.attachChild(g);
Geometry lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
movingNode=new Node("lightParentNode");
movingNode.attachChild(lightMdl);
rootNode.attachChild(movingNode);
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.Green);
pl.setRadius(4f);
rootNode.addLight(pl);
LightNode lightNode=new LightNode("pointLight", pl);
movingNode.attachChild(lightNode);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.Red);
dl.setDirection(new Vector3f(0, 1, 0));
rootNode.addLight(dl);
}
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:TestLightNode.java
示例8: createInstrumentParts
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
@Override
protected void createInstrumentParts(){
InstrumentPart x = new InstrumentPart(Name + " x");
Mesh cone = TranslateUtil.toJMEMesh(new Cone(0.01, 0.015, 12));
x.putViewAndGripGeometry("0", new ColorRGBA(0.8f, 0.8f, 0.2f, 1), cone, true);
x.setTranslation(new Point3D(0.1, 0, 0));
x.setRotation(new Quaternion().fromAngles(0, (float) AngleUtil.RIGHT, 0));
x.setOnSelection(() -> getPresenter().selectTool(Tool.X));
drawnNode.attachChild(x.getViewNode());
gripNode.attachChild(x.getGripNode());
parts.add(x);
InstrumentPart y = new InstrumentPart(Name + " y");
y.putViewAndGripGeometry("0", new ColorRGBA(0.8f, 0.2f, 0.2f, 1), cone, true);
y.setTranslation(new Point3D(0, 0.1, 0));
y.setRotation(new Quaternion().fromAngles((float) -AngleUtil.RIGHT, 0, 0));
y.setOnSelection(() -> getPresenter().selectTool(Tool.Y));
drawnNode.attachChild(y.getViewNode());
gripNode.attachChild(y.getGripNode());
parts.add(y);
InstrumentPart z = new InstrumentPart(Name + " z");
z.putViewAndGripGeometry("0", new ColorRGBA(0.2f, 0.2f, 0.8f, 1), new Box(0.0025f, 0.0025f, 0.1f), true);
z.setOnSelection(() -> getPresenter().selectTool(Tool.Z));
drawnNode.attachChild(z.getViewNode());
gripNode.attachChild(z.getGripNode());
parts.add(z);
InstrumentPart xy = new InstrumentPart(Name + " xy");
xy.putViewAndGripGeometry("0", new ColorRGBA(0.5f, 0.2f, 0.2f, 1), new Box(0.02f, 0.02f, 0.001f), true);
xy.setTranslation(new Point3D(0.02, 0.02, 0));
xy.setOnSelection(() -> getPresenter().selectTool(Tool.XY));
drawnNode.attachChild(xy.getViewNode());
gripNode.attachChild(xy.getGripNode());
parts.add(xy);
InstrumentPart yaw = new InstrumentPart(Name + " yaw");
yaw.putViewGeometry("0", new ColorRGBA(0.2f, 0.2f, 0.8f, 1), new Torus(25, 3, 0.0015f, 0.09f), true);
yaw.putGripGeometry("0", new Torus(12, 3, 0.005f, 0.09f));
yaw.setOnSelection(() -> getPresenter().selectTool(Tool.YAW));
drawnNode.attachChild(yaw.getViewNode());
gripNode.attachChild(yaw.getGripNode());
parts.add(yaw);
}
开发者ID:meltzow,项目名称:supernovae,代码行数:45,代码来源:PlanarStanceInstrumentState.java
示例9: updateShape
import com.jme3.scene.shape.Torus; //导入依赖的package包/类
private void updateShape(double radius){
Point3D pos = presenter.getPosition();
double camDistance = RendererPlatform.getCamera().getLocation().distance(TranslateUtil.toVector3f(pos));
circle.setViewMesh("0", new Torus(25, 3, 0.0015f, (float)(radius/camDistance)));
circle.setGripMesh("0", new Torus(12, 3, 0.005f, (float)(radius/camDistance)));
}
开发者ID:meltzow,项目名称:supernovae,代码行数:7,代码来源:CircleCollisionShapeInstrumentState.java
注:本文中的com.jme3.scene.shape.Torus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论