Hajime Hoshi
9ec23ddeb4
ebiten: add DrawTrianglesOptions.AntiAlias
and DrawTrianglesShaderOptions.AntiAlias
...
Closes #2385
2022-10-21 02:07:41 +09:00
Hajime Hoshi
b79495761e
ebiten: add Blend and deprecate CompositeMode
...
Updates #2382
2022-10-16 22:47:00 +09:00
Hajime Hoshi
2855095ac9
all: unify terms for buffers and flushing
2022-10-16 19:47:00 +09:00
Hajime Hoshi
09a7d39874
internal/graphicsdriver: add Blend struct
...
This is a preparation to specify blend factors and blend operators.
Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
30cc36b1ba
ebiten: add FinalScreenDrawer
...
FinalScreenDrawer is an interface for a custom screen rendering. If a
game implements FinalScreenDrawer and is passed to RunGame, its
DrawFinalScreen is called after Draw.
Also this adds `-crt` option to examples/flappy.
Closes #2046
2022-10-14 16:49:32 +09:00
Hajime Hoshi
940d6b11c8
ebiten: add comments about SubImage as destinations
...
Updates #2232
2022-10-03 01:56:20 +09:00
Hajime Hoshi
dcc98e78e9
ebiten: remove unnecessary casts
2022-10-03 01:25:24 +09:00
Hajime Hoshi
534d82c17d
internal/builtinshader: move Filter and Address from internal/graphicsdriver
2022-10-02 23:24:15 +09:00
Hajime Hoshi
efd91c8b86
internal/ui: remove unused arguments from DrawTriangles
...
Closes #2369
2022-10-02 23:10:27 +09:00
Hajime Hoshi
d4e7676daa
ebiten: do not use mipmaps at DrawTrianglesShader
...
This change stops using mipmaps at DrawTrianglesShader. Though this
is a brekaing change, the shader APIs are experimental in v2.4, and
the extent of the impact should be pretty small as DrawTrianglesShader
is a rarely-used low-level API.
For DrawRectShader, mipmaps were not used even before this change.
Updates #2370
2022-10-02 20:22:59 +09:00
Hajime Hoshi
72004b2e23
ebiten: update comments about Vertex
...
Updates #2365
2022-10-02 19:35:19 +09:00
Hajime Hoshi
f293a03ab6
internal/mipmap: reland: do not consider filter to determine mipmap level
...
This is a reland of 42833614fb
.
Now the filter argument is not used (a4e9a05b14
),
the filter value can be the nearest filter even though the shader is
for the linear filter.
As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.
Updates #2364
2022-10-02 19:14:23 +09:00
Hajime Hoshi
4b087a3af4
ebiten: bug fix: examples/minify didn't work correctly
...
Updates #2369
2022-10-02 19:04:52 +09:00
Hajime Hoshi
d08c1dbf8d
ebiten: add a type name
2022-10-02 17:37:27 +09:00
Hajime Hoshi
a4e9a05b14
ebiten: reland: use Kage shaders instead of built-in shaders for a color matrix
...
This replaces the built-in shaders with Kage shadres. This is a
refactoring and doesn't degrade performance:
```
go test -bench=^BenchmarkColorMScale$ -run=^$ . -count=5
```
```
name old time/op new time/op delta
ColorMScale-8 978ns ±15% 1184ns ±46% ~ (p=0.413 n=4+5)
```
A follow-up change to remove the built-in shaders is needed.
Closes #2364
2022-10-02 15:35:40 +09:00
Hajime Hoshi
058b8d5635
ebiten: add ColorScaleFormat to DrawTrianglesOptions
...
Closes #2365
2022-10-02 14:14:11 +09:00
Hajime Hoshi
5e459bbe42
internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
...
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
fb6dffaf12
ebiten: remove a wrong comment
2022-10-02 00:21:35 +09:00
Hajime Hoshi
520c47f0e8
Revert "ebiten: use Kage shaders instead of built-in shaders for a color matrix"
...
This reverts commit 7fc79c50c3
.
Reason: a color scale might be used with ColorM (DrawTriangles)
Updates #2364
2022-10-02 00:19:37 +09:00
Hajime Hoshi
7fc79c50c3
ebiten: use Kage shaders instead of built-in shaders for a color matrix
...
Closes #2364
2022-10-02 00:08:14 +09:00
Hajime Hoshi
9d06875243
ebiten: remove 'experimental' from the shader APIs
...
Now the Kage shaders are used for the screen and will be used for ColorM.
Updatse #2046
Updates #2171
2022-09-30 22:45:26 +09:00
Hajime Hoshi
1f70307582
ebiten: add DrawRectShaderOptions.ColorScale
...
This change also introduces a new struct ColorScale.
Closes #2361
2022-09-30 21:44:48 +09:00
Hajime Hoshi
d00bd1cb16
internal/ui: refactoring: move setVerticesCache
to ui.Image
...
Updates #2362
2022-09-29 01:21:46 +09:00
Alexander F. Rødseth
0d2c8b59fc
ebiten: reorder fields as recommended by the fieldalignment utility ( #2359 )
...
This reduces the struct size from 64 to 32 bytes.
2022-09-28 18:11:08 +09:00
Hajime Hoshi
284c9fcc7f
update URLs in comments
2022-09-23 19:09:25 +09:00
Hajime Hoshi
d9704f2ba9
ebiten: typo
2022-08-21 23:01:25 +09:00
Hajime Hoshi
ef7966b625
ebiten: typo
2022-08-21 21:58:10 +09:00
Hajime Hoshi
f923250a65
ebiten: typo
2022-08-21 20:02:53 +09:00
Hajime Hoshi
652cd169b2
ebiten: revert the changes for DrawRectShader
...
This reverts these commits:
- 9bd46cb2b5
.
- f8c4634017
.
This causes test failures on the Steam bot. See #2246 .
Updates #2166
Closes #2246
2022-08-17 00:56:33 +09:00
Hajime Hoshi
f8c4634017
ebiten: always specify the source region at DrawRectShader
...
imageSrcRegionOnTexture should work even without any images.
Updates #2166
2022-08-16 22:43:33 +09:00
Hajime Hoshi
0217ed0544
ebiten: add WritePixels replacing ReplacePixels
...
Closes #2236
2022-08-08 03:50:27 +09:00
Hajime Hoshi
24424d036c
ebiten: update comments
2022-08-08 03:42:14 +09:00
Hajime Hoshi
34aa52459e
internal/ui: rename ReplacePixels -> WritePixels
...
Updates #2236
2022-08-08 03:32:26 +09:00
Hajime Hoshi
ea04e2a9de
ebiten: remove returning error from ReadPixels
...
- As ReadPixels should often be used at Draw, error handling would be hard.
- Make the API consistent with ReplacePixels.
Updates #1995
2022-08-08 02:48:25 +09:00
Hajime Hoshi
39790c257b
ebiten: update comments
2022-08-08 01:59:09 +09:00
Hajime Hoshi
81bd5b488c
ebiten: add (*Image).ReadPixels
...
Closes #1995
2022-08-08 01:42:26 +09:00
Hajime Hoshi
6d87be7169
internal/ui, internal/mipmap: refactoring: replace At with ReadPixels
...
Updates #1995
2022-08-06 00:32:42 +09:00
mattn
3cd0daac67
go generate ./... with Go 1.19 ( #2228 )
2022-08-03 20:48:02 +09:00
Hajime Hoshi
1daf3bd8ff
ebiten: update comments
2022-07-13 02:26:30 +09:00
Hajime Hoshi
afed6a83c6
internal/graphics: change the naming convention: Num -> Count
...
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
80c26e6dcc
ebiten: bug fix: Set after Set resulted in a wrong color
...
Updates #2154
Updates #2176
2022-07-05 01:13:45 +09:00
Hajime Hoshi
66bf40dc84
ebiten: bug fix: resolveSetVerticesCacheIfNeeded could resolve more vertices
...
Closes #2178
2022-07-05 00:28:53 +09:00
Hajime Hoshi
5411e8136b
ebiten: bug fix: use DrawTriangles as an implementation of Set
...
Closes #2154
2022-07-04 12:02:47 +09:00
Hajime Hoshi
ddced3af9f
ebiten: bug fix: Fill and Clear doesn't work on an image whose upper-left is not (0, 0)
...
Closes #2159
2022-06-24 02:02:00 +09:00
Hajime Hoshi
acd70d6e34
ebiten: add NewImageFromImageWithOptions
...
Closes #2013
Closes #2017
Closes #2124
2022-06-15 14:19:16 +09:00
Hajime Hoshi
aee2e67242
ebiten: refactoring
2022-06-15 11:54:49 +09:00
Hajime Hoshi
922784f574
ebiten: English
2022-06-15 02:34:31 +09:00
Hajime Hoshi
654c4c286c
ebiten: English
2022-06-15 02:27:24 +09:00
Hajime Hoshi
0f27999909
ebiten: bug fix: wrong comments
...
Updates #2013
Updates #2017
2022-06-15 02:24:03 +09:00
Hajime Hoshi
bac34a4474
ebiten: add NewImageWithOptions and NewImageOptions
...
This change adds NewImageWithOptions, that creates a new image with
the given options.
NewImageWithOptions takes image.Rectangle instead of a width and a
height, then a user can create an image with an arbitrary bounds.
A left-upper position can be a negative number.
NewImageWithOptions can create an unmanged image, that is no longer
on an automatic internal texture atlas. A user can have finer controls
over the image.
This change also adds tests for this function.
Updates #2013
Updates #2017
Updates #2124
2022-06-15 02:20:19 +09:00
Hajime Hoshi
81f91658ff
internal/atlas: refactoring: remove SetVolatile and SetIsolate
...
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
c379873a1f
rename Ebiten -> Ebitengine
2022-05-25 22:48:19 +09:00
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