Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
maxammann committed Nov 11, 2024
1 parent 3fbe3c1 commit e684984
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 47 deletions.
2 changes: 1 addition & 1 deletion maplibre/src/sdf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ mod resource;
mod resource_system;
mod upload_system;

pub mod text;
pub mod tessellation;
pub mod tessellation_new;
pub mod text;

struct SymbolPipeline(wgpu::RenderPipeline);

Expand Down
65 changes: 27 additions & 38 deletions maplibre/src/sdf/tessellation_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ use geozero::{
};
use lyon::{
geom::euclid::{Box2D, Point2D},
tessellation::{VertexBuffers},
tessellation::VertexBuffers,
};

use crate::{
euclid::{Rect, Size2D},
legacy::{
bidi::Char16,
buckets::symbol_bucket::SymbolBucketBuffer,
font_stack::FontStackHasher,
geometry_tile_data::{GeometryCoordinates, SymbolGeometryTileLayer},
glyph::{Glyph, GlyphDependencies, GlyphMap, GlyphMetrics, Glyphs},
Expand All @@ -27,15 +28,12 @@ use crate::{
symbol_layout::{FeatureIndex, LayerProperties, SymbolLayer, SymbolLayout},
},
style_types::SymbolLayoutProperties_Unevaluated,
tagged_string::SectionOptions,
CanonicalTileID, MapMode, OverscaledTileID, TileSpace,
},
render::shaders::ShaderSymbolVertexNew,
sdf::Feature,
sdf::{tessellation::IndexDataType, text::GlyphSet, Feature},
};
use crate::legacy::buckets::symbol_bucket::SymbolBucketBuffer;
use crate::legacy::tagged_string::SectionOptions;
use crate::sdf::tessellation::IndexDataType;
use crate::sdf::text::GlyphSet;

type GeoResult<T> = geozero::error::Result<T>;

Expand Down Expand Up @@ -83,9 +81,7 @@ impl TextTessellatorNew {
name: layer_name.clone(),
features: vec![SymbolGeometryTileFeature::new(Box::new(
VectorGeometryTileFeature {
geometry: vec![GeometryCoordinates(vec![Point2D::new(
512, 512,
)])],
geometry: vec![GeometryCoordinates(vec![Point2D::new(512, 512)])],
},
))],
};
Expand All @@ -98,8 +94,8 @@ impl TextTessellatorNew {

let image_positions = ImagePositions::new();

let glyph_map = GlyphPositionMap::from_iter(glyphs.glyphs.iter().map(
|(unicode_point, glyph)| {
let glyph_map =
GlyphPositionMap::from_iter(glyphs.glyphs.iter().map(|(unicode_point, glyph)| {
(
*unicode_point as Char16,
GlyphPosition {
Expand All @@ -122,32 +118,29 @@ impl TextTessellatorNew {
},
},
)
},
));
}));

let glyph_positions: GlyphPositions =
GlyphPositions::from([(FontStackHasher::new(&font_stack), glyph_map)]);

let glyphs: GlyphMap = GlyphMap::from([(
FontStackHasher::new(&font_stack),
Glyphs::from_iter(glyphs.glyphs.iter().map(
|(unicode_point, glyph)| {
(
*unicode_point as Char16,
Some(Glyph {
id: *unicode_point as Char16,
bitmap: Default::default(),
metrics: GlyphMetrics {
width: glyph.width,
height: glyph.height,
left: glyph.left_bearing,
top: glyph.top_bearing,
advance: glyph.h_advance,
},
}),
)
},
)),
Glyphs::from_iter(glyphs.glyphs.iter().map(|(unicode_point, glyph)| {
(
*unicode_point as Char16,
Some(Glyph {
id: *unicode_point as Char16,
bitmap: Default::default(),
metrics: GlyphMetrics {
width: glyph.width,
height: glyph.height,
left: glyph.left_bearing,
top: glyph.top_bearing,
advance: glyph.h_advance,
},
}),
)
})),
)]);

let mut layout = SymbolLayout::new(
Expand All @@ -161,7 +154,7 @@ impl TextTessellatorNew {
available_images: &mut Default::default(),
},
)
.unwrap();
.unwrap();

assert_eq!(glyph_dependencies.len(), 1);

Expand Down Expand Up @@ -254,9 +247,7 @@ impl GeomProcessor for TextTessellatorNew {
}
}

impl PropertyProcessor
for TextTessellatorNew
{
impl PropertyProcessor for TextTessellatorNew {
fn property(
&mut self,
_idx: usize,
Expand All @@ -276,9 +267,7 @@ impl PropertyProcessor
}
}

impl FeatureProcessor
for TextTessellatorNew
{
impl FeatureProcessor for TextTessellatorNew {
fn feature_end(&mut self, _idx: u64) -> geozero::error::Result<()> {
let geometry = self.geo_writer.take_geometry();

Expand Down
11 changes: 3 additions & 8 deletions maplibre/src/vector/process_vector.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use std::{
borrow::Cow,
collections::{HashSet},
marker::PhantomData,
};
use std::{borrow::Cow, collections::HashSet, marker::PhantomData};

use geozero::{
mvt::{tile, Message},
Expand All @@ -20,7 +16,7 @@ use crate::{
shaders::{ShaderSymbolVertex, ShaderSymbolVertexNew},
ShaderVertex,
},
sdf::{tessellation::TextTessellator, Feature},
sdf::{tessellation::TextTessellator, tessellation_new::TextTessellatorNew, Feature},
style::layer::{LayerPaint, StyleLayer},
vector::{
tessellation::{IndexDataType, OverAlignedVertexBuffer, ZeroTessellator},
Expand All @@ -30,7 +26,6 @@ use crate::{
},
},
};
use crate::sdf::tessellation_new::TextTessellatorNew;

#[derive(Error, Debug)]
pub enum ProcessVectorError {
Expand Down Expand Up @@ -214,7 +209,7 @@ impl<T: VectorTransferables, C: Context> ProcessVectorContext<T, C> {
layer_data: tile::Layer,
) -> Result<(), ProcessVectorError> {
self.context
.send(T::SymbolLayerTessellated::build_from(
.send_back(T::SymbolLayerTessellated::build_from(
*coords, buffer, new_buffer, features, layer_data,
))
.map_err(|e| ProcessVectorError::SendError(e))
Expand Down

0 comments on commit e684984

Please sign in to comment.