mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-15 20:25:00 +01:00
Switch to lightmap texture based lighting
This commit is contained in:
parent
907a5da105
commit
f9a99fc0ae
6 changed files with 56 additions and 128 deletions
13
src/res.rs
13
src/res.rs
|
|
@ -1,27 +1,20 @@
|
|||
use sfml::{
|
||||
audio::Music,
|
||||
graphics::{Shader, ShaderType, Texture},
|
||||
SfBox,
|
||||
};
|
||||
use sfml::{audio::Music, graphics::Texture, SfBox};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Res {
|
||||
pub tile_atlas: SfBox<Texture>,
|
||||
pub light_texture: SfBox<Texture>,
|
||||
pub surf_music: Music<'static>,
|
||||
pub und_music: Music<'static>,
|
||||
pub lighting_shader: Shader<'static>,
|
||||
}
|
||||
|
||||
impl Res {
|
||||
pub fn load() -> anyhow::Result<Self> {
|
||||
Ok(Self {
|
||||
tile_atlas: Texture::from_file("res/tiles.png")?,
|
||||
light_texture: Texture::from_file("res/lightcircle.png")?,
|
||||
surf_music: Music::from_file("res/music.ogg").unwrap(),
|
||||
und_music: Music::from_file("res/cave2.ogg").unwrap(),
|
||||
lighting_shader: Shader::from_memory(
|
||||
include_str!("../shaders/lighting.glsl"),
|
||||
ShaderType::Fragment,
|
||||
)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue