Android Open Source - model-explorer Triangle List






From Project

Back to project page model-explorer.

License

The source code is released under:

Apache License

If you think the Android project model-explorer 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.etaoin.myopengltest.util.geometry;
/*from   ww  w  .j  a  v  a  2  s  . c o  m*/
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import java.util.ArrayList;
import java.util.List;

public class TriangleList extends ArrayList<Face> {

  public static final int VERTICES_PER_FACE = 3;

  // TODO This constant is repeated a few times...
  private static final int BYTES_PER_SHORT = 3;

  public ShortBuffer toShortBuffer() {
    int verticesCount = size() * VERTICES_PER_FACE;
    short[] vertexIndices = new short[verticesCount];
    for (int i = 0; i < size(); i++) {
      List<Integer> faceVertexIndices = get(i).getVertexIndices();
      for (int j = 0; j < VERTICES_PER_FACE; j++) {
        vertexIndices[3 * i + j] = faceVertexIndices.get(j).shortValue();
      }
    }
    ByteBuffer drawListByteBuffer = ByteBuffer.allocateDirect(vertexIndices.length * BYTES_PER_SHORT);
    drawListByteBuffer.order(ByteOrder.nativeOrder());
    ShortBuffer drawListBuffer = drawListByteBuffer.asShortBuffer();
    drawListBuffer.put(vertexIndices);
    drawListBuffer.position(0);

    return drawListBuffer;
  }
}




Java Source Code List

com.etaoin.myopengltest.core.main.activity.MainGLActivity.java
com.etaoin.myopengltest.core.main.context.ContextManager.java
com.etaoin.myopengltest.core.main.context.Context.java
com.etaoin.myopengltest.core.main.context.GameContext.java
com.etaoin.myopengltest.core.main.events.UserEvent.java
com.etaoin.myopengltest.core.main.renderers.MainGLRenderer.java
com.etaoin.myopengltest.core.main.views.MainGLSurfaceView.java
com.etaoin.myopengltest.util.camera.Camera.java
com.etaoin.myopengltest.util.geometry.Face.java
com.etaoin.myopengltest.util.geometry.TriangleList.java
com.etaoin.myopengltest.util.geometry.Vector3List.java
com.etaoin.myopengltest.util.geometry.Vector3.java
com.etaoin.myopengltest.util.gl.MyGLES20DebugAll.java
com.etaoin.myopengltest.util.gl.MyGLES20DebugNone.java
com.etaoin.myopengltest.util.gl.MyGLES20Factory.java
com.etaoin.myopengltest.util.gl.MyGLES20.java
com.etaoin.myopengltest.util.gl.MyGenericGLES20.java
com.etaoin.myopengltest.util.io.FileReader.java
com.etaoin.myopengltest.util.io.ModelParserFactory.java
com.etaoin.myopengltest.util.io.ModelParser.java
com.etaoin.myopengltest.util.io.obj.ObjParser.java
com.etaoin.myopengltest.util.light.PointLight.java
com.etaoin.myopengltest.util.shaders.SampleFragmentShader.java
com.etaoin.myopengltest.util.shaders.SampleVertexShader.java
com.etaoin.myopengltest.util.shaders.ShaderFactory.java
com.etaoin.myopengltest.util.shaders.Shader.java
com.etaoin.myopengltest.util.shapes.Axis.java
com.etaoin.myopengltest.util.shapes.Background.java
com.etaoin.myopengltest.util.shapes.Drawable.java
com.etaoin.myopengltest.util.shapes.Model.java