gdritter repos utmyen / 8c05f6d
Added Farbfeld texture Getty Ritter 7 years ago
3 changed file(s) with 8 addition(s) and 14 deletion(s). Collapse all Expand all
Binary diff not shown
3131
3232
3333 impl<'a> Graphics<'a> {
34 pub fn new(sg: SceneGraph<'a>, t: RawImage2d<u8>) -> Self {
34 pub fn new(sg: SceneGraph<'a>, t: RawImage2d<(u16,u16,u16,u16)>) -> Self {
3535 let disp = WindowBuilder::new()
3636 .with_title(format!("utmyen"))
3737 .with_depth_buffer(24)
4545 let tex = Texture2d::with_format(
4646 &disp,
4747 t,
48 glium::texture::UncompressedFloatFormat::U8U8U8,
48 glium::texture::UncompressedFloatFormat::U16U16U16U16,
4949 glium::texture::MipmapsOption::NoMipmap).unwrap();
5050 Graphics {
5151 disp: disp,
77
88 mod graphics;
99
10
11 use glium::texture::{RawImage2d};
10 use glium::texture::{RawImage2d,Texture2dDataSource};
11 use therm_model::farbfeld::FFImage;
1212 use therm_model::model;
1313 use therm_model::graph::SceneGraph;
1414
1818 model::Model::load_from_file(&file).unwrap()
1919 }
2020
21 fn sample_texture<'a>() -> RawImage2d<'a, u8> {
22 use std::io::Cursor;
23 let img = image::load(
24 Cursor::new(&include_bytes!("../data/test/chest.png")[..]),
25 image::PNG).unwrap().to_rgba();
26 let dims = img.dimensions();
27 let img = glium::texture::RawImage2d::from_raw_rgba_reversed(img.into_raw(), dims);
28 img
21 fn sample_texture<'a>() -> RawImage2d<'a, (u16,u16,u16,u16)> {
22 FFImage::from_bz2_file("data/test/chest.ff.bz2").unwrap().into_raw()
2923 }
3024
3125 fn main() {
3327 let tex = sample_texture();
3428
3529 let mut v = vec![];
36 for x in -20..20i32 {
37 for y in -20..20i32 {
30 for x in -50..5i32 {
31 for y in -5..5i32 {
3832 v.push(SceneGraph::Translate(x as f32*0.3,
3933 0.0,
4034 y as f32*0.3,