Skip to content

Instantly share code, notes, and snippets.

Pete D peted70

Block or report user

Report or block peted70

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
peted70 / TMP_SDF-MobileInstanced.shader
Created Mar 14, 2019
TextMeshPro Shader updated to work with Single pass stereo rendering in Unity
View TMP_SDF-MobileInstanced.shader
// Simplified SDF shader:
// - No Shading Option (bevel / bump / env map)
// - No Glow Option
// - Softness is applied on both side of the outline
Shader "TextMeshPro/Mobile/Distance Field Instanced" {
Properties {
_FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0
View link2.xml
<assembly fullname="Microsoft.Identity.Client" preserve="all"/>
<assembly fullname="System.Runtime.Serialization" preserve="all"/>
peted70 / link.xml
Created Jan 18, 2019
link.xml used to preserve code and prevent stripping in .NET library using il2cpp
View link.xml
View devicecode.cs
res.res = await app.AcquireTokenWithDeviceCodeAsync(scopes, string.Empty,
deviceCodeCallback =>
// This will print the message on the console which tells the user where to go sign-in using
// a separate browser and the code to enter once they sign in.
// The AcquireTokenWithDeviceCodeAsync() method will poll the server after firing this
// device code callback to look for the successful login of the user via that browser.
// This background polling (whose interval and timeout data is also provided as fields in the
// deviceCodeCallback class) will occur until:
// * The user has successfully logged in via browser and entered the proper code
View ADToken.cs
public void ConfigureServices(IServiceCollection services)
services.Configure<CookiePolicyOptions>(options =>
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
View a-frame-webvr-gltf.html
<!DOCTYPE html>
<title>WebVR on Hololens</title>
<script src=""></script>
<script type="javascript">
View uwp-native-stream.cpp
void GLTF_Parser::ParseFile(StorageFile^ storageFile)
// try to get an IStorageItemHandleAccess interface from the StorageFile
ComPtr<IUnknown> unknown(reinterpret_cast<IUnknown*>(storageFile));
ComPtr<IStorageItemHandleAccess> fileAccessor;
// Use the IStorageItemHandleAccess::Create method to retrieve an OS HANDLE
shared_ptr<void> fileHandle;
HANDLE file = nullptr;
View shadercache.cpp
void MeshNode::CompileAndLoadPixelShader()
// Create a shader descriptor which we can use to either find the shader in the
// shader cache or create and add it.
// The hash used for lookup is generated from the shader name and defines passed
// when it is compiled
ShaderDescriptor descriptor("pbrpixel.hlsl", DevResources());
auto textures = _material->Textures();
// Allocate the defines map...
View pbr1.c
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
float4 mrSample = metallicRoughnessTexture.Sample(metallicRoughnessSampler, input.texcoord);
perceptualRoughness = mrSample.g * perceptualRoughness;
metallic = mrSample.b * metallic;
View using-subject.cpp
// I can declare a variable like this
subject<SceneManager const&> SceneChanged;
// subscribe for changes using an arbitrary function signature
sub_token RegisterForUpdates(function<void(SceneManager const&)> slot)
return SceneChanged.subscribe(slot);
// Then when changes happen, notify observers like this..
You can’t perform that action at this time.