mirror of https://github.com/buggins/dlangui.git
Fix NO_OPENGL configurations, fix imports
This commit is contained in:
parent
ffbd8ad33e
commit
84fe6a3467
|
@ -72,7 +72,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>EmbedStandardResources ForceLogs USE_OPENGL</versionids>
|
<versionids>EmbedStandardResources ForceLogs</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>EmbedStandardResources ForceLogs USE_OPENGL</versionids>
|
<versionids>EmbedStandardResources ForceLogs</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
|
4
dub.json
4
dub.json
|
@ -65,8 +65,8 @@
|
||||||
{
|
{
|
||||||
"name": "minimal",
|
"name": "minimal",
|
||||||
"versions": ["EmbedStandardResources", "ForceLogs"],
|
"versions": ["EmbedStandardResources", "ForceLogs"],
|
||||||
"versions-posix": ["USE_SDL", "USE_FREETYPE", "USE_OPENGL"],
|
"versions-posix": ["USE_SDL", "USE_FREETYPE", "NO_OPENGL"],
|
||||||
"versions-windows": ["Unicode"],
|
"versions-windows": ["Unicode" ,"NO_OPENGL"],
|
||||||
"dependencies-posix": {
|
"dependencies-posix": {
|
||||||
"derelict-gl3": "~>1.0.18",
|
"derelict-gl3": "~>1.0.18",
|
||||||
"derelict-sdl2": "~>1.9.7",
|
"derelict-sdl2": "~>1.9.7",
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids> EmbedStandardResources USE_OPENGL</versionids>
|
<versionids />
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
@ -276,7 +276,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids> EmbedStandardResources</versionids>
|
<versionids />
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
|
|
@ -29,7 +29,11 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
Window window = Platform.instance.createWindow("DlangUI example - 3D Application", null, WindowFlag.Resizable, 600, 500);
|
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();
|
//MeshPart part = new MeshPart();
|
||||||
|
|
||||||
|
@ -40,6 +44,8 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
return Platform.instance.enterMessageLoop();
|
return Platform.instance.enterMessageLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
class UiWidget : VerticalLayout, CellVisitor {
|
class UiWidget : VerticalLayout, CellVisitor {
|
||||||
this() {
|
this() {
|
||||||
super("OpenGLView");
|
super("OpenGLView");
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dminer.core.blocks;
|
module dminer.core.blocks;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dminer.core.minetypes;
|
import dminer.core.minetypes;
|
||||||
import dminer.core.world;
|
import dminer.core.world;
|
||||||
import dlangui.graphics.scene.mesh;
|
import dlangui.graphics.scene.mesh;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dminer.core.minetypes;
|
module dminer.core.minetypes;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
alias cell_t = ubyte;
|
alias cell_t = ubyte;
|
||||||
|
|
||||||
immutable cell_t NO_CELL = 0;
|
immutable cell_t NO_CELL = 0;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dminer.core.world;
|
module dminer.core.world;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dminer.core.minetypes;
|
import dminer.core.minetypes;
|
||||||
import dminer.core.blocks;
|
import dminer.core.blocks;
|
||||||
|
|
||||||
|
@ -225,8 +228,8 @@ struct DiamondVisitor {
|
||||||
//int index = diamondIndex(v, maxDistBits);
|
//int index = diamondIndex(v, maxDistBits);
|
||||||
if (visited_ptr[index] == visitedOccupied)// || cell == visitedEmpty)
|
if (visited_ptr[index] == visitedOccupied)// || cell == visitedEmpty)
|
||||||
return;
|
return;
|
||||||
if (v * position.direction.forward < dist / 3)
|
//if (v * position.direction.forward < dist / 3)
|
||||||
return;
|
// return;
|
||||||
Vector3d pos = pos0 + v;
|
Vector3d pos = pos0 + v;
|
||||||
cell_t cell = world.getCell(pos);
|
cell_t cell = world.getCell(pos);
|
||||||
|
|
||||||
|
|
|
@ -59,28 +59,44 @@ version (USE_SDL) {
|
||||||
// no backend selected: set default based on platform
|
// no backend selected: set default based on platform
|
||||||
version (Windows) {
|
version (Windows) {
|
||||||
// For 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_SDL = false;
|
||||||
enum BACKEND_X11 = false;
|
enum BACKEND_X11 = false;
|
||||||
enum BACKEND_DSFML = false;
|
enum BACKEND_DSFML = false;
|
||||||
enum BACKEND_WIN32 = true;
|
enum BACKEND_WIN32 = true;
|
||||||
} else version(linux) {
|
} else version(linux) {
|
||||||
// Default for Linux: use SDL and OpenGL
|
// 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_SDL = true;
|
||||||
enum BACKEND_X11 = false;
|
enum BACKEND_X11 = false;
|
||||||
enum BACKEND_DSFML = false;
|
enum BACKEND_DSFML = false;
|
||||||
enum BACKEND_WIN32 = false;
|
enum BACKEND_WIN32 = false;
|
||||||
} else version(OSX) {
|
} else version(OSX) {
|
||||||
// Default: use SDL and OpenGL
|
// 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_SDL = true;
|
||||||
enum BACKEND_X11 = false;
|
enum BACKEND_X11 = false;
|
||||||
enum BACKEND_DSFML = false;
|
enum BACKEND_DSFML = false;
|
||||||
enum BACKEND_WIN32 = false;
|
enum BACKEND_WIN32 = false;
|
||||||
} else {
|
} else {
|
||||||
// Unknown platform: use SDL and OpenGL
|
// 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_SDL = true;
|
||||||
enum BACKEND_X11 = false;
|
enum BACKEND_X11 = false;
|
||||||
enum BACKEND_DSFML = false;
|
enum BACKEND_DSFML = false;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.camera;
|
module dlangui.graphics.scene.camera;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.graphics.scene.node;
|
import dlangui.graphics.scene.node;
|
||||||
|
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
module dlangui.graphics.scene.drawableobject;
|
module dlangui.graphics.scene.drawableobject;
|
||||||
|
|
||||||
public import dlangui.core.types;
|
import dlangui.core.config;
|
||||||
public import dlangui.graphics.scene.node;
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
|
import dlangui.core.types;
|
||||||
|
|
||||||
/// Reference counted DrawableObject
|
/// Reference counted DrawableObject
|
||||||
alias DrawableObjectRef = Ref!DrawableObject;
|
alias DrawableObjectRef = Ref!DrawableObject;
|
||||||
|
|
||||||
class DrawableObject : RefCountedObject {
|
class DrawableObject : RefCountedObject {
|
||||||
|
|
||||||
|
import dlangui.graphics.scene.node;
|
||||||
|
|
||||||
this() {
|
this() {
|
||||||
}
|
}
|
||||||
void draw(Node3d node, bool wireframe) {
|
void draw(Node3d node, bool wireframe) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.fbximport;
|
module dlangui.graphics.scene.fbximport;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.logger;
|
import dlangui.core.logger;
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
import dlangui.dml.tokenizer;
|
import dlangui.dml.tokenizer;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
module dlangui.graphics.scene.light;
|
module dlangui.graphics.scene.light;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
import dlangui.core.types;
|
import dlangui.core.types;
|
||||||
import dlangui.graphics.scene.node;
|
|
||||||
|
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
|
|
||||||
|
@ -17,6 +19,8 @@ alias LightRef = Ref!Light;
|
||||||
|
|
||||||
class Light : RefCountedObject {
|
class Light : RefCountedObject {
|
||||||
|
|
||||||
|
import dlangui.graphics.scene.node;
|
||||||
|
|
||||||
protected Node3d _node;
|
protected Node3d _node;
|
||||||
|
|
||||||
protected vec3 _color;
|
protected vec3 _color;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module dlangui.graphics.scene.material;
|
module dlangui.graphics.scene.material;
|
||||||
|
|
||||||
public import dlangui.core.config;
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.types;
|
import dlangui.core.types;
|
||||||
import dlangui.core.logger;
|
import dlangui.core.logger;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.mesh;
|
module dlangui.graphics.scene.mesh;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
import dlangui.core.types;
|
import dlangui.core.types;
|
||||||
//import dlangui.graphics.scene.material;
|
//import dlangui.graphics.scene.material;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.model;
|
module dlangui.graphics.scene.model;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.graphics.scene.drawableobject;
|
import dlangui.graphics.scene.drawableobject;
|
||||||
import dlangui.graphics.scene.mesh;
|
import dlangui.graphics.scene.mesh;
|
||||||
import dlangui.graphics.scene.material;
|
import dlangui.graphics.scene.material;
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
module dlangui.graphics.scene.node;
|
module dlangui.graphics.scene.node;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
|
|
||||||
import dlangui.graphics.scene.transform;
|
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
|
/// 3D scene node
|
||||||
class Node3d : Transform {
|
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 Node3d _parent;
|
||||||
protected Scene3d _scene;
|
protected Scene3d _scene;
|
||||||
protected string _id;
|
protected string _id;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.objimport;
|
module dlangui.graphics.scene.objimport;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.logger;
|
import dlangui.core.logger;
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
import dlangui.dml.tokenizer;
|
import dlangui.dml.tokenizer;
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
module dlangui.graphics.scene.scene3d;
|
module dlangui.graphics.scene.scene3d;
|
||||||
|
|
||||||
import dlangui.core.types;
|
public import dlangui.core.config;
|
||||||
import dlangui.graphics.scene.node;
|
static if (ENABLE_OPENGL):
|
||||||
import dlangui.graphics.scene.camera;
|
|
||||||
import dlangui.graphics.scene.light;
|
|
||||||
|
|
||||||
public import dlangui.core.math3d;
|
import dlangui.core.types;
|
||||||
|
|
||||||
|
import dlangui.core.math3d;
|
||||||
|
import dlangui.graphics.scene.node;
|
||||||
|
|
||||||
/// Reference counted Scene3d object
|
/// Reference counted Scene3d object
|
||||||
alias Scene3dRef = Ref!Scene3d;
|
alias Scene3dRef = Ref!Scene3d;
|
||||||
|
|
||||||
|
|
||||||
/// 3D scene
|
/// 3D scene
|
||||||
class Scene3d : Node3d {
|
class Scene3d : Node3d {
|
||||||
|
import dlangui.graphics.scene.camera;
|
||||||
|
import dlangui.graphics.scene.light;
|
||||||
|
|
||||||
protected vec3 _ambientColor;
|
protected vec3 _ambientColor;
|
||||||
protected Camera _activeCamera;
|
protected Camera _activeCamera;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
module dlangui.graphics.scene.transform;
|
module dlangui.graphics.scene.transform;
|
||||||
|
|
||||||
|
public import dlangui.core.config;
|
||||||
|
static if (ENABLE_OPENGL):
|
||||||
|
|
||||||
import dlangui.core.math3d;
|
import dlangui.core.math3d;
|
||||||
import dlangui.core.types;
|
import dlangui.core.types;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
||||||
module dlangui;
|
module dlangui;
|
||||||
|
|
||||||
public {
|
public {
|
||||||
|
import dlangui.core.config;
|
||||||
import dlangui.core.logger;
|
import dlangui.core.logger;
|
||||||
import dlangui.core.types;
|
import dlangui.core.types;
|
||||||
import dlangui.core.i18n;
|
import dlangui.core.i18n;
|
||||||
|
|
Loading…
Reference in New Issue