Skip to content

Instantly share code, notes, and snippets.

@CustomPhase
CustomPhase / MidiReader.cs
Last active May 3, 2024 13:04
MidiReader.cs
using UnityEngine;
using System.Collections;
using NAudio.Midi;
using System.IO;
using System.Linq;
public class MidiReader : MonoBehaviour {
public MidiFile midi;
@guycalledseven
guycalledseven / manual-uninstall-paragon-ntfs.sh
Last active April 27, 2024 09:00
Manually remove Paragon NTFS v15 leftovers MacOS
# after appcleaner does his magic, do this
sudo rm -rf "/Library/Application Support/Paragon Software/"
sudo rm /Library/LaunchDaemons/com.paragon-software.installer.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfs.loader.plist
sudo rm /Library/LaunchDaemons/com.paragon-software.ntfsd.plist
sudo rm /Library/LaunchAgents/com.paragon-software.ntfs.notification-agent.plist
sudo rm -rf /Library/Filesystems/ufsd_NTFS.fs/
sudo rm -rf /Library/PrivilegedHelperTools/com.paragon-software.installer
sudo rm -rf /Library/Extensions/ufsd_NTFS.kext/
@ghidra
ghidra / SimpleQuad.glsl
Created November 3, 2016 16:46
Urho3d simple quad example
#include "Uniforms.glsl"
#include "Samplers.glsl"
#include "Transform.glsl"
#include "ScreenPos.glsl"
//varying vec2 vTexCoord;
varying vec2 vScreenPos2;
void VS()
{
@Enhex
Enhex / Urho3D render order behind.cpp
Last active August 20, 2017 19:48
Urho3D render order in front
Node* planeNode = scene_->CreateChild("Plane");
planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
auto mat = cache->GetResource<Material>("Materials/StoneTiled.xml")->Clone();
mat->SetRenderOrder(100); // Lower render order to render first
auto tecs = mat->GetTechniques();
for (size_t i = 0; i < tecs.Size(); ++i)
{
@bkaradzic
bkaradzic / orthodoxc++.md
Last active April 23, 2024 13:59
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@mandarinx
mandarinx / optimizations.md
Last active September 28, 2023 03:51
Unity3D optimization tips

Unity3D optimization tips

Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.

Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.

When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.

public class SomeClass {
@yone80
yone80 / Deform Along Curve
Last active December 2, 2020 03:41
VEXpression
/* Initialize */
float curvelength = primintrinsic(1, 'arclength', 0);
if( curvelength == 0 )
curvelength = primintrinsic(1, 'measuredperimeter', 0);
float dist = @P.z / curvelength + ch('offset');
vector2 uv = set(dist, 0);
// PRIMUV_UNITLEN_TO_UNIT = 7
vector2 posuv = primuvconvert(@OpInput2, uv, 0, 7);
@Nimrodda
Nimrodda / JNI.cpp
Last active March 8, 2021 09:35
Raw JNI with async callbacks
static jclass callbacksClass;
static jobject callbacksInstance;
JNIEXPORT void JNICALL Java_com_example_NativeClass_nativeMethod(JNIEnv* env, jclass callingObject, jobject callbacks)
{
// Cache the Java callbacks instance
callbacksInstance = env->NewGlobalRef(callbacks);
// Cache the Java callbacks class (in case of interface, this will be the concrete implementation class)
jclass objClass = env->GetObjectClass(callbacks);
@castano
castano / hemicube.cpp
Created June 20, 2014 09:46
Hemicube Integrator
#include "hemicube.h"
#define PACK_HEMICUBES 1
static void get_hemicube_face_normal(int index, Vector3 *forward, Vector3 *left, Vector3 *up) {
// Unwrapped hemicube with positive-Z in the middle.
switch (index) {
case 0: *forward = Vector3(+1, 0, 0); *left = Vector3( 0, 1, 0); break;
@CarloMaker
CarloMaker / Description
Last active October 31, 2015 15:43
Managing game states in Urho3d
/*
This is a simple game state inspired from a good article about managing game states
at http://gamedevgeek.com/tutorials/managing-game-states-in-c/ , i tried to adapt it in Urho3d
using events rather than loops update on virtual methods that kill performance.
*/
gamestateshandler expect a scene already create , you can simply modified as you like,
main.cpp{