パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.5.2

flutter_gpu_shaders

Flutter GPU シェーダー バンドル/ライブラリ用のビルドツール。

AndroidiOSLinuxmacOSWindows
30日間ダウンロード
10.9万
いいね数
21
Pub ポイント
150

パッケージをインストール

flutter pub add flutter_gpu_shaders

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

GPUシェーダーパッケージおよびライブラリの作成と管理に使用できるツールを提供するFlutterパッケージで、高パフォーマンスな3Dグラフィックスレンダリングを可能にします。Android、iOS、Linux、macOS、Windowsなど複数プラットフォームでFlutterのレンダリングパイプラインとの統合をサポートしています。低レベルのGPU制御が必要な複雑なビジュアルエフェクト、ゲーム、またはデータ可視化アプリケーションを開発する開発者向けに設計されています。効率的なシェーダーのバンドル化により、開発ワークフローを簡素化し、最適化されたシェーダー実行によってパフォーマンスを向上させます。

用途

  • 3Dゲーム開発
  • リアルタイムデータの可視化
  • 複雑なUIアニメーション
  • 高パフォーマンスなグラフィックスレンダリング
  • シェーダーに基づくビジュアルエフェクト

主な機能

  • クロスプラットフォームGPUシェーダー対応
  • 効率的なシェーダー パッケージ管理
  • Flutter のレンダリングパイプラインとの統合
  • 3Dコンテンツ向けのパフォーマンス最適化
  • シェーダーのコンパイルおよびパッケージング用ツール

適している対象

  • 3Dアプリケーション開発に従事する開発者
  • Flutterにおけるゲームエンジン作成者
  • ビジュアルエフェクト専門家
  • 高パフォーマンスUIデザイナー
  • グラフィックス集約型アプリビルダー

注意事項

  • GLSL や HLSL の知識が必要です
  • GPUアクセラレーテッドレンダリングに限定
  • ビルドの複雑さを増加させる可能性があります
  • 上級者向けに最適
  • プラットフォーム固有のシェーダー動作は異なる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Build tools for Flutter GPU shader bundles/libraries.

Features

Use native asset build hooks to import Flutter GPU shader bundle assets.

Getting started

  1. Place some Flutter GPU shaders in your project. For this example, we'll assume the existence of two shaders: shaders/my_cool_shader.vert and shaders/my_cool_shader.frag.
  2. Create a shader bundle manifest file in your project. The filename must end with .shaderbundle.json. For this example, we'll assume the following file is saved as my_cool_bundle.shaderbundle.json:
    {
        "CoolVertex": {
            "type": "vertex",
            "file": "shaders/my_cool_shader.vert"
        },
        "CoolFragment": {
            "type": "fragment",
            "file": "shaders/my_cool_shader.frag"
        }
    }
    
  3. Next, define a build hook in your project that builds the shader bundle using buildShaderBundleJson. The build hook must be named hook/build.dart in your project; this script will be automatically invoked by Flutter:
    import 'package:hooks/hooks.dart';
    import 'package:flutter_gpu_shaders/build.dart';
    
    void main(List<String> args) async {
      await build(args, (config, output) async {
        await buildShaderBundleJson(
            buildInput: config,
            buildOutput: output,
            manifestFileName: 'my_cool_bundle.shaderbundle.json');
      });
    }
    
    buildShaderBundleJson always declares the manifest and directly listed shader files as build dependencies. With Flutter SDKs whose impellerc supports --depfile for shader bundles, it also declares transitive #include dependencies from the generated depfile. Older impellerc builds continue to use the manifest scan fallback.
  4. In your project's pubspec.yaml, add the built shader bundle as an asset:
    flutter:
      assets:
        - build/shaderbundles/my_cool_bundle.shaderbundle
    
  5. If your Flutter toolchain supports Dart DataAssets, you can opt in to registering the generated bundle with the Flutter asset bundle instead of listing it in pubspec.yaml:
    await buildShaderBundleJson(
      buildInput: config,
      buildOutput: output,
      manifestFileName: 'my_cool_bundle.shaderbundle.json',
      assetMode: ShaderBundleAssetMode.dataAssetsIfAvailable,
    );
    
    With DataAssets enabled, the result's flutterAssetKey is the key to pass to gpu.ShaderLibrary.fromAsset. When DataAssets are unavailable, dataAssetsIfAvailable falls back to the legacy file output. Use ShaderBundleAssetMode.dataAssetsRequired to fail fast with guidance instead.
  6. You can now import the built shader bundle as a library using gpu.ShaderLibrary.fromAsset in your project. For example:
    import 'package:flutter_gpu/gpu.dart' as gpu;
    
    final String _kBaseShaderBundlePath =
        'build/shaderbundles/my_cool_bundle.shaderbundle';
    
    gpu.ShaderLibrary? _baseShaderLibrary;
    gpu.ShaderLibrary get baseShaderLibrary {
      if (_baseShaderLibrary != null) {
        return _baseShaderLibrary!;
      }
      _baseShaderLibrary = gpu.ShaderLibrary.fromAsset(_kBaseShaderBundlePath);
      if (_baseShaderLibrary != null) {
        return _baseShaderLibrary!;
      }
    
      throw Exception(
          "Failed to load base shader bundle! ($_kBaseShaderBundlePath)");
    }
    

カテゴリー

依存関係

依存関係一覧 4 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。

ランキング