poc window decorations
This commit is contained in:
@@ -10,8 +10,8 @@ use crate::{
|
||||
globals::Globals,
|
||||
layout::Widget,
|
||||
renderer_vk::text::{
|
||||
TextShadow,
|
||||
custom_glyph::{CustomGlyph, CustomGlyphData},
|
||||
TextShadow,
|
||||
},
|
||||
stack::{self, ScissorBoundary, ScissorStack, TransformStack},
|
||||
widget::{self, ScrollbarInfo, WidgetState},
|
||||
@@ -147,6 +147,11 @@ impl Color {
|
||||
let a = (self.a.clamp(0.0, 1.0) * 255.0).round() as u8;
|
||||
format!("#{r:02X}{g:02X}{b:02X}{a:02X}")
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn as_arr(&self) -> [f32; 4] {
|
||||
[self.r, self.b, self.g, self.a]
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Color {
|
||||
|
||||
@@ -13,12 +13,12 @@ use vulkano::{
|
||||
view::ImageView,
|
||||
},
|
||||
pipeline::{
|
||||
Pipeline, PipelineBindPoint,
|
||||
graphics::{self, vertex_input::Vertex, viewport::Viewport},
|
||||
Pipeline, PipelineBindPoint,
|
||||
},
|
||||
};
|
||||
|
||||
use super::{WGfx, pipeline::WGfxPipeline};
|
||||
use super::{pipeline::WGfxPipeline, WGfx};
|
||||
|
||||
pub struct WGfxPass<V> {
|
||||
pub command_buffer: Arc<SecondaryAutoCommandBuffer>,
|
||||
@@ -34,6 +34,7 @@ where
|
||||
pub(super) fn new(
|
||||
pipeline: &Arc<WGfxPipeline<V>>,
|
||||
dimensions: [f32; 2],
|
||||
offset: [f32; 2],
|
||||
vertex_buffer: Subbuffer<[V]>,
|
||||
vertices: Range<u32>,
|
||||
instances: Range<u32>,
|
||||
@@ -41,7 +42,7 @@ where
|
||||
vk_scissor: &graphics::viewport::Scissor,
|
||||
) -> anyhow::Result<Self> {
|
||||
let viewport = Viewport {
|
||||
offset: [0.0, 0.0],
|
||||
offset,
|
||||
extent: dimensions,
|
||||
depth_range: 0.0..=1.0,
|
||||
};
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use std::{marker::PhantomData, ops::Range, sync::Arc};
|
||||
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use vulkano::{
|
||||
buffer::{
|
||||
BufferContents, BufferUsage, Subbuffer,
|
||||
allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
|
||||
BufferContents, BufferUsage, Subbuffer,
|
||||
},
|
||||
descriptor_set::{
|
||||
DescriptorSet, WriteDescriptorSet,
|
||||
layout::{DescriptorBindingFlags, DescriptorSetLayoutCreateFlags},
|
||||
DescriptorSet, WriteDescriptorSet,
|
||||
},
|
||||
format::Format,
|
||||
image::{
|
||||
@@ -17,9 +17,8 @@ use vulkano::{
|
||||
},
|
||||
memory::allocator::MemoryTypeFilter,
|
||||
pipeline::{
|
||||
DynamicState, GraphicsPipeline, Pipeline, PipelineLayout,
|
||||
graphics::{
|
||||
self, GraphicsPipelineCreateInfo,
|
||||
self,
|
||||
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
|
||||
input_assembly::{InputAssemblyState, PrimitiveTopology},
|
||||
multisample::MultisampleState,
|
||||
@@ -27,13 +26,15 @@ use vulkano::{
|
||||
subpass::PipelineRenderingCreateInfo,
|
||||
vertex_input::{Vertex, VertexDefinition, VertexInputState},
|
||||
viewport::ViewportState,
|
||||
GraphicsPipelineCreateInfo,
|
||||
},
|
||||
layout::PipelineDescriptorSetLayoutCreateInfo,
|
||||
DynamicState, GraphicsPipeline, Pipeline, PipelineLayout,
|
||||
},
|
||||
shader::{EntryPoint, ShaderModule},
|
||||
};
|
||||
|
||||
use super::{WGfx, pass::WGfxPass};
|
||||
use super::{pass::WGfxPass, WGfx};
|
||||
|
||||
pub struct WGfxPipeline<V> {
|
||||
pub graphics: Arc<WGfx>,
|
||||
@@ -266,6 +267,7 @@ where
|
||||
pub fn create_pass(
|
||||
self: &Arc<Self>,
|
||||
dimensions: [f32; 2],
|
||||
offset: [f32; 2],
|
||||
vertex_buffer: Subbuffer<[V]>,
|
||||
vertices: Range<u32>,
|
||||
instances: Range<u32>,
|
||||
@@ -275,6 +277,7 @@ where
|
||||
WGfxPass::new(
|
||||
&self.clone(),
|
||||
dimensions,
|
||||
offset,
|
||||
vertex_buffer,
|
||||
vertices,
|
||||
instances,
|
||||
|
||||
@@ -200,6 +200,7 @@ impl ImageRenderer {
|
||||
|
||||
let pass = self.pipeline.inner.create_pass(
|
||||
[res[0] as _, res[1] as _],
|
||||
[0.0, 0.0],
|
||||
vert_buffer.clone(),
|
||||
0..4,
|
||||
0..1,
|
||||
|
||||
@@ -10,10 +10,10 @@ use vulkano::{
|
||||
use crate::{
|
||||
drawing::{Boundary, Rectangle},
|
||||
gfx::{
|
||||
BLEND_ALPHA, WGfx,
|
||||
cmd::GfxCommandBuffer,
|
||||
pass::WGfxPass,
|
||||
pipeline::{WGfxPipeline, WPipelineCreateInfo},
|
||||
WGfx, BLEND_ALPHA,
|
||||
},
|
||||
renderer_vk::model_buffer::ModelBuffer,
|
||||
};
|
||||
@@ -151,6 +151,7 @@ impl RectRenderer {
|
||||
let set1 = self.model_buffer.get_rect_descriptor(&self.pipeline);
|
||||
let pass = self.pipeline.color_rect.create_pass(
|
||||
[res[0] as _, res[1] as _],
|
||||
[0.0, 0.0],
|
||||
self.vert_buffer.clone(),
|
||||
0..4,
|
||||
0..self.rect_vertices.len() as _,
|
||||
|
||||
@@ -4,9 +4,9 @@ use crate::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
ContentType, FontSystem, GlyphDetails, GpuCacheStatus, SwashCache, TextArea,
|
||||
custom_glyph::{CustomGlyphCacheKey, RasterizeCustomGlyphRequest, RasterizedCustomGlyph},
|
||||
text_atlas::{GlyphVertex, TextAtlas, TextPipeline},
|
||||
ContentType, FontSystem, GlyphDetails, GpuCacheStatus, SwashCache, TextArea,
|
||||
};
|
||||
use cosmic_text::{Color, SubpixelBin, SwashContent};
|
||||
use etagere::size2;
|
||||
@@ -272,6 +272,7 @@ impl TextRenderer {
|
||||
|
||||
let pass = self.pipeline.inner.create_pass(
|
||||
[res[0] as _, res[1] as _],
|
||||
[0.0, 0.0],
|
||||
self.vertex_buffer.clone(),
|
||||
0..4,
|
||||
0..self.glyph_vertices.len() as u32,
|
||||
|
||||
Reference in New Issue
Block a user