Skip to content

Instantly share code, notes, and snippets.

View peted70's full-sized avatar
™️

Pete D peted70

™️
View GitHub Profile
@peted70
peted70 / TMP_SDF-MobileInstanced.shader
Created March 14, 2019 10:05
TextMeshPro Shader updated to work with Single pass stereo rendering in Unity
// 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
<linker>
<assembly fullname="Microsoft.Identity.Client" preserve="all"/>
<assembly fullname="System.Runtime.Serialization" preserve="all"/>
</linker>
@peted70
peted70 / link.xml
Created January 18, 2019 11:45
link.xml used to preserve code and prevent stripping in .NET library using il2cpp
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
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;
});
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
<!DOCTYPE html>
<html>
<head>
<title>WebVR on Hololens</title>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script type="javascript">
</script>
</head>
<body>
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;
ThrowIfFailed(unknown.As(&fileAccessor));
// Use the IStorageItemHandleAccess::Create method to retrieve an OS HANDLE
shared_ptr<void> fileHandle;
HANDLE file = nullptr;
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...
#ifdef HAS_METALROUGHNESSMAP
// 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;
#endif
// 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..