DMiner fixes for android

This commit is contained in:
Vadim Lopatin 2016-04-26 10:29:14 +03:00
parent caa09ae56e
commit 95a0d0370d
4 changed files with 18 additions and 14 deletions

View File

@ -94,7 +94,7 @@ X<-----x-----
3 | 2 3 | 2
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_north = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_north =
[ [
0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
-0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, -0.5, 0.5, -0.5, 0.0, 0.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -109,7 +109,7 @@ static const float[VERTEX_COMPONENTS * 4] face_vertices_north =
3 | 2 3 | 2
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_south = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_south =
[ [
-0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, -0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.5, 0.5, 0.5, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -124,7 +124,7 @@ static const float[VERTEX_COMPONENTS * 4] face_vertices_south =
3 | 2 3 | 2
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_west = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_west =
[ [
-0.5, 0.5, -0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, -0.5, 0.5, -0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
-0.5, 0.5, 0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, -0.5, 0.5, 0.5, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -139,7 +139,7 @@ Z<-----x-----
3 | 2 3 | 2
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_east = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_east =
[ [
0.5, 0.5, 0.5, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.5, 0.5, 0.5, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.5, 0.5, -0.5, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.5, 0.5, -0.5, -1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -155,7 +155,7 @@ static const float[VERTEX_COMPONENTS * 4] face_vertices_east =
Zv Zv
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_up = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_up =
[ [
-0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, -0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.5, 0.5, -0.5, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -170,7 +170,7 @@ X<-----x-----
Zv Zv
*/ */
static const float[VERTEX_COMPONENTS * 4] face_vertices_down = __gshared static const float[VERTEX_COMPONENTS * 4] face_vertices_down =
[ [
0.5, -0.5,-0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.5, -0.5,-0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
-0.5, -0.5,-0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, -0.5, -0.5,-0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,
@ -178,12 +178,12 @@ static const float[VERTEX_COMPONENTS * 4] face_vertices_down =
0.5, -0.5, 0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.5, -0.5, 0.5, 0.0, -1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0,
]; ];
static const ushort[6] face_indexes = __gshared static const ushort[6] face_indexes =
[ [
2, 1, 0, 0, 3, 2 // CCW 2, 1, 0, 0, 3, 2 // CCW
]; ];
static const ushort[6] face_indexes_back = __gshared static const ushort[6] face_indexes_back =
[ [
0, 2, 1, 2, 3, 1 0, 2, 1, 2, 3, 1
]; ];

View File

@ -159,7 +159,7 @@ struct Vector3d {
} }
} }
const Vector3d ZERO3 = Vector3d(0, 0, 0); __gshared const Vector3d ZERO3 = Vector3d(0, 0, 0);
struct Array(T) { struct Array(T) {
private: private:
@ -721,7 +721,7 @@ struct Random {
} }
} }
const Vector3d[6] DIRECTION_VECTORS = [ __gshared const Vector3d[6] DIRECTION_VECTORS = [
Vector3d(0, 0, -1), Vector3d(0, 0, -1),
Vector3d(0, 0, 1), Vector3d(0, 0, 1),
Vector3d(-1, 0, 0), Vector3d(-1, 0, 0),

View File

@ -3,7 +3,11 @@ module dminer.core.world;
import dminer.core.minetypes; import dminer.core.minetypes;
import dminer.core.blocks; import dminer.core.blocks;
const int MAX_VIEW_DISTANCE_BITS = 6; version (Android) {
const int MAX_VIEW_DISTANCE_BITS = 6;
} else {
const int MAX_VIEW_DISTANCE_BITS = 5;
}
const int MAX_VIEW_DISTANCE = (1 << MAX_VIEW_DISTANCE_BITS); const int MAX_VIEW_DISTANCE = (1 << MAX_VIEW_DISTANCE_BITS);
// Layer is 16x16 (CHUNK_DX_SHIFT x CHUNK_DX_SHIFT) cells // Layer is 16x16 (CHUNK_DX_SHIFT x CHUNK_DX_SHIFT) cells

View File

@ -444,7 +444,7 @@ class UiWidget : VerticalLayout, CellVisitor {
/// this is OpenGLDrawableDelegate implementation /// this is OpenGLDrawableDelegate implementation
private void doDraw(Rect windowRect, Rect rc) { private void doDraw(Rect windowRect, Rect rc) {
_cam.setPerspective(rc.width, rc.height, 45.0f, 0.1, 100); _cam.setPerspective(rc.width, rc.height, 45.0f, 0.3, MAX_VIEW_DISTANCE);
_cam.setIdentity(); _cam.setIdentity();
_cam.translate(_animatingPosition); _cam.translate(_animatingPosition);
_cam.rotateY(_animatingAngle); _cam.rotateY(_animatingAngle);
@ -453,8 +453,8 @@ class UiWidget : VerticalLayout, CellVisitor {
dirLightNode.translate(_animatingPosition); dirLightNode.translate(_animatingPosition);
dirLightNode.rotateY(_animatingAngle); dirLightNode.rotateY(_animatingAngle);
checkgl!glEnable(GL_CULL_FACE); //checkgl!glEnable(GL_CULL_FACE);
//checkgl!glDisable(GL_CULL_FACE); checkgl!glDisable(GL_CULL_FACE);
checkgl!glEnable(GL_DEPTH_TEST); checkgl!glEnable(GL_DEPTH_TEST);
checkgl!glCullFace(GL_BACK); checkgl!glCullFace(GL_BACK);