Commit Graph

556 Commits

Author SHA1 Message Date
Hajime Hoshi
4a90841a59 ebiten: update a comment 2022-04-28 11:14:36 +09:00
Hajime Hoshi
b1bcbbeeea ebiten: add comments at DrawTriangles 2022-04-26 23:23:31 +09:00
Hajime Hoshi
6710808cd1 ebiten: compile shaders at NewShader
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
f75a70dc40 internal/graphicscommand: treat []float32 instead of interface{} for uniform variables 2022-04-03 03:51:52 +09:00
Hajime Hoshi
9ddcf58728 ebiten: allow passing ebiten.Image to NewImageFromImage
Closes #1917
2022-04-02 06:10:22 +09:00
Hajime Hoshi
0c6362c93a internal/atlas: move the color scaling from internal/atlas to ebiten
Updates #1820
2022-04-02 02:47:56 +09:00
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
3ae4e873e6 ebiten: refactoring: remove an unused member Image.screen 2022-04-01 18:17:07 +09:00
Hajime Hoshi
b5bb576a58 internal/ui: refactoring: unexport ConvertUniforms 2022-03-21 17:05:50 +09:00
Hajime Hoshi
c316aaae72 internal/buffered: simplify the API 2022-03-21 15:19:06 +09:00
Hajime Hoshi
14c327c89b internal/atlas: replace Pixels with At to reduce unnecessary slice allocations 2022-03-20 18:39:17 +09:00
Hajime Hoshi
54b4e87506 internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.

Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
c3e855ab02 internal/buffered: refactoring 2022-03-20 16:44:11 +09:00
Hajime Hoshi
673556d03f internal/ui: move the error handlings to the ui package 2022-03-20 16:26:26 +09:00
Hajime Hoshi
cc574ad67e internal/atlas: rename functions: Area -> Region 2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239 internal/buffered: separate ReplacePixels with the large-area and small-area versions
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
e78f34aa26 internal/ui: add Image
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
Hajime Hoshi
86698481f6 ebiten: add a comment 2022-03-05 01:58:44 +09:00
Hajime Hoshi
4610505fc5 ebiten: check the current error at Set and ReplacePixels 2022-03-05 01:52:55 +09:00
Hajime Hoshi
9c6b7aaca3 internal/ui: catch the error at At correctly 2022-03-05 01:44:59 +09:00
divVerent
f2209a0b51
internal/atlas: optimization: send premultiplied alpha from vertex to fragment shader. (#1996)
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.

Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.

I assume this is a strict improvement, however this may warrant some testing.

Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.

Updates #1772
2022-02-24 02:27:50 +09:00
Hajime Hoshi
b282b1805b internal/ui: refactoring: add ui.SetError
This is a preparation to move uiContext to the package internal/ui.
2022-02-13 17:17:08 +09:00
Hajime Hoshi
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +09:00
Bertrand Jung
8a2965ba4a
ebiten: fixed a wrong function name mentioned in panic (#1953) 2022-01-13 03:33:59 +09:00
Hajime Hoshi
e687865c8c ebiten: add ColorM.ScaleWithColor
Updates #1944
2022-01-10 17:36:46 +09:00
Hajime Hoshi
5f942150e0 ebiten: update comments about DrawImage 2021-12-14 20:37:29 +09:00
Hajime Hoshi
9787e076bc ebiten: Add comments about NewImage*
Closes #1894
2021-12-09 21:03:25 +09:00
Hajime Hoshi
42cd923418 ebiten: Add FillRule
Closes #1715
2021-09-19 17:17:00 +09:00
Hajime Hoshi
ba8ea50d57 ebiten: Follow image.RGBA64Image's aim
image.RGBA64Image aims to get 64bit color values efficiently to avoid
allocating an original color value and converting it to colorRGBA64.
Thus, we should avoid allocating color.RGBA for RGBA64At.

Updates #1769
2021-08-21 15:22:38 +09:00
Trevor Slocum
92d8562b1d
ebiten: Add (*Image).RGBA64At (#1773)
Closes #1769.
2021-08-21 15:15:48 +09:00
Hajime Hoshi
21aa96f9f5 internal/affine: Refactoring: Make ColorM interface 2021-07-27 12:10:22 +09:00
Hajime Hoshi
b466a0cbd7 ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
66be53804d ebiten: Bug fix: Fill on a sub-image didn't work correctly
Closes #1691
2021-07-02 22:42:28 +09:00
Hajime Hoshi
d94a89f37b ebiten: Update the comments of (*Image).SubImage
Closes #1643
2021-05-13 21:23:17 +09:00
Hajime Hoshi
5c8d8ab2eb ebiten: Make NewImage/NewImageFromImage panic when RunGame finishes
Closes #1149
2021-04-03 18:44:43 +09:00
Hajime Hoshi
41f060b1d2 ebiten: Use the common vertices backend at DrawTriangles 2021-03-20 20:25:42 +09:00
Hajime Hoshi
26b9fa20c1 internal/graphics: Bug fix: Race condition at QuadVertices
QuadVertices or verticesBackend.slice reused its backend slice.
This caused a race condition. QuadVertices can be accessed from
multiple goroutines, and resetting the head and copying the data
at internal/graphicscommand might not be synced.

This change fixes this issue by basically reverting
9cb631e30f.

Closes #1546
2021-03-20 16:32:13 +09:00
Hajime Hoshi
b23dfff2ff ebiten: Refactoring 2021-01-31 22:45:47 +09:00
Hajime Hoshi
5a62587df5 ebiten: Bug fix: The vertex backend was not flushed when the screen is shrunk
The last parameter of QuadVertices represents whether we can flush
the backend vertices (on Wasm). The problem was that this was
unexpectedly false even though the image is the screen, when the
screen rendering is done with FilterLinear instead of FilterScreen.

Closes #1479
2021-01-31 22:37:18 +09:00
Hajime Hoshi
569964d7e4 Cache SubImage for the empty images 2021-01-25 01:31:18 +09:00
Hajime Hoshi
170ddd70a5 ebiten: Add comments 2020-11-08 04:12:48 +09:00
Hajime Hoshi
c7330883ef restorable: Remove Fill and make (*ebiten.Image).Fill available for sub-images
Now a scissor (a clipping region) can be specified, we don't have to
worry about the rendering results out of the specified region.
Replace the implmenetation of the Fill with just a DrawTriangles with
an empty white image.

As a side effect, SubImage is avilable for Fill.

Fixes #1416
2020-11-08 02:50:06 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
9464dc2f58 ebiten: Refactoring: canSkipMipmap 2020-10-31 02:59:48 +09:00
Hajime Hoshi
2259378430 ebiten: Panic immediately when zero size is given to NewImage(FromImage) 2020-10-23 00:42:57 +09:00
Hajime Hoshi
1b816eb249 ebiten: Remove the error returning value from NewImageFromImage
Updates #1380
2020-10-06 01:03:33 +09:00
Hajime Hoshi
c6053bcf14 ebiten: Remove the error returning value from NewImage
Updates #1380
2020-10-06 00:48:56 +09:00
Hajime Hoshi
54da0d9763 ebiten: Remove the returning value from (*Image).DrawImage
Updates #1380
2020-10-06 00:21:17 +09:00
Hajime Hoshi
04bbe1ebb6 ebiten: Remove the returning value from (*Image).ReplacePixels
Updates #1380
2020-10-06 00:16:18 +09:00
Hajime Hoshi
525d16bec8 ebiten: Remove the returning value from (*Image).Dispose
Updates #1380
2020-10-06 00:13:23 +09:00