本文へスキップ

Shader

検証済みの WGSL を、数を制限した数値シェーダーパラメーターで描画します。

デモを読み込み中…

#インポート

quickgui から CustomShader をインポートします。

use quickgui::*;

#使い方

custom_shader(
    CustomShader::new(
        "fn quickgui_fragment(input: QuickGuiShaderInput) -> vec4<f32> { return vec4<f32>(input.uv.x, 0.3, input.uv.y, 1.0); }",
    )
    .expect("shader"),
)
.size(260.0, 150.0)

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

CustomShader

ソースを見る
pub fn new(source: impl AsRef<str>) -> Result<Self, CustomShaderError>
source_bytespub fn source_bytes(&self) -> usize—

Configures source bytes for this part.

pub fn source_bytes(&self) -> usize
ソースを見る

custom_shader

ソースを見る
pub fn custom_shader(shader: impl Into<CustomShader>) -> Element

Create a retained rectangle painted by validated application WGSL. Like the web canvas default, its initial size is 300 by 150 logical pixels. The shader remains still until application state invalidates the view or explicitly requests another frame.