-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cvusmo/dev
Adding volumetric shader information and slowly integrating the shade…
- Loading branch information
Showing
7 changed files
with
123 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
//|=====================Summary========================|0| | ||
//| Animation Bridge |1| | ||
//|by cvusmo===========================================|4| | ||
//|====================================================|2| | ||
using FFT.Modules; | ||
using FFT.Utilities; | ||
using UnityEngine; | ||
|
||
namespace FFT.Controllers | ||
{ | ||
public class AnimationBridge : MonoBehaviour | ||
{ | ||
public Material targetMaterial; | ||
public Texture3D[] vaporTextures; | ||
public float animationValue; | ||
|
||
public float intensity = 0.3f; | ||
public float stepDistance = 0.01f; | ||
|
||
private int currentTextureIndex = 0; | ||
private float timeSinceLastChange = 0.0f; | ||
private void Awake() | ||
{ | ||
SetTexture(); | ||
} | ||
private void Update() | ||
{ | ||
if (targetMaterial != null) | ||
{ | ||
timeSinceLastChange += Time.deltaTime; | ||
|
||
if (timeSinceLastChange >= animationValue) | ||
{ | ||
SetNextTexture(); | ||
timeSinceLastChange = 0f; | ||
} | ||
} | ||
} | ||
private void SetTexture() | ||
{ | ||
if (vaporTextures != null && vaporTextures.Length > 0) | ||
{ | ||
targetMaterial.SetTexture("_Volume", vaporTextures[currentTextureIndex]); | ||
} | ||
} | ||
private void SetNextTexture() | ||
{ | ||
currentTextureIndex = (currentTextureIndex + 1) % vaporTextures.Length; | ||
SetTexture(); | ||
} | ||
public void UpdateShaderProperties(Material cachedMaterial, float customIntensity, float customStepDistance, float customASL, float customAGL, float customVV, float customHV, float customDP, float customSP, float customAT, float customET, float customFL) | ||
{ | ||
if (targetMaterial) | ||
{ | ||
targetMaterial.SetFloat("_Intensity", customIntensity); | ||
targetMaterial.SetFloat("_StepDistance", customStepDistance); | ||
targetMaterial.SetFloat("_ASL", customASL); | ||
targetMaterial.SetFloat("_AGL", customAGL); | ||
targetMaterial.SetFloat("_VV", customVV); | ||
targetMaterial.SetFloat("_HV", customHV); | ||
targetMaterial.SetFloat("_DP", customDP); | ||
targetMaterial.SetFloat("_SP", customSP); | ||
targetMaterial.SetFloat("_AT", customAT); | ||
targetMaterial.SetFloat("_ET", customET); | ||
targetMaterial.SetFloat("_FL", customFL); | ||
} | ||
if (cachedMaterial) | ||
{ | ||
cachedMaterial.SetFloat("_Intensity", customIntensity); | ||
cachedMaterial.SetFloat("_StepDistance", customStepDistance); | ||
cachedMaterial.SetFloat("_ASL", customASL); | ||
cachedMaterial.SetFloat("_AGL", customAGL); | ||
cachedMaterial.SetFloat("_VV", customVV); | ||
cachedMaterial.SetFloat("_HV", customHV); | ||
cachedMaterial.SetFloat("_DP", customDP); | ||
cachedMaterial.SetFloat("_SP", customSP); | ||
cachedMaterial.SetFloat("_AT", customAT); | ||
cachedMaterial.SetFloat("_ET", customET); | ||
cachedMaterial.SetFloat("_FL", customFL); | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters