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 serde::{Deserialize, Serialize}; | |
use std::{collections::HashMap, fs::read_to_string}; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct BloatOutput { | |
#[serde(alias = "file-size")] | |
file_size: usize, | |
#[serde(alias = "text-section-size")] | |
text_section_size: usize, | |
functions: Vec<Function>, |
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(Clone, ShaderType)] | |
struct MyType { | |
x: f32, | |
} | |
// Create a GPU array buffer | |
let mut buffer = GpuArrayBuffer::<MyType>::new(&render_device.limits()); | |
// Push some items into it | |
for i in 0..N { |
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 bevy::prelude::*; | |
struct Player { | |
velocity: Vec3, | |
} | |
fn main() { | |
App::build() | |
.add_plugins(DefaultPlugins) | |
.add_startup_system(spawn_player.system()) |
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 bevy_ecs::{Changed, Entity, Query, Res, ResMut, With, Without}; | |
use bevy_math::Vec2; | |
use bevy_render::renderer::RenderResources; | |
use bevy_transform::prelude::{Children, Parent, Transform}; | |
use bevy_window::Windows; | |
use std::collections::HashMap; | |
use stretch::{number::Number, result::Layout, style::Style, Stretch}; | |
#[derive(Debug, Clone, Default, RenderResources)] | |
pub struct Node { |
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 std::{fmt::Debug, ops::{Deref, DerefMut}}; | |
pub struct Track<T> { | |
modified: bool, | |
value: T, | |
} | |
pub trait Tracker { | |
fn is_modified(&self) -> bool; | |
fn reset(&mut self); |
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
Entity [ | |
MyComponent, | |
Scale { x: 2.0, y: 2.0, z: 2.0 }, | |
PropDemo { | |
value: "hello", | |
sequence: [0,1,2], | |
map: {field: 1.0, hello: "hi"}, | |
nested: {field: [{test: 1.0}]} | |
}, | |
// Children entities are nested |
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
PipelineLayout { | |
bind_groups: [ | |
BindGroupDescriptor { | |
index: 0, | |
bindings: [ | |
BindingDescriptor { | |
name: "Camera2d", | |
index: 0, | |
bind_type: Uniform { | |
dynamic: false, |
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
[gd_scene load_steps=3 format=2] | |
[sub_resource type="Shader" id=1] | |
code = "shader_type canvas_item; | |
// Godot Nvidia FXAA 3.11 Port | |
// Usage: Drop this in to any 3D scene for FXAA! This is a port of the \"PC High Quality Preset 39\". However the medium quality | |
// parameters are also included. For medium quality, just comment out sections \"PS 6\" and above and uncomment the \"med 13\" variables. |
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
using Godot; | |
namespace HighHat.MathHelpers | |
{ | |
public static class MathExtensions | |
{ | |
// TODO: expose Godot's Transform::interpolate_with to scripting. This is just a C# port | |
public static Transform InterpolateWith(this Transform transform, Transform targetTransform, float percent, bool includeScale = true) | |
{ | |
var rotation = transform.basis.Orthonormalized().ToQuat(); |
NewerOlder