Example #1
0
  @Override
  public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
    //   bulletAppState.setEnabled(false);
    stateManager.attach(bulletAppState);
    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);

    brick = new Box(Vector3f.ZERO, brickWidth, brickHeight, brickDepth);
    brick.scaleTextureCoordinates(new Vector2f(1f, .5f));
    // bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    initMaterial();
    initTower();
    initFloor();
    initCrossHairs();
    this.getCam().setLocation(new Vector3f(0, 25f, 8f));
    getCam().lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0));
    getCam().setFrustumFar(80);
    inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
    inputManager.addListener(actionListener, "shoot");
    rootNode.setShadowMode(ShadowMode.Off);
    bsr = new PssmShadowRenderer(assetManager, 1024, 2);
    bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    bsr.setLambda(0.55f);
    bsr.setShadowIntensity(0.6f);
    bsr.setCompareMode(CompareMode.Hardware);
    bsr.setFilterMode(FilterMode.PCF4);
    viewPort.addProcessor(bsr);
  }
Example #2
0
 public void loadShadow() {
   PssmShadowRenderer pssmRenderer = new PssmShadowRenderer(assetManager, 1024 * 2, 1);
   pssmRenderer.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
   pssmRenderer.setLambda(0.55f);
   pssmRenderer.setShadowIntensity(0.7f);
   pssmRenderer.setCompareMode(CompareMode.Software);
   pssmRenderer.setFilterMode(FilterMode.PCF4);
   // pssmRenderer.displayDebug();
   viewPort.addProcessor(pssmRenderer);
 }