summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-01-21 15:27:55 -0500
committerLLLL Colonq <llll@colonq>2025-01-21 15:27:55 -0500
commit47fe18171569582d1af9401013c57045b59f3774 (patch)
treeb3dbfa96c90e6a36ac74b1f0e4ef1b8705a46470 /src/lib.rs
parentfdafae3cdcb03a8b7fa736039556bcc465a34959 (diff)
Fix font rendering
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3bd1668..db802f0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -287,9 +287,10 @@ impl TestGame {
pub async fn new(ctx: &context::Context) -> Self {
Self {
font: font::Bitmap::new(ctx),
- tt: font::TrueType::new(ctx),
+ tt: font::TrueType::new(ctx, 12.0, include_bytes!("assets/fonts/ComicNeue-Regular.ttf")),
cube: mesh::Mesh::from_obj(ctx, include_bytes!("assets/meshes/cube.obj")),
- fox: scene::Scene::from_gltf(ctx, include_bytes!("assets/scenes/fox.glb")),
+ // fox: scene::Scene::from_gltf(ctx, include_bytes!("assets/scenes/fox.glb")),
+ fox: scene::Scene::from_gltf(ctx, include_bytes!("/home/llll/src/colonq/assets/lcolonq_flat.vrm")),
tex: texture::Texture::new(ctx, include_bytes!("assets/textures/test.png")),
shader: shader::Shader::new(ctx, include_str!("assets/shaders/scene/vert.glsl"), include_str!("assets/shaders/scene/frag.glsl")),
}
@@ -307,15 +308,16 @@ impl state::Game for TestGame {
Some(())
}
fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Option<()> {
- // if let Some(n) = self.fox.nodes_by_name.get("J_Bip_C_Neck").and_then(|i| self.fox.nodes.get_mut(*i)) {
- // n.transform *= glam::Mat4::from_rotation_z(0.05);
- // }
- self.fox.reflect_animation("Run", (st.tick as f32 / 60.0).rem(3.0));
+ if let Some(n) = self.fox.nodes_by_name.get("J_Bip_C_Neck").and_then(|i| self.fox.nodes.get_mut(*i)) {
+ n.transform *= glam::Mat4::from_rotation_z(0.05);
+ }
+ // self.fox.reflect_animation("Run", (st.tick as f32 / 60.0).rem(3.0));
st.bind_3d(ctx, &self.shader);
self.shader.set_position_3d(
ctx,
&glam::Mat4::from_scale_rotation_translation(
- glam::Vec3::new(0.005, 0.005, 0.005),
+ // glam::Vec3::new(0.005, 0.005, 0.005),
+ glam::Vec3::new(1.0, 1.0, 1.0),
glam::Quat::from_rotation_y(st.tick as f32 / 60.0),
glam::Vec3::new(0.0, -0.2, 0.0),
),
@@ -323,7 +325,14 @@ impl state::Game for TestGame {
self.tex.bind(ctx);
self.fox.render(ctx, &self.shader);
self.font.render_text(ctx, &glam::Vec2::new(0.0, 10.0), "he's all FIXED up");
- // self.tt.render_text(ctx, &glam::Vec2::new(10.0, 10.0), "tESTge");
+ self.tt.render_text_helper(
+ ctx, &glam::Vec2::new(10.0, 60.0), &glam::Vec2::new(20.0, 30.0),
+ "tESTge",
+ &[
+ glam::Vec3::new(1.0, 0.0, 0.0),
+ glam::Vec3::new(0.0, 1.0, 0.0),
+ ],
+ );
Some(())
}
}