début renderer
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
//! # Basic Shader Module
|
||||
struct VertexInput {
|
||||
@location(0) position: vec3<f32>,
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) clip_position: vec4<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
pub fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4f {
|
||||
var positions = array<vec2f, 3>(
|
||||
vec2f(0.0, 0.5),
|
||||
vec2f(-0.5, -0.5),
|
||||
vec2f(0.5, -0.5),
|
||||
);
|
||||
return vec4f(positions[vertex_index], 0.0, 1.0);
|
||||
fn vs_main(model: VertexInput) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.clip_position = vec4<f32>(model.position, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
pub fn fs_main() -> @location(0) vec4f {
|
||||
return vec4f(1.0, 0.0, 0.0, 1.0);
|
||||
fn fs_main() -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(1.0, 0.5, 0.2, 1.0); // Couleur orange
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user