Examples of MTComplexPolygon


Examples of org.mt4j.components.visibleComponents.shapes.MTComplexPolygon

            top = getFittingTileSideTo(getBottomOfUpperTile(tiles, i, j));
            left = getFittingTileSideTo(getRightOfLeftTile(tiles, i, j));
          }
        }
       
        MTComplexPolygon tile = getPolygon(app, top, right, bottom, left, this.tileWidth, this.tileHeight);
        tile.setName(i + "" + j);
        tile.setUserData("i", i);
        tile.setUserData("j", j);
        tile.setUserData("top", top);
        tile.setUserData("right", right);
        tile.setUserData("bottom", bottom);
        tile.setUserData("left", left);
        //Create some default texture coords
        tile.setBounds(new BoundsZPlaneRectangle(tile));
        if (tile != null && tile.hasBounds() && tile.getBounds() instanceof BoundsZPlaneRectangle){
          BoundsZPlaneRectangle bounds = (BoundsZPlaneRectangle) tile.getBounds();
         
//          float width = bounds.getWidthXY(TransformSpace.LOCAL);
//          float height = bounds.getHeightXY(TransformSpace.LOCAL);
//          float upperLeftX = bounds.getVectorsLocal()[0].x;
//          float upperLeftY = bounds.getVectorsLocal()[0].y;
         
//          float upperLeftX = bounds.getVectorsLocal()[0].x  + j* tileWidth ;
//          float upperLeftY = bounds.getVectorsLocal()[0].y  + i * tileHeight;
          Vertex[] verts = tile.getVerticesLocal();
          for (int n = 0; n < verts.length; n++) {
            Vertex vertex = verts[n];
//            vertex.setTexCoordU((vertex.x-upperLeftX )/width);
//            vertex.setTexCoordV((vertex.y-upperLeftY)/height);
//            vertex.setTexCoordU((vertex.x - upperLeftX  + (j * tileWidth)) / p.width);
//            vertex.setTexCoordV((vertex.y - upperLeftY + (i * tileHeight)) / p.height);
           
            vertex.setTexCoordU((vertex.x  + (j * tileWidth)) / p.width);
            vertex.setTexCoordV((vertex.y  + (i * tileHeight)) / p.height);
           
            //System.out.println("TexU:" + vertex.getTexCoordU() + " TexV:" + vertex.getTexCoordV());
          }
          tile.getGeometryInfo().updateTextureBuffer(tile.isUseVBOs());
         
          //Set the texture
          tile.setTexture(p);
//          tile.setNoStroke(true);
//          tile.setStrokeColor(MTColor.GREY);
          tile.setStrokeColor(new MTColor(80,80,80));
          tile.setStrokeWeight(0.7f);
         
          tiles.add(tile);
        }
       
      }
View Full Code Here
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.