Пример #1
0
  private TrailManager(final Node root) {
    this.root = root;

    trails = new HashMap<Spatial, TrailMesh>();

    Renderer r = DisplaySystem.getDisplaySystem().getRenderer();
    ts = r.createTextureState();
    ts.setEnabled(true);
    Texture t1 =
        TextureManager.loadTexture(
            ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, "trail_y1.png"),
            Texture.MinificationFilter.Trilinear,
            Texture.MagnificationFilter.Bilinear);
    ts.setTexture(t1);

    bs = r.createBlendState();
    bs.setBlendEnabled(true);
    bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
    bs.setDestinationFunction(BlendState.DestinationFunction.One);
    bs.setTestEnabled(true);

    zs = r.createZBufferState();
    zs.setWritable(false);

    cs = r.createCullState();
    cs.setCullFace(CullState.Face.None);
    cs.setEnabled(true);
  }
Пример #2
0
  /** Initializes the rootNodes RenderStates, initializes the Camera and */
  private void init() {
    // we attach transparent objects to this node, so it must be
    // rendered in the transparent bucket
    objectsNode.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);

    CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
    cs.setCullFace(Face.Back);
    cs.setEnabled(true);
    rootNode.setRenderState(cs);

    // create a first person controller to move the Camera with W,A,S,D and mouse look
    movementInput = new FirstPersonHandler(cam, 15.0f, 0.5f);
    // move the camera a bit backwards and up
    cam.setLocation(new Vector3f(2, 10, 15));

    // create a Physics update callback, to simulate basic wind force
    wind =
        new PhysicsWindCallback(
            SceneSettings.get().getWindVariation(), SceneSettings.get().getWindForce());
    getPhysicsSpace().addToUpdateCallbacks(wind);
  }