If you think the Android project min3d 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.min3d;
/*www.java2s.com*/import com.min3d.lib.Utils;
import com.min3d.lib.core.Object3d;
import com.min3d.lib.core.RendererActivity;
/**
* XXXXXXXXXXXXXXXXXXX NOT COMPLETE XXXXXXXXXXXXXXXXXXX
* Example of creating an object from scratch.
*
* In the real world, you'd do this synchronously, not on-enter-frame.
*
* I'm building the object frame-by-frame in part to demonstrate how
* adding vertices post-construction is not bad for performance.
*
* Also note that based on the shape of the object made here, it'd be
* optimal to the faces to share vertices, which I'm not bothering
* with here...
*
* @author Lee
*/publicclass ExampleFromScratch extends RendererActivity
{
int _count;
Object3d _currentObject;
publicvoid initScene()
{
_count = 0;
}
@Override
publicvoid updateScene()
{
if (_count % 500 == 0) {
_currentObject = new Object3d(500,500);
_currentObject.normalsEnabled(false);
_currentObject.vertexColorsEnabled(true);
_currentObject.doubleSidedEnabled(true);
scene.addChild(_currentObject);
}
addToObject();
}
privatevoid addToObject()
{
float count = _count % 500;
float rad = 0.5f + (count/500f) * 1.0f;
float x1 = (float)(Math.sin(count * Utils.DEG * 3) * rad);
float z1 = (float)(Math.cos(count * Utils.DEG * 3) * rad);
float y1 = count / 500f;
// _currentObject.vertices().addVertex($pointX, $pointY, $pointZ, $textureU, $textureV, $normalX, $normalY, $normalZ, $colorR, $colorG, $colorB, $colorA);
// .. not bothering with U/V info
}
}