mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
fix crunchiness on textures I create
This commit is contained in:
@@ -58,6 +58,7 @@ class BaseChibi:
|
|||||||
|
|
||||||
class ChibiBad(BaseChibi):
|
class ChibiBad(BaseChibi):
|
||||||
def __init__(self, index: int, bpm: float, tex: TextureWrapper, is_2p: bool):
|
def __init__(self, index: int, bpm: float, tex: TextureWrapper, is_2p: bool):
|
||||||
|
self.tex = tex
|
||||||
self.is_2p = is_2p
|
self.is_2p = is_2p
|
||||||
self.bpm = bpm
|
self.bpm = bpm
|
||||||
self.index = random.randint(0, 2)
|
self.index = random.randint(0, 2)
|
||||||
|
|||||||
@@ -37,6 +37,16 @@ class Texture:
|
|||||||
self.width = self.texture.width
|
self.width = self.texture.width
|
||||||
self.height = self.texture.height
|
self.height = self.texture.height
|
||||||
self.is_frames = isinstance(self.texture, list)
|
self.is_frames = isinstance(self.texture, list)
|
||||||
|
if isinstance(self.texture, list):
|
||||||
|
pass
|
||||||
|
for texture_data in self.texture:
|
||||||
|
ray.GenTextureMipmaps(ray.ffi.addressof(texture_data))
|
||||||
|
ray.SetTextureFilter(texture_data, ray.TEXTURE_FILTER_TRILINEAR)
|
||||||
|
ray.SetTextureWrap(texture_data, ray.TEXTURE_WRAP_CLAMP)
|
||||||
|
else:
|
||||||
|
ray.GenTextureMipmaps(ray.ffi.addressof(self.texture))
|
||||||
|
ray.SetTextureFilter(self.texture, ray.TEXTURE_FILTER_TRILINEAR)
|
||||||
|
ray.SetTextureWrap(self.texture, ray.TEXTURE_WRAP_CLAMP)
|
||||||
|
|
||||||
self.x: list[int] = [0]
|
self.x: list[int] = [0]
|
||||||
self.y: list[int] = [0]
|
self.y: list[int] = [0]
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ class OutlinedText:
|
|||||||
self.texture = self._create_text_vertical(text, font_size, color, ray.BLANK, self.font)
|
self.texture = self._create_text_vertical(text, font_size, color, ray.BLANK, self.font)
|
||||||
else:
|
else:
|
||||||
self.texture = self._create_text_horizontal(text, font_size, color, ray.BLANK, self.font)
|
self.texture = self._create_text_horizontal(text, font_size, color, ray.BLANK, self.font)
|
||||||
|
ray.gen_texture_mipmaps(self.texture)
|
||||||
|
ray.set_texture_filter(self.texture, ray.TextureFilter.TEXTURE_FILTER_TRILINEAR)
|
||||||
outline_size = ray.ffi.new('float*', self.outline_thickness)
|
outline_size = ray.ffi.new('float*', self.outline_thickness)
|
||||||
texture_size = ray.ffi.new("float[2]", [self.texture.width, self.texture.height])
|
texture_size = ray.ffi.new("float[2]", [self.texture.width, self.texture.height])
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class VideoPlayer:
|
|||||||
'format': ray.PIXELFORMAT_UNCOMPRESSED_R8G8B8
|
'format': ray.PIXELFORMAT_UNCOMPRESSED_R8G8B8
|
||||||
})
|
})
|
||||||
self.texture = ray.LoadTextureFromImage(image[0])
|
self.texture = ray.LoadTextureFromImage(image[0])
|
||||||
|
ray.SetTextureFilter(self.texture, ray.TEXTURE_FILTER_TRILINEAR)
|
||||||
else:
|
else:
|
||||||
if frame_data is not None:
|
if frame_data is not None:
|
||||||
frame_bytes = frame_data.tobytes()
|
frame_bytes = frame_data.tobytes()
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ void main()
|
|||||||
|
|
||||||
// Calculate outline
|
// Calculate outline
|
||||||
float outline = 0.0;
|
float outline = 0.0;
|
||||||
int ringSamples = 64;
|
int ringSamples = 16;
|
||||||
int rings = 4;
|
int rings = 2;
|
||||||
for(int ring = 1; ring <= rings; ring++) {
|
for(int ring = 1; ring <= rings; ring++) {
|
||||||
float ringRadius = float(ring) / float(rings);
|
float ringRadius = float(ring) / float(rings);
|
||||||
for(int i = 0; i < ringSamples; i++) {
|
for(int i = 0; i < ringSamples; i++) {
|
||||||
@@ -28,7 +28,7 @@ void main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
outline = min(outline, 1.0);
|
outline = min(outline, 1.0);
|
||||||
outline = smoothstep(0.1, 0.6, outline);
|
outline = smoothstep(0.3, 0.7, outline);
|
||||||
|
|
||||||
float edgeStart = 0.5 - smoothness * 0.3;
|
float edgeStart = 0.5 - smoothness * 0.3;
|
||||||
float edgeEnd = 0.5 + smoothness * 0.3;
|
float edgeEnd = 0.5 + smoothness * 0.3;
|
||||||
|
|||||||
Reference in New Issue
Block a user