Skip to content

Instantly share code, notes, and snippets.

View Anthelmed's full-sized avatar

Anthelme Dumont Anthelmed

View GitHub Profile
@Anthelmed
Anthelmed / ReplaceDuplicateMeshesEditorWindow
Last active October 3, 2020 17:29
Unity - Find and replace meshes that are identical but use different assets
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace AnthelmeDumontTools
{
public class ReplaceDuplicateMeshesEditorWindow : EditorWindow
{
private GameObject[] _selectedObjects;
Shader "Custom/SilhouetteShader"
{
Properties
{
_SilhouetteColor("Silhouette Color", Color) = (0,1,0,1)
}
SubShader
{
Tags{"Queue"="Geometry+1" "RenderType" = "Geometry"}
@Anthelmed
Anthelmed / BlendingSurfaceShader.shader
Created September 6, 2017 13:20
Unity blending shader prototype
Shader "Custom/BlendingSurfaceShader" {
Properties {
[NoScaleOffset] _NoiseTex ("Noise", 2D) = "white" {}
[NoScaleOffset] _BottomDiffuseTex ("Bottom diffuse", 2D) = "white" {}
[NoScaleOffset] [Normal] _BottomNormalTex ("Bottom normal", 2D) = "bump" {}
[NoScaleOffset] _MiddleDiffuseTex ("Middle diffuse", 2D) = "white" {}
[NoScaleOffset] [Normal] _MiddleNormalTex ("Middle normal", 2D) = "bump" {}
@Anthelmed
Anthelmed / WRL loader and parser
Last active April 2, 2018 21:03
WRL loader/parser es6
/**
* WRLLoader class
*/
class WRLLoader {
/**
* load method
* @returns {Promise}
*/
load(path) {
const xhr = new XMLHttpRequest();
@Anthelmed
Anthelmed / Custom cannon js body
Last active November 9, 2022 00:05
Using v-hacd https://github.com/kmammou/v-hacd to create custom collider for cannon js
import THREE from 'three';
import CANNON from 'cannon';
export const generateThreeVertices = (rawVerts) => {
let verts = [];
for(let v = 0; v < rawVerts.length; v+=3){
verts.push(new THREE.Vector3(rawVerts[v],
rawVerts[v+1],
rawVerts[v+2]));