本文整理汇总了Java中com.jme3.scene.debug.WireBox类的典型用法代码示例。如果您正苦于以下问题:Java WireBox类的具体用法?Java WireBox怎么用?Java WireBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WireBox类属于com.jme3.scene.debug包,在下文中一共展示了WireBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeUnshadedWireBox
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public Geometry makeUnshadedWireBox(String name, Vector3f extents, float lineWidth, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
WireBox box = new WireBox(extents.x, extents.y, extents.z);
box.setLineWidth(lineWidth);
Geometry g = new Geometry(name, box);
g.setMaterial(mat);
g.setUserData("obj_shape", "wireBox");
g.setUserData("obj_extents", extents);
g.setUserData("obj_lineWidth", lineWidth);
g.setUserData("obj_color", color);
return g;
}
示例2: setSpatial
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public void setSpatial(final Spatial geom) {
LOG.info("show spatial " + geom);
LOG.info("vertex count: " + geom.getVertexCount());
LOG.info("triangle count: " + geom.getTriangleCount());
LOG.info("bounding volume: " + geom.getWorldBound());
enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
if (spatial != null) {
rootNode.detachChild(spatial);
}
geom.rotate(-FastMath.HALF_PI, 0, 0);
BoundingBox b = (BoundingBox) geom.getWorldBound();
bounds.setMesh(new WireBox(b.getXExtent(), b.getYExtent(), b.getZExtent()));
bounds.setLocalTranslation(b.getCenter());
spatial = geom;
rootNode.attachChild(spatial);
LOG.info("attached");
return null;
}
});
}
示例3: attachBoxSelection
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
protected void attachBoxSelection(Spatial geom) {
BoundingVolume bound = geom.getWorldBound();
if (bound instanceof BoundingBox) {
BoundingBox bbox = (BoundingBox) bound;
Vector3f extent = new Vector3f();
bbox.getExtent(extent);
WireBox wireBox = new WireBox();
wireBox.fromBoundingBox(bbox);
selctionShapeOffset.set(bbox.getCenter()).subtractLocal(geom.getWorldTranslation());
Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", wireBox);
selectionGeometry.setMaterial(blueMat);
selectionGeometry.setLocalTransform(geom.getWorldTransform());
selectionGeometry.setLocalTranslation(bbox.getCenter());
toolsNode.attachChild(selectionGeometry);
selectionShape = selectionGeometry;
}
}
示例4: attachBoundingBox
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
/**
* used by attachBoundChildren()
*/
private void attachBoundingBox(BoundingBox bb, Node parent) {
WireBox wb = new WireBox(bb.getXExtent(), bb.getYExtent(), bb.getZExtent());
Geometry g = new Geometry();
g.setMesh(wb);
g.setLocalTranslation(bb.getCenter());
parent.attachChild(g);
}
示例5: renderBounds
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public void renderBounds(RenderQueue rq, Matrix4f transform, WireBox box, Material mat){
int numChilds = 0;
for (int i = 0; i < 8; i++){
if (children[i] != null){
numChilds ++;
break;
}
}
if (geoms != null && numChilds == 0){
BoundingBox bbox2 = new BoundingBox(bbox);
bbox.transform(transform, bbox2);
// WireBox box = new WireBox(bbox2.getXExtent(), bbox2.getYExtent(),
// bbox2.getZExtent());
// WireBox box = new WireBox(1,1,1);
Geometry geom = new Geometry("bound", box);
geom.setLocalTranslation(bbox2.getCenter());
geom.setLocalScale(bbox2.getXExtent(), bbox2.getYExtent(),
bbox2.getZExtent());
geom.updateGeometricState();
geom.setMaterial(mat);
rq.addToQueue(geom, Bucket.Opaque);
box = null;
geom = null;
}
for (int i = 0; i < 8; i++){
if (children[i] != null){
children[i].renderBounds(rq, transform, box, mat);
}
}
}
示例6: attachBoxSelection
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
protected void attachBoxSelection(Spatial geom) {
BoundingVolume bound = geom.getWorldBound();
if (bound instanceof BoundingBox) {
BoundingBox bbox = (BoundingBox) bound;
Vector3f extent = new Vector3f();
bbox.getExtent(extent);
final Geometry selectionGeometry = WireBox.makeGeometry(bbox);
selectionGeometry.setName("selection_geometry_sceneviewer");
selectionGeometry.setMaterial(blueMat);
selectionGeometry.setLocalTranslation(bbox.getCenter().subtract(geom.getWorldTranslation()));
//Vector3f scale = new Vector3f(1,1,1);
//scale.x = 1/geom.getWorldScale().x;
//scale.y = 1/geom.getWorldScale().y;
//scale.z = 1/geom.getWorldScale().z;
selectionShape = new Node("SelectionParent");
((Node) selectionShape).attachChild(selectionGeometry);
//selectionShape.setLocalTransform(geom.getWorldTransform());
//selectionShape.setLocalTranslation(geom.getWorldTranslation());
//selectionGeometry.setLocalScale(scale);
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
toolsNode.attachChild(selectionShape);
return null;
}
});
}
}
示例7: createWireBox
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
/**
* Wireframe Cube
* @param xExt
* @param yExt
* @param zExt
* @param color
* @return
*/
public static Geometry createWireBox(float xExt, float yExt, float zExt, ColorRGBA color) {
Geometry g = new Geometry("wireframe cube", new WireBox(xExt, yExt, zExt));
Material mat = new Material(LuoYing.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", color);
g.setMaterial(mat);
return g;
}
示例8: ContainerNode
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public ContainerNode( String name, ColorRGBA color ) {
super(name);
material = GuiGlobals.getInstance().createMaterial(containerColor, false);
wire = new WireBox(1, 1, 1);
wireGeom = new Geometry(name + ".wire", wire);
wireGeom.setMaterial(material.getMaterial());
attachChild(wireGeom);
box = new Box(1, 1, 1);
boxGeom = new Geometry(name + ".box", box);
boxGeom.setMaterial(material.getMaterial()); // might as well reuse it
boxGeom.setCullHint(CullHint.Always); // invisible
attachChild(boxGeom);
}
示例9: initMarker
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
protected void initMarker() {
Material mat = baseApplication.getAssetManager().loadMaterial("Common/Materials/RedColor.j3m");
WireBox box = new WireBox(Game.TILE_SIZE * 0.5f, 0.1f, Game.TILE_SIZE * 0.5f);
box.setLineWidth(3);
Geometry g = new Geometry(BLANK, box);
g.setMaterial(mat);
marker = g;
rootNode.attachChild(marker);
}
示例10: adaptSelectionBox
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public void adaptSelectionBox() {
BoundingVolume bv = null;
for (Node n : this.currentSelection) {
if (n == null) {
continue;
}
if (bv == null) {
bv = n.getWorldBound();
} else {
bv.merge(n.getWorldBound());
}
}
if (bv != null && bv.getType() == Type.AABB) {
BoundingBox bb = (BoundingBox) bv;
if (wireBoxGeometry != null) {
wireBoxGeometry.removeFromParent();
}
wireBoxGeometry = WireBox.makeGeometry(bb);
wireBoxGeometry.setLocalTranslation(bb.getCenter());
wireBoxGeometry.setMaterial(wireBoxMaterial);
if (wireBoxGeometry.getParent() == null) {
this.rootNode.attachChild(wireBoxGeometry);
}
} else if (wireBoxGeometry != null) {
wireBoxGeometry.removeFromParent();
}
}
示例11: putBox
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public void putBox(Vector3f pos, float size, ColorRGBA color){
putShape(new WireBox(size, size, size), color).setLocalTranslation(pos);
}
示例12: renderBounds
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
public void renderBounds(RenderQueue rq, Matrix4f transform, WireBox box, Material mat){
root.renderBounds(rq, transform, box, mat);
}
示例13: simpleInitApp
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
@Override
public void simpleInitApp() {
center = createBox(0, 0, 0, ColorRGBA.Blue);
attachCoordinateAxes(Vector3f.ZERO);
flyCam.setDragToRotate(true);
// flyCam.setEnabled(false);
// chaseCam = new ChaseCamera(cam, center, inputManager);
light = new PointLight();
light.setColor(ColorRGBA.White);
light.setPosition(new Vector3f(0, 6, -6));
rootNode.addLight(light);
AmbientLight am = new AmbientLight();
am.setColor(ColorRGBA.White.mult(0.5f));
rootNode.addLight(am);
bounds = new Geometry("bounds", new WireBox(0, 0, 0));
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Gray);
bounds.setMaterial(mat);
rootNode.attachChild(bounds);
wireProcessor = new WireProcessor(assetManager);
inputManager.addMapping("Wireframes", new KeyTrigger(KeyInput.KEY_RETURN));
inputManager.addListener(new ActionListener() {
@Override
public void onAction(String name, boolean isPressed, float tpf) {
if ("Wireframes".equals(name) && isPressed) {
wireframes = !wireframes;
if (wireframes) {
viewPort.addProcessor(wireProcessor);
} else {
viewPort.removeProcessor(wireProcessor);
}
}
}
}, "Wireframes");
}
示例14: load
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
@Override
protected void load() {
/*
* The load method is called very first when ever the user calls to go to this screen.
* A black panel will by default be shown over the screen
* One must normally load the level and player and inputs and camera stuff here.
*/
game = new Game(baseApplication, rootNode);
if (test) {
game.test("skulls.properties");
} else {
game.play("level1.properties");
}
game.load();
player = new Player(game);
player.load();
game.addGameListener(this);
//Load the camera
loadCameraSettings();
//Load the inputs
//Init the picker listener
touchPickListener = new TouchPickListener(baseApplication.getCamera(), rootNode);
touchPickListener.setPickListener(this);
touchPickListener.registerWithInput(inputManager);
//Hide dialogs
scoreDialog.setScore(0);
scoreDialog.setEnemyCount(0);
scoreDialog.hide();
//create a market geometry
WireBox wb = new WireBox(Game.TILE_SIZE * 0.5f, 0.02f, Game.TILE_SIZE * 0.5f);
wb.setLineWidth(2);
marker = new Geometry("MARKER", wb);
marker.setMaterial(baseApplication.getAssetManager().loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(marker);
cameraShaker = new CameraShaker(camera, rootNode);
}
示例15: simpleInitApp
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
Material mat_box = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_box.setColor("Color", ColorRGBA.Blue);
Material mat_wire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_wire.setColor("Color", ColorRGBA.Cyan);
mat_wire.getAdditionalRenderState().setWireframe(true);
Mesh sphr = new Sphere(10, 10, 1f);
Mesh cyl = new Cylinder(10,10,1,1,true);
Mesh bxWire = new Box(1,1,1);
geom = new Geometry("Sphere", sphr);
geom.scale(2,1,1); //check if scale works with bx correctly
wbx = new WireBox();
wbx.fromBoundingBox((BoundingBox) geom.getWorldBound());
bx = new Geometry("TheMesh", wbx);
bx.setMaterial(mat_box);
rootNode.attachChild(bx);
geom.setMaterial(mat);
rootNode.attachChild(geom);
geom2 = new Geometry("Boxxx", cyl);
geom2.setMaterial(mat);
geom2.setLocalTranslation(5, 0, 0);
geom2.setLocalScale(2, 1, 1);
rootNode.attachChild(geom2);
bx2 = new Geometry("TheMesh", sphr);
bx2.setMaterial(mat_wire);
rootNode.attachChild(bx2);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.63f, -0.463f, -0.623f).normalizeLocal());
dl.setColor(new ColorRGBA(1,1,1,1));
rootNode.addLight(dl);
viewPort.setBackgroundColor(ColorRGBA.Gray);
flyCam.setMoveSpeed(30);
}