-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c44264
commit 334ecd2
Showing
6 changed files
with
124 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use crate::{ | ||
pipeline::{ | ||
BlendDescriptor, BlendFactor, BlendOperation, ColorStateDescriptor, ColorWrite, | ||
CompareFunction, CullMode, DepthStencilStateDescriptor, FrontFace, PipelineDescriptor, | ||
PolygonMode, RasterizationStateDescriptor, StencilStateDescriptor, | ||
StencilStateFaceDescriptor, | ||
}, | ||
prelude::*, | ||
shader::{Shader, ShaderStage, ShaderStages}, | ||
texture::TextureFormat, | ||
}; | ||
use bevy_app::prelude::*; | ||
use bevy_asset::{Assets, Handle}; | ||
|
||
pub(crate) fn build_wireframe_pipeline(shaders: &mut Assets<Shader>) -> PipelineDescriptor { | ||
PipelineDescriptor { | ||
rasterization_state: Some(RasterizationStateDescriptor { | ||
front_face: FrontFace::Ccw, | ||
cull_mode: CullMode::Back, | ||
polygon_mode: PolygonMode::Line, | ||
depth_bias: 0, | ||
depth_bias_slope_scale: 0.0, | ||
depth_bias_clamp: 0.0, | ||
clamp_depth: false, | ||
}), | ||
depth_stencil_state: Some(DepthStencilStateDescriptor { | ||
format: TextureFormat::Depth32Float, | ||
depth_write_enabled: true, | ||
depth_compare: CompareFunction::Less, | ||
stencil: StencilStateDescriptor { | ||
front: StencilStateFaceDescriptor::IGNORE, | ||
back: StencilStateFaceDescriptor::IGNORE, | ||
read_mask: 0, | ||
write_mask: 0, | ||
}, | ||
}), | ||
color_states: vec![ColorStateDescriptor { | ||
format: TextureFormat::Bgra8UnormSrgb, | ||
color_blend: BlendDescriptor { | ||
src_factor: BlendFactor::SrcAlpha, | ||
dst_factor: BlendFactor::OneMinusSrcAlpha, | ||
operation: BlendOperation::Add, | ||
}, | ||
alpha_blend: BlendDescriptor { | ||
src_factor: BlendFactor::One, | ||
dst_factor: BlendFactor::One, | ||
operation: BlendOperation::Add, | ||
}, | ||
write_mask: ColorWrite::ALL, | ||
}], | ||
..PipelineDescriptor::new(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"), | ||
))), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters