It is android version. I got it from first post in this topic.
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 Menu
private static Object3D tile3D; // sample
public static Object3D getNewTile3D(Context context){
if(tile3D == null){
Object3D[] objs = Loader.load3DS(context.getResources().openRawResource(R.raw.tile_box_44faces), 2);
if(objs == null || objs.length == 0) return null;
tile3D = objs[0];
}
return tile3D.cloneObject();
}
Intent i = new Intent(MainAct.this,FieldAct.class);
MainAct.this.startActivity(i);
01-17 06:57:42.272: INFO/ActivityManager(56): Starting activity: Intent { cmp=com.codand.mahjong3d/.FieldAct (has extras) }
01-17 06:57:42.732: DEBUG/dalvikvm(226): GC freed 5997 objects / 378000 bytes in 79ms
01-17 06:57:42.772: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:42.852: DEBUG/dalvikvm(226): GC freed 381 objects / 16128 bytes in 77ms
01-17 06:57:42.862: INFO/dalvikvm-heap(226): Grow heap (frag case) to 4.647MB for 262160-byte allocation
01-17 06:57:42.942: DEBUG/dalvikvm(226): GC freed 4 objects / 136 bytes in 83ms
01-17 06:57:42.992: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.022: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.042: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.142: DEBUG/dalvikvm(226): GC freed 41 objects / 1784 bytes in 68ms
01-17 06:57:43.222: DEBUG/dalvikvm(226): GC freed 28 objects / 1120 bytes in 78ms
01-17 06:57:43.232: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.264: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.292: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.312: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.335: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.442: DEBUG/dalvikvm(226): GC freed 55 objects / 2536 bytes in 73ms
01-17 06:57:43.522: DEBUG/dalvikvm(226): GC freed 42 objects / 1800 bytes in 72ms
01-17 06:57:43.542: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.562: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.582: INFO/jPCT-AE(226): Loading Texture...
01-17 06:57:43.942: DEBUG/dalvikvm(226): GC freed 14819 objects / 505928 bytes in 81ms
01-17 06:57:44.322: DEBUG/dalvikvm(226): GC freed 16729 objects / 571784 bytes in 83ms
01-17 06:57:44.692: DEBUG/dalvikvm(226): GC freed 15323 objects / 523976 bytes in 87ms
01-17 06:57:45.042: DEBUG/dalvikvm(226): GC freed 15319 objects / 523904 bytes in 85ms
01-17 06:57:45.392: DEBUG/dalvikvm(226): GC freed 15320 objects / 523952 bytes in 82ms
01-17 06:57:45.772: DEBUG/dalvikvm(226): GC freed 15282 objects / 523800 bytes in 82ms
01-17 06:57:46.152: DEBUG/dalvikvm(226): GC freed 15284 objects / 523880 bytes in 82ms
01-17 06:57:46.552: DEBUG/dalvikvm(226): GC freed 15242 objects / 523656 bytes in 82ms
01-17 06:57:46.942: DEBUG/dalvikvm(226): GC freed 15240 objects / 523632 bytes in 83ms
01-17 06:57:47.413: DEBUG/dalvikvm(226): GC freed 15206 objects / 523424 bytes in 149ms
01-17 06:57:47.892: DEBUG/dalvikvm(226): GC freed 15134 objects / 522896 bytes in 90ms
01-17 06:57:48.092: DEBUG/libEGL(226): egl.cfg not found, using default config
01-17 06:57:48.102: DEBUG/libEGL(226): loaded /system/lib/egl/libGLES_android.so
01-17 06:57:48.152: INFO/jPCT-AE(226): OpenGL vendor: Android
01-17 06:57:48.152: INFO/jPCT-AE(226): OpenGL renderer: Android PixelFlinger 1.2
01-17 06:57:48.182: INFO/jPCT-AE(226): OpenGL version: OpenGL ES-CM 1.0
01-17 06:57:48.182: INFO/jPCT-AE(226): OpenGL renderer initialized (using 2 texture stages)
01-17 06:57:48.223: INFO/jPCT-AE(226): Loading file from InputStream
01-17 06:57:48.223: INFO/jPCT-AE(226): File from InputStream loaded...2763 bytes
01-17 06:57:48.242: INFO/jPCT-AE(226): Processing new material 01 - Default!
01-17 06:57:48.242: INFO/jPCT-AE(226): Texture named GIFT.PNG added to TextureManager!
01-17 06:57:48.242: INFO/jPCT-AE(226): Processing object from 3DS-file: Tile
01-17 06:57:48.262: INFO/jPCT-AE(226): Object 'Tile_jPCT1' created using 44 polygons and 24 vertices.
01-17 06:57:48.562: DEBUG/dalvikvm(226): GC freed 6214 objects / 366104 bytes in 86ms
01-17 06:57:48.863: INFO/jPCT-AE(226): Adding Lightsource: 0
01-17 06:57:48.863: INFO/jPCT-AE(226): Memory usage before compacting: 3700 KB used out of 4295 KB
01-17 06:57:48.963: DEBUG/dalvikvm(226): GC freed 4503 objects / 324296 bytes in 90ms
01-17 06:57:49.043: DEBUG/dalvikvm(226): GC freed 73 objects / 2312 bytes in 81ms
01-17 06:57:49.207: INFO/jPCT-AE(226): Memory usage after compacting: 3382 KB used out of 4295 KB
01-17 06:57:49.233: INFO/jPCT-AE(226): Subobject of object 2/object4 compiled to flat fixed point data using 132 vertices in 4ms!
01-17 06:57:49.243: INFO/jPCT-AE(226): Object 2/object4 compiled to 1 subobjects in 21ms!
01-17 06:57:49.243: INFO/jPCT-AE(226): Object 'object4' uses one texture set!
01-17 06:57:49.253: INFO/jPCT-AE(226): Object 3/object5 precompiled!
01-17 06:57:49.253: INFO/jPCT-AE(226): Object 'object5' uses one texture set!
01-17 06:57:49.253: INFO/jPCT-AE(226): Object 4/object6 precompiled!
01-17 06:57:49.263: INFO/jPCT-AE(226): Object 'object6' uses one texture set!
01-17 06:57:49.263: INFO/jPCT-AE(226): Object 5/object7 precompiled!
01-17 06:57:49.273: INFO/jPCT-AE(226): Object 'object7' uses one texture set!
01-17 06:57:49.273: INFO/jPCT-AE(226): Object 6/object8 precompiled!
01-17 06:57:49.273: INFO/jPCT-AE(226): Object 'object8' uses one texture set!
01-17 06:57:49.273: INFO/jPCT-AE(226): Object 7/object9 precompiled!
...lines lines lines...
01-17 06:57:49.653: INFO/jPCT-AE(226): Object 59/object61 precompiled!
01-17 06:57:49.653: INFO/jPCT-AE(226): Object 'object61' uses one texture set!
01-17 06:57:49.663: INFO/jPCT-AE(226): Object 60/object62 precompiled!
01-17 06:57:49.663: INFO/jPCT-AE(226): Object 'object62' uses one texture set!
01-17 06:57:49.674: INFO/jPCT-AE(226): Object 61/object63 precompiled!
01-17 06:57:49.674: INFO/jPCT-AE(226): Object 'object63' uses one texture set!
01-17 06:57:49.674: INFO/jPCT-AE(226): [ 1295247469679 ] - WARNING: Object object2 hasn't been build yet. Forcing build()!
01-17 06:57:49.685: INFO/jPCT-AE(226): Subobject of object 62/object64 compiled to flat fixed point data using 6 vertices in 9ms!
01-17 06:57:49.693: INFO/jPCT-AE(226): Object 62/object64 compiled to 1 subobjects in 14ms!
01-17 06:57:49.813: DEBUG/dalvikvm(226): GC freed 1924 objects / 172104 bytes in 106ms
01-17 06:57:50.253: INFO/ARMAssembler(226): generated scanline__000000B7:03010144_00009501_00000000 [126 ipp] (207 ins) at [0x2d5478:0x2d57b4] in 6201067 ns
01-17 06:57:50.323: INFO/jPCT-AE(226): Object 'object39' shares compiled data with object 'object4'
01-17 06:57:50.333: INFO/jPCT-AE(226): Object 'object6' shares compiled data with object 'object4'
01-17 06:57:50.373: INFO/jPCT-AE(226): Object 'object35' shares compiled data with object 'object4'
01-17 06:57:50.373: INFO/jPCT-AE(226): Object 'object31' shares compiled data with object 'object4'
01-17 06:57:50.383: INFO/jPCT-AE(226): Object 'object42' shares compiled data with object 'object4'
01-17 06:57:50.395: INFO/jPCT-AE(226): Object 'object16' shares compiled data with object 'object4'
01-17 06:57:50.413: INFO/jPCT-AE(226): Object 'object58' shares compiled data with object 'object4'
01-17 06:57:50.434: INFO/jPCT-AE(226): Object 'object12' shares compiled data with object 'object4'
01-17 06:57:50.434: INFO/jPCT-AE(226): Object 'object62' shares compiled data with object 'object4'
...lines lines lines...
01-17 06:57:50.883: INFO/jPCT-AE(226): Object 'object29' shares compiled data with object 'object4'
01-17 06:57:50.893: INFO/jPCT-AE(226): Object 'object27' shares compiled data with object 'object4'
01-17 06:57:50.893: INFO/jPCT-AE(226): Object 'object23' shares compiled data with object 'object4'
01-17 06:57:50.904: INFO/jPCT-AE(226): Object 'object51' shares compiled data with object 'object4'
01-17 06:57:50.913: INFO/jPCT-AE(226): Object 'object18' shares compiled data with object 'object4'
01-17 06:57:50.923: INFO/jPCT-AE(226): 0 fps
01-17 06:57:51.163: INFO/ActivityManager(56): Displayed activity com.codand.mahjong3d/.FieldAct: 8855 ms (total 8855 ms)
01-17 06:57:52.093: INFO/jPCT-AE(226): 5 fps
01-17 06:57:53.103: INFO/jPCT-AE(226): 5 fps
01-17 06:57:54.133: INFO/jPCT-AE(226): 5 fps
01-17 06:57:55.273: INFO/jPCT-AE(226): 5 fps
01-17 06:57:56.293: INFO/jPCT-AE(226): 5 fps
01-17 06:57:57.303: INFO/jPCT-AE(226): 5 fps
01-17 06:57:58.362: INFO/jPCT-AE(226): 4 fps
... press BACK button...
01-17 06:58:20.932: WARN/KeyCharacterMap(226): No keyboard for id 0
01-17 06:58:20.942: WARN/KeyCharacterMap(226): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
... start FilendActivity again...
01-17 07:02:02.562: INFO/ActivityManager(56): Starting activity: Intent { cmp=com.codand.mahjong3d/.FieldAct (has extras) }
01-17 07:02:07.062: INFO/jPCT-AE(226): OpenGL vendor: Android
01-17 07:02:07.062: INFO/jPCT-AE(226): OpenGL renderer: Android PixelFlinger 1.2
01-17 07:02:07.072: INFO/jPCT-AE(226): OpenGL version: OpenGL ES-CM 1.0
01-17 07:02:07.072: INFO/jPCT-AE(226): OpenGL renderer initialized (using 2 texture stages)
01-17 07:02:07.492: DEBUG/dalvikvm(226): GC freed 6283 objects / 468952 bytes in 93ms
01-17 07:02:07.502: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.502: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.512: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.522: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.522: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.532: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.542: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.542: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.552: INFO/jPCT-AE(226): 44 polygons in tile
01-17 07:02:07.593: INFO/jPCT-AE(226): Adding Lightsource: 0
01-17 07:02:07.612: INFO/jPCT-AE(226): Memory usage before compacting: 3862 KB used out of 4743 KB
01-17 07:02:07.802: DEBUG/dalvikvm(226): GC freed 1636 objects / 104264 bytes in 179ms
01-17 07:02:07.892: DEBUG/dalvikvm(226): GC freed 72 objects / 2288 bytes in 90ms
01-17 07:02:08.052: INFO/jPCT-AE(226): Memory usage after compacting: 3759 KB used out of 4743 KB
01-17 07:02:08.072: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.072: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.072: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.072: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.072: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.072: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.072: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.072: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.172: INFO/jPCT-AE(226): Additional visibility list (2) created with size: 512
01-17 07:02:08.212: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.212: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.212: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.212: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.212: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.212: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.212: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.212: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.252: INFO/jPCT-AE(226): Additional visibility list (3) created with size: 512
01-17 07:02:08.272: INFO/ActivityManager(56): Displayed activity com.codand.mahjong3d/.FieldAct: 5691 ms (total 5691 ms)
01-17 07:02:08.292: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.292: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.292: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.292: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.292: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.292: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.292: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.292: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.302: INFO/jPCT-AE(226): Additional visibility list (4) created with size: 512
01-17 07:02:08.312: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.312: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.312: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.312: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.312: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.312: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.312: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.312: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.333: INFO/jPCT-AE(226): Additional visibility list (5) created with size: 512
01-17 07:02:08.342: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.342: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.342: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.342: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.342: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.342: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.342: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.342: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.362: INFO/jPCT-AE(226): Additional visibility list (6) created with size: 512
01-17 07:02:08.372: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.372: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.372: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.372: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.372: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.372: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.372: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.372: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.382: INFO/jPCT-AE(226): Additional visibility list (7) created with size: 512
01-17 07:02:08.402: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.402: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.402: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.402: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.402: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.402: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.402: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.402: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.412: INFO/jPCT-AE(226): Additional visibility list (8) created with size: 512
01-17 07:02:08.432: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.432: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.432: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.432: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.432: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.432: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.432: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.432: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.442: INFO/jPCT-AE(226): Additional visibility list (9) created with size: 512
01-17 07:02:08.462: INFO/jPCT-AE(226): java.lang.NullPointerException
01-17 07:02:08.462: INFO/jPCT-AE(226): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-17 07:02:08.462: INFO/jPCT-AE(226): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-17 07:02:08.462: INFO/jPCT-AE(226): at com.threed.jpct.World.compile(World.java:2029)
01-17 07:02:08.462: INFO/jPCT-AE(226): at com.threed.jpct.World.renderScene(World.java:1060)
01-17 07:02:08.462: INFO/jPCT-AE(226): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-17 07:02:08.462: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-17 07:02:08.462: INFO/jPCT-AE(226): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-17 07:02:08.482: INFO/jPCT-AE(226): Additional visibility list (10) created with size: 512
01-16 19:53:03.645: INFO/jPCT-AE(2004): java.lang.NullPointerException
01-16 19:53:03.645: INFO/jPCT-AE(2004): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at com.threed.jpct.World.compile(World.java:2029)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at com.threed.jpct.World.renderScene(World.java:1060)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-16 19:53:03.645: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-16 19:53:03.655: INFO/jPCT-AE(2004): Additional visibility list (32) created with size: 512
01-16 19:53:03.675: INFO/jPCT-AE(2004): java.lang.NullPointerException
01-16 19:53:03.675: INFO/jPCT-AE(2004): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at com.threed.jpct.World.compile(World.java:2029)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at com.threed.jpct.World.renderScene(World.java:1060)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-16 19:53:03.675: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-16 19:53:03.685: INFO/jPCT-AE(2004): Additional visibility list (33) created with size: 512
01-16 19:53:03.705: INFO/jPCT-AE(2004): java.lang.NullPointerException
01-16 19:53:03.705: INFO/jPCT-AE(2004): at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:823)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:134)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at com.threed.jpct.World.compile(World.java:2029)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at com.threed.jpct.World.renderScene(World.java:1060)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at com.codand.mahjong3d.renderer.PlaygroundRenderer.onDrawFrame(PlaygroundRenderer.java:113)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1127)
01-16 19:53:03.705: INFO/jPCT-AE(2004): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
01-16 19:53:03.714: INFO/jPCT-AE(2004): Additional visibility list (34) created with size: 512
package com.codand.mahjong3d.renderer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import com.codand.mahjong3d.entity.Model;
import com.codand.mahjong3d.entity.Tile;
import com.codand.mahjong3d.utils.Utils;
import com.threed.jpct.Camera;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Interact2D;
import com.threed.jpct.Light;
import com.threed.jpct.Logger;
import com.threed.jpct.Matrix;
import com.threed.jpct.Object3D;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.MemoryHelper;
import android.content.Context;
import android.opengl.GLSurfaceView;
public class PlaygroundRenderer implements GLSurfaceView.Renderer,Model.ModelListener{
private static final float TILE_SCALE = (float)10.1;
private static final float TILE_MARGIN = (float)0.0;
private static final int TILE_ICON_SIZE = 60;
private static final int TILE_ICON_X = 10;
private static final int TILE_ICON_Y = 10;
private static final float MIN_CAMERA_MOVE = 150;
private static final float CAMERA_MOVE_STEP = 2;
private static final float BORDER_SIZE = 40;
private static final float SUN_DISTANCE = 1000;
private static final int START_TRANSPARENCY = 4;
private static final int TRANSPARENCY_DECREASE = 3;
private Context context;
private Model model;
private Object3D model3D;
private ArrayList<Object3D> tiles3D;
private HashMap<String,Object3D> tileMap = new HashMap<String,Object3D>();
private float[] boundingBox;
private boolean calcBoundingBox = false;
private Object3D skyPlane;
private long time = System.currentTimeMillis();
private long lastFrameTime;
private float period = 0; // time after last frame in sec
private World world;
private Light sun;
private FrameBuffer fb;
private ArrayList<Object3D> removingObjects = new ArrayList<Object3D>();
private boolean stop;
private boolean isWorldInited = false;
private RGBColor back = new RGBColor(0, 0, 0);
private RGBColor selectionColor = new RGBColor(0,500,0);
private float xImpulse = 0;
private float yImpulse = 0;
private float resist = (float)0.02;
private int fps = 0;
public PlaygroundRenderer(Context context,Model model) {
super();
this.context = context;
this.model = model;
this.model.addListener(this);
}
public Model getModel() {
return model;
}
public void stop(){
stop = true;
}
@Override
public void onDrawFrame(GL10 arg0) {
try {
if (!stop) {
//long testTime = System.currentTimeMillis();
updatePeriod();
processCameraMovement();
removeMarkedObjects();
//Logger.log((System.currentTimeMillis() - testTime) + " dirst functions");
//testTime = System.currentTimeMillis();
fb.clear(back);
//Logger.log((System.currentTimeMillis() - testTime) + " fb.clear(back)");
//testTime = System.currentTimeMillis();
world.renderScene(fb);
//Logger.log((System.currentTimeMillis() - testTime) + " world.renderScene(fb)");
//testTime = System.currentTimeMillis();
world.draw(fb);
//Logger.log((System.currentTimeMillis() - testTime) + " world.draw(fb)");
//testTime = System.currentTimeMillis();
drawSelectionBlitting();
adjustFitness();
//Logger.log((System.currentTimeMillis() - testTime) + " adjustFitness()");
//testTime = System.currentTimeMillis();
fb.display();
//Logger.log((System.currentTimeMillis() - testTime) + " fb.display()");
//testTime = System.currentTimeMillis();
if(Math.abs(xImpulse) > 2*resist){
xImpulse = xImpulse - Math.signum(xImpulse)*resist*period;
}
if (Math.abs(yImpulse) > 2*resist ) {
yImpulse = yImpulse - Math.signum(yImpulse)*resist*period;
}
if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + " fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;
} else {
if (fb != null) {
fb.dispose();
fb = null;
}
}
} catch (Exception e) {
Logger.log(e, Logger.MESSAGE);
}
}
@Override
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
initWorld();
/*
fb = new FrameBuffer(gl, w, h);
world = new World();
world.setAmbientLight(200, 10, 10);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
// Create a texture out of the icon...:-)
if(!TextureManager.getInstance().containsTexture("texture")){
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(context.getResources().getDrawable(R.drawable.test)), 64, 64));
TextureManager.getInstance().addTexture("texture", texture);
}
cube = Primitives.getCube(10);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();
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();
*/
}
@Override
public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) {
//Utils.loadTextures(context);
}
private void initWorld(){
if(model == null) return;
if(world != null){
world.removeAll();
}
world = new World();
world.setAmbientLight(200, 200, 200);
initModel();
initSky();
Camera cam = world.getCamera();
cam.setPosition(model3D.getTransformedCenter());
cam.moveCamera(Camera.CAMERA_MOVEOUT, MIN_CAMERA_MOVE);
cam.lookAt(model3D.getTransformedCenter());
sun = new Light(world);
sun.setIntensity(10, 10, 10);
SimpleVector center = model3D.getTransformedCenter();
SimpleVector dir = cam.getDirection();
dir.scalarMul(-1);
dir.add(cam.getUpVector());
SimpleVector tmp = cam.getSideVector();
tmp.scalarMul(-1);
dir.add(tmp);
dir.scalarMul(SUN_DISTANCE);
center.add(dir);
sun.setPosition(center);
MemoryHelper.compact();
isWorldInited = true;
}
private void initSky(){
skyPlane = new Object3D(2);
float offset = 1000;
skyPlane.addTriangle(new SimpleVector(-offset,-offset,0), 0, 0,
new SimpleVector(-offset,offset,0), 0, 1,
new SimpleVector(offset,offset,0), 1, 1,
TextureManager.getInstance().getTextureID(Utils.SKY_TEXTURE_NAME));
skyPlane.addTriangle(new SimpleVector(offset,offset,0), 1, 1,
new SimpleVector(offset,-offset,0), 1, 0,
new SimpleVector(-offset,-offset,0), 0, 0,
TextureManager.getInstance().getTextureID(Utils.SKY_TEXTURE_NAME));
//skyPlane.setBillboarding(Object3D.BILLBOARDING_ENABLED);
skyPlane.build();
SimpleVector center = model3D.getTransformedCenter();
center.z += 500;
skyPlane.translate(center);
world.addObject(skyPlane);
}
private void deinitModel(){
if(model3D != null){
world.removeObject(model3D);
model3D = null;
}
if(tiles3D != null){
for(int i = 0; i < tiles3D.size();i++){
world.removeObject(tiles3D.get(i));
}
tiles3D.clear();
tileMap.clear();
removingObjects.clear();
}
}
private void initModel(){
deinitModel();
model3D = Object3D.createDummyObj();
List<Tile> tiles = model.getTiles();
Object3D tile3D;
Tile tile;
tiles3D = new ArrayList<Object3D>();
tileMap.clear();
for(int i = 0;i < tiles.size();i++){
tile = tiles.get(i);
tile3D = createTile(tile);
if(i != 0){
tile3D.shareCompiledData(tiles3D.get(0));
}
//tile3D = Primitives.getCube(TILE_SCALE);
//tile3D.setUserObject(tile);
//tile3D.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
//tile3D.rotateY((float)Math.PI/4);
//tile3D.setTransparency(10);
//tile3D.translate(getTileX(tile), getTileY(tile), getTileZ(tile));
//tile3D.calcTextureWrapSpherical();
//tile3D.setTexture(Utils.getTextureByType(tile.type));
//tile3D.strip();
//tile3D.build();
tiles3D.add(tile3D);
tileMap.put(Tile.getTileKey(tile), tile3D);
world.addObject(tile3D);
}
calculateModelBoundingBox();
model3D.translate((boundingBox[1]+boundingBox[0])/2,(boundingBox[2]+boundingBox[3])/2,(boundingBox[4]+boundingBox[5])/2);
//model3D.rotateY((float)Math.PI/4);
world.addObject(model3D);
for(int i = 0;i < tiles3D.size();i++){
model3D.addChild(tiles3D.get(i));
tiles3D.get(i).translate(-(boundingBox[1]+boundingBox[0])/2, -(boundingBox[2]+boundingBox[3])/2, -(boundingBox[4]+boundingBox[5])/2);
}
}
private Object3D createTile(Tile tile){
//Object3D[] objs;
Object3D tile3D = Utils.getNewTile3D(context);
//objs = new Object3D[1];
//tile3D = Primitives.getCube(TILE_SCALE);
//tile3D.rotateY((float)Math.PI/4);
int polygonCount = tile3D.getPolygonManager().getMaxPolygonID();
Logger.log(polygonCount + " polygons in tile");
tile3D.setUserObject(tile);
tile3D.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
tile3D.translate(getTileX(tile), getTileY(tile), getTileZ(tile));
//tile3D.setTransparency(100);
//tile3D.calcTextureWrapSpherical();
tile3D.setTexture(Utils.getTextureByType(tile.type));
//tile3D.setTexture(Utils.getTextureInfoByType(tile.type));
tile3D.strip();
tile3D.build();
return tile3D;
}
private void updatePeriod(){
long curTime = System.currentTimeMillis();
if(lastFrameTime != 0){
period = (float)(curTime-lastFrameTime)/1000;
}
lastFrameTime = curTime;
}
private Object3D get(Tile tile){
String key = Tile.getTileKey(tile);
if(!tileMap.containsKey(key)) return null;
return tileMap.get(key);
}
private void remove(Tile tile){
Object3D tile3D = get(tile);
if(tile3D == null) return;
tile3D.setCollisionMode(Object3D.COLLISION_CHECK_NONE);
removingObjects.add(tile3D);
tiles3D.remove(tile3D);
tileMap.remove(Tile.getTileKey(tile));
}
private void select(Tile tile){
Object3D tile3D = get(tile);
if(tile3D == null) return;
tile3D.setAdditionalColor(selectionColor);
}
private void deselect(Tile tile){
Object3D tile3D = get(tile);
if(tile3D == null) return;
tile3D.clearAdditionalColor();
}
private void calculateModelBoundingBox(){
calcBoundingBox = true;
boundingBox = new float[]{Float.MAX_VALUE,Float.MIN_VALUE,
Float.MAX_VALUE,Float.MIN_VALUE,
Float.MAX_VALUE,Float.MIN_VALUE};
float[] bb;
Object3D tile3D;
for(int i = 0;i < tiles3D.size();i++){
tile3D = tiles3D.get(i);
bb = getBoundingBoxInWorld(tile3D);
boundingBox[0] = bb[0] < boundingBox[0] ? bb[0] : boundingBox[0];
boundingBox[1] = bb[1] > boundingBox[1] ? bb[1] : boundingBox[1];
boundingBox[2] = bb[2] < boundingBox[2] ? bb[2] : boundingBox[2];
boundingBox[3] = bb[3] > boundingBox[3] ? bb[3] : boundingBox[3];
boundingBox[4] = bb[4] < boundingBox[4] ? bb[4] : boundingBox[4];
boundingBox[5] = bb[5] > boundingBox[5] ? bb[5] : boundingBox[5];
}
calcBoundingBox = false;
}
private float[] getBoundingBoxInWorld(Object3D model){
float[] bb = model.getMesh().getBoundingBox();
float[] result = new float[]{Float.MAX_VALUE,Float.MIN_VALUE,
Float.MAX_VALUE,Float.MIN_VALUE,
Float.MAX_VALUE,Float.MIN_VALUE};
SimpleVector tmp;
Matrix trans = model.getWorldTransformation();
tmp = new SimpleVector(bb[0],bb[2],bb[4]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[0],bb[2],bb[5]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[0],bb[3],bb[4]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[0],bb[3],bb[5]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[1],bb[2],bb[4]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[1],bb[2],bb[5]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[1],bb[3],bb[4]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
tmp.set(bb[1],bb[3],bb[5]);
tmp.matMul(trans);
updateBoundingBox(result,tmp.x,tmp.y,tmp.z);
return result;
}
private void updateBoundingBox(float[] result, float x, float y, float z){
result[0] = x < result[0] ? x : result[0];
result[1] = x > result[1] ? x : result[1];
result[2] = y < result[2] ? y : result[2];
result[3] = y > result[3] ? y : result[3];
result[4] = z < result[4] ? z : result[4];
result[5] = z > result[5] ? z : result[5];
}
private void removeMarkedObjects(){
if(removingObjects.isEmpty()) return;
Object3D obj;
int tr;
for(int i = 0;i < removingObjects.size();i++){
obj = removingObjects.get(i);
tr = obj.getTransparency();
if(tr == -1){
obj.setTransparency(START_TRANSPARENCY);
}else{
tr = tr - TRANSPARENCY_DECREASE;
if(tr < 0){
world.removeObject(obj);
removingObjects.remove(obj);
i--;
}else{
obj.setTransparency(tr);
}
}
}
}
private void drawSelectionBlitting(){
Tile tile = model.getSelected();
if(tile == null) return;
String texName = Utils.getTextureByType(tile.type);
Texture tex = TextureManager.getInstance().getTexture(texName);
fb.blit(tex,
0, 0,
TILE_ICON_X, TILE_ICON_Y,
tex.getWidth(), tex.getHeight(),
TILE_ICON_SIZE, TILE_ICON_SIZE, -1, false, null);
}
private void adjustFitness(){
if(calcBoundingBox || isCameraRotating() || boundingBox == null || fb == null) return;
if(world == null) return;
Camera cam = world.getCamera();
float width = fb.getWidth();
float height = fb.getHeight();
boolean moveOut = false;
boolean moveIn = true;
SimpleVector tmp = new SimpleVector();
SimpleVector result = new SimpleVector();
tmp.set(boundingBox[0],boundingBox[2],boundingBox[4]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!isInBounds(result,0,width,0,height)){
moveOut = true;// we need to move camera out
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[0],boundingBox[2],boundingBox[5]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[0],boundingBox[3],boundingBox[4]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[0],boundingBox[3],boundingBox[5]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[1],boundingBox[2],boundingBox[4]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[1],boundingBox[2],boundingBox[5]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[1],boundingBox[3],boundingBox[4]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
tmp.set(boundingBox[1],boundingBox[3],boundingBox[5]);
Interact2D.project3D2D(cam, fb,tmp,result);
if(!moveOut && !isInBounds(result,0,width,0,height)){
moveOut = true;
moveIn = false;
}else if(moveIn && !isInBounds(result,BORDER_SIZE,width - BORDER_SIZE,BORDER_SIZE,height - BORDER_SIZE)){
moveIn = false;
}
if(moveOut){
cam.moveCamera(Camera.CAMERA_MOVEOUT, CAMERA_MOVE_STEP);
}else if(moveIn){
cam.moveCamera(Camera.CAMERA_MOVEIN, CAMERA_MOVE_STEP);
}
}
private boolean isInBounds(SimpleVector point,float minx,float maxx,float miny, float maxy){
if(point == null) return false;
if(point.x < minx || point.x > maxx || point.y < miny || point.y > maxy)return false;
return true;
}
private float getTileX(Tile tile){
return tile.x*(TILE_MARGIN + 2*TILE_SCALE);
}
private float getTileY(Tile tile){
return tile.y*(TILE_MARGIN + 2*TILE_SCALE);
}
private float getTileZ(Tile tile){
return tile.z*(TILE_MARGIN + 2*TILE_SCALE);
}
private void processCameraMovement(){
if(world == null || Math.abs(xImpulse) <= 2*resist && Math.abs(yImpulse) <= 2*resist) return;
float xDir = 0;
if (isCameraRotatingX()) {
xDir = xImpulse*period;
}
float yDir = 0;
if (isCameraRotatingY() ) {
yDir = yImpulse*period;
}
rotateCamera(xDir, yDir);
}
private void rotateCamera(float xDir, float yDir){
Camera cam = world.getCamera();
SimpleVector center = model3D.getTransformedCenter();
float dist = center.distance(cam.getPosition());
float skyDist = center.distance(skyPlane.getTransformedCenter());
cam.setPosition(center);
center = model3D.getTransformedCenter();
center.sub(skyPlane.getTransformedCenter());
skyPlane.translate(center);
cam.rotateX(xDir);
cam.rotateY(yDir);
cam.moveCamera(Camera.CAMERA_MOVEOUT, dist);
center = model3D.getTransformedCenter();
SimpleVector dir = cam.getDirection();
dir.scalarMul(-1);
dir.add(cam.getUpVector());
SimpleVector tmp = cam.getSideVector();
tmp.scalarMul(-1);
dir.add(tmp);
dir.scalarMul(SUN_DISTANCE);
center.add(dir);
sun.setPosition(center);
dir = cam.getDirection();
dir.scalarMul(skyDist);
skyPlane.translate(dir);
skyPlane.align(cam);
}
public Tile pick(int x, int y){
Camera cam = world.getCamera();
SimpleVector dir=Interact2D.reproject2D3DWS(cam, fb, x, y);
Object[] res=world.calcMinDistanceAndObject3D(cam.getPosition(), dir, 10000 /*or whatever*/);
if(res[1] == null) return null;
return (Tile)((Object3D)res[1]).getUserObject();
}
private boolean isCameraRotatingX(){
return Math.abs(xImpulse) > 2*resist ? true: false;
}
private boolean isCameraRotatingY(){
return Math.abs(yImpulse) > 2*resist ? true: false;
}
private boolean isCameraRotating(){
return isCameraRotatingX() || isCameraRotatingY();
}
public void handleMove(float xDir,float yDir){
rotateCamera(xDir, yDir);
}
public void handlePush(float xImp,float yImp){
xImpulse = xImp;
yImpulse = yImp;
}
public void handleStop(){
xImpulse = 0;
yImpulse = 0;
}
// ------------------- listeners --------------------------------
@Override
public void onTileDeselected(Tile tile) {
deselect(tile);
}
@Override
public void onTilePareRemoved(Tile tile0, Tile tile1) {
remove(tile0);
remove(tile1);
}
@Override
public void onTileSelected(Tile tile) {
select(tile);
}
@Override
public void onModelShuffaled() {
if(isWorldInited){
initModel();
}
}
}
Page created in 0.021 seconds with 13 queries.