2021-03-04 01:23:24 +00:00
|
|
|
use crate::{
|
2021-05-02 20:45:25 +00:00
|
|
|
pipeline::{FrontFace, PipelineDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology},
|
2021-03-04 01:23:24 +00:00
|
|
|
shader::{Shader, ShaderStage, ShaderStages},
|
|
|
|
};
|
|
|
|
use bevy_asset::Assets;
|
|
|
|
|
|
|
|
pub(crate) fn build_wireframe_pipeline(shaders: &mut Assets<Shader>) -> PipelineDescriptor {
|
|
|
|
PipelineDescriptor {
|
|
|
|
name: Some("wireframe".into()),
|
|
|
|
primitive: PrimitiveState {
|
|
|
|
topology: PrimitiveTopology::TriangleList,
|
|
|
|
strip_index_format: None,
|
|
|
|
front_face: FrontFace::Ccw,
|
2021-05-02 20:45:25 +00:00
|
|
|
cull_mode: None,
|
2021-03-04 01:23:24 +00:00
|
|
|
polygon_mode: PolygonMode::Line,
|
2021-05-02 20:45:25 +00:00
|
|
|
clamp_depth: false,
|
|
|
|
conservative: false,
|
2021-03-04 01:23:24 +00:00
|
|
|
},
|
|
|
|
..PipelineDescriptor::default_config(ShaderStages {
|
|
|
|
vertex: shaders.add(Shader::from_glsl(
|
|
|
|
ShaderStage::Vertex,
|
|
|
|
include_str!("wireframe.vert"),
|
|
|
|
)),
|
|
|
|
fragment: Some(shaders.add(Shader::from_glsl(
|
|
|
|
ShaderStage::Fragment,
|
|
|
|
include_str!("wireframe.frag"),
|
|
|
|
))),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|