This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn find_path_through_voxels_with_l1_and_linear_heuristic( | |
start: &lat::Point, | |
finish: &lat::Point, | |
predicate: impl Fn(&lat::Point) -> bool, | |
max_iterations: usize, | |
) -> (bool, Vec<lat::Point>) { | |
let LatPoint3(start_float) = (*start).into(); | |
let LatPoint3(finish_float) = (*finish).into(); | |
let line = Line::from_endpoints(start_float, finish_float); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn unit_vector_from_yaw_and_pitch(yaw: f32, pitch: f32) -> Vector3<f32> { | |
let mut ray = Vector3::z_axis().into_inner(); | |
let y_axis = Vector3::y_axis(); | |
ray = Rotation3::from_axis_angle(&y_axis, yaw) * ray; | |
let pitch_axis = Unit::new_unchecked(ray.cross(&y_axis)); | |
Rotation3::from_axis_angle(&pitch_axis, pitch) * ray | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Uses a kernel to average the adjacent materials for each surface point. | |
fn calculate_material_weights(voxels: &VoxelMap, surface_points: &[Point]) -> Vec<[f32; 4]> { | |
// The current vertex format is limited to 4 numbers for material weights. | |
const WEIGHT_TABLE: [[f32; 4]; 4] = [ | |
[1.0, 0.0, 0.0, 0.0], | |
[0.0, 1.0, 0.0, 0.0], | |
[0.0, 0.0, 1.0, 0.0], | |
[0.0, 0.0, 0.0, 1.0], | |
]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Voxel { | |
/// Points to some palette element. | |
palette_address: u8, | |
/// Quantized distance from the isosurface. | |
distance: i8, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
layout(set = 1, binding = 1) uniform sampler2DArray albedo; | |
layout(set = 1, binding = 2) uniform sampler2DArray emission; | |
layout(set = 1, binding = 3) uniform sampler2DArray normal; | |
layout(set = 1, binding = 4) uniform sampler2DArray metallic_roughness; | |
layout(set = 1, binding = 5) uniform sampler2DArray ambient_occlusion; | |
layout(location = 0) in VertexData { | |
vec3 position; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is mostly just experimental. I don't have a good rationale for this value. | |
const SDF_QUANTIZE_FACTOR: f32 = 50.0; | |
pub fn encode_distance(distance: f32) -> i8 { | |
(distance * SDF_QUANTIZE_FACTOR) | |
.min(std::i8::MAX as f32) | |
.max(std::i8::MIN as f32) as i8 | |
} | |
/// The inverse of `encode_distance`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use amethyst::{ | |
core::{ecs::prelude::*, math::Point2, ParentHierarchy, Time}, | |
ui::{get_parent_pixel_size, ScaleMode, UiTransform}, | |
window::ScreenDimensions, | |
}; | |
/// Component that tells entities with `UiTransform` to follow the target position at some speed | |
/// (in pixel units). | |
pub struct UiFollow { | |
pub pixel_speed: f32, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Default)] | |
pub struct Vertices { | |
pub positions: Vec<Position>, | |
pub normals: Vec<Normal>, | |
pub tangents: Vec<Tangent>, | |
pub tex_coords: Vec<TexCoord>, | |
} | |
pub struct IndexedVertices { | |
pub indices: Vec<u32>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"nodes":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,26,27,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,55,56,57,58,59,61,62,63,64,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,123,124,125,126,128,129,130,131,133,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,162,163,165,166,167,168,169,170,171,172,174,175,176,178,179,180,181,182,183,184,185,186,187,188,189,190,192,193,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,297,298,299,300,301, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@user-desktop:~/.vscode-server$ cat .2213894ea0415ee8c85c5eea0d0ff81ecc191529.log | |
* | |
* Visual Studio Code Server | |
* | |
* Reminder: You may only use this software with Visual Studio family products, | |
* as described in the license https://aka.ms/vscode-remote/license | |
* |