Skip to main content

perfectum_3d 1.0.0 copy "perfectum_3d: ^1.0.0" to clipboard
perfectum_3d: ^1.0.0 copied to clipboard

A lightweight, pure Dart software rendering 3D engine for Flutter. Build voxel-based, low-poly casual games without OpenGL or hardware acceleration.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:vector_math/vector_math_64.dart' as math;
import 'package:perfectum_3d/perfectum_3d.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.black,
        body: BasicScene(),
      ),
    );
  }
}

class BasicScene extends StatefulWidget {
  const BasicScene({super.key});

  @override
  State<BasicScene> createState() => _BasicSceneState();
}

class _BasicSceneState extends State<BasicScene> {
  late Camera3D camera;
  List<Mesh3D> sceneObjects = [];

  @override
  void initState() {
    super.initState();
    camera = Camera3D(
      position: math.Vector3(0.0, 2.0, 10.0),
      target: math.Vector3(0.0, 0.0, 0.0),
    );

    // Create a simple green cube
    var cube = BoxGeometry(width: 2.0, height: 2.0, depth: 2.0, color: Colors.green);
    sceneObjects.add(cube);
  }

  @override
  Widget build(BuildContext context) {
    return Scene3D(
      camera: camera,
      meshes: sceneObjects,
      lightDirection: math.Vector3(0.5, -1.0, -0.5),
      backgroundColor: Colors.lightBlue,
      enableFog: true,
    );
  }
}
6
likes
140
points
153
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight, pure Dart software rendering 3D engine for Flutter. Build voxel-based, low-poly casual games without OpenGL or hardware acceleration.

Repository (GitHub)

License

MIT (license)

Dependencies

flutter, vector_math

More

Packages that depend on perfectum_3d