A Flutter 3D widget that renders Wavefront's object files.

Overview

Flutter Cube

pub package

A Flutter 3D widget that renders Wavefront's object files.

Getting Started

Add flutter_cube as a dependency in your pubspec.yaml file.

dependencies:
  flutter_cube: ^0.1.0

Add Wavefront's object files to assets.

flutter:
  assets:
    - assets/cube/cube.obj
    - assets/cube/cube.mtl
    - assets/cube/flutter.png

Import and add the Cube widget to your project.

import 'package:flutter_cube/flutter_cube.dart';
... ...
  
@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Cube(
          onSceneCreated: (Scene scene) {
            scene.world.add(Object(fileName: 'assets/cube/cube.obj'));
          },
        ),
      ),
    );
  }

Screenshot

screenshot screenshot screenshot

Comments
  • Scene lighting support?

    Scene lighting support?

    Are there any plans to release a new version of the library to pub.dev with lighting support available?

    I would like to use it in my project but the latest published package version (0.0.5) does not include it yet, though it is in the master branch of the repository.

    opened by IgnaceMaes 2
  • Support for non-texture obj

    Support for non-texture obj

    opened by thienvu18 2
  • how to load in mtl,texture from local storage/sdcard

    how to load in mtl,texture from local storage/sdcard

    Hi all, i am able to render the obj and its texture/mtl from assets. Currently i am trying to render the 3d object from local storage instead, however when i add: obj = cube3d.Object( fileName: '/storage/emulated/0/Download/testfolder/texturedMesh.obj', isAsset: false); using isAsset as false, i am only able to get the mesh of the object with not texture.

    I am confused with how to use loadMtl, loadTexture to load the texture on top of the mesh. Any help will be great! :)

    opened by tangzt0415 1
  • how to change 3d object in this widget?

    how to change 3d object in this widget?

    Hi ! Thank you for amazing plugin. how i can change obj file in cube widget when showing model ? i think method setState can not working in this widget.

    opened by ebrahimimasod 1
  • how to explicit mtl file ?

    how to explicit mtl file ?

    hello a simple question i suppose..

    i have 3 assets:

    • test.obj
    • test.mtl
    • texture_map.png

    i create

      _test = Object(
            name: 'test',
            scale: Vector3(10.0, 10.0, 10.0),
            backfaceCulling: true,
            fileName: 'assets/test/test.obj');
        _scene.world.add(_test!);
        _scene.updateTexture();
    

    only the 3D object appear. not the texture. Could you help me ? thx

    opened by redDwarf03 0
  • negative vertex problem solved

    negative vertex problem solved

    If you want to display an obj file containing a negative vertex, you may get an error. To fix this error, it is necessary to make the following changes in "lib/src/mesh.dart" file.

    opened by wolcy97 0
  • texture not visible on my 3d object.

    texture not visible on my 3d object.

    Hi, I am facing an issue when rendering the 3d Object.

    this is my mask image.

    image

    my asset folder structure image

    this is my code

    Cube(
        onSceneCreated: (Scene scene) {
          scene.world.add(
            Object(
              fileName: 'assets/shoe.obj',
              scale: Vector3.all(5),
              lighting: true,
            ),
          );
        },
      )
    

    my mtl file

    Material Count: 1

    newmtl Material
    	Ns 323.999994
    	Ka 1.000000 1.000000 1.000000
    	Kd 0.800000 0.800000 0.800000
    	Ks 0.500000 0.500000 0.500000
    	Ke 0.0 0.0 0.0
    	Ni 1.450000
    	d 1.000000
    	illum 2
    	map_Kd diffuse.png
    

    any solution to this?

    opened by nehal076 4
  • How to save .obj file from composed scene/how to get list of verticies?

    How to save .obj file from composed scene/how to get list of verticies?

    I'm composing a scene with a few .obj files and I'm wondering how to store it. The first thing on which I looked was the list of vertices - and I can't get it from the library. It would seem that it should be accessible from scene.world.mesh.vertices, but it's empty.

    opened by danPyk 0
  • Error: RangeError (index): Index out of range: index should be less than 6291456: 6291456

    Error: RangeError (index): Index out of range: index should be less than 6291456: 6291456

    Hello thanks for this great package!

    I've cloned your project and run the planet example on WEB (chrome) and get this error :

    Error: RangeError (index): Index out of range: index should be less than 6291456: 6291456

    Then I tried to remove stars & clouds from the scene and keep only earth object, which Is working. But not with clouds & stars.

    How could we solve this? This is only happened on WEB (works great on mobile) Thank you

    opened by Nico3652 0
  • Auto rotation

    Auto rotation

    There is a way to have a spherical object (like a earth map) that dosent mess up with the screen??? Or something to make the obj auto rotate on x axis?

    opened by smnprc91 0
Owner
Zebiao Hu
Just a coder! Languages: Flutter, Dart, Go, Delphi.
Zebiao Hu
A simple widget that renders BBCode in Flutter.

A simple display for BBCode in Flutter. Supports custom tags and styles. Features Render BBCode into human readable text. Support for custom tags Prev

Marten 3 Nov 15, 2022
🎯 This library automatically generates object classes from JSON files that can be parsed by the freezed library.

The Most Powerful Way to Automatically Generate Model Objects from JSON Files âš¡ 1. Guide ?? 1.1. Features ?? 1.1.1. From 1.1.2. To 1.2. Getting Starte

KATO, Shinya / 加藤 真也 14 Nov 9, 2022
Download files from Firebase Storage with Flutter. List all images, videos, or other files from Firebase and download them.

Flutter Tutorial - Download Files From Firebase Storage Download files from Firebase Storage with Flutter. List all images, videos, or other files fro

Johannes Milke 28 Dec 4, 2022
Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

Johannes Milke 30 Dec 28, 2022
Flutter shareable package of object-oriented classes for local caching of user data in json

json_cache Json Cache is an object-oriented package to serve as a layer on top of local storage packages - packages that persist data locally on the u

Dartoos 10 Dec 19, 2022
Real-time object detection in Flutter using camera and tflite plugin

For details: https://medium.com/@shaqian629/real-time-object-detection-in-flutter-b31c7ff9ef96 flutter_realtime_detection Real-time object detection i

Post_Swift 6 Oct 12, 2022
Object-oriented package for validating Flutter form fields.

formdator Contents Overview Getting Started List of Validators Categories Demo Application References Overview Form Validator — Formdator is a fully o

Dartoos 10 Oct 26, 2022
Flutter realtime object detection with Tensorflow Lite

Flutter realtime object detection with Tensorflow Lite Flutter realtime object d

null 0 Dec 25, 2021
This is a flutter plugin to detect edges in a live camera, take the picture of detected edges object, crop it, and save.

edge_detection A flutter plugin to detect edges of objects, scan paper, detect corners, detect rectangles. It allows cropping of the detected object i

Sawan Kumar Bundelkhandi 180 Dec 28, 2022
Receiving ozh's github-colors repository with latest commit of colors.json to Flutter's Color object.

Apply GitHub's languages colours into Flutter's Color object. Receiving ozh's github-colors repository with latest commit of colors.json to Flutter's

Cyrus Chan 1 Jun 6, 2022
Return a result ErrorOr with either a value T or an error Object.

ErrorOr Return a result ErrorOr with either a value T or an error Object. Features Always return a value ErrorOr from an async function. Let the calle

Erlend 6 Nov 6, 2022
Widget to count the amount of nested widget tree, useful in the dynamic construction of the interface when it is important to know the depth of widget.

widget_tree_depth_counter Widget Tree Depth Counter WidgetTreeDepthCounter is a simple widget to count the amount of nested widget tree, useful in the

Riccardo Cucia 4 Aug 1, 2022
MindInventory 15 Sep 5, 2022
It's OK to love Flutter and hate hand-coding design elements. Parabeac-Core converts design files into Flutter code.

Parabeac-Core Parabeac-Core converts design files into Flutter code driven by open-source & community. Contribute · Discord Community · Designer Proto

Parabeac 536 Jan 4, 2023
Flutter file manager - Flutter package for managing files on Android

flutter_file_utils Helper tools for managing files on Android. Getting Started For help getting started with Flutter, view our online documentation. F

Mohamed Naga 35 Nov 11, 2022
A flutter plugin for viewing PDF files in mobile app (Android & iOS)

PDF Viewer (JK) A flutter plugin for viewing PDF files in mobile app (Android & iOS) Pub.dev https://pub.dev/packages/pdf_viewer_jk Github ht

Jawad 8 Sep 30, 2021
A flutter plugin for handling PDF files

advance_pdf_viewer A flutter plugin for handling PDF files. Works on both Android & iOS. Originally forked from (https://github.com/CrossPT/flutter_pl

Abeer Iqbal 0 Dec 3, 2021
A freelancer project: A flutter app to manage files and certificates of employees in an organization. It uses AWS for authentication, Storage and DynamoDB.

certify A Certificate Management project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

null 0 Feb 3, 2022
A tool which automatically generates Flutter localization resources from CSV and Excel files.

flappy_translator A tool which automatically generates Flutter localization resources from CSV and Excel files. This is especially useful as any team

Smart&Soft 55 Sep 15, 2022