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

패키지 상세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 모델 파일을 렌더링할 수 있도록 해주는 플러터 패키지입니다. 안드로이드, iOS, macOS, Windows, 리눅스 등 여러 플랫폼을 지원하여 크로스플랫폼 3D 시각화에 이상적입니다. 플러터의 위젯 시스템과 원활하게 통합되어 개발자가 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 개

소스 저장소

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

아직 데이터가 없습니다.