Skip to content

Commit

Permalink
update probe in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
z3y committed Oct 23, 2023
1 parent 662e713 commit 34496b7
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 6 deletions.
44 changes: 39 additions & 5 deletions Runtime/CBIRPReflectionProbe.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

using UdonSharp;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using UdonSharpEditor;

#if UNITY_EDITOR && !COMPILER_UDONSHARP
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
#endif

namespace CBIRP
{
Expand Down Expand Up @@ -56,8 +62,10 @@ void Start()
public void UpdateProbe()
{
meshRenderer.sortingOrder = 128 - probe.importance;

_propertyBlock = new MaterialPropertyBlock();
if (_propertyBlock == null)
{
_propertyBlock = new MaterialPropertyBlock();
}

//float intensity = probe.textureHDRDecodeValues.x;
_data0.x = probe.intensity;
Expand All @@ -75,7 +83,13 @@ public void UpdateProbe()
meshRenderer.SetPropertyBlock(_propertyBlock);
}

#if UNITY_EDITOR
#if UNITY_EDITOR && !COMPILER_UDONSHARP

private void Update()
{
Debug.Log("aaa");
}

public void OnValidate()
{
if (!_initialized)
Expand All @@ -89,4 +103,24 @@ public void OnValidate()
}
#endif
}

#if UNITY_EDITOR && !COMPILER_UDONSHARP
[CustomEditor(typeof(CBIRPReflectionProbe))]
public class CBIRPReflectionProbeEditor : Editor
{
public override void OnInspectorGUI()
{
if (UdonSharpGUI.DrawDefaultUdonSharpBehaviourHeader(target)) return;

base.OnInspectorGUI();

if (Application.isPlaying)
{
return;
}
var probe = (CBIRPReflectionProbe)target;
probe.UpdateProbe();
}
}
#endif
}
1 change: 1 addition & 0 deletions Shaders/CBIRP_Internal_Uniforms_Lights.mat
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Material:
serializedVersion: 3
m_TexEnvs: []
m_Floats:
- _Clear: 0
- _ReflectionProbe: 0
m_Colors: []
2 changes: 1 addition & 1 deletion Shaders/Standard.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Shaders/dfg-multiscatter 1.exr
Binary file not shown.
116 changes: 116 additions & 0 deletions Shaders/dfg-multiscatter 1.exr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34496b7

Please sign in to comment.