Package org.pollux3d.scene

Source Code of org.pollux3d.scene.LoadingScreen

package org.pollux3d.scene;

import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.font.Rectangle;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.Camera;
import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;

public class LoadingScreen implements PolluxScene {
 
  private Node sceneNode = new Node("LoadingScreen");

  private String txtB =
      "Pollux3D loading...";
 
  @Override
  public Node create(AssetManager assetManager, Camera cam) {
        Quad q = new Quad(20, 10);
        Geometry g = new Geometry("quad", q);
        g.setLocalTranslation(-10, -5, -0.0001f);
        Material bg = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        bg.setColor("Color", ColorRGBA.Black);
        g.setMaterial(bg);
        sceneNode.attachChild(g);

        Quad q_small = new Quad(9.0f, 3.0f);
        Geometry logo = new Geometry("quad", q_small);
        logo.setLocalTranslation(-4.5f, -1.5f, 1);
        Material logo_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Texture logo_tex = assetManager.loadTexture("Textures/pollux.jpg");
        logo_mat.setTexture("ColorMap", logo_tex);
        logo.setMaterial(logo_mat);
        sceneNode.attachChild(logo);
       
       
        BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
        BitmapText txt = new BitmapText(fnt, false);
        txt.setBox(new Rectangle(-2, -2.5f, 6, 3));
        txt.setQueueBucket(Bucket.Transparent);
        txt.setSize( 0.5f );
        txt.setText(txtB);
        sceneNode.attachChild(txt);
       
        return sceneNode;
  }

}
TOP

Related Classes of org.pollux3d.scene.LoadingScreen

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.