本文整理汇总了Java中com.jme3.scene.debug.WireBox类的典型用法代码示例。如果您正苦于以下问题:Java WireBox类的具体用法?Java WireBox怎么用?Java WireBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WireBox类属于com.jme3.scene.debug包,在下文中一共展示了WireBox类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:dwhuang,项目名称:SMILE,代码行数:18,代码来源:Factory.java
示例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;
}
});
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:24,代码来源:SpatialViewer.java
示例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;
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:19,代码来源:SceneToolController.java
示例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);
}
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:TerrainQuad.java
示例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);
}
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:Octnode.java
示例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;
}
});
}
}
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:31,代码来源:SceneToolController.java
示例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;
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:17,代码来源:DebugUtils.java
示例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);
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:16,代码来源:DragAndDropDemoState.java
示例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);
}
开发者ID:jMonkeyEngine,项目名称:examplegame-skulls,代码行数:10,代码来源:EditScreen.java
示例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();
}
}
开发者ID:samynk,项目名称:DArtE,代码行数:28,代码来源:SandboxViewport.java
示例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);
}
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:TestDebugShapes.java
示例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);
}
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:Octree.java
示例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");
}
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:42,代码来源:SpatialViewer.java
示例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);
}
开发者ID:jMonkeyEngine,项目名称:examplegame-skulls,代码行数:46,代码来源:PlayScreen.java
示例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);
}
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:49,代码来源:DrawCollisionBox.java
示例16: createPlaneControllers
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
private void createPlaneControllers(AssetManager assetManager, float size, float axisRadius, Material planeMaterial) {
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.getAdditionalRenderState().setDepthTest(false);
mat.setColor("Color", ColorRGBA.Orange);
Box xyBox = new Box(size, size, 0.01f);
xyGeometry = new Geometry("translate_XY", xyBox);
xyGeometry.setMaterial(planeMaterial);
xyGeometry.setLocalTranslation(size + axisRadius, size + axisRadius, 0);
this.attachChild(xyGeometry);
xyGeometry.setUserData("Transform", "translate_XY");
Geometry g = new Geometry("wireframe_xy", new WireBox(size, size, 0.01f));
g.setMaterial(mat);
g.setLocalTranslation(size + axisRadius, size + axisRadius, 0);
this.attachChild(g);
xyGeometry.setQueueBucket(Bucket.Inherit);
g.setQueueBucket(Bucket.Inherit);
Box xzBox = new Box(size, 0.01f, size);
xzGeometry = new Geometry("translate_XZ", xzBox);
xzGeometry.setMaterial(planeMaterial);
xzGeometry.move(size + axisRadius, 0, size + axisRadius);
this.attachChild(xzGeometry);
xzGeometry.setUserData("Transform", "translate_XZ");
Geometry g2 = new Geometry("wireframe_xz", new WireBox(size, 0.01f, size));
g2.setMaterial(mat);
g2.setLocalTranslation(size + axisRadius, 0, size + axisRadius);
this.attachChild(g2);
xzGeometry.setQueueBucket(Bucket.Inherit);
g2.setQueueBucket(Bucket.Inherit);
Box yzBox = new Box(0.01f, size, size);
yzGeometry = new Geometry("translate_YZ", yzBox);
yzGeometry.setMaterial(planeMaterial);
yzGeometry.move(0, size + axisRadius, size + axisRadius);
this.attachChild(yzGeometry);
yzGeometry.setUserData("Transform", "translate_YZ");
Geometry g3 = new Geometry("wireframe_yz", new WireBox(0.01f, size, size));
g3.setMaterial(mat);
g3.setLocalTranslation(0, size + axisRadius, size + axisRadius);
this.attachChild(g3);
yzGeometry.setQueueBucket(Bucket.Inherit);
g3.setQueueBucket(Bucket.Inherit);
}
开发者ID:samynk,项目名称:DArtE,代码行数:53,代码来源:Axis.java
示例17: doLink
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
private Vector3f doLink(SandboxViewport viewport) {
CollisionResults results = new CollisionResults();
// Convert screen click to 3d position
InputManager inputManager = viewport.getInputManager();
Vector2f click2d = inputManager.getCursorPosition();
Camera cam = viewport.getCamera();
Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d);
// Aim the ray from the clicked spot forwards.
Ray ray = new Ray(click3d, dir);
// Collect intersections between ray and all nodes in results list.
Node sceneElements = viewport.getSceneElements();
sceneElements.collideWith(ray, results);
CollisionResult result = results.getClosestCollision();
if (result == null) {
return cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0.5f).clone();
}
Geometry g = result.getGeometry();
Prefab prefab = viewport.findPrefabParent(g);
if (prefab != null) {
prefab.updateModelBound();
BoundingVolume bv = prefab.getWorldBound();
if (bv.getType() == Type.AABB) {
BoundingBox bb = (BoundingBox) bv;
if (wireBoxGeometryLinkParent != null) {
wireBoxGeometryLinkParent.removeFromParent();
}
wireBoxGeometryLinkParent = WireBox.makeGeometry(bb);
wireBoxGeometryLinkParent.setMaterial(wireBoxMaterial);
wireBoxGeometryLinkParent.setLocalTranslation(bb.getCenter().clone());
if (wireBoxGeometryLinkParent.getParent() == null) {
viewport.getRootNode().attachChild(wireBoxGeometryLinkParent);
}
}
String sLinkText = currentChildElement.getName() + "->" + prefab.getName();
linkText.setText(sLinkText);
linkText.setLocalTranslation(click2d.x, click2d.y, .2f);
//linkText.updateModelBound();
//System.out.println("Setting linkText on : " + click2d );
textBackground.setDimension(linkText.getLineWidth() + 2, linkText.getLineHeight() + 4);
textBackgroundGeometry.updateModelBound();
textBackgroundGeometry.setLocalTranslation(click2d.x - 1, click2d.y - linkText.getLineHeight() - 2, .1f);
return result.getContactPoint();
} else {
wireBoxGeometryLinkParent.removeFromParent();
return result.getContactPoint();
}
}
开发者ID:samynk,项目名称:DArtE,代码行数:57,代码来源:LinkTool.java
示例18: doPickText
import com.jme3.scene.debug.WireBox; //导入依赖的package包/类
private void doPickText() {
CollisionResults results = new CollisionResults();
// Convert screen click to 3d position
Vector2f click2d = viewport.getInputManager().getCursorPosition();
Camera cam = viewport.getCamera();
Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d);
// Aim the ray from the clicked spot forwards.
Ray ray = new Ray(click3d, dir);
// Collect intersections between ray and all nodes in results list.
Node sceneElements = viewport.getSceneElements();
sceneElements.collideWith(ray, results);
CollisionResult result = results.getClosestCollision();
if (result == null) {
linkText.setText("");
textBackground.setDimension(0, 0);
textBackgroundGeometry.updateModelBound();
return;
}
Geometry g = result.getGeometry();
Prefab prefab = viewport.findPrefabParent(g);
if (prefab != null) {
prefab.updateModelBound();
BoundingVolume bv = prefab.getWorldBound();
if (bv.getType() == BoundingVolume.Type.AABB) {
BoundingBox bb = (BoundingBox) bv;
if ( wireBoxGeometryLinkParent != null ){
wireBoxGeometryLinkParent.removeFromParent();
}
wireBoxGeometryLinkParent = WireBox.makeGeometry(bb);
wireBoxGeometryLinkParent.setMaterial(wireBoxMaterial);
wireBoxGeometryLinkParent.setLocalTranslation(bb.getCenter().clone());
if (wireBoxGeometryLinkParent.getParent() == null) {
viewport.getRootNode().attachChild(wireBoxGeometryLinkParent);
}
}
linkText.setText(prefab.getName());
linkText.setLocalTranslation(click2d.x, click2d.y, 0.01f);
textBackground.setDimension(linkText.getLineWidth() + 2, linkText.getLineHeight() + 4);
textBackgroundGeometry.updateModelBound();
textBackgroundGeometry.setLocalTranslation(click2d.x - 1, click2d.y - linkText.getLineHeight() - 2, 0f);
} else {
linkText.setText("");
textBackground.setDimension(0, 0);
textBackgroundGeometry.updateModelBound();
wireBoxGeometryLinkParent.removeFromParent();
}
}
开发者ID:samynk,项目名称:DArtE,代码行数:54,代码来源:PickTool.java
注:本文中的com.jme3.scene.debug.WireBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论