Silly me, thank you.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menupackage com.threed.jpct.example;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Matrix;
import com.threed.jpct.Object3D;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;
class MyRenderer implements GLSurfaceView.Renderer {
private FrameBuffer fb = null;
public World world = null;
public World terrainWorld = null;
private RGBColor back = new RGBColor(50, 50, 100);
private HelloWorld king;
public void setKing(HelloWorld a) {
king = a;
}
public MyRenderer() {
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
try {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
if (king.master == null) {
terrainWorld = new World();
terrainWorld.setAmbientLight(100, 100, 100);
Light[] lizatka = new Light[3];
for (int i = 0; i < 3; i++)
lizatka[i] = new Light(terrainWorld);
SimpleVector moveVec = new SimpleVector();
moveVec.x = -8f;
moveVec.z = 2f;
moveVec.y = -2;
lizatka[0].setPosition(moveVec);
lizatka[0].setIntensity(85, 85, 85);
moveVec.x = 8f;
lizatka[1].setPosition(moveVec);
lizatka[1].setIntensity(85, 85, 85);
moveVec = new SimpleVector(0, -5, 0);
lizatka[2].setPosition(moveVec);
lizatka[2].setIntensity(85, 85, 85);
Object3D [] terrain = Loader.load3DS(king.getAssets().open("index.3ds"), 1f);
for(Object3D obj : terrain){
obj.setVisibility(true);
obj.setAdditionalColor(RGBColor.RED);
obj.setCenter(SimpleVector.ORIGIN);
obj.rotateX((float) (-.5 * Math.PI));
obj.rotateMesh();
obj.setRotationMatrix(new Matrix());
}
terrainWorld.addObjects(terrain);
terrainWorld.renderScene(fb);
terrainWorld.getCamera().setPosition(0, -4, -10);
terrainWorld.getCamera().lookAt(terrain[6].getTransformedCenter());
MemoryHelper.compact();
}
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}
public void onDrawFrame(GL10 gl) {
fb.clear(back);
terrainWorld.draw(fb);
fb.display();
}
}
Page created in 0.052 seconds with 12 queries.