本文整理汇总了Java中com.jme3.scene.shape.Line类的典型用法代码示例。如果您正苦于以下问题:Java Line类的具体用法?Java Line怎么用?Java Line使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Line类属于com.jme3.scene.shape包,在下文中一共展示了Line类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VisibleBone
import com.jme3.scene.shape.Line; //导入依赖的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);
}
}
}
示例2: updateAngle
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private void updateAngle() {
Vector3f temp, higher, lower;
if (point2.y > point1.y) {
temp = point2;
higher = point2;
lower = point1;
} else {
temp = point1;
higher = point1;
lower = point2;
}
temp = temp.clone().setY(lower.y);
float angle = ((FastMath.asin(temp.distance(higher) / lower.distance(higher))) * FastMath.RAD_TO_DEG);
angleText.setText(angle + " degrees");
angleText.setLocalTranslation(new Vector3f().interpolateLocal(point1, point2, 0.5f));
if (line.getParent() == null) {
parent.attachChild(line);
parent.attachChild(angleText);
}
((Line) line.getMesh()).updatePoints(point1, point2);
}
示例3: updateAngle
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private void updateAngle() {
Vector3f temp, higher, lower;
Vector3f point2 = p2.getTarget().getWorldTranslation();
Vector3f point1 = p1.getTarget().getWorldTranslation();
if (point2.y > point1.y) {
temp = point2;
higher = point2;
lower = point1;
} else {
temp = point1;
higher = point1;
lower = point2;
}
temp = temp.clone().setY(lower.y);
float angle = ((FastMath.asin(temp.distance(higher) / lower.distance(higher))) * FastMath.RAD_TO_DEG);
angleText.setText(angle + "");
angleText.setLocalTranslation(new Vector3f().interpolateLocal(point1, point2, 0.5f));
if (line.getParent() == null) {
edit.getEditRoot().attachChild(line);
edit.getEditRoot().attachChild(angleText);
}
((Line) line.getMesh()).updatePoints(point1, point2);
}
示例4: onEntityUpdated
import com.jme3.scene.shape.Line; //导入依赖的package包/类
@Override
protected void onEntityUpdated(Entity e) {
if(SpatialPool.models.containsKey(e.getId()))
RendererPlatform.getMainSceneNode().detachChild(SpatialPool.models.get(e.getId()));
EdgedCollisionShape shape = e.get(EdgedCollisionShape.class);
String name;
Naming n = entityData.getComponent(e.getId(), Naming.class);
if(n != null)
name = n.getName() + " drawing";
else
name = "unnamed entity #"+e.getId() + " drawing";
Node node = new Node(name);
for(Segment2D s : shape.getEdges()){
Geometry g = new Geometry(e.getId().getId() + " edge");
g.setMesh(new Line(TranslateUtil.toVector3f(s.getStart(), 0.1), TranslateUtil.toVector3f(s.getEnd(), 0.1) ));
g.setMaterial(MaterialManager.getLightingColor(ColorRGBA.LightGray));
node.attachChild(g);
}
SpatialPool.models.put(e.getId(), node);
RendererPlatform.getMainSceneNode().attachChild(node);
}
示例5: drawHeightPencil
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private void drawHeightPencil() {
List<Tile> tiles = ToolManager.getHeightTool().pencil.getNodes();
int index = 0;
for (Spatial s : HeightPencilNode.getChildren()) {
if (index < tiles.size()) {
Point3D start = tiles.get(index).getPos();
Point3D end = tiles.get(index).getPos().getAddition(0, 0, 0.5);
Line l = new Line(TranslateUtil.toVector3f(start), TranslateUtil.toVector3f(end));
l.setLineWidth(PENCIL_THICKNESS);
((Geometry) s).setMesh(l);
s.setLocalTranslation(Vector3f.ZERO);
// s.setLocalTranslation(Translator.toVector3f(tiles.get(index).getPos2D(), (float)toolManager.selector.getElevation()+0.1f));
} else {
s.setLocalTranslation(new Vector3f(-1000, -1000, 0));
}
index++;
}
}
示例6: SlopeTerrainToolControl
import com.jme3.scene.shape.Line; //导入依赖的package包/类
/**
* Instantiates a new Slope terrain tool control.
*
* @param component the component
*/
public SlopeTerrainToolControl(@NotNull final TerrainEditingComponent component) {
super(component);
this.baseMarker = new Geometry("BaseMarker", new Sphere(8, 8, 1));
this.baseMarker.setMaterial(createMaterial(ColorRGBA.Red));
this.targetMarker = new Geometry("TargetMarker", new Sphere(8, 8, 1));
this.targetMarker.setMaterial(createMaterial(ColorRGBA.Blue));
this.line = new Geometry("line", new Line(Vector3f.ZERO, Vector3f.ZERO));
this.line.setMaterial(createMaterial(ColorRGBA.White));
}
示例7: controlUpdate
import com.jme3.scene.shape.Line; //导入依赖的package包/类
@Override
protected void controlUpdate(final float tpf) {
super.controlUpdate(tpf);
final Geometry baseMarker = getBaseMarker();
final Geometry targetMarker = getTargetMarker();
final Geometry line = getLine();
final Vector3f firstPoint = baseMarker.getLocalTranslation();
final Vector3f secondPoint = targetMarker.getLocalTranslation();
final Line mesh = (Line) line.getMesh();
mesh.updatePoints(firstPoint, secondPoint);
}
示例8: getAxis
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private Geometry getAxis(String name, Vector3f endPoint, ColorRGBA color, AssetManager assetManager) {
Line axis = new Line(new Vector3f(0, 0, 0), endPoint);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
Geometry geom = new Geometry(name, axis);
geom.setMaterial(mat);
return geom;
}
示例9: LineElement
import com.jme3.scene.shape.Line; //导入依赖的package包/类
public LineElement(BaseScreen screen, Vector2f p1, Vector2f p2, ColorRGBA color, float lineWidth) {
super(screen, p1, new Size(p2.subtract(p1)));
Line l1 = new Line(new Vector3f(0, 0, 0), new Vector3f(p2.x - p1.x, p2.y - p1.y, 0));
l1.setLineWidth(lineWidth);
Geometry geom = new Geometry("A shape", l1);
meshMaterial.setColor("Color", color);
geom.setMaterial(meshMaterial);
attachChild(geom);
}
示例10: addLineAndText
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private void addLineAndText() {
line = new Geometry("line", new Line(Vector3f.ZERO, Vector3f.ZERO));
Material m = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
m.setColor("Color", ColorRGBA.White);
line.setMaterial(m);
angleText = new BitmapText(manager.loadFont("Interface/Fonts/Default.fnt"));
BillboardControl control = new BillboardControl();
angleText.addControl(control);
angleText.setSize(0.5f);
angleText.setCullHint(Spatial.CullHint.Never);
}
示例11: doCreateSpatial
import com.jme3.scene.shape.Line; //导入依赖的package包/类
@Override
protected Spatial doCreateSpatial(Node parent) {
NewGeometrySettings cfg = new NewGeometrySettings();
Line b = new Line(cfg.getLineStart(), cfg.getLineEnd());
b.setMode(cfg.getLineMode());
Geometry geom = new Geometry(cfg.getLineName(), 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;
}
示例12: makeUnshadedLine
import com.jme3.scene.shape.Line; //导入依赖的package包/类
public Geometry makeUnshadedLine(String name, Vector3f start, Vector3f end, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
Geometry line = new Geometry(name, new Line(start, end));
line.setMaterial(mat);
line.setUserData("obj_shape", "line");
line.setUserData("obj_start", start);
line.setUserData("obj_end", end);
line.setUserData("obj_color", color);
return line;
}
示例13: createLine
import com.jme3.scene.shape.Line; //导入依赖的package包/类
public static Geometry createLine(Vector3f start, Vector3f end, ColorRGBA color) {
Geometry g = new Geometry("wireframe cube", new Line(start, end));
Material mat = new Material(LuoYing.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
g.setMaterial(mat);
return g;
}
示例14: createLine
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private Spatial createLine() {
Geometry geo = new Geometry("line", new Line(new Vector3f(), new Vector3f(0, 0, 1f)));
Material mat = MaterialUtils.createUnshaded(ColorRGBA.Black);
geo.setMaterial(mat);
geo.setLocalScale(1000);
return geo;
}
示例15: createLine
import com.jme3.scene.shape.Line; //导入依赖的package包/类
private Geometry createLine() {
Geometry lineGeo = new Geometry("line", new Line(Vector3f.ZERO, Vector3f.ZERO));
Material m = new Material(editor.getAssetManager(), AssetConstants.MATERIAL_UNSHADED);
m.setColor("Color", ColorRGBA.White);
lineGeo.setMaterial(m);
return lineGeo;
}