├── Assets ├── Materials.meta ├── Materials │ ├── MultiColor.mat │ ├── MultiColor.mat.meta │ ├── Multicolor.shader │ └── Multicolor.shader.meta ├── Scene.meta ├── Scene │ ├── main.unity │ └── main.unity.meta ├── Scripts.meta └── Scripts │ ├── SimpleMeshGenerator.cs │ └── SimpleMeshGenerator.cs.meta ├── README.md └── img ├── curve.gif └── function.png /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4c3d87288ab3412498741ceb6ed1964 3 | folderAsset: yes 4 | timeCreated: 1475694626 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/MultiColor.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josemorval/SimpleCurveGenerator-in-Unity/914f233d394c67d7d4ea0114fc704f591e344c91/Assets/Materials/MultiColor.mat -------------------------------------------------------------------------------- /Assets/Materials/MultiColor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01816c2b2d84347aa997538de7b9aa78 3 | timeCreated: 1475684928 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Multicolor.shader: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' 2 | 3 | Shader "Unlit/Multicolor" 4 | { 5 | Properties 6 | { 7 | _Color1 ("Color 1", Color) = (0,0,0,0) 8 | _Color2 ("Color 2", Color) = (0,0,0,0) 9 | _Color3 ("Color 3", Color) = (0,0,0,0) 10 | } 11 | SubShader 12 | { 13 | Tags { "RenderType"="Opaque" } 14 | LOD 100 15 | 16 | Pass 17 | { 18 | CGPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | 22 | #include "UnityCG.cginc" 23 | 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | }; 28 | 29 | struct v2f 30 | { 31 | float4 worldPos : TEXCOORD0; 32 | float4 vertex : SV_POSITION; 33 | }; 34 | 35 | float4 _Color1; 36 | float4 _Color2; 37 | float4 _Color3; 38 | 39 | v2f vert (appdata v) 40 | { 41 | v2f o; 42 | o.vertex = UnityObjectToClipPos(v.vertex); 43 | o.worldPos = mul(unity_ObjectToWorld,v.vertex); 44 | return o; 45 | } 46 | 47 | fixed4 frag (v2f i) : SV_Target 48 | { 49 | fixed4 col = lerp(_Color1,_Color2,(i.worldPos.y+0.5)/0.5); 50 | col = lerp(_Color2,_Color3,i.worldPos.y/0.5); 51 | return col; 52 | } 53 | ENDCG 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/Materials/Multicolor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a29db03efead348229c7a16db05e39c5 3 | timeCreated: 1475692664 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae949e69bedf7461c9c64f7500ff3842 3 | folderAsset: yes 4 | timeCreated: 1475694658 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scene/main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josemorval/SimpleCurveGenerator-in-Unity/914f233d394c67d7d4ea0114fc704f591e344c91/Assets/Scene/main.unity -------------------------------------------------------------------------------- /Assets/Scene/main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 948f3937a99e64c82a0cb8e5277b8f83 3 | timeCreated: 1475690303 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a6dd33ffd86b4ace94971d338d82847 3 | folderAsset: yes 4 | timeCreated: 1475694618 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/SimpleMeshGenerator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class SimpleMeshGenerator : MonoBehaviour { 5 | 6 | public int N; 7 | public float width; 8 | public float longWidth; 9 | public float timeFactor; 10 | 11 | Mesh _mesh; 12 | Vector3[] _vs; 13 | int[] _inds; 14 | 15 | void Start () { 16 | 17 | _vs = new Vector3[2*N]; 18 | _inds = new int[6*(N-1)]; 19 | 20 | int k=0; 21 | for(int i=0;i().mesh = _mesh; 41 | 42 | } 43 | 44 | void GenerateMesh(){ 45 | for(int i=0;i 9 | -------------------------------------------------------------------------------- /img/curve.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josemorval/SimpleCurveGenerator-in-Unity/914f233d394c67d7d4ea0114fc704f591e344c91/img/curve.gif -------------------------------------------------------------------------------- /img/function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josemorval/SimpleCurveGenerator-in-Unity/914f233d394c67d7d4ea0114fc704f591e344c91/img/function.png --------------------------------------------------------------------------------