effect/screeneffect
화면 효과. (씬 후처리 사슬)
- 원본 effect/screeneffect.js 를 옮긴 것이다. 효과 이름, 적용 차례, 기본 파라미터, 파라미터 이름, 기본 색, GLSL 본문은 원본 표를 그대로 옮겼다.
- 씬은 화면에 그대로 그리고, end() 에서 화면(또는 set_region 으로 정한 영역)을 떠 와 켜진 효과를 차례로 건 뒤 같은 자리에 되돌려 놓는다. 화면은 copyTexSubImage2D 로 RGB8 텍스처에 떠 오고, 효과는 핑퐁 / 절반 크기 프레임버퍼를 오가며 FullscreenPass 로 건다. 마지막 단계는 기본 프레임버퍼에 그린다.
- 영역은 캔버스 픽셀 좌표(왼쪽 위 원점)이며 둥근 모서리 반지름을 주면 그 바깥은 원본을 유지한다.
- 셰이더는 GLSL ES 3.00 이다. 데스크탑(GL 3.3 코어)은 ShaderProgram 이 머리만 #version 330 core 로 바꾸고, 웹(WebGL2)은 그대로 쓴다.
- 엔진은 고치지 않는다. 원본처럼 씬이 pre_draw 첫머리에서 begin, post_draw 끝에서 end, tick 에서 tick 을 부른다:
// 씬 load 에서
self.screen_effect = ScreenEffect::new();
self.screen_effect.set_enabled(ScreenEffectType::Vignette, true);
// pre_draw 처음 / post_draw 끝에서
self.screen_effect.begin(graphic); ... self.screen_effect.end(graphic);
// tick 에서
self.screen_effect.tick(time_delta);- 패스 셰이더 만들기에 실패하면 두 엔진 모두 한 번 알리고 그 단계를 건너뛴다. (한 효과 실패로 프레임이 멈추지 않는다)
- 원본과 다른 점:
- 원본은 생성자에서 Graphic 을 받아 GL 컨텍스트를 든다. 러스트 판은 아무것도 받지 않고 만들며, GL 자원은 처음 end 에서 만들고 함수마다 Graphic 을 받는다. 그때 GL 컨텍스트의 약한 손잡이를 쥐어, destroy() 는 원본처럼 인자 없이 풀고, 버려질 때(Drop, 씬을 내릴 때)도 스스로 푼다.
- 효과는 문자열 대신 ScreenEffectType 열거형이다. (원본 문자열 이름은 get_name / from_name)
Screen effect. (scene post-processing chain)
- Ported from the original effect/screeneffect.js. Effect names, apply order, default parameters, parameter names, default colors and GLSL bodies are copied from the original tables as they are.
- The scene is drawn to the screen as is, and end() copies the screen (or the area set with set_region), applies the enabled effects in order and puts it back in the same place. The screen is copied into an RGB8 texture with copyTexSubImage2D, and effects are applied with FullscreenPass going back and forth between ping-pong / half size framebuffers. The last step draws to the default framebuffer.
- The area is in canvas pixel coordinates (top left origin), and with a rounded corner radius the outside of it keeps the original.
- Shaders are GLSL ES 3.00. On desktop (GL 3.3 core) ShaderProgram changes only the header to #version 330 core, and the web (WebGL2) uses them as they are.
- The engine is not modified. Like the original, the scene calls begin at the start of pre_draw, end at the end of post_draw, and tick in tick:
// in the scene load
self.screen_effect = ScreenEffect::new();
self.screen_effect.set_enabled(ScreenEffectType::Vignette, true);
// at the start of pre_draw / at the end of post_draw
self.screen_effect.begin(graphic); ... self.screen_effect.end(graphic);
// in tick
self.screen_effect.tick(time_delta);- When building a pass shader fails, both engines report once and skip that step. (one failing effect does not stop the frame)
- Differences from the original:
- The original takes a Graphic in the constructor and holds the GL context. The Rust version is made taking nothing, makes GL resources at the first end, and each function takes a Graphic. At that time it holds a weak handle to the GL context, so destroy() releases without arguments like the original, and it also releases by itself when dropped (Drop, when the scene is unloaded).
- Effects are the ScreenEffectType enum instead of strings. (the original string names are get_name / from_name)
ScreenEffectRegionstruct traits Clone, Copy, Debug, PartialEq
적용 영역. (캔버스 픽셀, 왼쪽 위 원점)
Application area. (canvas pixels, top left origin)
use vanilla::{ScreenEffect, ScreenEffectRegion};
let mut screen_effect = ScreenEffect::new();
assert_eq!(screen_effect.get_region(), None);
screen_effect.set_region(40.0, 30.0, 320.0, 180.0, -5.0);
let expected_region = ScreenEffectRegion { x: 40.0, y: 30.0, width: 320.0, height: 180.0, corner_radius: 0.0 };
assert_eq!(screen_effect.get_region(), Some(expected_region));
screen_effect.clear_region();
assert!(screen_effect.get_region().is_none());영역 너비. (픽셀, 캔버스 밖으로 나가는 만큼은 잘린다)
Area width. (pixels, the part beyond the canvas is cut off)
반환Returnsf64
영역 높이. (픽셀, 캔버스 밖으로 나가는 만큼은 잘린다)
Area height. (pixels, the part beyond the canvas is cut off)
반환Returnsf64
둥근 모서리 반지름. (픽셀, 0 이면 사각형)
Rounded corner radius. (pixels, a rectangle if 0)
반환Returnsf64
ScreenEffectstruct traits TimelinePropertyTarget, Default, Drop
화면 효과.
- 효과마다 켜기, 세기, 파라미터 넷, 색을 든다. 씬이 pre_draw 첫머리에서 begin, post_draw 끝에서 end, tick 에서 tick 을 부르면 켜진 효과를 적용 차례로 건다.
Screen effect.
- Holds enabled, strength, four parameters and a color for each effect. When the scene calls begin at the start of pre_draw, end at the end of post_draw and tick in tick, the enabled effects are applied in application order.
use vanilla::{Color, ScreenEffect, ScreenEffectType};
let mut screen_effect = ScreenEffect::new();
assert!(!screen_effect.has_active_effect());
screen_effect.set_enabled(ScreenEffectType::Vignette, true);
screen_effect.set_strength(ScreenEffectType::Vignette, 0.8);
screen_effect.set_parameter(ScreenEffectType::Vignette, "outer", 0.9);
screen_effect.set_color(ScreenEffectType::Vignette, Color::create(0.0, 0.0, 0.2, 1.0));
assert!(screen_effect.has_active_effect());
assert_eq!(screen_effect.get_parameters(ScreenEffectType::Vignette), [0.45, 0.9, 0.0, 0.0]);
screen_effect.set_strength(ScreenEffectType::Vignette, 0.0);
assert!(!screen_effect.has_active_effect());
use vanilla::{Engine, EngineConfiguration, Graphic, Scene, SceneBase, ScreenEffect, ScreenEffectType};
struct MainScene {
scene_base: SceneBase,
screen_effect: ScreenEffect,
}
impl Scene for MainScene {
fn get_scene_base(&self) -> &SceneBase {
&self.scene_base
}
fn get_scene_base_mut(&mut self) -> &mut SceneBase {
&mut self.scene_base
}
fn load(&mut self, _engine: &Engine) {
self.screen_effect.set_enabled(ScreenEffectType::Vignette, true);
}
fn tick(&mut self, time_delta: f64) {
self.scene_base.tick(time_delta);
self.screen_effect.tick(time_delta);
}
fn pre_draw(&mut self, graphic: &mut Graphic) {
self.screen_effect.begin(graphic);
self.scene_base.draw_scene_background(graphic);
}
fn post_draw(&mut self, graphic: &mut Graphic) {
self.screen_effect.end(graphic);
}
}
let engine = Engine::new(EngineConfiguration::new());
let main_scene = MainScene {
scene_base: SceneBase::new(),
screen_effect: ScreenEffect::new(),
};
engine.run(Box::new(main_scene)).unwrap();생성. (GL 자원은 처음 end 에서 만든다)
Creates. (GL resources are made at the first end)
반환ReturnsScreenEffect 모든 효과가 꺼지고 세기 1, 효과별 기본 파라미터와 색인 화면 효과. (영역 없음, 시간 0)A screen effect with all effects off, strength 1, and each effect's default parameters and color. (no area, time 0)
짝Counterpart: vanilla.js ScreenEffect.constructor
적용 차례 반환. (정적)
Returns the apply order. (static)
반환ReturnsVec<ScreenEffectType> 적용 차례대로의 효과 58 개. (열거 선언 차례와 같다)The 58 effects in application order. (same as the enum declaration order)
짝Counterpart: vanilla.js ScreenEffect.getEffectOrder
전부 기본값으로. (끄고, 세기 1, 파라미터 / 색 기본. 모드 전환 때 이전 설정이 남지 않게)
Resets everything to defaults. (off, strength 1, default parameters / colors. So earlier settings do not linger when switching modes)
짝Counterpart: vanilla.js ScreenEffect.resetAll
적용 영역 설정. (캔버스 픽셀, 왼쪽 위 원점. corner_radius 는 둥근 모서리 반지름(픽셀), 0 이면 사각형)
Sets the application area. (canvas pixels, top left origin. corner_radius is the rounded corner radius (pixels), a rectangle if 0)
- xf64
- 영역 왼쪽. (캔버스 픽셀, end 에서 반올림하고 0 아래는 0)Left of the area. (canvas pixels, rounded in end, below 0 becomes 0)
- yf64
- 영역 위. (캔버스 픽셀)Top of the area. (canvas pixels)
- widthf64
- 영역 너비. (픽셀, 캔버스 밖은 잘린다)Area width. (pixels, cut off beyond the canvas)
- heightf64
- 영역 높이. (픽셀, 캔버스 밖은 잘린다)Area height. (pixels, cut off beyond the canvas)
- corner_radiusf64
- 둥근 모서리 반지름. (픽셀, 음수는 0, 그 바깥은 원래 화면을 둔다)Rounded corner radius. (pixels, negative becomes 0, the original screen is kept outside it)
짝Counterpart: vanilla.js ScreenEffect.setRegion
적용 영역 해제. (화면 전체)
Clears the region to apply to. (whole screen)
짝Counterpart: vanilla.js ScreenEffect.clearRegion
적용 영역 반환. (None 이면 화면 전체)
Returns the application area. (the whole screen if None)
반환ReturnsOption<ScreenEffectRegion> 정한 영역. 화면 전체면 None.The set area. None for the whole screen.
짝Counterpart: vanilla.js ScreenEffect.getRegion
갱신. (애니메이션 효과의 시간)
Update. (time for animated effects)
- time_deltaf64
- 지난 프레임에서 흐른 시간. (초, 효과 시간에 더한다)Time elapsed since the last frame. (seconds, added to the effect time)
짝Counterpart: vanilla.js ScreenEffect.tick
시작. (씬 pre_draw 첫머리. 씬은 화면에 그대로 그린다. 켜진 효과가 있을 때만 end 가 일한다)
Begins. (at the start of the scene's pre_draw. The scene draws straight to the screen. end only works when an effect is enabled)
- _graphic&mut Graphic
- 그래픽. (지금은 쓰지 않는다, end 와 짝을 맞춘 인자)Graphic. (not used now, an argument to pair with end)
짝Counterpart: vanilla.js ScreenEffect.begin
효과 적용. (씬 post_draw 끝. 화면의 영역을 떠 와 효과를 걸고 같은 자리에 되돌려 놓는다)
- begin 에서 켜진 효과가 없었으면 아무것도 하지 않는다. 렌더 대상과 패스는 처음 필요할 때 만든다.
Applies the effects. (at the end of the scene's post_draw. Copies the screen area, applies the effects and puts it back in the same place)
- Does nothing if no effect was enabled at begin. Render targets and passes are made the first time they are needed.
- graphic&mut Graphic
- 씬을 다 그린 그래픽. (묶음을 내보낸 뒤 그 화면을 떠 온다)Graphic that finished drawing the scene. (copies that screen after flushing the batch)
짝Counterpart: vanilla.js ScreenEffect.end
켜진 효과 여부. (세기 0 은 꺼진 것으로 본다)
Whether any effect is enabled. (strength 0 counts as off)
반환Returnsbool 켜져 있고 세기가 0 보다 큰 효과가 하나라도 있으면 true.true if at least one effect is enabled with a strength above 0.
짝Counterpart: vanilla.js ScreenEffect.hasActiveEffect
효과 켜기 / 끄기.
Turns an effect on / off.
- effect_typeScreenEffectType
- 효과.Effect.
- is_enabledbool
- 참이면 켠다.Enables it if true.
짝Counterpart: vanilla.js ScreenEffect.setEnabled
효과 켜짐 여부 반환.
Returns whether an effect is on.
- effect_typeScreenEffectType
- 효과.Effect.
반환Returnsbool 켜져 있으면 true. (세기는 보지 않는다)true if enabled. (strength is not checked)
짝Counterpart: vanilla.js ScreenEffect.isEnabled
세기 설정. (0 이면 꺼진 것과 같다)
Sets the strength. (0 is the same as off)
- effect_typeScreenEffectType
- 효과.Effect.
- strengthf64
- 세기. (보통 0 ~ 1, 0 이하면 걸지 않는다. 전환 효과는 덮인 정도, 기본 1)Strength. (usually 0 ~ 1, not applied if 0 or less. Coverage for transition effects, default 1)
짝Counterpart: vanilla.js ScreenEffect.setStrength
세기 반환.
Returns the strength.
- effect_typeScreenEffectType
- 효과.Effect.
반환Returnsf64 세기. (기본 1)Strength. (default 1)
짝Counterpart: vanilla.js ScreenEffect.getStrength
pub fn set_parameters(&mut self, effect_type: ScreenEffectType, x: f64, y: f64, z: f64, w: f64)#파라미터 설정. (효과마다 뜻이 다르다. ScreenEffectType 주석 참고, 원본의 y / z / w 기본값 0 은 직접 넘긴다)
Sets the parameters. (the meaning differs per effect. See the ScreenEffectType comments, pass the original's y / z / w default 0 explicitly)
- effect_typeScreenEffectType
- 효과.Effect.
- xf64
- 첫째 파라미터.First parameter.
- yf64
- 둘째 파라미터. (쓰지 않는 효과는 0)Second parameter. (0 for effects that do not use it)
- zf64
- 셋째 파라미터. (쓰지 않는 효과는 0)Third parameter. (0 for effects that do not use it)
- wf64
- 넷째 파라미터. (쓰지 않는 효과는 0)Fourth parameter. (0 for effects that do not use it)
짝Counterpart: vanilla.js ScreenEffect.setParameters
pub fn set_parameter(&mut self, effect_type: ScreenEffectType, parameter_name: &str, value: f64)#파라미터 하나 설정. (이름은 SCREEN_EFFECT_PARAMETER_NAMES)
Sets a single parameter. (names in SCREEN_EFFECT_PARAMETER_NAMES)
- effect_typeScreenEffectType
- 효과.Effect.
- parameter_name&str
- 파라미터 이름. (get_parameter_names 의 것, 모르는 이름이면 아무것도 하지 않는다)Parameter name. (one from get_parameter_names, does nothing for an unknown name)
- valuef64
- 값.Value.
짝Counterpart: vanilla.js ScreenEffect.setParameter
파라미터 반환.
Returns the parameters.
- effect_typeScreenEffectType
- 효과.Effect.
반환Returns[f64; 4] 파라미터 [x, y, z, w]. (reset_all 뒤에는 효과별 기본값)Parameters [x, y, z, w]. (each effect's defaults after reset_all)
짝Counterpart: vanilla.js ScreenEffect.getParameters
색 설정. (Color 또는 "#rrggbb" 같은 문자열)
Sets the color. (a Color or a string such as "#rrggbb")
- effect_typeScreenEffectType
- 효과.Effect.
- colorimpl Into<Color>
- 효과 색. (뜻은 효과마다 다르다. 가장자리 색, 빛 색, 전환이 덮을 색 같은 것)Effect color. (the meaning differs per effect, like an edge color, a light color, or the color a transition covers with)
짝Counterpart: vanilla.js ScreenEffect.setColor
색 반환.
Returns the color.
- effect_typeScreenEffectType
- 효과.Effect.
반환ReturnsColor 효과 색. (reset_all 뒤에는 효과별 기본 색, 기본 색이 없는 효과는 흰색)Effect color. (each effect's default color after reset_all, white for effects without a default color)
짝Counterpart: vanilla.js ScreenEffect.getColor
전부 끄기.
Turns everything off.
짝Counterpart: vanilla.js ScreenEffect.disableAll
타임라인 속성 적용. ("vignette" = 세기(0 이면 끔), "shockwave.radius" = 파라미터, "fade.color" = 색, "fade.enabled" = 켜기)
- 값은 원본처럼 숫자, 문자열, 참거짓(TimelineValue)이다. 숫자는 원본 Number() 처럼 읽고(참거짓은 1 / 0, 빈 문자열은 0, 못 읽으면 NaN), 색은 "#rrggbb" 문자열일 때만 바꾸고, 켜기는 true 또는 "true" 다.
Applies a timeline property. ("vignette" = strength (off if 0), "shockwave.radius" = parameter, "fade.color" = color, "fade.enabled" = enabled)
- Values are numbers, strings or booleans (TimelineValue) as in the original. Numbers are read like the original Number() (booleans are 1 / 0, an empty string is 0, NaN if unreadable), colors change only for "#rrggbb" strings, and enabled is true or "true".
- property_name&str
- "효과" 또는 "효과.멤버". (효과는 원본 이름, 멤버는 color, enabled, 파라미터 이름. 모르는 효과나 파라미터 이름은 무시한다)"effect" or "effect.member". (effect is the original name, member is color, enabled or a parameter name. Unknown effects or parameter names are ignored)
- value&TimelineValue
- 걸 값.Value to apply.
짝Counterpart: vanilla.js ScreenEffect.setTimelineProperty
use vanilla::{Color, ScreenEffect, ScreenEffectType, TimelineValue};
let mut screen_effect = ScreenEffect::new();
screen_effect.set_timeline_property("vignette", &TimelineValue::Number(0.5));
assert!(screen_effect.is_enabled(ScreenEffectType::Vignette));
assert_eq!(screen_effect.get_strength(ScreenEffectType::Vignette), 0.5);
screen_effect.set_timeline_property("shockwave.radius", &TimelineValue::Number(0.75));
assert_eq!(screen_effect.get_parameters(ScreenEffectType::Shockwave)[2], 0.75);
screen_effect.set_timeline_property("fade.color", &TimelineValue::String(String::from("#ff0000")));
screen_effect.set_timeline_property("fade.enabled", &TimelineValue::Boolean(true));
assert_eq!(screen_effect.get_color(ScreenEffectType::Fade), Color::create(1.0, 0.0, 0.0, 1.0));
assert!(screen_effect.is_enabled(ScreenEffectType::Fade));시간 반환.
Returns the time.
반환Returnsf64 효과 시간. (초, tick 으로 쌓인다)Effect time. (seconds, accumulated by tick)
짝Counterpart: vanilla.js ScreenEffect.getTime
씬 텍스처 반환. (end 이후, 마지막 프레임에 떠 온 영역 원본)
Returns the scene texture. (after end, the original of the region captured in the last frame)
반환ReturnsOption<GlTexture> 떠 온 영역의 원본 텍스처. end 가 렌더 대상을 만들기 전이거나 destroy 뒤면 None.Original texture of the copied area. None before end makes the render targets or after destroy.
짝Counterpart: vanilla.js ScreenEffect.getSceneTexture
파괴. (GL 자원 해제: 렌더 대상과 패스 프로그램, 원본 destroy)
- 버려질 때(Drop)도 스스로 부른다. 다시 end 를 부르면 자원을 새로 만든다.
- GL 컨텍스트가 이미 사라졌으면 그 자원도 같이 사라졌으므로 목록만 비운다.
Destroys. (releases GL resources: render targets and pass programs, the original destroy)
- Also called by itself when dropped (Drop). Calling end again makes the resources anew.
- If the GL context is already gone, those resources are gone with it, so it only empties the lists.
짝Counterpart: vanilla.js ScreenEffect.destroy
상수Constants
효과별 파라미터 이름. (타임라인 속성 "효과.이름" 으로 접근, 적용 차례)
Parameter names per effect. (accessed with the timeline property "effect.name", in application order)
반환Returns[(ScreenEffectType, &[&str]); 59]
짝Counterpart: vanilla.js SCREEN_EFFECT_PARAMETER_NAMES
ScreenEffectTypeenum traits Clone, Copy, Debug, PartialEq, Eq, Hash
화면 효과 종류. (선언 차례가 적용 차례다)
Screen effect type. (declaration order is application order)
| 이름Name | 설명Description |
|---|---|
LensDistortion | 배럴 / 핀쿠션 렌즈 왜곡. (parameters = [세기: 음수면 핀쿠션])Barrel / pincushion lens distortion. (parameters = [strength: negative for pincushion]) |
Bulge | 볼록 / 오목. (parameters = [중심 x, 중심 y, 세기, 반지름])Bulge / pinch. (parameters = [center x, center y, strength, radius]) |
Swirl | 소용돌이. (parameters = [중심 x, 중심 y, 회전 수, 반지름])Swirl. (parameters = [center x, center y, turn count, radius]) |
Kaleidoscope | 만화경. (parameters = [조각 수])Kaleidoscope. (parameters = [segment count]) |
Mirror | 대칭. (parameters = [0 가로 / 1 세로])Symmetry. (parameters = [0 horizontal / 1 vertical]) |
Ripple | 물 파문. (parameters = [중심 x, 중심 y, 빈도, 속도])Water ripple. (parameters = [center x, center y, frequency, speed]) |
HeatHaze | 아지랑이. (parameters = [노이즈 배율, 속도])Heat haze. (parameters = [noise scale, speed]) |
Jitter | 화면 흔들림. (parameters = [진폭 픽셀, 초당 변화])Screen shake. (parameters = [amplitude pixels, changes per second]) |
DoubleVision | 겹쳐 보임. (parameters = [간격, 흔들리는 속도])Double vision. (parameters = [spacing, sway speed]) |
Pixelate | 모자이크. (strength 0 → 1, parameters = [가장 큰 블록 픽셀])Mosaic. (strength 0 → 1, parameters = [largest block pixels]) |
Shockwave | 충격파 링 왜곡. (parameters = [중심 x, 중심 y, 반지름 0 ~ 1.5, 폭], color = 링 빛)Shockwave ring distortion. (parameters = [center x, center y, radius 0 ~ 1.5, width], color = ring light) |
Wave | 화면 물결. (parameters = [빈도, 속도])Screen wave. (parameters = [frequency, speed]) |
MotionBlur | 방향 블러. (parameters = [각도 라디안, 길이 픽셀])Directional blur. (parameters = [angle radians, length pixels]) |
ZoomBlur | 중심으로 뻗는 방사 블러. (parameters = [중심 x, 중심 y, 길이])Radial blur streaking toward the center. (parameters = [center x, center y, length]) |
Blur | 가우시안 블러. (parameters = [반지름 픽셀])Gaussian blur. (parameters = [radius pixels]) |
GaussianBlur | 표준편차 가우시안 블러. (parameters = [표준편차 픽셀], CSS filter: blur() 와 같은 뜻, 분리형 선형 샘플링, 3 시그마까지)Standard-deviation Gaussian blur. (parameters = [standard deviation in pixels], same meaning as CSS filter: blur(), separable linear sampling, up to 3 sigma) |
TiltShift | 틸트 시프트. (parameters = [초점 y, 초점 폭, 반지름 픽셀])Tilt-shift. (parameters = [focus y, focus width, radius pixels]) |
GodRays | 빛줄기. (parameters = [중심 x, 중심 y, 문턱, 감쇠], color = 빛 색)Light shafts. (parameters = [center x, center y, threshold, decay], color = light color) |
Bloom | 밝은 곳 번짐. (parameters = [문턱, 세기 배율, 반지름 픽셀])Bloom of bright areas. (parameters = [threshold, strength scale, radius pixels]) |
Anamorphic | 가로 렌즈 플레어. (parameters = [문턱, 세기 배율, 폭 픽셀], color = 플레어 색)Horizontal lens flare. (parameters = [threshold, strength scale, width pixels], color = flare color) |
Glitch | 가로 줄 어긋남 + 색 분리 + 블록 반전. (parameters = [줄 수, 초당 변화, 어긋남 폭])Horizontal line offset + color split + block inversion. (parameters = [line count, changes per second, offset width]) |
Vhs | VHS 테이프. (흔들림 + 색 번짐 + 노이즈 줄, parameters = [흔들림, 노이즈])VHS tape. (shake + color bleeding + noise lines, parameters = [shake, noise]) |
Chromatic | 색수차. (parameters = [배율])Chromatic aberration. (parameters = [scale]) |
WhiteBalance | 색온도 / 틴트. (parameters = [온도 -1 ~ 1, 틴트 -1 ~ 1])Color temperature / tint. (parameters = [temperature -1 ~ 1, tint -1 ~ 1]) |
LiftGammaGain | 리프트 / 감마 / 게인. (parameters = [리프트, 감마, 게인])Lift / gamma / gain. (parameters = [lift, gamma, gain]) |
ColorGrade | 대비 / 채도 / 밝기 + 틴트. (parameters = [대비, 채도, 밝기], color = 틴트)Contrast / saturation / brightness + tint. (parameters = [contrast, saturation, brightness], color = tint) |
HueShift | 색상 회전. (parameters = [회전 수: strength 와 곱])Hue rotation. (parameters = [turn count: multiplied by strength]) |
SplitToning | 스플릿 토닝. (parameters.xyz = 그림자 색, color = 하이라이트 색, w = 균형)Split toning. (parameters.xyz = shadow color, color = highlight color, w = balance) |
Tonemap | ACES 톤매핑. (parameters = [노출])ACES tone mapping. (parameters = [exposure]) |
GradientMap | 밝기를 두 색 사이로 매핑. (parameters.xyz = 어두운 색, color = 밝은 색)Maps brightness between two colors. (parameters.xyz = dark color, color = bright color) |
Sepia | 세피아.Sepia. |
Grayscale | 무채색.Grayscale. |
Posterize | 포스터화. (parameters = [단계 수])Posterize. (parameters = [step count]) |
Dither | 오더드 디더링. (parameters = [단계 수, 픽셀 크기])Ordered dithering. (parameters = [step count, pixel size]) |
Halftone | 하프톤 점. (parameters = [격자 픽셀])Halftone dots. (parameters = [grid pixels]) |
Sharpen | 샤픈.Sharpen. |
EdgeDetect | 윤곽 검출. (color = 선 색)Edge detection. (color = line color) |
OldFilm | 낡은 필름. (세피아 + 그레인 + 스크래치 + 깜빡임)Old film. (sepia + grain + scratches + flicker) |
NightVision | 야시경. (color = 틴트)Night vision. (color = tint) |
Invert | 색 반전.Color inversion. |
Scanline | CRT 곡면 + 주사선 + RGB 마스크. (parameters = [곡률, 주사선 밀도])CRT curvature + scanlines + RGB mask. (parameters = [curvature, scanline density]) |
Grain | 필름 그레인.Film grain. |
Rain | 빗줄기. (parameters = [줄 수, 밀도, 속도], color = 빗줄기 색)Rain streaks. (parameters = [line count, density, speed], color = streak color) |
Fog | 세로 안개. (parameters = [시작 y, 끝 y], color = 안개 색)Vertical fog. (parameters = [start y, end y], color = fog color) |
Vignette | 비네트. (parameters = [시작 거리, 끝 거리], color = 가장자리 색)Vignette. (parameters = [start distance, end distance], color = edge color) |
Spotlight | 스포트라이트 바깥 어둡힘. (parameters = [중심 x, 중심 y, 반지름, 부드러움], color = 바깥 색)Darkening outside a spotlight. (parameters = [center x, center y, radius, softness], color = outside color) |
SpeedLines | 집중선. (parameters = [중심 x, 중심 y, 밀도, 속도], color = 선 색)Focus lines. (parameters = [center x, center y, density, speed], color = line color) |
Letterbox | 위아래 / 좌우 검은 띠. (parameters = [세로 띠 비율, 가로 띠 비율], color = 띠 색)Black bars at top and bottom / left and right. (parameters = [vertical bar ratio, horizontal bar ratio], color = bar color) |
PixelDissolve | 블록 디졸브. (parameters = [블록 수])Block dissolve. (parameters = [block count]) |
Wipe | 방향 와이프. (parameters = [방향 x, 방향 y, 부드러움])Directional wipe. (parameters = [direction x, direction y, softness]) |
IrisWipe | 원형 아이리스. (parameters = [중심 x, 중심 y, 부드러움])Circular iris. (parameters = [center x, center y, softness]) |
DiamondWipe | 마름모 와이프. (parameters = [부드러움])Diamond wipe. (parameters = [softness]) |
ClockWipe | 시계 와이프. (parameters = [부드러움])Clock wipe. (parameters = [softness]) |
Blinds | 블라인드. (parameters = [줄 수, 부드러움])Blinds. (parameters = [line count, softness]) |
CheckerWipe | 체커 보드. (parameters = [칸 수])Checkerboard. (parameters = [cell count]) |
NoiseFade | 노이즈 페이드. (parameters = [노이즈 배율, 부드러움])Noise fade. (parameters = [noise scale, softness]) |
Burn | 불에 타듯. (parameters = [노이즈 배율, 띠 폭], color = 덮을 색, 띠는 주황)As if burning. (parameters = [noise scale, band width], color = cover color, the band is orange) |
TvOff | 브라운관 끄기. (세로로 눌리며 밝은 선으로)CRT turn-off. (squashes vertically into a bright line) |
Fade | 단색으로 페이드. (color = 목표 색)Fade to a solid color. (color = target color) |
원본 이름으로 찾기. (모르는 이름이면 None)
Finds by the original name. (None for an unknown name)
- name&str
- 원본 효과 이름. (대소문자를 가린다)Original effect name. (case-sensitive)
반환ReturnsOption<ScreenEffectType> 그 이름의 효과. 모르는 이름이면 None.The effect with that name. None for an unknown name.
use vanilla::ScreenEffectType;
assert_eq!(ScreenEffectType::from_name("shockwave"), Some(ScreenEffectType::Shockwave));
assert_eq!(ScreenEffectType::Shockwave.get_name(), "shockwave");
assert_eq!(ScreenEffectType::Shockwave.get_parameter_names(), &["centerX", "centerY", "radius", "width"]);
assert!(ScreenEffectType::Sepia.get_parameter_names().is_empty());
assert_eq!(ScreenEffectType::from_name("unknown"), None);원본 이름 반환. ("vignette" 같은 문자열)
Returns the original name. (a string like "vignette")
반환Returns&'static str 원본 효과 이름. (camelCase, "lensDistortion" 같은)Original effect name. (camelCase, like "lensDistortion")
파라미터 이름 목록 반환. (SCREEN_EFFECT_PARAMETER_NAMES)
Returns the list of parameter names. (SCREEN_EFFECT_PARAMETER_NAMES)
반환Returns&'static [&'static str] 파라미터 x, y, z, w 차례의 이름 목록. (0 ~ 4 개, 파라미터가 없는 효과는 빈 목록)List of names in parameter x, y, z, w order. (0 ~ 4 of them, an empty list for effects without parameters)