Skip to content

Instantly share code, notes, and snippets.

View SoylentGraham's full-sized avatar
🌴
I like trees.

Graham Reeves SoylentGraham

🌴
I like trees.
View GitHub Profile
@SoylentGraham
SoylentGraham / GetScriptableAssets.cs
Created February 8, 2024 12:44
Get all unity scriptable object assets
void RunForEachCondenseBuildSettings(System.Action<CondenseBuildSettings> Functor)
{
var ThisTypename = this.GetType().Name;
var BuildSettingAssetGuids = AssetDatabase.FindAssets($"t:{ThisTypename}");
// no build-settings assets in project, nothing to apply.
if ( BuildSettingAssetGuids.Length == 0 )
return;
if ( BuildSettingAssetGuids.Length > 1 )
class TempBuffer_t
{
constructor(Module,Size,Length)
{
this.Module = Module;
if ( Size === null )
{
this.Address = 0;
this.Size = 0;
@SoylentGraham
SoylentGraham / How to install libprotobuf.md
Last active July 19, 2021 11:33
How to get a binary of libprotobuf

get vcpkg (c/++ package installer/builder) git clone https://github.com/microsoft/vcpkg

checkout vcpkg commit e6c6d9621 to get protobuf version 3012001 cd ./vcpkg && git checkout e6c6d9621

run this to download/build vcpkg.exe .\vcpkg\bootstrap-vcpkg.bat

install/build protobuf for x64, default is x86(!)

@SoylentGraham
SoylentGraham / ConvertToMp4.reg
Created December 7, 2020 18:35
Right click -> convert to mp4 with ffmpeg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Convert To Mp4]
[HKEY_CLASSES_ROOT\*\shell\Convert To Mp4\command]
@="\"d:\\ffmpeg\\ffmpeg.exe\" -i \"%1\" -codec copy \"%1.mp4\""
@SoylentGraham
SoylentGraham / Ray precision.frag.glsl
Created June 7, 2020 12:09
Broken precision using vec3 in struct, only on android webgl glsl (chromium)
precision highp float;
struct TRay
{
vec3 Pos;
vec3 Dir;
};
vec3 ScreenToWorld(float2 uv,float z)
{
@SoylentGraham
SoylentGraham / SolvePnp.cpp
Last active August 6, 2019 12:05
SolvePnp tvec & rvec into object-space rot & trans for the camera pose
// the vectors from SolvePnp forms the matrix to place the object in camera space
// therefore the matrix is ObjectToView/ObjectTo[CameraObject] (in -1..1, -1..1 space as SolvePnp takes no projection, it's in the normalised frustum)
// object transform in camera space
auto ObjectTranslation = TranslationVec;
cv::Mat ObjectRotation;
Rodrigues(RotationVec, ObjectRotation);
cv::Mat ObjectToCamera = cv::Mat::eye(4, 4, CV_64F);
ObjectRotation.copyTo( ObjectToCamera.rowRange(0, 3).colRange(0, 3) );
ObjectTranslation.copyTo( ObjectToCamera.rowRange(0, 3).col(3) );
auto Result = client.RemoteDevice.RunCommand("DevToolsLauncher.exe", @"LaunchForDeploy cmd ""/C C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\VSRemoteTools\x86\TailoredDeploy.exe /_v CheckDeveloperLicense >> C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\VSRemoteTools\x86\license.txt""");
Console.WriteLine( Result );
client.RemoteDevice.GetFile(@"C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\VSRemoteTools\x86\license.txt", "license.txt");
1>------ Deploy started: Project: HolographicApp1, Configuration: Release Win32 ------
Bootstrapping for deployment, version 4.
BootstrapAsync-Deploying: START
BootstrapAsync-Deploying: Bootstrapping.TargetHash = PII(192.168.0.36)
ConnectTo-Device: START
Connecting to the device '192.168.0.36' using SSH.
Project architecture: X86
Target processor architecture: X86
Target supported architectures: X86
Connected to the device '192.168.0.36'. Execution time: 0:00:00.512.
1>------ Deploy started: Project: HolographicApp1, Configuration: Release Win32 ------
Bootstrapping for deployment, version 4.
BootstrapAsync-Deploying: START
BootstrapAsync-Deploying: Bootstrapping.TargetHash = PII(192.168.0.36)
ConnectTo-Device: START
Connecting to the device '192.168.0.36' using SSH.
Project architecture: X86
Target processor architecture: X86
Target supported architectures: X86
Connected to the device '192.168.0.36'. Execution time: 0:00:04.466.
@SoylentGraham
SoylentGraham / NormalDotLight.shader
Created September 27, 2018 18:28
Very simply lit shader for particle system that uses vertex/particle system colour
Shader "NewChromantics/NormalDotLight"
{
Properties
{
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Cull Off