本文整理汇总了Java中com.jme3.scene.control.BillboardControl类的典型用法代码示例。如果您正苦于以下问题:Java BillboardControl类的具体用法?Java BillboardControl怎么用?Java BillboardControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BillboardControl类属于com.jme3.scene.control包,在下文中一共展示了BillboardControl类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializePlayer
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private void initializePlayer() {
// create a robot for the player
player = createRobot("player");
player.setUserData("health", 100f);
// add simple healthbar
BillboardControl billboard = new BillboardControl();
Geometry healthbar = new Geometry("healthbar", new Quad(4f, 0.2f));
Material mathb = mat.clone();
mathb.setColor("Color", ColorRGBA.Red);
healthbar.setMaterial(mathb);
player.attachChild(healthbar);
healthbar.center();
healthbar.move(4, 1, -4);
healthbar.addControl(billboard);
// put player in center
player.move(-2, 0, 0);
player.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
// add player to scene
rootNode.attachChild(player);
}
示例2: createPointGizmo
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private static Node createPointGizmo(AssetManager assetManager, JmePointLight jmeLight, Light light) {
PointLightGizmo gizmo = new PointLightGizmo(jmeLight);
gizmo.addControl(new LightPositionUpdate(light, gizmo));
Node billboardNode = new Node("billboard lightGizmo");
billboardNode.addControl(new BillboardControl());
gizmo.attachChild(billboardNode);
billboardNode.attachChild(createLightBulb(assetManager));
Geometry radius = RadiusShape.createShape(assetManager, "radius shape");
radius.addControl(new LightRadiusUpdate((PointLight) light));
radius.addControl(new LightColorUpdate(light, radius.getMaterial(), "Color"));
billboardNode.attachChild(radius);
return gizmo;
}
示例3: createDirectionalGizmo
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private static Node createDirectionalGizmo(AssetManager assetManager, JmeDirectionalLight jmeLight, Light light) {
DirectionalLightGizmo gizmo = new DirectionalLightGizmo(jmeLight);
gizmo.move(0, 5, 0);
gizmo.addControl(new LightDirectionUpdate(light, gizmo));
Node billboardNode = new Node("billboard lightGizmo");
billboardNode.addControl(new BillboardControl());
billboardNode.attachChild(createLightBulb(assetManager));
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.White);
mat.getAdditionalRenderState().setLineWidth(2f);
Geometry arrow = new Geometry("direction arrow", new Arrow(((DirectionalLight) light).getDirection().mult(5f)));
arrow.setMaterial(mat);
arrow.addControl(new LightColorUpdate(light, arrow.getMaterial(), "Color"));
gizmo.attachChild(arrow);
gizmo.attachChild(billboardNode);
jmeLight.setGizmo(gizmo);
return gizmo;
}
示例4: createShape
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
/**
* Convenience factory method that creates a debuging bounding sphere geometry
* @param assetManager the assetManager
* @return the bounding sphere debug geometry.
*/
public static Geometry createShape(AssetManager assetManager) {
ProbeRadiusShape b = new ProbeRadiusShape();
Geometry geom = new Geometry("BoundingDebug", b);
Material mat = new Material(assetManager, "com/jme3/gde/scenecomposer/gizmo/light/mat/dashed/dashed.j3md");
mat.getAdditionalRenderState().setWireframe(true);
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
mat.getAdditionalRenderState().setDepthWrite(false);
mat.getAdditionalRenderState().setDepthTest(false);
mat.setFloat("DashSize", 0.5f);
geom.setQueueBucket(RenderQueue.Bucket.Transparent);
geom.addControl(new BillboardControl());
geom.setMaterial(mat);
return geom;
}
示例5: createSunFlag
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private Spatial createSunFlag(String icon) {
Material mat = MaterialUtils.createUnshaded();
mat.setTexture("ColorMap", Jfx.getJmeApp().getAssetManager().loadTexture(icon));
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
Geometry flagObj = new Geometry("DirectionalLightEntitySelectObj", new QuadXYC(1, 1));
flagObj.setMaterial(mat);
flagObj.setQueueBucket(RenderQueue.Bucket.Translucent);
// 让flag始终朝向镜头
BillboardControl bc = new BillboardControl();
bc.setAlignment(BillboardControl.Alignment.Screen);
flagObj.addControl(bc);
return flagObj;
}
示例6: initializeEnemy
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private void initializeEnemy() {
// create a robot for the enemy
enemy = createRobot("enemy");
enemy.setUserData("health", 100f);
// add simple healthbar
BillboardControl billboard = new BillboardControl();
Geometry healthbar = new Geometry("healthbar", new Quad(4f, 0.2f));
Material mathb = mat.clone();
mathb.setColor("Color", ColorRGBA.Red);
healthbar.setMaterial(mathb);
enemy.attachChild(healthbar);
healthbar.center();
healthbar.move(0, 7, 2);
healthbar.addControl(billboard);
// put enemy in a corner
enemy.move(floorsize * 2 - 5, 0, floorsize * 2 - 5);
// let enemy look at center
enemy.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
// add enemy to scene
rootNode.attachChild(enemy);
}
示例7: addToCharacter
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
public void addToCharacter(BuffInfoParameters params) {
Quad blanket = new Quad(8, 8, true);
fearIcon = new Geometry("fear-icon", blanket);
fearIcon.scale(1f);
Material mat = assets.loadMaterial("Materials/FearMaterial.j3m");
fearIcon.setMaterial(mat);
fearIcon.setQueueBucket(RenderQueue.Bucket.Transparent);
Node characterNode = (Node) params.buffControl.getSpatial();
characterNode.attachChild(fearIcon);
fearIcon.center();
fearIcon.setLocalTranslation(0f, 22f, 0f);
BillboardControl billBoard = new BillboardControl();
fearIcon.addControl(billBoard);
}
示例8: addLineAndText
import com.jme3.scene.control.BillboardControl; //导入依赖的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);
}
示例9: createAngleText
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private BitmapText createAngleText() {
BitmapText label = new BitmapText(editor.getAssetManager().loadFont(AssetConstants.INTERFACE_FONTS_DEFAULT));
BillboardControl control = new BillboardControl();
label.addControl(control);
label.setSize(0.5f);
label.setCullHint(Spatial.CullHint.Never);
AutoScaleControl asc = new AutoScaleControl(0.03f);
label.addControl(asc);
return label;
}
示例10: createBillboard
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
public void createBillboard(AssetManager manager) {
// Set position above model
// Load font and create the Text
BitmapFont font = manager.loadFont("Interface/Fonts/Default.fnt");
BitmapText bmText = new BitmapText(font);
bmText.setSize(0.25f);
bmText.setText(actorName);
bmText.setQueueBucket(Bucket.Transparent);
bmText.setColor(ColorRGBA.Orange);
bmText.setBox(new Rectangle(-bmText.getLineWidth() / 2.0f - 0.2f, 0, bmText.getLineWidth() * 2.0f, bmText.getLineHeight() + 0.1f));
bmText.setAlignment(BitmapFont.Align.Left);
bmText.setLineWrapMode(LineWrapMode.NoWrap);
Vector3f newPos = new Vector3f(0, 2.5f, 0);
// Create node and add a BillboardControl so it rotates with the cam
BillboardControl bbControl = new BillboardControl();
bbControl.setAlignment(BillboardControl.Alignment.Screen);
Node textNode = new Node("Node for text");
textNode.setLocalTranslation(newPos);
textNode.setCullHint(CullHint.Never);
textNode.attachChild(bmText);
bmText.addControl(bbControl);
//Vector3f world = textNode.getWorldTranslation();
this.attachChild(textNode);
//System.out.println("Text node location for " + actorName + "," +world);
}
示例11: spawnEvent
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
void spawnEvent(InputEvent evt) {
addInfo(InputMapperHelpers.toString(evt, false));
Quad q = new Quad(0.5f, 0.5f);
Geometry g = new Geometry("Quad", q);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
//mat.setColor("Color", ColorRGBA.Blue);
String path = inputTextureFinders.findPath(evt);
mat.setTexture("ColorMap", app.getAssetManager().loadTexture(path));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
g.setQueueBucket(Bucket.Transparent);
g.setMaterial(mat);
BillboardControl billboard = new BillboardControl();
g.addControl(billboard);
spawnEventCnt++;
Animation anim = new Animation("goUp", 6.0f);
anim.addTrack(new TranslationTrack(new Vector3f((spawnEventCnt % 10) - 5f,10f,0f), 5.0f));
anim.addTrack(new RemoveTrack(5.0f));
AnimControl ac = new AnimControl();
ac.addAnim(anim);
g.addControl(ac);
g.setLocalTranslation(scene.getChild("player").getWorldTranslation());
app.enqueue(()-> {
scene.attachChild(g);
AnimChannel c = ac.createChannel();
c.setLoopMode(LoopMode.DontLoop);
c.setAnim("goUp");
return true;
});
}
示例12: simpleInitApp
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
public void simpleInitApp() {
flyCam.setMoveSpeed(10);
Quad q = new Quad(2, 2);
Geometry g = new Geometry("Quad", q);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
g.setMaterial(mat);
Quad q2 = new Quad(1, 1);
Geometry g3 = new Geometry("Quad2", q2);
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat2.setColor("Color", ColorRGBA.Yellow);
g3.setMaterial(mat2);
g3.setLocalTranslation(.5f, .5f, .01f);
Box b = new Box(new Vector3f(0, 0, 3), .25f, .5f, .25f);
Geometry g2 = new Geometry("Box", b);
g2.setMaterial(mat);
Node bb = new Node("billboard");
BillboardControl control=new BillboardControl();
bb.addControl(control);
bb.attachChild(g);
bb.attachChild(g3);
n=new Node("parent");
n.attachChild(g2);
n.attachChild(bb);
rootNode.attachChild(n);
n2=new Node("parentParent");
n2.setLocalTranslation(Vector3f.UNIT_X.mult(5));
n2.attachChild(n);
rootNode.attachChild(n2);
// rootNode.attachChild(bb);
// rootNode.attachChild(g2);
}
示例13: createSpotGizmo
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
private static Node createSpotGizmo(AssetManager assetManager, JmeSpotLight jmeLight, Light light) {
SpotLightGizmo gizmo = new SpotLightGizmo(jmeLight);
gizmo.addControl(new LightDirectionUpdate(light, gizmo));
gizmo.addControl(new LightPositionUpdate(light, gizmo));
Node billboardNode = new Node("billboard lightGizmo");
gizmo.attachChild(billboardNode);
billboardNode.addControl(new BillboardControl());
billboardNode.attachChild(createLightBulb(assetManager));
Node radiusNode = new Node("radius Node");
gizmo.attachChild(radiusNode);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.White);
mat.getAdditionalRenderState().setLineWidth(1f);
Geometry arrow = new Geometry("direction arrow", new Arrow(Vector3f.UNIT_Y.mult(1f)));
arrow.setMaterial(mat);
arrow.addControl(new LightColorUpdate(light, arrow.getMaterial(), "Color"));
gizmo.attachChild(arrow);
Geometry inRadius = RadiusShape.createShape(assetManager, "inner radius shape");
inRadius.rotate(pitch90);
inRadius.addControl(new LightColorUpdate(light, inRadius.getMaterial(), "Color"));
inRadius.getMaterial().setFloat("DashSize", 0.875f);
radiusNode.attachChild(inRadius);
Geometry outRadius = RadiusShape.createShape(assetManager, "outer radius shape");
outRadius.addControl(new LightColorUpdate(light, outRadius.getMaterial(), "Color"));
outRadius.getMaterial().setFloat("DashSize", 0.125f);
radiusNode.attachChild(outRadius);
outRadius.rotate(pitch90);
Geometry cone = new Geometry("cone shape", new Triangle(1f, -1f));
cone.setMaterial(mat);
BillboardControl bc = new BillboardControl();
bc.setAlignment(BillboardControl.Alignment.AxialY);
cone.addControl(bc);
cone.addControl(new LightColorUpdate(light, outRadius.getMaterial(), "Color"));
cone.addControl(new LightConeRadiusUpdate((SpotLight) light, inRadius, outRadius));
radiusNode.attachChild(cone);
radiusNode.addControl(new LightRangeUpdate((SpotLight) light, arrow));
return gizmo;
}
示例14: setBonePositionVisible
import com.jme3.scene.control.BillboardControl; //导入依赖的package包/类
public void setBonePositionVisible(boolean bonePositionVisible) {
if (bonePositionVisible) {
if (bonePositionNode == null) {
bonePositionNode = new Node("bonePositionNode");
bonePositionGeomArray = new Geometry[pmdModel.getBoneList().getBoneCount()];
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Red);
mat.getAdditionalRenderState().setDepthTest(false);
mat.getAdditionalRenderState().setDepthWrite(false);
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat2.setColor("Color", ColorRGBA.Blue);
mat2.getAdditionalRenderState().setDepthTest(false);
mat2.getAdditionalRenderState().setDepthWrite(false);
Material mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat3.setColor("Color", ColorRGBA.Green);
mat3.getAdditionalRenderState().setDepthTest(false);
mat3.getAdditionalRenderState().setDepthWrite(false);
for (int i = 0; i < bonePositionGeomArray.length; i++) {
Mesh mesh = new Mesh();
// mesh.setMode(Mesh.Mode.Points);
// VertexBuffer pb = new VertexBuffer(Type.Position);
// FloatBuffer fpb = BufferUtils.createFloatBuffer(3);
// fpb.put(0f).put(0f).put(0f);
// pb.setupData(Usage.Static, 3, Format.Float, fpb);
// mesh.setBuffer(pb);
// mesh.setPointSize(7);
// mesh.updateCounts();
Geometry geom = new Geometry(pmdModel.getBoneList().getBones()[i].getBoneName(), new Box(0.1f, 0.1f, 0.0f));
geom.setMaterial(mat);
geom.setQueueBucket(Bucket.Transparent);
bonePositionGeomArray[i] = geom;
bonePositionNode.attachChild(geom);
geom.addControl(new BillboardControl());
if (pmdModel.getBoneList().getBones()[i].getBoneType() == 2) {
geom.setMaterial(mat2);
}
if (pmdModel.getBoneList().getBones()[i].getBoneType() == 6) {
geom.setMaterial(mat3);
}
}
attachChild(bonePositionNode);
}
} else {
if (bonePositionNode != null) {
bonePositionNode.removeFromParent();
bonePositionNode = null;
bonePositionGeomArray = null;
}
}
setUpdateNeeded(true);
this.bonePositionVisible = bonePositionVisible;
}