本文整理汇总了Java中com.threed.jpct.util.MemoryHelper类的典型用法代码示例。如果您正苦于以下问题:Java MemoryHelper类的具体用法?Java MemoryHelper怎么用?Java MemoryHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemoryHelper类属于com.threed.jpct.util包,在下文中一共展示了MemoryHelper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: drawScene
import com.threed.jpct.util.MemoryHelper; //导入依赖的package包/类
private void drawScene(){
world = new World();
Vector<EditorObject> objects = new Vector<EditorObject>();
Vector<LightData> lights = new Vector<LightData>();
String flagModeSetting = prefs.getString(Settings.FLAG_MODE_SETTING, Settings.FLAG_MODE_FULLSCREEN);
String flagSpeedSetting = prefs.getString(Settings.FLAG_SPEED, "normal");
AssetManager assetManager = FlagWallpaperService.context.getAssets();
objects = Scene.loadSerializedLevel(flagModeSetting+"_"+flagSpeedSetting+".txt", objects, lights, null,null, world, assetManager);
flag = (Scene.findObject(flagModeSetting+"0", objects));
Animator.Play(flag, "wave", objects);
float[] bb = flag.getMesh().getBoundingBox();
float width = Math.abs(bb[0]-bb[1]);
Camera cam = world.getCamera();
float moveout;
if(flagModeSetting.equals(Settings.FLAG_MODE_FULLSCREEN)){
pole = null;
moveout = 30;
cam.setPositionToCenter(flag);
cam.moveCamera(Camera.CAMERA_MOVEOUT, moveout);
// cam.setYFOV(cam.convertRADAngleIntoFOV((float) Math.atan(height/(2*moveout))));
cam.setFOV(cam.convertRADAngleIntoFOV((float) Math.atan(width/(2*moveout))));
cam.lookAt(flag.getTransformedCenter());
}else{
pole = (Scene.findObject("pole", objects));
float height = Math.abs(bb[2]-bb[3]);
moveout = 35;
cam.setPosition(0, 0, 0);
cam.moveCamera(Camera.CAMERA_MOVEOUT, moveout);
cam.moveCamera(Camera.CAMERA_MOVEDOWN, height-5);
cam.setFOV(cam.convertRADAngleIntoFOV((float) Math.atan(width/(2*moveout))));
cam.lookAt(new SimpleVector(width/2, -height/2, 0));
}
Light sun = new Light(world);
SimpleVector sv = new SimpleVector();
sv.set(flag.getTransformedCenter());
sv.y += 100;
sv.x -= 100;
sv.z -= 30;
sun.setPosition(sv);
// sun.disable();
MemoryHelper.compact();
}
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:52,代码来源:FlagRenderer.java
示例2: onSurfaceChanged
import com.threed.jpct.util.MemoryHelper; //导入依赖的package包/类
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
if (master == null) {
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
// Create a texture out of the icon...:-)
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.icon)), 64, 64));
Texture sky_tex = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.raw.sky)), 64, 64));
TextureManager.getInstance().addTexture("texture", texture);
TextureManager.getInstance().addTexture("sky", sky_tex);
/*cube = Primitives.getCube(10);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();
*/
//world.addObject(cube);
//sky = new SkyBox("sky", "sky", "sky", "sky", "sky", "sky", 90.0f);
objects = Scene.loadLevelAE("test.txt", objects, world, assetManager);
cube = Scene.findObject("barrel", objects);
cube.scale(10.0f);
world.addObject(cube);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cube.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();
if (master == null) {
Logger.log("Saving master Activity!");
master = MyWallpaperService.this;
}
}
}
开发者ID:dns,项目名称:LiveWallpaper3D-jPCT-AE,代码行数:54,代码来源:MyWallpaperService.java
注:本文中的com.threed.jpct.util.MemoryHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论