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

パッケージ詳細v1.0.2+1

flutter_3d_objects

Wavefrontの3DオブジェクトファイルをレンダリングするFlutterパッケージプロジェクトです。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
2
いいね数
5
Pub ポイント
135

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

flutter pub add flutter_3d_objects

パッケージ概要

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

Flutterアプリケーション内でWavefront (.obj) 3Dモデルファイルのレンダリングを可能にするFlutterパッケージです。Android、iOS、macOS、Windows、Linuxなど複数のプラットフォームをサポートしており、クロスプラットフォームでの3D可視化に最適です。Flutterのウィジェットシステムとシームレスに統合されており、開発者がUIにインタラクティブな3Dオブジェクトを埋め込むことができます。製品プレビュー、教育ツール、拡張現実体験など、3Dアセットの表示が必要なアプリに特に役立ちます。

用途

  • 3D製品ビジュアライゼーション
  • 3Dモデルを搭載した教育アプリ
  • 拡張現実インターフェース
  • インタラクティブな3D UIコンポーネント
  • ゲーム開発プロトタイプ

主な機能

  • Wavefront .obj ファイルをサポートしています
  • クロスプラットフォーム互換性
  • Flutter ウィジェットとの統合
  • 軽量で使いやすい
  • リアルタイム3Dレンダリング

適している対象

  • 3D対応のFlutterアプリを開発する開発者
  • 教育ソフトウェアの作成者
  • プロダクトショーケースアプリケーション
  • AR/VRプロトタイピングチーム
  • UIデザイナーが3D要素を探索しています

注意事項

  • .obj ファイル形式に制限されています
  • 組み込みのアニメーションサポートなし
  • 3Dモデルの最適化が必要です
  • 低スペックデバイスへのパフォーマンスへの影響がある可能性があります
  • 標準ではテクスチャマッピングなし

元の README

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

[Flutter 3D Objects]

pub package style: effective dart License: MIT

This package allows Flutter developers to easily display 3D models in their applications. It supports the .obj file format and provides functionalities to manipulate the scene, including setting camera positions and adding objects with child objects.

Features:

  • Display 3D models from .obj files
  • Add and manipulate objects within the scene
  • Set camera positions to adjust the view
  • Support for hierarchical object structures

Setup

How to use this

  • Add dependency in pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
flutter_3d_objects:
  • Add 3D Models in assets, file type should be .obj
flutter:
assets:
  - assets/p.obj
  - assets/c.obj

Usage

void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Cube(
            onSceneCreated: (Scene scene) {
              scene.world.add(
                Object(
                  fileName: 'assets/c.obj',
                  position: Vector3(1, 1, 1),
                  scale: Vector3(1, 1, 1),
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}

Example

//Create a variable
late Scene _scene;
double x = 0;
double y = 3;
double z = 8;
late AnimationController _controller;
late Animation<double> _animation;
Object? _p;

// Create Function
void _onSceneCreated(Scene scene) {
   _scene = scene;
   scene.camera.position.z = z;
   scene.camera.position.y = y;
   scene.camera.position.x = x;
   _p = Object(
       position: Vector3(0, -2.5, 0),
       scale: Vector3(4, 4, 4),
       fileName: 'assets/p.obj',
       children: [
         Object(
           fileName: 'assets/c.obj',
           position: Vector3(0.25, 0.15, -0.24),
           scale: Vector3(0.8, 0.8, 0.8),
         ),
       ]);
   scene.world.add(_p!);
 }

//Function to rotate
void rotateLeft() {
   _animateRotation(90);
 }

 void rotateRight() {
   _animateRotation(-90);
 }

 void _animateRotation(double angle) {
   final double begin = _p!.rotation.y;
   final double end = _p!.rotation.y + angle;

   _animation = Tween<double>(begin: begin, end: end).animate(_controller)
     ..addListener(() {
       setState(() {
         _p!.rotation.y = _animation.value;
         _p!.updateTransform();
         _scene.update();
       });
     });

   _controller.forward(from: 0);
 }

// In main widget function
Scaffold(
     appBar: AppBar(
       title: const Text(''),
     ),
     body: Stack(
       children: [
         Cube(
           interactive: false,
           zoom: false,
           onSceneCreated: _onSceneCreated,
         ),
         Positioned(
           bottom: 10,
           left: 0,
           right: 0,
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceEvenly,
             children: [
               ElevatedButton(
                 onPressed: rotateLeft,
                 child: const Text('Left'),
               ),
               ElevatedButton(
                 onPressed: rotateRight,
                 child: const Text('Right'),
               ),
             ],
           ),
         ),
       ],
     ),
   );

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

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

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