Skip to content

Commit

Permalink
"Auto commit number 31"
Browse files Browse the repository at this point in the history
  • Loading branch information
lat-murmeldjur committed Mar 25, 2024
1 parent 1dbe814 commit ae063a3
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 56 deletions.
2 changes: 1 addition & 1 deletion chronicl.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30
31
2 changes: 1 addition & 1 deletion featuring.dt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30
31
1 change: 1 addition & 0 deletions ohio.note
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Year::2024::|::Month::03::|::Day::21::|::Hour::14::|::Minute::51::|::Second::35:
Year::2024::|::Month::03::|::Day::22::|::Hour::16::|::Minute::32::|::Second::41::
Year::2024::|::Month::03::|::Day::24::|::Hour::19::|::Minute::16::|::Second::53::
Year::2024::|::Month::03::|::Day::24::|::Hour::19::|::Minute::34::|::Second::50::
Year::2024::|::Month::03::|::Day::25::|::Hour::18::|::Minute::23::|::Second::03::
73 changes: 66 additions & 7 deletions src/anomaly.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// experimental generic composite reductive approximation outline
use std::thread;

use crate::magma_ocean::{magma, petrify, Stone};
use crate::positions::{move_positions, Normal, Position};

pub struct Anomaly {
pub Anomaly: Vec<Anomaly>,
pub Component: Vec<Component>,
Expand All @@ -18,6 +21,7 @@ pub struct Component {
pub Property: Vec<Property>,
}

#[derive(Clone)]
pub struct Property {
pub Name: f64,
pub Value: f64,
Expand All @@ -29,11 +33,13 @@ pub struct Force {
pub Domain: Vec<Component>,
}

static EC: f64 = 313.0;
static Sp: f64 = 591.0;
static Ms: f64 = 343.0;
static Cr: f64 = 0.10;
static QMs: [f64; 6] = [2.2, 4.7, 1.28, 96.0, 173.1, 4.18];
pub fn add_particle(anom: &mut Anomaly, position: [f32; 3], properties: Vec<Property>) {
anom.Anomaly.push(particle(position, properties));
}

pub fn add_particle_by(anom: &mut Anomaly, p: Anomaly) {
anom.Anomaly.push(p);
}

pub fn particle(position: [f32; 3], properties: Vec<Property>) -> Anomaly {
let mut anom = Anomaly {
Expand All @@ -52,7 +58,60 @@ pub fn particle(position: [f32; 3], properties: Vec<Property>) -> Anomaly {
anom
}

pub fn e(position: [f32; 3], clock: bool) {
pub fn view(anom: &Anomaly) -> Vec<Stone> {
let mut ret: Vec<Stone> = vec![];
for a in &anom.Anomaly {
ret.append(&mut view(&a));
}

for c in &anom.Component {
ret.append(&mut component_view(&c));
}

ret
}

pub fn component_view(component: &Component) -> Vec<Stone> {
let mut ret: Vec<Stone> = vec![];

for c in &component.Component {
ret.append(&mut component_view(&c));
}

let size: Vec<Property> = component
.Property
.clone()
.into_iter()
.filter(|c| c.Name == Ms)
.collect();

for c in &component.Composition {
for d in &c.Distribution {
for v in &d(c.Space.clone()) {
let mut s = petrify(magma(2, size[0].Value as f32));
move_positions(&mut s.positions, *v);
ret.push(s);
}
}
}
ret
}

//

//

//

// future ref example

static EC: f64 = 313.0;
static Sp: f64 = 591.0;
static Ms: f64 = 343.0;
static Cr: f64 = 0.10;
static QMs: [f64; 6] = [2.2, 4.7, 1.28, 96.0, 173.1, 4.18];

pub fn e(position: [f32; 3], clock: bool) -> Anomaly {
let sp = if clock { 0.5 } else { -0.5 };
particle(
position,
Expand All @@ -70,7 +129,7 @@ pub fn e(position: [f32; 3], clock: bool) {
Value: 0.511,
},
],
);
)
}

pub fn q(position: [f32; 3], clock: bool, charge: bool, color: u8, flavor: u8) {
Expand Down
3 changes: 2 additions & 1 deletion src/frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ layout(location = 0) out vec4 f_color;
const vec3 LIGHT = vec3(0.0, 1.0, 0.0);

void main() {

float brightness = dot(normalize(v_normal), normalize(LIGHT));
vec3 dark_color = vec3(0.5, 0.5, 0.33);
vec3 regular_color = vec3(1.0, 1.0, 0.6);

f_color = vec4(mix(dark_color, regular_color, brightness), 1.0);
f_color = vec4(mix(dark_color, regular_color, brightness), 0.03);
}
6 changes: 3 additions & 3 deletions src/magma_ocean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub fn petrify(flow: Magma) -> Stone {
let mut rng = rand::thread_rng();
let points_diff = sbtr_f32_3(flow.positions[1].position, flow.positions[0].position);
let planes_normal: [f32; 3] = nrmlz_f32_3(points_diff);
let planes_number = rng.gen_range(64..128);
let planes_number = rng.gen_range(6..16);

let mut points_of_plane: u32 = 3;
let reference_orthogonal = gen_rthgnl_f32_3(planes_normal, &mut rng);
Expand Down Expand Up @@ -155,7 +155,7 @@ pub fn petrify(flow: Magma) -> Stone {
});
let normal = //nrmlz_f32_3(gen_f32_3(0.0, 1.0, &mut rng));
// find_points_normal(plane.positions[(i as usize)].position, *plane_point);
find_points_normal(plane.positions[(i as usize)].position, normal_origin);
nrmlz_f32_3(dd_f32_3(find_points_normal(plane.positions[(i as usize)].position, normal_origin),gen_f32_3(0.0, 0.1, &mut rng)));
stone.normals.push(Normal { normal: normal });
}

Expand Down Expand Up @@ -208,7 +208,7 @@ pub fn petrify(flow: Magma) -> Stone {
points_of_plane = 3;
} else {
points_of_plane =
3 + spherical_progress(125.0, pln as f32, planes_number as f32 - 1.0) as u32;
3 + spherical_progress(8.0, pln as f32, planes_number as f32 - 1.0) as u32;
};
}

Expand Down
98 changes: 55 additions & 43 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use display_mods::{
};

mod f32_3;
use f32_3::gen_f32_3;

mod positions;
use positions::{move_positions, Normal, Position};

Expand All @@ -25,7 +27,7 @@ mod magma_ocean;
use magma_ocean::{magma, petrify, Stone};

mod anomaly;
use anomaly::Anomaly;
use anomaly::{add_particle_by, e, view, Anomaly};

mod moving_around;
use moving_around::{
Expand Down Expand Up @@ -98,6 +100,12 @@ use winit::{
use rand::rngs::ThreadRng;
use rand::Rng;

pub struct bv {
pub v: Subbuffer<[Position]>,
pub n: Subbuffer<[Normal]>,
pub i: Subbuffer<[u32]>,
}

fn main() {
let mut duration_since_epoch_nanos = record_nanos();
// Statements here are executed when the compiled binary is called.
Expand All @@ -111,14 +119,20 @@ fn main() {

let mut rng = rand::thread_rng();

let mut stone = petrify(magma(2, 10.0));
let mut pebble = petrify(magma(2, 50.0));
// let mut stone = petrify(magma(2, 10.0));
// let mut pebble = petrify(magma(2, 50.0));
let mut anom = Anomaly {
Anomaly: vec![],
Component: vec![],
Force: vec![],
};

let k = 12;

for i in 0..k {
add_particle_by(&mut anom, e(gen_f32_3(0.0, 69.0, &mut rng), true));
}

let ocl = oclock().cos();

///|||\\\///|||\\\///|||\\\///|||\\\///|||\\\///|||\\\[ Main ]///|||\\\///|||\\\///|||\\\///|||\\\///|||\\\///|||\\\
Expand Down Expand Up @@ -513,15 +527,29 @@ fn main() {

// simulation

move_positions(&mut pebble.positions, [0.0, 0.0, 0.0]);
// move_positions(&mut pebble.positions, [0.0, 0.0, 0.0]);
//
// move_positions(&mut stone.positions, [0.0, 0.0, 0.0]);

move_positions(&mut stone.positions, [0.0, 0.0, 0.0]);
let get = view(&anom);

let (vertex_buffer, normals_buffer, index_buffer) =
load_buffers_short(&mut stone, memory_allocator.clone());
let mut bvs: Vec<bv> = vec![];

let (vertex_buffer2, normals_buffer2, index_buffer2) =
load_buffers_short(&mut pebble, memory_allocator.clone());
for mut g in get {
let (vertex_buffer, normals_buffer, index_buffer) =
load_buffers_short(&mut g, memory_allocator.clone());
bvs.push(bv {
v: vertex_buffer,
n: normals_buffer,
i: index_buffer,
});
}

// let (vertex_buffer, normals_buffer, index_buffer) =
// load_buffers_short(&mut stone, memory_allocator.clone());
//
// let (vertex_buffer2, normals_buffer2, index_buffer2) =
// load_buffers_short(&mut pebble, memory_allocator.clone());

let image_extent: [u32; 2] = window.inner_size().into();

Expand Down Expand Up @@ -670,42 +698,26 @@ fn main() {
0,
set,
)
.unwrap()
.begin_query(
query_pool.clone(),
0,
QueryControlFlags::empty(),
// QueryControlFlags::PRECISE,
)
.unwrap()
.bind_vertex_buffers(0, (vertex_buffer.clone(), normals_buffer.clone()))
.unwrap()
.bind_index_buffer(index_buffer.clone())
.unwrap()
.draw_indexed(index_buffer.len() as u32 as u32, 1, 0, 0, 0)
.unwrap()
.end_query(query_pool.clone(), 0)
.unwrap();

builder
.begin_query(
query_pool.clone(),
0,
QueryControlFlags::empty(),
// QueryControlFlags::PRECISE,
)
.unwrap()
.bind_vertex_buffers(
0,
(vertex_buffer2.clone(), normals_buffer2.clone()),
)
.unwrap()
.bind_index_buffer(index_buffer2.clone())
.unwrap()
.draw_indexed(index_buffer2.len() as u32 as u32, 1, 0, 0, 0)
.unwrap()
.end_query(query_pool.clone(), 0)
.unwrap();
for x in bvs {
builder
.begin_query(
query_pool.clone(),
0,
QueryControlFlags::empty(),
// QueryControlFlags::PRECISE,
)
.unwrap()
.bind_vertex_buffers(0, (x.v.clone(), x.n.clone()))
.unwrap()
.bind_index_buffer(x.i.clone())
.unwrap()
.draw_indexed(x.i.len() as u32 as u32, 1, 0, 0, 0)
.unwrap()
.end_query(query_pool.clone(), 0)
.unwrap();
}
}

builder.end_render_pass(Default::default()).unwrap();
Expand Down

0 comments on commit ae063a3

Please sign in to comment.