Texture2D._draw_rect_region is all white.
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- computer-graphics, game-dev
Direzione di ricerca
Start with paged-texture.gd in the attached reproduction project and compare _draw_rect_region with the working _draw_rect implementation. Reproduce the white result through the scene’s TextureRect and inspect how the source rectangle is split and passed to each page’s draw_rect_region. Done means the requested region renders the correct texture content across pages without white output in tiled, scale, and keep modes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Tested versions
v26.3.rc.3.official [ccb92435b]
System information
Operating System: Debian GNU/Linux 13 KDE Plasma Version: 6.3.6 KDE Frameworks Version: 6.13.0 Qt Version: 6.8.2 Kernel Version: 6.12.107+deb13-amd64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 5700G with Radeon Graphics Memory: 16 GiB of RAM (15.0 GiB usable) Graphics Processor: AMD Radeon Graphics Product Name: B550M-ITX/ac
Issue description
I am trying to implement a paged texture resource.
The issue is _draw_rect_region is not being drawn its just all white.
I was using NinePatchRect and TextureRect control to test it.
@tool class_name PagedTexture extends Texture2D
@export var pages : Array[Texture2D]=[]
@export var page_width := 160
@export var page_height := 144
func _get_width() -> int:
return page_width
func _get_height() -> int:
return page_height * pages.size()
func _draw(to_canvas_item: RID, pos: Vector2, modulate: Color, transpose: bool) -> void:
if pages.size() == 0: return
var offset := 0
for page in pages:
page.draw(to_canvas_item, Vector2(pos.x, pos.y+offset), modulate, transpose)
offset += page_height
func _draw_rect(to_canvas_item: RID, dst_rect: Rect2, tile: bool, modulate: Color, transpose: bool) -> void:
if pages.size() == 0: return
# dst_size is the size of one page and how much we increment the dst_offset by.
var dst_size := dst_rect.size.y / pages.size()
var dst_offset := 0.0
# loop over all pages :(
for page in pages:
# calculate the destination rectangle for this page.
var dst_rect_part := Rect2(dst_rect.position.x, dst_rect.position.y+dst_offset, dst_rect.size.x, dst_size)
if page:
page.draw_rect(to_canvas_item, dst_rect_part, tile, modulate, transpose)
# offset that destination rectangle y.
dst_offset += dst_size
func _draw_rect_region(to_canvas_item: RID, dst_rect: Rect2, src_rect: Rect2, modulate: Color, transpose: bool, clip_uv: bool) -> void:
if pages.size() == 0: return
# dst_size is the size of one page and how much we increment the dst_offset by.
# src_size is the size of one page and how much we increment the src_offset by.
var dst_size := dst_rect.size.y / pages.size()
var src_size := src_rect.size.y / pages.size()
var dst_offset := 0.0
var src_offset := 0.0
# find used page indices.
var page_start := (src_rect.position.y) / page_height
var page_end := (src_rect.position.y + src_rect.size.y) / page_height
# if page_start is out of bounds return.
if page_start < 0 or page_start >= pages.size():
return
# loop over used page indices.
for page_index in range(page_start, page_end):
# if at anytime we are out of bounds break the loop.
if page_index >= pages.size():
break;
# fetch the page we are drawing.
var page := pages[page_index]
# calculate the destination and source rectangle for this page.
var dst_rect_part := Rect2(dst_rect.position.x, dst_rect.position.y+dst_offset, dst_rect.size.x, dst_size)
var src_rect_part := Rect2(src_rect.position.x, src_rect.position.y+src_offset, src_rect.size.x, src_size)
if page:
page.draw_rect_region(
to_canvas_item,
dst_rect_part,
src_rect_part,
modulate, transpose, clip_uv)
# offset that destination and source rectangle y.
dst_offset += dst_size
src_offset += src_size
tiled mode width is correct, scale and keep mode height is correct.
Steps to reproduce
- open the project
- open the editor scene
- open up the paged-texture.gd
- mess with the texture rect in the scene
- look at the code.
Minimal reproduction project (MRP)
- Lingua principale
- C++
- Stelle
- 6.1k
- Fork
- 337
- Merge medio
- 5g 8h
- PR unite (30g)
- 13
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Redot-Engine/redot-engine
-
C#] [Export] does not support struct types (GD0102), inconsistent with GDScript struct supportApertaenhancement topic:dotnet usability
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Redot-Engine/redot-engine#1589 ·
I maintainer di solito rispondono entro 1 giorno
-
Trait is not being resolvedApertabug topic:gdscript
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
Redot-Engine/redot-engine#1588 ·
I maintainer di solito rispondono entro 1 giorno
-
Handle stateful audio effects when a bus channel becomes inactiveForse già presa @GeneralProtectionFault l’ha presa 27 giorni fa. Aperta
Redot-Engine/redot-engine#1584 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
bug usability
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
Redot-Engine/redot-engine#1583 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug confirmed topic:3d topic:rendering
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Redot-Engine/redot-engine#1568 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Redot-Engine/redot-engine
Issue simili
-
Make the HTTP server's keep-alive and headers timeouts configurableForse già presa @mattgodbolt l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
compiler-explorer/compiler-explorer#9902 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Nixtla/statsforecast#1371 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itselfForse già presa @fedonman l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
task
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
SparseLinearAlgebra/spla#316 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno