]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoRaise an exception if the TBN UV layer is not found during export
Mikko Rasa [Tue, 23 Jun 2020 16:37:40 +0000 (19:37 +0300)]
Raise an exception if the TBN UV layer is not found during export

3 years agoRework Blender material and texture export
Mikko Rasa [Tue, 23 Jun 2020 15:14:59 +0000 (18:14 +0300)]
Rework Blender material and texture export

3 years agoRequire all uniforms in a buffer-backed block to be present
Mikko Rasa [Tue, 23 Jun 2020 14:20:20 +0000 (17:20 +0300)]
Require all uniforms in a buffer-backed block to be present

3 years agoMake setting a nonexistent uniform only a warning in debug builds
Mikko Rasa [Tue, 23 Jun 2020 14:19:11 +0000 (17:19 +0300)]
Make setting a nonexistent uniform only a warning in debug builds

During development it's sometimes necessary to disable parts of a shader,
which causes variables to disappear.

3 years agoNormalize fragment normal
Mikko Rasa [Tue, 23 Jun 2020 14:11:54 +0000 (17:11 +0300)]
Normalize fragment normal

With some shading models even small deviations, such as result from
the quantization to 8-bit texel component values, may cause visible
artifacts.

3 years agoAdd a PBR material type and corresponding shader
Mikko Rasa [Tue, 23 Jun 2020 14:06:30 +0000 (17:06 +0300)]
Add a PBR material type and corresponding shader

3 years agoNaming tweaks in builtin shaders
Mikko Rasa [Tue, 23 Jun 2020 14:01:53 +0000 (17:01 +0300)]
Naming tweaks in builtin shaders

3 years agoUse HDR rendering and a colorcurve postprocessor in desertpillars
Mikko Rasa [Thu, 11 Jun 2020 19:24:20 +0000 (22:24 +0300)]
Use HDR rendering and a colorcurve postprocessor in desertpillars

3 years agoModernize the demo and tool programs
Mikko Rasa [Thu, 11 Jun 2020 15:07:38 +0000 (18:07 +0300)]
Modernize the demo and tool programs

3 years agoAdd a flag to BasicMaterial to enable shadow map
Mikko Rasa [Thu, 11 Jun 2020 19:05:19 +0000 (22:05 +0300)]
Add a flag to BasicMaterial to enable shadow map

3 years agoFix shadow map uniform name
Mikko Rasa [Thu, 11 Jun 2020 14:18:08 +0000 (17:18 +0300)]
Fix shadow map uniform name

3 years agoGive materials the capability to automatically create a suitable shader
Mikko Rasa [Thu, 11 Jun 2020 13:23:19 +0000 (16:23 +0300)]
Give materials the capability to automatically create a suitable shader

3 years agoCheck uniforms as a hint for texunit to use for material textures
Mikko Rasa [Thu, 11 Jun 2020 11:13:38 +0000 (14:13 +0300)]
Check uniforms as a hint for texunit to use for material textures

3 years agoRecreate RenderPass shdata if a new program is specified
Mikko Rasa [Thu, 11 Jun 2020 08:09:14 +0000 (11:09 +0300)]
Recreate RenderPass shdata if a new program is specified

3 years agoCopy the tied program of ProgramData
Mikko Rasa [Thu, 4 Jun 2020 23:16:16 +0000 (02:16 +0300)]
Copy the tied program of ProgramData

3 years agoAdd a new, better structured Phong shader
Mikko Rasa [Thu, 4 Jun 2020 21:04:53 +0000 (00:04 +0300)]
Add a new, better structured Phong shader

3 years agoRedesign the material system
Mikko Rasa [Wed, 3 Jun 2020 18:56:00 +0000 (21:56 +0300)]
Redesign the material system

Now that legacy OpenGL support is removed and all lighting calculations
are done in shaders, there's no reason to stick to the old material model
anymore.  The new model is closer to that used by many 3D modeling
programs, with textures applied to material properties.  It also allows
different types of materials with different shading models.

This change breaks source compatibility, but the new BasicMaterial class
is mostly compatible with the old Material class, with only minor changes
needed in code and datafiles.

3 years agoFix a bug with setting uniforms after texunits
Mikko Rasa [Mon, 1 Jun 2020 10:11:30 +0000 (13:11 +0300)]
Fix a bug with setting uniforms after texunits

3 years agoWrite the occluder shader in GLSL
Mikko Rasa [Sun, 31 May 2020 21:53:04 +0000 (00:53 +0300)]
Write the occluder shader in GLSL

3 years agoAdd a texunit statement which automatically determines the unit number
Mikko Rasa [Sun, 31 May 2020 09:43:03 +0000 (12:43 +0300)]
Add a texunit statement which automatically determines the unit number

3 years agoRemove obsolete demo programs
Mikko Rasa [Mon, 25 May 2020 19:11:58 +0000 (22:11 +0300)]
Remove obsolete demo programs

3 years agoMark ProgramBuilder as deprecated
Mikko Rasa [Mon, 25 May 2020 18:43:29 +0000 (21:43 +0300)]
Mark ProgramBuilder as deprecated

3 years agoChange Texturing to store index-texture pairs
Mikko Rasa [Mon, 25 May 2020 15:17:28 +0000 (18:17 +0300)]
Change Texturing to store index-texture pairs

Modern GPUs have a large number of texture binding points so storing
texture pointers for all of them is inefficient.

3 years agoAutomatically add uniforms for texunits
Mikko Rasa [Tue, 19 May 2020 12:16:35 +0000 (15:16 +0300)]
Automatically add uniforms for texunits

The uniform statement now uses existing ProgramData if it exists, to
avoid inadvertently erasing the texunit uniforms.

3 years agoRequire shader for rendering
Mikko Rasa [Mon, 18 May 2020 22:57:24 +0000 (01:57 +0300)]
Require shader for rendering

Being able to assume shaders are used will make implementing some
features easier.

3 years agoRemove attribute proxying from Mesh in the Blender exporter
Mikko Rasa [Sun, 3 May 2020 22:28:28 +0000 (01:28 +0300)]
Remove attribute proxying from Mesh in the Blender exporter

Instead just copy all the data.  This makes the script easier to read and
avoids holding references to stale data.

3 years agoUpdate the Blender exporter for version 2.80
Mikko Rasa [Sun, 3 May 2020 22:22:55 +0000 (01:22 +0300)]
Update the Blender exporter for version 2.80

Textures are disabled for now.  Blender's materials have changed
significantly enough to be difficult to map to the current mspgl material
system and I'm planning to do some changes to the library anyway.

3 years agoCheck that Object has a Mesh when rendering
Mikko Rasa [Thu, 5 Mar 2020 17:46:03 +0000 (19:46 +0200)]
Check that Object has a Mesh when rendering

3 years agoAdd a find_pass function to Technique
Mikko Rasa [Sat, 2 May 2020 14:55:37 +0000 (17:55 +0300)]
Add a find_pass function to Technique

4 years agoFix euler angle calculation in Transform
Mikko Rasa [Sun, 9 Feb 2020 22:07:37 +0000 (00:07 +0200)]
Fix euler angle calculation in Transform

4 years agoAccess static functions through class and not instance
Mikko Rasa [Sun, 9 Feb 2020 22:07:09 +0000 (00:07 +0200)]
Access static functions through class and not instance

4 years agoCosmetic fixes
Mikko Rasa [Sun, 9 Feb 2020 22:06:54 +0000 (00:06 +0200)]
Cosmetic fixes

4 years agoCheck for non-null buffer in Bufferable's refresh function
Mikko Rasa [Sun, 9 Feb 2020 22:04:14 +0000 (00:04 +0200)]
Check for non-null buffer in Bufferable's refresh function

4 years agoFlush the shader data of View's Renderer after rendering
Mikko Rasa [Sun, 9 Feb 2020 22:01:58 +0000 (00:01 +0200)]
Flush the shader data of View's Renderer after rendering

In a very simple application with only a single renderable omitting the
flush would prevent shader data from being updated.

4 years agoMake all overloads of render available in WindowView
Mikko Rasa [Sun, 9 Feb 2020 22:01:35 +0000 (00:01 +0200)]
Make all overloads of render available in WindowView

4 years agoAdd a function to clear all FBO component buffers
Mikko Rasa [Sun, 9 Feb 2020 22:00:26 +0000 (00:00 +0200)]
Add a function to clear all FBO component buffers

4 years agoRemove the kludge for FBO error codes on GLES
Mikko Rasa [Sun, 9 Feb 2020 21:57:57 +0000 (23:57 +0200)]
Remove the kludge for FBO error codes on GLES

This turned out to be a bad idea as the constants are not defined in the
headers.  Not having them here makes the extension generator emit the
definitions with a proper #ifndef guard.

4 years agoDon't call glVertexAttribDivisor if the extension is not available
Mikko Rasa [Sun, 9 Feb 2020 21:53:24 +0000 (23:53 +0200)]
Don't call glVertexAttribDivisor if the extension is not available

4 years agoUse GLES3 headers instead of GLES2
Mikko Rasa [Sun, 9 Feb 2020 21:51:16 +0000 (23:51 +0200)]
Use GLES3 headers instead of GLES2

A few constants are not available in GLES2 and would be bothersome to
introduce through a fake extension.  I'll bring back compatibility if
some relevant hardware turns out to only support GLES2.

4 years agoRemove sized L and LA pixel formats
Mikko Rasa [Sun, 9 Feb 2020 21:48:45 +0000 (23:48 +0200)]
Remove sized L and LA pixel formats

These constants are not part of modern OpenGL and not supported on
OpenGL ES.  The unsized formats can still be used for uploading data
and will be translated to RED and RG for use as internal format.

4 years agoAdd the specializations for non-square matrix uniforms
Mikko Rasa [Sun, 9 Feb 2020 20:51:04 +0000 (22:51 +0200)]
Add the specializations for non-square matrix uniforms

These were forgotten from d971f8d.

4 years agoRecognize an assignment to an out parameter as used
Mikko Rasa [Wed, 5 Feb 2020 21:48:46 +0000 (23:48 +0200)]
Recognize an assignment to an out parameter as used

4 years agoAdd support for non-square matrix uniforms
Mikko Rasa [Wed, 5 Feb 2020 21:35:42 +0000 (23:35 +0200)]
Add support for non-square matrix uniforms

4 years agoRewrite ProgramData update in a more efficient way
Mikko Rasa [Wed, 5 Feb 2020 18:07:28 +0000 (20:07 +0200)]
Rewrite ProgramData update in a more efficient way

This method does not do any map lookups on the fast path.

4 years agoRemove the EXT_draw_range_elements extension
Mikko Rasa [Mon, 4 Nov 2019 01:58:45 +0000 (03:58 +0200)]
Remove the EXT_draw_range_elements extension

Its main use is to allow the OpenGL implementation to optimize reads from
client memory, which is moot when storing vertices in VRAM.

4 years agoCheck for null camera in View::render
Mikko Rasa [Mon, 4 Nov 2019 01:56:05 +0000 (03:56 +0200)]
Check for null camera in View::render

4 years agoAllow system framebuffer to not have attachments
Mikko Rasa [Mon, 4 Nov 2019 01:55:41 +0000 (03:55 +0200)]
Allow system framebuffer to not have attachments

4 years agoUse a persistent Renderer in View
Mikko Rasa [Sun, 3 Nov 2019 17:41:37 +0000 (19:41 +0200)]
Use a persistent Renderer in View

4 years agoDeprecated the Renderer constructor taking a Camera pointer
Mikko Rasa [Sun, 3 Nov 2019 11:58:16 +0000 (13:58 +0200)]
Deprecated the Renderer constructor taking a Camera pointer

4 years agoRemove one more render function without a Renderer I missed before
Mikko Rasa [Fri, 1 Nov 2019 08:25:22 +0000 (10:25 +0200)]
Remove one more render function without a Renderer I missed before

4 years agoSupport rendering View with an externally provided Renderer
Mikko Rasa [Thu, 31 Oct 2019 11:47:22 +0000 (13:47 +0200)]
Support rendering View with an externally provided Renderer

This can be useful if an OffscreenView is used to render a sub-scene in
some renderable's setup_frame function.

4 years agoRemove various old deprecated things
Mikko Rasa [Thu, 31 Oct 2019 00:44:55 +0000 (02:44 +0200)]
Remove various old deprecated things

Mark remaining ones as deprecated with a compiler attribute.

4 years agoRequire vertex arrays to have a buffer when adding them to VertexSetup
Mikko Rasa [Tue, 29 Oct 2019 22:02:51 +0000 (00:02 +0200)]
Require vertex arrays to have a buffer when adding them to VertexSetup

4 years agoRemove bind mechanics from Mesh and VertexArray
Mikko Rasa [Tue, 29 Oct 2019 00:25:16 +0000 (02:25 +0200)]
Remove bind mechanics from Mesh and VertexArray

It's now handled through VertexSetup.

4 years agoRemove last fragments of rendererless rendering
Mikko Rasa [Tue, 29 Oct 2019 00:19:43 +0000 (02:19 +0200)]
Remove last fragments of rendererless rendering

4 years agoAdd sanity checks to bind functions
Mikko Rasa [Tue, 29 Oct 2019 00:04:37 +0000 (02:04 +0200)]
Add sanity checks to bind functions

4 years agoAlways use VertexSetup in Mesh
Mikko Rasa [Mon, 28 Oct 2019 23:57:53 +0000 (01:57 +0200)]
Always use VertexSetup in Mesh

This means vertex array objects are now required.  I don't think that's a
problem since they've been supported even on mobile hardware for a long
time.

4 years agoRemove immediate mode emulation
Mikko Rasa [Mon, 28 Oct 2019 13:42:20 +0000 (15:42 +0200)]
Remove immediate mode emulation

It's not very useful anymore and starting to get in the way of other
things.

4 years agoAlways use buffers in Mesh
Mikko Rasa [Wed, 23 Oct 2019 11:25:46 +0000 (14:25 +0300)]
Always use buffers in Mesh

4 years agoRemove support for legacy OpenGL features
Mikko Rasa [Sun, 20 Oct 2019 17:20:57 +0000 (20:20 +0300)]
Remove support for legacy OpenGL features

This includes all fixed-point functionality as well as the
NV_primitive_restart and SGIS_generate_mipmap extensions, which have
better alternatives available in modern OpenGL.

4 years agoInitialize members of Font::Glyph legacy
Mikko Rasa [Mon, 30 Sep 2019 11:06:46 +0000 (14:06 +0300)]
Initialize members of Font::Glyph

It's not safe to assume that font files contain all of the values for
every glyph.

4 years agoRequire ARB_shader_objects in Shader constructor
Mikko Rasa [Wed, 25 Sep 2019 16:33:11 +0000 (19:33 +0300)]
Require ARB_shader_objects in Shader constructor

4 years agoHide windows.h from public headers
Mikko Rasa [Wed, 18 Sep 2019 15:10:21 +0000 (18:10 +0300)]
Hide windows.h from public headers

OpenGL headers require a few #defines, so do those manually instead.

4 years agoAppease the compiler with some extra copy-ctor's and operator='s
Mikko Rasa [Thu, 12 Sep 2019 19:34:15 +0000 (22:34 +0300)]
Appease the compiler with some extra copy-ctor's and operator='s

In C++11 if you manually define either a copy constructor or an
assignment operator, you must define the other as well.

4 years agoProduce a linear animation curve if there's only one keyframe
Mikko Rasa [Mon, 26 Aug 2019 11:53:21 +0000 (14:53 +0300)]
Produce a linear animation curve if there's only one keyframe

This can be useful for setting a constant value for the duration of an
animation, without needing to specify the value twice.

4 years agoPlug some memory leaks
Mikko Rasa [Wed, 7 Aug 2019 11:56:42 +0000 (14:56 +0300)]
Plug some memory leaks

4 years agoFix an uninitialized variable
Mikko Rasa [Tue, 6 Aug 2019 17:11:47 +0000 (20:11 +0300)]
Fix an uninitialized variable

4 years agoAdd a function to flush shader data in Renderer
Mikko Rasa [Sun, 28 Jul 2019 00:03:58 +0000 (03:03 +0300)]
Add a function to flush shader data in Renderer

Necessary if the same shader data object is used in successive draw
commands but the contained uniform values are changed.

4 years agoAdd an object LoD bias parameter to Renderer
Mikko Rasa [Sat, 27 Jul 2019 23:05:55 +0000 (02:05 +0300)]
Add an object LoD bias parameter to Renderer

This could be used by environment map and similar effects to render the
scene at lower detail.

4 years agoAdd an alpha channel flag to Pipeline
Mikko Rasa [Sat, 27 Jul 2019 23:05:05 +0000 (02:05 +0300)]
Add an alpha channel flag to Pipeline

4 years agoDon't add externally specified postprocessors as owned
Mikko Rasa [Fri, 26 Jul 2019 17:02:58 +0000 (20:02 +0300)]
Don't add externally specified postprocessors as owned

4 years agoRecognize the samplerCubeArray type in shaders
Mikko Rasa [Tue, 23 Jul 2019 08:07:29 +0000 (11:07 +0300)]
Recognize the samplerCubeArray type in shaders

The actual extension will be added a bit later.

4 years agoSupport named postprocessor slots in pipeline templates
Mikko Rasa [Tue, 23 Jul 2019 07:07:40 +0000 (10:07 +0300)]
Support named postprocessor slots in pipeline templates

This can be useful if a postprocessor in the middle of the chain needs to
be created at runtime due to data dependencies.

4 years agoAllow access to ShadowMap's texture and matrix from outside
Mikko Rasa [Tue, 23 Jul 2019 07:04:00 +0000 (10:04 +0300)]
Allow access to ShadowMap's texture and matrix from outside

This is necessary if a postprocessor wants to access the shadow map for
deferred shading.

4 years agoRecognize #version directive in GLSL
Mikko Rasa [Thu, 11 Jul 2019 22:22:59 +0000 (01:22 +0300)]
Recognize #version directive in GLSL

This allows shaders to explicitly specify the required version in
case there's a feature which is not detected by the program compiler
framework.

4 years agoAdd feature check for array texture samplers
Mikko Rasa [Thu, 11 Jul 2019 22:22:02 +0000 (01:22 +0300)]
Add feature check for array texture samplers

4 years agoTranslate cube map sampling function for old GLSL versions
Mikko Rasa [Thu, 11 Jul 2019 12:34:30 +0000 (15:34 +0300)]
Translate cube map sampling function for old GLSL versions

4 years agoAdd functions for setting arrays of 2x2 and 3x3 matrix uniforms
Mikko Rasa [Tue, 9 Jul 2019 22:51:37 +0000 (01:51 +0300)]
Add functions for setting arrays of 2x2 and 3x3 matrix uniforms

4 years agoMake explicit mipmap generation public
Mikko Rasa [Mon, 8 Jul 2019 16:24:02 +0000 (19:24 +0300)]
Make explicit mipmap generation public

Also changed set_generate_mipmap to set_auto_generate_mipmap to clarify
that it concerns automatic mipmap generation.

4 years agoGuard against sample points behind the camera in ambient occlusion
Mikko Rasa [Wed, 3 Jul 2019 21:06:00 +0000 (00:06 +0300)]
Guard against sample points behind the camera in ambient occlusion

4 years agoSort things by name when exporting
Mikko Rasa [Wed, 3 Jul 2019 17:26:03 +0000 (20:26 +0300)]
Sort things by name when exporting

This keeps them in deterministic order and produces cleaner diffs.

4 years agoRemove a stray debug print
Mikko Rasa [Wed, 3 Jul 2019 17:04:33 +0000 (20:04 +0300)]
Remove a stray debug print

4 years agoAdd an option to skip existing resources when exporting a scene
Mikko Rasa [Wed, 3 Jul 2019 17:01:03 +0000 (20:01 +0300)]
Add an option to skip existing resources when exporting a scene

This can be helpful when exporting multiple scenes, to avoid certain
auto-generated resources being exported multiple times.

4 years agoCorrectly process meshes with empty material slots
Mikko Rasa [Wed, 3 Jul 2019 16:35:05 +0000 (19:35 +0300)]
Correctly process meshes with empty material slots

This may happen if materials are defined on the object rather than on
the mesh.

4 years agoChange AnimationPlayer::stop to take a Placeable
Mikko Rasa [Sun, 23 Jun 2019 21:25:26 +0000 (00:25 +0300)]
Change AnimationPlayer::stop to take a Placeable

4 years agoExport the entire scene by default
Mikko Rasa [Sun, 23 Jun 2019 20:02:41 +0000 (23:02 +0300)]
Export the entire scene by default

Options have been added to export only selected object or limit the
export to active layers.

4 years agoUse double for animation curves
Mikko Rasa [Sun, 23 Jun 2019 19:38:23 +0000 (22:38 +0300)]
Use double for animation curves

Since the t value is raised to the third power, floats with their 24-bit
mantissa started to run out of precision around 30 seconds.  Doubles
should be good for several hours.  If that somehow turns out to not be
enough I'll invent some way to chain animations.

4 years agoAdd public functions for adding owned keyframes to Animation
Mikko Rasa [Sun, 23 Jun 2019 19:37:22 +0000 (22:37 +0300)]
Add public functions for adding owned keyframes to Animation

This is useful when constructing animations in code, to avoid the need
of storing pointers to the keyframes.

4 years agoRetain assignment location when moving out variables to global scope
Mikko Rasa [Fri, 21 Jun 2019 12:13:27 +0000 (15:13 +0300)]
Retain assignment location when moving out variables to global scope

4 years agoTranslate shader compile errors to actual source file names
Mikko Rasa [Fri, 21 Jun 2019 11:46:34 +0000 (14:46 +0300)]
Translate shader compile errors to actual source file names

Intel drivers appear to process the #line directives incorrectly and
produce off-by-one line numbers.

4 years agoRecord statement source lines and emit #line directives to output
Mikko Rasa [Fri, 21 Jun 2019 11:27:32 +0000 (14:27 +0300)]
Record statement source lines and emit #line directives to output

4 years agoRefactor ProgramCompiler::Formatter
Mikko Rasa [Fri, 21 Jun 2019 11:24:56 +0000 (14:24 +0300)]
Refactor ProgramCompiler::Formatter

This is necessary for keeping track of output lines and translating error
locations.

4 years agoRequire import module names to be identifiers
Mikko Rasa [Fri, 21 Jun 2019 10:25:33 +0000 (13:25 +0300)]
Require import module names to be identifiers

4 years agoConsistently use the NodeList and NodeArray types
Mikko Rasa [Fri, 21 Jun 2019 10:24:01 +0000 (13:24 +0300)]
Consistently use the NodeList and NodeArray types

4 years agoAdd an intermediate node type for statements
Mikko Rasa [Fri, 21 Jun 2019 10:19:47 +0000 (13:19 +0300)]
Add an intermediate node type for statements

4 years agoObtain the instance transform location from shader program
Mikko Rasa [Fri, 21 Jun 2019 08:32:46 +0000 (11:32 +0300)]
Obtain the instance transform location from shader program

4 years agoMerge variable declaration layouts
Mikko Rasa [Fri, 21 Jun 2019 08:23:21 +0000 (11:23 +0300)]
Merge variable declaration layouts

4 years agoConsider extensions when checking GLSL features
Mikko Rasa [Fri, 21 Jun 2019 08:22:08 +0000 (11:22 +0300)]
Consider extensions when checking GLSL features

4 years agoStore information about attributes in Program
Mikko Rasa [Thu, 20 Jun 2019 21:50:41 +0000 (00:50 +0300)]
Store information about attributes in Program

4 years agoSplit the interface queries from Program::link into separate functions
Mikko Rasa [Thu, 20 Jun 2019 08:38:11 +0000 (11:38 +0300)]
Split the interface queries from Program::link into separate functions