public void TestJobTexture() { float totalCount = Size.x * Size.y * Size.z; if (mpb == null) { mpb = new MaterialPropertyBlock(); } float pct = 0; float[] values = new float[(int)totalCount]; var mr = target.GetComponent <MeshRenderer>(); mr.GetPropertyBlock(mpb); for (int i = 0; i < totalCount; i++) { pct = (float)(i) / totalCount; values[i] = pct; } Action <Texture3D> resultCallback = (tex) => { Debug.Log("Result Callback"); VolumetricTexutre = tex; mpb.SetTexture("_Data", tex); mr.SetPropertyBlock(mpb); #if UNITY_EDITOR AssetDatabase.CreateAsset(tex, "Assets/auto3dTex.asset"); #endif }; Debug.Log("starting Texture job test"); IEnumerator coroutine = VolumetricTools.CreateVolumetricTexture(values, Size, resultCallback); target.GetComponent <CoroutineCaller>().StartCoroutine(coroutine); }
public void GenerateTexture() { VolumetricTools.Create3dTexture(Size, generator); }