Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Effects extension #210

Merged
merged 8 commits into from
Mar 6, 2023
Merged

Conversation

Xeltalliv
Copy link
Contributor

@Xeltalliv Xeltalliv commented Feb 27, 2023

image

Example of using those blocks:
image

Adds 2 effects:

  • Clipping, which only shows parts of sprite inside of the clipping area.
  • Additive blending

Those effects are cleared after stopping the project. They affect stamps, but don't affect pen. Touching blocks work as if those effects don't exist. They are disabled for stage.

@True-Fantom
Copy link
Contributor

It might need a better name.

Perhaps just "effects" would have been better. Or "shaders"

@True-Fantom
Copy link
Contributor

It may be worth adding these blocks:

  • (clipping box x1)
  • (clipping box y1)
  • (clipping box x2)
  • (clipping box y2)
  • <additive blending on?>

@True-Fantom
Copy link
Contributor

True-Fantom commented Feb 28, 2023

finished images (#204)
91
92

@Xeltalliv Xeltalliv changed the title Add Effects+ extension Add Effects extension Mar 1, 2023
@True-Fantom
Copy link
Contributor

@Xeltalliv By the way, maybe add #177 effects in the future?

@Xeltalliv
Copy link
Contributor Author

@Xeltalliv By the way, maybe add #177 effects in the future?

In terms of code, it makes more sense to make that a separate extension. I might eventually make it. Or someone else might make it. And for this reason, calling this extension "Effects" may be slightly problematic.

@True-Fantom
Copy link
Contributor

True-Fantom commented Mar 1, 2023

@Xeltalliv Well, in fact, all these are the effects of displaying sprites. It would not be very convenient to divide them into "Color effects" and "Something effects"

Perhaps "Render" is good alternative

@True-Fantom
Copy link
Contributor

True-Fantom commented Mar 1, 2023

@Xeltalliv I edited the code a bit:

  • added icon
  • renamed class from Extension to Effects
  • replaced (function(Scratch) { with (Scratch => {
  • moved width and height to beginning of menu
  • renamed min x, min y, max x and max y to x1, y1, x2 and y2 for convenience
  • removed unnecessary empty lines
  • add some empty lines

Here is it

@Xeltalliv
Copy link
Contributor Author

Perhaps "Render" is good alternative

I don't think that's a better name. I think I'll keep it named "Effects".

(Also, there's no need to mention me. I made this PR, so I'm automatically subscribed to all activity in it. I'm also Watching this repository, so I actually get notified about everything)

@True-Fantom
Copy link
Contributor

True-Fantom commented Mar 1, 2023

Also, there's no need to mention me

Ok

I changed name back and once again modified code

@True-Fantom
Copy link
Contributor

Do you agree with changes?

@Xeltalliv
Copy link
Contributor Author

Xeltalliv commented Mar 1, 2023

Do you agree with changes?

  • added icon
  • moved width and height to beginning of menu

Yes

  • renamed class from Extension to Effects

Keeping class named just Extension allows changing name of the extension more easily. I've recently switched to doing that in every new extension I make.

  • renamed min x, min y, max x and max y to x1, y1, x2 and y2 for convenience

There is a reason why it was called that way.
People might not expect this:
image
But this is immediately clear:
image

  • replaced (function(Scratch) { with (Scratch => {
  • removed unnecessary empty lines
  • add some empty lines

It was formatted in the way I prefer. Double/more empty lines are used to more visibly separate distinct sections of code. Trailing commas in "blocks" and "menus" were also intentional.

@TheShovel
Copy link
Contributor

Maybe rename this extension to Clipping if you are not planning on adding other effects.

@True-Fantom
Copy link
Contributor

Okay)

I asked and offered everything I wanted. You made excellent extension! Good luck in the future)

@Xeltalliv
Copy link
Contributor Author

Xeltalliv commented Mar 5, 2023

Note to GarboMuffin: this extension modifies gl state, but doesn't fully restore it at the end. Despite that it seems to work. I'm not sure if it's better to keep it as is, or make it intercept, save and then restore everything which will add extra overhead, but potentially improve compatibility.

@GarboMuffin
Copy link
Member

This seems like another case where a documentation page could be beneficial

I'll fix the merge conflicts and merge this in a bit, such a documentation page can be added later if you want to

@WojtekCodesToday
Copy link

ok

@GarboMuffin GarboMuffin merged commit 72f732e into TurboWarp:master Mar 6, 2023
@Xeltalliv Xeltalliv deleted the clipping-and-blending branch March 8, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants