本文整理汇总了Java中com.jme3.ui.Picture.setTexture方法的典型用法代码示例。如果您正苦于以下问题:Java Picture.setTexture方法的具体用法?Java Picture.setTexture怎么用?Java Picture.setTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.ui.Picture
的用法示例。
在下文中一共展示了Picture.setTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.jme3.ui.Picture; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp) {
this.rm = rm;
this.vp = vp;
loadTextures(manager);
createTextures();
applyTextures(material);
createPreViews();
material.setVector2("FrustumNearFar", new Vector2f(vp.getCamera().getFrustumNear(), vp.getCamera().getFrustumFar()));
if (debug) {
dispRefraction = new Picture("dispRefraction");
dispRefraction.setTexture(manager, refractionTexture, false);
dispReflection = new Picture("dispRefraction");
dispReflection.setTexture(manager, reflectionTexture, false);
dispDepth = new Picture("depthTexture");
dispDepth.setTexture(manager, depthTexture, false);
}
}
示例2: simpleInitApp
import com.jme3.ui.Picture; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
int w = settings.getWidth();
int h = settings.getHeight();
//setup framebuffer
fb = new FrameBuffer(w, h, 1);
Texture2D fbTex = new Texture2D(w, h, Format.RGBA8);
fb.setDepthBuffer(Format.Depth);
fb.setColorTexture(fbTex);
// setup framebuffer's scene
Sphere sphMesh = new Sphere(20, 20, 1);
Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
Geometry sphere = new Geometry("sphere", sphMesh);
sphere.setMaterial(solidColor);
fbNode.attachChild(sphere);
//setup main scene
Picture p = new Picture("Picture");
p.setPosition(0, 0);
p.setWidth(w);
p.setHeight(h);
p.setTexture(assetManager, fbTex, false);
rootNode.attachChild(p);
}
示例3: simpleInitApp
import com.jme3.ui.Picture; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
flyCam.setEnabled(false);
// inputManager.setCursorVisible(false);
Texture tex = assetManager.loadTexture("Interface/Logo/Cursor.png");
cursor = new Picture("cursor");
cursor.setTexture(assetManager, (Texture2D) tex, true);
cursor.setWidth(64);
cursor.setHeight(64);
guiNode.attachChild(cursor);
inputManager.addRawInputListener(inputListener);
// Image img = tex.getImage();
// ByteBuffer data = img.getData(0);
// IntBuffer image = BufferUtils.createIntBuffer(64 * 64);
// for (int y = 0; y < 64; y++){
// for (int x = 0; x < 64; x++){
// int rgba = data.getInt();
// image.put(rgba);
// }
// }
// image.clear();
//
// try {
// Cursor cur = new Cursor(64, 64, 2, 62, 1, image, null);
// Mouse.setNativeCursor(cur);
// } catch (LWJGLException ex) {
// Logger.getLogger(TestSoftwareMouse.class.getName()).log(Level.SEVERE, null, ex);
// }
}
示例4: initGui
import com.jme3.ui.Picture; //导入方法依赖的package包/类
private void initGui() {
oneGui = new OneGui();
try (InputStream inputStream = Example1.class.getResourceAsStream("/example1.ogs")) {
oneGui.addStyles(inputStream);
} catch (Exception e) {
}
final Screen screen = new Screen(oneGui, "screen");
Panel leftPanel = new Panel(screen, "panelLeft");
Button startNewGameButton = new Button(leftPanel, "startNewGame");
startNewGameButton.addClickedEventListener(id -> {
System.out.println("Clicked: " + id);
});
Button showSettingsButton = new Button(leftPanel, "showSettings");
Panel centerspace = new Panel(screen, "panelCenterSpace");
Panel rightPanel = new Panel(screen, "panelRight");
label = new Label(rightPanel, "label1");
label.setText("SettingslåäöÅÄÖqhjKp");
Label settingsLabel2 = new Label(rightPanel, "label2");
settingsLabel2.setText("SettingslåäöÅÄÖqhjKp");
Label settingsLabel3 = new Label(rightPanel, "label3");
settingsLabel3.setText("SettingslåäöÅÄÖqhjKp");
Button button2 = new Button(rightPanel, "saveSettings");
startNewGameButton.click();
oneGuiRenderer = new OneGuiRenderer(screen, 1280, 720);
oneGuiRenderer.update(1);
final BufferedImage bufferedImage = oneGuiRenderer.generateImage();
image = new AWTLoader().load(bufferedImage, true);
final byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData();
flipImage(pixels, (int) oneGuiRenderer.getWidth(), (int) oneGuiRenderer.getHeight(), bufferedImage.getColorModel().getPixelSize());
byteBuffer = BufferUtils.createByteBuffer(pixels.length);
byteBuffer.put(pixels);
byteBuffer.flip();
texture = new Texture2D(image);
texture.setAnisotropicFilter(2);
final Picture picture = new Picture("HUD Picture");
picture.setWidth(settings.getWidth());
picture.setHeight(settings.getHeight());
picture.setPosition(0, 0);
picture.setTexture(assetManager, texture, true);
guiNode.attachChild(picture);
}