Skip to content

Instantly share code, notes, and snippets.

@jpsarda
jpsarda / ImagePlane.cs
Created October 6, 2017 12:30
Build dynamically a plane mesh from its 4 corners position in world and displaying an image filling the plane .
using FuretCompany.Utils;
using UnityEngine;
public class ImagePlane : MonoBehaviour
{
public string imageResourceName;
protected Vector3 _topLeft;
public Vector3 topLeft { get { return _topLeft; } set { if (value != _topLeft) { _topLeft = value; _meshDirty = true; } } }
protected Vector3 _topRight;
public Vector3 topRight { get { return _topRight; } set { if (value != _topRight) { _topRight = value; _meshDirty = true; } } }
@jpsarda
jpsarda / WaveExplo.shader
Last active August 3, 2022 05:10
Unity (pro) post processing explosion wave effect (need GoKit library). You call it like this : WaveExploPostProcessing.Get().StartIt(myVector2Position);
Shader "Custom/WaveExplo" {
Properties {
_MainTex ("", 2D) = "white" {}
_CenterX ("CenterX", Range(-1,2)) = 0.5
_CenterY ("CenterY", Range(-1,2)) = 0.5
_Radius ("Radius", Range(-1,1)) = 0.2
_Amplitude ("Amplitude", Range(-10,10)) = 0.05
}
SubShader {
@jpsarda
jpsarda / FSpriteHolesShader.cs
Last active July 20, 2020 08:40
Holes with futile, see usage.cs
public class FSpriteHolesShader : FShader
{
private Texture _hole0Texture=null;
private Vector4 _hole0LocalToUVParams;
private Vector4 _hole0MatrixABCD;
private Vector4 _hole0MatrixTxTy;
private Vector4 _hole0UVRect;
private FSprite _hole0Sprite=null;
static private Vector4 _screenParams;
@jpsarda
jpsarda / FHole0Shader.cs
Created May 13, 2014 20:53
CG Shader to dig a hole in an image in Futile/Unity3D. See usage.cs for more details.
public class FHole0Shader : FShader
{
private Texture _hole0Texture=null;
private Vector2 _hole0Offset=Vector2.zero;
public Texture hole0Texture
{
get {return _hole0Texture;}
}
public void SetHole0(FAtlasElement hole0Element,FAtlasElement toDigElement) {
@jpsarda
jpsarda / Fractals.cs
Created March 23, 2014 14:59
Fun with Fractals and Futile (Unity). A simple C# class to play with animated fractals. (You need also FSpriteTrail https://gist.github.com/jpsarda/8760429 )
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
/*
FractalElement e = new FractalElement(60f,true,4);
Color c=RandomUtils.RandomColor();
@jpsarda
jpsarda / TrailPath.cs
Last active December 11, 2023 04:35
Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method. See description and usage in code. https://vine.co/v/MzpwETVAKIT
using UnityEngine;
using System;
using System.Collections.Generic;
/*
*
* Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method.
* FSpriteTrail provided as an example.
* https://vine.co/v/MzpwETVAKIT
*
@jpsarda
jpsarda / FGlowShader.cs
Created December 21, 2013 13:59
A Glow CG shader for Futile (Unity 3D)
public class FGlowShader : FShader
{
private float _glowAmount;
private Color _glowColor;
public FGlowShader(float glowAmount,Color glowColor) : base("GlowShader", Shader.Find("Futile/Glow"))
{
_glowAmount = glowAmount;
_glowColor = glowColor;
needsApply = true;
@jpsarda
jpsarda / Blur.shader
Last active December 11, 2023 04:36
A Blur CG shader for Futile (Unity 3D)
Shader "Futile/Blur"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Color ("Main Color", Color) = (1,0,0,1.5)
_BlurAmount ("Blur Amount", Range(0,02)) = 0.0005
}
Category
@jpsarda
jpsarda / GPUImageSaturationExposureGammaRGBFilter.h
Created December 17, 2013 10:06
GPUImageSaturationExposureGammaRGBFilter is a combined GPUImageFilter. You use only one filter (one FBO) instead of using 4 chained filters (4 FBO) which is much better for memory usage. ( see why I did this https://github.com/BradLarson/GPUImage/issues/1346 )
//
// GPUSaturationExposureGammaRGBFilter.h
// bonnemine
//
// Created by Jean-Philippe SARDA on 12/17/13.
// Copyright (c) 2013 My Little Paris. All rights reserved.
//
#import "GPUImageFilter.h"
@jpsarda
jpsarda / MiniJSON.cs
Last active July 10, 2020 00:46 — forked from darktable/MiniJSON.cs
Added comments support, everything after a "#" is ignored, except if the "#" is in a token. It seems to work approximately the way monodevelop show the comments in orange color in a json file. (I know comments are not part of the json format, but it comes in handy sometimes).
/*
* Copyright (c) 2012 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining