패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.5.2

flutter_gpu_shaders

Flutter GPU 색상 버블/라이브러리용 빌드 도구.

AndroidiOSLinuxmacOSWindows
30일 다운로드
10.9만
좋아요
21
Pub 점수
150

패키지 설치

flutter pub add flutter_gpu_shaders

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

GPU 색상 프로그램 패키지 및 라이브러리 생성과 관리를 위한 도구를 제공하는 플러터 패키지로, 고성능 3D 그래픽 렌더링을 가능하게 합니다. 안드로이드, iOS, 리눅스, 맥OS, 윈도우 등 다양한 플랫폼에서 플러터의 렌더링 파이프라인과의 통합을 지원합니다. 저수준 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.

순위