本文整理汇总了Java中com.jme3.scene.shape.Quad类的典型用法代码示例。如果您正苦于以下问题:Java Quad类的具体用法?Java Quad怎么用?Java Quad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Quad类属于com.jme3.scene.shape包,在下文中一共展示了Quad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BaseMaterialEditor3DState
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public BaseMaterialEditor3DState(@NotNull final T fileEditor) {
super(fileEditor);
this.testBox = new Geometry("Box", new Box(2, 2, 2));
this.testSphere = new Geometry("Sphere", new Sphere(30, 30, 2));
this.testQuad = new Geometry("Quad", new Quad(4, 4));
this.testQuad.setLocalTranslation(QUAD_OFFSET);
this.lightEnabled = MaterialFileEditor.DEFAULT_LIGHT_ENABLED;
TangentGenerator.useMikktspaceGenerator(testBox);
TangentGenerator.useMikktspaceGenerator(testSphere);
TangentGenerator.useMikktspaceGenerator(testQuad);
final DirectionalLight light = notNull(getLightForCamera());
light.setDirection(LIGHT_DIRECTION);
final EditorCamera editorCamera = notNull(getEditorCamera());
editorCamera.setDefaultHorizontalRotation(H_ROTATION);
editorCamera.setDefaultVerticalRotation(V_ROTATION);
getModelNode().attachChild(getNodeForCamera());
}
示例2: createCollisionPlane
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
/**
* Create collision plane.
*/
@FromAnyThread
private void createCollisionPlane() {
final AssetManager assetManager = EDITOR.getAssetManager();
final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
final RenderState renderState = material.getAdditionalRenderState();
renderState.setFaceCullMode(RenderState.FaceCullMode.Off);
renderState.setWireframe(true);
final float size = 20000;
final Geometry geometry = new Geometry("plane", new Quad(size, size));
geometry.setMaterial(material);
geometry.setLocalTranslation(-size / 2, -size / 2, 0);
collisionPlane = new Node();
collisionPlane.attachChild(geometry);
}
示例3: getCockpit
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public Geometry getCockpit() {
Quad reticle = new Quad(
0.03f, 0.03f);
Geometry geom = new Geometry("reticle", reticle); // wrap shape into geometry
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create material
mat.setColor("Color", ColorRGBA.White);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
mat.setTexture("ColorMap", assetManager.loadTexture(
"Textures/circle-01.png"));
geom.setMaterial(mat);
geom.setQueueBucket(Bucket.Translucent);
geom.rotate(0, FastMath.PI, 0);
geom.setLocalTranslation(new Vector3f(0, 0.8f, 2.6f).add(0.015f, -0.015f, 0.7f));
return geom;
}
示例4: Sprite
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public Sprite(final String name, final Texture texture, Vector2f size, final boolean transparent, final Vector3f rotation,
final Vector3f translation, final AssetManager assetManager) {
super(name, new Quad(size.getX(), size.getY()));
final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
setMaterial(material);
if (texture != null) {
setTexture(texture);
}
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
if (transparent) {
setQueueBucket(Bucket.Transparent);
} else {
setQueueBucket(Bucket.Opaque);
}
if (rotation != null) {
rotate(rotation.getX() * FastMath.DEG_TO_RAD, rotation.getY() * FastMath.DEG_TO_RAD, rotation.getZ()
* FastMath.DEG_TO_RAD);
}
if (translation != null) {
setLocalTranslation(translation);
}
}
示例5: simpleInitApp
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(20);
Sphere sphereMesh = new Sphere(32, 32, 1);
sphereMesh.setTextureMode(Sphere.TextureMode.Projected);
sphereMesh.updateGeometry(32, 32, 1, false, false);
addMesh("Sphere", sphereMesh, new Vector3f(-1, 0, 0));
Quad quadMesh = new Quad(1, 1);
quadMesh.updateGeometry(1, 1);
addMesh("Quad", quadMesh, new Vector3f(1, 0, 0));
Mesh strip = createTriangleStripMesh();
addMesh("strip", strip, new Vector3f(0, -3, 0));
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal());
dl.setColor(ColorRGBA.White);
rootNode.addLight(dl);
}
示例6: simpleInitApp
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Quad quadMesh = new Quad(1, 1);
Geometry sphere = new Geometry("Rock Ball", quadMesh);
Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m");
sphere.setMaterial(mat);
TangentBinormalGenerator.generate(sphere);
rootNode.attachChild(sphere);
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.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
// DirectionalLight dl = new DirectionalLight();
// dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal());
// dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f));
// rootNode.addLight(dl);
}
示例7: simpleInitApp
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Quad q = new Quad(6, 3);
Geometry g = new Geometry("quad", q);
g.setLocalTranslation(0, -3, -0.0001f);
g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(g);
BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText txt = new BitmapText(fnt, false);
txt.setBox(new Rectangle(0, 0, 6, 3));
txt.setQueueBucket(Bucket.Transparent);
txt.setSize( 0.5f );
txt.setText(txtB);
rootNode.attachChild(txt);
}
示例8: simpleInitApp
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
@Override
public void simpleInitApp() {
// create a simple plane/quad
Quad quadMesh = new Quad(1, 1);
quadMesh.updateGeometry(1, 1, true);
Geometry quad = new Geometry("Textured Quad", quadMesh);
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/town.zip",
HttpZipLocator.class);
TextureKey key = new TextureKey("grass.jpg", false);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
quad.setMaterial(mat);
float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight();
quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1));
quad.center();
rootNode.attachChild(quad);
}
示例9: simpleInitApp
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
@Override
public void simpleInitApp() {
// create a simple plane/quad
Quad quadMesh = new Quad(1, 1);
quadMesh.updateGeometry(1, 1, true);
Geometry quad = new Geometry("Textured Quad", quadMesh);
assetManager.registerLocator("http://www.jmonkeyengine.com/wp-content/uploads/2010/09/",
UrlLocator.class);
TextureKey key = new TextureKey("planet-2.jpg", false);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
quad.setMaterial(mat);
float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight();
quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1));
quad.center();
rootNode.attachChild(quad);
}
示例10: init
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
private void init() {
SceneApplication.getApplication().addSceneListener(this);
Sphere sphMesh = new Sphere(32, 32, 2.5f);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 2.5f, false, false);
Logger log = Logger.getLogger(TangentBinormalGenerator.class.getName());
log.setLevel(Level.SEVERE);
TangentBinormalGenerator.generate(sphMesh);
sphere = new Geometry("previewSphere", sphMesh);
sphere.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_X));
Box boxMesh = new Box(1.75f, 1.75f, 1.75f);
TangentBinormalGenerator.generate(boxMesh);
box = new Geometry("previewBox", boxMesh);
box.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.DEG_TO_RAD * 30, Vector3f.UNIT_X).multLocal(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Y)));
Quad quadMesh = new Quad(4.5f, 4.5f);
TangentBinormalGenerator.generate(quadMesh);
quad = new Geometry("previewQuad", quadMesh);
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
currentGeom = sphere;
init = true;
}
示例11: TexturePreview
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public TexturePreview(ProjectAssetManager assetManager) {
this.assetManager = assetManager;
Quad quadMesh = new Quad(4.5f, 4.5f);
Quad quadMesh3D = new Quad(4.5f, 4.5f);
quadMesh3D.scaleTextureCoordinates(new Vector2f(4, 4));
quad = new Geometry("previewQuad", quadMesh);
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
quad3D = new Geometry("previewQuad", quadMesh3D);
quad3D.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
material3D = new Material(assetManager, "com/jme3/gde/core/properties/preview/tex3DThumb.j3md");
material3D.setFloat("InvDepth", 1f / 16f);
material3D.setInt("Rows", 4);
material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
SceneApplication.getApplication().addSceneListener(this);
}
示例12: makeUnshadedPlane
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public Geometry makeUnshadedPlane(String name, float width, float height, ColorRGBA color) {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
// mat.setBoolean("UseAlpha", true);
// mat.setBoolean("HighQuality", false);
Geometry plane = new Geometry(name, new Quad(width, height));
plane.setMaterial(mat);
plane.setUserData("obj_shape", "plane");
plane.setUserData("obj_width", width);
plane.setUserData("obj_height", height);
plane.setUserData("obj_color", color);
return plane;
}
示例13: getNode
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
public Node getNode(AssetManager assetM, ColorRGBA color) {
Node n = new Node();
if (SHOW_HITBOX) {
//geo.setCullHint(Spatial.CullHint.Always);
//}else {
Material mat = new Material(assetM, "Common/MatDefs/Misc/Unshaded.j3md");
ColorRGBA col = color.clone();
col.a = .5f;
mat.setColor("Color", col);
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
Geometry geo = new Geometry(name, new Quad(w, h));
geo.setMaterial(mat);
geo.setLocalTranslation(-w / 2, -h / 2, 0);
n.attachChild(geo);
}
return n;
}
示例14: createControlObj
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
private Spatial createControlObj(ColorRGBA color) {
Quad quad = new Quad(1,1);
Geometry geo = new Geometry("", quad);
geo.rotate(-FastMath.HALF_PI, 0, 0);
geo.setLocalTranslation(-0.5f, 0, 0.5f);
Material mat = MaterialUtils.createUnshaded();
if (color != null) {
mat.setColor("Color", color);
}
geo.setMaterial(mat);
geo.setCullHint(Spatial.CullHint.Always);
Node root = new Node();
root.attachChild(geo);
return root;
}
示例15: registerInput
import com.jme3.scene.shape.Quad; //导入依赖的package包/类
private void registerInput() {
if (brushGeom == null) {
brushGeom = new Geometry("brush", new Quad(BRUSH_RADIUS*2, BRUSH_RADIUS*2));
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", app.getAssetManager().loadTexture("org/shaman/terrain/polygonal/Brush.png"));
mat.getAdditionalRenderState().setDepthTest(false);
mat.getAdditionalRenderState().setDepthWrite(false);
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
brushGeom.setMaterial(mat);
graphNode.attachChild(brushGeom);
brushGeom.setCullHint(Spatial.CullHint.Always);
listener = new InputListenerImpl();
app.getInputManager().addMapping("PolygonalMouseX+", new MouseAxisTrigger(MouseInput.AXIS_X, false));
app.getInputManager().addMapping("PolygonalMouseX-", new MouseAxisTrigger(MouseInput.AXIS_X, true));
app.getInputManager().addMapping("PolygonalMouseY+", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
app.getInputManager().addMapping("PolygonalMouseY-", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
app.getInputManager().addMapping("PolygonalMouseLeft", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
app.getInputManager().addMapping("PolygonalMouseRight", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
}
app.getInputManager().addListener(listener, "PolygonalMouseX+", "PolygonalMouseX-", "PolygonalMouseY+",
"PolygonalMouseY-", "PolygonalMouseLeft", "PolygonalMouseRight");
}