mirror of
https://github.com/griffi-gh/hUI.git
synced 2024-11-26 00:48:44 -06:00
stuff
This commit is contained in:
parent
a92817cb88
commit
f25efdb3ca
|
@ -9,11 +9,5 @@ in vec2 vtx_uv;
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
//HACK: if vtx_uv is (0, 0) then the texture is not used
|
|
||||||
//disabling this will cause blinking
|
|
||||||
if (vtx_uv.x == 0.0 && vtx_uv.y == 0.0) {
|
|
||||||
out_color = vtx_color;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
out_color = texture(tex, vtx_uv) * vtx_color;
|
out_color = texture(tex, vtx_uv) * vtx_color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,7 @@ impl UiDrawCall {
|
||||||
.map(|x| atlas.get_uv(x))
|
.map(|x| atlas.get_uv(x))
|
||||||
.flatten()
|
.flatten()
|
||||||
.unwrap_or(Corners::all(Vec2::ZERO));
|
.unwrap_or(Corners::all(Vec2::ZERO));
|
||||||
|
|
||||||
let vidx = draw_call.vertices.len() as u32;
|
let vidx = draw_call.vertices.len() as u32;
|
||||||
if let Some(corner) = rounded_corners.filter(|x| x.radius.max_f32() > 0.0) {
|
if let Some(corner) = rounded_corners.filter(|x| x.radius.max_f32() > 0.0) {
|
||||||
//this code is stupid as fuck
|
//this code is stupid as fuck
|
||||||
|
|
|
@ -219,6 +219,14 @@ impl TextureAtlasManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn add_dummy(&mut self) {
|
||||||
|
let handle = self.allocate((1, 1).into());
|
||||||
|
assert!(handle.index == 0, "Dummy texture handle is not 0");
|
||||||
|
assert!(self.get(handle).unwrap().position == (0, 0).into(), "Dummy texture position is not (0, 0)");
|
||||||
|
self.data[0..4].copy_from_slice(&[255, 255, 255, 255]);
|
||||||
|
self.modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn modify(&mut self, handle: ImageHandle) {
|
pub fn modify(&mut self, handle: ImageHandle) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,7 @@ impl UiInstance {
|
||||||
text_renderer: TextRenderer::new(),
|
text_renderer: TextRenderer::new(),
|
||||||
atlas: {
|
atlas: {
|
||||||
let mut atlas = TextureAtlasManager::default();
|
let mut atlas = TextureAtlasManager::default();
|
||||||
//HACK: Ensure that vec(0, 0) uv is white square
|
atlas.add_dummy();
|
||||||
atlas.add_rgba(1, &[255, 255, 255, 255]);
|
|
||||||
atlas
|
atlas
|
||||||
},
|
},
|
||||||
events: EventQueue::new(),
|
events: EventQueue::new(),
|
||||||
|
|
Loading…
Reference in a new issue