Skip to content

Instantly share code, notes, and snippets.

View JSandusky's full-sized avatar

Jonathan Sandusky JSandusky

  • Ohio, United States
View GitHub Profile
@JSandusky
JSandusky / dead.cs
Created March 23, 2019 01:48
Ubernoise
[Description("Uses noise derivatives to produce an extremely versatile noise")]
[PropertyData.PropertyIgnore("Interpolation")]
public partial class UberNoise : NoiseGenerator
{
float lacunarity_ = 2.0f;
int octaves_ = 3;
float gain_ = 0.5f;
float perturbFeatures_ = 0.2f;
float sharpness_ = 0.7f;
float amplify_ = 0.7f;
@JSandusky
JSandusky / MotionWheel.cpp
Created February 22, 2019 00:45
Motion Wheel ... WTFPL
MotionWheel::MotionWheel(Context* ctx) : Component(ctx),
traveledDistance_(0.0f),
lastPosition_(Vector3(M_INFINITY, M_INFINITY, M_INFINITY))
{
SubscribeToEvent(E_SCENEPOSTUPDATE, URHO3D_HANDLER(MotionWheel, OnUpdate));
}
MotionWheel::~MotionWheel()
{
@JSandusky
JSandusky / AnimProc.cpp
Created February 20, 2019 01:42
Keyframe extraction
#include "AnimProc.h"
#include "../Graphics/Animation.h"
#include "../IO/Log.h"
namespace Urho3D
{
/// Pulls out an interpolated keyframe from a track based on time.
/// The time value of the key will be set to the given time value, overwrite if undesired.
@JSandusky
JSandusky / MaterialGraph.xml
Created February 6, 2019 11:28
Material graph node definition XML
<graph name="Material" candebug="false" color="orange">
<!--
<in /> = designates an input socket
<out /> = designates an output socket
<metadata></metadata> = can be attached to sockets or nodes themselves
List of Metadata: [NAME], [valid targets] = [purpose/effect]
@JSandusky
JSandusky / Toon.hlsl
Created February 6, 2019 01:51
HLSL Toon Shader
//==========================================================
// Toon Shader
//==========================================================
// Features:
// - artist supplied *tone* ramp
// - Control map to force shadow/highlight
// - model-space vertical 1px shade control (hat shadows, etc)
// - MSDF *linework* map
// - rimlight glow
// - geometry-shader outlines
@JSandusky
JSandusky / DEGFX.lua
Created January 22, 2019 07:42
DiligentEngine Premake
--[[
Usage:
// setup the paths and build options
DEGFX_InitPaths(...)
DEGFX_InitRenderers(...)
// add the projects to build
DEGFX_IncludeProjects()
@JSandusky
JSandusky / 27_Urho2DPhysics.as
Created December 16, 2018 22:18
Repro for Physics 2d raycast bug
// Urho2D physics sample.
// This sample demonstrates:
// - Creating both static and moving 2D physics objects to a scene
// - Displaying physics debug geometry
#include "Scripts/Utilities/Sample.as"
void Start()
{
// Execute the common startup for samples
@JSandusky
JSandusky / asPEEK.cpp
Last active April 9, 2020 05:26
asPEEK debugger: add `friend class asPEEK` as needed for access to `Script`' and `ScriptFile` internals
/*
Copyright (c) 2012 Muhammed Ikbal Akpaca
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
@JSandusky
JSandusky / Shake.as
Last active November 11, 2018 19:21
Angelscript camera shake
// Shakes an object using a # of shake intervals
// Intended behavior is to shake to random directions once per interval, optionally returning
// to the original reference direction
class Shake : ScriptObject
{
// internal state
private Vector3 referenceDirection;
private Vector3 shakeTowards;
private Vector3 shakeBase;
@JSandusky
JSandusky / Header.h
Created November 9, 2018 23:43
Marching Triangles
class DebugRenderer;
class Context;
class Geometry;
struct MTFront;
void ImplicitTangentSpace(const Vector3& norm, Vector3& tangent, Vector3& binormal);
/// A vertex on the advancing front.
struct MTVertex
{