remove proj

This commit is contained in:
Tsuki 2024-09-24 19:59:42 +08:00
parent 664223d199
commit 6b68aedc2a
24 changed files with 1069 additions and 335 deletions

BIN
.DS_Store vendored

Binary file not shown.

170
Cargo.lock generated
View File

@ -354,29 +354,6 @@ version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bindgen"
version = "0.66.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
dependencies = [
"bitflags 2.6.0",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"prettyplease",
"proc-macro2 1.0.86",
"quote 1.0.37",
"regex",
"rustc-hash",
"shlex",
"syn 2.0.75",
"which",
]
[[package]] [[package]]
name = "bit_field" name = "bit_field"
version = "0.10.2" version = "0.10.2"
@ -662,15 +639,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "cfg-expr" name = "cfg-expr"
version = "0.15.8" version = "0.15.8"
@ -816,17 +784,6 @@ dependencies = [
"inout", "inout",
] ]
[[package]]
name = "clang-sys"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
"libloading 0.8.5",
]
[[package]] [[package]]
name = "clipboard-win" name = "clipboard-win"
version = "3.1.1" version = "3.1.1"
@ -837,15 +794,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "cmake"
version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.24.1" version = "0.24.1"
@ -1392,18 +1340,6 @@ dependencies = [
"rustc_version", "rustc_version",
] ]
[[package]]
name = "filetime"
version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550"
dependencies = [
"cfg-if",
"libc",
"libredox 0.1.3",
"windows-sys 0.59.0",
]
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.32" version = "1.0.32"
@ -2054,12 +1990,6 @@ dependencies = [
"system-deps 7.0.2", "system-deps 7.0.2",
] ]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]] [[package]]
name = "glow" name = "glow"
version = "0.13.1" version = "0.13.1"
@ -2425,15 +2355,6 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.12" version = "0.2.12"
@ -2788,12 +2709,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "leak" name = "leak"
version = "0.1.2" version = "0.1.2"
@ -2908,7 +2823,6 @@ checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"libc", "libc",
"redox_syscall 0.5.3",
] ]
[[package]] [[package]]
@ -3829,12 +3743,6 @@ dependencies = [
"sha2", "sha2",
] ]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.1" version = "2.3.1"
@ -3962,16 +3870,6 @@ dependencies = [
"zerocopy", "zerocopy",
] ]
[[package]]
name = "prettyplease"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
dependencies = [
"proc-macro2 1.0.86",
"syn 2.0.75",
]
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "1.3.1" version = "1.3.1"
@ -4064,32 +3962,6 @@ dependencies = [
"syn 2.0.75", "syn 2.0.75",
] ]
[[package]]
name = "proj"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ad1830ad8966eba22c76e78440458f07bd812bef5c3efdf335dec55cd1085ab"
dependencies = [
"geo-types",
"libc",
"num-traits",
"proj-sys",
"thiserror",
]
[[package]]
name = "proj-sys"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "601bf4fa1e17fde1a56d303f7bed5c65969cf1822c6baf5d6c2c12c593638fec"
dependencies = [
"bindgen",
"cmake",
"flate2",
"pkg-config",
"tar",
]
[[package]] [[package]]
name = "py_literal" name = "py_literal"
version = "0.4.0" version = "0.4.0"
@ -4199,8 +4071,6 @@ dependencies = [
"dirs", "dirs",
"ndarray 0.16.1", "ndarray 0.16.1",
"num-traits", "num-traits",
"proj",
"proj-sys",
"quick_cache 0.6.5", "quick_cache 0.6.5",
"radarg_plugin_interface", "radarg_plugin_interface",
"relm4", "relm4",
@ -4579,12 +4449,6 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.0" version = "0.4.0"
@ -5216,17 +5080,6 @@ dependencies = [
"version-compare", "version-compare",
] ]
[[package]]
name = "tar"
version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]] [[package]]
name = "target-lexicon" name = "target-lexicon"
version = "0.12.16" version = "0.12.16"
@ -6071,18 +5924,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]] [[package]]
name = "wide" name = "wide"
version = "0.7.28" version = "0.7.28"
@ -6508,17 +6349,6 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
[[package]]
name = "xattr"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f"
dependencies = [
"libc",
"linux-raw-sys",
"rustix",
]
[[package]] [[package]]
name = "xcursor" name = "xcursor"
version = "0.3.8" version = "0.3.8"

View File

@ -1,3 +1,7 @@
[common]
background = "Terrain"
path = "/Users/tsuki/projects/radar-gb/resources/alts.png"
[[cmap]] [[cmap]]
type = "DBZ" type = "DBZ"
levels = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75] levels = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75]

View File

@ -1,6 +1,6 @@
use cgmath::Euler; use cgmath::Euler;
use glow::NativeProgram; use glow::NativeProgram;
use nalgebra_glm::{look_at, Mat4x4, Vec3}; use nalgebra_glm::{look_at, Mat3, Mat3x3, Mat4x4, Vec3};
use std::num::NonZeroU32; use std::num::NonZeroU32;
#[derive(Clone)] #[derive(Clone)]
@ -46,12 +46,20 @@ impl Camera {
} }
pub fn get_view_matrix(&self) -> Mat4x4 { pub fn get_view_matrix(&self) -> Mat4x4 {
let l = self.center; look_at(&self.pos, &self.center, &self.upward)
look_at(&self.pos, &l, &self.upward) }
// Left-handed coordinate system, for ray tracing
pub fn ca(&self) -> Mat3x3 {
let front = (-self.front()).normalize();
let right = front.cross(&self.upward).normalize();
let up = self.upward;
let result = Mat3x3::from_columns(&[right, up, front]);
result
} }
pub fn front(&self) -> Vec3 { pub fn front(&self) -> Vec3 {
self.center - self.pos self.pos - self.center
} }
} }

View File

@ -24,4 +24,10 @@ pub enum Error {
#[error("Invalid Setting {0}")] #[error("Invalid Setting {0}")]
SettingError(String), SettingError(String),
#[error("IO Error")]
IO {
#[from]
source: std::io::Error,
},
} }

View File

@ -31,7 +31,7 @@ impl Earth {
}) })
} }
fn set_conf(&mut self, gl: &GL, config: &EarthConfig) -> Result<()> { fn set_conf(&mut self, gl: &glow::Context, config: &EarthConfig) -> Result<()> {
unsafe { unsafe {
let sun_loc = self.program.get_uniform_location(gl, "sun_location"); let sun_loc = self.program.get_uniform_location(gl, "sun_location");
gl.uniform_3_f32_slice(sun_loc.as_ref(), &config.sun_location); gl.uniform_3_f32_slice(sun_loc.as_ref(), &config.sun_location);
@ -72,72 +72,12 @@ impl EarthConfig {
} }
fn generate_cube(&self) -> (Vec<f32>, Vec<u32>) { fn generate_cube(&self) -> (Vec<f32>, Vec<u32>) {
let mut vertices = vec![]; let vertices = vec![
let mut indices = vec![]; // positions
-1.0, -1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, 1.0, 1.0, 0.0,
let mut add_vertex = |x: f32, y: f32, z: f32| { ];
vertices.push(x);
vertices.push(y);
vertices.push(z);
};
let mut add_indices = |a: u32, b: u32, c: u32| {
indices.push(a);
indices.push(b);
indices.push(c);
};
let mut add_face = |a: u32, b: u32, c: u32, d: u32| {
add_indices(a, b, c);
add_indices(a, c, d);
};
let r = self.earth_radius;
// Front
add_vertex(-r, -r, r);
add_vertex(r, -r, r);
add_vertex(r, r, r);
add_vertex(-r, r, r);
add_face(0, 1, 2, 3);
// Back
add_vertex(-r, -r, -r);
add_vertex(-r, r, -r);
add_vertex(r, r, -r);
add_vertex(r, -r, -r);
add_face(4, 5, 6, 7);
// Top
add_vertex(-r, r, -r);
add_vertex(-r, r, r);
add_vertex(r, r, r);
add_vertex(r, r, -r);
add_face(8, 9, 10, 11);
// Bottom
add_vertex(-r, -r, -r);
add_vertex(r, -r, -r);
add_vertex(r, -r, r);
add_vertex(-r, -r, r);
add_face(12, 13, 14, 15);
// Right
add_vertex(r, -r, -r);
add_vertex(r, r, -r);
add_vertex(r, r, r);
add_vertex(r, -r, r);
add_face(16, 17, 18, 19);
// Left
add_vertex(-r, -r, -r);
add_vertex(-r, -r, r);
add_vertex(-r, r, r);
add_vertex(-r, r, -r);
add_face(20, 21, 22, 23);
let indices = vec![0, 1, 2, 1, 3, 2];
(vertices, indices) (vertices, indices)
} }
} }
@ -167,7 +107,6 @@ impl Graphics for Earth {
fn draw(&self, gl: &glow::Context, count: i32) -> Result<()> { fn draw(&self, gl: &glow::Context, count: i32) -> Result<()> {
self.attach.bind_self(gl, &self.program); self.attach.bind_self(gl, &self.program);
unsafe { unsafe {
// gl.draw_arrays(glow::POINTS, 0, count);
gl.draw_elements(glow::TRIANGLES, self.attach.len, glow::UNSIGNED_INT, 0); gl.draw_elements(glow::TRIANGLES, self.attach.len, glow::UNSIGNED_INT, 0);
} }
Ok(()) Ok(())
@ -198,6 +137,7 @@ impl Graphics for Earth {
} }
fn set_config(&mut self, gl: &glow::Context, config: &Self::Config) -> Result<()> { fn set_config(&mut self, gl: &glow::Context, config: &Self::Config) -> Result<()> {
self.set_conf(gl, config);
Ok(()) Ok(())
} }
} }

View File

@ -1 +1,2 @@
pub mod earth; pub mod earth;
pub mod terrain;

View File

@ -0,0 +1,199 @@
use glow::HasContext;
use crate::components::Program;
use crate::errors::Result;
use crate::graphics::collections::agg_fast_path::Path;
use crate::graphics::{AttaWithBuffer, Graphics};
use crate::pg::Attach;
use crate::resources::RcGlRcResource;
use crate::shaders::terrain::{TerrainFragment, TerrainVertex};
use crate::GL;
use crate::{components::Shader, shaders::earth::EarthVertex};
pub struct Terrain {
program: Program,
// Buffers
attach: Attach,
}
impl Terrain {
pub fn new(gl: &GL) -> Result<Self> {
let vertex = Shader::new(glow::VERTEX_SHADER, TerrainVertex::new())?;
// let geometry = Shader::new(glow::GEOMETRY_SHADER, EarthGeometry::new())?;
let fragment = Shader::new(glow::FRAGMENT_SHADER, TerrainFragment::new())?;
let config = TerrainConfig::default();
let default_attach = config.create_attach(gl);
let program = Program::new(vertex, fragment, None, "330 core");
Ok(Self {
program,
attach: default_attach,
})
}
fn set_conf(&mut self, gl: &glow::Context, config: &TerrainConfig) -> Result<()> {
unsafe {
let sun_loc = self.program.get_uniform_location(gl, "sun_location");
gl.uniform_3_f32_slice(sun_loc.as_ref(), &config.sun_location);
let er = self.program.get_uniform_location(gl, "ER");
gl.uniform_1_f32(er.as_ref(), config.earth_radius);
let ts = self.program.get_uniform_location(gl, "terrain_scale");
gl.uniform_1_f32(ts.as_ref(), config.terrain_scale);
let tt = self.program.get_uniform_location(gl, "terrain_texture");
if let Some(texture) = &config.terrain_texture {
gl.uniform_1_i32(tt.as_ref(), 0);
gl.active_texture(glow::TEXTURE0);
gl.bind_texture(glow::TEXTURE_2D, Some(texture.native()));
}
}
Ok(())
}
}
pub struct TerrainConfig {
pub earth_radius: f32,
pub sun_location: [f32; 3],
pub terrain_scale: f32,
max_height: f32,
tex_range: [f32; 4],
terrain_texture: Option<RcGlRcResource<glow::NativeTexture>>,
}
impl TerrainConfig {
fn create_attach(&self, gl: &GL) -> Attach {
unsafe {
let vao = gl.create_vertex_array().unwrap();
gl.bind_vertex_array(Some(vao));
let vbo = gl.create_buffer().unwrap();
gl.bind_buffer(glow::ARRAY_BUFFER, Some(vbo));
gl.enable_vertex_attrib_array(0);
gl.vertex_attrib_pointer_f32(0, 3, glow::FLOAT, false, 12, 0);
let ebo = gl.create_buffer().unwrap();
gl.bind_buffer(glow::ELEMENT_ARRAY_BUFFER, Some(ebo));
let mut attach = Attach::new(gl.clone(), vao, vbo, Some(ebo), None, Some(1));
let (vbo, ebo) = self.generate_cube();
attach.bind_data(gl, &vbo, Some(&ebo), ebo.len() as i32, glow::STATIC_DRAW);
attach
}
}
fn generate_cube(&self) -> (Vec<f32>, Vec<u32>) {
let vertices = vec![
// positions
-1.0, -1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, 1.0, 1.0, 0.0,
];
let indices = vec![0, 1, 2, 1, 3, 2];
(vertices, indices)
}
}
impl Default for TerrainConfig {
fn default() -> Self {
Self {
earth_radius: 3.0,
sun_location: [10.0, 0.0, 0.0],
terrain_scale: 1.0,
tex_range: [0.0, 0.0, 0.0, 0.0],
max_height: 1.0,
terrain_texture: None,
}
}
}
impl TerrainConfig {
pub fn set_alt_texture(
&mut self,
gl: &GL,
path: impl AsRef<std::path::Path>,
) -> crate::errors::Result<()> {
let img = image::open(path).unwrap();
let img = img.flipv();
let img = img.to_rgba8();
let (width, height) = img.dimensions();
let data = img.into_raw();
let texture = unsafe {
let texture = gl.create_texture().unwrap();
gl.bind_texture(glow::TEXTURE_2D, Some(texture));
gl.tex_image_2d(
glow::TEXTURE_2D,
0,
glow::RGBA as i32,
width as i32,
height as i32,
0,
glow::RGBA,
glow::UNSIGNED_BYTE,
Some(&data),
);
gl.generate_mipmap(glow::TEXTURE_2D);
texture
};
let result = gl.create_resource_rc_with(texture);
self.terrain_texture = Some(result);
Ok(())
}
}
impl Graphics for Terrain {
const id: &'static str = "Terrain";
type Config = TerrainConfig;
fn compile(&mut self, gl: &glow::Context) -> Result<()> {
self.program.compile(gl)
}
fn destroy(&mut self, gl: &glow::Context) -> Result<()> {
self.program.destroy(gl);
Ok(())
}
fn draw(&self, gl: &glow::Context, count: i32) -> Result<()> {
self.attach.bind_self(gl, &self.program);
unsafe {
gl.draw_elements(glow::TRIANGLES, self.attach.len, glow::UNSIGNED_INT, 0);
}
Ok(())
}
fn mount(&self, gl: &glow::Context) -> Result<()> {
unsafe {
gl.use_program(self.program.native_program);
}
Ok(())
}
fn unmount(&self, gl: &glow::Context) -> Result<()> {
unsafe {
gl.use_program(None);
}
Ok(())
}
fn program_ref(&self) -> &Program {
&self.program
}
fn program_mut(&mut self) -> &mut Program {
&mut self.program
}
fn set_config(&mut self, gl: &glow::Context, config: &Self::Config) -> Result<()> {
self.set_conf(gl, config);
Ok(())
}
}

View File

@ -48,12 +48,13 @@ impl App {
if let Err(e) = self.context.programs.prepare() { if let Err(e) = self.context.programs.prepare() {
error!("prepare failed: {:?}", e); error!("prepare failed: {:?}", e);
} }
let init_modules = self.init_modules(setting)?;
self.init_modules = Some(init_modules);
Ok(()) Ok(())
} }
pub fn set_init_modules(&mut self, modules: ModulePackage) {
self.init_modules = Some(modules);
}
pub fn render<'a>( pub fn render<'a>(
&'a mut self, &'a mut self,
modules: &mut Vec<Rc<RefCell<ModulePackage>>>, modules: &mut Vec<Rc<RefCell<ModulePackage>>>,
@ -79,11 +80,6 @@ impl App {
&mut self.context.programs &mut self.context.programs
} }
fn init_modules(&mut self, setting: &radarg_core::config::Setting) -> Result<ModulePackage> {
let earth_module = self.program().earth();
earth_module.load_data(&(), setting).map(|v| v.into())
}
pub fn supported_modules<'a>( pub fn supported_modules<'a>(
&mut self, &mut self,
data: &'a Value<Data>, data: &'a Value<Data>,

View File

@ -25,7 +25,10 @@ use crate::{
collections::agg_fast_path::AggFastPath, collections::agg_fast_path::AggFastPath,
font::Text, font::Text,
geoquadmesh::GeoQuadMesh, geoquadmesh::GeoQuadMesh,
planet::earth::{self, Earth}, planet::{
earth::{self, Earth},
terrain::Terrain,
},
ppi::PPI, ppi::PPI,
transforms::plane::PlaneTrans, transforms::plane::PlaneTrans,
AttaWithProgram, AttachWithIO, Graphics, AttaWithProgram, AttachWithIO, Graphics,
@ -77,12 +80,15 @@ pub struct Programs {
_line: AggFastPath, _line: AggFastPath,
_geo_quad_mesh: GeoQuadMesh, _geo_quad_mesh: GeoQuadMesh,
_earth: Earth, _earth: Earth,
_terrain: Terrain,
} }
impl Programs { impl Programs {
fn new(gl: GL) -> Result<Self> { fn new(gl: GL) -> Result<Self> {
let font_manager = FontManager::new()?; let font_manager = FontManager::new()?;
let earth = Earth::new(&gl)?; let earth = Earth::new(&gl)?;
let _terrain = Terrain::new(&gl)?;
Ok(Self { Ok(Self {
gl: gl.clone(), gl: gl.clone(),
_ppi: PPI::new()?, _ppi: PPI::new()?,
@ -90,6 +96,7 @@ impl Programs {
_line: AggFastPath::new()?, _line: AggFastPath::new()?,
_geo_quad_mesh: GeoQuadMesh::new()?, _geo_quad_mesh: GeoQuadMesh::new()?,
_earth: earth, _earth: earth,
_terrain,
}) })
} }
@ -99,6 +106,7 @@ impl Programs {
self._text.program_mut().compile(&self.gl)?; self._text.program_mut().compile(&self.gl)?;
self._geo_quad_mesh.program().compile(&self.gl)?; self._geo_quad_mesh.program().compile(&self.gl)?;
self._earth.program_mut().compile(&self.gl)?; self._earth.program_mut().compile(&self.gl)?;
self._terrain.program_mut().compile(&self.gl)?;
Ok(()) Ok(())
} }
@ -108,6 +116,7 @@ impl Programs {
self._line.destroy(&self.gl)?; self._line.destroy(&self.gl)?;
self._geo_quad_mesh.destroy(&self.gl)?; self._geo_quad_mesh.destroy(&self.gl)?;
self._earth.destroy(&self.gl)?; self._earth.destroy(&self.gl)?;
self._terrain.destroy(&self.gl)?;
Ok(()) Ok(())
} }
} }
@ -290,13 +299,15 @@ macro_rules! impl_module_package {
program_impl!( program_impl!(
{ppi | ppi_ref, PPIModule | PPIModuleRef, (_ppi, _text, _line)}, {ppi | ppi_ref, PPIModule | PPIModuleRef, (_ppi, _text, _line)},
{geo_quad_mesh | geo_quad_mesh_ref, GeoQuadMeshModule | GeoQuadMeshModuleRef, (_geo_quad_mesh,_text, _line)}, {geo_quad_mesh | geo_quad_mesh_ref, GeoQuadMeshModule | GeoQuadMeshModuleRef, (_geo_quad_mesh,_text, _line)},
{earth | earth_ref, EarthModule | EarthModuleRef, (_earth)} {earth | earth_ref, EarthModule | EarthModuleRef, (_earth)},
{terrain | terrain_ref, TerrainModule | TerrainModuleRef, (_terrain)}
); );
impl_module_package!( impl_module_package!(
{ppi|ppi_ref,PPIPackage => PPI | PPIModule | PPIModuleRef | PPIModuleConfigComponent}, {ppi|ppi_ref,PPIPackage => PPI | PPIModule | PPIModuleRef | PPIModuleConfigComponent},
{geo_quad_mesh|geo_quad_mesh_ref,GeoQuadMeshPackage => GeoQuadMesh | GeoQuadMeshModule | GeoQuadMeshModuleRef | GeoQuadMeshModuleConfigComponent}, {geo_quad_mesh|geo_quad_mesh_ref,GeoQuadMeshPackage => GeoQuadMesh | GeoQuadMeshModule | GeoQuadMeshModuleRef | GeoQuadMeshModuleConfigComponent},
{earth|earth_ref, EarthModulePackage => Earth| EarthModule | EarthModuleRef | EarthModuleConfigComponent} {earth|earth_ref, EarthModulePackage => Earth| EarthModule | EarthModuleRef | EarthModuleConfigComponent},
{terrain|terrain_ref, TerrainModulePackage => Terrain | TerrainModule | TerrainModuleRef | TerrainModuleConfigComponent}
); );
impl ModulePackage { impl ModulePackage {

View File

@ -81,10 +81,11 @@ impl<'b, 'gl: 'b> Module for EarthModule<'b, 'gl> {
) -> super::Result<()> { ) -> super::Result<()> {
self.earth.mount(&self.gl)?; self.earth.mount(&self.gl)?;
self.earth.set_config(&self.gl, &EarthConfig::default())?; self.earth.set_config(&self.gl, &EarthConfig::default())?;
operation.attach_with_program(&self.gl, self.earth.program_mut()); // operation.attach_with_program(&self.gl, self.earth.program_mut());
// Camera Info // Camera Info
let camera_loc = operation.camera().get_position(); let camera_loc = operation.camera().get_position();
// focal length // focal length
let focal_length = operation.projection().fov(); let focal_length = operation.projection().fov();
let focal_length = 1.0 / ((focal_length / 2.0).to_radians().tan()); let focal_length = 1.0 / ((focal_length / 2.0).to_radians().tan());
@ -104,12 +105,20 @@ impl<'b, 'gl: 'b> Module for EarthModule<'b, 'gl> {
let projection_params = let projection_params =
earth_program.get_uniform_location(&self.gl, "projection_params"); earth_program.get_uniform_location(&self.gl, "projection_params");
let ca = earth_program.get_uniform_location(&self.gl, "ca");
self.gl self.gl
.uniform_3_f32(cloc.as_ref(), camera_loc.x, camera_loc.y, camera_loc.z); .uniform_3_f32(cloc.as_ref(), camera_loc.x, camera_loc.y, camera_loc.z);
self.gl.uniform_1_f32(foc.as_ref(), focal_length); self.gl.uniform_1_f32(foc.as_ref(), focal_length);
self.gl.uniform_2_f32_slice(res.as_ref(), &resolution); self.gl.uniform_2_f32_slice(res.as_ref(), &resolution);
self.gl self.gl
.uniform_2_f32(projection_params.as_ref(), znear, zfar); .uniform_2_f32(projection_params.as_ref(), znear, zfar);
self.gl.uniform_matrix_3_f32_slice(
ca.as_ref(),
false,
operation.camera().ca().as_slice(),
);
} }
self.earth.draw(&self.gl, 1); self.earth.draw(&self.gl, 1);

View File

@ -17,6 +17,7 @@ use std::{cell::RefCell, path::Component, rc::Rc, sync::Arc};
mod earth; mod earth;
mod geoquadmesh; mod geoquadmesh;
mod ppi; mod ppi;
mod terrain;
use crate::errors::*; use crate::errors::*;
pub use geoquadmesh::{ pub use geoquadmesh::{
GeoQuadMeshModule, GeoQuadMeshModuleConfig, GeoQuadMeshModuleConfigComponent, GeoQuadMeshModule, GeoQuadMeshModuleConfig, GeoQuadMeshModuleConfigComponent,
@ -31,6 +32,10 @@ pub use earth::{
EarthModuleRef, EarthModuleRef,
}; };
pub use terrain::{
TerrainModule, TerrainModuleConfigComponent, TerrainModulePackage, TerrainModuleRef,
};
use relm4::Component as RComponent; use relm4::Component as RComponent;
use super::{layout_type::ViewPort, SideBarInputMsg}; use super::{layout_type::ViewPort, SideBarInputMsg};

View File

@ -611,11 +611,11 @@ impl SimpleComponent for PPIModuleConfigComponent {
adw::PreferencesGroup { adw::PreferencesGroup {
set_title:"Show Config", set_title:"Show Config",
set_hexpand:true, set_hexpand:true,
adw::PreferencesRow { adw::ActionRow {
set_title:"Color Line", set_title: "Color Line",
#[wrap(Some)] add_suffix=&gtk::ColorDialogButton {
set_child=&gtk::Box{ set_vexpand:false,
gtk::ColorDialogButton { set_height_request: 10,
set_dialog=&gtk::ColorDialog {}, set_dialog=&gtk::ColorDialog {},
set_rgba: &gtk::gdk::RGBA::new(init_config.line_color[0], init_config.line_color[1],init_config.line_color[2],init_config.line_color[3]), set_rgba: &gtk::gdk::RGBA::new(init_config.line_color[0], init_config.line_color[1],init_config.line_color[2],init_config.line_color[3]),
connect_rgba_notify[sender, config_ref] => move |this| { connect_rgba_notify[sender, config_ref] => move |this| {
@ -625,10 +625,7 @@ impl SimpleComponent for PPIModuleConfigComponent {
sender.output(OutputMsg::Refresh); sender.output(OutputMsg::Refresh);
} }
} }
}
}, },
adw::SpinRow { adw::SpinRow {
set_title: "Line Width", set_title: "Line Width",
set_digits: 1, set_digits: 1,

View File

@ -0,0 +1,168 @@
use geo_macros::{module_ref_impl, ModuleRef};
use glow::HasContext;
use relm4::{
adw::{self, prelude::*},
gtk::{self, prelude::*},
view, ComponentParts, SimpleComponent,
};
use std::{cell::RefCell, rc::Rc, sync::Arc};
use crate::{
graphics::{
planet::terrain::{Terrain, TerrainConfig},
transforms::plane::PlaneTrans,
Graphics,
},
GL,
};
use super::{Module, ModuleCursor};
#[derive(ModuleRef)]
pub struct TerrainModule<'b, 'gl: 'b> {
gl: &'gl GL,
terrain: &'b mut Terrain,
}
impl<'b, 'gl: 'b> TerrainModule<'b, 'gl> {
pub fn name(&self) -> &'static str {
"Terrain"
}
pub fn supported(&self, data: &Arc<radarg_core::Data>) -> bool {
false
}
}
impl<'b, 'gl: 'b> TerrainModuleRef<'b, 'gl> {
pub fn name(&self) -> &'static str {
"Terrain"
}
pub fn supported(&self, data: &Arc<radarg_core::Data>) -> bool {
false
}
}
impl<'b, 'gl: 'b> TerrainModule<'b, 'gl> {
pub fn new(gl: &'gl GL, terrain: &'b mut Terrain) -> Self {
Self { gl, terrain }
}
}
impl<'b, 'gl: 'b> TerrainModuleRef<'b, 'gl> {
pub fn new(gl: &'gl GL, terrain: &'b Terrain) -> Self {
Self { gl, terrain }
}
}
pub struct TerrainModulePackage {
conf: TerrainModulePackageConfig,
}
impl<'b, 'gl: 'b> Module for TerrainModule<'b, 'gl> {
type Cursor = TerrainModulePackage;
type Data = ();
type Operation = PlaneTrans;
const NAME: &'static str = "Terrain";
fn load_data<'dt>(
&self,
data: &Self::Data,
setting: &radarg_core::config::Setting,
) -> super::Result<Self::Cursor> {
let mut conf = TerrainModulePackageConfig::default();
let texture_path = &setting.common.path;
conf.terrain_conf.set_alt_texture(&self.gl, texture_path)?;
Ok(TerrainModulePackage { conf })
}
fn render(
&mut self,
cursor: &mut Self::Cursor,
operation: &crate::ui::operation::Operation<Self::Operation>,
viewport: &crate::pg::layout_type::ViewPort,
) -> super::Result<()> {
self.terrain.mount(&self.gl)?;
let conf = &cursor.conf.terrain_conf;
self.terrain.set_config(&self.gl, conf)?;
// operation.attach_with_program(&self.gl, self.earth.program_mut());
// Camera Info
let camera_loc = operation.camera().get_position();
// focal length
let focal_length = operation.projection().fov();
let focal_length = 1.0 / ((focal_length / 2.0).to_radians().tan());
// Viewport Info
let resolution = viewport.size();
let znear = operation.projection().z_near();
let zfar = operation.projection().z_far();
Ok(())
}
fn supported(&self, data: &radarg_core::Data) -> bool {
false
}
}
#[derive(Default)]
pub struct TerrainModulePackageConfig {
terrain_conf: TerrainConfig,
}
impl ModuleCursor for TerrainModulePackage {
type Module<'rf, 'gl: 'rf> = TerrainModule<'rf, 'gl>;
type Config = TerrainModulePackageConfig;
type Data = ();
type Component = TerrainModuleConfigComponent;
type ComponentOutput = ();
fn set_config<F>(&mut self, f: F)
where
F: FnOnce(&mut Self::Config),
{
}
fn component_config(&self) -> () {
()
}
fn component_sender(&self) -> Box<dyn Fn(Self::ComponentOutput) -> crate::pg::SideBarInputMsg> {
todo!()
}
}
pub struct TerrainModuleConfigComponent {}
#[relm4::component(pub)]
impl SimpleComponent for TerrainModuleConfigComponent {
type Widgets = EarthModuleConfigComponentWidgets;
type Init = ();
type Input = ();
type Output = ();
view! {
adw::PreferencesPage {
}
}
fn init(
init: Self::Init,
root: Self::Root,
sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
let model = TerrainModuleConfigComponent {};
let widgets = view_output!();
ComponentParts { model, widgets }
}
fn update(&mut self, message: Self::Input, sender: relm4::ComponentSender<Self>) {}
}

View File

@ -11,18 +11,15 @@ pub struct EarthFragment(pub ShaderStage);
impl EarthVertex { impl EarthVertex {
pub fn new() -> Self { pub fn new() -> Self {
let mut trackball = Trackball::new().0;
let raw = glsl! { let raw = glsl! {
layout(location = 0) in vec3 in_position; layout(location = 0) in vec3 in_position;
void main() { void main() {
gl_Position = transform(vec4(in_position, 1.0)); gl_Position = vec4(in_position, 1.0);
} }
}; };
trackball.extend(raw); Self(raw)
Self(trackball)
} }
} }
@ -34,10 +31,9 @@ impl EarthFragment {
uniform float focal_length; uniform float focal_length;
uniform vec2 resolution; uniform vec2 resolution;
uniform mat4 trackball_view; uniform mat4 trackball_view;
uniform vec2 projection_params; uniform vec2 projection_params;
uniform vec3 sun_location; uniform vec3 sun_location;
uniform mat3 ca;
uniform float ER; uniform float ER;
@ -56,89 +52,93 @@ impl EarthFragment {
return vec2( max( max( t1.x, t1.y ), t1.z ),min( min( t2.x, t2.y ), t2.z ) ); return vec2( max( max( t1.x, t1.y ), t1.z ),min( min( t2.x, t2.y ), t2.z ) );
} }
vec3 calcNormal( in vec3 pos ) { vec2 raycast(vec3 ro, vec3 rd )
vec2 e = vec2(1.0,-1.0)*0.5773*0.0005; {
return normalize( e.xyy*sdSphere( pos + e.xyy, ER ) + vec2 res = vec2(-1.0,-1.0);
e.yyx*sdSphere( pos + e.yyx ,ER) +
e.yxy*sdSphere( pos + e.yxy ,ER) +
e.xxx*sdSphere( pos + e.xxx ,ER) );
}
float raycast(in vec3 ro, in vec3 rd) {
float res = -1.0;
vec2 tb = iBox(ro, rd, vec3(ER, ER, ER));
float tmin = projection_params.x; float tmin = projection_params.x;
float tmax = projection_params.y; float tmax = projection_params.y;
if(tb.x < tb.y && tb.y > 0.0 && tb.x < tmax) { // raymarch primitives
vec2 tb = iBox( ro, rd, vec3(ER) );
tmin = max(tb.x, tmin); if( tb.x<tb.y && tb.y>0.0 && tb.x<tmax)
tmax = min(tb.y, tmax); {
//return vec2(tb.x,2.0);
tmin = max(tb.x,tmin);
tmax = min(tb.y,tmax);
float t = tmin; float t = tmin;
int i = 0; int i = 0;
while ( i < 70 && t < tmax) { while (i < 70 && t < tmax) {
vec2 h = vec2(sdSphere( ro+rd*t, ER ), 30.0);
float h = sdSphere(ro + rd * t, ER); if( abs(h.x)<(0.0001*t) )
{
if(abs(h) < (0.0001 * t)) { res = vec2(t,h.y);
res = t; break;
break; }
} t += h.x;
i += 1;
t += h;
i += 1;
} }
} }
return res; return res;
} }
vec3 calcNormal( in vec3 pos )
{
vec2 e = vec2(1.0,-1.0)*0.5773*0.0005;
return normalize( e.xyy*sdSphere( pos + e.xyy, ER ) +
e.yyx*sdSphere( pos + e.yyx,ER) +
e.yxy*sdSphere( pos + e.yxy,ER) +
e.xxx*sdSphere( pos + e.xxx,ER) );
}
void main() { void main() {
vec2 p = (2.0 * gl_FragCoord.xy - resolution) / resolution.y; vec2 p = (2.0 * gl_FragCoord.xy - resolution) / resolution.y;
vec3 ro = camera_location;
mat3 ca = transpose(mat3(trackball_view));
vec3 rd = ca * normalize(vec3(p, focal_length)); vec3 rd = ca * normalize(vec3(p, focal_length));
float t = raycast(ro, rd); vec2 res = raycast(camera_location, rd);
float ks = 1.0; float t = res.x;
float m = res.y;
vec3 lin = vec3(0.0); if( t <0.0 )
{
if (t < 0.0) {
discard; discard;
} }
vec3 col = vec3(1.0, 1.0, 1.0); vec3 col = vec3(0.7, 0.7, 0.9) - max(rd.y,0.0)*0.3;
col = 0.2 + 0.2*sin( m*2.0 + vec3(0.0,1.0,2.0) );
vec3 pos = camera_location + rd*t;
vec3 lin = vec3(0.0);
vec3 pos = ro + t * rd;
vec3 nor = calcNormal(pos); vec3 nor = calcNormal(pos);
// vec3 ref = reflect(rd, nor);
float ks = 1.0;
{
// lighting
vec3 lig = normalize( vec3(-0.5, 0.4, -0.6) );
vec3 hal = normalize( lig-rd );
float dif = clamp( dot( nor, lig ), 0.0, 1.0 );
float spe = pow( clamp( dot( nor, hal ), 0.0, 1.0 ),16.0);
spe *= dif;
spe *= 0.04+0.96*pow(clamp(1.0-dot(hal,lig),0.0,1.0),5.0);
lin += col*2.20*dif*vec3(1.30,1.00,0.70);
lin += 5.00*spe*vec3(1.30,1.00,0.70)*ks;
}
col = lin;
col = clamp(mix( col, vec3(0.7,0.7,0.9), 1.0-exp( -0.0001*t*t*t ) ), 0.0, 1.0);
FragColor = vec4(col, 1.0);
// If we hit the sphere
vec3 lig = normalize(sun_location);
vec3 hal = normalize(lig - rd);
float dif = clamp( dot( nor, lig ), 0.0, 1.0 );
float spe = pow( clamp( dot( nor, hal ), 0.0, 1.0 ),16.0);
spe *= dif;
spe *= 0.04+0.96*pow(clamp(1.0-dot(hal,lig),0.0,1.0),5.0);
lin += col*2.20*dif*vec3(1.30,1.00,0.70);
lin += 5.00*spe*vec3(1.30,1.00,0.70)*ks;
col = mix( col, vec3(0.7,0.7,0.9), 1.0-exp( -0.0001*t*t*t ) );
FragColor = vec4(clamp( col, 0.0, 1.0 ),1.0);
} }
}; };

View File

@ -7,6 +7,7 @@ pub mod math;
pub mod polar; pub mod polar;
pub mod ppi; pub mod ppi;
pub mod proj; pub mod proj;
pub mod terrain;
pub mod trackball; pub mod trackball;
use glsl::{ use glsl::{

141
gi/src/shaders/terrain.rs Normal file
View File

@ -0,0 +1,141 @@
use super::trackball::Trackball;
use super::CodePiece;
use crate::impl_code_piece;
use glsl::syntax::ShaderStage;
use glsl::syntax::TranslationUnit;
use glsl::transpiler::glsl::show_translation_unit;
use glsl_quasiquote::glsl;
pub struct TerrainVertex(pub ShaderStage);
pub struct TerrainFragment(pub ShaderStage);
impl TerrainVertex {
pub fn new() -> Self {
let raw = glsl! {
layout(location = 0) in vec4 in_position;
void main() {
gl_Position = in_position;
}
};
Self(raw)
}
}
impl TerrainFragment {
pub fn new() -> Self {
use super::polar::PolarTransform;
let mut include = PolarTransform::new().raw;
let mut colormap = super::colormap::ColorMap::new().0;
let raw = glsl! {
// Perspective Camera
uniform vec2 projection_params;
uniform vec3 camera_location;
uniform float focal_length;
uniform vec2 resolution;
// Earth Radius, alpha, beta
uniform vec3 earth;
uniform float maxHeight;
// Left Hand Coordinate System
uniform mat3 ca;
// Terrain
uniform float terrain_scale;
// Terrain SDF
uniform sampler2D terrain_texture;
// longitude, latitude
uniform vec4 tex_range;
const int NUM_SAMPLES = 16;
const float PI = 3.14159265359;
const float SAMPLE_STEP = 0.1;
out vec4 FragColor;
vec2 iBox(in vec3 ro, in vec3 rd, in vec3 rad ){
vec3 m = 1.0/rd;
vec3 n = m*ro;
vec3 k = abs(m)*rad;
vec3 t1 = -n - k;
vec3 t2 = -n + k;
return vec2( max( max( t1.x, t1.y ), t1.z ),min( min( t2.x, t2.y ), t2.z ) );
}
vec2 sdf(vec3 p) {
float ER = earth.x;
float alpha = earth.y;
float beta = earth.z;
float longitude = atan(p.z, p.x) + alpha;
float latitude = atan(p.y, length(p.xz)) + beta;
// 从高度图获取地形高度
vec2 uv = vec2((longitude + PI) / (2.0 * PI), (latitude + PI / 2.0) / PI);
float height = texture(terrain_texture, uv).r * maxHeight;
// 计算点到地球表面的最近距离
float baseDist = length(p) - ER - height;
return vec2(baseDist, height);
}
vec2 raycast(vec3 ro, vec3 rd) {
float ER = earth.x;
float tmin = projection_params.x;
float tmax = projection_params.y;
// raymarch primitives
vec2 tb = iBox(ro, rd, vec3(ER));
vec2 res = vec2(-1.0, -1.0);
if (tb.x < tb.y && tb.y > 0.0 && tb.x < tmax) {
tmin = max(tb.x, tmin);
tmax = min(tb.y, tmax);
float t = tmin;
int i = 0;
while (i < 70 && t < tmax) {
vec2 h = sdf(ro + rd * t);
if (abs(h.x) < (0.0001 * t)) {
res = vec2(t, h.y);
}
t += h.x;
i += 1;
}
}
return res;
}
void main() {
vec2 p = (2.0 * gl_FragCoord.xy - resolution) / resolution.y;
vec3 rd = normalize(ca * vec3(p, focal_length));
vec2 res = raycast(camera_location, rd);
float t = res.x;
float m = res.y;
if (m < 0.0) {
discard;
}
FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
};
include.extend(colormap);
include.extend(raw);
Self(include)
}
}
impl_code_piece!(TerrainVertex, 0);
impl_code_piece!(TerrainFragment, 0);

407
loaders/Cargo.lock generated
View File

@ -157,6 +157,19 @@ dependencies = [
"generic-array", "generic-array",
] ]
[[package]]
name = "blosc-src"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e5a7dc1b763e125322b8935ca19d712299f0ee1a8eed5474a45bd6ad9e592c"
dependencies = [
"cc",
"libz-sys",
"lz4-sys",
"snappy_src",
"zstd-sys",
]
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.16.0" version = "3.16.0"
@ -168,6 +181,20 @@ name = "bytemuck"
version = "1.17.1" version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.76",
]
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -175,6 +202,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
[[package]] [[package]]
name = "bzip2" name = "bzip2"
version = "0.4.4" version = "0.4.4"
@ -295,6 +328,15 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc32c"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47"
dependencies = [
"rustc_version",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.4.2" version = "1.4.2"
@ -313,12 +355,37 @@ dependencies = [
"crossbeam-utils", "crossbeam-utils",
] ]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.20" version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]] [[package]]
name = "crypto-common" name = "crypto-common"
version = "0.1.6" version = "0.1.6"
@ -355,6 +422,27 @@ dependencies = [
"syn 2.0.76", "syn 2.0.76",
] ]
[[package]]
name = "derive_more"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.76",
"unicode-xid",
]
[[package]] [[package]]
name = "digest" name = "digest"
version = "0.10.7" version = "0.10.7"
@ -377,13 +465,19 @@ dependencies = [
"syn 2.0.76", "syn 2.0.76",
] ]
[[package]]
name = "dyn-clone"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]] [[package]]
name = "earcutr" name = "earcutr"
version = "0.4.3" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79127ed59a85d7687c409e9978547cffb7dc79675355ed22da6b66fd5f6ead01" checksum = "79127ed59a85d7687c409e9978547cffb7dc79675355ed22da6b66fd5f6ead01"
dependencies = [ dependencies = [
"itertools", "itertools 0.11.0",
"num-traits", "num-traits",
] ]
@ -417,6 +511,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"zarrs",
"zip", "zip",
] ]
@ -504,6 +599,17 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "half"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
dependencies = [
"bytemuck",
"cfg-if",
"crunchy",
]
[[package]] [[package]]
name = "hash32" name = "hash32"
version = "0.3.1" version = "0.3.1"
@ -584,6 +690,12 @@ dependencies = [
"generic-array", "generic-array",
] ]
[[package]]
name = "inventory"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767"
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.11.0" version = "0.11.0"
@ -593,6 +705,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.11" version = "1.0.11"
@ -639,6 +760,27 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "libz-sys"
version = "1.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "link-cplusplus"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.12" version = "0.4.12"
@ -661,6 +803,16 @@ version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "lz4-sys"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb44a01837a858d47e5a630d2ccf304c8efcc4b83b8f9f75b7a9ee4fcc6e57d"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "lzma-rs" name = "lzma-rs"
version = "0.3.0" version = "0.3.0"
@ -671,6 +823,16 @@ dependencies = [
"crc", "crc",
] ]
[[package]]
name = "matrixmultiply"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a"
dependencies = [
"autocfg",
"rawpointer",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@ -692,6 +854,40 @@ dependencies = [
"adler2", "adler2",
] ]
[[package]]
name = "monostate"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d208407d7552cd041d8cdb69a1bc3303e029c598738177a3d87082004dc0e1e"
dependencies = [
"monostate-impl",
"serde",
]
[[package]]
name = "monostate-impl"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7ce64b975ed4f123575d11afd9491f2e37bbd5813fbfbc0f09ae1fbddea74e0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.76",
]
[[package]]
name = "ndarray"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
dependencies = [
"matrixmultiply",
"num-complex",
"num-integer",
"num-traits",
"rawpointer",
]
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.3" version = "7.1.3"
@ -724,12 +920,77 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "num"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"
dependencies = [
"num-bigint",
"num-complex",
"num-integer",
"num-iter",
"num-rational",
"num-traits",
]
[[package]]
name = "num-bigint"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "num-complex"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
dependencies = [
"bytemuck",
"num-traits",
]
[[package]] [[package]]
name = "num-conv" name = "num-conv"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-integer"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.19" version = "0.2.19"
@ -775,6 +1036,12 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]] [[package]]
name = "pbkdf2" name = "pbkdf2"
version = "0.12.2" version = "0.12.2"
@ -861,6 +1128,41 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "rawpointer"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]]
name = "rayon_iter_concurrent_limit"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d09ee01023de07fa073ce14c37cbe0a9e099c6b0b60a29cf4af6d04d9553fed7"
dependencies = [
"rayon",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.3" version = "0.5.3"
@ -917,6 +1219,15 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@ -955,12 +1266,24 @@ version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
dependencies = [ dependencies = [
"indexmap",
"itoa", "itoa",
"memchr", "memchr",
"ryu", "ryu",
"serde", "serde",
] ]
[[package]]
name = "serde_repr"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.76",
]
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.10.6" version = "0.10.6"
@ -990,6 +1313,16 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "snappy_src"
version = "0.2.3+snappy.1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc78d0b5fea71fda96c2e67f99ff3cfb34757307dd088a9abed3a4ba0a7f7465"
dependencies = [
"cc",
"link-cplusplus",
]
[[package]] [[package]]
name = "spade" name = "spade"
version = "2.12.0" version = "2.12.0"
@ -1108,12 +1441,34 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-xid"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "walkdir"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
"winapi-util",
]
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"
@ -1191,6 +1546,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
@ -1206,6 +1570,15 @@ dependencies = [
"windows-targets", "windows-targets",
] ]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.52.6" version = "0.52.6"
@ -1270,6 +1643,38 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "zarrs"
version = "0.16.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fa44a5936d9bfbfe5e57d1e397ede1d821415b8f7f4060b4f33a5335e75f835"
dependencies = [
"blosc-src",
"bytemuck",
"bytes",
"crc32c",
"derive_more",
"dyn-clone",
"flate2",
"half",
"inventory",
"itertools 0.13.0",
"monostate",
"ndarray",
"num",
"num-complex",
"parking_lot",
"pathdiff",
"rayon",
"rayon_iter_concurrent_limit",
"serde",
"serde_json",
"serde_repr",
"thiserror",
"walkdir",
"zstd",
]
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.7.35" version = "0.7.35"

View File

@ -18,6 +18,7 @@ num-traits = "0.2.17"
serde = { version = "1.0.196", features = ["derive"] } serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.112" serde_json = "1.0.112"
thiserror = "1.0.56" thiserror = "1.0.56"
zarrs = "0.16.4"
zip = "2.2.0" zip = "2.2.0"
[dependencies.radarg_plugin_interface] [dependencies.radarg_plugin_interface]

View File

@ -6,7 +6,7 @@ use super::{Layer, WindowCoord};
use femtovg::{Canvas, Color, FontId, Paint, Renderer}; use femtovg::{Canvas, Color, FontId, Paint, Renderer};
use gi::graphics::transforms::plane::PlaneTrans; use gi::graphics::transforms::plane::PlaneTrans;
use gi::pg::layout_type::ViewPort; use gi::pg::layout_type::ViewPort;
use gi::pg::ModulePackage; use gi::pg::{Module, ModulePackage};
use gi::ui::io::IO; use gi::ui::io::IO;
use gi::ui::operation::Operation; use gi::ui::operation::Operation;
use gi::{App as GI, Helper, GL}; use gi::{App as GI, Helper, GL};
@ -245,6 +245,13 @@ impl Render {
}; };
gi.prepare(&SETTING).expect("Cannot prepare GI"); gi.prepare(&SETTING).expect("Cannot prepare GI");
// Terrain
let terrain_module = gi.program().terrain().load_data(&(), &SETTING).unwrap();
// Init Modules
gi.set_init_modules(terrain_module.into());
// Set Modules
self.viewport.replace(Some(viewport)); self.viewport.replace(Some(viewport));
self.gi.replace(Some(gi)); self.gi.replace(Some(gi));
} }

View File

@ -9,8 +9,6 @@ ndarray = "0.16.1"
thiserror = "1.0.56" thiserror = "1.0.56"
rust-embed = "8.5.0" rust-embed = "8.5.0"
toml = "0.8.19" toml = "0.8.19"
proj-sys = "0.23.1"
proj = "0.27.2"
dirs = "5.0.1" dirs = "5.0.1"
num-traits = "0.2.19" num-traits = "0.2.19"
serde = { version = "1.0.209", features = ["derive"] } serde = { version = "1.0.209", features = ["derive"] }

View File

@ -5,7 +5,7 @@ use crate::Asset;
use dirs; use dirs;
use num_traits::{AsPrimitive, FromPrimitive}; use num_traits::{AsPrimitive, FromPrimitive};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::env; use std::{env, path::PathBuf};
use toml; use toml;
macro_rules! find_cmap { macro_rules! find_cmap {
@ -32,6 +32,7 @@ macro_rules! find_cmap {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct Setting { pub struct Setting {
pub common: Common,
pub cmap: Vec<CB>, pub cmap: Vec<CB>,
} }
@ -122,3 +123,15 @@ impl CB {
Ok(result) Ok(result)
} }
} }
#[derive(Deserialize, Serialize)]
pub struct Common {
pub background: BackgroundType,
pub path: PathBuf,
}
#[derive(Deserialize, Serialize, Debug)]
pub enum BackgroundType {
Terrain,
Earth,
}

View File

@ -1,4 +1,3 @@
use proj::ProjError;
use radarg_plugin_interface::Error as PluginError; use radarg_plugin_interface::Error as PluginError;
use thiserror::Error; use thiserror::Error;
@ -14,11 +13,6 @@ pub enum DataError {
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum PipelineError { pub enum PipelineError {
#[error("proj error")]
ProjError {
#[from]
source: ProjError,
},
#[error("data error")] #[error("data error")]
DataError(String), DataError(String),
} }

BIN
resources/alts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB