Package com.jme3.terrain.geomipmap

Examples of com.jme3.terrain.geomipmap.TerrainPatch


     * Starts the application. Creating a display and running the main loop.
     */
    public void start(){

        if (settings == null){
            settings = new AppSettings(true);
        }
       
        context = JmeSystem.newContext(settings, JmeContext.Type.OffscreenSurface);
        context.setSystemListener(this);
        context.create(false);
View Full Code Here


      new ModelInfo(activeModel, app.getAssetLogger().getKeys(activeModel.getRelPath(workspace)));
    } catch (Exception e) {}
  }

  public static void createCanvas(){
    AppSettings settings = new AppSettings(true);
    settings.setWidth( Math.max(640, frame.getContentPane().getWidth()) );
    settings.setHeight( Math.max(480, frame.getContentPane().getHeight()) );

    app = new EditorApp();

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
View Full Code Here

   * main for testing
   *
   * @param args
   */
  public static void main(String[] args) {
        AppSettings settings = new AppSettings(true);
        PolluxSettingsDialog.show(settings);
        System.out.println(settings.toString());
        System.exit(0);
  }
View Full Code Here

    }

    @Override
    public void start() {
     
        setSettings(new AppSettings(true));
        PolluxSettingsDialog.show(settings);
       
        super.start();
    }
View Full Code Here

            } else if (spatial instanceof TerrainPatch) {
                Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
                if (bool != null && bool.booleanValue()) {
                    continue; // go to the next child in the loop
                }
                TerrainPatch terrain = (TerrainPatch) spatial;
                Transform trans = getTransform(spatial, realRootNode);
                shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()),
                        trans.getTranslation(),
                        trans.getRotation().toRotationMatrix());
            } else if (spatial instanceof Geometry) {
                Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
                if (bool != null && bool.booleanValue()) {
View Full Code Here

    public static CollisionShape createMeshShape(Spatial spatial) {
        if (spatial instanceof TerrainQuad) {
            TerrainQuad terrain = (TerrainQuad) spatial;
            return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
        } else if (spatial instanceof TerrainPatch) {
            TerrainPatch terrain = (TerrainPatch) spatial;
            return new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale());
        } else if (spatial instanceof Geometry) {
            return createSingleMeshShape((Geometry) spatial, spatial);
        } else if (spatial instanceof Node) {
            return createMeshCompoundShape((Node) spatial);
        } else {
View Full Code Here

            return null;

        workRay.set(worldPick);

        for (TerrainPickData pd : pickData) {
            TerrainPatch patch = pd.targetPatch;


            tracer.getGridSpacing().set(patch.getWorldScale());
            tracer.setGridOrigin(patch.getWorldTranslation());

            workRay.getOrigin().set(worldPick.getDirection()).multLocal(pd.cr.getDistance()-.1f).addLocal(worldPick.getOrigin());

            tracer.startWalk(workRay);

            final Vector3f intersection = new Vector3f();
            final Vector2f loc = tracer.getGridLocation();

            if (tracer.isRayPerpendicularToGrid()) {
                Triangle hit = new Triangle();
                checkTriangles(loc.x, loc.y, workRay, intersection, patch, hit);
                float distance = worldPickRay.origin.distance(intersection);
                CollisionResult cr = new CollisionResult(intersection, distance);
                cr.setGeometry(patch);
                cr.setContactNormal(hit.getNormal());
                results.addCollision(cr);
                return intersection;
            }
           
           

            while (loc.x >= -1 && loc.x <= patch.getSize() &&
                   loc.y >= -1 && loc.y <= patch.getSize()) {

                //System.out.print(loc.x+","+loc.y+" : ");
                // check the triangles of main square for intersection.
                Triangle hit = new Triangle();
                if (checkTriangles(loc.x, loc.y, workRay, intersection, patch, hit)) {
View Full Code Here

    */
    Geometry g = new Geometry("Bubble", b);
    g.rotate(FastMath.HALF_PI, 0, FastMath.HALF_PI);
    //g.scale(1, 1, -1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture tex = assetManager.loadTexture("Textures/test3.png");
    mat.setTexture("ColorMap", tex);
    //mat.setColor("Color", ColorRGBA.Blue);
    //mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
   
View Full Code Here

    sphere.setQueueBucket(Bucket.Sky);
    Material sky = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    TextureKey key = new TextureKey("Textures/Sky/Stars.dds", true);
    key.setGenerateMips(true);
    key.setAsCube(true);
    Texture tex = assetManager.loadTexture(key);
    sky.setTexture("m_Texture", tex);
    sky.setVector3("m_NormalScale", Vector3f.UNIT_XYZ);
    sphere.setMaterial(sky);
    sphere.setCullHint(Spatial.CullHint.Never);
    bgNode.attachChild(sphere);
View Full Code Here

  public void initialize(AppStateManager stateManager, Application app){
    super.initialize(stateManager, app);
    assetManager = app.getAssetManager();
    settings = app.getContext().getSettings();
   
    Picture pic = new Picture("HUD Picture");
    pic.setImage(assetManager, "Hud/InfoBox2.png", true);
    pic.setHeight(settings.getHeight());
    pic.setWidth(settings.getHeight()/2);
    pic.setPosition(settings.getWidth()-settings.getHeight()/2, 0);
    menuNode.attachChild(pic);
   
   
    /*Quad q = new Quad(6, 3);
        Geometry g = new Geometry("quad", q);
View Full Code Here

TOP

Related Classes of com.jme3.terrain.geomipmap.TerrainPatch

Copyright © 2018 www.massapicom. 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.