Android Open Source - RubeLoader Rube Vertex Array






From Project

Back to project page RubeLoader.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...

If you think the Android project RubeLoader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gushikustudios.rube.loader.serializers.utils;
/*www . ja v a  2s .  c  om*/
import com.badlogic.gdx.math.Vector2;

/**
 * Used for serialize/unserialize vertex arrays stored with coordinates in separate arrays. <br/>
 * Example :  <br/>
 *  {<br/>
 *    "x" : [ 0.50, 0.50, -0.50, -0.50 ],<br/>
 *    "y" : [ -0.50, 0.50, 0.50, -0.50 ]<br/>
 *  }<br/>
 * 
 * @author clement.vayer
 *
 */
public class RubeVertexArray 
{
  public float x[];
  public float y[];
  
  /**
   * 
   * @return a new Vector2 Array. Can be null if x and y don't meet the requirement
   */
  public Vector2[] toVector2()
  {
    // length of x and y should be the same and not null
    if((x == null || y == null) || x.length != y.length || x.length == 0)
      return null;
    
    Vector2[] vertices = new Vector2[x.length];
    for(int i=0; i < x.length; ++i)
    {
      Vector2 vector = new Vector2(x[i], y[i]);
      vertices[i] =vector;
    }
    return vertices;
  }
}




Java Source Code List

com.gushikustudios.rube.MainActivity.java
com.gushikustudios.rube.PolySpatial.java
com.gushikustudios.rube.PolySpatial.java
com.gushikustudios.rube.RubeDefaults.java
com.gushikustudios.rube.RubeLoaderTestDesktop.java
com.gushikustudios.rube.RubeLoaderTestDesktop.java
com.gushikustudios.rube.RubeLoaderTest.java
com.gushikustudios.rube.RubeLoaderTest.java
com.gushikustudios.rube.RubeScene.java
com.gushikustudios.rube.SimpleSpatial.java
com.gushikustudios.rube.SimpleSpatial.java
com.gushikustudios.rube.loader.RubeSceneAsyncLoader.java
com.gushikustudios.rube.loader.RubeSceneLoader.java
com.gushikustudios.rube.loader.RubeSceneSyncLoader.java
com.gushikustudios.rube.loader.serializers.BodySerializer.java
com.gushikustudios.rube.loader.serializers.FixtureSerializer.java
com.gushikustudios.rube.loader.serializers.ImageSerializer.java
com.gushikustudios.rube.loader.serializers.JointSerializer.java
com.gushikustudios.rube.loader.serializers.RubeWorldSerializer.java
com.gushikustudios.rube.loader.serializers.Vector2Serializer.java
com.gushikustudios.rube.loader.serializers.WorldSerializer.java
com.gushikustudios.rube.loader.serializers.utils.RubeImage.java
com.gushikustudios.rube.loader.serializers.utils.RubeVertexArray.java