Migrate to a software rasterizer to dramatically improve performance
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
import 'package:wolf_3d_renderer/color_palette.dart';
|
||||
|
||||
class WeaponPainter extends CustomPainter {
|
||||
final Sprite? sprite;
|
||||
@@ -24,11 +23,11 @@ class WeaponPainter extends CustomPainter {
|
||||
|
||||
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) {
|
||||
// 255 is our transparent magenta
|
||||
_paint.color = ColorPalette.vga[colorByte];
|
||||
_paint.color = Color(ColorPalette.vga32Bit[colorByte]);
|
||||
|
||||
canvas.drawRect(
|
||||
Rect.fromLTWH(
|
||||
|
||||
Reference in New Issue
Block a user