Commit Graph

612 Commits

Author SHA1 Message Date
Hajime Hoshi
e237a70135 ebiten: refactoring: use struct{} to save memory 2022-10-31 23:58:41 +09:00
Hajime Hoshi
8919bc809a ebiten: refactoring: compile-time check 2022-10-31 23:36:07 +09:00
Hajime Hoshi
f04e391cb4 all: rename emptyImage -> whiteImage 2022-10-21 15:26:56 +09:00
Hajime Hoshi
418485801f ebiten: update comments 2022-10-21 13:42:52 +09:00
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