Commit graph

820 commits

Author SHA1 Message Date
Richard Davey
c5b538afcd Added the new Graphics Pipeline 2020-10-28 17:39:54 +00:00
Richard Davey
d6ecea8d4d Use the new attributes format 2020-10-28 17:39:31 +00:00
Richard Davey
92c365a881 Removed all Graphics methods and related properties. 2020-10-28 16:53:31 +00:00
Richard Davey
8c6e67ecfc Added attributes and other shader specific properties and methods 2020-10-28 16:15:56 +00:00
Richard Davey
e52def85be All vertex values now set during boot, after shaders are created. Added batchQuad/Tri methods. 2020-10-28 16:15:35 +00:00
Richard Davey
389b480777 Using new easier attribute config + moved some methods to WebGLPipeline 2020-10-28 16:15:09 +00:00
Richard Davey
15d8eabf17 Single pipeline updated so it can easily extend Multi now 2020-10-28 16:14:42 +00:00
Richard Davey
93b1775aaa Added new WebGL consts for easier shader configs 2020-10-28 16:14:05 +00:00
Richard Davey
9aeb765696 Updated type defs 2020-10-28 16:13:46 +00:00
Richard Davey
120f2c87cb The WebGL.Utils.getComponentCount function has been removed as this is no longer required internally. 2020-10-28 16:13:29 +00:00
Richard Davey
88d2ecd760 Pipeline passes attributes off to Shader. Also fixed multi-shader setup. 2020-10-27 18:06:45 +00:00
Richard Davey
39c77f431f Flush here, rather than in renderer 2020-10-27 18:06:28 +00:00
Richard Davey
a5d6016e64 Move sequence so the renderer is clean 2020-10-27 18:06:13 +00:00
Richard Davey
f42f0ce0d6 Shader needs attributes 2020-10-27 18:06:00 +00:00
Richard Davey
7b5d6076b2 Added max size value 2020-10-27 14:41:43 +00:00
Richard Davey
f50560eba8 The WebGLRenderer.getMaxTextures method has been removed. This is no longer needed as you can use the WebGLRenderer.maxTextures property instead. 2020-10-27 14:36:43 +00:00
Richard Davey
93b569c5ca Look-up based on string or instance 2020-10-27 14:05:48 +00:00
Richard Davey
59a215d643 * Types.Core.PipelineConfig is a new configuration object that you can set in the Game Config under the pipeline property. It allows you to define custom WebGL pipelines as part of the Game Config, so they're automatically installed and ready for use by all Scenes in your game. You can either set the pipeline object, or set it under the render sub-config. 2020-10-27 13:44:58 +00:00
Richard Davey
98b4319436 Bind needs to return this 2020-10-27 12:26:01 +00:00
Richard Davey
4ebdc637a9 Tidied up method flow 2020-10-27 12:25:53 +00:00
Richard Davey
d2c025e38a Added target fbo and all of the shader setters back in 2020-10-27 12:25:42 +00:00
Richard Davey
2b3863272e Removed 'nativeTextures' and added new reset parameter
* The `WebGLRenderer.nativeTextures` array has been removed and any WebGLTextures created by the renderer are no longer stored within it. All WebGLTexture instances are stored in the `TextureSource` objects anyway, or by local classes such as RenderTexture, so there was no need to have another array taking up memroy.
* The `WebGLRenderer.deleteTexture` method has a new optional boolean parameter `reset` which allows you to control if the `WebGLRenderer.resetTextures` method is called, or not, after the texture is deleted.
2020-10-27 11:38:21 +00:00
Richard Davey
efbc256a1f Added target fbo 2020-10-26 17:13:24 +00:00
Richard Davey
3c7062ca6a Common strings. 2020-10-26 17:00:23 +00:00
Richard Davey
bc34d01535 Update WebGLPipeline.js 2020-10-26 15:19:21 +00:00
Richard Davey
1e80f53f1d Better docs 2020-10-26 15:00:25 +00:00
Richard Davey
7c929e52bc Finished method docs and added clone 2020-10-26 15:00:17 +00:00
Richard Davey
ec4751ddc6 Finished all method docs 2020-10-26 15:00:07 +00:00
Richard Davey
55cbda85b8 Removed debug code 2020-10-26 14:24:15 +00:00
Richard Davey
f87bd7d384 Removed all of the shader setters. This should be done via the WebGLShader class now. 2020-10-26 14:24:06 +00:00
Richard Davey
fba97afcb6 Update dirty uniforms 2020-10-26 14:05:49 +00:00
Richard Davey
f32b4c7ecd Fixed config setter and added mvp matrices 2020-10-26 14:05:39 +00:00
Richard Davey
1e8b1cc583 Removed ProjectOrtho and optimized setters 2020-10-26 14:05:26 +00:00
Richard Davey
7ad02d6c0d Removed mvp component 2020-10-26 14:05:07 +00:00
Richard Davey
14e90c60d8 Don't resize to zero dimensions and run proper compare 2020-10-26 14:04:45 +00:00
Richard Davey
291f588110 Removed the mvp component. Pipelines no longer need this. 2020-10-26 14:04:01 +00:00
Richard Davey
8c85887479 Removed all of the mvp functions as they're no longer needed 2020-10-26 14:03:18 +00:00
Richard Davey
0b3011add3 Update PointLight-frag.js 2020-10-21 18:15:34 +01:00
Richard Davey
272727459f Use new shader property 2020-10-21 18:15:28 +01:00
Richard Davey
9531124903 Typo fix 2020-10-21 18:15:19 +01:00
Richard Davey
da47c776fa New shader class to allow one pipeline to set multiple shaders 2020-10-21 18:15:13 +01:00
Richard Davey
180b29be98 The pipeline can now handle multiple shaders all sharing the same attributes 2020-10-21 18:15:02 +01:00
Richard Davey
c730272ba7 Updated the configs to handle multiple shaders 2020-10-21 18:12:40 +01:00
Richard Davey
4b1c5c1a0b Improved docs 2020-10-21 11:30:49 +01:00
Richard Davey
7ffa615831 The WebGLPipeline.flushLocked property has been removed. A pipeline can never flush in the middle of a flush anyway, so it was just wasting CPU cycles being set. 2020-10-21 11:19:12 +01:00
Richard Davey
75f857b645 Update WebGLRenderer.js 2020-10-16 14:11:21 +01:00
Richard Davey
e50339b144 Updated to use new filtered children list 2020-10-16 14:11:15 +01:00
Richard Davey
d35ff331b2 Now takes a pre-filtered list of children to render 2020-10-16 11:36:00 +01:00
Richard Davey
675eec8103 Better attenuation 2020-10-14 15:16:35 +01:00
Richard Davey
cc167e158f Much better effect from the light shader 2020-10-14 11:57:58 +01:00
Richard Davey
d3d0c71fe4 Fixed shader for clip-space 2020-10-13 22:34:26 +01:00
Richard Davey
b1a5ce7f55 Testing new batched lights 2020-10-13 18:17:30 +01:00
Richard Davey
8708255948 Removed Layer3D Game Object and old MeshPipeline 2020-10-13 10:56:21 +01:00
Richard Davey
dda4431366 Merged the Layer3D Game Object and pipeline back in for now 2020-10-07 17:44:36 +01:00
Richard Davey
706d02873a Fixed issue with camera flash/fade not working 2020-10-05 13:44:29 +01:00
Richard Davey
468b1ba255 Added 2nd conditional back 2020-10-05 13:43:54 +01:00
Richard Davey
c3c35322c4
Merge pull request #4992 from svipal/master
Preliminary PR for isometric support
2020-10-02 09:42:47 +01:00
Richard Davey
6bc858e332 Moved out OBJFile and updated PipelineManager 2020-10-01 18:00:02 +01:00
Richard Davey
3baecb19d4 Moved old mesh pipeline and code into own folder 2020-10-01 17:56:49 +01:00
Richard Davey
2d43561e1a WebGLRenderer.vaoExtension is a new property that holds a reference to the Vertex Array Object WebGL Extension, if supported by the browser. 2020-10-01 13:48:27 +01:00
Richard Davey
d8992ccf9d WebGLRenderer.instancedArraysExtension is a new property that holds the WebGL Extension for instanced array drawing, if supported by the browser. 2020-10-01 10:57:13 +01:00
Richard Davey
8119ce7da1 Fixed use of old camera private properties 2020-09-29 16:44:11 +01:00
Richard Davey
aa3544310c When taking a snapshot in WebGL it would often have an extra line of empty pixels at the top of the resulting image, due to a rounding error in the WebGLSnapshot function. Fix #4956 2020-09-24 10:32:47 +01:00
Richard Davey
4748c7c7fc WebGLRenderer.defaultScissor is a new property that holds the default scissor dimensions for the renderer. This is modified during resize and avoids continuous array generation in the preRender loop. 2020-09-24 09:26:41 +01:00
Richard Davey
e004fa47fc Creating a Bitmap Mask from a texture atlas that was then used to mask another Game Object also using that same texture atlas would throw the error GL_INVALID_OPERATION : glDrawArrays: Source and destination textures of the draw are the same.. It now renders as expected. Fix #4675 2020-09-23 18:10:12 +01:00
Richard Davey
232f8e0ebc Updated to use new uniforms and fixed renderWebGL parameters 2020-09-23 17:55:03 +01:00
Richard Davey
e2d775e083 Remove duplicate code 2020-09-23 12:06:22 +01:00
Richard Davey
b350ebddcc Removed duplicate code. 2020-09-23 11:42:14 +01:00
Richard Davey
183e68580f Fixed dirty flag reset 2020-09-22 11:45:49 +01:00
Richard Davey
bd25dbc355 Added per-model cull mode 2020-09-22 11:39:26 +01:00
Richard Davey
0410c9f5aa Updated JSDocs 2020-09-22 11:33:40 +01:00
Richard Davey
afe765a2cf Fix component properties 2020-09-21 18:24:12 +01:00
Richard Davey
d86cde525a Remove console.log 2020-09-21 18:23:48 +01:00
Richard Davey
d33c69b65c Updated the shaders 2020-09-21 18:23:41 +01:00
Richard Davey
893453f840 New uniforms handler, new cache and dirty checks 2020-09-21 15:57:38 +01:00
Richard Davey
4549fb4320 Updated type defs 2020-09-21 14:05:51 +01:00
Richard Davey
f2f3aea79a Shorter errors 2020-09-21 14:05:38 +01:00
Richard Davey
9bb510be0c Now caches uniform locations and added all of the new set1f etc uniform methods 2020-09-21 14:05:30 +01:00
Richard Davey
56caeb126f Renders whole buffer in a single draw with no vertex iteration 2020-09-21 00:17:14 +01:00
Richard Davey
1d2a8bc58f Added fog to shader 2020-09-21 00:16:43 +01:00
svipal
030a9489cd
Merge pull request #9 from photonstorm/master
Final master pull hopefully
2020-09-19 11:01:04 +02:00
Svipal
299f83c13d fixed conflicts 2020-09-19 10:56:05 +02:00
Richard Davey
307cbe130f New Mesh Shader 2020-09-18 17:51:23 +01:00
Richard Davey
9a1b252a11 Use shouldFlush 2020-09-18 17:50:57 +01:00
Richard Davey
0013db3747 Created new Mesh Pipeline 2020-09-18 17:50:20 +01:00
Richard Davey
74f35acad1 Better docs 2020-09-18 16:38:26 +01:00
svipal
79fe9abc6e finished updating culling system 2020-09-18 17:16:52 +02:00
Richard Davey
5e5b8c0938 The WebGLPipeline.shouldFlush method now accepts an optional parameter amount. If given, it will return true if when the amount is added to the vertex count it will exceed the vertex capacity. The Multi Pipeline has been updated to now use this method instead of performing the comparison multiple times itself. 2020-09-15 11:54:12 +01:00
Richard Davey
6a966e3f3b Removed interpolationPercentage parameter from all render methods, as it has never been used. 2020-09-14 15:33:58 +01:00
Richard Davey
3fa0070e50 Now uses white texture and tintEffect mode 1 2020-09-14 15:03:04 +01:00
Richard Davey
81800e0ce2 WebGLRenderer.whiteTexture is a new property that is a reference to a pure white 4x4 texture that is created during Boot by the Texture Manager. The Multi Pipeline uses this internally for all Graphic, Shape and fill rendering. 2020-09-14 14:44:29 +01:00
Richard Davey
4ade25fc79 No longer read private values for tint
The `Multi Pipeline`, `Bitmap Text`, `Render Texture`, `Text`, `TileSprite` and `Camera` now all read the tint values from the public properties instead of the private `_tintTL` etc ones. They also now set the `tintEffect` value directly from the `tintFill` property, removing another conditional check.
2020-09-14 11:05:09 +01:00
Richard Davey
75c5f11aee Updated shader source RGB to BGR and removed if-else block
* The `Single.frag`, `Light.frag` and `Multi.frag` shaders have all been updated so they now read the color value as `outTint.bgr` instead of `outTint.rgb`. This allows the colors to remain in RGB order within the Tint component.
* The `Single.frag`, `Light.frag` and `Multi.frag` shaders have all been updated so they no longer have a 3-way check on the `outTintEffect` value.
2020-09-14 11:02:02 +01:00
Richard Davey
ea0abc4f69 Tidy up the formatting 2020-09-14 09:44:17 +01:00
Richard Davey
e4b1093e72 The WebGLRenderer.resize and onResize methods no longer receives or uses the resolution parameter. 2020-09-12 11:58:08 +01:00
Richard Davey
67e49b515c The PipelineManager.resize method along with WebGLPipeline.resize and anything else that extends them no longer receives or uses the resolution parameter. 2020-09-12 11:57:16 +01:00
Richard Davey
37a9261ac4 The CanvasRenderer no longer reads or uses the Game Config resolution property. 2020-09-12 11:56:11 +01:00
Emil Schnedler Vad
e1106a0112 Says webglRender but it is in PipelineManager 2020-09-11 18:44:11 +02:00
Richard Davey
205552d69c Fix namespaces. Fix #5289 2020-09-10 17:04:56 +01:00
Richard Davey
296dafebf5 No need for gl ref 2020-09-09 13:33:25 +01:00
Richard Davey
da4c387d86 Reference fixes 2020-09-09 13:21:38 +01:00
Richard Davey
6734932a32 Update PipelineManager.js 2020-09-09 13:09:25 +01:00
Richard Davey
7e840b2670 Removed all of the pipeline methods and added the Pipeline Manager instance 2020-09-09 13:05:18 +01:00
Richard Davey
52c2312455 Update PipelineManager.js 2020-09-09 13:05:18 +01:00
Richard Davey
7765016caa Pipeline constants so we can avoid using strings elsewhere 2020-09-09 13:05:17 +01:00
Richard Davey
d3e82f2d76 The new Pipeline Manager class 2020-09-09 13:05:17 +01:00
Richard Davey
dc99fd03aa Don't create if vertices already provided. Fix #5280 2020-09-07 16:03:36 +01:00
Richard Davey
5224985e7f Update BitmapMaskPipeline.js 2020-09-07 16:03:18 +01:00
Richard Davey
d92195a8b8 Default rotation as well 2020-09-02 22:55:51 +01:00
Richard Davey
1562525a51 When using Camera.setRenderToTexture its zoom value would be applied twice. Fix #4221 2020-09-02 22:50:27 +01:00
Richard Davey
6aef37572d WebGLRenderer.previousPipeline is a new property that is set during a call to clearPipeline and used during calls to rebindPipeline, allowing the renderer to rebind any previous pipeline, not just the Multi Pipeline.
The `WebGLRenderer.rebindPipeline` method has been changed slightly. Previously, you had to specify the `pipelineInstance`, but this is now optional. If you don't, it will use the new `previousPipeline` property instead. If not set, or none given, it will now return without throwing gl errors as well.
2020-09-01 13:05:31 +01:00
Richard Davey
809b8a41d9 The WebGLRenderer.updateCanvasTexture method will now set gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL to true, which should stop issues where you update a Text Game Object, having added a Render Texture or Spine Game Object to the Scene after it, which switches the PMA setting. Fix #5064 2020-08-26 00:19:19 +01:00
Richard Davey
791704febe WebGLRenderer.finalType is a new boolean property that signifies if the current Game Object being rendered is the final one in the list. 2020-08-25 18:24:42 +01:00
Richard Davey
de0133e3cc Spine Game Objects can now be rendered to Render Textures. Fix #5184 2020-08-25 14:11:37 +01:00
Richard Davey
ca99c4564f Added reset property to Bind to get new vertex attrib locations 2020-08-25 13:24:56 +01:00
Richard Davey
7d1ad38b4a Updated shader names 2020-08-25 13:23:59 +01:00
Richard Davey
0cd4d0fc54 Update WebGLRenderer.js 2020-08-21 16:23:04 +01:00
Richard Davey
9a1dc640f8 Fix gl access 2020-08-21 16:17:29 +01:00
Richard Davey
0dd07333af Updated to use MultiPipeline 2020-08-21 16:14:59 +01:00
Richard Davey
5c39254f36 Testing new config approach 2020-08-21 16:04:26 +01:00
Richard Davey
209b39b38c New pipeline names and single texture flag 2020-08-21 16:03:29 +01:00
Richard Davey
468c03dfe5 Much better docs and handling of config values 2020-08-21 16:03:07 +01:00
Richard Davey
4b4af50ca9 Quicker return 2020-08-21 16:02:43 +01:00
Richard Davey
37fdde7911 New typedefs for pipeline configs 2020-08-21 16:02:30 +01:00
Richard Davey
600385ac29 A brand new pipeline for single-texture custom pipelines 2020-08-21 16:01:53 +01:00
Richard Davey
57040554ef Renamed the pipelines to make them less ambiguous and sorted out lots of config properties 2020-08-21 16:01:39 +01:00
Richard Davey
8f5ee5391f Removed redundant consts 2020-08-21 15:59:41 +01:00
Richard Davey
6435772646 Shaders renamed to match new pipeline names 2020-08-21 15:41:12 +01:00
Richard Davey
14ad202adc Use new Utils function 2020-08-21 09:44:52 +01:00
Richard Davey
8edbbb2e2d Renderer.WebGL.Utils.parseFragmentShaderMaxTextures is a new function that will take fragment shader source and search it for %count% and %forloop% declarations, replacing them with the required GLSL for multi-texture support, returning the modified source. 2020-08-21 09:44:43 +01:00
Richard Davey
84ef02743b The WebGL Renderer will now add the pipelines during the boot method, instead of init. 2020-08-20 10:48:30 +01:00
Richard Davey
e3142f313f WebGLPipeline.hasBooted is a new boolean property that tracks if the pipeline has been booted or not, which is now far more important in 3.5 than in previous versions. This is checked in the WebGLRenderer.addPipeline method, and if not set, the pipeline is booted. Fix #5251 #5255 2020-08-20 10:47:21 +01:00
Richard Davey
75da5b2f22 Reset all textures on rebind, which is what Externs need when finishing 2020-08-06 17:06:26 +01:00
Richard Davey
4baa0522b9 Bumping to 3.50 2020-07-31 13:41:29 +01:00
Richard Davey
bf4c475e85 Floor drawFillRect values 2020-07-30 18:10:23 +01:00
Richard Davey
86f35ef9cf Updated docs 2020-07-23 17:35:47 +01:00
Richard Davey
c31a9ad4e5 WebGLRenderer.unbindTextures is a new method that will activate and then null bind all WebGL textures. 2020-07-23 16:24:44 +01:00
Richard Davey
27426dd0b6 Testing RenderTextures (currently broken, will fix next week) 2020-07-17 18:08:39 +01:00
Richard Davey
8210700124 Enable the pipelines again 2020-07-17 17:04:49 +01:00
Richard Davey
491ca62373 The TextureTintStripPipeline now extends TextureTintPipeline and just changes the topolgy, vastly reducing the filesize. 2020-07-17 17:04:40 +01:00
Richard Davey
8d976d6ed5 WebGLRenderer.textureFlush is a new property that keeps track of the total texture flushes per frame. 2020-07-17 16:36:18 +01:00
Richard Davey
8bb49332a9 Always set rotation 2020-07-17 13:55:50 +01:00
Richard Davey
d11a16deaa Added forceZero and setAttribPointers
`WebGLPipeline.forceZero` is a new property that informs Game Objects if the pipeline requires a zero bound texture unit.
* `WebGLPipeline.setAttribPointers` is a new method that will set the vertex attribute pointers for the pipeline.
2020-07-17 13:55:39 +01:00
Richard Davey
fea1ade5b7 Update WebGLRenderer.js 2020-07-16 16:59:45 +01:00
Richard Davey
12fc51e2e2 If normal map set, advance the current active texture 2020-07-16 16:17:16 +01:00
Richard Davey
3dd6d8a1a4 Remove forceZero and added textureUnit 2020-07-16 16:16:57 +01:00
Richard Davey
5e8c28d468 Removed batchTexture as it's no longer needed 2020-07-16 16:16:42 +01:00
Richard Davey
76de5c246a Update ForwardDiffuseLightPipeline.js 2020-07-16 15:51:12 +01:00
Richard Davey
e7957b9380 Added getNormalMap and setGameObject 2020-07-16 15:18:02 +01:00
Richard Davey
f7e6847027 Added setGameObject method and currentUnit property 2020-07-16 15:16:17 +01:00