Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
public class MeshBlit : MonoBehaviour
{
public RenderTexture rt;
public Mesh mesh;
public Material material;
public Vector3 meshPosition = new Vector3(0.5f, 0.5f, -1);
using System.Reflection;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
[CustomEditor(typeof(TextureImporter))]
[CanEditMultipleObjects]
//https://github.com/Unity-Technologies/UnityCsReference/blob/9034442437e6b5efe28c51d02e978a96a3ce5439/Editor/Mono/ImportSettings/TextureImporterInspector.cs
internal class TextureImporterEditor : AssetImporterEditor
{
@elaughli
elaughli / obj2usdz.mm
Created December 12, 2018 22:33
function to convert a saved obj file to USDZ in objective-c
// path to documents directory to save our usdc file
NSString* usdcPath = [documentsDirectory stringByAppendingPathComponent:@"usdcExample.usdc"];
NSURL *usdcUrl = [NSURL fileURLWithPath: usdcPath];
// path to documents directory to save our final usdz file
NSString* usdzPath = [documentsDirectory stringByAppendingPathComponent:@"usdzExample.usdz"];
NSURL *usdzUrl = [NSURL fileURLWithPath:usdzPath];
// load the .obj file at filePath as an MDLAsset
NSURL *url = [NSURL fileURLWithPath:filePath];
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active April 4, 2024 13:42
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@floooh
floooh / cmake_funcs.txt
Last active September 26, 2020 21:51
Fips generator example to copy files during build process
To invoke the generator from the cmake target you should define a helper macro in you project root's "fips-include.cmake" file:
macro(copy_files yml_file)
fips_generate(FROM ${yml_file}
TYPE filecopy
OUT_OF_SOURCE
ARGS "{ deploy_dir: \"${FIPS_PROJECT_DEPLOY_DIR}\" }")
endmacro()
In your cmake target definition you would then use this like:

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active April 25, 2024 17:19
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on