|
|
@@ -38,12 +38,17 @@ impl GlobeTileLayer {
|
|
38
|
38
|
program.add_attribute(
|
|
39
|
39
|
cx,
|
|
40
|
40
|
CStr::from_bytes_with_nul(b"position\0").unwrap(),
|
|
41
|
|
- &VertexAttribParams::new(3, 5, 0)
|
|
|
41
|
+ &VertexAttribParams::new(3, 9, 0)
|
|
42
|
42
|
);
|
|
43
|
43
|
program.add_attribute(
|
|
44
|
44
|
cx,
|
|
45
|
45
|
CStr::from_bytes_with_nul(b"tex_coord\0").unwrap(),
|
|
46
|
|
- &VertexAttribParams::new(2, 5, 3)
|
|
|
46
|
+ &VertexAttribParams::new(2, 9, 3)
|
|
|
47
|
+ );
|
|
|
48
|
+ program.add_attribute(
|
|
|
49
|
+ cx,
|
|
|
50
|
+ CStr::from_bytes_with_nul(b"tex_minmax\0").unwrap(),
|
|
|
51
|
+ &VertexAttribParams::new(4, 9, 5)
|
|
47
|
52
|
);
|
|
48
|
53
|
check_gl_errors!(cx);
|
|
49
|
54
|
|
|
|
@@ -115,12 +120,22 @@ impl GlobeTileLayer {
|
|
115
|
120
|
|
|
116
|
121
|
let rot_mat = Transform::<Point3<f32>>::concat(&rot_mat_y, &rot_mat_x);
|
|
117
|
122
|
|
|
|
123
|
+ let (inset_x, inset_y) = tile_atlas.texture_margins();
|
|
|
124
|
+
|
|
118
|
125
|
for tile_y in 0..16 {
|
|
119
|
126
|
for tile_x in 0..16 {
|
|
120
|
127
|
let tc = TileCoord::new(4, tile_x, tile_y);
|
|
121
|
128
|
let slot = tile_atlas.store(cx, tc, source, cache, true)
|
|
122
|
129
|
.unwrap_or_else(TileAtlas::default_slot);
|
|
123
|
130
|
let texrect = tile_atlas.slot_to_texture_rect(slot);
|
|
|
131
|
+ let tex_minmax = texrect.inset(inset_x, inset_y);
|
|
|
132
|
+
|
|
|
133
|
+ let minmax = [
|
|
|
134
|
+ tex_minmax.x1 as f32,
|
|
|
135
|
+ tex_minmax.y1 as f32,
|
|
|
136
|
+ tex_minmax.x2 as f32,
|
|
|
137
|
+ tex_minmax.y2 as f32,
|
|
|
138
|
+ ];
|
|
124
|
139
|
|
|
125
|
140
|
for &(tc, sub_tile_a) in &tc.children() {
|
|
126
|
141
|
for &(tc, sub_tile_b) in &tc.children() {
|
|
|
@@ -157,11 +172,17 @@ impl GlobeTileLayer {
|
|
157
|
172
|
let p4 = [p4.x as f32, p4.y as f32, p4.z as f32, texrect.x1 as f32, texrect.y2 as f32];
|
|
158
|
173
|
|
|
159
|
174
|
vertex_data.extend(&p1);
|
|
|
175
|
+ vertex_data.extend(&minmax);
|
|
160
|
176
|
vertex_data.extend(&p2);
|
|
|
177
|
+ vertex_data.extend(&minmax);
|
|
161
|
178
|
vertex_data.extend(&p3);
|
|
|
179
|
+ vertex_data.extend(&minmax);
|
|
162
|
180
|
vertex_data.extend(&p1);
|
|
|
181
|
+ vertex_data.extend(&minmax);
|
|
163
|
182
|
vertex_data.extend(&p3);
|
|
|
183
|
+ vertex_data.extend(&minmax);
|
|
164
|
184
|
vertex_data.extend(&p4);
|
|
|
185
|
+ vertex_data.extend(&minmax);
|
|
165
|
186
|
}
|
|
166
|
187
|
}
|
|
167
|
188
|
}
|