summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-14 22:38:10 +0200
committerHampusM <hampus@hampusmat.com>2024-04-14 22:38:10 +0200
commit2302a232de4132a25153071049d31bc59ae70b35 (patch)
tree67361e2cff1a7993573818ca9523e63fddb34477 /src
parent2b8f8ba255ef772f043cb27a49a55086df12718f (diff)
chore: remove reading default shaders
Diffstat (limited to 'src')
-rw-r--r--src/main.rs57
1 files changed, 11 insertions, 46 deletions
diff --git a/src/main.rs b/src/main.rs
index 0cbe754..97c7615 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,7 +10,7 @@ use engine::input::{Extension as InputExtension, Keys};
use engine::lighting::{LightSource, LightSourceBuilder};
use engine::material::Builder as MaterialBuilder;
use engine::renderer::Extension as RendererExtension;
-use engine::shader::{Kind as ShaderKind, Program as ShaderProgram, Shader};
+use engine::shader::Program as ShaderProgram;
use engine::texture::{Id as TextureId, Map as TextureMap, Texture};
use engine::transform::Transform;
use engine::vector::{Vec2, Vec3};
@@ -24,11 +24,6 @@ use crate::cube::{create_cube_mesh, Corner as CubeCorner, Side as CubeSide};
mod cube;
-const VERTEX_SHADER_FILE: &str = "vertex.glsl";
-const FRAGMENT_SHADER_FILE: &str = "fragment.glsl";
-
-const SHADER_DIR: &str = "engine";
-
const CAM_SPEED: f32 = 3.0;
const LIGHT_SOURCE_SPEED: f32 = 1.2;
@@ -127,53 +122,23 @@ fn main() -> Result<(), Box<dyn Error>>
let mut engine = Engine::new();
- let texture = Texture::open(Path::new("vent.png"))?;
-
- let material = MaterialBuilder::new()
- .ambient_map(TextureId::new(0))
- .diffuse_map(TextureId::new(0))
- .specular_map(TextureId::new(0))
- .build();
-
- /*
- let mut textured_cube = create_cube(cube_vertex_builder_cb)
- .texture(TextureId::new(0), texture.clone())
- .material(material.clone())
- .build(ObjectId::new(4))?;
-
- textured_cube.translate(Vec3 { x: 1.6, y: 0.0, z: 0.0 });
-
- engine.add_object(textured_cube);
- */
-
let mut transform = Transform::new();
transform.set_position(Vec3 { x: 1.6, y: 0.0, z: 0.0 });
- let mut shader_program = ShaderProgram::new();
-
- shader_program.push_shader(
- Shader::read_shader_file(
- ShaderKind::Vertex,
- &Path::new(SHADER_DIR).join(VERTEX_SHADER_FILE),
- )?
- .preprocess()?,
- );
-
- shader_program.push_shader(
- Shader::read_shader_file(
- ShaderKind::Fragment,
- &Path::new(SHADER_DIR).join(FRAGMENT_SHADER_FILE),
- )?
- .preprocess()?,
- );
-
engine.spawn((
create_cube_mesh(cube_vertex_builder_cb),
- TextureMap::from_iter([(TextureId::new(0), texture)]),
- material,
+ TextureMap::from_iter([(
+ TextureId::new(0),
+ Texture::open(Path::new("vent.png"))?,
+ )]),
+ MaterialBuilder::new()
+ .ambient_map(TextureId::new(0))
+ .diffuse_map(TextureId::new(0))
+ .specular_map(TextureId::new(0))
+ .build(),
transform,
- shader_program,
+ ShaderProgram::new()?,
));
let light_source = LightSourceBuilder::new()