Skip to content

Instantly share code, notes, and snippets.

View LaylBongers's full-sized avatar
🕹️

Layl LaylBongers

🕹️
View GitHub Profile
pub fn on_pointer(&mut self, state: &mut ApplicationState, position: Point2<f32>) {
let projection_matrix = create_projection_matrix(self.last_size);
let projection_inverse = projection_matrix.try_inverse().unwrap();
// Transform the window position to a 3D ray from the camera
let ray_clip = Vector3::new(
(2.0 * position.x) / self.last_size.x as f32 - 1.0,
(2.0 * position.y) / self.last_size.y as f32 - 1.0,
// Remember, inverse Z
C:\Users\Layl\Desktop\rivets [master ≡ +2 ~11 -0 !]
λ cargo run --bin rivets-server-bin
Finished dev [optimized + debuginfo] target(s) in 0.34s
Running `target\debug\rivets-server-bin.exe`
[INFO] Generated 58 asteroids (rivets_server::server:115)
[TRACE] registering with poller (mio::poll:787)
[TRACE] select; timeout=None (mio::sys::windows::selector:73)
[TRACE] polling IOCP (mio::sys::windows::selector:78)
[TRACE] registering with poller (mio::poll:787)
[TRACE] register Token(0) Readable | Writable (mio::sys::windows::selector:359)
+--- net.fabricmc:fabric-loader:0.6.3+build.168
+--- net.fabricmc.fabric-api:fabric-api:0.4.1+build.245-1.14
| +--- net.fabricmc.fabric-api:fabric-api-base:0.1.1+2ac73e7242
| | \--- net.fabricmc:fabric-loader:0.6.1+build.164 -> 0.6.3+build.168
| +--- net.fabricmc.fabric-api:fabric-biomes-v1:0.1.0+591e97ae42
| | \--- net.fabricmc:fabric-loader:0.6.1+build.164 -> 0.6.3+build.168
| +--- net.fabricmc.fabric-api:fabric-commands-v0:0.1.1+591e97ae42
| | \--- net.fabricmc:fabric-loader:0.6.1+build.164 -> 0.6.3+build.168
| +--- net.fabricmc.fabric-api:fabric-containers-v0:0.1.2+591e97ae42
fn reconcile_predictions(
player: &mut PlayerComponent,
player_predictions: &mut PlayerPredictionsComponent,
prediction_id: u16,
server_position: Point3<f32>,
server_rotation: UnitQuaternion<f32>,
) {
let predictions = &mut player_predictions.predictions;
// First, find the slot for this prediction
use {
blast::{
vdom::{el, VNode},
Component, Context, FetchFuture,
},
blast_fetch::fetch,
futures::Future,
serde::Deserialize,
};
let mut formatted_bytes = Vec::new();
{
struct UnimplementedCliOptions;
impl rustfmt_nightly::CliOptions for UnimplementedCliOptions {
fn apply_to(self, _config: &mut Config) { unimplemented!() }
fn config_path(&self) -> Option<&std::path::Path> { unimplemented!() }
}
let (mut config, _) = load_config::<UnimplementedCliOptions>(None, None).unwrap();
config.set().emit_mode(EmitMode::Files);
let index_buffer_data = [0u32, 1, 2];
// Allocate the index buffer
let index_buffer_info = vk::BufferCreateInfo::builder()
.size(size_of_val(&index_buffer_data) as u64)
.usage(vk::BufferUsageFlags::TRANSFER_SRC)
.sharing_mode(vk::SharingMode::EXCLUSIVE);
let create_info = AllocationCreateInfo {
usage: MemoryUsage::CpuOnly,
flags: AllocationCreateFlags::MAPPED,
class Foo {
public:
std::vector<int> m_ints;
}
class Bar : virtual Foo {
}
void main() {
while(true) {
section.section {
div.container {
h1.title { 'Hello from ' $hello '!' }
p.content { 'Counter: ' strong { $count } ' counts' }
div.buttons {
button.button on:click='Clicked(1)' { 'Add 1' }
button.button on:click='Clicked(-1)' { 'Sub 1' }
div.field.has-addons style='width:150px' {
div.control {
input.input .is-danger=$add_error type='text' from-view:value=$add_amount
#pragma once
#include <stdexcept>
namespace bmath {
template<typename S>
struct Mat4 {
// The matrix defines the direction of the axes of a local grid.
// This matrix is laid out like this:
// [x-axis-x y-axis-x z-axis-x w-axis-x]