Skip to content

Commit

Permalink
Shadetoy example scene
Browse files Browse the repository at this point in the history
  • Loading branch information
marwie committed Sep 23, 2024
1 parent e6b2a3c commit 267ac50
Show file tree
Hide file tree
Showing 4 changed files with 581 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ namespace Needle.Typescript.GeneratedComponents
public partial class ShaderToyFaceFilter : Needle.Typescript.GeneratedComponents.FaceMeshBehaviour
{
public UnityEngine.Texture @mask;
public void update(){}
public void awake(){}
public void OnEnable(){}
public void OnDisable(){}
public void update(){}
}
}

Expand Down
17 changes: 10 additions & 7 deletions package/Runtime/Facefilter/FaceFilter~/src/examples/ShaderToy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Behaviour, Context, getParam, makeIdFromRandomWords, serializable, setParam, setParamWithoutReload, showBalloonWarning, syncField } from "@needle-tools/engine";
import { Behaviour, Context, getParam, makeIdFromRandomWords, serializable, setParam, setParamWithoutReload, showBalloonMessage, showBalloonWarning, syncField } from "@needle-tools/engine";
import { FaceMeshBehaviour } from "../facemesh/FaceMeshBehaviour";
import { Material, ShaderMaterial, ShaderMaterialParameters, Texture, Vector3, Vector4 } from "three";

Expand Down Expand Up @@ -121,12 +121,8 @@ export class ShaderToyFaceFilter extends FaceMeshBehaviour {
}
})
}

update(): void {
const material = this.material as ShaderToyMaterial;
if (material) {
material.update(this)
}
awake() {
showBalloonMessage(`Copy paste <a href=\"https://shadertoy.com\" target=\"_blank\">shadertoy</a> shaders (the whole code) to use as a face filter.<br/>For example <a href=\"https://www.shadertoy.com/view/tlVGDt\" target=\"_blank\">this one</a> or <a href=\"https://www.shadertoy.com/view/ftSSRR\" target=\"_blank\">this one</a> or <a href=\"https://www.shadertoy.com/new\" target=\"_blank\">create your own</a>.`);
}
onEnable(): void {
super.onEnable();
Expand All @@ -148,6 +144,13 @@ export class ShaderToyFaceFilter extends FaceMeshBehaviour {
}
}

update(): void {
const material = this.material as ShaderToyMaterial;
if (material) {
material.update(this)
}
}

@syncField(ShaderToyFaceFilter.prototype.onShaderChanged)
private _networkedShader: string | null = null;

Expand Down
Loading

0 comments on commit 267ac50

Please sign in to comment.