Fix NO_OPENGL configurations, fix imports

This commit is contained in:
Vadim Lopatin 2016-04-07 12:13:06 +03:00
parent ffbd8ad33e
commit 84fe6a3467
20 changed files with 94 additions and 26 deletions

View File

@ -72,7 +72,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>EmbedStandardResources ForceLogs USE_OPENGL</versionids>
<versionids>EmbedStandardResources ForceLogs</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
@ -378,7 +378,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>EmbedStandardResources ForceLogs USE_OPENGL</versionids>
<versionids>EmbedStandardResources ForceLogs</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>

View File

@ -65,8 +65,8 @@
{
"name": "minimal",
"versions": ["EmbedStandardResources", "ForceLogs"],
"versions-posix": ["USE_SDL", "USE_FREETYPE", "USE_OPENGL"],
"versions-windows": ["Unicode"],
"versions-posix": ["USE_SDL", "USE_FREETYPE", "NO_OPENGL"],
"versions-windows": ["Unicode" ,"NO_OPENGL"],
"dependencies-posix": {
"derelict-gl3": "~>1.0.18",
"derelict-sdl2": "~>1.9.7",

View File

@ -72,7 +72,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids> EmbedStandardResources USE_OPENGL</versionids>
<versionids />
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
@ -276,7 +276,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids> EmbedStandardResources</versionids>
<versionids />
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>

View File

@ -29,7 +29,11 @@ extern (C) int UIAppMain(string[] args) {
// create window
Window window = Platform.instance.createWindow("DlangUI example - 3D Application", null, WindowFlag.Resizable, 600, 500);
window.mainWidget = new UiWidget();
static if (ENABLE_OPENGL) {
window.mainWidget = new UiWidget();
} else {
window.mainWidget = new TextWidget("error", "Please build with OpenGL enabled"d);
}
//MeshPart part = new MeshPart();
@ -40,6 +44,8 @@ extern (C) int UIAppMain(string[] args) {
return Platform.instance.enterMessageLoop();
}
static if (ENABLE_OPENGL):
class UiWidget : VerticalLayout, CellVisitor {
this() {
super("OpenGLView");

View File

@ -1,5 +1,8 @@
module dminer.core.blocks;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dminer.core.minetypes;
import dminer.core.world;
import dlangui.graphics.scene.mesh;

View File

@ -1,5 +1,8 @@
module dminer.core.minetypes;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
alias cell_t = ubyte;
immutable cell_t NO_CELL = 0;

View File

@ -1,5 +1,8 @@
module dminer.core.world;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dminer.core.minetypes;
import dminer.core.blocks;
@ -225,8 +228,8 @@ struct DiamondVisitor {
//int index = diamondIndex(v, maxDistBits);
if (visited_ptr[index] == visitedOccupied)// || cell == visitedEmpty)
return;
if (v * position.direction.forward < dist / 3)
return;
//if (v * position.direction.forward < dist / 3)
// return;
Vector3d pos = pos0 + v;
cell_t cell = world.getCell(pos);

View File

@ -59,28 +59,44 @@ version (USE_SDL) {
// no backend selected: set default based on platform
version (Windows) {
// For Windows
enum ENABLE_OPENGL = true;
version (NO_OPENGL) {
enum ENABLE_OPENGL = false;
} else {
enum ENABLE_OPENGL = true;
}
enum BACKEND_SDL = false;
enum BACKEND_X11 = false;
enum BACKEND_DSFML = false;
enum BACKEND_WIN32 = true;
} else version(linux) {
// Default for Linux: use SDL and OpenGL
enum ENABLE_OPENGL = true;
version (NO_OPENGL) {
enum ENABLE_OPENGL = false;
} else {
enum ENABLE_OPENGL = true;
}
enum BACKEND_SDL = true;
enum BACKEND_X11 = false;
enum BACKEND_DSFML = false;
enum BACKEND_WIN32 = false;
} else version(OSX) {
// Default: use SDL and OpenGL
enum ENABLE_OPENGL = true;
version (NO_OPENGL) {
enum ENABLE_OPENGL = false;
} else {
enum ENABLE_OPENGL = true;
}
enum BACKEND_SDL = true;
enum BACKEND_X11 = false;
enum BACKEND_DSFML = false;
enum BACKEND_WIN32 = false;
} else {
// Unknown platform: use SDL and OpenGL
enum ENABLE_OPENGL = true;
version (NO_OPENGL) {
enum ENABLE_OPENGL = false;
} else {
enum ENABLE_OPENGL = true;
}
enum BACKEND_SDL = true;
enum BACKEND_X11 = false;
enum BACKEND_DSFML = false;

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.camera;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.graphics.scene.node;
import dlangui.core.math3d;

View File

@ -1,12 +1,17 @@
module dlangui.graphics.scene.drawableobject;
public import dlangui.core.types;
public import dlangui.graphics.scene.node;
import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.types;
/// Reference counted DrawableObject
alias DrawableObjectRef = Ref!DrawableObject;
class DrawableObject : RefCountedObject {
import dlangui.graphics.scene.node;
this() {
}
void draw(Node3d node, bool wireframe) {

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.fbximport;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.logger;
import dlangui.core.math3d;
import dlangui.dml.tokenizer;

View File

@ -1,8 +1,10 @@
module dlangui.graphics.scene.light;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.math3d;
import dlangui.core.types;
import dlangui.graphics.scene.node;
import std.conv : to;
@ -17,6 +19,8 @@ alias LightRef = Ref!Light;
class Light : RefCountedObject {
import dlangui.graphics.scene.node;
protected Node3d _node;
protected vec3 _color;

View File

@ -1,6 +1,7 @@
module dlangui.graphics.scene.material;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.types;
import dlangui.core.logger;

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.mesh;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.math3d;
import dlangui.core.types;
//import dlangui.graphics.scene.material;

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.model;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.graphics.scene.drawableobject;
import dlangui.graphics.scene.mesh;
import dlangui.graphics.scene.material;

View File

@ -1,16 +1,20 @@
module dlangui.graphics.scene.node;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.math3d;
import dlangui.graphics.scene.transform;
import dlangui.core.collections;
import dlangui.graphics.scene.scene3d;
import dlangui.graphics.scene.drawableobject;
import dlangui.graphics.scene.light;
import dlangui.graphics.scene.camera;
/// 3D scene node
class Node3d : Transform {
import dlangui.core.collections;
import dlangui.graphics.scene.scene3d;
import dlangui.graphics.scene.drawableobject;
import dlangui.graphics.scene.light;
import dlangui.graphics.scene.camera;
protected Node3d _parent;
protected Scene3d _scene;
protected string _id;

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.objimport;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.logger;
import dlangui.core.math3d;
import dlangui.dml.tokenizer;

View File

@ -1,17 +1,21 @@
module dlangui.graphics.scene.scene3d;
import dlangui.core.types;
import dlangui.graphics.scene.node;
import dlangui.graphics.scene.camera;
import dlangui.graphics.scene.light;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
public import dlangui.core.math3d;
import dlangui.core.types;
import dlangui.core.math3d;
import dlangui.graphics.scene.node;
/// Reference counted Scene3d object
alias Scene3dRef = Ref!Scene3d;
/// 3D scene
class Scene3d : Node3d {
import dlangui.graphics.scene.camera;
import dlangui.graphics.scene.light;
protected vec3 _ambientColor;
protected Camera _activeCamera;

View File

@ -1,5 +1,8 @@
module dlangui.graphics.scene.transform;
public import dlangui.core.config;
static if (ENABLE_OPENGL):
import dlangui.core.math3d;
import dlangui.core.types;

View File

@ -47,6 +47,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
module dlangui;
public {
import dlangui.core.config;
import dlangui.core.logger;
import dlangui.core.types;
import dlangui.core.i18n;