Add option to always use GLSL tone mapping instead of GL_FRAMEBUFFER_SRGB.
This commit is contained in:
parent
6636b5e595
commit
1557d59d0f
|
@ -340,4 +340,4 @@ proc newMainFramebuffer*(engine: MyouEngine): Framebuffer =
|
|||
result.engine = engine
|
||||
result.framebuffer = 0
|
||||
result.is_complete = true
|
||||
result.use_sRGB = true
|
||||
result.use_sRGB = not engine.use_glsl_tone_mapping
|
||||
|
|
|
@ -64,6 +64,7 @@ proc newMyouEngine*(
|
|||
opengl_version = default_gl_version,
|
||||
opengl_es = default_gl_es,
|
||||
glsl_version = "",
|
||||
use_glsl_tone_mapping = true,
|
||||
): MyouEngine
|
||||
proc get_builtin_shader_library*(use_cubemap_prefiltering = true): string
|
||||
proc get_builtin_shader_textures*(): Table[string, Texture]
|
||||
|
@ -87,6 +88,7 @@ proc newMyouEngine*(
|
|||
opengl_version = default_gl_version,
|
||||
opengl_es = default_gl_es,
|
||||
glsl_version = "",
|
||||
use_glsl_tone_mapping = true,
|
||||
): MyouEngine =
|
||||
## Creates a Myou Engine instance. You need to call this before you can use
|
||||
## the engine. You also need to call `run <#run,MyouEngine>`_ at the end of
|
||||
|
@ -103,6 +105,10 @@ proc newMyouEngine*(
|
|||
# to override it with per-camera exposure settings
|
||||
if opengl_es:
|
||||
assert opengl_version >= 300, "Minimum supported OpenGL ES version is 3.0"
|
||||
else:
|
||||
assert opengl_version >= 330, "Minimum supported OpenGL version is 3.3"
|
||||
|
||||
if opengl_es or use_glsl_tone_mapping:
|
||||
result.tone_mapping_library = dedent """
|
||||
float linearrgb_to_srgb(float c){
|
||||
if (c < 0.0031308) return (c < 0.0) ? 0.0 : c * 12.92;
|
||||
|
@ -119,8 +125,8 @@ proc newMyouEngine*(
|
|||
#define MYOU_TONE_MAP(x) linearrgb_to_srgb(x)
|
||||
"""
|
||||
result.tone_mapping_function = "MYOU_TONE_MAP"
|
||||
result.use_glsl_tone_mapping = true
|
||||
else:
|
||||
assert opengl_version >= 330, "Minimum supported OpenGL version is 3.3"
|
||||
result.tone_mapping_library = "\n#define MYOU_TONE_MAP(x) x\n"
|
||||
|
||||
echo "assigning renderer"
|
||||
|
|
|
@ -81,9 +81,8 @@ type
|
|||
renderer*: RenderManager
|
||||
tone_mapping_library*: string
|
||||
tone_mapping_function*: string
|
||||
use_glsl_tone_mapping*: bool
|
||||
loaders_by_ext*: Table[string, seq[proc(e: MyouEngine): Loader]]
|
||||
# TODO: remove this and query it when screen is created
|
||||
width*, height*: int
|
||||
glsl_version*: string
|
||||
all_framebuffers*: seq[Framebuffer] ## private
|
||||
|
||||
|
|
Loading…
Reference in a new issue