Web assembly #6
82 changed files with 11188 additions and 413 deletions
1
demos/.gitignore
vendored
1
demos/.gitignore
vendored
|
|
@ -10,3 +10,4 @@
|
||||||
!external/**/*.d
|
!external/**/*.d
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!compile_wasm.py
|
!compile_wasm.py
|
||||||
|
!cimgui.bc
|
||||||
BIN
demos/assets/fonts/Ruda-Bold.ttf
Normal file
BIN
demos/assets/fonts/Ruda-Bold.ttf
Normal file
Binary file not shown.
42
demos/assets/shaders/base.fp
Normal file
42
demos/assets/shaders/base.fp
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
precision mediump int;
|
||||||
|
precision mediump float;
|
||||||
|
precision lowp sampler2D;
|
||||||
|
precision lowp samplerCube;
|
||||||
|
|
||||||
|
#ifdef GLES
|
||||||
|
#if __VERSION__ >290
|
||||||
|
in mediump vec2 uv;
|
||||||
|
#else
|
||||||
|
varying mediump vec2 uv;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if __VERSION__ > 320
|
||||||
|
in vec2 uv;
|
||||||
|
#else
|
||||||
|
varying vec2 uv;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//layout(binding = 0)uniform sampler2D tex;
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
|
||||||
|
//layout(location = 0) out vec4 outColor;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
#ifdef GLES
|
||||||
|
#if __VERSION__ >290
|
||||||
|
gl_FragColor = texture(tex,uv);
|
||||||
|
#else
|
||||||
|
gl_FragColor = texture2D(tex,uv);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if __VERSION__ > 320
|
||||||
|
gl_FragColor = texture(tex,uv);
|
||||||
|
#else
|
||||||
|
gl_FragColor = texture2D(tex,uv);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
if(gl_FragColor.a < 0.01)discard;
|
||||||
|
}
|
||||||
55
demos/assets/shaders/base.vp
Normal file
55
demos/assets/shaders/base.vp
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
precision highp float;
|
||||||
|
precision highp int;
|
||||||
|
precision lowp sampler2D;
|
||||||
|
precision lowp samplerCube;
|
||||||
|
|
||||||
|
#ifdef GLES
|
||||||
|
#if __VERSION__ >290
|
||||||
|
layout(location = 0) uniform vec4 matrix_1;
|
||||||
|
layout(location = 1) uniform vec4 matrix_2;
|
||||||
|
layout(location = 2) uniform vec4 uv_transform;
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 positions;
|
||||||
|
layout(location = 1) in vec2 tex_coords;
|
||||||
|
|
||||||
|
out mediump vec2 uv;
|
||||||
|
#else
|
||||||
|
uniform vec4 matrix_1;
|
||||||
|
uniform vec4 matrix_2;
|
||||||
|
uniform vec4 uv_transform;
|
||||||
|
|
||||||
|
attribute vec2 positions;
|
||||||
|
attribute vec2 tex_coords;
|
||||||
|
|
||||||
|
varying mediump vec2 uv;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if __VERSION__ > 320
|
||||||
|
layout(location = 0) uniform vec4 matrix_1;
|
||||||
|
layout(location = 1) uniform vec4 matrix_2;
|
||||||
|
layout(location = 2) uniform vec4 uv_transform;
|
||||||
|
|
||||||
|
layout(location = 0) in vec2 positions;
|
||||||
|
layout(location = 1) in vec2 tex_coords;
|
||||||
|
|
||||||
|
out vec2 uv;
|
||||||
|
#else
|
||||||
|
uniform vec4 matrix_1;
|
||||||
|
uniform vec4 matrix_2;
|
||||||
|
uniform vec4 uv_transform;
|
||||||
|
|
||||||
|
attribute vec2 positions;
|
||||||
|
attribute vec2 tex_coords;
|
||||||
|
|
||||||
|
varying vec2 uv;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vec3 position = mat3(matrix_1.x,matrix_1.y,0,matrix_1.z,matrix_1.w,0,matrix_2.xy,1) * vec3(positions,1.0);
|
||||||
|
uv = tex_coords * uv_transform.zw + uv_transform.xy;
|
||||||
|
|
||||||
|
gl_Position = vec4(position.xy,0,1.0);
|
||||||
|
|
||||||
|
}
|
||||||
BIN
demos/cimgui.bc
Normal file
BIN
demos/cimgui.bc
Normal file
Binary file not shown.
BIN
demos/cimgui.dll
Normal file
BIN
demos/cimgui.dll
Normal file
Binary file not shown.
|
|
@ -36,8 +36,8 @@ clean = 0
|
||||||
demo = 0
|
demo = 0
|
||||||
sources = ['tests', 'source']
|
sources = ['tests', 'source']
|
||||||
emc_flags = '-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[\'png\']" --preload-file assets '
|
emc_flags = '-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="[\'png\']" --preload-file assets '
|
||||||
ldc_flags = '--d-version=SDL_209 --d-version=BindSDL_Static --d-version=BindSDL_Image '
|
ldc_flags = '--d-version=SDL_209 --d-version=BindSDL_Static --d-version=BindSDL_Image --d-version=MM_USE_POSIX_THREADS '
|
||||||
import_paths = ['external/imports', '../source', 'utils/source']
|
import_paths = ['external/sources', 'external/imports', 'external/wasm_imports', '../source', 'utils/source', 'simple/source']
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if(arg == '-release'):
|
if(arg == '-release'):
|
||||||
|
|
@ -74,18 +74,24 @@ for arg in sys.argv[1:]:
|
||||||
print('unknown argument: ' + arg)
|
print('unknown argument: ' + arg)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
compile(['external/imports/bindbc/sdl'], 'bindbc-sdl.bc')
|
compile(['external/wasm_imports/bindbc/sdl'], 'bindbc-sdl.bc')
|
||||||
compile(['utils/source'], 'utils.bc')
|
compile(['utils/source'], 'utils.bc')
|
||||||
compile(['simple/source'], 'demo.bc')
|
compile(['external/sources/mmutils'], 'mmutils.bc')
|
||||||
|
compile(['external/sources/glad'], 'glad.bc')
|
||||||
|
compile(['source'], 'demo.bc')
|
||||||
|
|
||||||
if clean or os.path.exists('../ecs.bc') == 0 or os.path.isfile('../ecs.bc') == 0:
|
if clean or os.path.exists('../ecs.bc') == 0 or os.path.isfile('../ecs.bc') == 0:
|
||||||
compile(['../source'], '../ecs.bc')
|
compile(['../source'], '../ecs.bc')
|
||||||
|
|
||||||
emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s ALLOW_MEMORY_GROWTH=1 -s MALLOC=dlmalloc -s WASM=1 -o index.html '
|
emcc_cmd = 'emcc -v ' + shared_flags + emc_flags + '-s ALLOW_MEMORY_GROWTH=1 -s MALLOC=dlmalloc -s FULL_ES2=1 -s WASM=1 -o index.html '
|
||||||
|
|
||||||
emcc_cmd += '../ecs.bc '
|
emcc_cmd += '../ecs.bc '
|
||||||
emcc_cmd += 'utils.bc '
|
emcc_cmd += 'utils.bc '
|
||||||
emcc_cmd += 'bindbc-sdl.bc '
|
emcc_cmd += 'bindbc-sdl.bc '
|
||||||
|
emcc_cmd += 'glad.bc '
|
||||||
|
emcc_cmd += 'cimgui.bc '
|
||||||
|
emcc_cmd += 'nuklear.bc '
|
||||||
|
emcc_cmd += 'mmutils.bc '
|
||||||
emcc_cmd += 'demo.bc '
|
emcc_cmd += 'demo.bc '
|
||||||
|
|
||||||
print emcc_cmd
|
print emcc_cmd
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "simple",
|
"name": "demo",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Michał Masiukiewicz", "Dawid Masiukiewicz"
|
"Michał Masiukiewicz", "Dawid Masiukiewicz"
|
||||||
],
|
],
|
||||||
"targetPath": "..",
|
|
||||||
"description": "Dynamic Entity Component System simple example",
|
"description": "Dynamic Entity Component System simple example",
|
||||||
"copyright": "Copyright © 2018-2019, Michał Masiukiewicz, Dawid Masiukiewicz",
|
"copyright": "Copyright © 2018-2019, Michał Masiukiewicz, Dawid Masiukiewicz",
|
||||||
"license": "BSD 3-clause",
|
"license": "BSD 3-clause",
|
||||||
"sourcePaths" : ["source\/"],
|
|
||||||
"dflags-posix-ldc": [
|
|
||||||
"-defaultlib=phobos2-ldc,druntime-ldc"
|
|
||||||
],
|
|
||||||
"libs-windows-x86_64": ["../libs/windows/x64/SDL2","../libs/windows/x64/SDL2main","../libs/windows/x64/SDL2_Image"],
|
|
||||||
"dflagss": [
|
|
||||||
"-betterC"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bindbc-sdl":"0.13.0",
|
"ecs_utils":{"path":"utils/"}
|
||||||
"ecs":{"path":"../../"},
|
|
||||||
"ecs_utils":{"path":"../utils/"}
|
|
||||||
},
|
},
|
||||||
"versions": [
|
"sourcePaths": [
|
||||||
"SDL_2010",
|
"source"
|
||||||
"BindSDL_Image"
|
|
||||||
],
|
],
|
||||||
|
"importPaths": [
|
||||||
|
"source"
|
||||||
|
],
|
||||||
|
"libs-windows-x86_64": ["libs/windows/x64/SDL2","libs/windows/x64/SDL2_Image","libs/windows/x64/cimgui"],
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"name" : "default",
|
"name" : "default",
|
||||||
1990
demos/external/sources/cimgui/cimgui.d
vendored
Normal file
1990
demos/external/sources/cimgui/cimgui.d
vendored
Normal file
File diff suppressed because it is too large
Load diff
28
demos/external/sources/glad/gl/all.d
vendored
Normal file
28
demos/external/sources/glad/gl/all.d
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
OpenGL, OpenGL ES loader generated by glad 0.1.33 on Fri Nov 8 17:14:30 2019.
|
||||||
|
|
||||||
|
Language/Generator: D
|
||||||
|
Specification: gl
|
||||||
|
APIs: gl=3.3, gles2=3.0
|
||||||
|
Profile: compatibility
|
||||||
|
Extensions:
|
||||||
|
|
||||||
|
Loader: True
|
||||||
|
Local files: False
|
||||||
|
Omit khrplatform: False
|
||||||
|
Reproducible: False
|
||||||
|
|
||||||
|
Commandline:
|
||||||
|
--profile="compatibility" --api="gl=3.3,gles2=3.0" --generator="d" --spec="gl" --extensions=""
|
||||||
|
Online:
|
||||||
|
https://glad.dav1d.de/#profile=compatibility&language=d&specification=gl&loader=on&api=gl%3D3.3&api=gles2%3D3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
module glad.gl.all;
|
||||||
|
|
||||||
|
|
||||||
|
public import glad.gl.funcs;
|
||||||
|
public import glad.gl.ext;
|
||||||
|
public import glad.gl.enums;
|
||||||
|
public import glad.gl.types;
|
||||||
1302
demos/external/sources/glad/gl/enums.d
vendored
Normal file
1302
demos/external/sources/glad/gl/enums.d
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
demos/external/sources/glad/gl/ext.d
vendored
Normal file
10
demos/external/sources/glad/gl/ext.d
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
module glad.gl.ext;
|
||||||
|
|
||||||
|
|
||||||
|
private import glad.gl.types;
|
||||||
|
private import glad.gl.enums;
|
||||||
|
private import glad.gl.funcs;
|
||||||
|
nothrow @nogc extern(System) {
|
||||||
|
}
|
||||||
|
__gshared {
|
||||||
|
}
|
||||||
1508
demos/external/sources/glad/gl/funcs.d
vendored
Normal file
1508
demos/external/sources/glad/gl/funcs.d
vendored
Normal file
File diff suppressed because it is too large
Load diff
404
demos/external/sources/glad/gl/gl.d
vendored
Normal file
404
demos/external/sources/glad/gl/gl.d
vendored
Normal file
|
|
@ -0,0 +1,404 @@
|
||||||
|
module glad.gl.gl;
|
||||||
|
|
||||||
|
|
||||||
|
public import glad.gl.types;
|
||||||
|
public import glad.gl.funcs :
|
||||||
|
glCopyTexImage1D, glVertexAttribI3ui, glWindowPos2s, glWindowPos2i, glWindowPos2f,
|
||||||
|
glWindowPos2d, glVertex2fv, glColor4ub, glIndexi, glFramebufferRenderbuffer,
|
||||||
|
glRectdv, glCompressedTexSubImage3D, glEvalCoord2d, glEvalCoord2f, glIndexd,
|
||||||
|
glVertexAttrib1sv, glIndexf, glBindSampler, glLineWidth, glColorP3uiv,
|
||||||
|
glGetIntegeri_v, glGetMapfv, glIndexs, glCompileShader, glGetTransformFeedbackVarying,
|
||||||
|
glVertex3sv, glIndexfv, glFogiv, glStencilMaskSeparate, glRasterPos2fv,
|
||||||
|
glLightModeliv, glRectd, glSecondaryColor3fv, glMultiTexCoordP3ui, glFogfv,
|
||||||
|
glVertexP4ui, glEnablei, glVertex4iv, glEvalCoord1fv, glWindowPos2sv,
|
||||||
|
glVertexAttribP4ui, glCreateShader, glIsBuffer, glGetMultisamplefv, glGenRenderbuffers,
|
||||||
|
glCopyTexSubImage2D, glCompressedTexImage2D, glVertexAttrib1f, glBlendFuncSeparate, glVertex4fv,
|
||||||
|
glDrawBuffers, glVertexAttrib1s, glTexCoord2fv, glSampleMaski, glVertexP2ui,
|
||||||
|
glTexCoord1i, glTexCoord4fv, glUniformMatrix3x2fv, glPointSize, glVertexAttrib2dv,
|
||||||
|
glDeleteProgram, glColor4bv, glRasterPos2f, glRasterPos2d, glLoadIdentity,
|
||||||
|
glRasterPos2i, glUniformMatrix4x3fv, glColor3b, glClearBufferfv, glEdgeFlag,
|
||||||
|
glFogCoordf, glVertex3d, glVertex3f, glVertex3i, glColor3i,
|
||||||
|
glUniform3f, glVertexAttrib4ubv, glColor3s, glVertex3s, glTexCoordP2ui,
|
||||||
|
glColorMaski, glEnableClientState, glClearBufferfi, glTexCoord1iv, glMultiTexCoord1iv,
|
||||||
|
glMultiTexCoordP2ui, glGetSamplerParameterIiv, glGetFragDataIndex, glRasterPos4i, glVertex2iv,
|
||||||
|
glColor3sv, glGetVertexAttribdv, glUniformMatrix3x4fv, glNormalPointer, glTexCoordP3uiv,
|
||||||
|
glVertex4sv, glPassThrough, glMultiTexCoordP4ui, glFogi, glBegin,
|
||||||
|
glEvalCoord2dv, glColor3ubv, glVertexPointer, glScaled, glDeleteFramebuffers,
|
||||||
|
glDrawArrays, glUniform1ui, glMultiTexCoord1d, glMultiTexCoord1f, glLightfv,
|
||||||
|
glClear, glMultiTexCoord1i, glGetActiveUniformName, glMultiTexCoord1s, glStencilOp,
|
||||||
|
glTexCoord1s, glFramebufferTexture2D, glGetFramebufferAttachmentParameteriv, glTranslatef, glVertexAttrib4Nub,
|
||||||
|
glTranslated, glTexCoord3sv, glGetFragDataLocation, glTexImage1D, glTexParameteriv,
|
||||||
|
glCopyPixels, glSecondaryColor3bv, glGetMaterialfv, glGetTexImage, glFogCoordfv,
|
||||||
|
glVertexAttrib4iv, glPixelMapuiv, glColor4ubv, glGetQueryObjecti64v, glGenFramebuffers,
|
||||||
|
glIndexsv, glGetAttachedShaders, glIsRenderbuffer, glVertex3iv, glBitmap,
|
||||||
|
glMateriali, glIsVertexArray, glDisableVertexAttribArray, glGetQueryiv, glTexCoord4f,
|
||||||
|
glTexCoord4d, glGetSamplerParameterfv, glTexCoord4i, glMaterialf, glTexCoord4s,
|
||||||
|
glGetUniformIndices, glIsShader, glFeedbackBuffer, glVertexAttribI4ubv, glVertex3dv,
|
||||||
|
glPointParameteriv, glDisable, glEnable, glGetActiveUniformsiv, glColor4fv,
|
||||||
|
glTexCoord1fv, glTexCoord2sv, glVertexAttrib4dv, glMultiTexCoord1dv, glGetMapiv,
|
||||||
|
glTexCoord3fv, glSecondaryColor3usv, glMultiTexCoordP3uiv, glVertexAttribP3ui, glGetPointerv,
|
||||||
|
glPolygonOffset, glGetUniformuiv, glNormal3fv, glDepthRange, glFrustum,
|
||||||
|
glMultiTexCoord2f, glDrawBuffer, glPushMatrix, glRasterPos3fv, glOrtho,
|
||||||
|
glDrawElementsInstanced, glWindowPos3sv, glVertexAttrib4d, glClearIndex, glMap1d,
|
||||||
|
glMap1f, glFlush, glGetRenderbufferParameteriv, glIndexiv, glRasterPos3sv,
|
||||||
|
glGetVertexAttribPointerv, glPixelZoom, glDeleteBuffers, glFenceSync, glDeleteVertexArrays,
|
||||||
|
glColorP3ui, glVertexAttrib3sv, glVertexAttrib4s, glGetTexLevelParameteriv, glLighti,
|
||||||
|
glMultiTexCoordP4uiv, glLightf, glGetAttribLocation, glStencilFuncSeparate, glGenSamplers,
|
||||||
|
glClampColor, glUniform4iv, glClearStencil, glVertexAttrib2sv, glMultiTexCoord3fv,
|
||||||
|
glGetPixelMapuiv, glGenTextures, glTexCoord4iv, glGetTexParameterIuiv, glIndexPointer,
|
||||||
|
glVertexAttrib4Nbv, glGetQueryObjectiv, glIsSync, glVertex2f, glVertex2d,
|
||||||
|
glDeleteRenderbuffers, glUniform2i, glMapGrid2d, glMapGrid2f, glShaderSource,
|
||||||
|
glVertex2i, glVertexAttribPointer, glFramebufferTextureLayer, glVertex2s, glNormal3bv,
|
||||||
|
glFlushMappedBufferRange, glSecondaryColor3sv, glPointParameteri, glWindowPos2iv, glGenQueries,
|
||||||
|
glGetPixelMapfv, glTexEnvf, glVertexAttribP1ui, glTexSubImage3D, glGetInteger64i_v,
|
||||||
|
glFogCoordd, glDeleteSamplers, glCopyTexImage2D, glTexEnvi, glBlitFramebuffer,
|
||||||
|
glIsEnabledi, glSecondaryColorP3ui, glBindFragDataLocationIndexed, glMultiTexCoord2dv, glUniform2iv,
|
||||||
|
glUniform4uiv, glMatrixMode, glMultiTexCoord2s, glColor3uiv, glMultiTexCoord2i,
|
||||||
|
glFramebufferTexture1D, glGetShaderiv, glMultiTexCoord2d, glMultiTexCoord4sv, glBindFragDataLocation,
|
||||||
|
glPrioritizeTextures, glCallList, glSecondaryColor3ubv, glGetDoublev, glMultiTexCoord3iv,
|
||||||
|
glVertexAttrib1d, glLightModelf, glVertexAttrib1fv, glVertex2sv, glLightModeli,
|
||||||
|
glBindBufferRange, glWindowPos3iv, glMultiTexCoordP1uiv, glUniform3fv, glCallLists,
|
||||||
|
glMapBuffer, glSecondaryColor3d, glTexCoord3i, glMultiTexCoord4fv, glRasterPos3i,
|
||||||
|
glSecondaryColor3b, glRasterPos3d, glRasterPos3f, glCompressedTexImage3D, glTexCoord3f,
|
||||||
|
glDeleteSync, glMultiTexCoordP1ui, glGetVertexAttribiv, glSecondaryColor3s, glVertexAttrib3fv,
|
||||||
|
glTexCoord3s, glUniform3iv, glRasterPos3s, glPolygonMode, glGetActiveUniformBlockiv,
|
||||||
|
glAreTexturesResident, glIsList, glRasterPos4sv, glCopyTexSubImage3D, glColor4s,
|
||||||
|
glUseProgram, glLineStipple, glSamplerParameterIuiv, glMultiTexCoord1sv, glGetProgramInfoLog,
|
||||||
|
glMultiTexCoord2iv, glTexCoord1sv, glBindVertexArray, glColor4b, glSecondaryColor3f,
|
||||||
|
glColor4f, glColor4d, glColor4i, glMultiDrawElementsBaseVertex, glUniform4fv,
|
||||||
|
glRasterPos3iv, glVertex2dv, glTexCoord4sv, glUniform2uiv, glCompressedTexSubImage1D,
|
||||||
|
glFinish, glClipPlane, glDeleteShader, glRasterPos2s, glGetMapdv,
|
||||||
|
glVertexAttrib4Nsv, glTexGendv, glViewport, glBindBufferBase, glVertexP3uiv,
|
||||||
|
glTransformFeedbackVaryings, glIndexdv, glTexCoord3d, glTexCoord3iv, glVertexAttribI3i,
|
||||||
|
glClearDepth, glVertexAttribI4usv, glTexParameterf, glTexParameteri, glGetShaderSource,
|
||||||
|
glTexBuffer, glPixelStorei, glValidateProgram, glPixelStoref, glSecondaryColor3iv,
|
||||||
|
glRasterPos4fv, glEvalCoord1dv, glMultiTexCoordP2uiv, glRecti, glMultiDrawElements,
|
||||||
|
glRectf, glColor4ui, glNormal3sv, glGetFloatv, glColor4us,
|
||||||
|
glVertexAttribP1uiv, glLinkProgram, glTexSubImage1D, glBindTexture, glRects,
|
||||||
|
glTexCoord2dv, glRasterPos4iv, glGetString, glVertexAttribP2uiv, glEdgeFlagv,
|
||||||
|
glDetachShader, glScalef, glEndQuery, glSecondaryColor3uiv, glEdgeFlagPointer,
|
||||||
|
glVertexAttrib4Nuiv, glVertexAttribI2ui, glPopAttrib, glDeleteTextures, glStencilOpSeparate,
|
||||||
|
glDeleteQueries, glNormalP3uiv, glVertexAttrib4f, glRenderbufferStorage, glInitNames,
|
||||||
|
glColor3dv, glPixelMapfv, glGetTexParameteriv, glWaitSync, glBeginConditionalRender,
|
||||||
|
glDrawElementsBaseVertex, glSampleCoverage, glSamplerParameteri, glSamplerParameterf, glUniform1f,
|
||||||
|
glGetVertexAttribfv, glRenderMode, glGetCompressedTexImage, glWindowPos2dv, glUniform1i,
|
||||||
|
glGetActiveAttrib, glUniform3i, glPixelTransferi, glTexSubImage2D, glGetUniformiv,
|
||||||
|
glLogicOp, glEvalPoint2, glPixelTransferf, glUniform4ui, glColor3f,
|
||||||
|
glBindFramebuffer, glGetTexEnvfv, glRectfv, glCullFace, glGetLightfv,
|
||||||
|
glTexGenf, glTexGend, glTexGeni, glMultiTexCoord3s, glVertexAttribI2uiv,
|
||||||
|
glMultiTexCoord3i, glMultiTexCoord3f, glMultiTexCoord3d, glAttachShader, glFogCoorddv,
|
||||||
|
glGetTexGenfv, glQueryCounter, glFogCoordPointer, glProvokingVertex, glRasterPos4dv,
|
||||||
|
glTexGeniv, glDrawElements, glColorMaterial, glSecondaryColor3dv, glClientActiveTexture,
|
||||||
|
glVertexAttribI4sv, glTexCoord2iv, glUniform1iv, glGetBufferParameteriv, glReadBuffer,
|
||||||
|
glTexParameterIuiv, glDrawArraysInstanced, glGenerateMipmap, glWindowPos3fv, glLightModelfv,
|
||||||
|
glSamplerParameteriv, glDeleteLists, glGetClipPlane, glVertexAttrib3f, glTexCoord2d,
|
||||||
|
glVertexAttrib3d, glTexCoord2f, glRasterPos2dv, glIndexubv, glUnmapBuffer,
|
||||||
|
glTexCoord2i, glRasterPos4d, glRasterPos4f, glVertexAttrib3s, glTexCoord2s,
|
||||||
|
glBindRenderbuffer, glVertex3fv, glTexCoord4dv, glMaterialiv, glVertexAttribP4uiv,
|
||||||
|
glIsProgram, glPointParameterfv, glVertex4s, glPopMatrix, glVertexAttrib4fv,
|
||||||
|
glNormal3dv, glUniform4i, glActiveTexture, glEnableVertexAttribArray, glRotated,
|
||||||
|
glRotatef, glVertex4i, glArrayElement, glReadPixels, glVertexAttribI3iv,
|
||||||
|
glStencilMask, glUniform4f, glRenderbufferStorageMultisample, glColor3d, glGenVertexArrays,
|
||||||
|
glShadeModel, glMapGrid1d, glGetUniformfv, glMapGrid1f, glDrawPixels,
|
||||||
|
glDisableClientState, glMultiTexCoord3sv, glDrawElementsInstancedBaseVertex, glSecondaryColorPointer, glAlphaFunc,
|
||||||
|
glMultiTexCoord4iv, glTexEnvfv, glStencilFunc, glTexCoord3dv, glUniformBlockBinding,
|
||||||
|
glColor4uiv, glRectiv, glColorP4ui, glRasterPos3dv, glEvalMesh2,
|
||||||
|
glEvalMesh1, glTexCoordPointer, glLoadMatrixf, glVertexAttribI4iv, glEvalCoord2fv,
|
||||||
|
glGetShaderInfoLog, glLoadTransposeMatrixd, glLoadTransposeMatrixf, glVertexAttribI4i, glRasterPos2iv,
|
||||||
|
glGetBufferSubData, glTexEnviv, glBlendEquationSeparate, glVertexAttribI1ui, glGenBuffers,
|
||||||
|
glSelectBuffer, glTexCoordP1uiv, glPushAttrib, glVertexAttribIPointer, glBlendFunc,
|
||||||
|
glCreateProgram, glTexImage3D, glIsFramebuffer, glLightiv, glPrimitiveRestartIndex,
|
||||||
|
glTexGenfv, glTexCoord1dv, glEnd, glGetInteger64v, glScissor,
|
||||||
|
glTexCoordP4uiv, glGetBooleanv, glPushName, glMaterialfv, glIndexub,
|
||||||
|
glVertexP2uiv, glUniform3uiv, glMultTransposeMatrixf, glMultTransposeMatrixd, glClearColor,
|
||||||
|
glVertexAttrib4uiv, glPolygonStipple, glVertexAttrib4Niv, glClearBufferiv, glGetBufferParameteri64v,
|
||||||
|
glColorP4uiv, glBlendColor, glWindowPos3d, glGetStringi, glColor4iv,
|
||||||
|
glUniform3ui, glSecondaryColor3us, glVertexAttribI4uiv, glVertexAttrib4bv, glUniform2fv,
|
||||||
|
glSecondaryColor3ub, glSecondaryColor3ui, glMultiTexCoord1fv, glGetSamplerParameterIuiv, glNormal3i,
|
||||||
|
glTexCoordP3ui, glNormal3iv, glWindowPos3s, glPointParameterf, glColor3us,
|
||||||
|
glWindowPos3i, glUniformMatrix2x3fv, glWindowPos3f, glGetVertexAttribIuiv, glMultiTexCoord4s,
|
||||||
|
glVertexAttrib4Nusv, glGetLightiv, glDepthFunc, glCompressedTexSubImage2D, glListBase,
|
||||||
|
glMultiTexCoord4f, glColor3ub, glMultiTexCoord4d, glVertexAttribI4bv, glGetTexParameterfv,
|
||||||
|
glColor3ui, glMultiTexCoord4i, glGetPolygonStipple, glClientWaitSync, glVertexAttribI4ui,
|
||||||
|
glPixelMapusv, glColorMask, glTexParameterIiv, glBlendEquation, glGetUniformLocation,
|
||||||
|
glGetTexGeniv, glRasterPos4s, glEndTransformFeedback, glVertexAttrib4usv, glTexImage2DMultisample,
|
||||||
|
glColor4sv, glPopClientAttrib, glColor4dv, glBeginTransformFeedback, glFogf,
|
||||||
|
glVertexAttribI1iv, glIsSampler, glVertexP3ui, glVertexAttribDivisor, glColor3iv,
|
||||||
|
glCompressedTexImage1D, glCopyTexSubImage1D, glDrawRangeElementsBaseVertex, glCheckFramebufferStatus, glTexCoord1d,
|
||||||
|
glTexCoord1f, glEndConditionalRender, glUniform1uiv, glBindAttribLocation, glUniformMatrix4x2fv,
|
||||||
|
glMultiTexCoord2sv, glVertexAttrib1dv, glDrawRangeElements, glGetQueryObjectuiv, glSamplerParameterIiv,
|
||||||
|
glBufferSubData, glVertexAttribI2i, glGenLists, glColor3bv, glMapBufferRange,
|
||||||
|
glFramebufferTexture, glGetTexGendv, glMultiDrawArrays, glEndList, glVertexP4uiv,
|
||||||
|
glUniform2ui, glVertexAttribI2iv, glColor3usv, glWindowPos2fv, glDisablei,
|
||||||
|
glIndexMask, glPushClientAttrib, glVertex4dv, glTexCoordP4ui, glGetActiveUniformBlockName,
|
||||||
|
glVertexAttribI3uiv, glClearAccum, glGetSynciv, glTexCoordP2uiv, glUniform2f,
|
||||||
|
glBeginQuery, glUniformMatrix4fv, glBindBuffer, glMap2d, glMap2f,
|
||||||
|
glRasterPos2sv, glUniformMatrix2fv, glUniformMatrix2x4fv, glBufferData, glEvalPoint1,
|
||||||
|
glGetTexParameterIiv, glIsEnabled, glTexCoordP1ui, glGetError, glGetTexEnviv,
|
||||||
|
glGetProgramiv, glVertexAttribP2ui, glNewList, glSecondaryColor3i, glMultiTexCoord2fv,
|
||||||
|
glNormalP3ui, glEvalCoord1d, glGetTexLevelParameterfv, glEvalCoord1f, glVertexAttribI1i,
|
||||||
|
glVertex4d, glVertexAttribP3uiv, glGetPixelMapusv, glSecondaryColorP3uiv, glGetIntegerv,
|
||||||
|
glAccum, glGetBufferPointerv, glGetVertexAttribIiv, glFramebufferTexture3D, glVertexAttrib2fv,
|
||||||
|
glIsQuery, glVertexAttrib4sv, glWindowPos3dv, glTexImage2D, glLoadName,
|
||||||
|
glSamplerParameterfv, glMultMatrixd, glMultMatrixf, glIsTexture, glGetMaterialiv,
|
||||||
|
glUniform1fv, glVertexAttrib4Nubv, glLoadMatrixd, glTexParameterfv, glUniformMatrix3fv,
|
||||||
|
glVertex4f, glRectsv, glColor4usv, glNormal3s, glInterleavedArrays,
|
||||||
|
glHint, glNormal3f, glNormal3d, glNormal3b, glMultiTexCoord4dv,
|
||||||
|
glGetSamplerParameteriv, glPopName, glCopyBufferSubData, glVertexAttribI1uiv, glVertexAttrib2d,
|
||||||
|
glVertexAttrib2f, glVertexAttrib3dv, glGetQueryObjectui64v, glDepthMask, glVertexAttrib2s,
|
||||||
|
glColor3fv, glTexImage3DMultisample, glGetUniformBlockIndex, glMultiTexCoord3dv, glGetActiveUniform,
|
||||||
|
glColorPointer, glFrontFace, glGetBooleani_v, glClearBufferuiv;
|
||||||
|
|
||||||
|
public import glad.gl.enums :
|
||||||
|
GL_INDEX_CLEAR_VALUE, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_FOG_INDEX, GL_ALPHA_TEST_FUNC,
|
||||||
|
GL_SOURCE1_ALPHA, GL_NORMAL_MAP, GL_DITHER, GL_QUERY_RESULT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
|
||||||
|
GL_R16_SNORM, GL_FOG_COORD_ARRAY, GL_FLOAT, GL_PROXY_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LOD,
|
||||||
|
GL_RGB16_SNORM, GL_SAMPLER_2D_RECT, GL_RGB9_E5, GL_MAX_VERTEX_UNIFORM_BLOCKS, GL_TEXTURE_COMPRESSED,
|
||||||
|
GL_T2F_C4UB_V3F, GL_EDGE_FLAG_ARRAY_POINTER, GL_PROXY_TEXTURE_3D, GL_MAX_LIST_NESTING, GL_COLOR_ATTACHMENT22,
|
||||||
|
GL_SOURCE0_ALPHA, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_BYTE, GL_TIMEOUT_IGNORED,
|
||||||
|
GL_COLOR_ARRAY, GL_ZOOM_Y, GL_ZOOM_X, GL_RENDERBUFFER_SAMPLES, GL_HINT_BIT,
|
||||||
|
GL_COLOR_CLEAR_VALUE, GL_LINEAR_MIPMAP_LINEAR, GL_DEPTH_WRITEMASK, GL_TEXTURE_GEN_MODE, GL_3D_COLOR_TEXTURE,
|
||||||
|
GL_COLOR_ARRAY_POINTER, GL_TEXTURE_DEPTH_SIZE, GL_FLOAT_MAT3x2, GL_PIXEL_MAP_G_TO_G, GL_RENDER,
|
||||||
|
GL_MAX_TEXTURE_COORDS, GL_FLOAT_MAT3x4, GL_COLOR_ATTACHMENT28, GL_TEXTURE_BINDING_2D_MULTISAMPLE, GL_COLOR_ATTACHMENT24,
|
||||||
|
GL_COLOR_ATTACHMENT25, GL_COLOR_ATTACHMENT26, GL_COLOR_ATTACHMENT27, GL_COLOR_ATTACHMENT20, GL_COLOR_ATTACHMENT21,
|
||||||
|
GL_COMPRESSED_RGBA, GL_COLOR_ATTACHMENT23, GL_CLIENT_ATTRIB_STACK_DEPTH, GL_UNSIGNED_SHORT_5_5_5_1, GL_TEXTURE_COMPONENTS,
|
||||||
|
GL_QUERY_NO_WAIT, GL_PROVOKING_VERTEX, GL_SIGNED_NORMALIZED, GL_CURRENT_RASTER_TEXTURE_COORDS, GL_EXP,
|
||||||
|
GL_LINE_STRIP_ADJACENCY, GL_POINT_SIZE, GL_TEXTURE_COMPARE_FUNC, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, GL_BITMAP_TOKEN,
|
||||||
|
GL_RGB10, GL_RGB16, GL_POLYGON_OFFSET_FILL, GL_LINE_TOKEN, GL_DOUBLEBUFFER,
|
||||||
|
GL_MAX_CLIP_PLANES, GL_FOG_COORDINATE_ARRAY_STRIDE, GL_RGB_INTEGER, GL_COMPILE_AND_EXECUTE, GL_MULT,
|
||||||
|
GL_STENCIL_CLEAR_VALUE, GL_GREEN_BITS, GL_SHADING_LANGUAGE_VERSION, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_SRC2_RGB,
|
||||||
|
GL_FRAGMENT_SHADER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_INDEX_ARRAY_TYPE, GL_FRAGMENT_SHADER_DERIVATIVE_HINT, GL_TEXTURE_DEPTH,
|
||||||
|
GL_VIEWPORT, GL_DRAW_BUFFER6, GL_DRAW_BUFFER7, GL_DRAW_BUFFER4, GL_DRAW_BUFFER5,
|
||||||
|
GL_DRAW_BUFFER2, GL_DRAW_BUFFER3, GL_DRAW_BUFFER0, GL_DRAW_BUFFER1, GL_LIGHT1,
|
||||||
|
GL_LIGHT0, GL_LIGHT3, GL_LIGHT2, GL_COPY, GL_LIGHT4,
|
||||||
|
GL_BLEND_SRC, GL_LIGHT6, GL_MAP_STENCIL, GL_QUADRATIC_ATTENUATION, GL_TEXTURE_CUBE_MAP_SEAMLESS,
|
||||||
|
GL_TEXTURE_RECTANGLE, GL_FILL, GL_SRC_COLOR, GL_SAMPLER_BINDING, GL_DEPTH24_STENCIL8,
|
||||||
|
GL_SAMPLE_BUFFERS, GL_RGBA_INTEGER, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, GL_COLOR_INDEX, GL_EXTENSIONS,
|
||||||
|
GL_MAP2_NORMAL, GL_BUFFER_SIZE, GL_PASS_THROUGH_TOKEN, GL_MAX_EVAL_ORDER, GL_UPPER_LEFT,
|
||||||
|
GL_TEXTURE_COMPARE_MODE, GL_ANY_SAMPLES_PASSED, GL_LAST_VERTEX_CONVENTION, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_DEPTH_BUFFER_BIT,
|
||||||
|
GL_STENCIL_BACK_PASS_DEPTH_FAIL, GL_UNSIGNALED, GL_UNIFORM_BUFFER, GL_MAP_WRITE_BIT, GL_SHADE_MODEL,
|
||||||
|
GL_COMPRESSED_SLUMINANCE, GL_CCW, GL_RGB32I, GL_DEPTH_COMPONENT24, GL_INDEX_SHIFT,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_LIST_BIT, GL_ONE_MINUS_SRC1_COLOR, GL_STREAM_READ, GL_LINEAR,
|
||||||
|
GL_R32F, GL_VERTEX_ARRAY, GL_OR_REVERSE, GL_LUMINANCE12_ALPHA4, GL_LOGIC_OP,
|
||||||
|
GL_VERTEX_ARRAY_BUFFER_BINDING, GL_PIXEL_MAP_R_TO_R, GL_FOG_COORDINATE_SOURCE, GL_UNSIGNED_SHORT_5_6_5_REV, GL_TEXTURE_BORDER,
|
||||||
|
GL_GREATER, GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_MAX_TEXTURE_IMAGE_UNITS, GL_RGB32F,
|
||||||
|
GL_FLOAT_MAT2, GL_FLOAT_MAT3, GL_FRONT_FACE, GL_DEPTH, GL_REPLACE,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_OPERAND1_RGB, GL_RGBA32UI, GL_RG8I,
|
||||||
|
GL_RGBA8I, GL_TEXTURE_FILTER_CONTROL, GL_ACCUM_CLEAR_VALUE, GL_SRC1_ALPHA, GL_RG32F,
|
||||||
|
GL_R3_G3_B2, GL_ALPHA_BIAS, GL_RENDERBUFFER_BINDING, GL_TEXTURE_STACK_DEPTH, GL_TEXTURE_LUMINANCE_SIZE,
|
||||||
|
GL_TEXTURE_MIN_LOD, GL_FOG_COORDINATE_ARRAY, GL_BLEND, GL_FEEDBACK_BUFFER_TYPE, GL_MAP1_TEXTURE_COORD_3,
|
||||||
|
GL_R16UI, GL_MAP1_TEXTURE_COORD_1, GL_UNSIGNED_SHORT, GL_MIN, GL_MAP1_TEXTURE_COORD_4,
|
||||||
|
GL_COMPRESSED_SRGB_ALPHA, GL_ONE_MINUS_SRC_COLOR, GL_TEXTURE, GL_INTENSITY12, GL_MAX_PROJECTION_STACK_DEPTH,
|
||||||
|
GL_RGB_SCALE, GL_MAX_CLIP_DISTANCES, GL_PERSPECTIVE_CORRECTION_HINT, GL_LIST_MODE, GL_TIMESTAMP,
|
||||||
|
GL_ACTIVE_UNIFORMS, GL_VERTEX_PROGRAM_POINT_SIZE, GL_MAX_COLOR_ATTACHMENTS, GL_TEXTURE_BINDING_CUBE_MAP, GL_OPERAND2_RGB,
|
||||||
|
GL_R, GL_SRGB_ALPHA, GL_S, GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_PACK_SKIP_ROWS,
|
||||||
|
GL_T, GL_MAX_TEXTURE_UNITS, GL_SLUMINANCE8, GL_MAX_TEXTURE_BUFFER_SIZE, GL_MAP1_COLOR_4,
|
||||||
|
GL_GEOMETRY_SHADER, GL_R8I, GL_TEXTURE_MAX_LEVEL, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_BLEND_COLOR,
|
||||||
|
GL_ALPHA_BITS, GL_LINE_STIPPLE, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GL_ONE_MINUS_CONSTANT_ALPHA, GL_NEAREST_MIPMAP_LINEAR,
|
||||||
|
GL_ALPHA8, GL_BLEND_EQUATION, GL_SRC2_ALPHA, GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, GL_ALPHA4,
|
||||||
|
GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, GL_FOG_END, GL_SAMPLER_1D, GL_LINE, GL_STENCIL_BITS,
|
||||||
|
GL_FOG_COORDINATE_ARRAY_TYPE, GL_SAMPLES_PASSED, GL_RENDERBUFFER_RED_SIZE, GL_COMPRESSED_SLUMINANCE_ALPHA, GL_BLUE_INTEGER,
|
||||||
|
GL_DYNAMIC_COPY, GL_CURRENT_FOG_COORD, GL_SYNC_FLAGS, GL_RG32I, GL_UNSIGNED_BYTE_2_3_3_REV,
|
||||||
|
GL_RENDERBUFFER_INTERNAL_FORMAT, GL_CLIENT_ACTIVE_TEXTURE, GL_TEXTURE_HEIGHT, GL_RGBA16I, GL_RGBA16F,
|
||||||
|
GL_OPERAND2_ALPHA, GL_SAMPLE_ALPHA_TO_COVERAGE, GL_FOG_DENSITY, GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_CONSTANT_ATTENUATION,
|
||||||
|
GL_RED, GL_DEPTH_BIAS, GL_EQUIV, GL_POLYGON_OFFSET_LINE, GL_FUNC_REVERSE_SUBTRACT,
|
||||||
|
GL_GREEN, GL_INVALID_OPERATION, GL_CLAMP_READ_COLOR, GL_RED_INTEGER, GL_TEXTURE_BINDING_BUFFER,
|
||||||
|
GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT4, GL_MAP2_TEXTURE_COORD_2, GL_COLOR_ATTACHMENT6, GL_MAP2_TEXTURE_COORD_4,
|
||||||
|
GL_COLOR_ATTACHMENT0, GL_4_BYTES, GL_COLOR_ATTACHMENT2, GL_MAX_MODELVIEW_STACK_DEPTH, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS,
|
||||||
|
GL_COLOR_ATTACHMENT9, GL_COLOR_ATTACHMENT8, GL_PACK_IMAGE_HEIGHT, GL_PIXEL_MAP_B_TO_B_SIZE, GL_BUFFER_USAGE,
|
||||||
|
GL_CULL_FACE_MODE, GL_UNSIGNED_INT_8_8_8_8_REV, GL_BOOL, GL_MAX_COMBINED_UNIFORM_BLOCKS, GL_3D_COLOR,
|
||||||
|
GL_GREEN_INTEGER, GL_DST_COLOR, GL_T2F_V3F, GL_UNSIGNED_INT, GL_OPERAND0_ALPHA,
|
||||||
|
GL_ALWAYS, GL_NOOP, GL_V3F, GL_POINT_SPRITE_COORD_ORIGIN, GL_POINT_SIZE_RANGE,
|
||||||
|
GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, GL_LUMINANCE16, GL_GREEN_BIAS, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, GL_LUMINANCE12,
|
||||||
|
GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_SHADER_TYPE, GL_RG16_SNORM, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, GL_COLOR_ARRAY_TYPE,
|
||||||
|
GL_QUERY_COUNTER_BITS, GL_MODULATE, GL_RG_INTEGER, GL_DRAW_BUFFER10, GL_FOG_COORD_ARRAY_BUFFER_BINDING,
|
||||||
|
GL_TEXTURE_LUMINANCE_TYPE, GL_RENDERBUFFER_HEIGHT, GL_RG16UI, GL_INTERLEAVED_ATTRIBS, GL_TEXTURE_ALPHA_TYPE,
|
||||||
|
GL_COLOR_ATTACHMENT29, GL_MAP2_TEXTURE_COORD_1, GL_DRAW_BUFFER14, GL_FOG_COORD_ARRAY_STRIDE, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS,
|
||||||
|
GL_MAP2_TEXTURE_COORD_3, GL_TEXTURE_BLUE_TYPE, GL_COLOR_ATTACHMENT1, GL_C4F_N3F_V3F, GL_COMBINE_RGB,
|
||||||
|
GL_STEREO, GL_ALREADY_SIGNALED, GL_T4F_V4F, GL_STREAM_COPY, GL_LIGHT_MODEL_LOCAL_VIEWER,
|
||||||
|
GL_SOURCE0_RGB, GL_EYE_PLANE, GL_TEXTURE_CUBE_MAP, GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
|
||||||
|
GL_CLIP_PLANE1, GL_CLIP_PLANE0, GL_CLIP_PLANE3, GL_CLIP_PLANE2, GL_CLIP_PLANE5,
|
||||||
|
GL_CLIP_PLANE4, GL_ORDER, GL_NORMAL_ARRAY_TYPE, GL_TEXTURE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER,
|
||||||
|
GL_LINE_STIPPLE_REPEAT, GL_POINTS, GL_LIGHTING_BIT, GL_SYNC_STATUS, GL_RENDERBUFFER_BLUE_SIZE,
|
||||||
|
GL_UNIFORM_NAME_LENGTH, GL_FASTEST, GL_LUMINANCE8, GL_LUMINANCE4, GL_POLYGON,
|
||||||
|
GL_NAND, GL_MAP1_INDEX, GL_LINE_WIDTH_GRANULARITY, GL_ADD_SIGNED, GL_MAX_3D_TEXTURE_SIZE,
|
||||||
|
GL_CLIENT_PIXEL_STORE_BIT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, GL_DONT_CARE,
|
||||||
|
GL_POLYGON_BIT, GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING, GL_QUERY_WAIT, GL_MAP_FLUSH_EXPLICIT_BIT, GL_TEXTURE_COORD_ARRAY_SIZE,
|
||||||
|
GL_RED_SCALE, GL_SRGB8, GL_CURRENT_NORMAL, GL_COMPRESSED_SIGNED_RED_RGTC1, GL_FRAGMENT_DEPTH,
|
||||||
|
GL_UNIFORM_BLOCK_BINDING, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, GL_SRC0_ALPHA, GL_LEQUAL, GL_PIXEL_MAP_A_TO_A_SIZE,
|
||||||
|
GL_TEXTURE_WIDTH, GL_ONE_MINUS_SRC1_ALPHA, GL_MAP_COLOR, GL_UNIFORM_SIZE, GL_POINT_SPRITE,
|
||||||
|
GL_FLOAT_MAT4x2, GL_SHADER_SOURCE_LENGTH, GL_DOT3_RGBA, GL_COMPRESSED_RG, GL_UNPACK_SWAP_BYTES,
|
||||||
|
GL_CURRENT_VERTEX_ATTRIB, GL_POLYGON_OFFSET_UNITS, GL_LUMINANCE6_ALPHA2, GL_MAX_COLOR_TEXTURE_SAMPLES, GL_COLOR_ATTACHMENT7,
|
||||||
|
GL_PRIMARY_COLOR, GL_C3F_V3F, GL_OUT_OF_MEMORY, GL_AUX_BUFFERS, GL_NORMAL_ARRAY_STRIDE,
|
||||||
|
GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_SMOOTH, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, GL_GEOMETRY_OUTPUT_TYPE, GL_RASTERIZER_DISCARD,
|
||||||
|
GL_MAX_TEXTURE_LOD_BIAS, GL_CURRENT_TEXTURE_COORDS, GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_FRONT_RIGHT,
|
||||||
|
GL_EDGE_FLAG_ARRAY, GL_INT_SAMPLER_2D_MULTISAMPLE, GL_RETURN, GL_STENCIL_TEST, GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
|
||||||
|
GL_R11F_G11F_B10F, GL_LUMINANCE_ALPHA, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_INVERT, GL_PROXY_TEXTURE_1D,
|
||||||
|
GL_COMPRESSED_INTENSITY, GL_TRANSFORM_FEEDBACK_VARYINGS, GL_DEPTH_COMPONENT32F, GL_TRIANGLE_FAN, GL_LIST_BASE,
|
||||||
|
GL_MAX_ELEMENTS_VERTICES, GL_CURRENT_COLOR, GL_INVALID_FRAMEBUFFER_OPERATION, GL_RGB12, GL_UNIFORM_BUFFER_SIZE,
|
||||||
|
GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING, GL_DEPTH32F_STENCIL8, GL_MAX_ARRAY_TEXTURE_LAYERS, GL_RED_BITS, GL_MAX_SERVER_WAIT_TIMEOUT,
|
||||||
|
GL_NOR, GL_FLAT, GL_PACK_ALIGNMENT, GL_PIXEL_MAP_S_TO_S, GL_UNPACK_LSB_FIRST,
|
||||||
|
GL_BGRA, GL_ACTIVE_UNIFORM_BLOCKS, GL_SOURCE1_RGB, GL_UNPACK_SKIP_IMAGES, GL_RGB16I,
|
||||||
|
GL_ACTIVE_TEXTURE, GL_TEXTURE_BASE_LEVEL, GL_RGB16F, GL_SMOOTH_LINE_WIDTH_RANGE, GL_ALPHA_INTEGER,
|
||||||
|
GL_GREEN_SCALE, GL_CLIP_DISTANCE7, GL_FOG_BIT, GL_TRANSPOSE_TEXTURE_MATRIX, GL_UNSIGNED_INT_SAMPLER_3D,
|
||||||
|
GL_SAMPLE_MASK, GL_INT_VEC4, GL_INT_VEC3, GL_INT_VEC2, GL_STENCIL_FAIL,
|
||||||
|
GL_CURRENT_FOG_COORDINATE, GL_CONDITION_SATISFIED, GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, GL_FRAMEBUFFER_UNSUPPORTED, GL_RED_BIAS,
|
||||||
|
GL_DST_ALPHA, GL_SECONDARY_COLOR_ARRAY_POINTER, GL_R8, GL_RENDER_MODE, GL_EDGE_FLAG_ARRAY_BUFFER_BINDING,
|
||||||
|
GL_MAX_CUBE_MAP_TEXTURE_SIZE, GL_TEXTURE_1D_ARRAY, GL_RENDERBUFFER_WIDTH, GL_READ_FRAMEBUFFER_BINDING, GL_FRAMEBUFFER_ATTACHMENT_LAYERED,
|
||||||
|
GL_TEXTURE_BLUE_SIZE, GL_COORD_REPLACE, GL_RGBA2, GL_RGBA4, GL_MULTISAMPLE_BIT,
|
||||||
|
GL_FOG_COLOR, GL_DRAW_BUFFER11, GL_DRAW_BUFFER12, GL_DRAW_BUFFER13, GL_UNSIGNED_INT_10_10_10_2,
|
||||||
|
GL_DRAW_BUFFER15, GL_INFO_LOG_LENGTH, GL_R16F, GL_RENDERBUFFER_STENCIL_SIZE, GL_CONSTANT_ALPHA,
|
||||||
|
GL_RESCALE_NORMAL, GL_R16I, GL_POINT_SIZE_GRANULARITY, GL_STATIC_READ, GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER,
|
||||||
|
GL_COMPARE_R_TO_TEXTURE, GL_PREVIOUS, GL_MAP_READ_BIT, GL_SPOT_DIRECTION, GL_DEPTH_SCALE,
|
||||||
|
GL_STENCIL, GL_SAMPLE_MASK_VALUE, GL_LINE_BIT, GL_DIFFUSE, GL_MAX_RENDERBUFFER_SIZE,
|
||||||
|
GL_T2F_N3F_V3F, GL_TRANSFORM_BIT, GL_COLOR_ATTACHMENT30, GL_STENCIL_PASS_DEPTH_PASS, GL_INCR_WRAP,
|
||||||
|
GL_SOURCE2_RGB, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_R, GL_TEXTURE_GEN_Q,
|
||||||
|
GL_RENDERBUFFER_ALPHA_SIZE, GL_ALPHA12, GL_LIGHT_MODEL_TWO_SIDE, GL_ALPHA16, GL_DECR_WRAP,
|
||||||
|
GL_POLYGON_SMOOTH, GL_COMPILE, GL_SAMPLE_POSITION, GL_TRANSPOSE_MODELVIEW_MATRIX, GL_INCR,
|
||||||
|
GL_POINT_SIZE_MIN, GL_MAX_RECTANGLE_TEXTURE_SIZE, GL_RGBA12, GL_GENERATE_MIPMAP_HINT, GL_ALPHA_TEST_REF,
|
||||||
|
GL_RGBA16, GL_UNPACK_SKIP_ROWS, GL_MAP1_NORMAL, GL_SOURCE2_ALPHA, GL_DEPTH_CLAMP,
|
||||||
|
GL_POLYGON_STIPPLE_BIT, GL_BLEND_DST_ALPHA, GL_INT_SAMPLER_CUBE, GL_CURRENT_QUERY, GL_RGB5_A1,
|
||||||
|
GL_EXP2, GL_UNPACK_SKIP_PIXELS, GL_RGB16UI, GL_COPY_INVERTED, GL_TEXTURE_PRIORITY,
|
||||||
|
GL_MAX_GEOMETRY_INPUT_COMPONENTS, GL_LOWER_LEFT, GL_FOG_HINT, GL_TEXTURE_BINDING_1D, GL_PROJECTION_MATRIX,
|
||||||
|
GL_AUX0, GL_PIXEL_UNPACK_BUFFER, GL_LINEAR_MIPMAP_NEAREST, GL_POINT_DISTANCE_ATTENUATION, GL_TEXTURE_BUFFER_DATA_STORE_BINDING,
|
||||||
|
GL_RGB10_A2, GL_AMBIENT_AND_DIFFUSE, GL_ZERO, GL_ELEMENT_ARRAY_BUFFER, GL_CONTEXT_CORE_PROFILE_BIT,
|
||||||
|
GL_SCISSOR_BIT, GL_READ_ONLY, GL_MAX_FRAGMENT_INPUT_COMPONENTS, GL_MAP1_GRID_DOMAIN, GL_PIXEL_MAP_I_TO_A_SIZE,
|
||||||
|
GL_UNSIGNED_NORMALIZED, GL_SMOOTH_POINT_SIZE_GRANULARITY, GL_CLAMP_VERTEX_COLOR, GL_MAP2_INDEX, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
|
||||||
|
GL_PIXEL_MAP_I_TO_R_SIZE, GL_NOTEQUAL, GL_TEXTURE_COORD_ARRAY, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_MAP2_GRID_DOMAIN,
|
||||||
|
GL_COMPRESSED_RED, GL_INT_SAMPLER_1D_ARRAY, GL_DRAW_PIXEL_TOKEN, GL_MAX_LIGHTS, GL_RGBA16_SNORM,
|
||||||
|
GL_OBJECT_LINEAR, GL_LIST_INDEX, GL_TEXTURE_BORDER_COLOR, GL_LUMINANCE16_ALPHA16, GL_TEXTURE_SHARED_SIZE,
|
||||||
|
GL_COMPILE_STATUS, GL_LOGIC_OP_MODE, GL_LUMINANCE8_ALPHA8, GL_RENDERBUFFER_DEPTH_SIZE, GL_MAX_FRAGMENT_UNIFORM_BLOCKS,
|
||||||
|
GL_SLUMINANCE_ALPHA, GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, GL_FEEDBACK_BUFFER_POINTER, GL_SPOT_EXPONENT, GL_SHORT,
|
||||||
|
GL_BLUE, GL_CW, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_BYTE, GL_MAX_VERTEX_UNIFORM_COMPONENTS,
|
||||||
|
GL_QUADS, GL_DEPTH_TEXTURE_MODE, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_R16, GL_PIXEL_PACK_BUFFER,
|
||||||
|
GL_PACK_LSB_FIRST, GL_RENDERBUFFER, GL_UNSIGNED_BYTE_3_3_2, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_RGB8I,
|
||||||
|
GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, GL_DRAW_BUFFER, GL_STENCIL_INDEX1, GL_STENCIL_INDEX4, GL_SAMPLER_3D,
|
||||||
|
GL_TEXTURE_GREEN_TYPE, GL_STENCIL_INDEX8, GL_DEPTH_BITS, GL_OR_INVERTED, GL_RGB8UI,
|
||||||
|
GL_STENCIL_INDEX16, GL_STENCIL_BACK_REF, GL_SELECT, GL_INTENSITY4, GL_BLEND_DST_RGB,
|
||||||
|
GL_INTENSITY8, GL_LIGHT5, GL_LINE_RESET_TOKEN, GL_MAP1_VERTEX_3, GL_TEXTURE_BINDING_2D_ARRAY,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_DIVISOR, GL_CLEAR, GL_DRAW_BUFFER8, GL_CURRENT_RASTER_POSITION_VALID, GL_FOG_COORD_SRC,
|
||||||
|
GL_DRAW_BUFFER9, GL_SRC0_RGB, GL_PIXEL_PACK_BUFFER_BINDING, GL_DECAL, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
|
||||||
|
GL_2D, GL_SELECTION_BUFFER_POINTER, GL_SELECTION_BUFFER_SIZE, GL_SAMPLES, GL_UNSIGNED_INT_VEC2,
|
||||||
|
GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_SHORT_5_6_5, GL_CURRENT_RASTER_POSITION, GL_VERTEX_ATTRIB_ARRAY_SIZE,
|
||||||
|
GL_VERTEX_SHADER, GL_RGBA_MODE, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4,
|
||||||
|
GL_COEFF, GL_RGB32UI, GL_BUFFER_MAP_OFFSET, GL_MIN_PROGRAM_TEXEL_OFFSET, GL_PROXY_TEXTURE_RECTANGLE,
|
||||||
|
GL_UNSIGNED_INT_SAMPLER_BUFFER, GL_UNIFORM_BUFFER_START, GL_MAX_TEXTURE_STACK_DEPTH, GL_UNSIGNED_INT_SAMPLER_2D, GL_TEXTURE8,
|
||||||
|
GL_INT_SAMPLER_2D_RECT, GL_TEXTURE_COORD_ARRAY_STRIDE, GL_TEXTURE4, GL_TEXTURE5, GL_TEXTURE6,
|
||||||
|
GL_TEXTURE7, GL_TEXTURE0, GL_CONTEXT_PROFILE_MASK, GL_TEXTURE2, GL_TEXTURE3,
|
||||||
|
GL_BOOL_VEC4, GL_DOUBLE, GL_RG8_SNORM, GL_BOOL_VEC3, GL_BOOL_VEC2,
|
||||||
|
GL_COLOR_MATERIAL_PARAMETER, GL_DOT3_RGB, GL_ONE, GL_SRC_ALPHA_SATURATE, GL_MAX_SAMPLES,
|
||||||
|
GL_UNPACK_IMAGE_HEIGHT, GL_TRIANGLE_STRIP, GL_N3F_V3F, GL_CONTEXT_FLAGS, GL_FRONT_LEFT,
|
||||||
|
GL_CLAMP, GL_POINT_SMOOTH_HINT, GL_INDEX_OFFSET, GL_INTENSITY, GL_POINT_SIZE_MAX,
|
||||||
|
GL_MODELVIEW_MATRIX, GL_VERTEX_ARRAY_BINDING, GL_INDEX_BITS, GL_TIMEOUT_EXPIRED, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
|
||||||
|
GL_STENCIL_FUNC, GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING, GL_TEXTURE_ENV, GL_ALIASED_LINE_WIDTH_RANGE, GL_DECR,
|
||||||
|
GL_BACK, GL_VIEWPORT_BIT, GL_INT, GL_CLIP_DISTANCE1, GL_CLIP_DISTANCE0,
|
||||||
|
GL_CLIP_DISTANCE3, GL_CLIP_DISTANCE2, GL_CLIP_DISTANCE5, GL_CLIP_DISTANCE4, GL_MINOR_VERSION,
|
||||||
|
GL_PIXEL_MAP_G_TO_G_SIZE, GL_FRONT_AND_BACK, GL_POINT, GL_COMPRESSED_RG_RGTC2, GL_POLYGON_TOKEN,
|
||||||
|
GL_SMOOTH_LINE_WIDTH_GRANULARITY, GL_SRGB, GL_NORMAL_ARRAY_POINTER, GL_SYNC_FENCE, GL_ONE_MINUS_CONSTANT_COLOR,
|
||||||
|
GL_UNSIGNED_INT_8_8_8_8, GL_RGB8_SNORM, GL_TEXTURE_ALPHA_SIZE, GL_UNSIGNED_INT_SAMPLER_2D_RECT, GL_CONSTANT_COLOR,
|
||||||
|
GL_UNSIGNED_SHORT_4_4_4_4, GL_NO_ERROR, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_BLEND_SRC_ALPHA, GL_CURRENT_SECONDARY_COLOR,
|
||||||
|
GL_RGBA16UI, GL_AND_REVERSE, GL_MAX_INTEGER_SAMPLES, GL_CLAMP_FRAGMENT_COLOR, GL_QUERY_RESULT_AVAILABLE,
|
||||||
|
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_MAX_DRAW_BUFFERS, GL_ONE_MINUS_DST_ALPHA, GL_FOG_MODE, GL_R32UI,
|
||||||
|
GL_RGBA8_SNORM, GL_C4UB_V2F, GL_INT_SAMPLER_3D, GL_CURRENT_INDEX, GL_AND,
|
||||||
|
GL_INDEX_MODE, GL_ACCUM_GREEN_BITS, GL_MAJOR_VERSION, GL_STATIC_COPY, GL_REFLECTION_MAP,
|
||||||
|
GL_BGR_INTEGER, GL_3_BYTES, GL_UNIFORM_BUFFER_BINDING, GL_UNIFORM_TYPE, GL_DELETE_STATUS,
|
||||||
|
GL_POINT_BIT, GL_SYNC_GPU_COMMANDS_COMPLETE, GL_SMOOTH_POINT_SIZE_RANGE, GL_ALIASED_POINT_SIZE_RANGE, GL_3D,
|
||||||
|
GL_MAP_INVALIDATE_BUFFER_BIT, GL_UNSIGNED_INT_5_9_9_9_REV, GL_DEPTH_TEST, GL_BUFFER_MAP_LENGTH, GL_VERTEX_ATTRIB_ARRAY_POINTER,
|
||||||
|
GL_MULTISAMPLE, GL_MAX_GEOMETRY_OUTPUT_VERTICES, GL_TEXTURE_RED_TYPE, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_FUNC_SUBTRACT,
|
||||||
|
GL_VERTEX_PROGRAM_TWO_SIDE, GL_SAMPLER_BUFFER, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, GL_TEXTURE_COORD_ARRAY_TYPE, GL_CLAMP_TO_BORDER,
|
||||||
|
GL_COLOR_ATTACHMENT15, GL_COLOR_ATTACHMENT14, GL_COLOR_ATTACHMENT17, GL_DEPTH_RANGE, GL_COLOR_ATTACHMENT11,
|
||||||
|
GL_COLOR_ATTACHMENT10, GL_COLOR_ATTACHMENT13, GL_COLOR_ATTACHMENT12, GL_NEAREST, GL_COMPRESSED_TEXTURE_FORMATS,
|
||||||
|
GL_COLOR_ATTACHMENT19, GL_COLOR_ATTACHMENT18, GL_RENDERBUFFER_GREEN_SIZE, GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, GL_PIXEL_MAP_S_TO_S_SIZE,
|
||||||
|
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_RGBA8, GL_T2F_C3F_V3F, GL_SAMPLER_2D_RECT_SHADOW, GL_ALL_ATTRIB_BITS,
|
||||||
|
GL_POINT_TOKEN, GL_T4F_C4F_N3F_V4F, GL_TEXTURE30, GL_TEXTURE31, GL_UNSIGNED_INT_SAMPLER_1D,
|
||||||
|
GL_POINT_SMOOTH, GL_DEPTH_CLEAR_VALUE, GL_GEOMETRY_INPUT_TYPE, GL_BACK_LEFT, GL_TEXTURE_ENV_COLOR,
|
||||||
|
GL_BUFFER_MAP_POINTER, GL_LINE_SMOOTH, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_STENCIL_REF, GL_CURRENT_BIT,
|
||||||
|
GL_FOG_COORDINATE, GL_COPY_WRITE_BUFFER, GL_MAX_VARYING_FLOATS, GL_PRIMITIVE_RESTART_INDEX, GL_OPERAND0_RGB,
|
||||||
|
GL_LIGHT_MODEL_COLOR_CONTROL, GL_FEEDBACK, GL_ONE_MINUS_DST_COLOR, GL_MAX_ATTRIB_STACK_DEPTH, GL_FOG_COORD_ARRAY_TYPE,
|
||||||
|
GL_PROXY_TEXTURE_1D_ARRAY, GL_ACCUM_ALPHA_BITS, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, GL_PIXEL_MAP_I_TO_A,
|
||||||
|
GL_COLOR_BUFFER_BIT, GL_PIXEL_MAP_I_TO_I, GL_SPOT_CUTOFF, GL_PIXEL_MAP_I_TO_R, GL_LINEAR_ATTENUATION,
|
||||||
|
GL_SAMPLER_2D, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, GL_NEAREST_MIPMAP_NEAREST, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, GL_EDGE_FLAG_ARRAY_STRIDE,
|
||||||
|
GL_TEXTURE_MAG_FILTER, GL_COLOR_MATERIAL_FACE, GL_CONTEXT_COMPATIBILITY_PROFILE_BIT, GL_SINGLE_COLOR, GL_R32I,
|
||||||
|
GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY, GL_SAMPLER_CUBE, GL_INT_2_10_10_10_REV, GL_SAMPLER_CUBE_SHADOW, GL_LEFT,
|
||||||
|
GL_AND_INVERTED, GL_ACCUM_BLUE_BITS, GL_FRAMEBUFFER_SRGB, GL_SECONDARY_COLOR_ARRAY_TYPE, GL_POLYGON_OFFSET_POINT,
|
||||||
|
GL_BGR, GL_MAX_TEXTURE_SIZE, GL_COMBINE_ALPHA, GL_RIGHT, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
|
||||||
|
GL_ARRAY_BUFFER, GL_COMPRESSED_ALPHA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT16, GL_MAX_SAMPLE_MASK_WORDS,
|
||||||
|
GL_TEXTURE_COMPRESSED_IMAGE_SIZE, GL_TEXTURE_RED_SIZE, GL_TEXTURE_1D, GL_MAX_VARYING_COMPONENTS, GL_NAME_STACK_DEPTH,
|
||||||
|
GL_BLEND_SRC_RGB, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, GL_BGRA_INTEGER, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, GL_FALSE,
|
||||||
|
GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_ONE_MINUS_SRC_ALPHA, GL_SAMPLE_ALPHA_TO_ONE, GL_WEIGHT_ARRAY_BUFFER_BINDING, GL_COLOR_ATTACHMENT3,
|
||||||
|
GL_PIXEL_MAP_I_TO_G_SIZE, GL_MAP2_GRID_SEGMENTS, GL_PROGRAM_POINT_SIZE, GL_COLOR_ATTACHMENT16, GL_MAX_VIEWPORT_DIMS,
|
||||||
|
GL_DEPTH_ATTACHMENT, GL_INT_SAMPLER_2D, GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GL_STENCIL_PASS_DEPTH_FAIL, GL_PIXEL_MAP_A_TO_A,
|
||||||
|
GL_TEXTURE_COORD_ARRAY_POINTER, GL_MAP1_GRID_SEGMENTS, GL_MAX_GEOMETRY_UNIFORM_BLOCKS, GL_ATTRIB_STACK_DEPTH, GL_LINE_WIDTH,
|
||||||
|
GL_FEEDBACK_BUFFER_SIZE, GL_BLUE_BIAS, GL_FIXED_ONLY, GL_NONE, GL_FRAMEBUFFER_DEFAULT,
|
||||||
|
GL_POLYGON_MODE, GL_HALF_FLOAT, GL_UNIFORM_BLOCK_NAME_LENGTH, GL_V2F, GL_TEXTURE_BINDING_RECTANGLE,
|
||||||
|
GL_LINE_SMOOTH_HINT, GL_CLAMP_TO_EDGE, GL_FRONT, GL_SCISSOR_BOX, GL_UNIFORM_BLOCK_DATA_SIZE,
|
||||||
|
GL_AMBIENT, GL_NUM_EXTENSIONS, GL_UNIFORM_IS_ROW_MAJOR, GL_MAX_UNIFORM_BLOCK_SIZE, GL_INDEX_ARRAY,
|
||||||
|
GL_FRAMEBUFFER_BINDING, GL_NORMAL_ARRAY_BUFFER_BINDING, GL_ALPHA, GL_SET, GL_COLOR_WRITEMASK,
|
||||||
|
GL_DEPTH_FUNC, GL_TEXTURE_WRAP_R, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TEXTURE9,
|
||||||
|
GL_INVALID_ENUM, GL_EVAL_BIT, GL_INT_SAMPLER_2D_ARRAY, GL_COMPRESSED_RGB, GL_LIGHT_MODEL_AMBIENT,
|
||||||
|
GL_DEPTH_COMPONENT, GL_SRC1_COLOR, GL_FOG_START, GL_WAIT_FAILED, GL_COMPARE_REF_TO_TEXTURE,
|
||||||
|
GL_PROJECTION_STACK_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, GL_TRUE, GL_TEXTURE_MIN_FILTER, GL_FLOAT_MAT4,
|
||||||
|
GL_BLUE_BITS, GL_STACK_UNDERFLOW, GL_AUX1, GL_TEXTURE_SWIZZLE_R, GL_AUX3,
|
||||||
|
GL_AUX2, GL_PACK_SWAP_BYTES, GL_FIRST_VERTEX_CONVENTION, GL_EQUAL, GL_TEXTURE_SWIZZLE_G,
|
||||||
|
GL_DEPTH_STENCIL_ATTACHMENT, GL_TRIANGLE_STRIP_ADJACENCY, GL_ADD, GL_TEXTURE_BINDING_1D_ARRAY, GL_TEXTURE_SWIZZLE_B,
|
||||||
|
GL_TEXTURE_SWIZZLE_A, GL_FUNC_ADD, GL_MODELVIEW_STACK_DEPTH, GL_FLOAT_MAT4x3, GL_POINT_FADE_THRESHOLD_SIZE,
|
||||||
|
GL_INT_SAMPLER_BUFFER, GL_UNPACK_ALIGNMENT, GL_LINE_STRIP, GL_PACK_ROW_LENGTH, GL_COLOR_MATERIAL,
|
||||||
|
GL_MAX_PIXEL_MAP_TABLE, GL_COLOR, GL_POLYGON_STIPPLE, GL_BITMAP, GL_DYNAMIC_READ,
|
||||||
|
GL_COMPRESSED_LUMINANCE, GL_LUMINANCE12_ALPHA12, GL_DEPTH_STENCIL, GL_RG8UI, GL_MAX_VERTEX_OUTPUT_COMPONENTS,
|
||||||
|
GL_KEEP, GL_TEXTURE_INTENSITY_SIZE, GL_PROXY_TEXTURE_2D, GL_SYNC_CONDITION, GL_ACTIVE_UNIFORM_MAX_LENGTH,
|
||||||
|
GL_OR, GL_MAP_INVALIDATE_RANGE_BIT, GL_TEXTURE23, GL_TEXTURE22, GL_TEXTURE21,
|
||||||
|
GL_TEXTURE20, GL_TEXTURE27, GL_TEXTURE26, GL_TEXTURE25, GL_TEXTURE24,
|
||||||
|
GL_R8_SNORM, GL_TEXTURE29, GL_TEXTURE28, GL_SAMPLER_1D_ARRAY, GL_ELEMENT_ARRAY_BUFFER_BINDING,
|
||||||
|
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER, GL_TRIANGLES_ADJACENCY, GL_PIXEL_MODE_BIT, GL_LINE_LOOP, GL_ALPHA_SCALE,
|
||||||
|
GL_READ_BUFFER, GL_PACK_SKIP_PIXELS, GL_BACK_RIGHT, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, GL_SUBPIXEL_BITS,
|
||||||
|
GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS, GL_GEQUAL, GL_ALPHA_TEST, GL_SLUMINANCE8_ALPHA8, GL_SAMPLER_2D_MULTISAMPLE,
|
||||||
|
GL_LUMINANCE4_ALPHA4, GL_RGBA8UI, GL_UNIFORM_OFFSET, GL_TEXTURE1, GL_OBJECT_PLANE,
|
||||||
|
GL_UNSIGNED_INT_SAMPLER_CUBE, GL_SUBTRACT, GL_TIME_ELAPSED, GL_SECONDARY_COLOR_ARRAY_SIZE, GL_COMPRESSED_RED_RGTC1,
|
||||||
|
GL_READ_WRITE, GL_BUFFER_ACCESS, GL_LINES_ADJACENCY, GL_ARRAY_BUFFER_BINDING, GL_INDEX_WRITEMASK,
|
||||||
|
GL_TEXTURE_2D, GL_VERTEX_ARRAY_STRIDE, GL_DYNAMIC_DRAW, GL_4D_COLOR_TEXTURE, GL_NICEST,
|
||||||
|
GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, GL_UNPACK_ROW_LENGTH, GL_CURRENT_PROGRAM, GL_BUFFER_MAPPED, GL_EYE_LINEAR,
|
||||||
|
GL_STREAM_DRAW, GL_POLYGON_SMOOTH_HINT, GL_INDEX, GL_MAX_UNIFORM_BUFFER_BINDINGS, GL_SIGNALED,
|
||||||
|
GL_FRAMEBUFFER, GL_SPECULAR, GL_TEXTURE_BINDING_2D, GL_GENERATE_MIPMAP, GL_DOMAIN,
|
||||||
|
GL_COLOR_ARRAY_SIZE, GL_STENCIL_BACK_FAIL, GL_POLYGON_OFFSET_FACTOR, GL_R8UI, GL_SYNC_FLUSH_COMMANDS_BIT,
|
||||||
|
GL_DRAW_FRAMEBUFFER_BINDING, GL_STATIC_DRAW, GL_MODELVIEW, GL_PIXEL_MAP_I_TO_B_SIZE, GL_TRIANGLES,
|
||||||
|
GL_SAMPLER_2D_ARRAY_SHADOW, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_UNIFORM_MATRIX_STRIDE, GL_MAX_DEPTH_TEXTURE_SAMPLES, GL_QUERY_BY_REGION_WAIT,
|
||||||
|
GL_TEXTURE_RESIDENT, GL_SLUMINANCE, GL_SRGB8_ALPHA8, GL_FOG, GL_FOG_COORD,
|
||||||
|
GL_SAMPLER_2D_ARRAY, GL_POSITION, GL_RENDERER, GL_MIRRORED_REPEAT, GL_RG,
|
||||||
|
GL_PIXEL_MAP_B_TO_B, GL_LINE_STIPPLE_PATTERN, GL_STENCIL_BACK_FUNC, GL_PIXEL_MAP_R_TO_R_SIZE, GL_MAP1_TEXTURE_COORD_2,
|
||||||
|
GL_TEXTURE_BINDING_3D, GL_COLOR_LOGIC_OP, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, GL_UNIFORM_BLOCK_INDEX, GL_ENABLE_BIT,
|
||||||
|
GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, GL_MAX_VERTEX_ATTRIBS, GL_SPHERE_MAP, GL_CONSTANT, GL_LINE_WIDTH_RANGE,
|
||||||
|
GL_XOR, GL_PROJECTION, GL_LESS, GL_COPY_PIXEL_TOKEN, GL_FRAMEBUFFER_UNDEFINED,
|
||||||
|
GL_2_BYTES, GL_TEXTURE_STENCIL_SIZE, GL_CURRENT_RASTER_INDEX, GL_EMISSION, GL_COMPRESSED_SRGB,
|
||||||
|
GL_TEXTURE_DEPTH_TYPE, GL_TEXTURE_ENV_MODE, GL_COMPRESSED_LUMINANCE_ALPHA, GL_INT_SAMPLER_1D, GL_CURRENT_RASTER_COLOR,
|
||||||
|
GL_PROXY_TEXTURE_2D_ARRAY, GL_QUAD_STRIP, GL_REPEAT, GL_ACCUM, GL_T2F_C4F_N3F_V3F,
|
||||||
|
GL_TEXTURE_INTENSITY_TYPE, GL_INTENSITY16, GL_VERTEX_ARRAY_TYPE, GL_VERTEX_ARRAY_SIZE, GL_TEXTURE_GREEN_SIZE,
|
||||||
|
GL_CLIENT_ALL_ATTRIB_BITS, GL_VALIDATE_STATUS, GL_RG16, GL_LIGHT7, GL_STENCIL_BACK_VALUE_MASK,
|
||||||
|
GL_SCISSOR_TEST, GL_STENCIL_BUFFER_BIT, GL_TEXTURE_2D_MULTISAMPLE, GL_SAMPLER_1D_ARRAY_SHADOW, GL_SRC1_RGB,
|
||||||
|
GL_BLEND_EQUATION_ALPHA, GL_ACTIVE_ATTRIBUTES, GL_COLOR_ATTACHMENT31, GL_LIGHTING, GL_CURRENT_RASTER_DISTANCE,
|
||||||
|
GL_VERTEX_ARRAY_POINTER, GL_ATTACHED_SHADERS, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_QUERY_BY_REGION_NO_WAIT, GL_SAMPLE_COVERAGE_INVERT,
|
||||||
|
GL_LINES, GL_TEXTURE18, GL_TEXTURE19, GL_TEXTURE16, GL_TEXTURE17,
|
||||||
|
GL_TEXTURE14, GL_TEXTURE15, GL_TEXTURE12, GL_TEXTURE13, GL_TEXTURE10,
|
||||||
|
GL_TEXTURE11, GL_RGB, GL_SEPARATE_SPECULAR_COLOR, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_TRANSFORM_FEEDBACK_BUFFER_START,
|
||||||
|
GL_MAX_PROGRAM_TEXEL_OFFSET, GL_STACK_OVERFLOW, GL_MAP1_VERTEX_4, GL_TEXTURE_COMPRESSION_HINT, GL_RGBA32F,
|
||||||
|
GL_RGBA32I, GL_COLOR_ARRAY_BUFFER_BINDING, GL_VERTEX_ATTRIB_ARRAY_TYPE, GL_TRANSPOSE_COLOR_MATRIX, GL_STENCIL_WRITEMASK,
|
||||||
|
GL_RG8, GL_FOG_COORDINATE_ARRAY_POINTER, GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_INVALID_VALUE, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
|
||||||
|
GL_VERSION, GL_MAP_UNSYNCHRONIZED_BIT, GL_PRIMITIVE_RESTART, GL_COLOR_ARRAY_STRIDE, GL_MAX_ELEMENTS_INDICES,
|
||||||
|
GL_SRC_ALPHA, GL_TEXTURE_3D, GL_GEOMETRY_VERTICES_OUT, GL_RGB8, GL_INDEX_ARRAY_POINTER,
|
||||||
|
GL_MATRIX_MODE, GL_UNIFORM_ARRAY_STRIDE, GL_TEXTURE_SAMPLES, GL_RGB4, GL_RGB5,
|
||||||
|
GL_CULL_FACE, GL_PIXEL_MAP_I_TO_I_SIZE, GL_SAMPLE_COVERAGE_VALUE, GL_PROXY_TEXTURE_CUBE_MAP, GL_SECONDARY_COLOR_ARRAY_STRIDE,
|
||||||
|
GL_COMPRESSED_SIGNED_RG_RGTC2, GL_COLOR_INDEXES, GL_RG32UI, GL_OPERAND1_ALPHA, GL_NORMALIZE,
|
||||||
|
GL_NEVER, GL_STENCIL_VALUE_MASK, GL_BLEND_DST, GL_STENCIL_BACK_WRITEMASK, GL_BLUE_SCALE,
|
||||||
|
GL_TEXTURE_INTERNAL_FORMAT, GL_LOAD, GL_FRAMEBUFFER_COMPLETE, GL_COPY_READ_BUFFER, GL_INDEX_ARRAY_STRIDE,
|
||||||
|
GL_FOG_COORD_ARRAY_POINTER, GL_MAP2_VERTEX_3, GL_TEXTURE_SWIZZLE_RGBA, GL_DEPTH_COMPONENT32, GL_RGBA,
|
||||||
|
GL_READ_FRAMEBUFFER, GL_NORMAL_ARRAY, GL_COLOR_SUM, GL_BLEND_EQUATION_RGB, GL_MAP2_COLOR_4,
|
||||||
|
GL_VENDOR, GL_TEXTURE_2D_ARRAY, GL_ACCUM_BUFFER_BIT, GL_EDGE_FLAG, GL_OBJECT_TYPE,
|
||||||
|
GL_C4UB_V3F, GL_INTERPOLATE, GL_BUFFER_ACCESS_FLAGS, GL_LINK_STATUS, GL_PACK_SKIP_IMAGES,
|
||||||
|
GL_FLOAT_MAT2x3, GL_COMBINE, GL_FLOAT_MAT2x4, GL_Q, GL_SECONDARY_COLOR_ARRAY,
|
||||||
|
GL_INDEX_LOGIC_OP, GL_SEPARATE_ATTRIBS, GL_PRIMITIVES_GENERATED, GL_MAX, GL_LUMINANCE,
|
||||||
|
GL_INVALID_INDEX, GL_MAP2_VERTEX_4, GL_AUTO_NORMAL, GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS, GL_CURRENT_RASTER_SECONDARY_COLOR,
|
||||||
|
GL_SAMPLER_1D_SHADOW, GL_ACCUM_RED_BITS, GL_SAMPLER_2D_SHADOW, GL_TEXTURE_MATRIX, GL_TRANSPOSE_PROJECTION_MATRIX,
|
||||||
|
GL_CLIP_DISTANCE6, GL_RG16F, GL_MAX_NAME_STACK_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, GL_TEXTURE_BIT,
|
||||||
|
GL_RG16I, GL_WRITE_ONLY, GL_STENCIL_ATTACHMENT, GL_CLIENT_VERTEX_ARRAY_BIT, GL_SAMPLE_COVERAGE,
|
||||||
|
GL_INDEX_ARRAY_BUFFER_BINDING, GL_SHININESS, GL_DRAW_FRAMEBUFFER, GL_TEXTURE_LOD_BIAS, GL_RGB10_A2UI
|
||||||
|
;
|
||||||
|
|
||||||
183
demos/external/sources/glad/gl/gles2.d
vendored
Normal file
183
demos/external/sources/glad/gl/gles2.d
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
||||||
|
module glad.gl.gles2;
|
||||||
|
|
||||||
|
|
||||||
|
public import glad.gl.types;
|
||||||
|
public import glad.gl.funcs :
|
||||||
|
glUniformMatrix2fv, glBeginTransformFeedback, glFlush, glGetRenderbufferParameteriv, glClearColor,
|
||||||
|
glClearBufferiv, glStencilMaskSeparate, glGetVertexAttribPointerv, glLinkProgram, glBindTexture,
|
||||||
|
glGetStringi, glFenceSync, glUniform3ui, glFramebufferRenderbuffer, glGetString,
|
||||||
|
glCompressedTexSubImage3D, glDetachShader, glVertexAttribI4uiv, glEndQuery, glBindSampler,
|
||||||
|
glLineWidth, glUniform2fv, glGetIntegeri_v, glCompileShader, glGetTransformFeedbackVarying,
|
||||||
|
glDeleteTextures, glStencilOpSeparate, glStencilFuncSeparate, glBindBufferRange, glVertexAttrib4f,
|
||||||
|
glUniform2f, glRenderbufferStorage, glDeleteShader, glGetBufferParameteri64v, glDepthRangef,
|
||||||
|
glUniform4iv, glGetTexParameteriv, glClearStencil, glUniformMatrix2x3fv, glGetUniformiv,
|
||||||
|
glGenTransformFeedbacks, glGetVertexAttribIuiv, glSampleCoverage, glSamplerParameteri, glGenTextures,
|
||||||
|
glSamplerParameterf, glDepthFunc, glCompressedTexSubImage2D, glUniform1f, glGetVertexAttribfv,
|
||||||
|
glProgramBinary, glGetTexParameterfv, glCreateShader, glIsBuffer, glUniform1i,
|
||||||
|
glGenRenderbuffers, glCopyTexSubImage2D, glCompressedTexImage2D, glDisable, glUniform2i,
|
||||||
|
glBlendFuncSeparate, glGetProgramiv, glColorMask, glHint, glFramebufferTextureLayer,
|
||||||
|
glBlendEquation, glGetUniformLocation, glBindFramebuffer, glEndTransformFeedback, glCullFace,
|
||||||
|
glUniformMatrix3x2fv, glTexStorage2D, glUniform4fv, glGetInternalformativ, glDeleteProgram,
|
||||||
|
glIsSampler, glVertexAttribDivisor, glGenQueries, glWaitSync, glAttachShader,
|
||||||
|
glUniformMatrix4x3fv, glUniform3i, glClearBufferfv, glDeleteTransformFeedbacks, glShaderBinary,
|
||||||
|
glCheckFramebufferStatus, glTexSubImage3D, glGetInteger64i_v, glDeleteSamplers, glCopyTexImage2D,
|
||||||
|
glUniform3f, glBlitFramebuffer, glBindAttribLocation, glUniformMatrix4x2fv, glBlendEquationSeparate,
|
||||||
|
glDrawElements, glGetShaderSource, glUniform2iv, glGetQueryObjectuiv, glGenVertexArrays,
|
||||||
|
glBindBufferBase, glBufferSubData, glUniform1iv, glGetBufferParameteriv, glMapBufferRange,
|
||||||
|
glReadBuffer, glTexStorage3D, glClientWaitSync, glDrawArraysInstanced, glViewport,
|
||||||
|
glGenerateMipmap, glGetShaderiv, glUniformMatrix3x4fv, glUniform2ui, glVertexAttrib3f,
|
||||||
|
glGetActiveAttrib, glBlendColor, glGetShaderPrecisionFormat, glResumeTransformFeedback, glUnmapBuffer,
|
||||||
|
glGetUniformfv, glDisableVertexAttribArray, glShaderSource, glBindRenderbuffer, glDeleteRenderbuffers,
|
||||||
|
glIsSync, glReleaseShaderCompiler, glDeleteFramebuffers, glDrawArrays, glUniform1ui,
|
||||||
|
glIsProgram, glTexSubImage2D, glGetSynciv, glVertexAttrib1fv, glClear,
|
||||||
|
glVertexAttrib4fv, glProgramParameteri, glIsTransformFeedback, glUniform4i, glActiveTexture,
|
||||||
|
glEnableVertexAttribArray, glDrawRangeElements, glBindBuffer, glIsEnabled, glStencilOp,
|
||||||
|
glReadPixels, glStencilMask, glUniform4f, glFramebufferTexture2D, glGetFramebufferAttachmentParameteriv,
|
||||||
|
glUniformMatrix2x4fv, glUniform3fv, glBufferData, glCompressedTexImage3D, glDeleteSync,
|
||||||
|
glPauseTransformFeedback, glGetError, glGetActiveUniformBlockName, glGetVertexAttribiv, glTexParameteriv,
|
||||||
|
glGetProgramBinary, glVertexAttrib3fv, glGetFloatv, glUniform3iv, glVertexAttrib2fv,
|
||||||
|
glGetShaderInfoLog, glGenFramebuffers, glDrawBuffers, glGetActiveUniformBlockiv, glStencilFunc,
|
||||||
|
glGetIntegerv, glGetAttachedShaders, glUniformBlockBinding, glIsRenderbuffer, glGetBufferPointerv,
|
||||||
|
glDeleteVertexArrays, glIsShader, glRenderbufferStorageMultisample, glUniform4uiv, glIsQuery,
|
||||||
|
glIsVertexArray, glUseProgram, glVertexAttribI4iv, glGetQueryiv, glTexImage2D,
|
||||||
|
glGetProgramInfoLog, glGetSamplerParameterfv, glBindTransformFeedback, glUniform4ui, glSamplerParameterfv,
|
||||||
|
glClearBufferuiv, glBindVertexArray, glIsTexture, glGetUniformIndices, glUniform1fv,
|
||||||
|
glGetInteger64v, glVertexAttribPointer, glTexParameterfv, glInvalidateSubFramebuffer, glUniformMatrix3fv,
|
||||||
|
glScissor, glEnable, glGetActiveUniformsiv, glVertexAttribI4i, glVertexAttribI4ui,
|
||||||
|
glGetFragDataLocation, glUniform2uiv, glGenBuffers, glFinish, glGetAttribLocation,
|
||||||
|
glBeginQuery, glVertexAttribIPointer, glBlendFunc, glCreateProgram, glTexImage3D,
|
||||||
|
glGenSamplers, glGetSamplerParameteriv, glIsFramebuffer, glFlushMappedBufferRange, glUniformMatrix4fv,
|
||||||
|
glCopyBufferSubData, glInvalidateFramebuffer, glUniform1uiv, glTransformFeedbackVaryings, glVertexAttrib2f,
|
||||||
|
glVertexAttrib1f, glCopyTexSubImage3D, glDepthMask, glGetUniformuiv, glGetUniformBlockIndex,
|
||||||
|
glGetVertexAttribIiv, glGetActiveUniform, glTexParameterf, glClearBufferfi, glTexParameteri,
|
||||||
|
glFrontFace, glClearDepthf, glDeleteBuffers, glSamplerParameteriv, glDrawElementsInstanced,
|
||||||
|
glGetBooleanv, glPixelStorei, glValidateProgram, glPolygonOffset, glDeleteQueries,
|
||||||
|
glUniform3uiv;
|
||||||
|
|
||||||
|
public import glad.gl.enums :
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_SHORT_5_6_5,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_SIZE, GL_DEPTH_ATTACHMENT, GL_DITHER, GL_TRANSFORM_FEEDBACK_PAUSED, GL_RGB16UI,
|
||||||
|
GL_QUERY_RESULT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4,
|
||||||
|
GL_FLOAT, GL_RGB32UI, GL_TEXTURE_MAX_LOD, GL_BUFFER_MAP_OFFSET, GL_BUFFER_SIZE,
|
||||||
|
GL_RGB9_E5, GL_UNIFORM_BUFFER_START, GL_COMPRESSED_R11_EAC, GL_RGBA32UI, GL_UNSIGNED_INT_SAMPLER_2D,
|
||||||
|
GL_TEXTURE_MIN_LOD, GL_TEXTURE8, GL_TEXTURE9, GL_TEXTURE4, GL_TEXTURE5,
|
||||||
|
GL_TEXTURE6, GL_TEXTURE7, GL_TEXTURE0, GL_LINEAR_MIPMAP_LINEAR, GL_TEXTURE2,
|
||||||
|
GL_TEXTURE3, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_BLEND_EQUATION, GL_BYTE,
|
||||||
|
GL_BOOL_VEC3, GL_BOOL_VEC2, GL_TIMEOUT_IGNORED, GL_MAX_VARYING_VECTORS, GL_RENDERBUFFER_SAMPLES,
|
||||||
|
GL_ONE, GL_RG, GL_COLOR_CLEAR_VALUE, GL_MAX_SAMPLES, GL_BUFFER_USAGE,
|
||||||
|
GL_UNPACK_IMAGE_HEIGHT, GL_FLOAT_MAT3x2, GL_TRIANGLE_STRIP, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRANSFORM_FEEDBACK_BUFFER_BINDING,
|
||||||
|
GL_FLOAT_MAT3x4, GL_COLOR_ATTACHMENT28, GL_COLOR_ATTACHMENT29, GL_COLOR_ATTACHMENT24, GL_COLOR_ATTACHMENT25,
|
||||||
|
GL_COLOR_ATTACHMENT26, GL_COLOR_ATTACHMENT27, GL_COLOR_ATTACHMENT20, GL_COLOR_ATTACHMENT21, GL_COLOR_ATTACHMENT22,
|
||||||
|
GL_COLOR_ATTACHMENT23, GL_TRANSFORM_FEEDBACK_BUFFER, GL_VERTEX_ARRAY_BINDING, GL_UNSIGNED_SHORT_5_5_5_1, GL_TIMEOUT_EXPIRED,
|
||||||
|
GL_COMPRESSED_RGB8_ETC2, GL_SIGNED_NORMALIZED, GL_STENCIL_FUNC, GL_MAX_TEXTURE_LOD_BIAS, GL_ALIASED_LINE_WIDTH_RANGE,
|
||||||
|
GL_DECR, GL_BACK, GL_TEXTURE_COMPARE_FUNC, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, GL_INT,
|
||||||
|
GL_COMPRESSED_SIGNED_RG11_EAC, GL_POLYGON_OFFSET_FILL, GL_MINOR_VERSION, GL_FRONT_AND_BACK, GL_R8,
|
||||||
|
GL_RGB_INTEGER, GL_STENCIL_CLEAR_VALUE, GL_SRGB, GL_GREEN_BITS, GL_SYNC_FENCE,
|
||||||
|
GL_ONE_MINUS_CONSTANT_COLOR, GL_SHADING_LANGUAGE_VERSION, GL_RGB8_SNORM, GL_UNPACK_SKIP_PIXELS, GL_TEXTURE_IMMUTABLE_LEVELS,
|
||||||
|
GL_FRAGMENT_SHADER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_SHORT_4_4_4_4, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, GL_FRAGMENT_SHADER_DERIVATIVE_HINT,
|
||||||
|
GL_NO_ERROR, GL_VIEWPORT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_BLEND_SRC_ALPHA, GL_DRAW_BUFFER6,
|
||||||
|
GL_DRAW_BUFFER7, GL_DRAW_BUFFER4, GL_DRAW_BUFFER5, GL_DRAW_BUFFER2, GL_DRAW_BUFFER3,
|
||||||
|
GL_DRAW_BUFFER0, GL_DRAW_BUFFER1, GL_COMPRESSED_SRGB8_ETC2, GL_QUERY_RESULT_AVAILABLE, GL_DRAW_BUFFER8,
|
||||||
|
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, GL_MAX_DRAW_BUFFERS, GL_KEEP, GL_DELETE_STATUS, GL_R32UI,
|
||||||
|
GL_RGBA8_SNORM, GL_INT_SAMPLER_3D, GL_SRC_COLOR, GL_SAMPLER_BINDING, GL_DEPTH24_STENCIL8,
|
||||||
|
GL_SAMPLE_BUFFERS, GL_MAJOR_VERSION, GL_STATIC_COPY, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, GL_EXTENSIONS,
|
||||||
|
GL_UNIFORM_BUFFER_BINDING, GL_UNIFORM_TYPE, GL_COPY_READ_BUFFER_BINDING, GL_TEXTURE_COMPARE_MODE, GL_ANY_SAMPLES_PASSED,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BACK_PASS_DEPTH_FAIL, GL_UNIFORM_BUFFER, GL_MAP_WRITE_BIT,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_POINTER, GL_ALIASED_POINT_SIZE_RANGE, GL_CCW, GL_MAP_INVALIDATE_BUFFER_BIT, GL_DEPTH_COMPONENT24,
|
||||||
|
GL_UNSIGNED_INT_5_9_9_9_REV, GL_DEPTH_TEST, GL_SYNC_GPU_COMMANDS_COMPLETE, GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
|
||||||
|
GL_MAX_VERTEX_UNIFORM_BLOCKS, GL_STREAM_READ, GL_LINEAR, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_FUNC_SUBTRACT,
|
||||||
|
GL_R32F, GL_MAX_VARYING_COMPONENTS, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, GL_IMPLEMENTATION_COLOR_READ_FORMAT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,
|
||||||
|
GL_MAX_ELEMENT_INDEX, GL_COLOR_ATTACHMENT15, GL_COLOR_ATTACHMENT14, GL_HIGH_FLOAT, GL_DEPTH_RANGE,
|
||||||
|
GL_GREATER, GL_CLAMP_TO_EDGE, GL_COLOR_ATTACHMENT13, GL_COLOR_ATTACHMENT12, GL_NEAREST,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_COLOR_ATTACHMENT19, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, GL_MAX_TEXTURE_IMAGE_UNITS, GL_RGB32F,
|
||||||
|
GL_FLOAT_MAT2, GL_FLOAT_MAT3, GL_FRONT_FACE, GL_DEPTH, GL_FLOAT_MAT4,
|
||||||
|
GL_RENDERBUFFER_GREEN_SIZE, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT, GL_TEXTURE30, GL_TEXTURE31,
|
||||||
|
GL_RG8I, GL_RGBA8I, GL_RG8UI, GL_DEPTH_CLEAR_VALUE, GL_BUFFER_MAP_POINTER,
|
||||||
|
GL_RENDERBUFFER_BINDING, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_STENCIL_REF, GL_MAX_3D_TEXTURE_SIZE, GL_COPY_WRITE_BUFFER_BINDING,
|
||||||
|
GL_COPY_WRITE_BUFFER, GL_BLEND, GL_MIRRORED_REPEAT, GL_R16UI, GL_TEXTURE_BINDING_3D,
|
||||||
|
GL_UNSIGNED_SHORT, GL_MIN, GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_TEXTURE,
|
||||||
|
GL_COLOR_BUFFER_BIT, GL_DONT_CARE, GL_ACTIVE_UNIFORMS, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_MAX_VERTEX_UNIFORM_VECTORS,
|
||||||
|
GL_TEXTURE_BINDING_CUBE_MAP, GL_SAMPLER_2D, GL_INVALID_VALUE, GL_DRAW_BUFFER12, GL_NEAREST_MIPMAP_NEAREST,
|
||||||
|
GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_PACK_SKIP_ROWS, GL_TEXTURE_MAG_FILTER, GL_TEXTURE1, GL_BLEND_EQUATION_RGB,
|
||||||
|
GL_LINK_STATUS, GL_TEXTURE_MAX_LEVEL, GL_R32I, GL_BLEND_COLOR, GL_ALPHA_BITS,
|
||||||
|
GL_BOOL_VEC4, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GL_ONE_MINUS_CONSTANT_ALPHA, GL_NEAREST_MIPMAP_LINEAR, GL_INT_2_10_10_10_REV,
|
||||||
|
GL_SAMPLER_CUBE_SHADOW, GL_WAIT_FAILED, GL_MAX_TEXTURE_SIZE, GL_RG32F, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY,
|
||||||
|
GL_ARRAY_BUFFER, GL_DEPTH_COMPONENT16, GL_UNSIGNALED, GL_RGB32I, GL_BLEND_SRC_RGB,
|
||||||
|
GL_FRAMEBUFFER_UNDEFINED, GL_SYNC_FLAGS, GL_FALSE, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_ONE_MINUS_SRC_ALPHA,
|
||||||
|
GL_RG32I, GL_RENDERBUFFER_INTERNAL_FORMAT, GL_NUM_SHADER_BINARY_FORMATS, GL_RGBA16I, GL_R8I,
|
||||||
|
GL_SAMPLE_ALPHA_TO_COVERAGE, GL_INT_SAMPLER_2D, GL_STENCIL_BITS, GL_STENCIL_PASS_DEPTH_FAIL, GL_RED,
|
||||||
|
GL_FUNC_REVERSE_SUBTRACT, GL_RGBA8UI, GL_GREEN, GL_INVALID_OPERATION, GL_RED_INTEGER,
|
||||||
|
GL_NONE, GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_COLOR_ATTACHMENT5, GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS, GL_COLOR_ATTACHMENT7,
|
||||||
|
GL_UNIFORM_BLOCK_NAME_LENGTH, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT2,
|
||||||
|
GL_UNIFORM_BLOCK_INDEX, GL_FRAMEBUFFER_DEFAULT, GL_RGBA16UI, GL_COLOR_ATTACHMENT9, GL_COLOR_ATTACHMENT8,
|
||||||
|
GL_COLOR_ATTACHMENT10, GL_FRONT, GL_SCISSOR_BOX, GL_UNIFORM_BLOCK_DATA_SIZE, GL_DEPTH_WRITEMASK,
|
||||||
|
GL_CULL_FACE_MODE, GL_MAX_FRAGMENT_UNIFORM_VECTORS, GL_NUM_EXTENSIONS, GL_UNIFORM_IS_ROW_MAJOR, GL_MAX_UNIFORM_BLOCK_SIZE,
|
||||||
|
GL_BOOL, GL_MAX_COMBINED_UNIFORM_BLOCKS, GL_FRAMEBUFFER_BINDING, GL_UNSIGNED_INT_24_8, GL_COMPRESSED_TEXTURE_FORMATS,
|
||||||
|
GL_ALPHA, GL_COLOR_WRITEMASK, GL_DST_COLOR, GL_UNSIGNED_INT, GL_DEPTH_FUNC,
|
||||||
|
GL_ALWAYS, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_INVALID_ENUM, GL_PROGRAM_BINARY_LENGTH,
|
||||||
|
GL_STENCIL_BACK_VALUE_MASK, GL_INT_SAMPLER_2D_ARRAY, GL_DEPTH_COMPONENT, GL_SCISSOR_TEST, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
|
||||||
|
GL_SHADER_TYPE, GL_COMPARE_REF_TO_TEXTURE, GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, GL_TRUE,
|
||||||
|
GL_TEXTURE_MIN_FILTER, GL_REPLACE, GL_BLUE_BITS, GL_RG_INTEGER, GL_TEXTURE_SWIZZLE_R,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_EQUAL, GL_TEXTURE_SWIZZLE_G, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER_HEIGHT,
|
||||||
|
GL_RG16UI, GL_INTERLEAVED_ATTRIBS, GL_TEXTURE_SWIZZLE_A, GL_POLYGON_OFFSET_UNITS, GL_LOW_FLOAT,
|
||||||
|
GL_HALF_FLOAT, GL_FLOAT_MAT4x3, GL_DYNAMIC_COPY, GL_COLOR_ATTACHMENT6, GL_UNPACK_ALIGNMENT,
|
||||||
|
GL_ALREADY_SIGNALED, GL_LINE_STRIP, GL_STREAM_COPY, GL_PACK_ROW_LENGTH, GL_NUM_SAMPLE_COUNTS,
|
||||||
|
GL_MEDIUM_INT, GL_TEXTURE_CUBE_MAP, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, GL_COLOR, GL_RENDERBUFFER_DEPTH_SIZE,
|
||||||
|
GL_DYNAMIC_READ, GL_PROGRAM_BINARY_FORMATS, GL_LOW_INT, GL_DEPTH_STENCIL, GL_VERTEX_ATTRIB_ARRAY_DIVISOR,
|
||||||
|
GL_MAX_VERTEX_OUTPUT_COMPONENTS, GL_POINTS, GL_COMPRESSED_RG11_EAC, GL_RENDERBUFFER_BLUE_SIZE, GL_UNIFORM_NAME_LENGTH,
|
||||||
|
GL_FASTEST, GL_SYNC_CONDITION, GL_ACTIVE_UNIFORM_MAX_LENGTH, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, GL_MAP_INVALIDATE_RANGE_BIT,
|
||||||
|
GL_TEXTURE23, GL_TEXTURE22, GL_TEXTURE21, GL_TEXTURE20, GL_TEXTURE27,
|
||||||
|
GL_TEXTURE26, GL_TEXTURE25, GL_TEXTURE24, GL_R8_SNORM, GL_TEXTURE29,
|
||||||
|
GL_TEXTURE28, GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
|
||||||
|
GL_LINE_LOOP, GL_READ_BUFFER, GL_MAP_FLUSH_EXPLICIT_BIT, GL_PACK_SKIP_PIXELS, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS,
|
||||||
|
GL_SUBPIXEL_BITS, GL_R16F, GL_GEQUAL, GL_READ_FRAMEBUFFER, GL_UNIFORM_BLOCK_BINDING,
|
||||||
|
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, GL_LINE_WIDTH, GL_UNIFORM_OFFSET, GL_LEQUAL, GL_TRANSFORM_FEEDBACK,
|
||||||
|
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_INT_SAMPLER_CUBE, GL_COLOR_ATTACHMENT4, GL_UNIFORM_SIZE, GL_FUNC_ADD,
|
||||||
|
GL_FLOAT_MAT4x2, GL_SHADER_SOURCE_LENGTH, GL_CURRENT_VERTEX_ATTRIB, GL_ARRAY_BUFFER_BINDING, GL_TEXTURE_2D,
|
||||||
|
GL_DYNAMIC_DRAW, GL_OUT_OF_MEMORY, GL_NICEST, GL_IMPLEMENTATION_COLOR_READ_TYPE, GL_UNPACK_ROW_LENGTH,
|
||||||
|
GL_CURRENT_PROGRAM, GL_BUFFER_MAPPED, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, GL_RASTERIZER_DISCARD, GL_NUM_PROGRAM_BINARY_FORMATS,
|
||||||
|
GL_STREAM_DRAW, GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, GL_MAX_UNIFORM_BUFFER_BINDINGS, GL_SIGNALED, GL_FRAMEBUFFER,
|
||||||
|
GL_UNPACK_SKIP_ROWS, GL_MEDIUM_FLOAT, GL_STENCIL_TEST, GL_R11F_G11F_B10F, GL_SRGB8,
|
||||||
|
GL_LUMINANCE_ALPHA, GL_PIXEL_UNPACK_BUFFER_BINDING, GL_INVERT, GL_STENCIL_BACK_FAIL, GL_POLYGON_OFFSET_FACTOR,
|
||||||
|
GL_TRANSFORM_FEEDBACK_VARYINGS, GL_DEPTH_COMPONENT32F, GL_TRIANGLE_FAN, GL_SYNC_FLUSH_COMMANDS_BIT, GL_ONE_MINUS_DST_ALPHA,
|
||||||
|
GL_DRAW_FRAMEBUFFER_BINDING, GL_MAX_ELEMENTS_VERTICES, GL_STENCIL_BACK_WRITEMASK, GL_INVALID_FRAMEBUFFER_OPERATION, GL_BUFFER_ACCESS_FLAGS,
|
||||||
|
GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNIFORM_BUFFER_SIZE, GL_TRIANGLES, GL_SAMPLER_2D_ARRAY_SHADOW, GL_DEPTH32F_STENCIL8,
|
||||||
|
GL_MAX_ARRAY_TEXTURE_LAYERS, GL_RED_BITS, GL_UNIFORM_MATRIX_STRIDE, GL_MAX_SERVER_WAIT_TIMEOUT, GL_SRGB8_ALPHA8,
|
||||||
|
GL_RGBA16F, GL_PACK_ALIGNMENT, GL_SAMPLER_2D_ARRAY, GL_RENDERER, GL_MAX_COLOR_ATTACHMENTS,
|
||||||
|
GL_ACTIVE_UNIFORM_BLOCKS, GL_UNPACK_SKIP_IMAGES, GL_STENCIL_BACK_FUNC, GL_RGB16I, GL_ACTIVE_TEXTURE,
|
||||||
|
GL_TEXTURE_BASE_LEVEL, GL_RGB16F, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_INT_SAMPLER_3D, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH,
|
||||||
|
GL_TEXTURE_WRAP_R, GL_INT_VEC4, GL_INT_VEC3, GL_INT_VEC2, GL_STENCIL_FAIL,
|
||||||
|
GL_MAX_VERTEX_ATTRIBS, GL_CONDITION_SATISFIED, GL_TEXTURE_IMMUTABLE_FORMAT, GL_FRAMEBUFFER_UNSUPPORTED, GL_DST_ALPHA,
|
||||||
|
GL_LESS, GL_MAX_CUBE_MAP_TEXTURE_SIZE, GL_RGB565, GL_TRANSFORM_FEEDBACK_BINDING, GL_RENDERBUFFER_WIDTH,
|
||||||
|
GL_READ_FRAMEBUFFER_BINDING, GL_RGBA4, GL_DRAW_BUFFER10, GL_DRAW_BUFFER11, GL_RGBA8,
|
||||||
|
GL_DRAW_BUFFER13, GL_DRAW_BUFFER14, GL_DRAW_BUFFER15, GL_INFO_LOG_LENGTH, GL_PRIMITIVE_RESTART_FIXED_INDEX,
|
||||||
|
GL_SRC_ALPHA_SATURATE, GL_RENDERBUFFER_STENCIL_SIZE, GL_REPEAT, GL_R16I, GL_RG8_SNORM,
|
||||||
|
GL_PIXEL_PACK_BUFFER, GL_STATIC_READ, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, GL_VALIDATE_STATUS,
|
||||||
|
GL_MAP_READ_BIT, GL_STENCIL, GL_STENCIL_BUFFER_BIT, GL_TEXTURE_SWIZZLE_B, GL_COLOR_ATTACHMENT17,
|
||||||
|
GL_BLEND_EQUATION_ALPHA, GL_RGBA_INTEGER, GL_ACTIVE_ATTRIBUTES, GL_MAX_RENDERBUFFER_SIZE, GL_COLOR_ATTACHMENT31,
|
||||||
|
GL_COLOR_ATTACHMENT30, GL_STENCIL_PASS_DEPTH_PASS, GL_INCR_WRAP, GL_RENDERBUFFER_ALPHA_SIZE, GL_HIGH_INT,
|
||||||
|
GL_COLOR_ATTACHMENT16, GL_DECR_WRAP, GL_ATTACHED_SHADERS, GL_MAX_FRAGMENT_INPUT_COMPONENTS, GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||||
|
GL_LINES, GL_TEXTURE18, GL_TEXTURE19, GL_TEXTURE16, GL_TEXTURE17,
|
||||||
|
GL_TEXTURE14, GL_GENERATE_MIPMAP_HINT, GL_TEXTURE12, GL_COLOR_ATTACHMENT11, GL_TEXTURE10,
|
||||||
|
GL_MAX_FRAGMENT_UNIFORM_BLOCKS, GL_BLEND_DST_ALPHA, GL_RGB, GL_INT_SAMPLER_CUBE, GL_CURRENT_QUERY,
|
||||||
|
GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_RGB5_A1, GL_VERTEX_SHADER, GL_TRANSFORM_FEEDBACK_BUFFER_START, GL_MAX_PROGRAM_TEXEL_OFFSET,
|
||||||
|
GL_SHADER_BINARY_FORMATS, GL_CONSTANT_COLOR, GL_RGBA32F, GL_RGBA32I, GL_VERTEX_ATTRIB_ARRAY_TYPE,
|
||||||
|
GL_PIXEL_UNPACK_BUFFER, GL_LINEAR_MIPMAP_NEAREST, GL_STENCIL_WRITEMASK, GL_RG8, GL_RGB10_A2,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, GL_VERSION, GL_MAP_UNSYNCHRONIZED_BIT, GL_ZERO, GL_ELEMENT_ARRAY_BUFFER,
|
||||||
|
GL_SYNC_STATUS, GL_BUFFER_MAP_LENGTH, GL_MAX_ELEMENTS_INDICES, GL_UNSIGNED_NORMALIZED, GL_CONSTANT_ALPHA,
|
||||||
|
GL_SRC_ALPHA, GL_TEXTURE_3D, GL_FIXED, GL_RGB8, GL_SAMPLE_COVERAGE_INVERT,
|
||||||
|
GL_NOTEQUAL, GL_UNIFORM_ARRAY_STRIDE, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_INCR, GL_CULL_FACE,
|
||||||
|
GL_SAMPLE_COVERAGE_VALUE, GL_RENDERBUFFER_RED_SIZE, GL_MAX_VIEWPORT_DIMS, GL_RG32UI, GL_NEVER,
|
||||||
|
GL_TEXTURE15, GL_STENCIL_VALUE_MASK, GL_TEXTURE13, GL_DRAW_BUFFER9, GL_COMPILE_STATUS,
|
||||||
|
GL_FRAMEBUFFER_COMPLETE, GL_TEXTURE11, GL_COPY_READ_BUFFER, GL_SHADER_COMPILER, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
|
||||||
|
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, GL_LUMINANCE, GL_RGBA, GL_SHORT, GL_BLUE,
|
||||||
|
GL_CW, GL_MIN_PROGRAM_TEXEL_OFFSET, GL_UNSIGNED_BYTE, GL_MAX_VERTEX_UNIFORM_COMPONENTS, GL_VENDOR,
|
||||||
|
GL_TEXTURE_2D_ARRAY, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_TEXTURE_BINDING_2D, GL_OBJECT_TYPE, GL_R8UI,
|
||||||
|
GL_STATIC_DRAW, GL_RENDERBUFFER, GL_FLOAT_MAT2x3, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, GL_FLOAT_MAT2x4,
|
||||||
|
GL_RGB8I, GL_COLOR_ATTACHMENT18, GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, GL_TRANSFORM_FEEDBACK_ACTIVE, GL_SEPARATE_ATTRIBS,
|
||||||
|
GL_SAMPLER_3D, GL_MAX, GL_STENCIL_INDEX8, GL_DEPTH_BITS, GL_RGB8UI,
|
||||||
|
GL_STENCIL_BACK_REF, GL_INVALID_INDEX, GL_BLEND_DST_RGB, GL_SAMPLER_2D_SHADOW, GL_TEXTURE_BINDING_2D_ARRAY,
|
||||||
|
GL_RG16F, GL_SAMPLER_CUBE, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_RG16I,
|
||||||
|
GL_PIXEL_PACK_BUFFER_BINDING, GL_STENCIL_ATTACHMENT, GL_SAMPLE_COVERAGE, GL_ANY_SAMPLES_PASSED_CONSERVATIVE, GL_DRAW_FRAMEBUFFER,
|
||||||
|
GL_RGB10_A2UI, GL_SAMPLES;
|
||||||
|
|
||||||
1323
demos/external/sources/glad/gl/loader.d
vendored
Normal file
1323
demos/external/sources/glad/gl/loader.d
vendored
Normal file
File diff suppressed because it is too large
Load diff
46
demos/external/sources/glad/gl/types.d
vendored
Normal file
46
demos/external/sources/glad/gl/types.d
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
module glad.gl.types;
|
||||||
|
|
||||||
|
|
||||||
|
alias GLvoid = void;
|
||||||
|
alias GLintptr = ptrdiff_t;
|
||||||
|
alias GLsizei = int;
|
||||||
|
alias GLchar = char;
|
||||||
|
alias GLcharARB = byte;
|
||||||
|
alias GLushort = ushort;
|
||||||
|
alias GLint64EXT = long;
|
||||||
|
alias GLshort = short;
|
||||||
|
alias GLuint64 = ulong;
|
||||||
|
alias GLhalfARB = ushort;
|
||||||
|
alias GLubyte = ubyte;
|
||||||
|
alias GLdouble = double;
|
||||||
|
alias GLhandleARB = uint;
|
||||||
|
alias GLint64 = long;
|
||||||
|
alias GLenum = uint;
|
||||||
|
alias GLeglImageOES = void*;
|
||||||
|
alias GLintptrARB = ptrdiff_t;
|
||||||
|
alias GLsizeiptr = ptrdiff_t;
|
||||||
|
alias GLint = int;
|
||||||
|
alias GLboolean = ubyte;
|
||||||
|
alias GLbitfield = uint;
|
||||||
|
alias GLsizeiptrARB = ptrdiff_t;
|
||||||
|
alias GLfloat = float;
|
||||||
|
alias GLuint64EXT = ulong;
|
||||||
|
alias GLclampf = float;
|
||||||
|
alias GLbyte = byte;
|
||||||
|
alias GLclampd = double;
|
||||||
|
alias GLuint = uint;
|
||||||
|
alias GLvdpauSurfaceNV = ptrdiff_t;
|
||||||
|
alias GLfixed = int;
|
||||||
|
alias GLhalf = ushort;
|
||||||
|
alias GLclampx = int;
|
||||||
|
alias GLhalfNV = ushort;
|
||||||
|
struct ___GLsync; alias __GLsync = ___GLsync*;
|
||||||
|
alias GLsync = __GLsync*;
|
||||||
|
struct __cl_context; alias _cl_context = __cl_context*;
|
||||||
|
struct __cl_event; alias _cl_event = __cl_event*;
|
||||||
|
extern(System) {
|
||||||
|
alias GLDEBUGPROC = void function(GLenum, GLenum, GLuint, GLenum, GLsizei, in GLchar*, GLvoid*);
|
||||||
|
alias GLDEBUGPROCARB = GLDEBUGPROC;
|
||||||
|
alias GLDEBUGPROCKHR = GLDEBUGPROC;
|
||||||
|
alias GLDEBUGPROCAMD = void function(GLuint, GLenum, GLenum, GLsizei, in GLchar*, GLvoid*);
|
||||||
|
}
|
||||||
1694
demos/external/sources/mmutils/thread_pool.d
vendored
Normal file
1694
demos/external/sources/mmutils/thread_pool.d
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,216 +0,0 @@
|
||||||
module source.app;
|
|
||||||
|
|
||||||
import ecs.std;
|
|
||||||
import ecs.core;
|
|
||||||
import ecs.manager;
|
|
||||||
import ecs.attributes;
|
|
||||||
import ecs.entity;
|
|
||||||
|
|
||||||
import bindbc.sdl;
|
|
||||||
|
|
||||||
import utils.utils;
|
|
||||||
import utils.texture;
|
|
||||||
|
|
||||||
import ecs_utils.math.vector;
|
|
||||||
|
|
||||||
version (WebAssembly)
|
|
||||||
{
|
|
||||||
extern (C) void _start()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Renderer *renderer;
|
|
||||||
SDL_Window* window;
|
|
||||||
Texture texture;
|
|
||||||
EntityManager* manager;
|
|
||||||
|
|
||||||
struct CLocation
|
|
||||||
{
|
|
||||||
mixin ECS.Component;
|
|
||||||
|
|
||||||
alias location this;
|
|
||||||
|
|
||||||
vec2 location;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CTexture
|
|
||||||
{
|
|
||||||
mixin ECS.Component;
|
|
||||||
|
|
||||||
Texture tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DrawSystem
|
|
||||||
{
|
|
||||||
mixin ECS.System;
|
|
||||||
|
|
||||||
struct EntitiesData
|
|
||||||
{
|
|
||||||
uint length;
|
|
||||||
@readonly CTexture[] textures;
|
|
||||||
@readonly CLocation[] locations;
|
|
||||||
}
|
|
||||||
|
|
||||||
void onUpdate(EntitiesData data)
|
|
||||||
{
|
|
||||||
foreach(i; 0..data.length)
|
|
||||||
{
|
|
||||||
draw(renderer, data.textures[i].tex, data.locations[i], vec2(32,32), vec4(0,0,1,1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MoveSystem
|
|
||||||
{
|
|
||||||
mixin ECS.System;
|
|
||||||
|
|
||||||
struct EntitiesData
|
|
||||||
{
|
|
||||||
uint length;
|
|
||||||
CLocation[] locations;
|
|
||||||
}
|
|
||||||
|
|
||||||
void onUpdate(EntitiesData data)
|
|
||||||
{
|
|
||||||
foreach(i; 0..data.length)
|
|
||||||
{
|
|
||||||
data.locations[i].location.y = data.locations[i].location.y + 1;
|
|
||||||
if(data.locations[i].location.y > 400)data.locations[i].location.y = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern (C) int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
fps = 0;
|
|
||||||
time = 0;
|
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
|
||||||
{
|
|
||||||
printf("SDL could not initialize! SDL_Error: %s", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_version sdl_version;
|
|
||||||
SDL_GetVersion(&sdl_version);
|
|
||||||
printf("SDL version: %u.%u.%u\n",cast(uint)sdl_version.major,cast(uint)sdl_version.minor,cast(uint)sdl_version.patch);
|
|
||||||
|
|
||||||
SDL_Window* window = SDL_CreateWindow("Simple", SDL_WINDOWPOS_CENTERED,
|
|
||||||
SDL_WINDOWPOS_CENTERED, 600, 400, SDL_WINDOW_SHOWN);
|
|
||||||
//SDL_CreateWindowAndRenderer(600, 400, SDL_RENDERER_ACCELERATED, &window, &renderer);
|
|
||||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
|
||||||
SDL_SetRenderDrawColor(renderer, 1, 255, 255, 255);
|
|
||||||
|
|
||||||
texture.create();
|
|
||||||
texture.load(renderer, "assets/textures/buckler.png");
|
|
||||||
|
|
||||||
EntityManager.initialize(8);
|
|
||||||
manager = EntityManager.instance;
|
|
||||||
|
|
||||||
manager.beginRegister();
|
|
||||||
|
|
||||||
manager.registerComponent!CLocation;
|
|
||||||
manager.registerComponent!CTexture;
|
|
||||||
|
|
||||||
manager.registerSystem!MoveSystem(64);
|
|
||||||
manager.registerSystem!DrawSystem(64);
|
|
||||||
|
|
||||||
manager.endRegister();
|
|
||||||
|
|
||||||
ushort[2] components = [CLocation.component_id, CTexture.component_id];
|
|
||||||
EntityTemplate* tmpl = manager.allocateTemplate(components);
|
|
||||||
CTexture* tex_comp = tmpl.getComponent!CTexture;
|
|
||||||
tex_comp.tex = texture;
|
|
||||||
CLocation* loc_comp = tmpl.getComponent!CLocation;
|
|
||||||
// loc_comp.location = vec2(64,64);
|
|
||||||
|
|
||||||
foreach(i; 0..10)
|
|
||||||
foreach(j; 0..10)
|
|
||||||
{
|
|
||||||
loc_comp.location = vec2(i*32+64,j*32+64);
|
|
||||||
manager.addEntity(tmpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
manager.freeTemplate(tmpl);
|
|
||||||
|
|
||||||
/*image = IMG_Load("assets/owl.png");
|
|
||||||
tex = SDL_CreateTextureFromSurface(renderer, image);*/
|
|
||||||
|
|
||||||
version(WebAssembly)
|
|
||||||
{
|
|
||||||
emscripten_set_main_loop_arg(&loop, null, -1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool arg = true;
|
|
||||||
while(arg == true)
|
|
||||||
{
|
|
||||||
loop(&arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window !is null) {
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
end();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
long time;
|
|
||||||
uint fps;
|
|
||||||
|
|
||||||
extern(C) void loop(void *arg = null)
|
|
||||||
{
|
|
||||||
static float fps_time = 0;
|
|
||||||
float delta_time = cast(float)(Time.getUSecTime() - time);
|
|
||||||
if(delta_time > 1000_000)delta_time = 1000;
|
|
||||||
time = Time.getUSecTime();
|
|
||||||
|
|
||||||
if(fps_time < 0)fps_time = 0;
|
|
||||||
|
|
||||||
fps++;
|
|
||||||
fps_time += delta_time;
|
|
||||||
if(fps_time > 1000_000)
|
|
||||||
{
|
|
||||||
|
|
||||||
printf("FPS: %u\n",fps);
|
|
||||||
fps = 0;
|
|
||||||
fps_time -= 1000_000;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Event event;
|
|
||||||
while (SDL_PollEvent(&event))
|
|
||||||
{
|
|
||||||
if (event.type == SDL_QUIT) {
|
|
||||||
version(WebAssembly)emscripten_cancel_main_loop();
|
|
||||||
*cast(bool*)arg = false;
|
|
||||||
//return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.type == SDL_KEYDOWN) {
|
|
||||||
version(WebAssembly)emscripten_cancel_main_loop();
|
|
||||||
*cast(bool*)arg = false;
|
|
||||||
//return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_RenderClear(renderer);
|
|
||||||
|
|
||||||
manager.begin();
|
|
||||||
manager.update();
|
|
||||||
manager.end();
|
|
||||||
|
|
||||||
draw(renderer,texture,vec2(32,32),vec2(32,32),vec4(0,0,1,1));
|
|
||||||
//SDL_RenderCopy(ctx->renderer, ctx->owl_tex, NULL, &ctx->dest);
|
|
||||||
SDL_RenderPresent(renderer);
|
|
||||||
|
|
||||||
//return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void end()
|
|
||||||
{
|
|
||||||
EntityManager.destroy();
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
module utils.texture;
|
|
||||||
|
|
||||||
import ecs.std;
|
|
||||||
|
|
||||||
import bindbc.sdl;
|
|
||||||
import bindbc.sdl.image;
|
|
||||||
|
|
||||||
import ecs_utils.math.vector;
|
|
||||||
|
|
||||||
struct Texture
|
|
||||||
{
|
|
||||||
|
|
||||||
void create()
|
|
||||||
{
|
|
||||||
data = Mallocator.make!Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool load(SDL_Renderer* renderer, const char[] path)
|
|
||||||
{
|
|
||||||
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
|
||||||
//cpath[0..$-1] = path[0..$];
|
|
||||||
memcpy(cpath.ptr, path.ptr, path.length);
|
|
||||||
cpath[$-1] = 0;
|
|
||||||
|
|
||||||
SDL_Surface* surf = IMG_Load(cpath.ptr);
|
|
||||||
if(!surf)return false;
|
|
||||||
|
|
||||||
data.size = ivec2(surf.w,surf.h);
|
|
||||||
|
|
||||||
data.texture = SDL_CreateTextureFromSurface(renderer,surf);
|
|
||||||
SDL_FreeSurface(surf);
|
|
||||||
|
|
||||||
if(!data.texture)return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Data
|
|
||||||
{
|
|
||||||
ubyte[] data;
|
|
||||||
|
|
||||||
ivec2 size;
|
|
||||||
uint bpp;
|
|
||||||
|
|
||||||
SDL_Texture* texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
Data* data;
|
|
||||||
}
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
module utils.utils;
|
|
||||||
|
|
||||||
extern(C) int printf(scope const char* format, ...) @nogc nothrow @system;
|
|
||||||
|
|
||||||
version(WebAssembly)
|
|
||||||
{
|
|
||||||
|
|
||||||
extern (C) alias em_callback_func = void function();
|
|
||||||
extern (C) alias em_arg_callback_func = void function(void*);
|
|
||||||
extern (C) void emscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop);
|
|
||||||
extern (C) void emscripten_set_main_loop_arg(em_arg_callback_func func, void *arg, int fps, int simulate_infinite_loop);
|
|
||||||
extern (C) int emscripten_set_main_loop_timing(int mode, int value);
|
|
||||||
extern (C) void emscripten_cancel_main_loop();
|
|
||||||
|
|
||||||
alias int time_t;
|
|
||||||
alias int clockid_t;
|
|
||||||
enum CLOCK_REALTIME = 0;
|
|
||||||
|
|
||||||
struct timespec
|
|
||||||
{
|
|
||||||
time_t tv_sec;
|
|
||||||
int tv_nsec;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern(C) int clock_gettime(clockid_t, timespec*) @nogc nothrow @system;
|
|
||||||
|
|
||||||
struct Time
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
static long getUSecTime()
|
|
||||||
{
|
|
||||||
time_t time;
|
|
||||||
timespec spec;
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &spec);
|
|
||||||
|
|
||||||
//time = spec.tv_sec;
|
|
||||||
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000;//time / 1000_000;
|
|
||||||
|
|
||||||
/*LARGE_INTEGER time, freq;
|
|
||||||
QueryPerformanceFrequency(&freq);
|
|
||||||
QueryPerformanceCounter(&time);
|
|
||||||
return time.QuadPart / (freq.QuadPart / 1000_000);*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else version(Windows)
|
|
||||||
{
|
|
||||||
import core.stdc.stdio : printf;
|
|
||||||
import core.sys.windows.windows;
|
|
||||||
struct Time
|
|
||||||
{
|
|
||||||
static long getUSecTime()
|
|
||||||
{
|
|
||||||
LARGE_INTEGER time, freq;
|
|
||||||
QueryPerformanceFrequency(&freq);
|
|
||||||
QueryPerformanceCounter(&time);
|
|
||||||
return time.QuadPart / (freq.QuadPart / 1000_000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else version(Posix)
|
|
||||||
{
|
|
||||||
import core.stdc.stdio : printf;
|
|
||||||
import core.sys.posix.time;
|
|
||||||
struct Time
|
|
||||||
{
|
|
||||||
static long getUSecTime()
|
|
||||||
{
|
|
||||||
time_t time;
|
|
||||||
timespec spec;
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &spec);
|
|
||||||
|
|
||||||
//time = spec.tv_sec;
|
|
||||||
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000;//time / 1000_000;
|
|
||||||
|
|
||||||
/*LARGE_INTEGER time, freq;
|
|
||||||
QueryPerformanceFrequency(&freq);
|
|
||||||
QueryPerformanceCounter(&time);
|
|
||||||
return time.QuadPart / (freq.QuadPart / 1000_000);*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
import bindbc.sdl;
|
|
||||||
import utils.texture;
|
|
||||||
import ecs_utils.math.vector;
|
|
||||||
|
|
||||||
ivec2 resolution = ivec2(600, 400);
|
|
||||||
|
|
||||||
void draw(SDL_Renderer* renderer, Texture tex, vec2 pos, vec2 size, vec4 coords, float angle = 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
SDL_Rect rect = SDL_Rect(cast(int)(coords.x*tex.data.size.x),cast(int)(coords.y*tex.data.size.y),cast(int)(coords.z*tex.data.size.x),cast(int)(coords.w*tex.data.size.y));
|
|
||||||
SDL_Rect rect2 = SDL_Rect(cast(int)((pos.x-size.x*0.5)),
|
|
||||||
cast(int)(resolution.y - pos.y - size.y*0.5),
|
|
||||||
cast(int)(size.x),
|
|
||||||
cast(int)(size.y));
|
|
||||||
|
|
||||||
SDL_RenderCopyEx(renderer,
|
|
||||||
tex.data.texture,
|
|
||||||
&rect,
|
|
||||||
&rect2,
|
|
||||||
angle*360,
|
|
||||||
null,
|
|
||||||
SDL_FLIP_NONE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -5,21 +5,19 @@
|
||||||
],
|
],
|
||||||
"description": "Dynamic Entity Component System examples utils",
|
"description": "Dynamic Entity Component System examples utils",
|
||||||
"copyright": "Copyright © 2018-2019, Michał Masiukiewicz, Dawid Masiukiewicz",
|
"copyright": "Copyright © 2018-2019, Michał Masiukiewicz, Dawid Masiukiewicz",
|
||||||
"license": "BSD",
|
"license": "BSD 3-clause",
|
||||||
"sourcePaths" : [
|
"sourcePaths" : [
|
||||||
"source\/"
|
"source",
|
||||||
|
"../external/sources"
|
||||||
],
|
],
|
||||||
"importPaths": [
|
"importPaths": [
|
||||||
"source"
|
"source",
|
||||||
],
|
"../external/imports",
|
||||||
"dflags-posix-ldc": [
|
"../external/sources"
|
||||||
"-defaultlib=phobos2-ldc,druntime-ldc"
|
|
||||||
],
|
|
||||||
"dflagss": [
|
|
||||||
"-betterC"
|
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bindbc-sdl":"0.10.1"
|
"bindbc-sdl":"0.13.0",
|
||||||
|
"ecs":{"path":"../../"}
|
||||||
},
|
},
|
||||||
"versions": [
|
"versions": [
|
||||||
"BindSDL_Image",
|
"BindSDL_Image",
|
||||||
|
|
@ -32,7 +30,8 @@
|
||||||
"targetType" : "library",
|
"targetType" : "library",
|
||||||
"subConfigurations":
|
"subConfigurations":
|
||||||
{
|
{
|
||||||
"bindbc-sdl": "static"
|
"bindbc-sdl": "static",
|
||||||
|
"ecs":"library"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -43,7 +42,8 @@
|
||||||
],
|
],
|
||||||
"subConfigurations":
|
"subConfigurations":
|
||||||
{
|
{
|
||||||
"bindbc-sdl": "staticBC"
|
"bindbc-sdl": "staticBC",
|
||||||
|
"ecs":"library-betterC"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
134
demos/utils/source/ecs_utils/gfx/buffer.d
Normal file
134
demos/utils/source/ecs_utils/gfx/buffer.d
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
module ecs_utils.gfx.buffer;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
import glad.gl.gles2;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
struct Buffer
|
||||||
|
{
|
||||||
|
|
||||||
|
void create() nothrow
|
||||||
|
{
|
||||||
|
data = Mallocator.make!Data;
|
||||||
|
data.gl_handle = 0;
|
||||||
|
glGenBuffers(1,&data.gl_handle);
|
||||||
|
data.elem_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void destroy() nothrow
|
||||||
|
{
|
||||||
|
if(data.gl_handle)glDeleteBuffers(1,&data.gl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void bind(BindTarget target) nothrow
|
||||||
|
{
|
||||||
|
//if(vbo != this)glBindBuffer(GL_ARRAY_BUFFER,data.gl_handle);
|
||||||
|
//vbo = this;
|
||||||
|
glBindBuffer(target,data.gl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bindRange(BindTarget target, uint index, uint offset, uint size) nothrow
|
||||||
|
{
|
||||||
|
glBindBufferRange(target, index, data.gl_handle, offset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void bufferData(BindTarget target, uint size, uint count, uint usage, void* data) nothrow
|
||||||
|
{
|
||||||
|
bind(target);
|
||||||
|
this.data.elem_size = size;
|
||||||
|
glBufferData(target,size*count,data,usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void bufferStorage(uint size, uint count, void* data, uint flags = StorageFlagBits.write)
|
||||||
|
{
|
||||||
|
bind(BindTarget.array);
|
||||||
|
this.data.elem_size = size;
|
||||||
|
glBufferStorage(GL_ARRAY_BUFFER,size*count,data, flags);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
void bufferSubData(uint size, uint offset, void* data) nothrow
|
||||||
|
{
|
||||||
|
bind(BindTarget.array);
|
||||||
|
glBufferSubData(GL_ARRAY_BUFFER,offset,size,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void map(BindTarget target) nothrow
|
||||||
|
{
|
||||||
|
bind(target);
|
||||||
|
data.map_ptr = glMapBuffer(target,GL_WRITE_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void map(uint offset, uint size, BindTarget target, uint flags = MapFlagBits.write | MapFlagBits.flush_explict | MapFlagBits.invalidate_buffer) nothrow
|
||||||
|
{
|
||||||
|
bind(target);
|
||||||
|
data.map_ptr = glMapBufferRange(target,offset,size,flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void flush(uint offset, uint size, BindTarget target) nothrow
|
||||||
|
{
|
||||||
|
glFlushMappedBufferRange(target, offset, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unmap(BindTarget target) nothrow
|
||||||
|
{
|
||||||
|
bind(target);
|
||||||
|
glUnmapBuffer(target);
|
||||||
|
data.map_ptr = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* mappedPointer() nothrow
|
||||||
|
{
|
||||||
|
return data.map_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void unbind(BindTarget target) nothrow
|
||||||
|
{
|
||||||
|
//vbo = 0;
|
||||||
|
glBindBuffer(target,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum BindTarget
|
||||||
|
{
|
||||||
|
array = GL_ARRAY_BUFFER,
|
||||||
|
element_array = GL_ELEMENT_ARRAY_BUFFER,
|
||||||
|
uniform = GL_UNIFORM_BUFFER,
|
||||||
|
//shader_storage = GL_SHADER_STORAGE_BUFFER,
|
||||||
|
//indirect = GL_DRAW_INDIRECT_BUFFER
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MapFlagBits
|
||||||
|
{
|
||||||
|
write = GL_MAP_WRITE_BIT,
|
||||||
|
invalidate_buffer = GL_MAP_INVALIDATE_BUFFER_BIT,
|
||||||
|
flush_explict = GL_MAP_FLUSH_EXPLICIT_BIT,
|
||||||
|
//coherent = GL_MAP_COHERENT_BIT,
|
||||||
|
//persistent = GL_MAP_PERSISTENT_BIT
|
||||||
|
}
|
||||||
|
|
||||||
|
enum StorageFlagBits
|
||||||
|
{
|
||||||
|
write = GL_MAP_WRITE_BIT,
|
||||||
|
//coherent = GL_MAP_COHERENT_BIT,
|
||||||
|
//persistent = GL_MAP_PERSISTENT_BIT
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
uint elem_size;
|
||||||
|
uint gl_handle;
|
||||||
|
void* map_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Data* data;
|
||||||
|
}
|
||||||
102
demos/utils/source/ecs_utils/gfx/config.d
Normal file
102
demos/utils/source/ecs_utils/gfx/config.d
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
module ecs_utils.gfx.config;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import ecs_utils.gfx.material;
|
||||||
|
import ecs_utils.gfx.mesh;
|
||||||
|
import ecs_utils.gfx.texture;
|
||||||
|
|
||||||
|
//import mutils.serializer.json;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
enum LayerType
|
||||||
|
{
|
||||||
|
normal,
|
||||||
|
sorted
|
||||||
|
}
|
||||||
|
|
||||||
|
import ecs.vector;
|
||||||
|
|
||||||
|
static struct GfxConfig
|
||||||
|
{
|
||||||
|
extern(C):
|
||||||
|
__gshared:
|
||||||
|
Vector!LayerType layers;
|
||||||
|
//Vector!Mesh meshes;
|
||||||
|
//Vector!Material materials;
|
||||||
|
Mesh[] meshes;
|
||||||
|
Material[] materials;
|
||||||
|
|
||||||
|
static bool load(const (char)[] path) nothrow
|
||||||
|
{
|
||||||
|
struct LoadData
|
||||||
|
{
|
||||||
|
struct Str
|
||||||
|
{
|
||||||
|
@("malloc") string str;
|
||||||
|
}
|
||||||
|
|
||||||
|
@("malloc") Str[] materials;
|
||||||
|
@("malloc") Str[] meshes;
|
||||||
|
int inter;
|
||||||
|
|
||||||
|
void dispose() nothrow
|
||||||
|
{
|
||||||
|
/*if(blend_mode)Mallocator.instance.dispose(cast(char[])blend_mode);
|
||||||
|
if(vertex)Mallocator.instance.dispose(cast(char[])vertex);
|
||||||
|
if(fragment)Mallocator.instance.dispose(cast(char[])fragment);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
||||||
|
cpath[0..$-1] = path[0..$];
|
||||||
|
cpath[$-1] = 0;
|
||||||
|
|
||||||
|
SDL_RWops* file = SDL_RWFromFile(cpath.ptr,"r");
|
||||||
|
if(file)
|
||||||
|
{
|
||||||
|
size_t size = cast(size_t)SDL_RWsize(file);
|
||||||
|
char[] buffer = Mallocator.makeArray!char(size);
|
||||||
|
SDL_RWread(file,buffer.ptr,size,1);
|
||||||
|
|
||||||
|
LoadData load_data;
|
||||||
|
scope(exit)load_data.dispose();
|
||||||
|
|
||||||
|
/*JSONSerializer serializer = Mallocator.make!JSONSerializer;
|
||||||
|
scope(exit)Mallocator.dispose(serializer);
|
||||||
|
serializer.serialize!(Load.yes, true)(load_data,buffer);*/
|
||||||
|
|
||||||
|
//if(__ecs_used_backend == Backend.opengl)
|
||||||
|
{
|
||||||
|
meshes = Mallocator.makeArray!Mesh(load_data.meshes.length);
|
||||||
|
foreach(i,ref mesh; meshes)
|
||||||
|
{
|
||||||
|
mesh.load(load_data.meshes[i].str);
|
||||||
|
mesh.uploadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
materials = Mallocator.makeArray!Material(load_data.materials.length);
|
||||||
|
foreach(i,ref material; materials)
|
||||||
|
{
|
||||||
|
material.create();
|
||||||
|
material.load(load_data.materials[i].str);
|
||||||
|
material.compile();
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_RWclose(file);
|
||||||
|
load_data.dispose();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int addLayer(LayerType type)
|
||||||
|
{
|
||||||
|
layers.add(type);
|
||||||
|
return cast(int)(layers.length-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
198
demos/utils/source/ecs_utils/gfx/material.d
Normal file
198
demos/utils/source/ecs_utils/gfx/material.d
Normal file
|
|
@ -0,0 +1,198 @@
|
||||||
|
module ecs_utils.gfx.material;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import ecs_utils.gfx.shader;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
|
||||||
|
//import mutils.serializer.json;
|
||||||
|
|
||||||
|
struct Material
|
||||||
|
{
|
||||||
|
|
||||||
|
void create() nothrow
|
||||||
|
{
|
||||||
|
data = Mallocator.make!Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load(const char[] path) nothrow
|
||||||
|
{
|
||||||
|
struct LoadData
|
||||||
|
{
|
||||||
|
@("malloc") string blend_mode;
|
||||||
|
@("malloc") string vertex;
|
||||||
|
@("malloc") string fragment;
|
||||||
|
|
||||||
|
void dispose() nothrow
|
||||||
|
{
|
||||||
|
//if(blend_mode)Mallocator.instance.dispose(cast(char[])blend_mode);
|
||||||
|
//if(vertex)Mallocator.instance.dispose(cast(char[])vertex);
|
||||||
|
//if(fragment)Mallocator.instance.dispose(cast(char[])fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
||||||
|
cpath[0..$-1] = path[0..$];
|
||||||
|
cpath[$-1] = 0;
|
||||||
|
|
||||||
|
SDL_RWops* file = SDL_RWFromFile(cpath.ptr,"r");
|
||||||
|
if(file)
|
||||||
|
{
|
||||||
|
size_t size = cast(size_t)SDL_RWsize(file);
|
||||||
|
char[] buffer = Mallocator.makeArray!char(size);
|
||||||
|
SDL_RWread(file,buffer.ptr,size,1);
|
||||||
|
|
||||||
|
LoadData load_data;
|
||||||
|
scope(exit)load_data.dispose();
|
||||||
|
|
||||||
|
/*JSONSerializer serializer = Mallocator.make!JSONSerializer;
|
||||||
|
scope(exit)Mallocator.dispose(serializer);
|
||||||
|
serializer.serialize!(Load.yes, true)(load_data,buffer);*/
|
||||||
|
|
||||||
|
//if(__ecs_used_backend == Backend.opengl)
|
||||||
|
{
|
||||||
|
Shader vsh;
|
||||||
|
vsh.load(load_data.vertex);
|
||||||
|
vsh.compile();
|
||||||
|
|
||||||
|
Shader fsh;
|
||||||
|
fsh.load(load_data.fragment);
|
||||||
|
fsh.compile();
|
||||||
|
|
||||||
|
Material.ShaderModule[1] modules = [Material.ShaderModule(vsh,fsh)];
|
||||||
|
|
||||||
|
attachModules(modules);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_RWclose(file);
|
||||||
|
load_data.dispose();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind() nothrow
|
||||||
|
{
|
||||||
|
glUseProgram(data.modules[0].gl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum BlendMode
|
||||||
|
{
|
||||||
|
opaque,
|
||||||
|
additive,
|
||||||
|
mixed
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TransformMode
|
||||||
|
{
|
||||||
|
position,
|
||||||
|
matrix
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ShaderModule
|
||||||
|
{
|
||||||
|
Shader fragment_shader;
|
||||||
|
Shader vertex_shader;
|
||||||
|
uint gl_handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void attachModules(scope ShaderModule[] modules) nothrow
|
||||||
|
{
|
||||||
|
data.modules = Mallocator.makeArray(modules);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool compile() nothrow
|
||||||
|
{
|
||||||
|
foreach(ref module_;data.modules)
|
||||||
|
{
|
||||||
|
module_.gl_handle = glCreateProgram();
|
||||||
|
glAttachShader(module_.gl_handle, module_.vertex_shader.data.gl_handle);
|
||||||
|
glAttachShader(module_.gl_handle, module_.fragment_shader.data.gl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bindAttribLocation(const char* name, uint location) nothrow
|
||||||
|
{
|
||||||
|
foreach(ref module_;data.modules)
|
||||||
|
{
|
||||||
|
glBindAttribLocation(module_.gl_handle, location, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool link() nothrow
|
||||||
|
{
|
||||||
|
foreach(ref module_;data.modules)
|
||||||
|
{
|
||||||
|
glLinkProgram(module_.gl_handle);
|
||||||
|
|
||||||
|
GLint ok = 0;
|
||||||
|
glGetProgramiv(module_.gl_handle, GL_LINK_STATUS, &ok);
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
SDL_Log("Program link error!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getLocation(const char* name)
|
||||||
|
{
|
||||||
|
foreach(ref module_;data.modules)
|
||||||
|
{
|
||||||
|
int location = glGetUniformLocation(module_.gl_handle,name);
|
||||||
|
if(location != -1)return location;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushBindings()
|
||||||
|
{
|
||||||
|
foreach(i;0..data.bindings.length)
|
||||||
|
{
|
||||||
|
glUniform1i(data.bindings[i],cast(int)i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushUniforms(void* ptr)
|
||||||
|
{
|
||||||
|
foreach(ref Uniform uniform; data.uniforms)
|
||||||
|
{
|
||||||
|
void* local_ptr = ptr + uniform.offset;
|
||||||
|
glUniform4fv(uniform.location,1,cast(float*)local_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
float_,
|
||||||
|
float4
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Uniform
|
||||||
|
{
|
||||||
|
Type type;
|
||||||
|
int location;
|
||||||
|
uint offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
BlendMode blend_mode = BlendMode.opaque;
|
||||||
|
|
||||||
|
ShaderModule[] modules;
|
||||||
|
|
||||||
|
TransformMode mode;
|
||||||
|
|
||||||
|
Uniform[] uniforms;
|
||||||
|
int[] bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
Data* data;
|
||||||
|
}
|
||||||
121
demos/utils/source/ecs_utils/gfx/mesh.d
Normal file
121
demos/utils/source/ecs_utils/gfx/mesh.d
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
module ecs_utils.gfx.mesh;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import ecs_utils.gfx.buffer;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
//import mutils.serializer.json;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
struct Mesh
|
||||||
|
{
|
||||||
|
bool load(const char[] path) nothrow
|
||||||
|
{
|
||||||
|
struct LoadData
|
||||||
|
{
|
||||||
|
/*struct Vertex
|
||||||
|
{
|
||||||
|
struct Binding
|
||||||
|
{
|
||||||
|
@("malloc") string type;
|
||||||
|
uint stride;
|
||||||
|
}
|
||||||
|
@("malloc") Binding[] bindings;
|
||||||
|
}
|
||||||
|
Vertex vertex;*/
|
||||||
|
@("malloc") ushort[] indices;
|
||||||
|
@("malloc") float[] vertices;
|
||||||
|
//int i;
|
||||||
|
|
||||||
|
void dispose() nothrow
|
||||||
|
{
|
||||||
|
if(indices)Mallocator.dispose(indices);
|
||||||
|
if(vertices)Mallocator.dispose(vertices);
|
||||||
|
|
||||||
|
/*foreach(binding; vertex.bindings)Mallocator.instance.dispose(cast(char[])binding.type);
|
||||||
|
|
||||||
|
if(vertex.bindings)Mallocator.instance.dispose(vertex.bindings);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
||||||
|
cpath[0..$-1] = path[0..$];
|
||||||
|
cpath[$-1] = 0;
|
||||||
|
|
||||||
|
SDL_RWops* file = SDL_RWFromFile(cpath.ptr,"r");//SDL_LoadFile(cpath.ptr,);
|
||||||
|
if(file)
|
||||||
|
{
|
||||||
|
size_t size = cast(size_t)SDL_RWsize(file);
|
||||||
|
//data.code = Mallocator.instance.makeArray!char(size);
|
||||||
|
//data.code[$-1] = 0;
|
||||||
|
char[] buffer = Mallocator.makeArray!char(size);
|
||||||
|
SDL_RWread(file,buffer.ptr,size,1);
|
||||||
|
|
||||||
|
LoadData load_data;
|
||||||
|
scope(exit)load_data.dispose();
|
||||||
|
|
||||||
|
/*JSONSerializer serializer = Mallocator.make!JSONSerializer;
|
||||||
|
scope(exit)Mallocator.dispose(serializer);
|
||||||
|
serializer.serialize!(Load.yes, true)(load_data,buffer);*/
|
||||||
|
|
||||||
|
indices = Mallocator.makeArray(load_data.indices);
|
||||||
|
/*vertex.create();
|
||||||
|
Vertex.Binding[] bindings = (cast(Vertex.Binding*)alloca(Vertex.Binding.sizeof*load_data.vertex.bindings.length))[0..load_data.vertex.bindings.length];
|
||||||
|
uint vertex_size = 0;
|
||||||
|
uint alignment = 4;
|
||||||
|
foreach(i, binding;load_data.vertex.bindings)
|
||||||
|
{
|
||||||
|
uint new_size = binding.stride;
|
||||||
|
bindings[i].stride = binding.stride;
|
||||||
|
if(binding.type == "float_rg")
|
||||||
|
{
|
||||||
|
bindings[i].type = Vertex.Type.float_rg;
|
||||||
|
new_size += 8;
|
||||||
|
}
|
||||||
|
if(new_size > vertex_size)vertex_size = new_size;
|
||||||
|
//new_size = new_size + (3 - (new_size)%alignment)
|
||||||
|
}
|
||||||
|
vertex.data.size = vertex_size;
|
||||||
|
vertex.attachBindings(bindings);*/
|
||||||
|
|
||||||
|
vertices = Mallocator.makeArray(load_data.vertices);
|
||||||
|
/*vertices = Mallocator.instance.makeArray!ubyte(vertex_size * load_data.vertices.length);
|
||||||
|
{
|
||||||
|
foreach()
|
||||||
|
}*/
|
||||||
|
|
||||||
|
SDL_RWclose(file);
|
||||||
|
load_data.dispose();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uploadData() nothrow
|
||||||
|
{
|
||||||
|
vbo.create();
|
||||||
|
vbo.bufferData(Buffer.BindTarget.array,16,cast(uint)vertices.length,GL_STATIC_DRAW,vertices.ptr);
|
||||||
|
|
||||||
|
ibo.create();
|
||||||
|
ibo.bufferData(Buffer.BindTarget.element_array,2,cast(uint)indices.length,GL_STATIC_DRAW,indices.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind() nothrow
|
||||||
|
{
|
||||||
|
vbo.bind(Buffer.BindTarget.array);
|
||||||
|
ibo.bind(Buffer.BindTarget.element_array);
|
||||||
|
|
||||||
|
glVertexAttribPointer(0,2,GL_FLOAT,false,16,null);
|
||||||
|
glVertexAttribPointer(1,2,GL_FLOAT,false,16,cast(void*)8);
|
||||||
|
}
|
||||||
|
|
||||||
|
float[] vertices;
|
||||||
|
ushort[] indices;
|
||||||
|
Buffer vbo;
|
||||||
|
Buffer ibo;
|
||||||
|
//Vertex vertex;
|
||||||
|
}
|
||||||
12
demos/utils/source/ecs_utils/gfx/mesh_module.d
Normal file
12
demos/utils/source/ecs_utils/gfx/mesh_module.d
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
module ecs_utils.gfx.mesh_module;
|
||||||
|
|
||||||
|
import ecs_utils.gfx.material;
|
||||||
|
import ecs_utils.gfx.texture;
|
||||||
|
import ecs_utils.gfx.mesh;
|
||||||
|
|
||||||
|
struct MeshModule
|
||||||
|
{
|
||||||
|
Mesh* mesh;
|
||||||
|
Material* material;
|
||||||
|
Texture texture;
|
||||||
|
}
|
||||||
29
demos/utils/source/ecs_utils/gfx/render_list.d
Normal file
29
demos/utils/source/ecs_utils/gfx/render_list.d
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
module ecs_utils.gfx.render_list;
|
||||||
|
|
||||||
|
import ecs_utils.gfx.mesh_module;
|
||||||
|
import ecs_utils.math.vector;
|
||||||
|
import ecs_utils.math.matrix;
|
||||||
|
import ecs_utils.gfx.config;
|
||||||
|
|
||||||
|
struct RenderList
|
||||||
|
{
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
MeshModule* module_;
|
||||||
|
uint index;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LocScale
|
||||||
|
{
|
||||||
|
vec2 location;
|
||||||
|
vec2 scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Layer
|
||||||
|
{
|
||||||
|
LayerType type;
|
||||||
|
Data[] list;
|
||||||
|
LocScale[] loc_scale;
|
||||||
|
mat3[] matrices;
|
||||||
|
}
|
||||||
|
}
|
||||||
817
demos/utils/source/ecs_utils/gfx/renderer.d
Normal file
817
demos/utils/source/ecs_utils/gfx/renderer.d
Normal file
|
|
@ -0,0 +1,817 @@
|
||||||
|
module ecs_utils.gfx.renderer;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
//import ecs_utils.core : Backend;
|
||||||
|
import ecs_utils.gfx.buffer;
|
||||||
|
import ecs_utils.gfx.texture;
|
||||||
|
import ecs_utils.math.vector;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
|
||||||
|
version = ver1;
|
||||||
|
/*version(ver5)version = vv2;
|
||||||
|
else version(ver6)version = vv2;*/
|
||||||
|
|
||||||
|
extern(C) float sinf(float);
|
||||||
|
extern(C) float cosf(float);
|
||||||
|
|
||||||
|
enum RenderTechnique
|
||||||
|
{
|
||||||
|
simple,//1
|
||||||
|
simple_array,//2
|
||||||
|
vbo_batch,//3
|
||||||
|
instanced_attrib_divisor,//4
|
||||||
|
uniform_buffer,//5
|
||||||
|
uniform_buffer_indexed,//6
|
||||||
|
uniform_buffer_multi_draw,//7
|
||||||
|
uniform_buffer_instanced,//8
|
||||||
|
uniform_buffer_instanced_mapped_gl2,//9
|
||||||
|
uniform_buffer_instanced_mapped,//10
|
||||||
|
uniform_buffer_instanced_persistent_mapped,//11
|
||||||
|
uniform_buffer_instanced_persistent_mapped_coherent,//12
|
||||||
|
ssbo_instanced,//13
|
||||||
|
uniform_buffer_draw_indirect,//14
|
||||||
|
uniform_buffer_multi_draw_indirect,//15
|
||||||
|
uniform_buffer_multi_draw_indirect_arb_draw_parameters//16
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Renderer
|
||||||
|
{
|
||||||
|
//static SDL_Renderer* main_sdl_renderer;
|
||||||
|
|
||||||
|
enum MaxObjects = 1024 * 64 * 4;
|
||||||
|
enum BufferUsage = GL_STATIC_DRAW;
|
||||||
|
|
||||||
|
//SDL_Window* sdl_window;
|
||||||
|
//SDL_Renderer* sdl_renderer;
|
||||||
|
ivec2 resolution;
|
||||||
|
vec2 dres;
|
||||||
|
vec4 sdl_transform;
|
||||||
|
vec2 view_pos = vec2(-1,-1);
|
||||||
|
vec2 view_size = vec2(1,1);
|
||||||
|
|
||||||
|
//uint[2] time_queries;
|
||||||
|
|
||||||
|
Buffer[2] ubos;
|
||||||
|
int block_alignment = 1;
|
||||||
|
int block_max_size = 16384;
|
||||||
|
|
||||||
|
struct IndirectDraw
|
||||||
|
{
|
||||||
|
uint count = 6;
|
||||||
|
uint instances = 1;
|
||||||
|
uint first_index = 0;
|
||||||
|
uint base_vertex = 0;
|
||||||
|
uint base_instance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer[2] batch_vbo;
|
||||||
|
Buffer[2] batch_ibo;
|
||||||
|
|
||||||
|
float[] batch_vertices;
|
||||||
|
ushort[] batch_indices;
|
||||||
|
|
||||||
|
Buffer indirect_buffer;
|
||||||
|
IndirectDraw[] indirect_block;
|
||||||
|
|
||||||
|
Buffer id_buffer;
|
||||||
|
|
||||||
|
int data_offset = 48;
|
||||||
|
int data_index;
|
||||||
|
ubyte[] uniform_block;
|
||||||
|
|
||||||
|
struct RenderData
|
||||||
|
{
|
||||||
|
Texture texture;
|
||||||
|
uint material_id;
|
||||||
|
uint mesh_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderData[] render_list;
|
||||||
|
uint item_id;
|
||||||
|
|
||||||
|
uint[] multi_count;
|
||||||
|
uint[] multi_offset;
|
||||||
|
|
||||||
|
alias Technique = RenderTechnique;
|
||||||
|
|
||||||
|
__gshared Technique technique = Technique.simple;
|
||||||
|
void* data_ptr;
|
||||||
|
|
||||||
|
//import ecs_utils.core : RenderTechnique;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void initialize()
|
||||||
|
{
|
||||||
|
//this.technique = __ecs_used_technique;
|
||||||
|
__initialize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __initialize_gl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
with(this_)
|
||||||
|
{
|
||||||
|
//glGenQueries(2, time_queries.ptr);
|
||||||
|
|
||||||
|
version(WebAssembly)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &block_max_size);
|
||||||
|
glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &block_alignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ubos[0].bufferStorage(1,64*MaxObjects,null);
|
||||||
|
|
||||||
|
switch(technique)
|
||||||
|
{
|
||||||
|
case Technique.simple:
|
||||||
|
uniform_block = Mallocator.makeArray!ubyte(64*MaxObjects);
|
||||||
|
data_ptr = uniform_block.ptr;
|
||||||
|
data_offset = cast(ushort)((data_offset + block_alignment - 1) & (-cast(int) block_alignment));
|
||||||
|
break;
|
||||||
|
case Technique.simple_array:
|
||||||
|
goto case(Technique.simple);
|
||||||
|
case Technique.vbo_batch:
|
||||||
|
batch_vbo[0].create();
|
||||||
|
batch_ibo[0].create();
|
||||||
|
batch_vbo[0].bufferData(Buffer.BindTarget.array,16,4*MaxObjects,BufferUsage,null);
|
||||||
|
batch_ibo[0].bufferData(Buffer.BindTarget.element_array,2,6*MaxObjects,BufferUsage,null);
|
||||||
|
|
||||||
|
batch_vbo[1].create();
|
||||||
|
batch_ibo[1].create();
|
||||||
|
batch_vbo[1].bufferData(Buffer.BindTarget.array,16,4*MaxObjects,BufferUsage,null);
|
||||||
|
batch_ibo[1].bufferData(Buffer.BindTarget.element_array,2,6*MaxObjects,BufferUsage,null);
|
||||||
|
|
||||||
|
batch_vertices = Mallocator.makeArray!float(16*MaxObjects);
|
||||||
|
batch_indices = Mallocator.makeArray!ushort(6*MaxObjects);
|
||||||
|
break;
|
||||||
|
case Technique.instanced_attrib_divisor:
|
||||||
|
goto case(Technique.uniform_buffer_indexed);
|
||||||
|
case Technique.uniform_buffer:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[1].create();
|
||||||
|
ubos[1].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
goto case(Technique.simple);
|
||||||
|
case Technique.uniform_buffer_indexed:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[1].create();
|
||||||
|
ubos[1].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
uniform_block = Mallocator.makeArray!ubyte(64*MaxObjects);
|
||||||
|
data_ptr = uniform_block.ptr;
|
||||||
|
break;
|
||||||
|
/*case Technique.uniform_buffer_multi_draw:
|
||||||
|
multi_count = Mallocator.makeArray!uint(992,6);
|
||||||
|
multi_offset = Mallocator.makeArray!uint(992,0);
|
||||||
|
|
||||||
|
{
|
||||||
|
uint[] indices = Mallocator.makeArray!uint(992);
|
||||||
|
scope(exit)Mallocator.dispose(indices);
|
||||||
|
foreach(i;0..992)indices[i]=i;
|
||||||
|
id_buffer.create();
|
||||||
|
id_buffer.bufferData(uint.sizeof,992,BufferUsage,indices.ptr);
|
||||||
|
}
|
||||||
|
goto case(Technique.uniform_buffer_multi_draw_indirect_arb_draw_parameters);*/
|
||||||
|
case Technique.uniform_buffer_instanced:
|
||||||
|
goto case(Technique.uniform_buffer_indexed);
|
||||||
|
case Technique.uniform_buffer_instanced_mapped_gl2:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferData(Buffer.BindTarget.uniform,1,512*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[0].map(Buffer.BindTarget.uniform);
|
||||||
|
ubos[1].create();
|
||||||
|
ubos[1].bufferData(Buffer.BindTarget.uniform,1,512*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[1].map(Buffer.BindTarget.uniform);
|
||||||
|
data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_instanced_mapped:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[0].map(0, 64*MaxObjects, Buffer.BindTarget.uniform);
|
||||||
|
ubos[1].create();
|
||||||
|
ubos[1].bufferData(Buffer.BindTarget.uniform,1,64*MaxObjects,BufferUsage,null);
|
||||||
|
ubos[1].map(0, 64*MaxObjects, Buffer.BindTarget.uniform);
|
||||||
|
data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
/*case Technique.uniform_buffer_instanced_persistent_mapped:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferStorage(1,64*MaxObjects,null,Buffer.StorageFlagBits.write|Buffer.StorageFlagBits.persistent);
|
||||||
|
ubos[0].map(0, 64*MaxObjects, Buffer.BindTarget.uniform, Buffer.MapFlagBits.write | Buffer.MapFlagBits.persistent | Buffer.MapFlagBits.flush_explict);
|
||||||
|
data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_instanced_persistent_mapped_coherent:
|
||||||
|
ubos[0].create();
|
||||||
|
ubos[0].bufferStorage(1,64*MaxObjects,null,Buffer.StorageFlagBits.write|Buffer.StorageFlagBits.persistent|Buffer.StorageFlagBits.coherent);
|
||||||
|
ubos[0].map(0, 64*MaxObjects, Buffer.BindTarget.uniform, Buffer.MapFlagBits.write | Buffer.MapFlagBits.persistent | Buffer.MapFlagBits.flush_explict | Buffer.MapFlagBits.coherent);
|
||||||
|
ubos[1].create();
|
||||||
|
ubos[1].bufferStorage(1,64*MaxObjects,null,Buffer.StorageFlagBits.write|Buffer.StorageFlagBits.persistent|Buffer.StorageFlagBits.coherent);
|
||||||
|
ubos[1].map(0, 64*MaxObjects, Buffer.BindTarget.uniform, Buffer.MapFlagBits.write | Buffer.MapFlagBits.persistent | Buffer.MapFlagBits.flush_explict | Buffer.MapFlagBits.coherent);
|
||||||
|
data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
case Technique.ssbo_instanced:
|
||||||
|
goto case(Technique.uniform_buffer_indexed);
|
||||||
|
case Technique.uniform_buffer_draw_indirect:
|
||||||
|
indirect_block = Mallocator.makeArray!IndirectDraw(1);
|
||||||
|
indirect_buffer.create();
|
||||||
|
indirect_buffer.bufferData(IndirectDraw.sizeof,1,BufferUsage,indirect_block.ptr);
|
||||||
|
indirect_buffer.bind(Buffer.BindTarget.indirect);
|
||||||
|
goto case(Technique.uniform_buffer);
|
||||||
|
case Technique.uniform_buffer_multi_draw_indirect:
|
||||||
|
goto case(Technique.uniform_buffer_multi_draw_indirect_arb_draw_parameters);
|
||||||
|
case Technique.uniform_buffer_multi_draw_indirect_arb_draw_parameters:
|
||||||
|
indirect_block = Mallocator.makeArray!IndirectDraw(992);
|
||||||
|
foreach(i;0..992)
|
||||||
|
{
|
||||||
|
IndirectDraw* idraw = &indirect_block[i];
|
||||||
|
idraw.base_instance = i;
|
||||||
|
}
|
||||||
|
indirect_buffer.create();
|
||||||
|
indirect_buffer.bufferData(IndirectDraw.sizeof,992,BufferUsage,indirect_block.ptr);
|
||||||
|
indirect_buffer.bind(Buffer.BindTarget.indirect);
|
||||||
|
goto case(Technique.uniform_buffer_indexed);*/
|
||||||
|
default:break;
|
||||||
|
}//*/
|
||||||
|
|
||||||
|
// if(batching)data_offset = cast(ushort)((data_offset + block_alignment - 1) & (-cast(int) block_alignment));
|
||||||
|
//data_offset = cast(ushort)((data_offset + block_alignment - 1) & (-cast(int) block_alignment));
|
||||||
|
|
||||||
|
/*version(ver4){}
|
||||||
|
else version(ver5){}
|
||||||
|
else version(ver6){}
|
||||||
|
else data_offset = cast(ushort)((data_offset + block_alignment - 1) & (-cast(int) block_alignment));//*/
|
||||||
|
//data_offset = (data_offset + block_alignment - 1) - data_offset % block_alignment;
|
||||||
|
|
||||||
|
render_list = Mallocator.makeArray!RenderData(MaxObjects);
|
||||||
|
|
||||||
|
SDL_Log("Uniform block alignment: %u",block_alignment);
|
||||||
|
SDL_Log("Uniform block max size: %u",block_max_size);
|
||||||
|
SDL_Log("Data offset: %u",data_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __initialize_sdl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(Texture tex, vec2 pos, vec2 size, vec4 coords, float angle = 0, uint material_id = 0, uint mesh_id = 0)
|
||||||
|
{
|
||||||
|
__draw(this,tex,pos,size,coords,angle,material_id,mesh_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __draw_sdl(ref Renderer this_, Texture tex, vec2 pos, vec2 size, vec4 coords, float angle, uint material_id, uint mesh_id)
|
||||||
|
{
|
||||||
|
/*with(this_)
|
||||||
|
{
|
||||||
|
SDL_Rect rect = SDL_Rect(cast(int)(coords.x*tex.data.size.x),cast(int)(coords.y*tex.data.size.y),cast(int)(coords.z*tex.data.size.x),cast(int)(coords.w*tex.data.size.y));
|
||||||
|
SDL_Rect rect2 = SDL_Rect(cast(int)((pos.x-size.x*0.5)),
|
||||||
|
cast(int)(resolution.y - pos.y - size.y*0.5),
|
||||||
|
cast(int)(size.x),
|
||||||
|
cast(int)(size.y));
|
||||||
|
|
||||||
|
SDL_RenderCopyEx(sdl_renderer,
|
||||||
|
tex.data.texture,
|
||||||
|
&rect,
|
||||||
|
&rect2,
|
||||||
|
angle*360,
|
||||||
|
null,
|
||||||
|
SDL_FLIP_NONE);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __draw_gl(ref Renderer this_, Texture tex, vec2 pos, vec2 size, vec4 coords, float angle, uint material_id, uint mesh_id)
|
||||||
|
{
|
||||||
|
//import core.stdc.string;
|
||||||
|
with(this_)
|
||||||
|
{
|
||||||
|
//pos += view_pos;
|
||||||
|
size.x *= view_size.x;
|
||||||
|
size.y *= view_size.y;
|
||||||
|
pos.x = pos.x * view_size.x + view_pos.x;
|
||||||
|
pos.y = pos.y * view_size.y + view_pos.y;//*/
|
||||||
|
|
||||||
|
/*version(ver6)void* ptr = ubos[0].mappedPointer() + data_index;
|
||||||
|
else void* ptr = uniform_block.ptr + data_index;*/
|
||||||
|
if(data_ptr is null)return;
|
||||||
|
void* ptr = data_ptr + data_index;
|
||||||
|
if(angle == 0)
|
||||||
|
{
|
||||||
|
*cast(float*)ptr = size.x;
|
||||||
|
*cast(float*)(ptr+4) = 0;
|
||||||
|
*cast(float*)(ptr+8) = 0;
|
||||||
|
*cast(float*)(ptr+12) = size.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//import core.stdc.math;
|
||||||
|
float sinn = sinf(angle);
|
||||||
|
float coss = cosf(angle);
|
||||||
|
*cast(float*)ptr = coss * size.x;
|
||||||
|
*cast(float*)(ptr+4) = -sinn * size.y;
|
||||||
|
*cast(float*)(ptr+8) = sinn * size.x;
|
||||||
|
*cast(float*)(ptr+12) = coss * size.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
//memcpy(ptr,);
|
||||||
|
memcpy(ptr+16,pos.data.ptr,8);
|
||||||
|
memcpy(ptr+32,coords.data.ptr,16);
|
||||||
|
|
||||||
|
//render_list[item_id] = RenderData(tex,material_id,mesh_id);
|
||||||
|
render_list[item_id].texture = tex;
|
||||||
|
render_list[item_id].material_id = material_id;
|
||||||
|
render_list[item_id].mesh_id = mesh_id;
|
||||||
|
|
||||||
|
data_index += data_offset;
|
||||||
|
item_id++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __draw_gl_vbo_batch(ref Renderer this_, Texture tex, vec2 pos, vec2 size, vec4 coords, float angle, uint material_id, uint mesh_id)
|
||||||
|
{
|
||||||
|
import ecs_utils.gfx.config;
|
||||||
|
//import core.stdc.string;
|
||||||
|
with(this_)
|
||||||
|
{
|
||||||
|
//pos += view_pos;
|
||||||
|
size.x *= view_size.x;
|
||||||
|
size.y *= view_size.y;
|
||||||
|
pos.x = pos.x * view_size.x + view_pos.x;
|
||||||
|
pos.y = pos.y * view_size.y + view_pos.y;//*/
|
||||||
|
|
||||||
|
/*void* ptr = data_ptr + data_index;
|
||||||
|
*cast(float*)ptr = size.x;
|
||||||
|
*cast(float*)(ptr+4) = 0;
|
||||||
|
*cast(float*)(ptr+8) = 0;
|
||||||
|
*cast(float*)(ptr+12) = size.y;
|
||||||
|
//memcpy(ptr,);
|
||||||
|
memcpy(ptr+16,pos.data.ptr,8);
|
||||||
|
memcpy(ptr+32,coords.data.ptr,16);*/
|
||||||
|
|
||||||
|
if(angle == 0)
|
||||||
|
{
|
||||||
|
batch_vertices[item_id*16] = GfxConfig.meshes[mesh_id].vertices[0] * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+1] = GfxConfig.meshes[mesh_id].vertices[1] * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+4] = GfxConfig.meshes[mesh_id].vertices[4] * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+5] = GfxConfig.meshes[mesh_id].vertices[5] * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+8] = GfxConfig.meshes[mesh_id].vertices[8] * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+9] = GfxConfig.meshes[mesh_id].vertices[9] * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+12] = GfxConfig.meshes[mesh_id].vertices[12] * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+13] = GfxConfig.meshes[mesh_id].vertices[13] * size.y + pos.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//import core.stdc.math;
|
||||||
|
float sinn = sinf(angle);
|
||||||
|
float coss = cosf(angle);
|
||||||
|
|
||||||
|
/*batch_vertices[item_id*16] = GfxConfig.meshes[mesh_id].vertices[0] * size.x;
|
||||||
|
batch_vertices[item_id*16+1] = GfxConfig.meshes[mesh_id].vertices[1] * size.y;
|
||||||
|
batch_vertices[item_id*16+4] = GfxConfig.meshes[mesh_id].vertices[4] * size.x;
|
||||||
|
batch_vertices[item_id*16+5] = GfxConfig.meshes[mesh_id].vertices[5] * size.y;
|
||||||
|
batch_vertices[item_id*16+8] = GfxConfig.meshes[mesh_id].vertices[8] * size.x;
|
||||||
|
batch_vertices[item_id*16+9] = GfxConfig.meshes[mesh_id].vertices[9] * size.y;
|
||||||
|
batch_vertices[item_id*16+12] = GfxConfig.meshes[mesh_id].vertices[12] * size.x;
|
||||||
|
batch_vertices[item_id*16+13] = GfxConfig.meshes[mesh_id].vertices[13] * size.y;*/
|
||||||
|
|
||||||
|
batch_vertices[item_id*16] = (GfxConfig.meshes[mesh_id].vertices[0] * coss + GfxConfig.meshes[mesh_id].vertices[1] * sinn) * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+1] = (GfxConfig.meshes[mesh_id].vertices[1] * coss - GfxConfig.meshes[mesh_id].vertices[0] * sinn) * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+4] = (GfxConfig.meshes[mesh_id].vertices[4] * coss + GfxConfig.meshes[mesh_id].vertices[5] * sinn) * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+5] = (GfxConfig.meshes[mesh_id].vertices[5] * coss - GfxConfig.meshes[mesh_id].vertices[4] * sinn) * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+8] = (GfxConfig.meshes[mesh_id].vertices[8] * coss + GfxConfig.meshes[mesh_id].vertices[9] * sinn) * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+9] = (GfxConfig.meshes[mesh_id].vertices[9] * coss - GfxConfig.meshes[mesh_id].vertices[8] * sinn) * size.y + pos.y;
|
||||||
|
batch_vertices[item_id*16+12] = (GfxConfig.meshes[mesh_id].vertices[12] * coss + GfxConfig.meshes[mesh_id].vertices[13] * sinn) * size.x + pos.x;
|
||||||
|
batch_vertices[item_id*16+13] = (GfxConfig.meshes[mesh_id].vertices[13] * coss - GfxConfig.meshes[mesh_id].vertices[12] * sinn) * size.y + pos.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
batch_vertices[item_id*16+2] = GfxConfig.meshes[mesh_id].vertices[2] * coords.z + coords.x;
|
||||||
|
batch_vertices[item_id*16+3] = GfxConfig.meshes[mesh_id].vertices[3] * coords.w + coords.y;
|
||||||
|
batch_vertices[item_id*16+6] = GfxConfig.meshes[mesh_id].vertices[6] * coords.z + coords.x;
|
||||||
|
batch_vertices[item_id*16+7] = GfxConfig.meshes[mesh_id].vertices[7] * coords.w + coords.y;
|
||||||
|
batch_vertices[item_id*16+10] = GfxConfig.meshes[mesh_id].vertices[10] * coords.z + coords.x;
|
||||||
|
batch_vertices[item_id*16+11] = GfxConfig.meshes[mesh_id].vertices[11] * coords.w + coords.y;
|
||||||
|
batch_vertices[item_id*16+14] = GfxConfig.meshes[mesh_id].vertices[14] * coords.z + coords.x;
|
||||||
|
batch_vertices[item_id*16+15] = GfxConfig.meshes[mesh_id].vertices[15] * coords.w + coords.y;
|
||||||
|
|
||||||
|
uint ind_id = item_id % 16_384;
|
||||||
|
|
||||||
|
batch_indices[item_id*6] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[0] + ind_id*4);
|
||||||
|
batch_indices[item_id*6+1] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[1] + ind_id*4);
|
||||||
|
batch_indices[item_id*6+2] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[2] + ind_id*4);
|
||||||
|
batch_indices[item_id*6+3] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[3] + ind_id*4);
|
||||||
|
batch_indices[item_id*6+4] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[4] + ind_id*4);
|
||||||
|
batch_indices[item_id*6+5] = cast(ushort)(GfxConfig.meshes[mesh_id].indices[5] + ind_id*4);
|
||||||
|
|
||||||
|
//render_list[item_id] = RenderData(tex,material_id,mesh_id);
|
||||||
|
render_list[item_id].texture = tex;
|
||||||
|
render_list[item_id].material_id = material_id;
|
||||||
|
render_list[item_id].mesh_id = mesh_id;
|
||||||
|
|
||||||
|
//data_index += 1;//data_offset;
|
||||||
|
item_id++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
__clear(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __clear_sdl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
//SDL_RenderClear(this_.sdl_renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __clear_gl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
glClearColor(0,0,0,0);
|
||||||
|
glViewport(0,0,this_.resolution.x,this_.resolution.y);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);// | GL_DEPTH_BUFFER_BIT);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void present()
|
||||||
|
{
|
||||||
|
__present(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __present_sdl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
//+SDL_RenderPresent(this_.sdl_renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void __present_gl(ref Renderer this_)
|
||||||
|
{
|
||||||
|
glViewport(0,0,this_.resolution.x,this_.resolution.y);
|
||||||
|
//glEnable(GL_ALPHA_TEST);
|
||||||
|
//glAlphaFunc(GL_GREATER, 0.01);
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
import ecs_utils.gfx.config;
|
||||||
|
with(this_)
|
||||||
|
{
|
||||||
|
bool instanced = false;
|
||||||
|
bool indirect = false;
|
||||||
|
bool multi_draw = false;
|
||||||
|
Buffer.BindTarget buffer_target = Buffer.BindTarget.uniform;
|
||||||
|
|
||||||
|
switch(technique)
|
||||||
|
{
|
||||||
|
case Technique.simple:
|
||||||
|
break;
|
||||||
|
case Technique.simple_array:
|
||||||
|
break;
|
||||||
|
case Technique.vbo_batch:
|
||||||
|
//if(data_index){
|
||||||
|
batch_vbo[0].bufferSubData(item_id*4*16,0,batch_vertices.ptr);
|
||||||
|
batch_ibo[0].bufferSubData(item_id*6*2,0,batch_indices.ptr);
|
||||||
|
|
||||||
|
batch_vbo[0].bind(Buffer.BindTarget.array);
|
||||||
|
batch_ibo[0].bind(Buffer.BindTarget.element_array);
|
||||||
|
|
||||||
|
glVertexAttribPointer(0,2,GL_FLOAT,false,16,null);
|
||||||
|
glVertexAttribPointer(1,2,GL_FLOAT,false,16,cast(void*)8);//}
|
||||||
|
break;
|
||||||
|
case Technique.instanced_attrib_divisor:
|
||||||
|
ubos[0].bufferSubData(data_index,0,uniform_block.ptr);
|
||||||
|
ubos[0].bind(Buffer.BindTarget.array);
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
glEnableVertexAttribArray(3);
|
||||||
|
glEnableVertexAttribArray(4);
|
||||||
|
|
||||||
|
glVertexAttribPointer(2,4,GL_FLOAT,false,48,null);
|
||||||
|
glVertexAttribPointer(3,4,GL_FLOAT,false,48,cast(void*)16);
|
||||||
|
glVertexAttribPointer(4,4,GL_FLOAT,false,48,cast(void*)32);
|
||||||
|
glVertexAttribDivisor(2,1);
|
||||||
|
glVertexAttribDivisor(3,1);
|
||||||
|
glVertexAttribDivisor(4,1);
|
||||||
|
//ubos[0].bindRange(Buffer.BindTarget.uniform,0,0,block_max_size);
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer:
|
||||||
|
//ubos[0].bufferData(1,64*MaxObjects,BufferUsage,null);
|
||||||
|
/*if(data_index)*/ubos[0].bufferSubData(data_index,0,uniform_block.ptr);
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_indexed:
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.uniform,0,0,block_max_size);
|
||||||
|
goto case(Technique.uniform_buffer);
|
||||||
|
case Technique.uniform_buffer_multi_draw:
|
||||||
|
id_buffer.bind(Buffer.BindTarget.array);
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
|
||||||
|
glVertexAttribIPointer(2,1,GL_UNSIGNED_INT,cast(uint)uint.sizeof,cast(void*)0);
|
||||||
|
glVertexAttribDivisor(2,1);
|
||||||
|
multi_draw = true;
|
||||||
|
goto case(Technique.uniform_buffer_instanced);
|
||||||
|
case Technique.uniform_buffer_instanced:
|
||||||
|
instanced = true;
|
||||||
|
goto case(Technique.uniform_buffer);
|
||||||
|
case Technique.uniform_buffer_instanced_mapped_gl2:
|
||||||
|
instanced = true;
|
||||||
|
ubos[0].unmap(Buffer.BindTarget.uniform);
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_instanced_mapped:
|
||||||
|
instanced = true;
|
||||||
|
ubos[0].flush(0,data_index,Buffer.BindTarget.uniform);
|
||||||
|
ubos[0].unmap(Buffer.BindTarget.uniform);
|
||||||
|
break;
|
||||||
|
/*case Technique.uniform_buffer_instanced_persistent_mapped:
|
||||||
|
instanced = true;
|
||||||
|
ubos[0].flush(0,data_index,Buffer.BindTarget.uniform);
|
||||||
|
//glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_instanced_persistent_mapped_coherent:
|
||||||
|
instanced = true;
|
||||||
|
break;
|
||||||
|
//ubos[0].flush(0,data_index,Buffer.BindTarget.uniform);
|
||||||
|
//goto case(Technique.uniform_buffer_instanced_mapped);
|
||||||
|
case Technique.ssbo_instanced:
|
||||||
|
//buffer_target = Buffer.BindTarget.shader_storage;
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.shader_storage,0,0,48*MaxObjects);
|
||||||
|
goto case(Technique.uniform_buffer_instanced);
|
||||||
|
case Technique.uniform_buffer_draw_indirect:
|
||||||
|
goto case(Technique.uniform_buffer);
|
||||||
|
case Technique.uniform_buffer_multi_draw_indirect:
|
||||||
|
indirect_buffer.bind(Buffer.BindTarget.array);
|
||||||
|
glEnableVertexAttribArray(2);
|
||||||
|
|
||||||
|
glVertexAttribIPointer(2,1,GL_UNSIGNED_INT,cast(uint)IndirectDraw.sizeof,cast(void*)(4*uint.sizeof));
|
||||||
|
glVertexAttribDivisor(2,1);
|
||||||
|
goto case(Technique.uniform_buffer_multi_draw_indirect_arb_draw_parameters);
|
||||||
|
case Technique.uniform_buffer_multi_draw_indirect_arb_draw_parameters:
|
||||||
|
indirect = true;
|
||||||
|
goto case(Technique.uniform_buffer_instanced);*/
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_index = 0;
|
||||||
|
|
||||||
|
int mesh_id = -1;
|
||||||
|
int material_id = -1;
|
||||||
|
int ubo_start = -1;
|
||||||
|
Texture texture;
|
||||||
|
uint item_ubo_id = 0;
|
||||||
|
|
||||||
|
/*Buffer tmpb = ubos[0];
|
||||||
|
ubos[0] = ubos[1];
|
||||||
|
ubos[1] = tmpb;
|
||||||
|
|
||||||
|
tmpb = batch_vbo[0];
|
||||||
|
batch_vbo[0] = batch_vbo[1];
|
||||||
|
batch_vbo[1] = tmpb;
|
||||||
|
|
||||||
|
tmpb = batch_ibo[0];
|
||||||
|
batch_ibo[0] = batch_ibo[1];
|
||||||
|
batch_ibo[1] = tmpb;//*/
|
||||||
|
//glFinish();
|
||||||
|
|
||||||
|
//glBeginQuery(GL_TIME_ELAPSED, time_queries[0]);
|
||||||
|
if(technique == Technique.vbo_batch)
|
||||||
|
{
|
||||||
|
uint items = item_id/16_384+1;
|
||||||
|
foreach(i; 0..items)
|
||||||
|
{
|
||||||
|
if(material_id != render_list[i].material_id)
|
||||||
|
{
|
||||||
|
material_id = render_list[i].material_id;
|
||||||
|
GfxConfig.materials[material_id].bind();
|
||||||
|
}
|
||||||
|
if(texture.data != render_list[i].texture.data)
|
||||||
|
{
|
||||||
|
texture.data = render_list[i].texture.data;
|
||||||
|
render_list[i].texture.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint instance_count = 16_384;
|
||||||
|
if(i*16_384 > item_id)
|
||||||
|
{
|
||||||
|
instance_count = i*16_384 - item_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*glVertexAttribPointer(0,2,GL_FLOAT,false,16,cast(void*)(i*16_384*4*16));
|
||||||
|
glVertexAttribPointer(1,2,GL_FLOAT,false,16,cast(void*)(i*16_384*4*16+8));
|
||||||
|
|
||||||
|
glDrawElements(GL_TRIANGLES,instance_count*6,GL_UNSIGNED_SHORT,cast(void*)(i*16_384*6*2));*/
|
||||||
|
|
||||||
|
glDrawElementsBaseVertex(GL_TRIANGLES,instance_count*6,GL_UNSIGNED_SHORT,cast(void*)(i*16_384*6*2),i*16_384*4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(technique == Technique.ssbo_instanced || technique == Technique.instanced_attrib_divisor)
|
||||||
|
{
|
||||||
|
if(mesh_id != render_list[0].mesh_id)
|
||||||
|
{
|
||||||
|
mesh_id = render_list[0].mesh_id;
|
||||||
|
GfxConfig.meshes[mesh_id].bind();
|
||||||
|
}
|
||||||
|
if(material_id != render_list[0].material_id)
|
||||||
|
{
|
||||||
|
material_id = render_list[0].material_id;
|
||||||
|
GfxConfig.materials[material_id].bind();
|
||||||
|
}
|
||||||
|
if(texture.data != render_list[0].texture.data)
|
||||||
|
{
|
||||||
|
texture.data = render_list[0].texture.data;
|
||||||
|
render_list[0].texture.bind();
|
||||||
|
}
|
||||||
|
glDrawArraysInstanced(GL_TRIANGLE_STRIP,0,4,item_id);
|
||||||
|
//glDrawElementsInstanced(GL_TRIANGLES,6,GL_UNSIGNED_SHORT,null,item_id);
|
||||||
|
}
|
||||||
|
else if(instanced)
|
||||||
|
{
|
||||||
|
uint items = item_id/992+1;
|
||||||
|
foreach(i; 0..items)
|
||||||
|
{
|
||||||
|
if(mesh_id != render_list[i].mesh_id)
|
||||||
|
{
|
||||||
|
mesh_id = render_list[i].mesh_id;
|
||||||
|
GfxConfig.meshes[mesh_id].bind();
|
||||||
|
}
|
||||||
|
if(material_id != render_list[i].material_id)
|
||||||
|
{
|
||||||
|
material_id = render_list[i].material_id;
|
||||||
|
GfxConfig.materials[material_id].bind();
|
||||||
|
}
|
||||||
|
if(texture.data != render_list[i].texture.data)
|
||||||
|
{
|
||||||
|
texture.data = render_list[0].texture.data;
|
||||||
|
render_list[i].texture.bind();
|
||||||
|
}
|
||||||
|
ubos[0].bindRange(buffer_target,0,data_index,block_max_size);
|
||||||
|
|
||||||
|
uint instance_count = 992;
|
||||||
|
if(i*992 > item_id)
|
||||||
|
{
|
||||||
|
instance_count = i*992 - item_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(indirect)glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, cast(void*)0, instance_count, 0);
|
||||||
|
else if(multi_draw)glMultiDrawElements(GL_TRIANGLES,cast(int*)multi_count.ptr,GL_UNSIGNED_SHORT,cast(void**)multi_offset.ptr,instance_count);
|
||||||
|
//glMultiDrawElementsBaseVertex(GL_TRIANGLES,cast(int*)multi_count.ptr,GL_UNSIGNED_SHORT,cast(void**)multi_offset.ptr,instance_count,cast(int*)multi_offset.ptr);
|
||||||
|
else */glDrawElementsInstanced(GL_TRIANGLES,6,GL_UNSIGNED_SHORT,null,instance_count);
|
||||||
|
//glDrawArraysInstanced(GL_TRIANGLES,0,6,instance_count);
|
||||||
|
data_index += data_offset * 992;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
foreach(item; render_list[0..item_id])
|
||||||
|
{
|
||||||
|
if(mesh_id != item.mesh_id)
|
||||||
|
{
|
||||||
|
mesh_id = item.mesh_id;
|
||||||
|
GfxConfig.meshes[mesh_id].bind();
|
||||||
|
}
|
||||||
|
if(material_id != item.material_id)
|
||||||
|
{
|
||||||
|
material_id = item.material_id;
|
||||||
|
GfxConfig.materials[material_id].bind();
|
||||||
|
GfxConfig.materials[material_id].pushBindings();
|
||||||
|
}
|
||||||
|
if(texture.data != item.texture.data)
|
||||||
|
{
|
||||||
|
texture.data = render_list[0].texture.data;
|
||||||
|
item.texture.bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(technique)
|
||||||
|
{
|
||||||
|
case Technique.simple:
|
||||||
|
/*glUniform4f(0, *cast(float*)&uniform_block[data_index], *cast(float*)&uniform_block[data_index+4], *cast(float*)&uniform_block[data_index+8], *cast(float*)&uniform_block[data_index+12]);
|
||||||
|
glUniform4f(1, *cast(float*)&uniform_block[data_index+16], *cast(float*)&uniform_block[data_index+20], *cast(float*)&uniform_block[data_index+24], *cast(float*)&uniform_block[data_index+28]);
|
||||||
|
glUniform4f(2, *cast(float*)&uniform_block[data_index+32], *cast(float*)&uniform_block[data_index+36], *cast(float*)&uniform_block[data_index+40], *cast(float*)&uniform_block[data_index+44]);
|
||||||
|
*/
|
||||||
|
GfxConfig.materials[material_id].pushUniforms(&uniform_block[data_index]);break;
|
||||||
|
case Technique.simple_array:
|
||||||
|
glUniform4fv(0,12,cast(float*)(uniform_block.ptr+data_index));
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer:
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.uniform,0,data_index,data_offset);
|
||||||
|
break;
|
||||||
|
/*case Technique.uniform_buffer_draw_indirect:
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.uniform,0,data_index,data_offset);
|
||||||
|
glDrawElementsIndirect(GL_TRIANGLES,GL_UNSIGNED_SHORT,null);
|
||||||
|
data_index += data_offset;
|
||||||
|
continue;*/
|
||||||
|
case Technique.uniform_buffer_indexed:
|
||||||
|
if(item_ubo_id >= 992)
|
||||||
|
{
|
||||||
|
item_ubo_id = 0;
|
||||||
|
ubo_start = data_index;
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.uniform,0,ubo_start,block_max_size);
|
||||||
|
}
|
||||||
|
glUniform1i(0,item_ubo_id++);
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}//*/
|
||||||
|
|
||||||
|
/*version(ver3)ubos[0].bindRange(Buffer.BindTarget.uniform,0,data_index,data_offset);
|
||||||
|
else version(ver1)
|
||||||
|
{
|
||||||
|
glUniform4f(0, *cast(float*)&uniform_block[data_index], *cast(float*)&uniform_block[data_index+4], *cast(float*)&uniform_block[data_index+8], *cast(float*)&uniform_block[data_index+12]);
|
||||||
|
glUniform4f(1, *cast(float*)&uniform_block[data_index+16], *cast(float*)&uniform_block[data_index+20], *cast(float*)&uniform_block[data_index+24], *cast(float*)&uniform_block[data_index+28]);
|
||||||
|
glUniform4f(2, *cast(float*)&uniform_block[data_index+32], *cast(float*)&uniform_block[data_index+36], *cast(float*)&uniform_block[data_index+40], *cast(float*)&uniform_block[data_index+44]);
|
||||||
|
}
|
||||||
|
else version(ver2)glUniform4fv(0,12,cast(float*)(uniform_block.ptr+data_index));
|
||||||
|
else version(ver4)
|
||||||
|
{
|
||||||
|
if(item_ubo_id >= 992)
|
||||||
|
{
|
||||||
|
item_ubo_id = 0;
|
||||||
|
ubo_start = data_index;
|
||||||
|
ubos[0].bindRange(Buffer.BindTarget.uniform,0,ubo_start,block_max_size);
|
||||||
|
}
|
||||||
|
glUniform1i(0,item_ubo_id++);
|
||||||
|
}//*/
|
||||||
|
|
||||||
|
glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_SHORT,null);
|
||||||
|
//glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
data_index += data_offset;
|
||||||
|
}
|
||||||
|
//glEndQuery(GL_TIME_ELAPSED);
|
||||||
|
//uint tmpq = time_queries[0];
|
||||||
|
//time_queries[0] = time_queries[1];
|
||||||
|
//time_queries[1] = tmpq;
|
||||||
|
/*Buffer tmpb = ubos[0];
|
||||||
|
ubos[0] = ubos[1];
|
||||||
|
ubos[1] = tmpb;//*/
|
||||||
|
|
||||||
|
data_index = 0;
|
||||||
|
//data_offset = 0;
|
||||||
|
item_id = 0;
|
||||||
|
//SDL_GL_SwapWindow(sdl_window);
|
||||||
|
//glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||||
|
//version(ver6)ubos[0].map(0, 64*MaxObjects, Buffer.BindTarget.uniform);
|
||||||
|
//ubos[0].map(Buffer.BindTarget.uniform);
|
||||||
|
|
||||||
|
switch(technique)
|
||||||
|
{
|
||||||
|
case Technique.uniform_buffer_instanced_mapped_gl2:
|
||||||
|
ubos[0].map(Buffer.BindTarget.uniform);
|
||||||
|
//data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
case Technique.uniform_buffer_instanced_mapped:
|
||||||
|
ubos[0].map(0, 64*MaxObjects, Buffer.BindTarget.uniform);
|
||||||
|
//data_ptr = ubos[0].mappedPointer();
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ubos[0].data && ubos[0].mappedPointer)
|
||||||
|
{
|
||||||
|
data_ptr = ubos[0].mappedPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*switch(technique)
|
||||||
|
{
|
||||||
|
case Technique.simple:
|
||||||
|
case Technique.simple_array:
|
||||||
|
case Technique.uniform_buffer:
|
||||||
|
case Technique.uniform_buffer_indexed:
|
||||||
|
case Technique.uniform_buffer_instanced:
|
||||||
|
case Technique.uniform_buffer_instanced_mapped:
|
||||||
|
case Technique.uniform_buffer_instanced_persistent_mapped:
|
||||||
|
default:break;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
glDisableVertexAttribArray(0);
|
||||||
|
glDisableVertexAttribArray(1);
|
||||||
|
/*glUseProgram(0);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);*/
|
||||||
|
//glDisable(GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resize(ivec2 size)
|
||||||
|
{
|
||||||
|
resolution = size;
|
||||||
|
dres = vec2(1.0/cast(float)size.x,1.0/cast(float)size.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void view(vec2 pos, vec2 size)
|
||||||
|
{
|
||||||
|
view_pos = pos * size - 1;
|
||||||
|
view_size = vec2(2/size.x,2/size.y);
|
||||||
|
sdl_transform = vec4(0,0,1.0/size.x,1.0/size.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void function(ref Renderer this_, Texture tex, vec2 pos, vec2 size, vec4 coords, float angle, uint material_id, uint mesh_id) __draw;
|
||||||
|
static void function(ref Renderer this_) __present;
|
||||||
|
static void function(ref Renderer this_) __clear;
|
||||||
|
static void function(ref Renderer this_) __initialize;
|
||||||
|
|
||||||
|
static void __loadBackend()
|
||||||
|
{
|
||||||
|
//this.technique = __ecs_used_technique;
|
||||||
|
if(technique == Technique.vbo_batch)__draw = &__draw_gl_vbo_batch;
|
||||||
|
else __draw = &__draw_gl;
|
||||||
|
__present = &__present_gl;
|
||||||
|
__clear = &__clear_gl;
|
||||||
|
__initialize = &__initialize_gl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
171
demos/utils/source/ecs_utils/gfx/shader.d
Normal file
171
demos/utils/source/ecs_utils/gfx/shader.d
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
module ecs_utils.gfx.shader;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
|
||||||
|
//version = ver1;
|
||||||
|
|
||||||
|
struct Shader
|
||||||
|
{
|
||||||
|
|
||||||
|
void create() nothrow
|
||||||
|
{
|
||||||
|
data = Mallocator.make!Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load(const char[] path) nothrow
|
||||||
|
{
|
||||||
|
if(data is null)data = Mallocator.make!Data;
|
||||||
|
|
||||||
|
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
||||||
|
cpath[0..$-1] = path[0..$];
|
||||||
|
cpath[$-1] = 0;
|
||||||
|
|
||||||
|
int ind = cast(int)path.length - 1;
|
||||||
|
for(;ind>0;ind--)
|
||||||
|
{
|
||||||
|
if(path[ind] == '.')break;
|
||||||
|
}
|
||||||
|
if(ind < 0)return false;
|
||||||
|
ind++;
|
||||||
|
if(ind + 2 > path.length)return false;
|
||||||
|
|
||||||
|
char[2] ext = path[ind .. ind + 2];
|
||||||
|
if(ext[0] == 'v' && ext[1] == 'p')data.type = Type.vertex;
|
||||||
|
else if(ext[0] == 'f' && ext[1] == 'p')data.type = Type.fragment;
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
SDL_RWops* file = SDL_RWFromFile(cpath.ptr,"r");//SDL_LoadFile(cpath.ptr,);
|
||||||
|
if(file)
|
||||||
|
{
|
||||||
|
size_t size = cast(size_t)SDL_RWsize(file);
|
||||||
|
data.code = Mallocator.makeArray!char(size+1);
|
||||||
|
data.code[$-1] = 0;
|
||||||
|
SDL_RWread(file,data.code.ptr,size,1);
|
||||||
|
|
||||||
|
SDL_RWclose(file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool compile() nothrow
|
||||||
|
{
|
||||||
|
switch(data.type)
|
||||||
|
{
|
||||||
|
case Type.vertex:
|
||||||
|
data.gl_handle = glCreateShader(GL_VERTEX_SHADER);
|
||||||
|
break;
|
||||||
|
case Type.fragment:
|
||||||
|
data.gl_handle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
|
break;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
version(WebAssembly)const char* glsl = "#version 100\n";
|
||||||
|
else const char* glsl = "#version 450\n";
|
||||||
|
const char* buffer = data.code.ptr;
|
||||||
|
char* ver;
|
||||||
|
version(WebAssembly)ver = cast(char*)"#define ver1 1\n#define GLES\n".ptr;
|
||||||
|
else ver = cast(char*)"#define ver1 1\n".ptr;
|
||||||
|
/*switch(__ecs_used_technique)
|
||||||
|
{
|
||||||
|
case RenderTechnique.simple:
|
||||||
|
ver = cast(char*)"#define ver1 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.simple_array:
|
||||||
|
ver = cast(char*)"#define ver2 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.vbo_batch:
|
||||||
|
ver = cast(char*)"#define ver10 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.instanced_attrib_divisor:
|
||||||
|
ver = cast(char*)"#define ver8 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer:
|
||||||
|
ver = cast(char*)"#define ver3 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer_indexed:
|
||||||
|
ver = cast(char*)"#define ver4 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer_multi_draw:
|
||||||
|
goto case(RenderTechnique.uniform_buffer_multi_draw_indirect);
|
||||||
|
case RenderTechnique.uniform_buffer_instanced:
|
||||||
|
ver = cast(char*)"#define ver5 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer_instanced_mapped_gl2:
|
||||||
|
goto case(RenderTechnique.uniform_buffer_instanced);
|
||||||
|
case RenderTechnique.uniform_buffer_instanced_mapped:
|
||||||
|
goto case(RenderTechnique.uniform_buffer_instanced);
|
||||||
|
case RenderTechnique.uniform_buffer_instanced_persistent_mapped:
|
||||||
|
goto case(RenderTechnique.uniform_buffer_instanced);
|
||||||
|
case RenderTechnique.uniform_buffer_instanced_persistent_mapped_coherent:
|
||||||
|
goto case(RenderTechnique.uniform_buffer_instanced);
|
||||||
|
case RenderTechnique.ssbo_instanced:
|
||||||
|
ver = cast(char*)"#define ver6 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer_draw_indirect:
|
||||||
|
goto case(RenderTechnique.uniform_buffer);
|
||||||
|
case RenderTechnique.uniform_buffer_multi_draw_indirect:
|
||||||
|
ver = cast(char*)"#define ver9 1\n".ptr;
|
||||||
|
break;
|
||||||
|
case RenderTechnique.uniform_buffer_multi_draw_indirect_arb_draw_parameters:
|
||||||
|
ver = cast(char*)"#define ver7 1\n".ptr;
|
||||||
|
break;
|
||||||
|
default:break;
|
||||||
|
}*/
|
||||||
|
/*version(ver1)const char* ver = "#define ver1 1\n";
|
||||||
|
version(ver2)const char* ver = "#define ver2 1\n";
|
||||||
|
version(ver3)const char* ver = "#define ver3 1\n";
|
||||||
|
version(ver4)const char* ver = "#define ver4 1\n";
|
||||||
|
version(ver5)const char* ver = "#define ver5 1\n";
|
||||||
|
version(ver6)const char* ver = "#define ver5 1\n";*/
|
||||||
|
|
||||||
|
const char*[3] input = [glsl,ver,buffer];
|
||||||
|
|
||||||
|
glShaderSource(data.gl_handle,3,input.ptr,null);
|
||||||
|
|
||||||
|
glCompileShader(data.gl_handle);
|
||||||
|
|
||||||
|
int compile;
|
||||||
|
glGetShaderiv(data.gl_handle,GL_COMPILE_STATUS,&compile);
|
||||||
|
if(compile == GL_FALSE)
|
||||||
|
{
|
||||||
|
SDL_Log("Shader compile error! %u %s",data.type,glsl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroy() nothrow
|
||||||
|
{
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
if(data.gl_handle)glDeleteShader(data.gl_handle);
|
||||||
|
Mallocator.dispose(data);
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
vertex,
|
||||||
|
fragment,
|
||||||
|
geometry
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
char[] code;
|
||||||
|
Type type;
|
||||||
|
|
||||||
|
uint gl_handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
Data* data;
|
||||||
|
}
|
||||||
11
demos/utils/source/ecs_utils/gfx/sprite.d
Normal file
11
demos/utils/source/ecs_utils/gfx/sprite.d
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
module ecs_utils.gfx.sprite;
|
||||||
|
|
||||||
|
import ecs_utils.math.matrix;
|
||||||
|
import ecs_utils.gfx.mesh_module;
|
||||||
|
|
||||||
|
struct sprite
|
||||||
|
{
|
||||||
|
MeshModule* mesh;
|
||||||
|
|
||||||
|
mat3 matrix;
|
||||||
|
}
|
||||||
118
demos/utils/source/ecs_utils/gfx/texture.d
Normal file
118
demos/utils/source/ecs_utils/gfx/texture.d
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
module ecs_utils.gfx.texture;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
import ecs_utils.math.vector;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
struct Texture
|
||||||
|
{
|
||||||
|
|
||||||
|
void create()
|
||||||
|
{
|
||||||
|
data = Mallocator.make!Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load(const char[] path)
|
||||||
|
{
|
||||||
|
char[] cpath = (cast(char*)alloca(path.length+1))[0..path.length+1];
|
||||||
|
cpath[0..$-1] = path[0..$];
|
||||||
|
cpath[$-1] = 0;
|
||||||
|
|
||||||
|
return __load(this, cpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static bool __load_sdl(ref Texture this_, const char[] path)
|
||||||
|
{
|
||||||
|
import ecs_utils.gfx.renderer;
|
||||||
|
SDL_Surface* surf = IMG_Load(path.ptr);
|
||||||
|
if(!surf)return false;
|
||||||
|
|
||||||
|
this_.data.size = ivec2(surf.w,surf.h);
|
||||||
|
|
||||||
|
this_.data.texture = SDL_CreateTextureFromSurface(Renderer.main_sdl_renderer,surf);
|
||||||
|
if(!this_.data.texture)return false;
|
||||||
|
//this_.data.texture = surf;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
static bool __load_gl(ref Texture this_, const char[] path)
|
||||||
|
{
|
||||||
|
SDL_Surface* surf = IMG_Load(path.ptr);
|
||||||
|
if(!surf)return false;
|
||||||
|
|
||||||
|
with(this_)
|
||||||
|
{
|
||||||
|
data.size = ivec2(surf.w,surf.h);
|
||||||
|
data.bpp = surf.format.BytesPerPixel;
|
||||||
|
data.data = Mallocator.makeArray!ubyte(surf.w*surf.h*surf.format.BytesPerPixel);
|
||||||
|
data.data[0..$] = (cast(ubyte*)surf.pixels)[0..data.data.length];
|
||||||
|
|
||||||
|
glGenTextures(1, &data.gl_handle);
|
||||||
|
glBindTexture(GL_TEXTURE_2D,data.gl_handle);
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
|
if(data.bpp == 3)glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,surf.w,surf.h,0,GL_RGB,GL_UNSIGNED_BYTE,data.data.ptr);
|
||||||
|
else if(data.bpp == 4)glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,surf.w,surf.h,0,GL_RGBA,GL_UNSIGNED_BYTE,data.data.ptr);
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind()
|
||||||
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, data.gl_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void destory()
|
||||||
|
{
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
glDeleteTextures(1, &data.gl_handle);
|
||||||
|
Mallocator.dispose(data);
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool function(ref Texture this_, const char[] path) __load;
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
ubyte[] data;
|
||||||
|
|
||||||
|
ivec2 size;
|
||||||
|
uint bpp;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
SDL_Texture* texture;
|
||||||
|
uint gl_handle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __loadBackend()
|
||||||
|
{
|
||||||
|
__load = &__load_gl;
|
||||||
|
/*switch(backend)
|
||||||
|
{
|
||||||
|
case Backend.opengl:__load = &__load_gl;break;
|
||||||
|
case Backend.sdl:__load = &__load_sdl;break;
|
||||||
|
default:goto case(Backend.opengl);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
Data* data;
|
||||||
|
}
|
||||||
64
demos/utils/source/ecs_utils/gfx/vertex.d
Normal file
64
demos/utils/source/ecs_utils/gfx/vertex.d
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
module ecs_utils.gfx.vertex;
|
||||||
|
|
||||||
|
import ecs.std;
|
||||||
|
|
||||||
|
struct Vertex
|
||||||
|
{
|
||||||
|
void create()
|
||||||
|
{
|
||||||
|
data = Mallocator.make!Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableStates()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void attachBindings(scope Binding[] bindings)
|
||||||
|
{
|
||||||
|
data.bindings = Mallocator.makeArray(bindings);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
byte_r_snorm,
|
||||||
|
byte_r_unorm,
|
||||||
|
byte_rg_snorm,
|
||||||
|
byte_rg_unorm,
|
||||||
|
byte_rgb_snorm,
|
||||||
|
byte_rgb_unorm,
|
||||||
|
byte_rgba_snorm,
|
||||||
|
byte_rgba_unorm,
|
||||||
|
short_r_snorm,
|
||||||
|
short_r_unorm,
|
||||||
|
short_rg_snorm,
|
||||||
|
short_rg_unorm,
|
||||||
|
short_rgb_snorm,
|
||||||
|
short_rgb_unorm,
|
||||||
|
short_rgba_snorm,
|
||||||
|
short_rgba_unorm,
|
||||||
|
float_r,
|
||||||
|
float_rg,
|
||||||
|
float_rgb,
|
||||||
|
float_rgba
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Binding
|
||||||
|
{
|
||||||
|
Type type;
|
||||||
|
uint stride;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
Binding[] bindings;
|
||||||
|
uint size;
|
||||||
|
}
|
||||||
|
|
||||||
|
Data* data;
|
||||||
|
}
|
||||||
508
demos/utils/source/ecs_utils/imgui_bind.d
Normal file
508
demos/utils/source/ecs_utils/imgui_bind.d
Normal file
|
|
@ -0,0 +1,508 @@
|
||||||
|
module ecs_utils.imgui_bind;
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
import cimgui.cimgui;
|
||||||
|
|
||||||
|
version(WebAssembly)
|
||||||
|
{
|
||||||
|
extern(C):
|
||||||
|
bool ImGui_ImplOpenGL3_Init(const char* glsl_version = null);
|
||||||
|
void ImGui_ImplOpenGL3_Shutdown();
|
||||||
|
void ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
|
bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context);
|
||||||
|
bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
||||||
|
bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
||||||
|
void ImGui_ImplSDL2_Shutdown();
|
||||||
|
void ImGui_ImplSDL2_NewFrame(SDL_Window* window);
|
||||||
|
bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
||||||
|
}
|
||||||
|
else :
|
||||||
|
|
||||||
|
import bindbc.sdl;
|
||||||
|
|
||||||
|
import glad.gl.gl;
|
||||||
|
|
||||||
|
import cimgui.cimgui;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
SDL_Window* g_Window;
|
||||||
|
ulong g_Time;
|
||||||
|
bool[3] g_MousePressed;
|
||||||
|
SDL_Cursor*[ImGuiMouseCursor_COUNT] g_MouseCursors;
|
||||||
|
char* g_ClipboardTextData;
|
||||||
|
GLuint g_FontTexture = 0;
|
||||||
|
|
||||||
|
const (char)* ImGuiImplSDL2GetClipboardText(void*)
|
||||||
|
{
|
||||||
|
if (g_ClipboardTextData)
|
||||||
|
SDL_free(g_ClipboardTextData);
|
||||||
|
g_ClipboardTextData = SDL_GetClipboardText();
|
||||||
|
return g_ClipboardTextData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplSDL2SetClipboardText(void*, const char* text)
|
||||||
|
{
|
||||||
|
SDL_SetClipboardText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
switch (event.type)
|
||||||
|
{
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
{
|
||||||
|
if (event.wheel.x > 0) io.MouseWheelH += 1;
|
||||||
|
if (event.wheel.x < 0) io.MouseWheelH -= 1;
|
||||||
|
if (event.wheel.y > 0) io.MouseWheel += 1;
|
||||||
|
if (event.wheel.y < 0) io.MouseWheel -= 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
{
|
||||||
|
if (event.button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
|
||||||
|
if (event.button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
|
||||||
|
if (event.button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case SDL_TEXTINPUT:
|
||||||
|
{
|
||||||
|
ImGuiIO_AddInputCharactersUTF8(io,event.text.text.ptr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
case SDL_KEYUP:
|
||||||
|
{
|
||||||
|
int key = event.key.keysym.scancode;
|
||||||
|
//IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
|
||||||
|
io.KeysDown[key] = (event.type == SDL_KEYDOWN);
|
||||||
|
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||||
|
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||||
|
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||||
|
io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default:break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiImplSDL2Init(SDL_Window* window)
|
||||||
|
{
|
||||||
|
g_Window = window;
|
||||||
|
|
||||||
|
// Setup back-end capabilities flags
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||||
|
io.BackendPlatformName = "imgui_impl_sdl";
|
||||||
|
|
||||||
|
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
|
||||||
|
io.KeyMap[ImGuiKey_Tab] = SDL_SCANCODE_TAB;
|
||||||
|
io.KeyMap[ImGuiKey_LeftArrow] = SDL_SCANCODE_LEFT;
|
||||||
|
io.KeyMap[ImGuiKey_RightArrow] = SDL_SCANCODE_RIGHT;
|
||||||
|
io.KeyMap[ImGuiKey_UpArrow] = SDL_SCANCODE_UP;
|
||||||
|
io.KeyMap[ImGuiKey_DownArrow] = SDL_SCANCODE_DOWN;
|
||||||
|
io.KeyMap[ImGuiKey_PageUp] = SDL_SCANCODE_PAGEUP;
|
||||||
|
io.KeyMap[ImGuiKey_PageDown] = SDL_SCANCODE_PAGEDOWN;
|
||||||
|
io.KeyMap[ImGuiKey_Home] = SDL_SCANCODE_HOME;
|
||||||
|
io.KeyMap[ImGuiKey_End] = SDL_SCANCODE_END;
|
||||||
|
io.KeyMap[ImGuiKey_Insert] = SDL_SCANCODE_INSERT;
|
||||||
|
io.KeyMap[ImGuiKey_Delete] = SDL_SCANCODE_DELETE;
|
||||||
|
io.KeyMap[ImGuiKey_Backspace] = SDL_SCANCODE_BACKSPACE;
|
||||||
|
io.KeyMap[ImGuiKey_Space] = SDL_SCANCODE_SPACE;
|
||||||
|
io.KeyMap[ImGuiKey_Enter] = SDL_SCANCODE_RETURN;
|
||||||
|
io.KeyMap[ImGuiKey_Escape] = SDL_SCANCODE_ESCAPE;
|
||||||
|
io.KeyMap[ImGuiKey_KeyPadEnter] = SDL_SCANCODE_RETURN2;
|
||||||
|
io.KeyMap[ImGuiKey_A] = SDL_SCANCODE_A;
|
||||||
|
io.KeyMap[ImGuiKey_C] = SDL_SCANCODE_C;
|
||||||
|
io.KeyMap[ImGuiKey_V] = SDL_SCANCODE_V;
|
||||||
|
io.KeyMap[ImGuiKey_X] = SDL_SCANCODE_X;
|
||||||
|
io.KeyMap[ImGuiKey_Y] = SDL_SCANCODE_Y;
|
||||||
|
io.KeyMap[ImGuiKey_Z] = SDL_SCANCODE_Z;
|
||||||
|
|
||||||
|
io.SetClipboardTextFn = &ImGuiImplSDL2SetClipboardText;
|
||||||
|
io.GetClipboardTextFn = &ImGuiImplSDL2GetClipboardText;
|
||||||
|
io.ClipboardUserData = null;
|
||||||
|
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_TextInput] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
||||||
|
g_MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||||
|
|
||||||
|
//#ifdef _WIN32
|
||||||
|
version(WebAssembly)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else version(Windows)
|
||||||
|
{
|
||||||
|
SDL_SysWMinfo wmInfo;
|
||||||
|
SDL_VERSION(&wmInfo.version_);
|
||||||
|
SDL_GetWindowWMInfo(window, &wmInfo);
|
||||||
|
io.ImeWindowHandle = wmInfo.info.win.window;
|
||||||
|
}
|
||||||
|
//#else
|
||||||
|
//(void)window;
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiImplSDL2InitForOpenGL(SDL_Window* window, void* sdl_gl_context)
|
||||||
|
{
|
||||||
|
//(void)sdl_gl_context; // Viewport branch will need this.
|
||||||
|
return ImGuiImplSDL2Init(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplSDL2Shutdown()
|
||||||
|
{
|
||||||
|
g_Window = null;
|
||||||
|
|
||||||
|
// Destroy last known clipboard data
|
||||||
|
if (g_ClipboardTextData)
|
||||||
|
SDL_free(g_ClipboardTextData);
|
||||||
|
g_ClipboardTextData = null;
|
||||||
|
|
||||||
|
// Destroy SDL mouse cursors
|
||||||
|
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
||||||
|
SDL_FreeCursor(g_MouseCursors[cursor_n]);
|
||||||
|
//memset(g_MouseCursors, 0, sizeof(g_MouseCursors));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
|
||||||
|
// Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||||
|
if (io.WantSetMousePos)
|
||||||
|
SDL_WarpMouseInWindow(g_Window, cast(int)io.MousePos.x, cast(int)io.MousePos.y);
|
||||||
|
else
|
||||||
|
io.MousePos = ImVec2(-float.max, -float.max);
|
||||||
|
|
||||||
|
int mx, my;
|
||||||
|
Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
|
||||||
|
io.MouseDown[0] = g_MousePressed[0] || (mouse_buttons & (SDL_PRESSED<<(SDL_BUTTON_LEFT-1))) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
||||||
|
io.MouseDown[1] = g_MousePressed[1] || (mouse_buttons & (SDL_PRESSED<<(SDL_BUTTON_RIGHT-1))) != 0;
|
||||||
|
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & (SDL_PRESSED<<(SDL_BUTTON_MIDDLE-1))) != 0;
|
||||||
|
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||||
|
|
||||||
|
//#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
||||||
|
/*SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
||||||
|
if (g_Window == focused_window)
|
||||||
|
{
|
||||||
|
// SDL_GetMouseState() gives mouse position seemingly based on the last window entered/focused(?)
|
||||||
|
// The creation of a new windows at runtime and SDL_CaptureMouse both seems to severely mess up with that, so we retrieve that position globally.
|
||||||
|
int wx, wy;
|
||||||
|
SDL_GetWindowPosition(focused_window, &wx, &wy);
|
||||||
|
SDL_GetGlobalMouseState(&mx, &my);
|
||||||
|
mx -= wx;
|
||||||
|
my -= wy;
|
||||||
|
io.MousePos = ImVec2((float)mx, (float)my);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger the OS window resize cursor.
|
||||||
|
// The function is only supported from SDL 2.0.4 (released Jan 2016)
|
||||||
|
bool any_mouse_button_down = ImGui::IsAnyMouseDown();
|
||||||
|
SDL_CaptureMouse(any_mouse_button_down ? SDL_TRUE : SDL_FALSE);
|
||||||
|
//#else*/
|
||||||
|
if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
|
||||||
|
io.MousePos = ImVec2(cast(float)mx, cast(float)my);
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplSDL2_UpdateMouseCursor()
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImGuiMouseCursor imgui_cursor = igGetMouseCursor();
|
||||||
|
if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
|
||||||
|
{
|
||||||
|
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
||||||
|
SDL_ShowCursor(SDL_FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show OS mouse cursor
|
||||||
|
SDL_SetCursor(g_MouseCursors[imgui_cursor] ? g_MouseCursors[imgui_cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
|
||||||
|
SDL_ShowCursor(SDL_TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_ImplSDL2_UpdateGamepads()
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
//memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
||||||
|
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Get gamepad
|
||||||
|
SDL_GameController* game_controller = SDL_GameControllerOpen(0);
|
||||||
|
if (!game_controller)
|
||||||
|
{
|
||||||
|
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update gamepad inputs
|
||||||
|
/*#define MAP_BUTTON(NAV_NO, BUTTON_NO) { io.NavInputs[NAV_NO] = (SDL_GameControllerGetButton(game_controller, BUTTON_NO) != 0) ? 1.0f : 0.0f; }
|
||||||
|
#define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float vn = (float)(SDL_GameControllerGetAxis(game_controller, AXIS_NO) - V0) / (float)(V1 - V0); if (vn > 1.0f) vn = 1.0f; if (vn > 0.0f && io.NavInputs[NAV_NO] < vn) io.NavInputs[NAV_NO] = vn; }
|
||||||
|
const int thumb_dead_zone = 8000; // SDL_gamecontroller.h suggests using this value.
|
||||||
|
MAP_BUTTON(ImGuiNavInput_Activate, SDL_CONTROLLER_BUTTON_A); // Cross / A
|
||||||
|
MAP_BUTTON(ImGuiNavInput_Cancel, SDL_CONTROLLER_BUTTON_B); // Circle / B
|
||||||
|
MAP_BUTTON(ImGuiNavInput_Menu, SDL_CONTROLLER_BUTTON_X); // Square / X
|
||||||
|
MAP_BUTTON(ImGuiNavInput_Input, SDL_CONTROLLER_BUTTON_Y); // Triangle / Y
|
||||||
|
MAP_BUTTON(ImGuiNavInput_DpadLeft, SDL_CONTROLLER_BUTTON_DPAD_LEFT); // D-Pad Left
|
||||||
|
MAP_BUTTON(ImGuiNavInput_DpadRight, SDL_CONTROLLER_BUTTON_DPAD_RIGHT); // D-Pad Right
|
||||||
|
MAP_BUTTON(ImGuiNavInput_DpadUp, SDL_CONTROLLER_BUTTON_DPAD_UP); // D-Pad Up
|
||||||
|
MAP_BUTTON(ImGuiNavInput_DpadDown, SDL_CONTROLLER_BUTTON_DPAD_DOWN); // D-Pad Down
|
||||||
|
MAP_BUTTON(ImGuiNavInput_FocusPrev, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
|
||||||
|
MAP_BUTTON(ImGuiNavInput_FocusNext, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
|
||||||
|
MAP_BUTTON(ImGuiNavInput_TweakSlow, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
|
||||||
|
MAP_BUTTON(ImGuiNavInput_TweakFast, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
|
||||||
|
MAP_ANALOG(ImGuiNavInput_LStickLeft, SDL_CONTROLLER_AXIS_LEFTX, -thumb_dead_zone, -32768);
|
||||||
|
MAP_ANALOG(ImGuiNavInput_LStickRight, SDL_CONTROLLER_AXIS_LEFTX, +thumb_dead_zone, +32767);
|
||||||
|
MAP_ANALOG(ImGuiNavInput_LStickUp, SDL_CONTROLLER_AXIS_LEFTY, -thumb_dead_zone, -32767);
|
||||||
|
MAP_ANALOG(ImGuiNavInput_LStickDown, SDL_CONTROLLER_AXIS_LEFTY, +thumb_dead_zone, +32767);
|
||||||
|
|
||||||
|
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
||||||
|
#undef MAP_BUTTON
|
||||||
|
#undef MAP_ANALOG*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private long frequency;
|
||||||
|
|
||||||
|
void ImGuiImplSDL2NewFrame(SDL_Window* window)
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
assert(ImFontAtlas_IsBuilt(io.Fonts), "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame().");
|
||||||
|
|
||||||
|
// Setup display size (every frame to accommodate for window resizing)
|
||||||
|
int w, h;
|
||||||
|
int display_w, display_h;
|
||||||
|
SDL_GetWindowSize(window, &w, &h);
|
||||||
|
SDL_GL_GetDrawableSize(window, &display_w, &display_h);
|
||||||
|
io.DisplaySize = ImVec2(cast(float)w, cast(float)h);
|
||||||
|
if (w > 0 && h > 0)
|
||||||
|
io.DisplayFramebufferScale = ImVec2(cast(float)display_w / w, cast(float)display_h / h);
|
||||||
|
|
||||||
|
// Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
|
||||||
|
frequency = SDL_GetPerformanceFrequency();
|
||||||
|
long current_time = SDL_GetPerformanceCounter();
|
||||||
|
io.DeltaTime = g_Time > 0 ? cast(float)(cast(double)(current_time - g_Time) / frequency) : cast(float)(1.0f / 60.0f);
|
||||||
|
g_Time = current_time;
|
||||||
|
|
||||||
|
ImGui_ImplSDL2_UpdateMousePosAndButtons();
|
||||||
|
ImGui_ImplSDL2_UpdateMouseCursor();
|
||||||
|
|
||||||
|
// Update game controllers (if enabled and available)
|
||||||
|
ImGui_ImplSDL2_UpdateGamepads();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool ImGuiImplOpenGL2Init()
|
||||||
|
{
|
||||||
|
// Setup back-end capabilities flags
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
io.BackendRendererName = "imgui_impl_opengl2";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplOpenGL2Shutdown()
|
||||||
|
{
|
||||||
|
ImGuiImplOpenGL2DestroyDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplOpenGL2NewFrame()
|
||||||
|
{
|
||||||
|
if (!g_FontTexture)
|
||||||
|
ImGuiImplOpenGL2CreateDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGuiImplOpenGL2SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height)
|
||||||
|
{
|
||||||
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill.
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
//glDisable(GL_LIGHTING);
|
||||||
|
//glDisable(GL_COLOR_MATERIAL);
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
|
// If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
|
||||||
|
// you may need to backup/reset/restore current shader using the lines below. DO NOT MODIFY THIS FILE! Add the code in your calling function:
|
||||||
|
// GLint last_program;
|
||||||
|
// glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||||
|
// glUseProgram(0);
|
||||||
|
// ImGui_ImplOpenGL2_RenderDrawData(...);
|
||||||
|
// glUseProgram(last_program)
|
||||||
|
|
||||||
|
// Setup viewport, orthographic projection matrix
|
||||||
|
// Our visible imgui space lies from draw_data.DisplayPos (top left) to draw_data.DisplayPos+data_data.DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
|
||||||
|
glViewport(0, 0, cast(GLsizei)fb_width, cast(GLsizei)fb_height);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(draw_data.DisplayPos.x, draw_data.DisplayPos.x + draw_data.DisplaySize.x, draw_data.DisplayPos.y + draw_data.DisplaySize.y, draw_data.DisplayPos.y, -1.0f, +1.0f);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OpenGL2 Render function.
|
||||||
|
// (this used to be set in io.RenderDrawListsFn and called by ImGui::Render(), but you can now call this directly from your main loop)
|
||||||
|
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly, in order to be able to run within any OpenGL engine that doesn't do so.
|
||||||
|
void ImGuiImplOpenGL2RenderDrawData(ImDrawData* draw_data)
|
||||||
|
{
|
||||||
|
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||||
|
int fb_width = cast(int)(draw_data.DisplaySize.x * draw_data.FramebufferScale.x);
|
||||||
|
int fb_height = cast(int)(draw_data.DisplaySize.y * draw_data.FramebufferScale.y);
|
||||||
|
if (fb_width == 0 || fb_height == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Backup GL state
|
||||||
|
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
|
GLint[2] last_polygon_mode; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode.ptr);
|
||||||
|
GLint[4] last_viewport; glGetIntegerv(GL_VIEWPORT, last_viewport.ptr);
|
||||||
|
GLint[4] last_scissor_box; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box.ptr);
|
||||||
|
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||||
|
|
||||||
|
// Setup desired GL state
|
||||||
|
ImGuiImplOpenGL2SetupRenderState(draw_data, fb_width, fb_height);
|
||||||
|
|
||||||
|
// Will project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec2 clip_off = draw_data.DisplayPos; // (0,0) unless using multi-viewports
|
||||||
|
ImVec2 clip_scale = draw_data.FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
||||||
|
|
||||||
|
// Render command lists
|
||||||
|
for (int n = 0; n < draw_data.CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
ImDrawList* cmd_list = draw_data.CmdLists[n];
|
||||||
|
ImDrawVert* vtx_buffer = cmd_list.VtxBuffer.Data;
|
||||||
|
ImDrawIdx* idx_buffer = cmd_list.IdxBuffer.Data;
|
||||||
|
glVertexPointer(2, GL_FLOAT, ImDrawVert.sizeof, cast(const GLvoid*)(cast(const char*)vtx_buffer + ImDrawVert.pos.offsetof));
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, ImDrawVert.sizeof, cast(const GLvoid*)(cast(const char*)vtx_buffer + ImDrawVert.uv.offsetof));
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, ImDrawVert.sizeof, cast(const GLvoid*)(cast(const char*)vtx_buffer + ImDrawVert.col.offsetof));
|
||||||
|
|
||||||
|
for (int cmd_i = 0; cmd_i < cmd_list.CmdBuffer.Size; cmd_i++)
|
||||||
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list.CmdBuffer.Data[cmd_i];
|
||||||
|
if (pcmd.UserCallback)
|
||||||
|
{
|
||||||
|
// User callback, registered via ImDrawList::AddCallback()
|
||||||
|
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||||
|
/*if (pcmd.UserCallback == &ImDrawCallback_ResetRenderState)
|
||||||
|
ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height);
|
||||||
|
else*/
|
||||||
|
pcmd.UserCallback(cmd_list, pcmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
|
ImVec4 clip_rect = ImVec4(0,0,0,0);
|
||||||
|
clip_rect.x = (pcmd.ClipRect.x - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.y = (pcmd.ClipRect.y - clip_off.y) * clip_scale.y;
|
||||||
|
clip_rect.z = (pcmd.ClipRect.z - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.w = (pcmd.ClipRect.w - clip_off.y) * clip_scale.y;
|
||||||
|
|
||||||
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
|
{
|
||||||
|
// Apply scissor/clipping rectangle
|
||||||
|
glScissor(cast(int)clip_rect.x, cast(int)(fb_height - clip_rect.w), cast(int)(clip_rect.z - clip_rect.x), cast(int)(clip_rect.w - clip_rect.y));
|
||||||
|
|
||||||
|
// Bind texture, Draw
|
||||||
|
glBindTexture(GL_TEXTURE_2D, cast(GLuint)pcmd.TextureId);
|
||||||
|
glDrawElements(GL_TRIANGLES, cast(GLsizei)pcmd.ElemCount, ImDrawIdx.sizeof == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idx_buffer += pcmd.ElemCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore modified GL state
|
||||||
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, cast(GLuint)last_texture);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glPopAttrib();
|
||||||
|
glPolygonMode(GL_FRONT, cast(GLenum)last_polygon_mode[0]); glPolygonMode(GL_BACK, cast(GLenum)last_polygon_mode[1]);
|
||||||
|
glViewport(last_viewport[0], last_viewport[1], cast(GLsizei)last_viewport[2], cast(GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], cast(GLsizei)last_scissor_box[2], cast(GLsizei)last_scissor_box[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiImplOpenGL2CreateFontsTexture()
|
||||||
|
{
|
||||||
|
// Build texture atlas
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
ubyte* pixels;
|
||||||
|
int width, height;
|
||||||
|
int bpp;
|
||||||
|
ImFontAtlas_GetTexDataAsRGBA32(io.Fonts, &pixels, &width, &height, &bpp); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||||
|
|
||||||
|
// Upload texture to graphics system
|
||||||
|
GLint last_texture;
|
||||||
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
|
glGenTextures(1, &g_FontTexture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
|
// Store our identifier
|
||||||
|
io.Fonts.TexID = cast(ImTextureID)g_FontTexture;
|
||||||
|
|
||||||
|
// Restore state
|
||||||
|
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplOpenGL2DestroyFontsTexture()
|
||||||
|
{
|
||||||
|
if (g_FontTexture)
|
||||||
|
{
|
||||||
|
ImGuiIO* io = igGetIO();
|
||||||
|
glDeleteTextures(1, &g_FontTexture);
|
||||||
|
io.Fonts.TexID = null;
|
||||||
|
g_FontTexture = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGuiImplOpenGL2CreateDeviceObjects()
|
||||||
|
{
|
||||||
|
return ImGuiImplOpenGL2CreateFontsTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGuiImplOpenGL2DestroyDeviceObjects()
|
||||||
|
{
|
||||||
|
ImGuiImplOpenGL2DestroyFontsTexture();
|
||||||
|
}
|
||||||
95
demos/utils/source/ecs_utils/imgui_styles.d
Normal file
95
demos/utils/source/ecs_utils/imgui_styles.d
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
module ecs_utils.imgui_styles;
|
||||||
|
|
||||||
|
import cimgui.cimgui;
|
||||||
|
|
||||||
|
void setStyle(uint index)
|
||||||
|
{
|
||||||
|
ImGuiStyle * style = igGetStyle();
|
||||||
|
ImVec4 * colors = style.Colors.ptr;
|
||||||
|
|
||||||
|
switch(index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
igStyleColorsClassic(style);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
igStyleColorsDark(style);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
igStyleColorsLight(style);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
colors[ImGuiCol_Text] = ImVec4(0.95f, 0.96f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextDisabled] = ImVec4(0.36f, 0.42f, 0.47f, 1.00f);
|
||||||
|
colors[ImGuiCol_WindowBg] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||||
|
colors[ImGuiCol_ChildBg] = ImVec4(0.15f, 0.18f, 0.22f, 1.00f);
|
||||||
|
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
|
||||||
|
colors[ImGuiCol_Border] = ImVec4(0.08f, 0.10f, 0.12f, 1.00f);
|
||||||
|
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||||
|
colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.12f, 0.20f, 0.28f, 1.00f);
|
||||||
|
colors[ImGuiCol_FrameBgActive] = ImVec4(0.09f, 0.12f, 0.14f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBg] = ImVec4(0.09f, 0.12f, 0.14f, 0.65f);
|
||||||
|
colors[ImGuiCol_TitleBgActive] = ImVec4(0.08f, 0.10f, 0.12f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
|
||||||
|
colors[ImGuiCol_MenuBarBg] = ImVec4(0.15f, 0.18f, 0.22f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.39f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.18f, 0.22f, 0.25f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.09f, 0.21f, 0.31f, 1.00f);
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_SliderGrab] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.37f, 0.61f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_Button] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Header] = ImVec4(0.20f, 0.25f, 0.29f, 0.55f);
|
||||||
|
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
||||||
|
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Separator] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
|
||||||
|
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
|
||||||
|
colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
|
||||||
|
colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f);
|
||||||
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||||
|
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_Tab] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||||
|
colors[ImGuiCol_TabHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
||||||
|
colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
|
||||||
|
colors[ImGuiCol_TabUnfocused] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||||
|
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||||
|
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
||||||
|
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||||
|
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||||
|
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||||
|
|
||||||
|
style.PopupRounding = 3;
|
||||||
|
|
||||||
|
style.WindowPadding = ImVec2(4, 4);
|
||||||
|
style.FramePadding = ImVec2(6, 4);
|
||||||
|
style.ItemSpacing = ImVec2(6, 2);
|
||||||
|
|
||||||
|
style.ScrollbarSize = 18;
|
||||||
|
|
||||||
|
style.WindowBorderSize = 1;
|
||||||
|
style.ChildBorderSize = 1;
|
||||||
|
style.PopupBorderSize = 1;
|
||||||
|
style.FrameBorderSize = 0;
|
||||||
|
|
||||||
|
style.WindowRounding = 3;
|
||||||
|
style.ChildRounding = 3;
|
||||||
|
style.FrameRounding = 4;
|
||||||
|
style.ScrollbarRounding = 2;
|
||||||
|
style.GrabRounding = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
igStyleColorsClassic(style);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
183
demos/utils/source/ecs_utils/utils.d
Normal file
183
demos/utils/source/ecs_utils/utils.d
Normal file
|
|
@ -0,0 +1,183 @@
|
||||||
|
module ecs_utils.utils;
|
||||||
|
|
||||||
|
extern(C):
|
||||||
|
|
||||||
|
int randomRange(int min, int max)
|
||||||
|
{
|
||||||
|
int range = max - min;
|
||||||
|
return rand() % range - min;
|
||||||
|
}
|
||||||
|
|
||||||
|
float randomf()
|
||||||
|
{
|
||||||
|
const float scale = 1.0 / 32_767.0;
|
||||||
|
return cast(float)(rand() & 0x007FFF) * scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
float randomRangef(float min, float max)
|
||||||
|
{
|
||||||
|
//int range = max - min;
|
||||||
|
return rand()%4096;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
extern(C) int printf(scope const char* format, ...) @nogc nothrow @system;
|
||||||
|
extern(C) int rand();
|
||||||
|
|
||||||
|
version(D_BetterC)
|
||||||
|
{
|
||||||
|
version(LDC)
|
||||||
|
{
|
||||||
|
extern(C) bool _d_enter_cleanup(void*)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern(C) void _d_leave_cleanup(void*)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extern(C) void _d_array_slice_copy(void* dst, size_t dstlen, void* src, size_t srclen, size_t elemsz)
|
||||||
|
{
|
||||||
|
import ldc.intrinsics : llvm_memcpy;
|
||||||
|
llvm_memcpy!size_t(dst, src, dstlen * elemsz, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
version(WebAssembly)
|
||||||
|
{
|
||||||
|
|
||||||
|
enum EMSCRIPTEN_RESULT_SUCCESS = 0;
|
||||||
|
enum EMSCRIPTEN_RESULT_DEFERRED = 1;
|
||||||
|
enum EMSCRIPTEN_RESULT_NOT_SUPPORTED = -1;
|
||||||
|
enum EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED = -2;
|
||||||
|
enum EMSCRIPTEN_RESULT_INVALID_TARGET = -3;
|
||||||
|
enum EMSCRIPTEN_RESULT_UNKNOWN_TARGET = -4;
|
||||||
|
enum EMSCRIPTEN_RESULT_INVALID_PARAM = -5;
|
||||||
|
enum EMSCRIPTEN_RESULT_FAILED = -6;
|
||||||
|
enum EMSCRIPTEN_RESULT_NO_DATA = -7;
|
||||||
|
enum EMSCRIPTEN_RESULT_TIMED_OUT = -8;
|
||||||
|
|
||||||
|
alias EMSCRIPTEN_FULLSCREEN_SCALE = int;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT = 0;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH = 1;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT = 2;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_SCALE_CENTER = 3;
|
||||||
|
|
||||||
|
alias EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE = int;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE = 0;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF = 1;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF = 2;
|
||||||
|
|
||||||
|
alias EMSCRIPTEN_FULLSCREEN_FILTERING = int;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT = 0;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST = 1;
|
||||||
|
enum EMSCRIPTEN_FULLSCREEN_FILTERING_BILINEAR = 2;
|
||||||
|
|
||||||
|
alias em_canvasresized_callback_func = extern(C) bool function (int eventType, const void *reserved, void *userData);
|
||||||
|
|
||||||
|
struct EmscriptenFullscreenStrategy {
|
||||||
|
EMSCRIPTEN_FULLSCREEN_SCALE scaleMode;
|
||||||
|
EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE canvasResolutionScaleMode;
|
||||||
|
EMSCRIPTEN_FULLSCREEN_FILTERING filteringMode;
|
||||||
|
em_canvasresized_callback_func canvasResizedCallback;
|
||||||
|
void *canvasResizedCallbackUserData;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C) const (char)* emscripten_result_to_string(int result) {
|
||||||
|
if (result == EMSCRIPTEN_RESULT_SUCCESS) return "EMSCRIPTEN_RESULT_SUCCESS";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_DEFERRED) return "EMSCRIPTEN_RESULT_DEFERRED";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_NOT_SUPPORTED) return "EMSCRIPTEN_RESULT_NOT_SUPPORTED";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED) return "EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_INVALID_TARGET) return "EMSCRIPTEN_RESULT_INVALID_TARGET";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_UNKNOWN_TARGET) return "EMSCRIPTEN_RESULT_UNKNOWN_TARGET";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_INVALID_PARAM) return "EMSCRIPTEN_RESULT_INVALID_PARAM";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_FAILED) return "EMSCRIPTEN_RESULT_FAILED";
|
||||||
|
if (result == EMSCRIPTEN_RESULT_NO_DATA) return "EMSCRIPTEN_RESULT_NO_DATA";
|
||||||
|
return "Unknown EMSCRIPTEN_RESULT!";
|
||||||
|
}
|
||||||
|
|
||||||
|
extern (C) alias em_callback_func = void function();
|
||||||
|
extern (C) alias em_arg_callback_func = void function(void*);
|
||||||
|
extern (C) void emscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop);
|
||||||
|
extern (C) void emscripten_set_main_loop_arg(em_arg_callback_func func, void *arg, int fps, int simulate_infinite_loop);
|
||||||
|
extern (C) int emscripten_set_main_loop_timing(int mode, int value);
|
||||||
|
extern (C) void emscripten_cancel_main_loop();
|
||||||
|
extern (C) int emscripten_request_fullscreen_strategy(const char *target, bool deferUntilInEventHandler, const EmscriptenFullscreenStrategy *fullscreenStrategy);
|
||||||
|
extern (C) int emscripten_enter_soft_fullscreen(const char *target, const EmscriptenFullscreenStrategy *fullscreenStrategy);
|
||||||
|
|
||||||
|
alias int time_t;
|
||||||
|
alias int clockid_t;
|
||||||
|
enum CLOCK_REALTIME = 0;
|
||||||
|
|
||||||
|
struct timespec
|
||||||
|
{
|
||||||
|
time_t tv_sec;
|
||||||
|
int tv_nsec;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern(C) int clock_gettime(clockid_t, timespec*) @nogc nothrow @system;
|
||||||
|
|
||||||
|
struct Time
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
static long getUSecTime()
|
||||||
|
{
|
||||||
|
time_t time;
|
||||||
|
timespec spec;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_REALTIME, &spec);
|
||||||
|
|
||||||
|
//time = spec.tv_sec;
|
||||||
|
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000;//time / 1000_000;
|
||||||
|
|
||||||
|
/*LARGE_INTEGER time, freq;
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
QueryPerformanceCounter(&time);
|
||||||
|
return time.QuadPart / (freq.QuadPart / 1000_000);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else version(Windows)
|
||||||
|
{
|
||||||
|
import core.stdc.stdio : printf;
|
||||||
|
import core.sys.windows.windows;
|
||||||
|
struct Time
|
||||||
|
{
|
||||||
|
static long getUSecTime()
|
||||||
|
{
|
||||||
|
LARGE_INTEGER time, freq;
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
QueryPerformanceCounter(&time);
|
||||||
|
return time.QuadPart / (freq.QuadPart / 1000_000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else version(Posix)
|
||||||
|
{
|
||||||
|
import core.stdc.stdio : printf;
|
||||||
|
import core.sys.posix.time;
|
||||||
|
struct Time
|
||||||
|
{
|
||||||
|
static long getUSecTime()
|
||||||
|
{
|
||||||
|
time_t time;
|
||||||
|
timespec spec;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_REALTIME, &spec);
|
||||||
|
|
||||||
|
//time = spec.tv_sec;
|
||||||
|
return spec.tv_sec * 1000_000 + spec.tv_nsec / 1000;//time / 1000_000;
|
||||||
|
|
||||||
|
/*LARGE_INTEGER time, freq;
|
||||||
|
QueryPerformanceFrequency(&freq);
|
||||||
|
QueryPerformanceCounter(&time);
|
||||||
|
return time.QuadPart / (freq.QuadPart / 1000_000);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
dub.json
3
dub.json
|
|
@ -10,6 +10,9 @@
|
||||||
"dflagss": [
|
"dflagss": [
|
||||||
"-betterC"
|
"-betterC"
|
||||||
],
|
],
|
||||||
|
"excludedSourceFiles":[
|
||||||
|
"source\/ecs\/traits.d"
|
||||||
|
],
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"name" : "library",
|
"name" : "library",
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static if (isCopyable!T) {
|
static if (isCopyable!T) {
|
||||||
export this(this) {
|
export this(this) {
|
||||||
T[] tmp = array[0 .. used];
|
T[] tmp = array[0 .. used];
|
||||||
array = null;
|
array = null;
|
||||||
|
|
@ -38,9 +38,9 @@ public:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@disable this(this);
|
@disable this(this);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
@disable this(this);
|
//@disable this(this);
|
||||||
|
|
||||||
export ~this() {
|
export ~this() {
|
||||||
clear();
|
clear();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue