View example.rs
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 { |
View move_player.rs
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()) |
View stretch.rs
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 { |
View tracker.rs
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); |
View gist:3e77d6537e1a0979a69de5c6749b6bcb
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 |
View gist:1b97ea56303726eff05fdac41168b9d1
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, |
View FXAA.tscn
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. |
View gist:cc095f4950c40c1fe25169be5ee78247
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(); |
View NodeExtensions.cs
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; | |
using System; | |
using System.Collections.Generic; | |
using System.Text.RegularExpressions; | |
namespace HighHat.Scene.Nodes | |
{ | |
public static class NodeExtensions | |
{ | |
private static Regex _nameRegex = new Regex("@*(?<Name>[\\w|\\d]+)@*.*"); |