Android Open Source - android-plotter Base Cube From Project Back to project page android-plotter .
License The source code is released under:
Apache License
If you think the Android project android-plotter 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 org.solovyev.android.plotter.meshes;
/ * f r o m w w w . j a v a 2 s . c o m * /
import org.solovyev.android.plotter.Color;
import org.solovyev.android.plotter.MeshConfig;
import javax.annotation.Nonnull;
import javax.microedition.khronos.opengles.GL11;
public abstract class BaseCube extends BaseMesh {
protected final float width;
protected final float height;
protected final float depth;
public BaseCube(float width, float height, float depth) {
this.width = width;
this.height = height;
this.depth = depth;
}
@Override
public void onInitGl(@Nonnull GL11 gl, @Nonnull MeshConfig config) {
super.onInitGl(gl, config);
final float x = width / 2;
final float y = height / 2;
final float z = depth / 2;
final float vertices[] = {
-x, -y, -z, // 0
x, -y, -z, // 1
x, y, -z, // 2
-x, y, -z, // 3
-x, -y, z, // 4
x, -y, z, // 5
x, y, z, // 6
-x, y, z// 7
};
setVertices(vertices);
}
@Nonnull
protected static float [] rainbowVertices() {
final float colors[] = new float [8 * Color.COMPONENTS];
Color.fillVertex(colors, 0, Color.RED);
Color.fillVertex(colors, 1, Color.GREEN);
Color.fillVertex(colors, 2, Color.BLUE);
Color.fillVertex(colors, 3, Color.BLACK);
Color.fillVertex(colors, 4, Color.WHITE);
Color.fillVertex(colors, 5, Color.MAGENTA);
Color.fillVertex(colors, 6, Color.GRAY);
Color.fillVertex(colors, 7, Color.CYAN);
return colors;
}
@Override
public String toString() {
return "Cube(" + width + ", " + height + ", " + depth + ")" ;
}
}
Java Source Code List com.android.texample.GLText.java com.android.texample.SpriteBatch.java com.android.texample.TexampleRenderer.java com.android.texample.TextureRegion.java com.android.texample.Vertices.java org.solovyev.android.plotter.Angle.java org.solovyev.android.plotter.AxisStyle.java org.solovyev.android.plotter.Check.java org.solovyev.android.plotter.Color.java org.solovyev.android.plotter.DefaultPlotter.java org.solovyev.android.plotter.Dimensions.java org.solovyev.android.plotter.Frustum.java org.solovyev.android.plotter.Function0.java org.solovyev.android.plotter.Function1.java org.solovyev.android.plotter.Function2.java org.solovyev.android.plotter.Function.java org.solovyev.android.plotter.LineStyle.java org.solovyev.android.plotter.MeshConfig.java org.solovyev.android.plotter.MultisampleConfigChooser.java org.solovyev.android.plotter.PinchZoomTracker.java org.solovyev.android.plotter.PlotData.java org.solovyev.android.plotter.PlotFunction.java org.solovyev.android.plotter.PlotRenderer.java org.solovyev.android.plotter.PlotView.java org.solovyev.android.plotter.Plot.java org.solovyev.android.plotter.Plotter.java org.solovyev.android.plotter.PlottingView.java org.solovyev.android.plotter.Spf.java org.solovyev.android.plotter.SuperFunction.java org.solovyev.android.plotter.TouchHandler.java org.solovyev.android.plotter.ZoomLevels.java org.solovyev.android.plotter.Zoomer.java org.solovyev.android.plotter.app.MainActivity.java org.solovyev.android.plotter.app.PlotterApplication.java org.solovyev.android.plotter.meshes.Arrays.java org.solovyev.android.plotter.meshes.AxisGrid.java org.solovyev.android.plotter.meshes.Axis.java org.solovyev.android.plotter.meshes.BaseCube.java org.solovyev.android.plotter.meshes.BaseCurve.java org.solovyev.android.plotter.meshes.BaseMesh.java org.solovyev.android.plotter.meshes.BaseSurface.java org.solovyev.android.plotter.meshes.DimensionsAwareSwapper.java org.solovyev.android.plotter.meshes.DimensionsAware.java org.solovyev.android.plotter.meshes.DoubleBufferGroup.java org.solovyev.android.plotter.meshes.DoubleBufferMesh.java org.solovyev.android.plotter.meshes.FunctionGraph2d.java org.solovyev.android.plotter.meshes.FunctionGraph3d.java org.solovyev.android.plotter.meshes.FunctionGraphSwapper.java org.solovyev.android.plotter.meshes.FunctionGraph.java org.solovyev.android.plotter.meshes.Graph.java org.solovyev.android.plotter.meshes.Group.java org.solovyev.android.plotter.meshes.IndicesOrder.java org.solovyev.android.plotter.meshes.ListGroup.java org.solovyev.android.plotter.meshes.ListPool.java org.solovyev.android.plotter.meshes.Mesh.java org.solovyev.android.plotter.meshes.Meshes.java org.solovyev.android.plotter.meshes.Pool.java org.solovyev.android.plotter.meshes.Scene.java org.solovyev.android.plotter.meshes.SolidCube.java org.solovyev.android.plotter.meshes.SurfaceInitializer.java org.solovyev.android.plotter.meshes.WireFrameCube.java