#if UNITY_EDITOR
using System;
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class CreateResetTexture : MonoBehaviour {

	[MenuItem("GameObject/ResetTexture/8k")]
    static void CreateResetTexture8k_(){CreateResetTexture_(128, 128, "8k");}

    [MenuItem("GameObject/ResetTexture/32k")]
    static void CreateResetTexture32k_(){CreateResetTexture_(256, 256, "32k");}

    [MenuItem("GameObject/ResetTexture/131k")]
    static void CreateResetTexture131k_(){CreateResetTexture_(512, 512, "131k");}

    [MenuItem("GameObject/ResetTexture/524k")]
    static void CreateResetTexture524k_(){CreateResetTexture_(1024, 1024, "524k");}

    [MenuItem("GameObject/ResetTexture/2M")]
    static void CreateResetTexture2M_(){CreateResetTexture_(2048, 2048, "2M");}

    static void CreateResetTexture_(int width, int height, String name){
		var texture = new Texture2D(width, height, TextureFormat.RGBAFloat, false, true);
		texture.filterMode = FilterMode.Point;

		for(int y = 0; y < height; y++){
			for(int x = 0; x < width; x++){
				if(y < height/2){
					Vector3 pos = UnityEngine.Random.insideUnitSphere;
					texture.SetPixel(x, y, new Color(pos.x/2.0f, pos.y/2.0f, pos.z/2.0f, 1.0f));
				}else{
					texture.SetPixel(x, y, new Color(0.0f, 0.0f, 0.0f, 1.0f));
				}
			}
		}

		texture.Apply();

		AssetDatabase.CreateAsset(texture, "Assets/GPU Particles/Resources/ResetTexture" + name + ".asset");
	}
}
#endif
