forked from mlavik1/UnityVolumeRendering
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add switch on (single or all removal component) (UI & code)
- Loading branch information
Showing
32 changed files
with
4,461 additions
and
493 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
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 |
---|---|---|
@@ -1,70 +1,72 @@ | ||
using UnityEngine; | ||
//using UnityEngine; | ||
|
||
namespace UnityVolumeRendering | ||
{ | ||
public class ShaderDebugging_Mask : MonoBehaviour | ||
{ | ||
public GameObject target_Mask; | ||
//namespace UnityVolumeRendering | ||
//{ | ||
// public class ShaderDebugging_Mask : MonoBehaviour | ||
// { | ||
// public GameObject target_Mask; | ||
|
||
private Material material_Mask; | ||
private ComputeBuffer buffer_Mask; | ||
public Vector4[] element_Mask; | ||
private string label_Mask; | ||
private Renderer render_Mask; | ||
// private Material material_Mask; | ||
// private ComputeBuffer buffer_Mask; | ||
// public Vector4[] element_Mask; | ||
// private string label_Mask; | ||
// private Renderer render_Mask; | ||
|
||
MeshRenderer meshRenderer_Mask; | ||
Material mat_Mask; | ||
// MeshRenderer meshRenderer_Mask; | ||
// Material mat_Mask; | ||
|
||
|
||
void Load() | ||
{ | ||
buffer_Mask = new ComputeBuffer(10, 16, ComputeBufferType.Default); | ||
element_Mask = new Vector4[10]; | ||
for(int i=0; i < buffer_Mask.count; i++) | ||
{ | ||
element_Mask[i] = new Vector4(0, 0, 0, 0); | ||
} | ||
buffer_Mask.SetData(element_Mask); | ||
// void Load() | ||
// { | ||
// buffer_Mask = new ComputeBuffer(10, 16, ComputeBufferType.Default); | ||
// element_Mask = new Vector4[10]; | ||
// for(int i=0; i < buffer_Mask.count; i++) | ||
// { | ||
// element_Mask[i] = new Vector4(0, 0, 0, 0); | ||
// } | ||
// buffer_Mask.SetData(element_Mask); | ||
|
||
label_Mask = string.Empty; | ||
render_Mask = target_Mask.GetComponent<Renderer>(); | ||
material_Mask = render_Mask.material; | ||
} | ||
// label_Mask = string.Empty; | ||
// //render_Mask = target_Mask.GetComponent<Renderer>(); | ||
|
||
// } | ||
|
||
void Start() | ||
{ | ||
Load(); | ||
VolumeRenderedObject_Mask[] objects_Mask = FindObjectsOfType<VolumeRenderedObject_Mask>(); | ||
if (objects_Mask.Length == 1) | ||
{ | ||
meshRenderer_Mask = objects_Mask[0].meshRenderer; | ||
mat_Mask = meshRenderer_Mask.material; | ||
} | ||
} | ||
// void Start() | ||
// { | ||
// VolumeRenderedObject_Mask[] objects_Mask = FindObjectsOfType<VolumeRenderedObject_Mask>(); | ||
// if (objects_Mask.Length == 1) | ||
// { | ||
// render_Mask = objects_Mask[0].GetComponent<Transform>().GetChild(0).GetComponent<Renderer>(); | ||
// material_Mask = render_Mask.material; | ||
// Load(); | ||
// meshRenderer_Mask = objects_Mask[0].meshRenderer; | ||
// mat_Mask = meshRenderer_Mask.material; | ||
// } | ||
// } | ||
|
||
void Update() | ||
{ | ||
Graphics.ClearRandomWriteTargets(); | ||
material_Mask.SetPass(0); | ||
material_Mask.SetBuffer("buffer_Mask", buffer_Mask); | ||
Graphics.SetRandomWriteTarget(2, buffer_Mask, false); | ||
// void Update() | ||
// { | ||
// //Graphics.ClearRandomWriteTargets(); | ||
// material_Mask.SetPass(0); | ||
// material_Mask.SetBuffer("buffer_Mask", buffer_Mask); | ||
// Graphics.SetRandomWriteTarget(2, buffer_Mask, false); | ||
|
||
buffer_Mask.GetData(element_Mask); | ||
// buffer_Mask.GetData(element_Mask); | ||
|
||
label_Mask = (element_Mask != null && render_Mask.isVisible) ? element_Mask[0].ToString() : string.Empty; | ||
} | ||
// label_Mask = (element_Mask != null && render_Mask.isVisible) ? element_Mask[0].ToString() : string.Empty; | ||
// } | ||
|
||
void OnGUI() | ||
{ | ||
GUIStyle style = new GUIStyle(); | ||
// void OnGUI() | ||
// { | ||
// GUIStyle style = new GUIStyle(); | ||
|
||
GUI.color = Color.white; | ||
style.fontSize = 32; | ||
} | ||
// GUI.color = Color.white; | ||
// style.fontSize = 32; | ||
// } | ||
|
||
void OnDestroy() | ||
{ | ||
buffer_Mask.Dispose(); | ||
} | ||
} | ||
} | ||
// void OnDestroy() | ||
// { | ||
// buffer_Mask.Dispose(); | ||
// } | ||
// } | ||
//} |
Oops, something went wrong.