Ejemplo n.º 1
0
 /**
  * <code>updateWorldBound</code> updates the bounding volume that contains this geometry. The
  * location of the geometry is based on the location of all this node's parents.
  *
  * @see com.jme.scene.Spatial#updateWorldBound()
  */
 public void updateWorldBound() {
   if (target.getModelBound() != null) {
     worldBound =
         target
             .getModelBound()
             .transform(
                 parentGeom.getWorldRotation(),
                 parentGeom.getWorldTranslation(),
                 parentGeom.getWorldScale(),
                 worldBound);
   }
 }
Ejemplo n.º 2
0
  /**
   * <code>setTarget</code> sets the shared data mesh.
   *
   * @param target the TriMesh to share the data.
   */
  public void setTarget(TriangleBatch target) {
    this.target = target;

    for (int i = 0; i < RenderState.RS_MAX_STATE; i++) {
      RenderState renderState = this.target.getRenderState(i);
      if (renderState != null) {
        setRenderState(renderState);
      }
    }
    setCullMode(target.getLocalCullMode());
    setLightCombineMode(target.getLocalLightCombineMode());
    setRenderQueueMode(target.getLocalRenderQueueMode());
    setTextureCombineMode(target.getLocalTextureCombineMode());
    setZOrder(target.getZOrder());
  }
Ejemplo n.º 3
0
 public SharedBatch(TriangleBatch target) {
   this();
   if ((target.getType() & SceneElement.SHAREDBATCH) != 0) {
     setTarget(((SharedBatch) target).getTarget());
   } else {
     setTarget(target);
   }
 }
Ejemplo n.º 4
0
 @Override
 public ColorRGBA getDefaultColor() {
   if (defaultColor == null) {
     return target.getDefaultColor();
   } else {
     return defaultColor;
   }
 }
Ejemplo n.º 5
0
 public void read(JMEImporter e) throws IOException {
   InputCapsule capsule = e.getCapsule(this);
   target = (TriangleBatch) capsule.readSavable("target", null);
   if (target != null && target.parentGeom == null) {
     if (motherMesh == null) {
       motherMesh = new TriMesh("mother");
       motherMesh.clearBatches();
     }
     motherMesh.addBatch(target);
   }
   super.read(e);
 }
Ejemplo n.º 6
0
  /**
   * draw renders the target mesh, at the translation, rotation and scale of this shared mesh.
   *
   * @see com.jme.scene.Spatial#draw(com.jme.renderer.Renderer)
   */
  public void draw(Renderer r) {
    // if this batch is not enabled, don't bother processing it.
    if (!isEnabled()) {
      return;
    }

    if (!r.isProcessingQueue()) {
      if (r.checkAndAdd(this)) return;
    }

    target.parentGeom.getWorldTranslation().set(parentGeom.getWorldTranslation());
    target.parentGeom.getWorldRotation().set(parentGeom.getWorldRotation());
    target.parentGeom.getWorldScale().set(parentGeom.getWorldScale());
    target.setDefaultColor(getDefaultColor());
    System.arraycopy(this.states, 0, target.states, 0, states.length);

    r.draw(target);
  }
Ejemplo n.º 7
0
 public void write(JMEExporter e) throws IOException {
   OutputCapsule capsule = e.getCapsule(this);
   capsule.write(target, "target", null);
   super.write(e);
 }
Ejemplo n.º 8
0
 /** returns the model bound of the target object. */
 public BoundingVolume getModelBound() {
   return target.getModelBound();
 }
Ejemplo n.º 9
0
 /**
  * <code>updateBound</code> recalculates the bounding object assigned to the geometry. This resets
  * it parameters to adjust for any changes to the vertex information.
  */
 public void updateModelBound() {
   if (target.getModelBound() != null) {
     target.updateModelBound();
     updateWorldBound();
   }
 }
Ejemplo n.º 10
0
 /**
  * <code>setModelBound</code> sets the bounding object for this geometry.
  *
  * @param modelBound the bounding object for this geometry.
  */
 public void setModelBound(BoundingVolume modelBound) {
   target.setModelBound(modelBound);
 }
Ejemplo n.º 11
0
 /**
  * <code>getColorBuffer</code> retrieves the float buffer that contains the target geometry's
  * color information.
  *
  * @return the buffer that contains the target geometry's color information.
  */
 public FloatBuffer getColorBuffer() {
   return target.getColorBuffer();
 }
Ejemplo n.º 12
0
 /** <code>getVBOInfo</code> returns the target mesh's vbo info. */
 public VBOInfo getVBOInfo() {
   return target.getVBOInfo();
 }
Ejemplo n.º 13
0
 /**
  * <code>getTextureAsFloatBuffer</code> retrieves the texture buffer of a given texture unit.
  *
  * @param textureUnit the texture unit to check.
  * @return the texture coordinates at the given texture unit.
  */
 public FloatBuffer getTextureBuffer(int textureUnit) {
   return target.getTextureBuffer(textureUnit);
 }
Ejemplo n.º 14
0
 /**
  * <code>getTextureBuffers</code> retrieves the target geometry's texture information contained
  * within a float buffer array.
  *
  * @return the float buffers that contain the target geometry's texture information.
  */
 public ArrayList<FloatBuffer> getTextureBuffers() {
   return target.getTextureBuffers();
 }
Ejemplo n.º 15
0
 public void getTriangle(int index, int[] storage) {
   target.getTriangle(index, storage);
 }
Ejemplo n.º 16
0
 /**
  * Returns the number of triangles the target TriMesh contains.
  *
  * @return The current number of triangles.
  */
 public int getTriangleCount() {
   return target.getTriangleCount();
 }
Ejemplo n.º 17
0
 public int getVertexCount() {
   return target.getVertexCount();
 }
Ejemplo n.º 18
0
 /**
  * <code>getIndexAsBuffer</code> retrieves the target's indices array as an <code>IntBuffer</code>
  * .
  *
  * @return the indices array as an <code>IntBuffer</code>.
  */
 public IntBuffer getIndexBuffer() {
   return target.getIndexBuffer();
 }
Ejemplo n.º 19
0
 @Override
 public FloatBuffer getBinormalBuffer() {
   return target.getBinormalBuffer();
 }
Ejemplo n.º 20
0
 @Override
 public void lockMeshes(Renderer r) {
   target.lockMeshes(r);
 }
Ejemplo n.º 21
0
 /**
  * <code>getVertexBuffer</code> returns the float buffer that contains the target geometry's
  * vertex information.
  *
  * @return the float buffer that contains the target geometry's vertex information.
  */
 public FloatBuffer getVertexBuffer() {
   return target.getVertexBuffer();
 }
Ejemplo n.º 22
0
 @Override
 public FloatBuffer getTangentBuffer() {
   return target.getTangentBuffer();
 }
Ejemplo n.º 23
0
 /**
  * <code>getNormalBuffer</code> retrieves the target geometry's normal information as a float
  * buffer.
  *
  * @return the float buffer containing the target geometry information.
  */
 public FloatBuffer getNormalBuffer() {
   return target.getNormalBuffer();
 }