com.jme3.scene.Spatial.CullHint Java Examples

The following examples show how to use com.jme3.scene.Spatial.CullHint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestEverything.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
    public void simpleInitApp() {
        cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
        cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
        cam.update();

        cam.setFrustumFar(300);
        flyCam.setMoveSpeed(30);

        rootNode.setCullHint(CullHint.Never);

        setupBasicShadow();
        setupHdr();

        setupLighting();
        setupSkyBox();

//        setupTerrain();
        setupFloor();
//        setupRobotGuy();
        setupSignpost();

        
    }
 
Example #2
Source File: TestCartoonEdge.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.Gray);

    cam.setLocation(new Vector3f(-5.6310086f, 5.0892987f, -13.000479f));
    cam.setRotation(new Quaternion(0.1779095f, 0.20036356f, -0.03702727f, 0.96272093f));
    cam.update();

    cam.setFrustumFar(300);
    flyCam.setMoveSpeed(30);

    rootNode.setCullHint(CullHint.Never);

    setupLighting();
    setupModel();
    setupFilters();
}
 
Example #3
Source File: TestCartoonEdge.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.Gray);

    cam.setLocation(new Vector3f(-5.6310086f, 5.0892987f, -13.000479f));
    cam.setRotation(new Quaternion(0.1779095f, 0.20036356f, -0.03702727f, 0.96272093f));
    cam.update();

    cam.setFrustumFar(300);
    flyCam.setMoveSpeed(30);

    rootNode.setCullHint(CullHint.Never);

    setupLighting();
    setupModel();
    setupFilters();
}
 
Example #4
Source File: TestEverything.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
    public void simpleInitApp() {
        cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
        cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
        cam.update();

        cam.setFrustumFar(300);
        flyCam.setMoveSpeed(30);

        rootNode.setCullHint(CullHint.Never);

        setupBasicShadow();
        setupHdr();

        setupLighting();
        setupSkyBox();

//        setupTerrain();
        setupFloor();
//        setupRobotGuy();
        setupSignpost();

        
    }
 
Example #5
Source File: CubeField.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Initializes game 
 */
@Override
public void simpleInitApp() {
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);

    flyCam.setEnabled(false);
    statsView.setCullHint(CullHint.Always);

    Keys();

    defaultFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    pressStart = new BitmapText(defaultFont, false);
    fpsScoreText = new BitmapText(defaultFont, false);

    loadText(fpsScoreText, "Current Score: 0", defaultFont, 0, 2, 0);
    loadText(pressStart, "PRESS ENTER", defaultFont, 0, 5, 0);
    
    player = createPlayer();
    rootNode.attachChild(player);
    cubeField = new ArrayList<Geometry>();
    obstacleColors = new ArrayList<ColorRGBA>();

    gameReset();
}
 
Example #6
Source File: StatsAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);

    if (enabled) {
        fpsText.setCullHint(showFps ? CullHint.Never : CullHint.Always);
        darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
        statsView.setEnabled(showStats);
        statsView.setCullHint(showStats ? CullHint.Never : CullHint.Always);
        darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
    } else {
        fpsText.setCullHint(CullHint.Always);
        darkenFps.setCullHint(CullHint.Always);
        statsView.setEnabled(false);
        statsView.setCullHint(CullHint.Always);
        darkenStats.setCullHint(CullHint.Always);
    }
}
 
Example #7
Source File: StatsAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void loadDarken() {
    Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", new ColorRGBA(0,0,0,0.5f));
    mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

    darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight()));
    darkenFps.setMaterial(mat);
    darkenFps.setLocalTranslation(0, 0, -1);
    darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
    guiNode.attachChild(darkenFps);

    darkenStats = new Geometry("StatsDarken", new Quad(200, statsView.getHeight()));
    darkenStats.setMaterial(mat);
    darkenStats.setLocalTranslation(0, fpsText.getHeight(), -1);
    darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
    guiNode.attachChild(darkenStats);
}
 
Example #8
Source File: DragAndDropDemoState.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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);
}
 
Example #9
Source File: SimpleApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initialize() {
    super.initialize();

    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    loadFPSText();
    loadStatsView();
    viewPort.attachScene(rootNode);
    guiViewPort.attachScene(guiNode);

    if (inputManager != null) {
        flyCam = new FlyByCamera(cam);
        flyCam.setMoveSpeed(1f);
        flyCam.registerWithInput(inputManager);

        if (context.getType() == Type.Display) {
            inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE));
        }

        inputManager.addMapping(INPUT_MAPPING_CAMERA_POS, new KeyTrigger(KeyInput.KEY_C));
        inputManager.addMapping(INPUT_MAPPING_MEMORY, new KeyTrigger(KeyInput.KEY_M));
        inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5));
        inputManager.addListener(actionListener, INPUT_MAPPING_EXIT,
                INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_MEMORY, INPUT_MAPPING_HIDE_STATS);
        
    }

    // call user code
    simpleInitApp();
}
 
Example #10
Source File: EffectTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Internal use only
 *
 * @see Track#setTime(float, float, com.jme3.animation.AnimControl,
 * com.jme3.animation.AnimChannel, com.jme3.util.TempVars)
 */
public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {

    if (time >= length) {
        return;
    }
    //first time adding the Animation listener to stop the track at the end of the animation
    if (!initialized) {
        control.addListener(new OnEndListener());
        initialized = true;
    }
    //checking fo time to trigger the effect
    if (!emitted && time >= startOffset) {
        emitted = true;
        emitter.setCullHint(CullHint.Dynamic);
        emitter.setEnabled(true);
        //if the emitter has 0 particles per seconds emmit all particles in one shot
        if (particlesPerSeconds == 0) {
            emitter.emitAllParticles();
            if (!killParticles.stopRequested) {
                emitter.addControl(killParticles);
                killParticles.stopRequested = true;
            }
        } else {
            //else reset its former particlePerSec value to let it emmit.
            emitter.setParticlesPerSec(particlesPerSeconds);
        }
    }
}
 
Example #11
Source File: EffectTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected void controlUpdate(float tpf) {
    if (remove) {
        emitter.removeControl(this);
        return;
    }
    if (emitter.getNumVisibleParticles() == 0) {
        emitter.setCullHint(CullHint.Always);
        emitter.setEnabled(false);
        emitter.removeControl(this);
        stopRequested = false;
    }
}
 
Example #12
Source File: TestLeakingGL.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void simpleInitApp() {
    original = new Sphere(4, 4, 1);
    original.setStatic();
    original.setInterleaved();

    // this will make sure all spheres are rendered always
    rootNode.setCullHint(CullHint.Never);
    solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
    cam.setLocation(new Vector3f(0, 5, 0));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

    Logger.getLogger(Node.class.getName()).setLevel(Level.WARNING);
    Logger.getLogger(NativeObjectManager.class.getName()).setLevel(Level.WARNING);
}
 
Example #13
Source File: AndroidApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initialize() 
{
    // Create a default Android assetmanager before Application can create one in super.initialize();
    assetManager = JmeSystem.newAssetManager(null);        
    super.initialize();

    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    loadFPSText();
    viewPort.attachScene(rootNode);
    guiViewPort.attachScene(guiNode);
    
    inputManager.addMapping("TouchEscape", new TouchTrigger(TouchInput.KEYCODE_BACK));
    inputManager.addListener(this, new String[]{"TouchEscape"}); 

    // call user code
    init();
    
    // Start thread for async load
    Thread t = new Thread(new Runnable()
    {
        @Override
        public void run ()
        {
            try
            {
                // call user code
                asyncload();
            }
            catch (Exception e)
            {
                handleError("AsyncLoad failed", e);
            }
            loadingFinished.set(true);
        }
    });
    t.setDaemon(true);
    t.start();
}
 
Example #14
Source File: OpenRTSApplication.java    From OpenRTS with MIT License 5 votes vote down vote up
@Override
public void initialize() {
	bulletAppState = new BulletAppState();
	bulletAppState.startPhysics();

	super.initialize();

	guiNode.setQueueBucket(Bucket.Gui);
	guiNode.setCullHint(CullHint.Never);
	initTexts();
	loadStatsView();
	viewPort.attachScene(rootNode);
	guiViewPort.attachScene(guiNode);

	if (inputManager != null) {
		flyCam = new AzertyFlyByCamera(cam);
		flyCam.setMoveSpeed(1f);
		flyCam.registerWithInput(inputManager);

		if (context.getType() == Type.Display) {
			inputManager.addMapping("SIMPLEAPP_Exit", new KeyTrigger(KeyInput.KEY_ESCAPE));
		}

		inputManager.addMapping("SIMPLEAPP_CameraPos", new KeyTrigger(KeyInput.KEY_C));
		inputManager.addMapping("SIMPLEAPP_Memory", new KeyTrigger(KeyInput.KEY_M));
		inputManager.addListener(actionListener, "SIMPLEAPP_Exit", "SIMPLEAPP_CameraPos", "SIMPLEAPP_Memory");
	}

	// call user code
	simpleInitApp();
	stateManager.attach(bulletAppState);
	getPhysicsSpace().addTickListener(this);
}
 
Example #15
Source File: StatsAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Attaches Statistics View to guiNode and displays it on the screen
 * above FPS statistics line.
 *
 */
public void loadStatsView() {
    statsView = new StatsView("Statistics View",
                              app.getAssetManager(),
                              app.getRenderer().getStatistics());
    // move it up so it appears above fps text
    statsView.setLocalTranslation(0, fpsText.getLineHeight(), 0);
    statsView.setEnabled(showStats);
    statsView.setCullHint(showStats ? CullHint.Never : CullHint.Always);
    guiNode.attachChild(statsView);
}
 
Example #16
Source File: StatsAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setDisplayStatView(boolean show) {
    showStats = show;
    if (statsView != null ) {
        statsView.setEnabled(show);
        statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
        if (darkenStats != null) {
            darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always);
        }
    }
}
 
Example #17
Source File: StatsAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setDisplayFps(boolean show) {
    showFps = show;
    if (fpsText != null) {
        fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);
        if (darkenFps != null) {
            darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always);
        }

    }
}
 
Example #18
Source File: EffectTrack.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Internal use only
 *
 * @see Track#setTime(float, float, com.jme3.animation.AnimControl,
 * com.jme3.animation.AnimChannel, com.jme3.util.TempVars)
 */
@Override
public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) {

    if (time >= length) {
        return;
    }
    //first time adding the Animation listener to stop the track at the end of the animation
    if (!initialized) {
        control.addListener(new OnEndListener());
        initialized = true;
    }
    //checking for time to trigger the effect
    if (!emitted && time >= startOffset) {
        emitted = true;
        emitter.setCullHint(CullHint.Dynamic);
        emitter.setEnabled(true);
        //if the emitter has 0 particles per seconds emmit all particles in one shot
        if (particlesPerSeconds == 0) {
            emitter.emitAllParticles();
            if (!killParticles.stopRequested) {
                emitter.addControl(killParticles);
                killParticles.stopRequested = true;
            }
        } else {
            //else reset its former particlePerSec value to let it emmit.
            emitter.setParticlesPerSec(particlesPerSeconds);
        }
    }
}
 
Example #19
Source File: EffectTrack.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void controlUpdate(float tpf) {
    if (remove) {
        emitter.removeControl(this);
        return;
    }
    if (emitter.getNumVisibleParticles() == 0) {
        emitter.setCullHint(CullHint.Always);
        emitter.setEnabled(false);
        emitter.removeControl(this);
        stopRequested = false;
    }
}
 
Example #20
Source File: TestLeakingGL.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    original = new Sphere(4, 4, 1);
    original.setStatic();
    //original.setInterleaved();

    // this will make sure all spheres are rendered always
    rootNode.setCullHint(CullHint.Never);
    solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
    cam.setLocation(new Vector3f(0, 5, 0));
    cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

    Logger.getLogger(Node.class.getName()).setLevel(Level.WARNING);
    Logger.getLogger(NativeObjectManager.class.getName()).setLevel(Level.WARNING);
}
 
Example #21
Source File: IconComponent.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void createIcon() {
    Vector2f imageSize = getEffectiveIconSize();
    float width = iconScale.x * imageSize.x;
    float height = iconScale.y * imageSize.y;
    Quad q = new Quad(width, height);
    icon = new Geometry("icon:" + imagePath, q);
    if( material == null ) {
        material = GuiGlobals.getInstance().createMaterial(lit);
        material.setColor(color);
        material.setTexture(image);

        material.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
        // AlphaTest and AlphaFalloff are deprecated in favor of the material
        // parameter... in fact in current JME there are no-ops.
        //material.getMaterial().getAdditionalRenderState().setAlphaTest(true);
        //material.getMaterial().getAdditionalRenderState().setAlphaFallOff(0.01f);
        material.getMaterial().setFloat("AlphaDiscardThreshold", 0.1f);
    }

    icon.setMaterial(material.getMaterial());

    // Leave it invisible until the first time we are reshaped.
    // Without this, there is a noticeable one-frame jump from
    // 0,0,0 to it's proper position.
    icon.setCullHint(CullHint.Always);

    // Just in case but it should never happen
    if( isAttached() ) {
        getNode().attachChild(icon);
    }
}
 
Example #22
Source File: TextEntryComponent.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void resetCursorState() {
    if( isAttached() && focused && cursorVisible ) {
        cursor.setCullHint(CullHint.Inherit);
    } else {
        cursor.setCullHint(CullHint.Always);
    }
}
 
Example #23
Source File: SimpleApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void initialize() {
    super.initialize();

    // Several things rely on having this
    guiFont = loadGuiFont();

    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    viewPort.attachScene(rootNode);
    guiViewPort.attachScene(guiNode);

    if (inputManager != null) {

        // We have to special-case the FlyCamAppState because too
        // many SimpleApplication subclasses expect it to exist in
        // simpleInit().  But at least it only gets initialized if
        // the app state is added.
        if (stateManager.getState(FlyCamAppState.class) != null) {
            flyCam = new FlyByCamera(cam);
            flyCam.setMoveSpeed(1f); // odd to set this here but it did it before
            stateManager.getState(FlyCamAppState.class).setCamera( flyCam );
        }

        if (context.getType() == Type.Display) {
            inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE));
        }

        if (stateManager.getState(StatsAppState.class) != null) {
            inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5));
            inputManager.addListener(actionListener, INPUT_MAPPING_HIDE_STATS);
        }

        inputManager.addListener(actionListener, INPUT_MAPPING_EXIT);
    }

    if (stateManager.getState(StatsAppState.class) != null) {
        // Some of the tests rely on having access to fpsText
        // for quick display.  Maybe a different way would be better.
        stateManager.getState(StatsAppState.class).setFont(guiFont);
        fpsText = stateManager.getState(StatsAppState.class).getFpsText();
    }

    // call user code
    simpleInitApp();
}
 
Example #24
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Create a new VR application.<br> 
 * The application scene is made of a {@link #getRootNode() root node} that holds the scene spatials 
 * and a {@link #getGuiNode() GUI node} that is the root of the Graphical user interface.
 */
public VRApplication() {
    super();
    
    rootNode = new Node("root");
    guiNode = new Node("guiNode");
    
    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    dummyCam = new Camera();
    
    initStateManager();

    // Create the GUI manager.
    guiManager = new VRGuiManager(null);
    
    // Create a new view manager.
    viewmanager = new OpenVRViewManager(null);
    
    // Create a new mouse manager.
    mouseManager = new OpenVRMouseManager(null);
    
    // we are going to use OpenVR now, not the Oculus Rift
    // OpenVR does support the Rift
    OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
    VRSupportedOS = !OS.contains("nux") && System.getProperty("sun.arch.data.model").equalsIgnoreCase("64"); //for the moment, linux/unix causes crashes, 64-bit only
    compositorOS = OS.contains("indows");
    
    if( !VRSupportedOS ) {
    	logger.warning("Non-supported OS: " + OS + ", architecture: " + System.getProperty("sun.arch.data.model"));
    } else if( DISABLE_VR ) {
    	logger.warning("VR disabled via code.");
    } else if( VRSupportedOS && DISABLE_VR == false ) {
        if( CONSTRUCT_WITH_OSVR ) {
        	//FIXME: WARNING !!
            VRhardware = new OSVR(null);
            logger.config("Creating OSVR wrapper [SUCCESS]");
        } else {
        	//FIXME: WARNING !!
            VRhardware = new OpenVR(null);
            logger.config("Creating OpenVR wrapper [SUCCESS]");
        }
        if( VRhardware.initialize() ) {
            setPauseOnLostFocus(false);
        }
    }
}
 
Example #25
Source File: TestPostFilters.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    cam.setLocation(new Vector3f(-32.295086f, 54.80136f, 79.59805f));
    cam.setRotation(new Quaternion(0.074364014f, 0.92519957f, -0.24794696f, 0.27748522f));
    cam.update();

    cam.setFrustumFar(300);
    flyCam.setMoveSpeed(30);

    rootNode.setCullHint(CullHint.Never);

    setupLighting();
    setupSkyBox();


    setupFloor();

    setupSignpost();

    setupFilters();

    initInput();

}
 
Example #26
Source File: TestComboMoves.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    fpsText.setCullHint(CullHint.Always);
    statsView.setCullHint(CullHint.Always);

    // Create debug text
    BitmapText helpText = new BitmapText(guiFont);
    helpText.setLocalTranslation(0, settings.getHeight(), 0);
    helpText.setText("Moves:\n" +
                     "Fireball: Down, Down+Right, Right\n"+
                     "Shuriken: Left, Down, Attack1(Z)\n"+
                     "Jab: Attack1(Z)\n"+
                     "Punch: Attack1(Z), Attack1(Z)\n");
    guiNode.attachChild(helpText);

    fireballText = new BitmapText(guiFont);
    fireballText.setColor(ColorRGBA.Orange);
    fireballText.setLocalTranslation(0, fireballText.getLineHeight(), 0);
    guiNode.attachChild(fireballText);

    shurikenText = new BitmapText(guiFont);
    shurikenText.setColor(ColorRGBA.Cyan);
    shurikenText.setLocalTranslation(0, shurikenText.getLineHeight()*2f, 0);
    guiNode.attachChild(shurikenText);

    jabText = new BitmapText(guiFont);
    jabText.setColor(ColorRGBA.Red);
    jabText.setLocalTranslation(0, jabText.getLineHeight()*3f, 0);
    guiNode.attachChild(jabText);

    punchText = new BitmapText(guiFont);
    punchText.setColor(ColorRGBA.Green);
    punchText.setLocalTranslation(0, punchText.getLineHeight()*4f, 0);
    guiNode.attachChild(punchText);

    inputManager.addMapping("Left",    new KeyTrigger(KeyInput.KEY_LEFT));
    inputManager.addMapping("Right",   new KeyTrigger(KeyInput.KEY_RIGHT));
    inputManager.addMapping("Up",      new KeyTrigger(KeyInput.KEY_UP));
    inputManager.addMapping("Down",    new KeyTrigger(KeyInput.KEY_DOWN));
    inputManager.addMapping("Attack1", new KeyTrigger(KeyInput.KEY_Z));
    inputManager.addListener(this, "Left", "Right", "Up", "Down", "Attack1");

    fireball = new ComboMove("Fireball");
    fireball.press("Down").notPress("Right").done();
    fireball.press("Right", "Down").done();
    fireball.press("Right").notPress("Down").done();
    fireball.notPress("Right", "Down").done();
    fireball.setUseFinalState(false); // no waiting on final state

    shuriken = new ComboMove("Shuriken");
    shuriken.press("Left").notPress("Down", "Attack1").done();
    shuriken.press("Down").notPress("Attack1").timeElapsed(0.11f).done();
    shuriken.press("Attack1").notPress("Left").timeElapsed(0.11f).done();
    shuriken.notPress("Left", "Down", "Attack1").done();

    jab = new ComboMove("Jab");
    jab.setPriority(0.5f); // make jab less important than other moves
    jab.press("Attack1").done();

    punch = new ComboMove("Punch");
    punch.press("Attack1").done();
    punch.notPress("Attack1").done();
    punch.press("Attack1").done();

    fireballExec = new ComboMoveExecution(fireball);
    shurikenExec = new ComboMoveExecution(shuriken);
    jabExec = new ComboMoveExecution(jab);
    punchExec = new ComboMoveExecution(punch);
}
 
Example #27
Source File: IconComponent.java    From Lemur with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void reshape( Vector3f pos, Vector3f size ) {
    Vector2f imageSize = getEffectiveIconSize();
    float width = iconScale.x * imageSize.x;
    float height = iconScale.y * imageSize.y;
    float boxWidth = width + xMargin * 2;
    float boxHeight = height + yMargin * 2;

    float cx = 0;
    float cy = 0;

    switch( hAlign ) {
        case Left:
            cx = pos.x + boxWidth * 0.5f;
            if( !overlay ) {
                pos.x += boxWidth;
                size.x -= boxWidth;
            }
            break;
        case Right:
            cx = (pos.x + size.x) - boxWidth * 0.5f;
            if( !overlay ) {
                size.x -= boxWidth;
            }
            break;
        case Center:
            cx = pos.x + size.x * 0.5f;
            break;
    }

    switch( vAlign ) {
        case Top:
            cy = pos.y - boxHeight * 0.5f;
            if( !overlay ) {
                pos.y -= boxHeight;
                size.y -= boxHeight;
            }
            break;
        case Bottom:
            cy = (pos.y - size.y) + boxWidth * 0.5f;
            if( !overlay ) {
                size.y -= boxHeight;
            }
            break;
        case Center:
            cy = pos.y - size.y * 0.5f;
            break;
    }

    icon.setLocalTranslation(cx - width * 0.5f, cy - height * 0.5f, pos.z);
    if( offset != null ) {
        icon.move(offset);
    }

    pos.z += zOffset;
    size.z -= Math.abs(zOffset);

    icon.setCullHint(CullHint.Inherit);
}
 
Example #28
Source File: LevelTerrainToolControl.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@JmeThread
protected void controlUpdate(float tpf) {
    super.controlUpdate(tpf);
    getLevelMarker().setCullHint(isUseMarker() ? CullHint.Never : CullHint.Always);
}
 
Example #29
Source File: SimpleApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setDisplayFps(boolean show) {
    showFps = show;
    fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);
}
 
Example #30
Source File: SimpleApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void setDisplayStatView(boolean show) {
    statsView.setEnabled(show);
    statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
}