Migrate to a software rasterizer to dramatically improve performance
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
import 'package:wolf_3d_entities/wolf_3d_entities.dart';
|
||||
import 'package:wolf_3d_flutter/wolf_3d.dart';
|
||||
import 'package:wolf_3d_renderer/color_palette.dart';
|
||||
|
||||
class SpriteGallery extends StatelessWidget {
|
||||
final List<Sprite> sprites;
|
||||
@@ -76,12 +75,12 @@ class SingleSpritePainter extends CustomPainter {
|
||||
double pixelSize = size.width / 64;
|
||||
for (int x = 0; x < 64; x++) {
|
||||
for (int y = 0; y < 64; y++) {
|
||||
int colorByte = sprite[x][y];
|
||||
int colorByte = sprite.pixels[x * 64 + y];
|
||||
if (colorByte != 255) {
|
||||
// Skip transparency
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(x * pixelSize, y * pixelSize, pixelSize, pixelSize),
|
||||
Paint()..color = ColorPalette.vga[colorByte],
|
||||
Paint()..color = Color(ColorPalette.vga32Bit[colorByte]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user