This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not working Yet
- Loading branch information
Showing
6 changed files
with
123 additions
and
77 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using BaseX; | ||
using CloudX.Shared; | ||
using FrooxEngine; | ||
using NEOSPlus.Shaders; | ||
|
||
[Category(new string[] { "Assets/Materials/NeosPlus/Effects" })] | ||
public class Hologram : SingleShaderMaterialProvider | ||
{ | ||
protected override Uri ShaderURL => ShaderInjection.FragmentHologram; | ||
|
||
// Main | ||
public readonly AssetRef<ITexture2D> MainTexture; | ||
public readonly Sync<color> MainColor; | ||
// Repeating ramp | ||
public readonly AssetRef<ITexture2D> RampTexture; | ||
public readonly Sync<float> RampScale; | ||
public readonly Sync<float> ScrollSpeed; | ||
// Fresnel | ||
public readonly Sync<color> FresnelColor; | ||
public readonly Sync<float> FresnelStrength; | ||
public readonly Sync<float> FresnelPower; | ||
|
||
[DefaultValue(-1)] | ||
public readonly Sync<int> RenderQueue; | ||
private static PropertyState _propertyInitializationState; | ||
|
||
// Main | ||
private static MaterialProperty _MainColor = new MaterialProperty("_MainColor"); | ||
private static MaterialProperty _MainTexture = new MaterialProperty("_MainTexture"); | ||
// Repeating ramp | ||
private static MaterialProperty _RampTexture = new MaterialProperty("_RampTexture"); | ||
private static MaterialProperty _RampScale = new MaterialProperty("_RampScale"); | ||
private static MaterialProperty _ScrollSpeed = new MaterialProperty("_ScrollSpeed"); | ||
// Fresnel | ||
private static MaterialProperty _FresnelColor = new MaterialProperty("_FresnelColor"); | ||
private static MaterialProperty _FresnelStrength = new MaterialProperty("_FresnelStrength"); | ||
private static MaterialProperty _FresnelPower = new MaterialProperty("_FresnelPower"); | ||
|
||
public override PropertyState PropertyInitializationState | ||
{ | ||
get => _propertyInitializationState; | ||
protected set => _propertyInitializationState = value; | ||
} | ||
protected override void UpdateMaterial(Material material) | ||
{ | ||
// Main | ||
material.UpdateTexture(_MainTexture, MainTexture); | ||
material.UpdateColor(_MainColor, MainColor); | ||
// Repeating ramp | ||
material.UpdateTexture(_RampTexture, RampTexture); | ||
material.UpdateFloat(_RampScale, RampScale); | ||
material.UpdateFloat(_ScrollSpeed, ScrollSpeed); | ||
// Fresnel | ||
material.UpdateColor(_FresnelColor, FresnelColor); | ||
material.UpdateFloat(_FresnelStrength, FresnelStrength); | ||
material.UpdateFloat(_FresnelPower, FresnelPower); | ||
|
||
if (!RenderQueue.GetWasChangedAndClear()) return; | ||
var renderQueue = RenderQueue.Value; | ||
if ((int)RenderQueue == -1) renderQueue = 2600; | ||
material.SetRenderQueue(renderQueue); | ||
} | ||
protected override void UpdateKeywords(ShaderKeywords keywords) { } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
| ||
using BaseX; | ||
using FrooxEngine; | ||
using System; | ||
|
||
namespace NEOSPlus.Shaders | ||
{ | ||
[ImplementableClass(true)] | ||
internal class ExecutionHook | ||
{ | ||
#pragma warning disable CS0169 | ||
private static Type? __connectorType; | ||
private static Type? __connectorTypes; | ||
#pragma warning restore CS0169 | ||
|
||
static ExecutionHook() | ||
{ | ||
try | ||
{ | ||
Engine.Current.OnReady += () => | ||
{ | ||
ShaderInjection.AppendShaders(); | ||
}; | ||
} | ||
catch (Exception e) | ||
{ | ||
UniLog.Log($"Thrown Exception \n{e}"); | ||
} | ||
} | ||
|
||
private static DummyConnector InstantiateConnector() | ||
{ | ||
return new DummyConnector(); | ||
} | ||
|
||
private class DummyConnector : IConnector | ||
{ | ||
public IImplementable? Owner { get; private set; } | ||
public void ApplyChanges() { } | ||
public void AssignOwner(IImplementable owner) => Owner = owner; | ||
public void Destroy(bool destroyingWorld) { } | ||
public void Initialize() { } | ||
public void RemoveOwner() => Owner = null; | ||
} | ||
} | ||
} |
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