Пример #1
0
 /**
  * * Name a GameObject in the role of the Player object. Note that this is relevant only for the
  * viewport. If your game is larger than the screen, the viewport will follow the GameObject that
  * has been set as player. <br>
  * You have to add the GameObject to the game before assigning the player role.<br>
  * Only one GameObject can be the player. If you call this method for a second time, the player
  * role will switch to the newly specified object. player.
  *
  * @param player The player that should be added to the game. The location of this player is used
  *     by the viewport.
  */
 public final void setPlayer(MoveableGameObject player) {
   this.player = player;
   if (Viewport.useViewport) {
     Viewport vp = Viewport.getInstance();
     vp.setPlayer(player);
   }
 }
Пример #2
0
 /**
  * Set the dimensions of the game world.<br>
  * By default the dimensions will be set to the size of the screen. If you want to play a larger
  * game world, you can set the dimensions calleing this method in initialize().<br>
  * <b>Note</b>: You also need to set the world dimensions when you use a tile map.
  *
  * @param mapWidth, an int specifying the width of the game world
  * @param mapHeight, an int specifying the height of the game world
  */
 public void setMapDimensions(int mapWidth, int mapHeight) {
   this.mapHeight = mapHeight;
   this.mapWidth = mapWidth;
   if (Viewport.useViewport) {
     Viewport vp = Viewport.getInstance();
     vp.setBounds(0, 0, mapWidth, mapHeight);
   }
 }
  /*
   * Constructor
   */
  GameCanvas(WorldScreen world) {
    this.world = world;
    this.setBackground(Color.black);

    this.v = new Viewport();
    v.setTileMaxX(world.getTmap().getWidthInTiles());
    v.setTileMaxY(world.getTmap().getHeightInTiles());
    v.setBottomMenuHeight(world.getBottomMenuHeight());
  }
Пример #4
0
  /** Rendering and interface methods- */
  public void renderFor(Rendering rendering) {
    final Viewport port = rendering.port;

    for (Mission mission : missions) {
      final Sprite flag = mission.flagSprite();
      if (!port.intersects(flag.position, 2)) continue;
      rendering.addClient(flag);
    }
  }
Пример #5
0
 public void doSequence() { // goes through size^2 generations and then displays the results
   long start = System.currentTimeMillis();
   for (int i = 0;
       i < (Math.pow(2, Math.pow(viewport.arrayW, 2))) / 100000;
       i++) { // uses width as size (must have a square world for this!)
     viewport.doWorldLogic();
   }
   long end = System.currentTimeMillis();
   System.out.println("it took: " + (end - start) + " ms for 1 gen");
   System.out.println("check: " + viewport.check);
   viewport.repaint();
 }
 public void updateViewports(final Viewport leftViewport, final Viewport rightViewport) {
   leftViewport.setViewport(
       Math.round(this.mLeftEyeViewport.x * this.mXPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mLeftEyeViewport.y * this.mYPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mLeftEyeViewport.width * this.mXPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mLeftEyeViewport.height * this.mYPxPerTanAngle * this.mResolutionScale));
   rightViewport.setViewport(
       Math.round(this.mRightEyeViewport.x * this.mXPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mRightEyeViewport.y * this.mYPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mRightEyeViewport.width * this.mXPxPerTanAngle * this.mResolutionScale),
       Math.round(this.mRightEyeViewport.height * this.mYPxPerTanAngle * this.mResolutionScale));
   this.mViewportsChanged = false;
 }
 final boolean method3579(ha var_ha, int i, int i_15_, byte i_16_) {
   anInt10135++;
   if (i_16_ != 103) method45(-105);
   Class162 class162 = method3586((byte) -89, 131072, var_ha);
   if (class162 != null) {
     Viewport viewport = var_ha.o();
     viewport.method1859(
         ((Interactable) this).x, ((Interactable) this).anInt8317, ((Interactable) this).y);
     if (Class357.aBoolean4416)
       return class162.method1420(i_15_, i, viewport, false, 0, ObjectDefinition.anInt3100);
     return class162.method1437(i_15_, i, viewport, false, 0);
   }
   return false;
 }
  public int[][] projectVertices() {
    RenderLD renderData = Client.getRenderLD();
    Viewport render = renderData.getViewport();
    float[] data = render.getFloats();
    ModelLD model = getLDModel();
    double locX = (getLocalX() + 0.5) * 512;
    double locY = (getLocalY() + 0.5) * 512;
    int numVertices =
        Math.min(
            model.getVerticiesX().length,
            Math.min(model.getVerticiesY().length, model.getVerticiesZ().length));
    int[][] screen = new int[numVertices][3];

    float xOff = data[12];
    float yOff = data[13];
    float zOff = data[15];
    float xX = data[0];
    float xY = data[4];
    float xZ = data[8];
    float yX = data[1];
    float yY = data[5];
    float yZ = data[9];
    float zX = data[3];
    float zY = data[7];
    float zZ = data[11];

    int height = Calculations.tileHeight((int) locX, (int) locY);
    for (int index = 0; index < numVertices; index++) {
      int vertexX = (int) (model.getVerticiesX()[index] + locX);
      int vertexY = model.getVerticiesY()[index] + height;
      int vertexZ = (int) (model.getVerticiesZ()[index] + locY);

      float _z = (zOff + (zX * vertexX + zY * vertexY + zZ * vertexZ));
      float _x = (xOff + (xX * vertexX + xY * vertexY + xZ * vertexZ));
      float _y = (yOff + (yX * vertexX + yY * vertexY + yZ * vertexZ));

      float fx = ((float) 256.0 + ((float) 256.0 * _x) / _z);
      float fy = ((float) 166.0 + ((float) 167.0 * _y) / _z);
      if (fx < 520 && fx > 0 && fy < 390 && fy > 50) {
        screen[index][0] = (int) fx;
        screen[index][1] = (int) fy;
        screen[index][2] = 1;
      } else {
        screen[index][0] = -1;
        screen[index][1] = -1;
        screen[index][2] = 0;
      }
    }
    return screen;
  }
Пример #9
0
 public Mission pickedMission(BaseUI UI, Viewport port) {
   Mission closest = null;
   float minDist = Float.POSITIVE_INFINITY;
   for (Mission mission : missions) {
     final Sprite flag = mission.flagSprite();
     float dist = port.isoToScreen(new Vec3D().setTo(flag.position)).z;
     if (port.mouseIntersects(flag.position, 0.5f, UI)) {
       if (dist < minDist) {
         minDist = dist;
         closest = mission;
       }
     }
   }
   return closest;
 }
Пример #10
0
  @Override
  public void update(int screenWidth, int screenHeight, boolean centerCamera) {
    // Fit min size to the screen.
    worldWidth = minWorldWidth;
    worldHeight = minWorldHeight;
    Vector2 scaled = Scaling.fit.apply(worldWidth, worldHeight, screenWidth, screenHeight);

    // Extend in the short direction.
    viewportWidth = Math.round(scaled.x);
    viewportHeight = Math.round(scaled.y);
    if (viewportWidth < screenWidth) {
      float toViewportSpace = viewportHeight / worldHeight;
      float toWorldSpace = worldHeight / viewportHeight;
      float lengthen = (screenWidth - viewportWidth) * toWorldSpace;
      if (maxWorldWidth > 0) lengthen = Math.min(lengthen, maxWorldWidth - minWorldWidth);
      worldWidth += lengthen;
      viewportWidth += Math.round(lengthen * toViewportSpace);
    } else if (viewportHeight < screenHeight) {
      float toViewportSpace = viewportWidth / worldWidth;
      float toWorldSpace = worldWidth / viewportWidth;
      float lengthen = (screenHeight - viewportHeight) * toWorldSpace;
      if (maxWorldHeight > 0) lengthen = Math.min(lengthen, maxWorldHeight - minWorldHeight);
      worldHeight += lengthen;
      viewportHeight += Math.round(lengthen * toViewportSpace);
    }

    // Center.
    viewportX = (screenWidth - viewportWidth) / 2;
    viewportY = (screenHeight - viewportHeight) / 2;

    super.update(screenWidth, screenHeight, centerCamera);
  }
 public void setViewport(Viewport _viewport) {
   if (_viewport != null) { // disconnect from old viewport
     _viewport.setContainer(null);
   }
   mViewport = _viewport;
   if (mViewport != null) { // connect to new Satellite
     mViewport.setContainer(this);
     // resize to show entire view of satellite
     Dimension size = mViewport.getPreferredSize();
     setViewportSize(size);
     // resize the window to fit the image
     setSize(
         size.width + getInsets().left + getInsets().right + 2 * INSET,
         size.height + getInsets().top + getInsets().bottom + 2 * INSET);
   }
 }
Пример #12
0
 private void fillNeighbors() { // fill neighbors with Moore's neighborhood
   neighbors[0] = world.getNorthWest(this.x, this.y).getAlive();
   neighbors[1] = world.getNorth(this.x, this.y).getAlive();
   neighbors[2] = world.getNorthEast(this.x, this.y).getAlive();
   neighbors[3] = world.getEast(this.x, this.y).getAlive();
   neighbors[4] = world.getSouthEast(this.x, this.y).getAlive();
   neighbors[5] = world.getSouth(this.x, this.y).getAlive();
   neighbors[6] = world.getSouthWest(this.x, this.y).getAlive();
   neighbors[7] = world.getWest(this.x, this.y).getAlive();
 }
Пример #13
0
  private TabItem createFaceTabItem() {
    Viewport viewport = new Viewport();
    viewport.setLayout(new VBoxLayout(VBoxLayout.VBoxLayoutAlign.STRETCH));

    headerHtml.setStyleName("studentAccount");
    viewport.add(headerHtml);

    VBoxLayoutData flex = new VBoxLayoutData(10, 0, 0, 0);
    flex.setFlex(1);
    studentDataForm.setScrollMode(Style.Scroll.AUTOY);
    viewport.add(studentDataForm, flex);

    TabItem faceTabItem = new TabItem("Учетная карточка студента");
    faceTabItem.setLayout(new FitLayout());
    faceTabItem.add(viewport);

    return faceTabItem;
  }
  @Override
  public void onSurfaceChanged(GL10 glUnused, int width, int height) {
    // Set the viewport
    Viewport viewport = new Viewport(width, height);
    viewport.apply(glUnused);
    camera.setViewport(viewport);

    // TODO: This is hard coded because the height of the ActionBar isn't currently determinable
    // programatically
    camera.setScreenDisplayOffset(0, 48);

    // Create the FBO for selection
    genFBO(glUnused);

    // Set camera location transformation
    camera.loadIdentityM();

    GLES20.glClearColor(0f, 0f, 0f, 0f);
  }
 public void dispose() {
   super.dispose();
   if (mViewport != null) {
     mViewport.terminate();
     mViewport = null;
   }
   setUniverse(null);
   if (mBackBufferGfx != null) {
     mBackBufferGfx.dispose();
   }
   Logger.log("FramedViewportContainer terminated");
 }
 final Class346_Sub10 method3578(int i, ha var_ha) {
   anInt10129++;
   if (aClass162_10150 == null) return null;
   if (i != -1) method3574((byte) 27);
   Viewport viewport = var_ha.o();
   viewport.method1859(
       (((Interactable) this).x - -((Class346_Sub7_Sub1) this).aShort9910),
       ((Interactable) this).anInt8317,
       (((Class346_Sub7_Sub1) this).aShort9901 + ((Interactable) this).y));
   Class346_Sub10 class346_sub10 = Class282_Sub21.method3013(aBoolean10128, (byte) 113, 1);
   if (!Class357.aBoolean4416)
     aClass162_10150.method1440(
         viewport, (((Class346_Sub10) class346_sub10).aClass346_Sub9Array8353[0]), 0);
   else
     aClass162_10150.method1441(
         viewport,
         (((Class346_Sub10) class346_sub10).aClass346_Sub9Array8353[0]),
         ObjectDefinition.anInt3100,
         0);
   return class346_sub10;
 }
Пример #17
0
  public synchronized void tick() {
    if (!isFollowing()) return;

    if (isDemoMode()) {
      if (hasBeenDemoTrackingFor(DEMO_MODE_FOCUS_TIME_IN_SECONDS + DEMO_MODE_ZOOM_TIME_IN_SECONDS))
        startTrackingRandomLivingThing();
      else if (hasBeenDemoTrackingFor(DEMO_MODE_FOCUS_TIME_IN_SECONDS)) viewport.zoomOut();
    }

    if (target.getLabel().equals("narjillo")) {
      Narjillo narjillo = (Narjillo) target;
      if (narjillo.isDead()) {
        if (isDemoMode()) startTrackingRandomLivingThing();
        else {
          Thing nextClosestNarjillo = locator.findNarjilloAt(narjillo.getPosition());
          if (nextClosestNarjillo == null) {
            stopTracking();
            return;
          } else startTracking(nextClosestNarjillo);
        }
      }
    }

    if (target.getLabel().equals("egg")) {
      Narjillo hatched = ((Egg) target).getHatchedNarjillo();
      if (hatched != null) startTracking(hatched);
      return;
    }

    if (target.getLabel().equals("food_pellet")) {
      Thing eater = ((FoodPellet) target).getEater();
      if (eater != null) startTracking(eater);
      return;
    }

    viewport.centerOn(target);
  }
 public void setViewportSize(Dimension _size) {
   mViewportSize = new Dimension(_size);
   int w = mViewportSize.width + 2 * INSET;
   int h = mViewportSize.height + 2 * INSET;
   // create an off screen buffer for drawing
   if (mBackBufferGfx != null) {
     mBackBufferGfx.dispose(); // free old one
   }
   mBackBufferImg = createImage(w, h);
   Logger.log("Create off-screen buffer of " + w + "x" + h + " (" + mBackBufferImg + ")");
   mBackBufferGfx = mBackBufferImg.getGraphics();
   // Determine the graphics context for the viewport
   mDrawGfx = mBackBufferGfx.create(INSET, INSET, mViewportSize.width, mViewportSize.height);
   mViewport.setActualSize(mViewportSize);
   Logger.log("Viewport resized");
 }
Пример #19
0
  @Override
  public void render(GraphicsContext context, PlayingState state, Viewport view) {
    SpriteBatch batch = context.getBatch();

    final Rectangle size = view.getSizeAndPosition();
    final int width = 80;
    final int height = 32;
    final int xbase = (int) ((size.width / 2) - (width / 2));
    final int ybase = (int) ((size.height / 2) - (height / 2));

    // Draw corners.
    drawTile(batch, xbase - GUI_TILE_SIZE, ybase - GUI_TILE_SIZE, 0, 0);
    drawTile(batch, xbase - GUI_TILE_SIZE, ybase + height, 0, 2);
    drawTile(batch, xbase + width, ybase - GUI_TILE_SIZE, 2, 0);
    drawTile(batch, xbase + width, ybase + height, 2, 2);
    // Draw vertical thingies
    for (int y = 0; y < height; y += GUI_TILE_SIZE) {
      drawTile(batch, xbase - GUI_TILE_SIZE, ybase + y, 0, 1);
      drawTile(batch, xbase + width, ybase + y, 2, 1);
    }
    // Draw horizontal thingies
    for (int x = 0; x < width; x += GUI_TILE_SIZE) {
      drawTile(batch, xbase + x, ybase - GUI_TILE_SIZE, 1, 0);
      drawTile(batch, xbase + x, ybase + height, 1, 2);
    }
    // Draw center
    for (int x = 0; x < width; x += GUI_TILE_SIZE) {
      for (int y = 0; y < height; y += GUI_TILE_SIZE) {
        drawTile(batch, xbase + x, ybase + y, 1, 1);
      }
    }
    // Draw inventory.
    Entity[][] contents = inv.getContents();
    for (int x = 0; x < inv.getWidth(); ++x) {
      for (int y = 0; y < inv.getHeight(); ++y) {
        if (contents[x][y] != null) {
          // XXX: Remove this.
          if (y % 2 == 0) {
            drawTile(batch, xbase + x * GUI_TILE_SIZE, ybase + y * GUI_TILE_SIZE, 3, 0);
          } else {
            drawTile(batch, xbase + x * GUI_TILE_SIZE, ybase + y * GUI_TILE_SIZE, 3, 1);
          }
        }
      }
    }
  }
Пример #20
0
  /**
   * Converts a length from a CSS length or percentage to 'pt'.
   *
   * @param spec the CSS length specification
   * @param whole the value that corresponds to 100%. It is used only when spec is a percentage.
   * @return the length in 'pt'
   */
  public double ptLength(TermLengthOrPercent spec, double whole) {
    float nval = spec.getValue();
    if (spec.isPercentage()) return (whole * nval) / 100;
    else {
      TermLength.Unit unit = spec.getUnit();

      double ret = 0;
      if (unit == TermLength.Unit.pt) {
        ret = nval;
      } else if (unit == TermLength.Unit.in) {
        ret = nval * 72;
      } else if (unit == TermLength.Unit.cm) {
        ret = (nval * 72) / 2.54;
      } else if (unit == TermLength.Unit.mm) {
        ret = (nval * 72) / 25.4;
      } else if (unit == TermLength.Unit.pc) {
        ret = nval * 12;
      } else if (unit == TermLength.Unit.px) {
        ret = (nval * 72) / dpi;
      } else if (unit == TermLength.Unit.em) {
        ret = (em * nval * 72) / dpi; // em is in pixels
      } else if (unit == TermLength.Unit.rem) {
        ret = (rem * nval * 72) / dpi;
      } else if (unit == TermLength.Unit.ex) {
        ret = (ex * nval * 72) / dpi;
      } else if (unit == TermLength.Unit.ch) {
        ret = (ch * nval * 72) / dpi;
      } else if (unit == TermLength.Unit.vw) {
        return (viewport.getVisibleRect().getWidth() * nval * 72) / (100.0 * dpi);
      } else if (unit == TermLength.Unit.vh) {
        return (viewport.getVisibleRect().getHeight() * nval * 72) / (100.0 * dpi);
      } else if (unit == TermLength.Unit.vmin) {
        return (Math.min(
                    viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight())
                * nval
                * 72)
            / (100.0 * dpi);
      } else if (unit == TermLength.Unit.vmax) {
        return (Math.max(
                    viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight())
                * nval
                * 72)
            / (100.0 * dpi);
      }
      return ret;
    }
  }
Пример #21
0
  @Override
  public void actionPerformed(ActionEvent arg0) {

    if (arg0.getSource() == startStop) { // switch to/from editmode
      editMode = !editMode;
      // equence();//TODO do sequence
    } else if (arg0.getSource()
        == screenShot) { // save the image from viewport to the disk (named with date)
      DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd HH_mm_ss");
      Date date = new Date();
      String sDate = dateFormat.format(date);

      try {
        BufferedImage bi = viewport.getImage();
        String path = tPath.getText() + sDate + ".png"; // directory where the screenshot is saved
        System.out.println("PATH: " + path);
        File outputfile = new File(path); // make output file string
        ImageIO.write(bi, "png", outputfile);
      } catch (IOException e) {
        System.out.println("There was a problem saving the image!");
      }
    }
  }
 public void doTimer(TimerTrigger tt) {
   mViewport.paint(mDrawGfx);
   repaint();
 }
 private void checkBoundaries() {
   // Make sure the proposed domain boundaries will not cause plotting issues
   m_viewPort.updateBoudaries();
   mySimpleXYPlot.setDomainBoundaries(m_viewPort.minXY.x, m_viewPort.maxXY.x, BoundaryMode.AUTO);
 }
Пример #24
0
 @Override
 public void performTask() {
   viewport.update();
   scene.paint(viewport);
   sendToScreen(viewport.getImage());
 }
  @Override
  public boolean onTouch(View arg0, MotionEvent event) {
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
      case MotionEvent.ACTION_DOWN: // Start gesture
        firstFinger = new PointF(event.getX(), event.getY());
        mode = ONE_FINGER_DRAG;
        break;
      case MotionEvent.ACTION_UP:
      case MotionEvent.ACTION_POINTER_UP:
        // When the gesture ends, a thread is created to give inertia to the scrolling and zoom
        final Timer t = new Timer();
        t.schedule(
            new TimerTask() {
              @Override
              public void run() {
                while (Math.abs(lastScrolling) > 1f || Math.abs(lastZooming - 1) < 1.01) {
                  lastScrolling *= .8; // speed of scrolling damping
                  m_viewPort.scroll(lastScrolling);
                  lastZooming += (1 - lastZooming) * .2; // speed of zooming damping
                  m_viewPort.zoom(lastZooming);
                  checkBoundaries();
                  try {
                    mySimpleXYPlot.postRedraw();
                  } catch (final InterruptedException e) {
                    e.printStackTrace();
                  }
                  // the thread lives until the scrolling and zooming are imperceptible
                }
              }
            },
            0);

      case MotionEvent.ACTION_POINTER_DOWN: // second finger
        distBetweenFingers = spacing(event);
        // the distance check is done to avoid false alarms
        if (distBetweenFingers > 5f) mode = TWO_FINGERS_DRAG;
        break;
      case MotionEvent.ACTION_MOVE:
        if (mode == ONE_FINGER_DRAG) {
          final PointF oldFirstFinger = firstFinger;
          firstFinger = new PointF(event.getX(), event.getY());
          lastScrolling = oldFirstFinger.x - firstFinger.x;
          m_viewPort.scroll(lastScrolling);
          lastZooming = (firstFinger.y - oldFirstFinger.y) / mySimpleXYPlot.getHeight();
          if (lastZooming < 0) lastZooming = 1 / (1 - lastZooming);
          else lastZooming += 1;
          m_viewPort.zoom(lastZooming);
          checkBoundaries();
          mySimpleXYPlot.redraw();
        }
        //					else if (mode == TWO_FINGERS_DRAG) {
        //						final float oldDist = distBetweenFingers;
        //						distBetweenFingers = spacing(event);
        //						lastZooming = oldDist / distBetweenFingers;
        //						m_viewPort.zoom(lastZooming);
        //						checkBoundaries();
        //						mySimpleXYPlot.redraw();
        //					}
        break;
    }
    return true;
  }
Пример #26
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   image = Bitmap.createBitmap(w, h, Bitmap.Config.ALPHA_8);
   viewport.resize(w, h);
   map.setSize(w, h);
 }
Пример #27
0
  public void draw(StandardProgram prog, Viewport vp) {

    // get handle to vertex shader's vPosition member
    mPositionHandle = prog.getAttributeLocation("vPosition");

    // set the vertext pointer to the front of the buffer
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[0]);
    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, buffers[1]); // draw order

    GLES20.glEnableVertexAttribArray(mPositionHandle);

    // get handle to fragment shader's vColor member
    mColorHandle = prog.getUniformLocation("vColor");

    // texture stuff

    mTextureUniformHandle = prog.getUniformLocation("u_Texture");
    mTextureCoordinateHandle = prog.getAttributeLocation("a_TexCoordinate");
    tm.setTextureToRepeat(R.drawable.blank);
    GLES20.glUniform1i(mTextureUniformHandle, 0);

    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
    GLES20.glEnable(GLES20.GL_BLEND);

    GLES20.glEnableVertexAttribArray(mTextureCoordinateHandle);

    // get handle to shape's transformation matrix
    mMVPMatrixHandle = prog.getUniformLocation("uMVPMatrix");

    // start the position at -1, -1
    Matrix.setIdentityM(mMMatrix, 0);
    Matrix.translateM(mMMatrix, 0, 0, 0, 1.0f); // z index is at the very front

    // ---- draw a puddle

    setBufferPosition(PUDDLE);
    setColor(normalColor);

    setDrawPosition(300f, -300f);

    setScale(9.0f, 7.0f);

    // set up the view matrix and projection matrix
    Matrix.multiplyMM(eyeMatrix, 0, vp.getViewMatrix(), 0, mMMatrix, 0);
    Matrix.multiplyMM(mvpMatrix, 0, vp.getProjMatrix(), 0, eyeMatrix, 0);

    // Apply the projection and view transformation
    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);

    // Draw
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, drawOrder.length, GLES20.GL_UNSIGNED_SHORT, 0);

    // ---- end draw puddle

    // IMPORTANT: Unbind from the buffer when we're done with it.
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);

    // Disable vertex array
    GLES20.glDisableVertexAttribArray(mPositionHandle);
  }
Пример #28
0
 @Override
 protected void onDraw(Canvas canvas) {
   canvas.drawBitmap(image, viewport.getWindow(), viewport.getCanvas(), new Paint());
 }
Пример #29
0
 public void startTracking(Thing target) {
   this.target = target;
   viewport.centerAndZoomOn(target);
 }
Пример #30
0
 public void toggleDemoMode() {
   demoMode = !demoMode;
   if (!isDemoMode()) return;
   viewport.zoomToMaxLevel();
   startTrackingRandomLivingThing();
 }