@@ -1,10 +1,10 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wolf_dart/classes/color_palette.dart';
|
||||
import 'package:wolf_dart/classes/linear_coordinates.dart';
|
||||
import 'package:wolf_dart/classes/matrix.dart';
|
||||
import 'package:wolf_dart/classes/sprite.dart';
|
||||
import 'package:wolf_dart/features/renderer/color_palette.dart';
|
||||
|
||||
class RaycasterPainter extends CustomPainter {
|
||||
final Matrix<int> map;
|
||||
@@ -209,10 +209,8 @@ class RaycasterPainter extends CustomPainter {
|
||||
// THE Z-BUFFER CHECK!
|
||||
// Only draw if the sprite is closer to the camera than the wall at this pixel column
|
||||
if (transformY < zBuffer[stripe]) {
|
||||
int texX = ((stripe - drawStartX) * 64 / spriteWidth).toInt().clamp(
|
||||
0,
|
||||
63,
|
||||
);
|
||||
double texXDouble = (stripe - drawStartX) * 64 / spriteWidth;
|
||||
int texX = texXDouble.toInt().clamp(0, 63);
|
||||
|
||||
double startY = (size.height / 2) - (spriteHeight / 2);
|
||||
double stepY = spriteHeight / 64.0;
|
||||
|
||||
Reference in New Issue
Block a user