From db8cbdc77e31273b4f7ac66bb964835e0d25a0bf Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Tue, 10 Mar 2020 18:04:08 -0700 Subject: [PATCH] miserable failure to get text rendering to work using these 'easy text rendering' tricks. Will be bringing in a third party library which I have to write the damn backend implementation for --- notes/Home.txt | 8 +- notes/PossiblePathfinderPort.txt | 449 +++++++++++++++++++++ resources/shaders/simple_text.frag | 12 +- src/canvas/canvas_state.rs | 4 +- src/canvas/managed/shader/shader_common.rs | 2 +- src/canvas/managed/shader/text_shader.rs | 7 +- src/drawables/text.rs | 60 +-- 7 files changed, 505 insertions(+), 37 deletions(-) create mode 100644 notes/PossiblePathfinderPort.txt diff --git a/notes/Home.txt b/notes/Home.txt index c3edb2e7..6560d342 100644 --- a/notes/Home.txt +++ b/notes/Home.txt @@ -14,14 +14,16 @@ Creation-Date: 2020-02-03T22:11:42-08:00 vulkano/vulkano-win vulkano/vulkano-shaders vulkano/vulkano - [ ] Get a new GPU + [*] Get a new GPU + [*] Figure out how to make this POS stable (semi stable) + -------------------- [[~/source/Trac3r-rust/doc/sfml_rust/index.html|Documentation Root]] Docs -[[VkProcessor]] [[~/source/Trac3r-rust/doc/sfml_rust/vkprocessor/struct.VkProcessor.html|===========]] +[[VkProcessor]] [[~/source/Trac3r-rust/doc/sfml_rust/vkprocessor/struct.VkProcessor.html|===========]] [[VKProcessor:CanvasState|CanvasState]] [[~/source/Trac3r-rust/doc/sfml_rust/canvas/canvas_state/index.html|===========]] [[VKProcessor::CanvasFrame|CanvasFrame]] =========== [[VKProcessor:CompiledShader|CompiledShader]] =========== @@ -29,7 +31,7 @@ Creation-Date: 2020-02-03T22:11:42-08:00 [[VKProcessor:DynamicVertex|DynamicVertex]] (dead) =========== -[[Drawables]] =========== +[[Drawables]] =========== -------------------- diff --git a/notes/PossiblePathfinderPort.txt b/notes/PossiblePathfinderPort.txt new file mode 100644 index 00000000..0a8aca8d --- /dev/null +++ b/notes/PossiblePathfinderPort.txt @@ -0,0 +1,449 @@ +Content-Type: text/x-zim-wiki +Wiki-Format: zim 0.4 +Creation-Date: 2020-02-28T22:36:46-08:00 + +====== PossiblePathfinderPort ====== +Created Friday 28 February 2020 + + + + +pub struct RenderState<'a, D> where D: Device + pub target: &'a RenderTarget<'a, D>, + pub program: &'a D::Program, + pub vertex_array: &'a D::VertexArray, + pub primitive: Primitive, + pub uniforms: &'a [(&'a D::Uniform, UniformData)], + pub textures: &'a [&'a D::Texture], + pub viewport: RectI, + pub options: RenderOptions, + + +**So I need to define the following types in Vulkan syntax** + +**The other port uses container classes for these ** + + + type Buffer; + type Framebuffer; + type Program; + **VulkanProgram** + type Shader; + type Texture; + type TextureDataReceiver; + type TimerQuery; + type Uniform; + type VertexArray; + type VertexAttr; + + + + [ ] fn create_texture(&self, format: TextureFormat, size: Vector2I) -> Self::Texture; + + So for this function I'm going to need to convert Texture + + fn create_texture_from_data(&self, format: TextureFormat, size: Vector2I, data: TextureDataRef) + -> Self::Texture; + fn create_shader(&self, resources: &dyn ResourceLoader, name: &str, kind: ShaderKind) + -> Self::Shader; + fn create_shader_from_source(&self, name: &str, source: &[u8], kind: ShaderKind) + -> Self::Shader; + fn create_vertex_array(&self) -> Self::VertexArray; + fn create_program_from_shaders( + &self, + resources: &dyn ResourceLoader, + name: &str, + vertex_shader: Self::Shader, + fragment_shader: Self::Shader, + ) -> Self::Program; + fn get_vertex_attr(&self, program: &Self::Program, name: &str) -> Option; + fn get_uniform(&self, program: &Self::Program, name: &str) -> Self::Uniform; + fn bind_buffer(&self, + vertex_array: &Self::VertexArray, + buffer: &Self::Buffer, + target: BufferTarget); + fn configure_vertex_attr(&self, + vertex_array: &Self::VertexArray, + attr: &Self::VertexAttr, + descriptor: &VertexAttrDescriptor); + fn create_framebuffer(&self, texture: Self::Texture) -> Self::Framebuffer; + fn create_buffer(&self) -> Self::Buffer; + fn allocate_buffer( + &self, + buffer: &Self::Buffer, + data: BufferData, + target: BufferTarget, + mode: BufferUploadMode, + ); + fn framebuffer_texture<'f>(&self, framebuffer: &'f Self::Framebuffer) -> &'f Self::Texture; + fn destroy_framebuffer(&self, framebuffer: Self::Framebuffer) -> Self::Texture; + fn texture_format(&self, texture: &Self::Texture) -> TextureFormat; + fn texture_size(&self, texture: &Self::Texture) -> Vector2I; + fn set_texture_sampling_mode(&self, texture: &Self::Texture, flags: TextureSamplingFlags); + fn upload_to_texture(&self, texture: &Self::Texture, rect: RectI, data: TextureDataRef); + + **Command buffer stuff** + fn begin_commands(&self); + fn end_commands(&self); + + + fn draw_arrays(&self, index_count: u32, render_state: &RenderState); + fn draw_elements(&self, index_count: u32, render_state: &RenderState); + fn draw_elements_instanced(&self, + index_count: u32, + instance_count: u32, + render_state: &RenderState); + + **This is the weird timing stuff** + fn create_timer_query(&self) -> Self::TimerQuery; + fn begin_timer_query(&self, query: &Self::TimerQuery); + fn end_timer_query(&self, query: &Self::TimerQuery); + fn try_recv_timer_query(&self, query: &Self::TimerQuery) -> Option; + fn recv_timer_query(&self, query: &Self::TimerQuery) -> Duration; + + **And then the GPU reads** + fn try_recv_texture_data(&self, receiver: &Self::TextureDataReceiver) -> Option; + fn recv_texture_data(&self, receiver: &Self::TextureDataReceiver) -> TextureData; + + **This maybe reads?** + fn read_pixels(&self, target: &RenderTarget, viewport: RectI) + -> Self::TextureDataReceiver; + + **This just creates a texture like I do** + fn create_texture_from_png(&self, resources: &dyn ResourceLoader, name: &str) -> Self::Texture; + + **This one just ** + fn create_program_from_shader_names( + &self, + resources: &dyn ResourceLoader, + program_name: &str, + vertex_shader_name: &str, + fragment_shader_name: &str, + ) -> Self::Program { + let vertex_shader = self.create_shader(resources, vertex_shader_name, ShaderKind::Vertex); + let fragment_shader = + self.create_shader(resources, fragment_shader_name, ShaderKind::Fragment); + self.create_program_from_shaders(resources, program_name, vertex_shader, fragment_shader) + } + + fn create_program(&self, resources: &dyn ResourceLoader, name: &str) -> Self::Program { + self.create_program_from_shader_names(resources, name, name, name) + } +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum TextureFormat { + R8, + R16F, + RGBA8, + RGBA16F, + RGBA32F, +} + +#[derive(Clone, Copy, Debug)] +pub enum VertexAttrType { + F32, + I16, + I8, + U16, + U8, +} + +#[derive(Clone, Copy, Debug)] +pub enum BufferData<'a, T> { + Uninitialized(usize), + Memory(&'a [T]), +} + +#[derive(Clone, Copy, Debug)] +pub enum BufferTarget { + Vertex, + Index, +} + +#[derive(Clone, Copy, Debug)] +pub enum BufferUploadMode { + Static, + Dynamic, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum ShaderKind { + Vertex, + Fragment, +} + +#[derive(Clone, Copy)] +pub enum UniformData { + Float(f32), + IVec3([i32; 3]), + Int(i32), + Mat2(F32x4), + Mat4([F32x4; 4]), + Vec2(F32x2), + Vec3([f32; 3]), + Vec4(F32x4), + TextureUnit(u32), +} + +#[derive(Clone, Copy)] +pub enum Primitive { + Triangles, + Lines, +} + +#[derive(Clone)] +pub struct RenderState<'a, D> where D: Device { + pub target: &'a RenderTarget<'a, D>, + pub program: &'a D::Program, + pub vertex_array: &'a D::VertexArray, + pub primitive: Primitive, + pub uniforms: &'a [(&'a D::Uniform, UniformData)], + pub textures: &'a [&'a D::Texture], + pub viewport: RectI, + pub options: RenderOptions, +} + +#[derive(Clone, Debug)] +pub struct RenderOptions { + pub blend: Option, + pub depth: Option, + pub stencil: Option, + pub clear_ops: ClearOps, + pub color_mask: bool, +} + +#[derive(Clone, Copy, Debug, Default)] +pub struct ClearOps { + pub color: Option, + pub depth: Option, + pub stencil: Option, +} + +#[derive(Clone, Copy, Debug)] +pub enum RenderTarget<'a, D> where D: Device { + Default, + Framebuffer(&'a D::Framebuffer), +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct BlendState { + pub dest_rgb_factor: BlendFactor, + pub dest_alpha_factor: BlendFactor, + pub src_rgb_factor: BlendFactor, + pub src_alpha_factor: BlendFactor, + pub op: BlendOp, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum BlendFactor { + Zero, + One, + SrcAlpha, + OneMinusSrcAlpha, + DestAlpha, + OneMinusDestAlpha, + DestColor, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum BlendOp { + Add, + Subtract, + ReverseSubtract, + Min, + Max, +} + +#[derive(Clone, Copy, Default, Debug)] +pub struct DepthState { + pub func: DepthFunc, + pub write: bool, +} + +#[derive(Clone, Copy, Debug)] +pub enum DepthFunc { + Less, + Always, +} + +#[derive(Clone, Copy, Debug)] +pub struct StencilState { + pub func: StencilFunc, + pub reference: u32, + pub mask: u32, + pub write: bool, +} + +#[derive(Clone, Copy, Debug)] +pub enum StencilFunc { + Always, + Equal, +} + +impl Default for RenderOptions { + #[inline] + fn default() -> RenderOptions { + RenderOptions { + blend: None, + depth: None, + stencil: None, + clear_ops: ClearOps::default(), + color_mask: true, + } + } +} + +impl Default for BlendOp { + #[inline] + fn default() -> BlendOp { + BlendOp::Add + } +} + +impl Default for StencilState { + #[inline] + fn default() -> StencilState { + StencilState { + func: StencilFunc::default(), + reference: 0, + mask: !0, + write: false, + } + } +} + +impl Default for DepthFunc { + #[inline] + fn default() -> DepthFunc { + DepthFunc::Less + } +} + +impl Default for StencilFunc { + #[inline] + fn default() -> StencilFunc { + StencilFunc::Always + } +} + +#[derive(Clone, Debug)] +pub enum TextureData { + U8(Vec), + U16(Vec), + F16(Vec), + F32(Vec), +} + +#[derive(Clone, Copy, Debug)] +pub enum TextureDataRef<'a> { + U8(&'a [u8]), + F16(&'a [f16]), + F32(&'a [f32]), +} + +impl UniformData { + #[inline] + pub fn from_transform_3d(transform: &Transform4F) -> UniformData { + UniformData::Mat4([transform.c0, transform.c1, transform.c2, transform.c3]) + } +} + +#[derive(Clone, Copy, Debug)] +pub struct VertexAttrDescriptor { + pub size: usize, + pub class: VertexAttrClass, + pub attr_type: VertexAttrType, + pub stride: usize, + pub offset: usize, + pub divisor: u32, + pub buffer_index: u32, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum VertexAttrClass { + Float, + FloatNorm, + Int, +} + +impl TextureFormat { + #[inline] + pub fn channels(self) -> usize { + match self { + TextureFormat::R8 | TextureFormat::R16F => 1, + TextureFormat::RGBA8 | TextureFormat::RGBA16F | TextureFormat::RGBA32F => 4, + } + } + + #[inline] + pub fn bytes_per_pixel(self) -> usize { + match self { + TextureFormat::R8 => 1, + TextureFormat::R16F => 2, + TextureFormat::RGBA8 => 4, + TextureFormat::RGBA16F => 8, + TextureFormat::RGBA32F => 16, + } + } +} + +impl ClearOps { + #[inline] + pub fn has_ops(&self) -> bool { + self.color.is_some() || self.depth.is_some() || self.stencil.is_some() + } +} + +impl Default for BlendState { + #[inline] + fn default() -> BlendState { + BlendState { + src_rgb_factor: BlendFactor::One, + dest_rgb_factor: BlendFactor::OneMinusSrcAlpha, + src_alpha_factor: BlendFactor::One, + dest_alpha_factor: BlendFactor::One, + op: BlendOp::Add, + } + } +} + +bitflags! { + pub struct TextureSamplingFlags: u8 { + const REPEAT_U = 0x01; + const REPEAT_V = 0x02; + const NEAREST_MIN = 0x04; + const NEAREST_MAG = 0x08; + } +} + +impl<'a> TextureDataRef<'a> { + #[doc(hidden)] + pub fn check_and_extract_data_ptr(self, minimum_size: Vector2I, format: TextureFormat) + -> *const c_void { + let channels = match (format, self) { + (TextureFormat::R8, TextureDataRef::U8(_)) => 1, + (TextureFormat::RGBA8, TextureDataRef::U8(_)) => 4, + (TextureFormat::RGBA16F, TextureDataRef::F16(_)) => 4, + (TextureFormat::RGBA32F, TextureDataRef::F32(_)) => 4, + _ => panic!("Unimplemented texture format!"), + }; + + let area = minimum_size.x() as usize * minimum_size.y() as usize; + + match self { + TextureDataRef::U8(data) => { + assert!(data.len() >= area * channels); + data.as_ptr() as *const c_void + } + TextureDataRef::F16(data) => { + assert!(data.len() >= area * channels); + data.as_ptr() as *const c_void + } + TextureDataRef::F32(data) => { + assert!(data.len() >= area * channels); + data.as_ptr() as *const c_void + } + } + } +} diff --git a/resources/shaders/simple_text.frag b/resources/shaders/simple_text.frag index a2eeabc6..ed4e2a74 100644 --- a/resources/shaders/simple_text.frag +++ b/resources/shaders/simple_text.frag @@ -9,14 +9,18 @@ layout(location = 0) out vec4 f_color; void main() { - if (out_color.w >= 1.004) { + if (out_color.w >= 1.5/255.0) { - f_color = out_color; + //f_color = out_color; //f_color.w = 1.0; } else { - f_color = f_color; - f_color.w = 0.0; + //f_color = f_color; + //f_color.w = 0.0; + //f_color = vec4(0.0,0.0,0.0,0.0); } + f_color.rgb = out_color.rgb; + f_color.a = out_color.a; + //f_color = out_color; } diff --git a/src/canvas/canvas_state.rs b/src/canvas/canvas_state.rs index 530a5ade..f29ec56b 100644 --- a/src/canvas/canvas_state.rs +++ b/src/canvas/canvas_state.rs @@ -465,7 +465,7 @@ impl CanvasState { // Specify the color to clear the framebuffer with i.e. blue let clear_values = vec!( - ClearValue::Float([0.0, 0.0, 1.0, 1.0]), + ClearValue::Float([0.0, 0.0, 0.0, 0.0]), ClearValue::DepthStencil((1.0, 0x00)), ); @@ -500,6 +500,7 @@ impl CanvasState { ).unwrap(); } + // Images let mut shader = self.shader_buffers.get( self.get_shader_handle(String::from("simple_image")) @@ -604,7 +605,6 @@ impl CanvasState { ).unwrap(); } - command_buffer .end_render_pass() .unwrap() diff --git a/src/canvas/managed/shader/shader_common.rs b/src/canvas/managed/shader/shader_common.rs index 3133160f..14c5a8f1 100644 --- a/src/canvas/managed/shader/shader_common.rs +++ b/src/canvas/managed/shader/shader_common.rs @@ -65,7 +65,7 @@ pub trait CompiledShaderResources { fn compile(filepath: PathBuf, device: Arc, shader_type: ShaderType) -> (Entry, Arc) { - let compiled_shader = shade_runner::load(filepath, Self::convert_sr(shader_type)) + let compiled_shader = shade_runner::load(filepath, None, Self::convert_sr(shader_type), None) .expect("Shader didn't compile"); let vulkano_entry = diff --git a/src/canvas/managed/shader/text_shader.rs b/src/canvas/managed/shader/text_shader.rs index f5abd60f..28bfceb7 100644 --- a/src/canvas/managed/shader/text_shader.rs +++ b/src/canvas/managed/shader/text_shader.rs @@ -106,6 +106,8 @@ impl CompiledShader for TextShader { let blend = AttachmentBlend { enabled: true, color_op: BlendOp::Add, + // color_source: BlendFactor::SrcAlpha, + // color_destination: BlendFactor::OneMinusSrcAlpha, color_source: BlendFactor::One, color_destination: BlendFactor::One, alpha_op: BlendOp::Add, @@ -140,8 +142,9 @@ impl CompiledShader for TextShader { third_constant: 0.0, }) - .depth_stencil_simple_depth() - .blend_collective(blend) + .depth_stencil(stencil) +// .blend_collective(blend) + //.blend_logic_op(LogicOp::Noop) // We have to indicate which subpass of which render pass this pipeline is going to be used // in. The pipeline will only be usable from this particular subpass. diff --git a/src/drawables/text.rs b/src/drawables/text.rs index 7db11134..7e53359a 100644 --- a/src/drawables/text.rs +++ b/src/drawables/text.rs @@ -12,108 +12,118 @@ pub struct Text { /// Container class which implements drawable. impl Text { + + fn accumulator(depth: f32, accumulator: &mut f32, constant: f32) -> f32{ + + let accum = *accumulator; + *accumulator += constant; + return depth + accum + constant; + } /// pub fn new(position: (f32, f32), size: (f32, f32), depth: u32) -> Text { let normalized_depth = (depth as f32 / 255.0); + let mut depth_accumulator = 1.0; + let depth_accum_constant = -0.01 as f32; + let verts = { vec![ ColorVertex3D { - v_position: [-0.5, -0.5, normalized_depth], - color: [1.0, 1.0, 1.0, 1.0/255.0], + v_position: [-0.5, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)+0.1], + color: [1.0, 0.0, 0.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)+0.1], color: [1.0, 0.8, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-0.25, 0.0, normalized_depth], + v_position: [-0.25, 0.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)+0.1], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-0.25, 0.0, normalized_depth], + v_position: [-0.25, 0.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [0.8, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.0, 0.5, normalized_depth], + v_position: [0.0, 0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 0.8, 1.0/255.0], }, ColorVertex3D { - v_position: [0.25, 0.0, normalized_depth], + v_position: [0.25, 0.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 0.8, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.0, 0.5, normalized_depth], + v_position: [0.0, 0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.5, -0.5, normalized_depth], + v_position: [0.5, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.25, 0.0, normalized_depth], + v_position: [0.25, 0.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.25, -0.5, normalized_depth], + v_position: [0.25, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.5, -0.5, normalized_depth], + v_position: [0.5, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.25, -0.5, normalized_depth], + v_position: [0.25, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.0, -0.1, normalized_depth], + v_position: [0.0, -0.1, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-0.25, -0.5, normalized_depth], + v_position: [-0.25, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [0.0, -0.1, normalized_depth], + v_position: [0.0, -0.1, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-0.5, -0.5, normalized_depth], + v_position: [-0.5, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-1.0, 1.0, normalized_depth], + v_position: [-1.0, 1.0, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }, ColorVertex3D { - v_position: [-0.25, -0.5, normalized_depth], + v_position: [-0.25, -0.5, Text::accumulator(normalized_depth, &mut depth_accumulator, depth_accum_constant)], color: [1.0, 1.0, 1.0, 1.0/255.0], }] };