mirror of https://github.com/buggins/dlangui.git
fixes for #183
This commit is contained in:
parent
84c9dc4e4e
commit
698e3bc36e
|
@ -19,18 +19,24 @@ Authors: Vadim Lopatin, coolreader.org@gmail.com
|
|||
module dlangui.graphics.glsupport;
|
||||
|
||||
public import dlangui.core.config;
|
||||
|
||||
static if (ENABLE_OPENGL):
|
||||
|
||||
public import dlangui.core.math3d;
|
||||
import dlangui.graphics.scene.mesh;
|
||||
|
||||
import dlangui.core.logger;
|
||||
import derelict.opengl3.gl;
|
||||
import dlangui.core.types;
|
||||
|
||||
import std.conv;
|
||||
import std.string;
|
||||
import std.array;
|
||||
|
||||
public import derelict.opengl3.types;
|
||||
public import derelict.opengl3.gl3;
|
||||
public import derelict.opengl3.gl;
|
||||
|
||||
import dlangui.graphics.scene.mesh;
|
||||
import dlangui.graphics.scene.effect;
|
||||
|
||||
derelict.util.exception.ShouldThrow gl3MissingSymFunc( string symName ) {
|
||||
import std.algorithm : equal;
|
||||
foreach(s; ["glGetError", "glShaderSource", "glCompileShader",
|
||||
|
@ -112,7 +118,7 @@ string glerrorToString(in GLenum err) pure nothrow {
|
|||
}
|
||||
|
||||
|
||||
class GLProgram : GraphicsEffect {
|
||||
class GLProgram : dlangui.graphics.scene.effect.GraphicsEffect {
|
||||
@property abstract string vertexSource();
|
||||
@property abstract string fragmentSource();
|
||||
protected GLuint program;
|
||||
|
|
|
@ -9,6 +9,22 @@ import dlangui.graphics.glsupport;
|
|||
import dlangui.graphics.gldrawbuf;
|
||||
import dlangui.graphics.scene.mesh;
|
||||
|
||||
/// Base class for graphics effect / program - e.g. for OpenGL shader program
|
||||
abstract class GraphicsEffect : RefCountedObject {
|
||||
/// get location for vertex attribute
|
||||
int getVertexElementLocation(VertexElementType type);
|
||||
|
||||
void setUniform(string uniformName, mat4 matrix);
|
||||
|
||||
void setUniform(string uniformName, vec2 vec);
|
||||
|
||||
void setUniform(string uniformName, vec3 vec);
|
||||
|
||||
void setUniform(string uniformName, vec4 vec);
|
||||
|
||||
void draw(Mesh mesh);
|
||||
}
|
||||
|
||||
/// Reference counted Effect object
|
||||
alias EffectRef = Ref!Effect;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
module dlangui.graphics.scene.mesh;
|
||||
|
||||
import dlangui.graphics.scene.material;
|
||||
import dlangui.core.math3d;
|
||||
import dlangui.core.types;
|
||||
//import dlangui.graphics.scene.material;
|
||||
import dlangui.graphics.scene.effect;
|
||||
|
||||
/// Reference counted Mesh object
|
||||
alias MeshRef = Ref!Mesh;
|
||||
|
@ -46,22 +47,6 @@ class VertexBuffer {
|
|||
/// location for element is not found
|
||||
enum VERTEX_ELEMENT_NOT_FOUND = -1;
|
||||
|
||||
/// Base class for graphics effect / program - e.g. for OpenGL shader program
|
||||
abstract class GraphicsEffect : RefCountedObject {
|
||||
/// get location for vertex attribute
|
||||
int getVertexElementLocation(VertexElementType type);
|
||||
|
||||
void setUniform(string uniformName, mat4 matrix);
|
||||
|
||||
void setUniform(string uniformName, vec2 vec);
|
||||
|
||||
void setUniform(string uniformName, vec3 vec);
|
||||
|
||||
void setUniform(string uniformName, vec4 vec);
|
||||
|
||||
void draw(Mesh mesh);
|
||||
}
|
||||
|
||||
/// vertex attribute properties
|
||||
struct VertexElement {
|
||||
private VertexElementType _type;
|
||||
|
|
Loading…
Reference in New Issue