diff --git a/Runtime/Actions/ActionSequence.cs b/Runtime/Actions/ActionSequence.cs index 889e30f..9dea778 100644 --- a/Runtime/Actions/ActionSequence.cs +++ b/Runtime/Actions/ActionSequence.cs @@ -188,6 +188,7 @@ namespace Rokojori } + [Tool] [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ActionSequence.svg") ] public partial class ActionSequence:SequenceAction { diff --git a/Runtime/Actions/Conditional/ConditionalAction.cs b/Runtime/Actions/Conditional/ConditionalAction.cs index e54ac06..ec0b800 100644 --- a/Runtime/Actions/Conditional/ConditionalAction.cs +++ b/Runtime/Actions/Conditional/ConditionalAction.cs @@ -26,7 +26,7 @@ namespace Rokojori { var conditionActive = Condition.Evaluate( condition ) && SceneCondition.Evaluate( sceneCondition ); - this.LogInfo( "Condition is", conditionActive ); + // this.LogInfo( "Condition is", conditionActive ); if ( conditionActive ) { diff --git a/Runtime/Actions/Node3D/PlaySound.cs b/Runtime/Actions/Node3D/PlaySound.cs index 5196fd3..2b193fb 100644 --- a/Runtime/Actions/Node3D/PlaySound.cs +++ b/Runtime/Actions/Node3D/PlaySound.cs @@ -1,5 +1,6 @@ using Godot; +using System.Collections.Generic; namespace Rokojori { @@ -7,11 +8,91 @@ namespace Rokojori public partial class PlaySound:Action { [Export] - public AudioStreamPlayer player; + public AudioStreamPlayer3D player; + + + [ExportGroup("Randomize Playback Position")] + [Export] + public bool randomizePlaybackPosition = false; + + [Export] + public Duration durationPerSound; + + [Export] + public bool generatePools = true; + + + List players = new List(); + + + AudioStreamPlayer3D GetFreePlayer() + { + if ( players.Count == 0 ) + { + players.Add( player ); + } + + var freePlayer = players.Find( p => ! p.Playing ); + + if ( freePlayer != null ) + { + return freePlayer; + } + + var newPlayer = player.GetParent().CreateChild(); + newPlayer.Stream = player.Stream; + newPlayer.VolumeDb = player.VolumeDb; + newPlayer.MaxDb = player.MaxDb; + newPlayer.UnitSize = player.UnitSize; + newPlayer.AttenuationModel = player.AttenuationModel; + + players.Add( newPlayer ); + return newPlayer; + + } protected override void _OnTrigger() { - player.Play(); + var offset = 0f; + + var player = generatePools ? GetFreePlayer() : this.player; + + if ( randomizePlaybackPosition ) + { + var random = LCG.WithSeed( networkSeed ); + + var length = player.Stream.GetLength(); + var numOffsets = Mathf.FloorToInt( length / durationPerSound.GetDurationInSeconds() ); + var randomIndex = random.IntegerExclusive( numOffsets ); + offset = randomIndex * durationPerSound.GetDurationInSeconds(); + + // this.LogInfo( "Offset", numOffsets, randomIndex, offset ); + } + + player.Play( offset ); + + if ( randomizePlaybackPosition ) + { + var tl = TimeLineManager.Ensure( durationPerSound.timeLine ); + + var start = tl.position; + + TimeLineManager.ScheduleSpanIn( durationPerSound.timeLine, 0, durationPerSound.GetDurationInSeconds(), + ( span, type )=> + { + var timeNow = tl.position; + var elapsed = timeNow - start; + + var phase = span.phase; + + if ( type == TimeLineSpanUpdateType.End ) + { + player.Stop(); + player.Playing = false; + } + } + ); + } } } } \ No newline at end of file diff --git a/Runtime/Actions/OnTick.cs b/Runtime/Actions/OnTick.cs index 11da33a..b79266e 100644 --- a/Runtime/Actions/OnTick.cs +++ b/Runtime/Actions/OnTick.cs @@ -25,13 +25,10 @@ namespace Rokojori } [Export] - public float duration; + public Duration tickDuration; [Export] - public float offset; - - [Export] - public TimeLine timeLine; + public Duration offsetDuration; int _eventID = -1; @@ -44,12 +41,18 @@ namespace Rokojori _active = active; + var timeLine = tickDuration.timeLine; + if ( _active ) { + var duration = tickDuration.GetDurationInSeconds(); + var offset = offsetDuration.GetDurationInSeconds(); + + // this.LogInfo( "duration", duration, "offset", offset ); + if ( _eventID != -1 ) { TimeLineManager.RemoveEvent( timeLine, _eventID ); - return; } var tle = TimeLineManager.ScheduleLoopEvent( timeLine, duration, offset, tle => Action.Trigger( action ) ); diff --git a/Runtime/Actions/Sequence/RepeatSequence.cs b/Runtime/Actions/Sequence/RepeatSequence.cs index ca60e05..f97bb2e 100644 --- a/Runtime/Actions/Sequence/RepeatSequence.cs +++ b/Runtime/Actions/Sequence/RepeatSequence.cs @@ -10,7 +10,6 @@ namespace Rokojori [Export] public Action action; - [Export] public int maxNumRepeats = 3; diff --git a/Runtime/Actions/SetTick.cs b/Runtime/Actions/SetTick.cs new file mode 100644 index 0000000..747b2f5 --- /dev/null +++ b/Runtime/Actions/SetTick.cs @@ -0,0 +1,27 @@ + +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class SetTick: Action + { + [Export] + public OnTick tick; + + [Export] + public bool active = true; + + protected override void _OnTrigger() + { + if ( tick == null ) + { + return; + } + + tick.active = active; + } + } +} \ No newline at end of file diff --git a/Runtime/Actions/SetTick.cs.uid b/Runtime/Actions/SetTick.cs.uid new file mode 100644 index 0000000..6567de7 --- /dev/null +++ b/Runtime/Actions/SetTick.cs.uid @@ -0,0 +1 @@ +uid://cow7sv7kn0moo diff --git a/Runtime/Actions/Visual/TweenMaterial.cs b/Runtime/Actions/Visual/TweenMaterial.cs index e14b8e1..53fa794 100644 --- a/Runtime/Actions/Visual/TweenMaterial.cs +++ b/Runtime/Actions/Visual/TweenMaterial.cs @@ -68,7 +68,7 @@ namespace Rokojori } ); - [ExportToolButton( "Get Material Delta")] + [ExportToolButton( "Log Material Delta")] public Callable GetMaterialDeltaButton => Callable.From( () => { @@ -98,7 +98,7 @@ namespace Rokojori var delta = MaterialDelta.Create( fromMaterial, toMaterial ); - this.LogInfo( "Delta:", delta ); + // this.LogInfo( "Delta:", delta ); colors = delta.colorProperties.ToArray(); diff --git a/Runtime/Animation/Highlight/HighlightEffect.cs b/Runtime/Animation/Highlight/HighlightEffect.cs index 207c0a3..02165b9 100644 --- a/Runtime/Animation/Highlight/HighlightEffect.cs +++ b/Runtime/Animation/Highlight/HighlightEffect.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using System.Text; using Godot; +using System.Linq; namespace Rokojori { @@ -15,13 +16,13 @@ namespace Rokojori public class HighlightAnimation { + public HighlightEffect effect; public Node3D[] targets = new Node3D[ 0 ]; public int tweenID = -1; public List materials = new List(); public float phase; - } [Tool] @@ -97,9 +98,10 @@ namespace Rokojori List _active = new List(); + protected static Dictionary highlighted = new Dictionary(); + public void Highlight( HighlightActionType type, Node3D[] targets ) - { - + { if ( HighlightActionType.Start == type ) { StartHighlight( targets ); @@ -110,10 +112,87 @@ namespace Rokojori } } + + + void ClearHighlight( HighlightAnimation animation ) + { + for ( int i = 0; i < animation.targets.Length; i ++ ) + { + Materials.RemoveOverlay( animation.targets[ i ], animation.materials[ i ] ); + } + + _active.Remove( animation ); + + animation.targets.ForEach( + ( t )=> + { + if ( highlighted.ContainsKey( t ) && highlighted[ t ] == this ) + { + highlighted.Remove( t ); + } + } + ); + } + + public static void CancelHighlight( Node3D[] targets ) + { + RJLog.Log( "CancelHighlight", HierarchyName.Of( targets ) ); + + targets.ForEach( t => CancelHighlight( t ) ); + } + + public static void CancelHighlight( Node3D node ) + { + RJLog.Log( "CancelHighlight", HierarchyName.Of( node ) ); + + if ( ! highlighted.ContainsKey( node ) ) + { + RJLog.Log( "Not highlighted", node ); + return; + } + + var highlightEffect = highlighted[ node ]; + + if ( highlightEffect == null ) + { + RJLog.Log( "Not highlighted", node ); + return; + } + + var animations = highlightEffect._active; + + var removals = animations.Filter( a => a.targets.Contains( node ) ); + + var numRemoved = 0; + + removals.ForEach( + ( r )=> + { + RJLog.Log( "Removing animation", r ); + highlightEffect.ClearHighlight( r ); + + numRemoved ++; + } + ); + + RJLog.Log( "Removed animations", numRemoved ); + + Lists.RemoveRange( animations, removals ); + + + } + void StartHighlight( Node3D[] targets ) { var animation = _active.Find( a => Arrays.AreEntriesEqual( a.targets, targets ) ); + targets.ForEach( + ( t )=> + { + highlighted[ t ] = this; + } + ); + var hdrColor = color.GetHDRColor(); var colorTransparent = ColorX.Fade( hdrColor, 0 ); @@ -194,6 +273,11 @@ namespace Rokojori return; } + if ( ! _active.Contains( animation ) ) + { + return; + } + var phase = span.phase; @@ -268,6 +352,7 @@ namespace Rokojori return; } + var startPhase = animation.phase; var hdrColor = ColorX.Fade( color.GetHDRColor(), startPhase ); var colorTransparent = ColorX.Fade( hdrColor, 0 ); @@ -281,6 +366,11 @@ namespace Rokojori return; } + if ( ! _active.Contains( animation ) ) + { + return; + } + animation.phase = MathX.Map( span.phase, 0, 1, startPhase, 0 ); var p = animation.phase; @@ -301,12 +391,7 @@ namespace Rokojori tweenColor = colorTransparent; animation.phase = 0; - for ( int i = 0; i < animation.targets.Length; i ++ ) - { - Materials.RemoveOverlay( targets[ i ], animation.materials[ i ] ); - } - - _active.Remove( animation ); + ClearHighlight( animation ); } else { diff --git a/Runtime/Animation/Highlight/SetPointableHighlightEffect.cs b/Runtime/Animation/Highlight/SetPointableHighlightEffect.cs index de179ff..2f63d2a 100644 --- a/Runtime/Animation/Highlight/SetPointableHighlightEffect.cs +++ b/Runtime/Animation/Highlight/SetPointableHighlightEffect.cs @@ -17,9 +17,20 @@ namespace Rokojori [Export] public HighlightEffect effect; + [Export] + public bool startHighlight = false; + + protected override void _OnTrigger() { + this.LogInfo( "Change Hightlight", HierarchyName.Of( effect ) ); pointable.highlightEffect = effect; + + if ( effect != null && startHighlight ) + { + HighlightEffect.CancelHighlight( pointable.highlightTargets ); + effect.Highlight( HighlightActionType.Start, [ pointable ] ); + } } } } \ No newline at end of file diff --git a/Runtime/Godot/HierarchyName.cs b/Runtime/Godot/HierarchyName.cs index c0eb4b2..3f5a828 100644 --- a/Runtime/Godot/HierarchyName.cs +++ b/Runtime/Godot/HierarchyName.cs @@ -1,6 +1,7 @@ using Godot; using System.Text; using System.Collections.Generic; +using System.Linq; namespace Rokojori { @@ -47,6 +48,11 @@ namespace Rokojori } + public static string Of( Node[] nodes, string seperator = " ▸ " ) + { + return "{\n" + nodes.ToList().Map( n => Of( n, seperator ) ).Join( "\n" ) + "\n}"; + } + public static string Of( Node node, string seperator = " ▸ " ) { if ( node == null ) diff --git a/Runtime/Interactions/CharacterController/CharacterMovement.cs b/Runtime/Interactions/CharacterController/CharacterMovement.cs index 6390146..12b346b 100644 --- a/Runtime/Interactions/CharacterController/CharacterMovement.cs +++ b/Runtime/Interactions/CharacterController/CharacterMovement.cs @@ -49,6 +49,21 @@ namespace Rokojori [Export] public Smoothing inAirMovementSmoothing = new FrameSmoothing(); + bool _onFloor = false; + bool _moving = false; + + [Export] + public float movingSpeedTreshold = 0.01f; + + [Export] + public Action onStartedMoving; + + [Export] + public Action onStoppedMoving; + + public bool isOnFloor => _onFloor; + public bool isMoving => _moving; + [ExportGroup( "Rotation" )] @@ -65,9 +80,12 @@ namespace Rokojori protected CharacterMovementData characterMovementData = new CharacterMovementData(); + + protected override void _OnTrigger() { var onFloor = body.IsOnFloor(); + _onFloor = onFloor; characterMovementData.Reset( this ); @@ -122,6 +140,23 @@ namespace Rokojori smoothedMovement = inAirMovementSmoothing.Smooth( characterMovementData.movement, controller.delta ); } + var wasMoving = _moving; + _moving = smoothedMovement.Length() > movingSpeedTreshold; + + if ( wasMoving != _moving ) + { + if ( _moving ) + { + Trigger( onStartedMoving ); + } + else + { + Trigger( onStoppedMoving ); + } + + this.LogInfo( "Moving:", _moving ); + } + Velocity( smoothedMovement, onFloor ); } diff --git a/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs b/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs new file mode 100644 index 0000000..1a2eed8 --- /dev/null +++ b/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs @@ -0,0 +1,34 @@ +using Godot; +using System.Collections; +using System.Collections.Generic; +using Godot.Collections; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class CharacterIsMoving:SceneCondition + { + [Export] + public CharacterMovement characterMovement; + + [Export] + public Trillean needsToBeOnFloor = Trillean.Any; + + + public override bool Evaluate() + { + if ( characterMovement == null ) + { + return false; + } + + if ( ! TrilleanLogic.Matches( needsToBeOnFloor, characterMovement.isOnFloor, true ) ) + { + return false; + } + + return characterMovement.isMoving; + } + } +} \ No newline at end of file diff --git a/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs.uid b/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs.uid new file mode 100644 index 0000000..38af87c --- /dev/null +++ b/Runtime/Interactions/CharacterController/Conditions/CharacterIsMoving.cs.uid @@ -0,0 +1 @@ +uid://bwq7e6cx2oy8n diff --git a/Runtime/Interactions/Grabber.cs b/Runtime/Interactions/Grabber.cs index a079411..1bd3d4f 100644 --- a/Runtime/Interactions/Grabber.cs +++ b/Runtime/Interactions/Grabber.cs @@ -45,6 +45,7 @@ namespace Rokojori public override void _Ready() { + this.LogInfo( "Register" ); SensorManager.Register( this, button ); } diff --git a/Runtime/Interactions/Pointer.cs b/Runtime/Interactions/Pointer.cs index e3a7792..7b3274e 100644 --- a/Runtime/Interactions/Pointer.cs +++ b/Runtime/Interactions/Pointer.cs @@ -41,15 +41,15 @@ namespace Rokojori if ( pointable != null ) { - Highlight( HighlightActionType.End, pointable ); pointable.UpdatePointerState( this, false ); + Highlight( HighlightActionType.End, pointable ); } pointable = currentPointable; if ( pointable != null ) - { - pointable.UpdatePointerState( this, true ); + { + pointable.UpdatePointerState( this, true ); Highlight( HighlightActionType.Start, pointable ); } } @@ -66,7 +66,9 @@ namespace Rokojori return; } + var highlightEffect = p.highlightEffect ?? defaultHighlighter; + // this.LogInfo( "Set Highlight", highlightEffect == null ? "" : HierarchyName.Of( highlightEffect ) ); highlightEffect.Highlight( type, p.highlightTargets ); diff --git a/Runtime/Math/Math3D.cs b/Runtime/Math/Math3D.cs index 358ca58..90648b4 100644 --- a/Runtime/Math/Math3D.cs +++ b/Runtime/Math/Math3D.cs @@ -714,6 +714,21 @@ namespace Rokojori return ! ( q.IsFinite() || q.IsZero() ); } + public static bool IsValid( this Vector3 v ) + { + if ( float.IsNaN( v.X ) || float.IsNaN( v.Y ) || float.IsNaN( v.Z ) ) + { + return false; + } + + if ( float.IsInfinity( v.X ) || float.IsInfinity( v.Y ) || float.IsInfinity( v.Z ) ) + { + return false; + } + + return true; + } + public static Quaternion GetNormalized( this Quaternion q ) { if ( q.IsValid() ) diff --git a/Runtime/Reallusion/CCImportFile/CCMaterialInfo.cs b/Runtime/Reallusion/CCImportFile/CCMaterialInfo.cs index 20b7cd4..52e9ea5 100644 --- a/Runtime/Reallusion/CCImportFile/CCMaterialInfo.cs +++ b/Runtime/Reallusion/CCImportFile/CCMaterialInfo.cs @@ -480,6 +480,8 @@ namespace Rokojori.Reallusion mat.rootMap.AssignFor( m, customShader.value.GetHairRootMap() ); mat.idMap.AssignFor( m, customShader.value.GetHairIDMap() ); + mat.anisotropyRatio.AssignFor( m, settings.configuration.anisotropicRatio ); + mat.vertexGreyToColor.AssignFor( m, customShader.value.GetColorVariable( "VertexGrayToColor", 255f, false ) ); mat.vertexColorStrength.AssignFor( m, customShader.value.GetFloatVariable( "VertexColorStrength" ) ); mat.diffuseStrength.AssignFor( m, customShader.value.GetFloatVariable( "Diffuse Strength" ) ); diff --git a/Runtime/Reallusion/CCImportSettings/CCImportConfiguration.cs b/Runtime/Reallusion/CCImportSettings/CCImportConfiguration.cs index ff02464..2bafb83 100644 --- a/Runtime/Reallusion/CCImportSettings/CCImportConfiguration.cs +++ b/Runtime/Reallusion/CCImportSettings/CCImportConfiguration.cs @@ -58,6 +58,9 @@ namespace Rokojori.Reallusion [Export] public float hairOpacityGamma = 1.2f; + [Export] + public float anisotropicRatio = 1.0f; + [Export] public CCHairOpacityGammaOverwrite[] hairOpacityGammaOverwrites = []; diff --git a/Runtime/Reallusion/Shaders/Hair/CCHairBase.gdshaderinc b/Runtime/Reallusion/Shaders/Hair/CCHairBase.gdshaderinc index e33c53d..a3d4242 100644 --- a/Runtime/Reallusion/Shaders/Hair/CCHairBase.gdshaderinc +++ b/Runtime/Reallusion/Shaders/Hair/CCHairBase.gdshaderinc @@ -1,3 +1,4 @@ + #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Colors.gdshaderinc" #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Textures.gdshaderinc" #include "res://addons/rokojori_action_library/Runtime/Shading/Library/Math.gdshaderinc" @@ -241,9 +242,9 @@ void vertex() void fragment() { - if ( ! enabled ) + if ( ! enabled ) { - discard; + discard; } // if ( ! FRONT_FACING ) diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs index c2c9716..fc91bfc 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaBackMaterial.cs @@ -34,24 +34,20 @@ namespace Rokojori public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); - public static readonly FloatPropertyName highlightAFadeOutStart = FloatPropertyName.Create( "highlightAFadeOutStart" ); - public static readonly FloatPropertyName highlightAFadeOutRange = FloatPropertyName.Create( "highlightAFadeOutRange" ); - public static readonly FloatPropertyName highlightAFadeOutPower = FloatPropertyName.Create( "highlightAFadeOutPower" ); - public static readonly FloatPropertyName highlightAFadeOutAmount = FloatPropertyName.Create( "highlightAFadeOutAmount" ); public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); - public static readonly FloatPropertyName highlightBFadeOutStart = FloatPropertyName.Create( "highlightBFadeOutStart" ); - public static readonly FloatPropertyName highlightBFadeOutRange = FloatPropertyName.Create( "highlightBFadeOutRange" ); - public static readonly FloatPropertyName highlightBFadeOutPower = FloatPropertyName.Create( "highlightBFadeOutPower" ); - public static readonly FloatPropertyName highlightBFadeOutAmount = FloatPropertyName.Create( "highlightBFadeOutAmount" ); public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); @@ -59,12 +55,16 @@ namespace Rokojori public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); @@ -73,6 +73,7 @@ namespace Rokojori public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -105,24 +106,20 @@ namespace Rokojori public readonly CustomMaterialProperty strandEndStrength; public readonly CustomMaterialProperty strandGamma; public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; public readonly CustomMaterialProperty highlightAColor; public readonly CustomMaterialProperty highlightAStrength; public readonly CustomMaterialProperty highlightARange; public readonly CustomMaterialProperty highlightAOverlapEnd; public readonly CustomMaterialProperty highlightAInvert; - public readonly CustomMaterialProperty highlightAFadeOutStart; - public readonly CustomMaterialProperty highlightAFadeOutRange; - public readonly CustomMaterialProperty highlightAFadeOutPower; - public readonly CustomMaterialProperty highlightAFadeOutAmount; public readonly CustomMaterialProperty highlightBColor; public readonly CustomMaterialProperty highlightBStrength; public readonly CustomMaterialProperty highlightBRange; public readonly CustomMaterialProperty highlightBOverlapEnd; public readonly CustomMaterialProperty highlightBInvert; - public readonly CustomMaterialProperty highlightBFadeOutStart; - public readonly CustomMaterialProperty highlightBFadeOutRange; - public readonly CustomMaterialProperty highlightBFadeOutPower; - public readonly CustomMaterialProperty highlightBFadeOutAmount; public readonly CustomMaterialProperty roughness; public readonly CustomMaterialProperty roughnessOffset; public readonly CustomMaterialProperty textureRoughness; @@ -130,12 +127,16 @@ namespace Rokojori public readonly CustomMaterialProperty metallicOffset; public readonly CustomMaterialProperty textureMetallic; public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; public readonly CustomMaterialProperty textureEmission; public readonly CustomMaterialProperty emission; public readonly CustomMaterialProperty emissionEnergy; public readonly CustomMaterialProperty backlight; public readonly CustomMaterialProperty albedoToBacklightAmount; public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; public readonly CustomMaterialProperty textureAmbientOcclusion; public readonly CustomMaterialProperty aoLightAffect; public readonly CustomMaterialProperty ambientOcclusion; @@ -144,6 +145,7 @@ namespace Rokojori public readonly CustomMaterialProperty rootOcclusionRange; public readonly CustomMaterialProperty endOcclusionAmount; public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairAlphaBackMaterial() { @@ -173,24 +175,20 @@ namespace Rokojori strandEndStrength = new CustomMaterialProperty( this, CCHairAlphaBackShader.strandEndStrength ); strandGamma = new CustomMaterialProperty( this, CCHairAlphaBackShader.strandGamma ); maximumHighlightAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightFadeOutAmount ); highlightAColor = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAColor ); highlightAStrength = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAStrength ); highlightARange = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightARange ); highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAOverlapEnd ); highlightAInvert = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAInvert ); - highlightAFadeOutStart = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAFadeOutStart ); - highlightAFadeOutRange = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAFadeOutRange ); - highlightAFadeOutPower = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAFadeOutPower ); - highlightAFadeOutAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightAFadeOutAmount ); highlightBColor = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBColor ); highlightBStrength = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBStrength ); highlightBRange = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBRange ); highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBOverlapEnd ); highlightBInvert = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBInvert ); - highlightBFadeOutStart = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBFadeOutStart ); - highlightBFadeOutRange = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBFadeOutRange ); - highlightBFadeOutPower = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBFadeOutPower ); - highlightBFadeOutAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.highlightBFadeOutAmount ); roughness = new CustomMaterialProperty( this, CCHairAlphaBackShader.roughness ); roughnessOffset = new CustomMaterialProperty( this, CCHairAlphaBackShader.roughnessOffset ); textureRoughness = new CustomMaterialProperty( this, CCHairAlphaBackShader.textureRoughness ); @@ -198,12 +196,16 @@ namespace Rokojori metallicOffset = new CustomMaterialProperty( this, CCHairAlphaBackShader.metallicOffset ); textureMetallic = new CustomMaterialProperty( this, CCHairAlphaBackShader.textureMetallic ); specular = new CustomMaterialProperty( this, CCHairAlphaBackShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairAlphaBackShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairAlphaBackShader.anisotropyRatio ); textureEmission = new CustomMaterialProperty( this, CCHairAlphaBackShader.textureEmission ); emission = new CustomMaterialProperty( this, CCHairAlphaBackShader.emission ); emissionEnergy = new CustomMaterialProperty( this, CCHairAlphaBackShader.emissionEnergy ); backlight = new CustomMaterialProperty( this, CCHairAlphaBackShader.backlight ); albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.albedoToBacklightAmount ); textureBacklight = new CustomMaterialProperty( this, CCHairAlphaBackShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairAlphaBackShader.subsurfaceScatteringStrength ); textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairAlphaBackShader.textureAmbientOcclusion ); aoLightAffect = new CustomMaterialProperty( this, CCHairAlphaBackShader.aoLightAffect ); ambientOcclusion = new CustomMaterialProperty( this, CCHairAlphaBackShader.ambientOcclusion ); @@ -212,6 +214,7 @@ namespace Rokojori rootOcclusionRange = new CustomMaterialProperty( this, CCHairAlphaBackShader.rootOcclusionRange ); endOcclusionAmount = new CustomMaterialProperty( this, CCHairAlphaBackShader.endOcclusionAmount ); endOcclusionRange = new CustomMaterialProperty( this, CCHairAlphaBackShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairAlphaBackShader.rootBasedOcclusion ); } } diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs index 1874e72..1ab46cf 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlphaMaterial.cs @@ -10,7 +10,70 @@ namespace Rokojori "res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/Hair/Variants/CCHairAlpha.gdshader" ); - + public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" ); + public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" ); + public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" ); + public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" ); + public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" ); + public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" ); + public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" ); + public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" ); + public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" ); + public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" ); + public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" ); + public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" ); + public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" ); + public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" ); + public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" ); + public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" ); + public static readonly BoolPropertyName activateHairColor = BoolPropertyName.Create( "activateHairColor" ); + public static readonly FloatPropertyName baseColorMapStrength = FloatPropertyName.Create( "baseColorMapStrength" ); + public static readonly ColorPropertyName strandRootColor = ColorPropertyName.Create( "strandRootColor" ); + public static readonly FloatPropertyName strandRootStrength = FloatPropertyName.Create( "strandRootStrength" ); + public static readonly ColorPropertyName strandEndColor = ColorPropertyName.Create( "strandEndColor" ); + public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); + public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); + public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); + public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); + public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); + public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); + public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); + public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); + public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); + public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); + public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); + public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); + public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); + public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); + public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); + public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); + public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" ); + public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); + public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); + public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); + public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); + public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); + public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); + public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); + public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); + public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); + public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); + public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); + public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); + public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" ); + public static readonly FloatPropertyName rootOcclusionAmount = FloatPropertyName.Create( "rootOcclusionAmount" ); + public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); + public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); + public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -19,13 +82,139 @@ namespace Rokojori { - + public readonly CustomMaterialProperty enabled; + public readonly CustomMaterialProperty albedo; + public readonly CustomMaterialProperty textureAlbedo; + public readonly CustomMaterialProperty hslOffset; + public readonly CustomMaterialProperty textureBlend; + public readonly CustomMaterialProperty blendAmount; + public readonly CustomMaterialProperty naturalColors; + public readonly CustomMaterialProperty textureOpacity; + public readonly CustomMaterialProperty opacity; + public readonly CustomMaterialProperty opacityGamma; + public readonly CustomMaterialProperty rootMap; + public readonly CustomMaterialProperty flowMap; + public readonly CustomMaterialProperty idMap; + public readonly CustomMaterialProperty diffuseStrength; + public readonly CustomMaterialProperty vertexColorStrength; + public readonly CustomMaterialProperty vertexGreyToColor; + public readonly CustomMaterialProperty activateHairColor; + public readonly CustomMaterialProperty baseColorMapStrength; + public readonly CustomMaterialProperty strandRootColor; + public readonly CustomMaterialProperty strandRootStrength; + public readonly CustomMaterialProperty strandEndColor; + public readonly CustomMaterialProperty strandEndStrength; + public readonly CustomMaterialProperty strandGamma; + public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; + public readonly CustomMaterialProperty highlightAColor; + public readonly CustomMaterialProperty highlightAStrength; + public readonly CustomMaterialProperty highlightARange; + public readonly CustomMaterialProperty highlightAOverlapEnd; + public readonly CustomMaterialProperty highlightAInvert; + public readonly CustomMaterialProperty highlightBColor; + public readonly CustomMaterialProperty highlightBStrength; + public readonly CustomMaterialProperty highlightBRange; + public readonly CustomMaterialProperty highlightBOverlapEnd; + public readonly CustomMaterialProperty highlightBInvert; + public readonly CustomMaterialProperty roughness; + public readonly CustomMaterialProperty roughnessOffset; + public readonly CustomMaterialProperty textureRoughness; + public readonly CustomMaterialProperty metallic; + public readonly CustomMaterialProperty metallicOffset; + public readonly CustomMaterialProperty textureMetallic; + public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; + public readonly CustomMaterialProperty textureEmission; + public readonly CustomMaterialProperty emission; + public readonly CustomMaterialProperty emissionEnergy; + public readonly CustomMaterialProperty backlight; + public readonly CustomMaterialProperty albedoToBacklightAmount; + public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; + public readonly CustomMaterialProperty textureAmbientOcclusion; + public readonly CustomMaterialProperty aoLightAffect; + public readonly CustomMaterialProperty ambientOcclusion; + public readonly CustomMaterialProperty aoGamma; + public readonly CustomMaterialProperty rootOcclusionAmount; + public readonly CustomMaterialProperty rootOcclusionRange; + public readonly CustomMaterialProperty endOcclusionAmount; + public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairAlphaMaterial() { Shader = CCHairAlphaShader.shader.Get(); - + enabled = new CustomMaterialProperty( this, CCHairAlphaShader.enabled ); + albedo = new CustomMaterialProperty( this, CCHairAlphaShader.albedo ); + textureAlbedo = new CustomMaterialProperty( this, CCHairAlphaShader.textureAlbedo ); + hslOffset = new CustomMaterialProperty( this, CCHairAlphaShader.hslOffset ); + textureBlend = new CustomMaterialProperty( this, CCHairAlphaShader.textureBlend ); + blendAmount = new CustomMaterialProperty( this, CCHairAlphaShader.blendAmount ); + naturalColors = new CustomMaterialProperty( this, CCHairAlphaShader.naturalColors ); + textureOpacity = new CustomMaterialProperty( this, CCHairAlphaShader.textureOpacity ); + opacity = new CustomMaterialProperty( this, CCHairAlphaShader.opacity ); + opacityGamma = new CustomMaterialProperty( this, CCHairAlphaShader.opacityGamma ); + rootMap = new CustomMaterialProperty( this, CCHairAlphaShader.rootMap ); + flowMap = new CustomMaterialProperty( this, CCHairAlphaShader.flowMap ); + idMap = new CustomMaterialProperty( this, CCHairAlphaShader.idMap ); + diffuseStrength = new CustomMaterialProperty( this, CCHairAlphaShader.diffuseStrength ); + vertexColorStrength = new CustomMaterialProperty( this, CCHairAlphaShader.vertexColorStrength ); + vertexGreyToColor = new CustomMaterialProperty( this, CCHairAlphaShader.vertexGreyToColor ); + activateHairColor = new CustomMaterialProperty( this, CCHairAlphaShader.activateHairColor ); + baseColorMapStrength = new CustomMaterialProperty( this, CCHairAlphaShader.baseColorMapStrength ); + strandRootColor = new CustomMaterialProperty( this, CCHairAlphaShader.strandRootColor ); + strandRootStrength = new CustomMaterialProperty( this, CCHairAlphaShader.strandRootStrength ); + strandEndColor = new CustomMaterialProperty( this, CCHairAlphaShader.strandEndColor ); + strandEndStrength = new CustomMaterialProperty( this, CCHairAlphaShader.strandEndStrength ); + strandGamma = new CustomMaterialProperty( this, CCHairAlphaShader.strandGamma ); + maximumHighlightAmount = new CustomMaterialProperty( this, CCHairAlphaShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairAlphaShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairAlphaShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairAlphaShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairAlphaShader.highlightFadeOutAmount ); + highlightAColor = new CustomMaterialProperty( this, CCHairAlphaShader.highlightAColor ); + highlightAStrength = new CustomMaterialProperty( this, CCHairAlphaShader.highlightAStrength ); + highlightARange = new CustomMaterialProperty( this, CCHairAlphaShader.highlightARange ); + highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairAlphaShader.highlightAOverlapEnd ); + highlightAInvert = new CustomMaterialProperty( this, CCHairAlphaShader.highlightAInvert ); + highlightBColor = new CustomMaterialProperty( this, CCHairAlphaShader.highlightBColor ); + highlightBStrength = new CustomMaterialProperty( this, CCHairAlphaShader.highlightBStrength ); + highlightBRange = new CustomMaterialProperty( this, CCHairAlphaShader.highlightBRange ); + highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairAlphaShader.highlightBOverlapEnd ); + highlightBInvert = new CustomMaterialProperty( this, CCHairAlphaShader.highlightBInvert ); + roughness = new CustomMaterialProperty( this, CCHairAlphaShader.roughness ); + roughnessOffset = new CustomMaterialProperty( this, CCHairAlphaShader.roughnessOffset ); + textureRoughness = new CustomMaterialProperty( this, CCHairAlphaShader.textureRoughness ); + metallic = new CustomMaterialProperty( this, CCHairAlphaShader.metallic ); + metallicOffset = new CustomMaterialProperty( this, CCHairAlphaShader.metallicOffset ); + textureMetallic = new CustomMaterialProperty( this, CCHairAlphaShader.textureMetallic ); + specular = new CustomMaterialProperty( this, CCHairAlphaShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairAlphaShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairAlphaShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairAlphaShader.anisotropyRatio ); + textureEmission = new CustomMaterialProperty( this, CCHairAlphaShader.textureEmission ); + emission = new CustomMaterialProperty( this, CCHairAlphaShader.emission ); + emissionEnergy = new CustomMaterialProperty( this, CCHairAlphaShader.emissionEnergy ); + backlight = new CustomMaterialProperty( this, CCHairAlphaShader.backlight ); + albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairAlphaShader.albedoToBacklightAmount ); + textureBacklight = new CustomMaterialProperty( this, CCHairAlphaShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairAlphaShader.subsurfaceScatteringStrength ); + textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairAlphaShader.textureAmbientOcclusion ); + aoLightAffect = new CustomMaterialProperty( this, CCHairAlphaShader.aoLightAffect ); + ambientOcclusion = new CustomMaterialProperty( this, CCHairAlphaShader.ambientOcclusion ); + aoGamma = new CustomMaterialProperty( this, CCHairAlphaShader.aoGamma ); + rootOcclusionAmount = new CustomMaterialProperty( this, CCHairAlphaShader.rootOcclusionAmount ); + rootOcclusionRange = new CustomMaterialProperty( this, CCHairAlphaShader.rootOcclusionRange ); + endOcclusionAmount = new CustomMaterialProperty( this, CCHairAlphaShader.endOcclusionAmount ); + endOcclusionRange = new CustomMaterialProperty( this, CCHairAlphaShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairAlphaShader.rootBasedOcclusion ); } } diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs index f9d35d4..c30f23c 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscardMaterial.cs @@ -7,10 +7,74 @@ namespace Rokojori public class CCHairDiscardShader { public static readonly CachedResource shader = new CachedResource( - "res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/CCHairDiscard.gdshader" + "res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/Hair/Variants/CCHairDiscard.gdshader" ); - + public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" ); + public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" ); + public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" ); + public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" ); + public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" ); + public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" ); + public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" ); + public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" ); + public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" ); + public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" ); + public static readonly FloatPropertyName alphaDiscardTreshold = FloatPropertyName.Create( "alphaDiscardTreshold" ); + public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" ); + public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" ); + public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" ); + public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" ); + public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" ); + public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" ); + public static readonly BoolPropertyName activateHairColor = BoolPropertyName.Create( "activateHairColor" ); + public static readonly FloatPropertyName baseColorMapStrength = FloatPropertyName.Create( "baseColorMapStrength" ); + public static readonly ColorPropertyName strandRootColor = ColorPropertyName.Create( "strandRootColor" ); + public static readonly FloatPropertyName strandRootStrength = FloatPropertyName.Create( "strandRootStrength" ); + public static readonly ColorPropertyName strandEndColor = ColorPropertyName.Create( "strandEndColor" ); + public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); + public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); + public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); + public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); + public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); + public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); + public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); + public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); + public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); + public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); + public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); + public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); + public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); + public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); + public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); + public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); + public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" ); + public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); + public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); + public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); + public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); + public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); + public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); + public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); + public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); + public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); + public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); + public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); + public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); + public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" ); + public static readonly FloatPropertyName rootOcclusionAmount = FloatPropertyName.Create( "rootOcclusionAmount" ); + public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); + public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); + public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -19,13 +83,141 @@ namespace Rokojori { - + public readonly CustomMaterialProperty enabled; + public readonly CustomMaterialProperty albedo; + public readonly CustomMaterialProperty textureAlbedo; + public readonly CustomMaterialProperty hslOffset; + public readonly CustomMaterialProperty textureBlend; + public readonly CustomMaterialProperty blendAmount; + public readonly CustomMaterialProperty naturalColors; + public readonly CustomMaterialProperty textureOpacity; + public readonly CustomMaterialProperty opacity; + public readonly CustomMaterialProperty opacityGamma; + public readonly CustomMaterialProperty alphaDiscardTreshold; + public readonly CustomMaterialProperty rootMap; + public readonly CustomMaterialProperty flowMap; + public readonly CustomMaterialProperty idMap; + public readonly CustomMaterialProperty diffuseStrength; + public readonly CustomMaterialProperty vertexColorStrength; + public readonly CustomMaterialProperty vertexGreyToColor; + public readonly CustomMaterialProperty activateHairColor; + public readonly CustomMaterialProperty baseColorMapStrength; + public readonly CustomMaterialProperty strandRootColor; + public readonly CustomMaterialProperty strandRootStrength; + public readonly CustomMaterialProperty strandEndColor; + public readonly CustomMaterialProperty strandEndStrength; + public readonly CustomMaterialProperty strandGamma; + public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; + public readonly CustomMaterialProperty highlightAColor; + public readonly CustomMaterialProperty highlightAStrength; + public readonly CustomMaterialProperty highlightARange; + public readonly CustomMaterialProperty highlightAOverlapEnd; + public readonly CustomMaterialProperty highlightAInvert; + public readonly CustomMaterialProperty highlightBColor; + public readonly CustomMaterialProperty highlightBStrength; + public readonly CustomMaterialProperty highlightBRange; + public readonly CustomMaterialProperty highlightBOverlapEnd; + public readonly CustomMaterialProperty highlightBInvert; + public readonly CustomMaterialProperty roughness; + public readonly CustomMaterialProperty roughnessOffset; + public readonly CustomMaterialProperty textureRoughness; + public readonly CustomMaterialProperty metallic; + public readonly CustomMaterialProperty metallicOffset; + public readonly CustomMaterialProperty textureMetallic; + public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; + public readonly CustomMaterialProperty textureEmission; + public readonly CustomMaterialProperty emission; + public readonly CustomMaterialProperty emissionEnergy; + public readonly CustomMaterialProperty backlight; + public readonly CustomMaterialProperty albedoToBacklightAmount; + public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; + public readonly CustomMaterialProperty textureAmbientOcclusion; + public readonly CustomMaterialProperty aoLightAffect; + public readonly CustomMaterialProperty ambientOcclusion; + public readonly CustomMaterialProperty aoGamma; + public readonly CustomMaterialProperty rootOcclusionAmount; + public readonly CustomMaterialProperty rootOcclusionRange; + public readonly CustomMaterialProperty endOcclusionAmount; + public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairDiscardMaterial() { Shader = CCHairDiscardShader.shader.Get(); - + enabled = new CustomMaterialProperty( this, CCHairDiscardShader.enabled ); + albedo = new CustomMaterialProperty( this, CCHairDiscardShader.albedo ); + textureAlbedo = new CustomMaterialProperty( this, CCHairDiscardShader.textureAlbedo ); + hslOffset = new CustomMaterialProperty( this, CCHairDiscardShader.hslOffset ); + textureBlend = new CustomMaterialProperty( this, CCHairDiscardShader.textureBlend ); + blendAmount = new CustomMaterialProperty( this, CCHairDiscardShader.blendAmount ); + naturalColors = new CustomMaterialProperty( this, CCHairDiscardShader.naturalColors ); + textureOpacity = new CustomMaterialProperty( this, CCHairDiscardShader.textureOpacity ); + opacity = new CustomMaterialProperty( this, CCHairDiscardShader.opacity ); + opacityGamma = new CustomMaterialProperty( this, CCHairDiscardShader.opacityGamma ); + alphaDiscardTreshold = new CustomMaterialProperty( this, CCHairDiscardShader.alphaDiscardTreshold ); + rootMap = new CustomMaterialProperty( this, CCHairDiscardShader.rootMap ); + flowMap = new CustomMaterialProperty( this, CCHairDiscardShader.flowMap ); + idMap = new CustomMaterialProperty( this, CCHairDiscardShader.idMap ); + diffuseStrength = new CustomMaterialProperty( this, CCHairDiscardShader.diffuseStrength ); + vertexColorStrength = new CustomMaterialProperty( this, CCHairDiscardShader.vertexColorStrength ); + vertexGreyToColor = new CustomMaterialProperty( this, CCHairDiscardShader.vertexGreyToColor ); + activateHairColor = new CustomMaterialProperty( this, CCHairDiscardShader.activateHairColor ); + baseColorMapStrength = new CustomMaterialProperty( this, CCHairDiscardShader.baseColorMapStrength ); + strandRootColor = new CustomMaterialProperty( this, CCHairDiscardShader.strandRootColor ); + strandRootStrength = new CustomMaterialProperty( this, CCHairDiscardShader.strandRootStrength ); + strandEndColor = new CustomMaterialProperty( this, CCHairDiscardShader.strandEndColor ); + strandEndStrength = new CustomMaterialProperty( this, CCHairDiscardShader.strandEndStrength ); + strandGamma = new CustomMaterialProperty( this, CCHairDiscardShader.strandGamma ); + maximumHighlightAmount = new CustomMaterialProperty( this, CCHairDiscardShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairDiscardShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairDiscardShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairDiscardShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairDiscardShader.highlightFadeOutAmount ); + highlightAColor = new CustomMaterialProperty( this, CCHairDiscardShader.highlightAColor ); + highlightAStrength = new CustomMaterialProperty( this, CCHairDiscardShader.highlightAStrength ); + highlightARange = new CustomMaterialProperty( this, CCHairDiscardShader.highlightARange ); + highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairDiscardShader.highlightAOverlapEnd ); + highlightAInvert = new CustomMaterialProperty( this, CCHairDiscardShader.highlightAInvert ); + highlightBColor = new CustomMaterialProperty( this, CCHairDiscardShader.highlightBColor ); + highlightBStrength = new CustomMaterialProperty( this, CCHairDiscardShader.highlightBStrength ); + highlightBRange = new CustomMaterialProperty( this, CCHairDiscardShader.highlightBRange ); + highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairDiscardShader.highlightBOverlapEnd ); + highlightBInvert = new CustomMaterialProperty( this, CCHairDiscardShader.highlightBInvert ); + roughness = new CustomMaterialProperty( this, CCHairDiscardShader.roughness ); + roughnessOffset = new CustomMaterialProperty( this, CCHairDiscardShader.roughnessOffset ); + textureRoughness = new CustomMaterialProperty( this, CCHairDiscardShader.textureRoughness ); + metallic = new CustomMaterialProperty( this, CCHairDiscardShader.metallic ); + metallicOffset = new CustomMaterialProperty( this, CCHairDiscardShader.metallicOffset ); + textureMetallic = new CustomMaterialProperty( this, CCHairDiscardShader.textureMetallic ); + specular = new CustomMaterialProperty( this, CCHairDiscardShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairDiscardShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairDiscardShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairDiscardShader.anisotropyRatio ); + textureEmission = new CustomMaterialProperty( this, CCHairDiscardShader.textureEmission ); + emission = new CustomMaterialProperty( this, CCHairDiscardShader.emission ); + emissionEnergy = new CustomMaterialProperty( this, CCHairDiscardShader.emissionEnergy ); + backlight = new CustomMaterialProperty( this, CCHairDiscardShader.backlight ); + albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairDiscardShader.albedoToBacklightAmount ); + textureBacklight = new CustomMaterialProperty( this, CCHairDiscardShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairDiscardShader.subsurfaceScatteringStrength ); + textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairDiscardShader.textureAmbientOcclusion ); + aoLightAffect = new CustomMaterialProperty( this, CCHairDiscardShader.aoLightAffect ); + ambientOcclusion = new CustomMaterialProperty( this, CCHairDiscardShader.ambientOcclusion ); + aoGamma = new CustomMaterialProperty( this, CCHairDiscardShader.aoGamma ); + rootOcclusionAmount = new CustomMaterialProperty( this, CCHairDiscardShader.rootOcclusionAmount ); + rootOcclusionRange = new CustomMaterialProperty( this, CCHairDiscardShader.rootOcclusionRange ); + endOcclusionAmount = new CustomMaterialProperty( this, CCHairDiscardShader.endOcclusionAmount ); + endOcclusionRange = new CustomMaterialProperty( this, CCHairDiscardShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairDiscardShader.rootBasedOcclusion ); } } diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs index e1dd020..4e8b303 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairMaterial.cs @@ -35,24 +35,20 @@ namespace Rokojori public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); - public static readonly FloatPropertyName highlightAFadeOutStart = FloatPropertyName.Create( "highlightAFadeOutStart" ); - public static readonly FloatPropertyName highlightAFadeOutRange = FloatPropertyName.Create( "highlightAFadeOutRange" ); - public static readonly FloatPropertyName highlightAFadeOutPower = FloatPropertyName.Create( "highlightAFadeOutPower" ); - public static readonly FloatPropertyName highlightAFadeOutAmount = FloatPropertyName.Create( "highlightAFadeOutAmount" ); public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); - public static readonly FloatPropertyName highlightBFadeOutStart = FloatPropertyName.Create( "highlightBFadeOutStart" ); - public static readonly FloatPropertyName highlightBFadeOutRange = FloatPropertyName.Create( "highlightBFadeOutRange" ); - public static readonly FloatPropertyName highlightBFadeOutPower = FloatPropertyName.Create( "highlightBFadeOutPower" ); - public static readonly FloatPropertyName highlightBFadeOutAmount = FloatPropertyName.Create( "highlightBFadeOutAmount" ); public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); @@ -60,12 +56,16 @@ namespace Rokojori public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); @@ -74,6 +74,7 @@ namespace Rokojori public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -107,24 +108,20 @@ namespace Rokojori public readonly CustomMaterialProperty strandEndStrength; public readonly CustomMaterialProperty strandGamma; public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; public readonly CustomMaterialProperty highlightAColor; public readonly CustomMaterialProperty highlightAStrength; public readonly CustomMaterialProperty highlightARange; public readonly CustomMaterialProperty highlightAOverlapEnd; public readonly CustomMaterialProperty highlightAInvert; - public readonly CustomMaterialProperty highlightAFadeOutStart; - public readonly CustomMaterialProperty highlightAFadeOutRange; - public readonly CustomMaterialProperty highlightAFadeOutPower; - public readonly CustomMaterialProperty highlightAFadeOutAmount; public readonly CustomMaterialProperty highlightBColor; public readonly CustomMaterialProperty highlightBStrength; public readonly CustomMaterialProperty highlightBRange; public readonly CustomMaterialProperty highlightBOverlapEnd; public readonly CustomMaterialProperty highlightBInvert; - public readonly CustomMaterialProperty highlightBFadeOutStart; - public readonly CustomMaterialProperty highlightBFadeOutRange; - public readonly CustomMaterialProperty highlightBFadeOutPower; - public readonly CustomMaterialProperty highlightBFadeOutAmount; public readonly CustomMaterialProperty roughness; public readonly CustomMaterialProperty roughnessOffset; public readonly CustomMaterialProperty textureRoughness; @@ -132,12 +129,16 @@ namespace Rokojori public readonly CustomMaterialProperty metallicOffset; public readonly CustomMaterialProperty textureMetallic; public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; public readonly CustomMaterialProperty textureEmission; public readonly CustomMaterialProperty emission; public readonly CustomMaterialProperty emissionEnergy; public readonly CustomMaterialProperty backlight; public readonly CustomMaterialProperty albedoToBacklightAmount; public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; public readonly CustomMaterialProperty textureAmbientOcclusion; public readonly CustomMaterialProperty aoLightAffect; public readonly CustomMaterialProperty ambientOcclusion; @@ -146,6 +147,7 @@ namespace Rokojori public readonly CustomMaterialProperty rootOcclusionRange; public readonly CustomMaterialProperty endOcclusionAmount; public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairMaterial() { @@ -176,24 +178,20 @@ namespace Rokojori strandEndStrength = new CustomMaterialProperty( this, CCHairShader.strandEndStrength ); strandGamma = new CustomMaterialProperty( this, CCHairShader.strandGamma ); maximumHighlightAmount = new CustomMaterialProperty( this, CCHairShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairShader.highlightFadeOutAmount ); highlightAColor = new CustomMaterialProperty( this, CCHairShader.highlightAColor ); highlightAStrength = new CustomMaterialProperty( this, CCHairShader.highlightAStrength ); highlightARange = new CustomMaterialProperty( this, CCHairShader.highlightARange ); highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairShader.highlightAOverlapEnd ); highlightAInvert = new CustomMaterialProperty( this, CCHairShader.highlightAInvert ); - highlightAFadeOutStart = new CustomMaterialProperty( this, CCHairShader.highlightAFadeOutStart ); - highlightAFadeOutRange = new CustomMaterialProperty( this, CCHairShader.highlightAFadeOutRange ); - highlightAFadeOutPower = new CustomMaterialProperty( this, CCHairShader.highlightAFadeOutPower ); - highlightAFadeOutAmount = new CustomMaterialProperty( this, CCHairShader.highlightAFadeOutAmount ); highlightBColor = new CustomMaterialProperty( this, CCHairShader.highlightBColor ); highlightBStrength = new CustomMaterialProperty( this, CCHairShader.highlightBStrength ); highlightBRange = new CustomMaterialProperty( this, CCHairShader.highlightBRange ); highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairShader.highlightBOverlapEnd ); highlightBInvert = new CustomMaterialProperty( this, CCHairShader.highlightBInvert ); - highlightBFadeOutStart = new CustomMaterialProperty( this, CCHairShader.highlightBFadeOutStart ); - highlightBFadeOutRange = new CustomMaterialProperty( this, CCHairShader.highlightBFadeOutRange ); - highlightBFadeOutPower = new CustomMaterialProperty( this, CCHairShader.highlightBFadeOutPower ); - highlightBFadeOutAmount = new CustomMaterialProperty( this, CCHairShader.highlightBFadeOutAmount ); roughness = new CustomMaterialProperty( this, CCHairShader.roughness ); roughnessOffset = new CustomMaterialProperty( this, CCHairShader.roughnessOffset ); textureRoughness = new CustomMaterialProperty( this, CCHairShader.textureRoughness ); @@ -201,12 +199,16 @@ namespace Rokojori metallicOffset = new CustomMaterialProperty( this, CCHairShader.metallicOffset ); textureMetallic = new CustomMaterialProperty( this, CCHairShader.textureMetallic ); specular = new CustomMaterialProperty( this, CCHairShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairShader.anisotropyRatio ); textureEmission = new CustomMaterialProperty( this, CCHairShader.textureEmission ); emission = new CustomMaterialProperty( this, CCHairShader.emission ); emissionEnergy = new CustomMaterialProperty( this, CCHairShader.emissionEnergy ); backlight = new CustomMaterialProperty( this, CCHairShader.backlight ); albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairShader.albedoToBacklightAmount ); textureBacklight = new CustomMaterialProperty( this, CCHairShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairShader.subsurfaceScatteringStrength ); textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairShader.textureAmbientOcclusion ); aoLightAffect = new CustomMaterialProperty( this, CCHairShader.aoLightAffect ); ambientOcclusion = new CustomMaterialProperty( this, CCHairShader.ambientOcclusion ); @@ -215,6 +217,7 @@ namespace Rokojori rootOcclusionRange = new CustomMaterialProperty( this, CCHairShader.rootOcclusionRange ); endOcclusionAmount = new CustomMaterialProperty( this, CCHairShader.endOcclusionAmount ); endOcclusionRange = new CustomMaterialProperty( this, CCHairShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairShader.rootBasedOcclusion ); } } diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs index 0f65988..836471a 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairScissorMaterial.cs @@ -35,24 +35,20 @@ namespace Rokojori public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); - public static readonly FloatPropertyName highlightAFadeOutStart = FloatPropertyName.Create( "highlightAFadeOutStart" ); - public static readonly FloatPropertyName highlightAFadeOutRange = FloatPropertyName.Create( "highlightAFadeOutRange" ); - public static readonly FloatPropertyName highlightAFadeOutPower = FloatPropertyName.Create( "highlightAFadeOutPower" ); - public static readonly FloatPropertyName highlightAFadeOutAmount = FloatPropertyName.Create( "highlightAFadeOutAmount" ); public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); - public static readonly FloatPropertyName highlightBFadeOutStart = FloatPropertyName.Create( "highlightBFadeOutStart" ); - public static readonly FloatPropertyName highlightBFadeOutRange = FloatPropertyName.Create( "highlightBFadeOutRange" ); - public static readonly FloatPropertyName highlightBFadeOutPower = FloatPropertyName.Create( "highlightBFadeOutPower" ); - public static readonly FloatPropertyName highlightBFadeOutAmount = FloatPropertyName.Create( "highlightBFadeOutAmount" ); public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); @@ -60,12 +56,16 @@ namespace Rokojori public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); @@ -74,6 +74,7 @@ namespace Rokojori public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -107,24 +108,20 @@ namespace Rokojori public readonly CustomMaterialProperty strandEndStrength; public readonly CustomMaterialProperty strandGamma; public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; public readonly CustomMaterialProperty highlightAColor; public readonly CustomMaterialProperty highlightAStrength; public readonly CustomMaterialProperty highlightARange; public readonly CustomMaterialProperty highlightAOverlapEnd; public readonly CustomMaterialProperty highlightAInvert; - public readonly CustomMaterialProperty highlightAFadeOutStart; - public readonly CustomMaterialProperty highlightAFadeOutRange; - public readonly CustomMaterialProperty highlightAFadeOutPower; - public readonly CustomMaterialProperty highlightAFadeOutAmount; public readonly CustomMaterialProperty highlightBColor; public readonly CustomMaterialProperty highlightBStrength; public readonly CustomMaterialProperty highlightBRange; public readonly CustomMaterialProperty highlightBOverlapEnd; public readonly CustomMaterialProperty highlightBInvert; - public readonly CustomMaterialProperty highlightBFadeOutStart; - public readonly CustomMaterialProperty highlightBFadeOutRange; - public readonly CustomMaterialProperty highlightBFadeOutPower; - public readonly CustomMaterialProperty highlightBFadeOutAmount; public readonly CustomMaterialProperty roughness; public readonly CustomMaterialProperty roughnessOffset; public readonly CustomMaterialProperty textureRoughness; @@ -132,12 +129,16 @@ namespace Rokojori public readonly CustomMaterialProperty metallicOffset; public readonly CustomMaterialProperty textureMetallic; public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; public readonly CustomMaterialProperty textureEmission; public readonly CustomMaterialProperty emission; public readonly CustomMaterialProperty emissionEnergy; public readonly CustomMaterialProperty backlight; public readonly CustomMaterialProperty albedoToBacklightAmount; public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; public readonly CustomMaterialProperty textureAmbientOcclusion; public readonly CustomMaterialProperty aoLightAffect; public readonly CustomMaterialProperty ambientOcclusion; @@ -146,6 +147,7 @@ namespace Rokojori public readonly CustomMaterialProperty rootOcclusionRange; public readonly CustomMaterialProperty endOcclusionAmount; public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairScissorMaterial() { @@ -176,24 +178,20 @@ namespace Rokojori strandEndStrength = new CustomMaterialProperty( this, CCHairScissorShader.strandEndStrength ); strandGamma = new CustomMaterialProperty( this, CCHairScissorShader.strandGamma ); maximumHighlightAmount = new CustomMaterialProperty( this, CCHairScissorShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairScissorShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairScissorShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairScissorShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairScissorShader.highlightFadeOutAmount ); highlightAColor = new CustomMaterialProperty( this, CCHairScissorShader.highlightAColor ); highlightAStrength = new CustomMaterialProperty( this, CCHairScissorShader.highlightAStrength ); highlightARange = new CustomMaterialProperty( this, CCHairScissorShader.highlightARange ); highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairScissorShader.highlightAOverlapEnd ); highlightAInvert = new CustomMaterialProperty( this, CCHairScissorShader.highlightAInvert ); - highlightAFadeOutStart = new CustomMaterialProperty( this, CCHairScissorShader.highlightAFadeOutStart ); - highlightAFadeOutRange = new CustomMaterialProperty( this, CCHairScissorShader.highlightAFadeOutRange ); - highlightAFadeOutPower = new CustomMaterialProperty( this, CCHairScissorShader.highlightAFadeOutPower ); - highlightAFadeOutAmount = new CustomMaterialProperty( this, CCHairScissorShader.highlightAFadeOutAmount ); highlightBColor = new CustomMaterialProperty( this, CCHairScissorShader.highlightBColor ); highlightBStrength = new CustomMaterialProperty( this, CCHairScissorShader.highlightBStrength ); highlightBRange = new CustomMaterialProperty( this, CCHairScissorShader.highlightBRange ); highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairScissorShader.highlightBOverlapEnd ); highlightBInvert = new CustomMaterialProperty( this, CCHairScissorShader.highlightBInvert ); - highlightBFadeOutStart = new CustomMaterialProperty( this, CCHairScissorShader.highlightBFadeOutStart ); - highlightBFadeOutRange = new CustomMaterialProperty( this, CCHairScissorShader.highlightBFadeOutRange ); - highlightBFadeOutPower = new CustomMaterialProperty( this, CCHairScissorShader.highlightBFadeOutPower ); - highlightBFadeOutAmount = new CustomMaterialProperty( this, CCHairScissorShader.highlightBFadeOutAmount ); roughness = new CustomMaterialProperty( this, CCHairScissorShader.roughness ); roughnessOffset = new CustomMaterialProperty( this, CCHairScissorShader.roughnessOffset ); textureRoughness = new CustomMaterialProperty( this, CCHairScissorShader.textureRoughness ); @@ -201,12 +199,16 @@ namespace Rokojori metallicOffset = new CustomMaterialProperty( this, CCHairScissorShader.metallicOffset ); textureMetallic = new CustomMaterialProperty( this, CCHairScissorShader.textureMetallic ); specular = new CustomMaterialProperty( this, CCHairScissorShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairScissorShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairScissorShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairScissorShader.anisotropyRatio ); textureEmission = new CustomMaterialProperty( this, CCHairScissorShader.textureEmission ); emission = new CustomMaterialProperty( this, CCHairScissorShader.emission ); emissionEnergy = new CustomMaterialProperty( this, CCHairScissorShader.emissionEnergy ); backlight = new CustomMaterialProperty( this, CCHairScissorShader.backlight ); albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairScissorShader.albedoToBacklightAmount ); textureBacklight = new CustomMaterialProperty( this, CCHairScissorShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairScissorShader.subsurfaceScatteringStrength ); textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairScissorShader.textureAmbientOcclusion ); aoLightAffect = new CustomMaterialProperty( this, CCHairScissorShader.aoLightAffect ); ambientOcclusion = new CustomMaterialProperty( this, CCHairScissorShader.ambientOcclusion ); @@ -215,6 +217,7 @@ namespace Rokojori rootOcclusionRange = new CustomMaterialProperty( this, CCHairScissorShader.rootOcclusionRange ); endOcclusionAmount = new CustomMaterialProperty( this, CCHairScissorShader.endOcclusionAmount ); endOcclusionRange = new CustomMaterialProperty( this, CCHairScissorShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairScissorShader.rootBasedOcclusion ); } } diff --git a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs index 4e881e3..2374d11 100644 --- a/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs +++ b/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadowMaterial.cs @@ -7,10 +7,80 @@ namespace Rokojori public class CCHairShadowShader { public static readonly CachedResource shader = new CachedResource( - "res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/CCHairShadow.gdshader" + "res://addons/rokojori_action_library/Runtime/Reallusion/Shaders/Hair/Variants/CCHairShadow.gdshader" ); - + public static readonly BoolPropertyName enabled = BoolPropertyName.Create( "enabled" ); + public static readonly ColorPropertyName albedo = ColorPropertyName.Create( "albedo" ); + public static readonly Texture2DPropertyName textureAlbedo = Texture2DPropertyName.Create( "texture_albedo" ); + public static readonly Vector3PropertyName hslOffset = Vector3PropertyName.Create( "hslOffset" ); + public static readonly Texture2DPropertyName textureBlend = Texture2DPropertyName.Create( "texture_blend" ); + public static readonly FloatPropertyName blendAmount = FloatPropertyName.Create( "blendAmount" ); + public static readonly FloatPropertyName naturalColors = FloatPropertyName.Create( "naturalColors" ); + public static readonly Texture2DPropertyName textureOpacity = Texture2DPropertyName.Create( "texture_opacity" ); + public static readonly FloatPropertyName opacity = FloatPropertyName.Create( "opacity" ); + public static readonly FloatPropertyName opacityGamma = FloatPropertyName.Create( "opacityGamma" ); + public static readonly FloatPropertyName opacityFarScale = FloatPropertyName.Create( "opacityFarScale" ); + public static readonly FloatPropertyName opacityBlur = FloatPropertyName.Create( "opacityBlur" ); + public static readonly FloatPropertyName opacityBlurFarScale = FloatPropertyName.Create( "opacityBlurFarScale" ); + public static readonly FloatPropertyName opacityFarStart = FloatPropertyName.Create( "opacityFarStart" ); + public static readonly FloatPropertyName opacityFarRange = FloatPropertyName.Create( "opacityFarRange" ); + public static readonly FloatPropertyName opacityFarPower = FloatPropertyName.Create( "opacityFarPower" ); + public static readonly FloatPropertyName extending = FloatPropertyName.Create( "extending" ); + public static readonly Texture2DPropertyName rootMap = Texture2DPropertyName.Create( "rootMap" ); + public static readonly Texture2DPropertyName flowMap = Texture2DPropertyName.Create( "flowMap" ); + public static readonly Texture2DPropertyName idMap = Texture2DPropertyName.Create( "idMap" ); + public static readonly FloatPropertyName diffuseStrength = FloatPropertyName.Create( "diffuseStrength" ); + public static readonly FloatPropertyName vertexColorStrength = FloatPropertyName.Create( "vertexColorStrength" ); + public static readonly ColorPropertyName vertexGreyToColor = ColorPropertyName.Create( "vertexGreyToColor" ); + public static readonly BoolPropertyName activateHairColor = BoolPropertyName.Create( "activateHairColor" ); + public static readonly FloatPropertyName baseColorMapStrength = FloatPropertyName.Create( "baseColorMapStrength" ); + public static readonly ColorPropertyName strandRootColor = ColorPropertyName.Create( "strandRootColor" ); + public static readonly FloatPropertyName strandRootStrength = FloatPropertyName.Create( "strandRootStrength" ); + public static readonly ColorPropertyName strandEndColor = ColorPropertyName.Create( "strandEndColor" ); + public static readonly FloatPropertyName strandEndStrength = FloatPropertyName.Create( "strandEndStrength" ); + public static readonly FloatPropertyName strandGamma = FloatPropertyName.Create( "strandGamma" ); + public static readonly FloatPropertyName maximumHighlightAmount = FloatPropertyName.Create( "maximumHighlightAmount" ); + public static readonly FloatPropertyName highlightFadeOutStart = FloatPropertyName.Create( "highlightFadeOutStart" ); + public static readonly FloatPropertyName highlightFadeOutEnd = FloatPropertyName.Create( "highlightFadeOutEnd" ); + public static readonly FloatPropertyName highlightFadeOutPower = FloatPropertyName.Create( "highlightFadeOutPower" ); + public static readonly FloatPropertyName highlightFadeOutAmount = FloatPropertyName.Create( "highlightFadeOutAmount" ); + public static readonly ColorPropertyName highlightAColor = ColorPropertyName.Create( "highlightAColor" ); + public static readonly FloatPropertyName highlightAStrength = FloatPropertyName.Create( "highlightAStrength" ); + public static readonly Vector3PropertyName highlightARange = Vector3PropertyName.Create( "highlightARange" ); + public static readonly FloatPropertyName highlightAOverlapEnd = FloatPropertyName.Create( "highlightAOverlapEnd" ); + public static readonly FloatPropertyName highlightAInvert = FloatPropertyName.Create( "highlightAInvert" ); + public static readonly ColorPropertyName highlightBColor = ColorPropertyName.Create( "highlightBColor" ); + public static readonly FloatPropertyName highlightBStrength = FloatPropertyName.Create( "highlightBStrength" ); + public static readonly Vector3PropertyName highlightBRange = Vector3PropertyName.Create( "highlightBRange" ); + public static readonly FloatPropertyName highlightBOverlapEnd = FloatPropertyName.Create( "highlightBOverlapEnd" ); + public static readonly FloatPropertyName highlightBInvert = FloatPropertyName.Create( "highlightBInvert" ); + public static readonly FloatPropertyName roughness = FloatPropertyName.Create( "roughness" ); + public static readonly FloatPropertyName roughnessOffset = FloatPropertyName.Create( "roughnessOffset" ); + public static readonly Texture2DPropertyName textureRoughness = Texture2DPropertyName.Create( "texture_roughness" ); + public static readonly FloatPropertyName metallic = FloatPropertyName.Create( "metallic" ); + public static readonly FloatPropertyName metallicOffset = FloatPropertyName.Create( "metallicOffset" ); + public static readonly Texture2DPropertyName textureMetallic = Texture2DPropertyName.Create( "texture_metallic" ); + public static readonly FloatPropertyName specular = FloatPropertyName.Create( "specular" ); + public static readonly FloatPropertyName specularOpacityAmount = FloatPropertyName.Create( "specularOpacityAmount" ); + public static readonly FloatPropertyName specularOpacityGamma = FloatPropertyName.Create( "specularOpacityGamma" ); + public static readonly FloatPropertyName anisotropyRatio = FloatPropertyName.Create( "anisotropy_ratio" ); + public static readonly Texture2DPropertyName textureEmission = Texture2DPropertyName.Create( "texture_emission" ); + public static readonly ColorPropertyName emission = ColorPropertyName.Create( "emission" ); + public static readonly FloatPropertyName emissionEnergy = FloatPropertyName.Create( "emission_energy" ); + public static readonly ColorPropertyName backlight = ColorPropertyName.Create( "backlight" ); + public static readonly FloatPropertyName albedoToBacklightAmount = FloatPropertyName.Create( "albedoToBacklightAmount" ); + public static readonly Texture2DPropertyName textureBacklight = Texture2DPropertyName.Create( "texture_backlight" ); + public static readonly FloatPropertyName subsurfaceScatteringStrength = FloatPropertyName.Create( "subsurface_scattering_strength" ); + public static readonly Texture2DPropertyName textureAmbientOcclusion = Texture2DPropertyName.Create( "texture_ambient_occlusion" ); + public static readonly FloatPropertyName aoLightAffect = FloatPropertyName.Create( "ao_light_affect" ); + public static readonly FloatPropertyName ambientOcclusion = FloatPropertyName.Create( "ambientOcclusion" ); + public static readonly FloatPropertyName aoGamma = FloatPropertyName.Create( "aoGamma" ); + public static readonly FloatPropertyName rootOcclusionAmount = FloatPropertyName.Create( "rootOcclusionAmount" ); + public static readonly FloatPropertyName rootOcclusionRange = FloatPropertyName.Create( "rootOcclusionRange" ); + public static readonly FloatPropertyName endOcclusionAmount = FloatPropertyName.Create( "endOcclusionAmount" ); + public static readonly FloatPropertyName endOcclusionRange = FloatPropertyName.Create( "endOcclusionRange" ); + public static readonly FloatPropertyName rootBasedOcclusion = FloatPropertyName.Create( "rootBasedOcclusion" ); } @@ -19,13 +89,153 @@ namespace Rokojori { - + public readonly CustomMaterialProperty enabled; + public readonly CustomMaterialProperty albedo; + public readonly CustomMaterialProperty textureAlbedo; + public readonly CustomMaterialProperty hslOffset; + public readonly CustomMaterialProperty textureBlend; + public readonly CustomMaterialProperty blendAmount; + public readonly CustomMaterialProperty naturalColors; + public readonly CustomMaterialProperty textureOpacity; + public readonly CustomMaterialProperty opacity; + public readonly CustomMaterialProperty opacityGamma; + public readonly CustomMaterialProperty opacityFarScale; + public readonly CustomMaterialProperty opacityBlur; + public readonly CustomMaterialProperty opacityBlurFarScale; + public readonly CustomMaterialProperty opacityFarStart; + public readonly CustomMaterialProperty opacityFarRange; + public readonly CustomMaterialProperty opacityFarPower; + public readonly CustomMaterialProperty extending; + public readonly CustomMaterialProperty rootMap; + public readonly CustomMaterialProperty flowMap; + public readonly CustomMaterialProperty idMap; + public readonly CustomMaterialProperty diffuseStrength; + public readonly CustomMaterialProperty vertexColorStrength; + public readonly CustomMaterialProperty vertexGreyToColor; + public readonly CustomMaterialProperty activateHairColor; + public readonly CustomMaterialProperty baseColorMapStrength; + public readonly CustomMaterialProperty strandRootColor; + public readonly CustomMaterialProperty strandRootStrength; + public readonly CustomMaterialProperty strandEndColor; + public readonly CustomMaterialProperty strandEndStrength; + public readonly CustomMaterialProperty strandGamma; + public readonly CustomMaterialProperty maximumHighlightAmount; + public readonly CustomMaterialProperty highlightFadeOutStart; + public readonly CustomMaterialProperty highlightFadeOutEnd; + public readonly CustomMaterialProperty highlightFadeOutPower; + public readonly CustomMaterialProperty highlightFadeOutAmount; + public readonly CustomMaterialProperty highlightAColor; + public readonly CustomMaterialProperty highlightAStrength; + public readonly CustomMaterialProperty highlightARange; + public readonly CustomMaterialProperty highlightAOverlapEnd; + public readonly CustomMaterialProperty highlightAInvert; + public readonly CustomMaterialProperty highlightBColor; + public readonly CustomMaterialProperty highlightBStrength; + public readonly CustomMaterialProperty highlightBRange; + public readonly CustomMaterialProperty highlightBOverlapEnd; + public readonly CustomMaterialProperty highlightBInvert; + public readonly CustomMaterialProperty roughness; + public readonly CustomMaterialProperty roughnessOffset; + public readonly CustomMaterialProperty textureRoughness; + public readonly CustomMaterialProperty metallic; + public readonly CustomMaterialProperty metallicOffset; + public readonly CustomMaterialProperty textureMetallic; + public readonly CustomMaterialProperty specular; + public readonly CustomMaterialProperty specularOpacityAmount; + public readonly CustomMaterialProperty specularOpacityGamma; + public readonly CustomMaterialProperty anisotropyRatio; + public readonly CustomMaterialProperty textureEmission; + public readonly CustomMaterialProperty emission; + public readonly CustomMaterialProperty emissionEnergy; + public readonly CustomMaterialProperty backlight; + public readonly CustomMaterialProperty albedoToBacklightAmount; + public readonly CustomMaterialProperty textureBacklight; + public readonly CustomMaterialProperty subsurfaceScatteringStrength; + public readonly CustomMaterialProperty textureAmbientOcclusion; + public readonly CustomMaterialProperty aoLightAffect; + public readonly CustomMaterialProperty ambientOcclusion; + public readonly CustomMaterialProperty aoGamma; + public readonly CustomMaterialProperty rootOcclusionAmount; + public readonly CustomMaterialProperty rootOcclusionRange; + public readonly CustomMaterialProperty endOcclusionAmount; + public readonly CustomMaterialProperty endOcclusionRange; + public readonly CustomMaterialProperty rootBasedOcclusion; public CCHairShadowMaterial() { Shader = CCHairShadowShader.shader.Get(); - + enabled = new CustomMaterialProperty( this, CCHairShadowShader.enabled ); + albedo = new CustomMaterialProperty( this, CCHairShadowShader.albedo ); + textureAlbedo = new CustomMaterialProperty( this, CCHairShadowShader.textureAlbedo ); + hslOffset = new CustomMaterialProperty( this, CCHairShadowShader.hslOffset ); + textureBlend = new CustomMaterialProperty( this, CCHairShadowShader.textureBlend ); + blendAmount = new CustomMaterialProperty( this, CCHairShadowShader.blendAmount ); + naturalColors = new CustomMaterialProperty( this, CCHairShadowShader.naturalColors ); + textureOpacity = new CustomMaterialProperty( this, CCHairShadowShader.textureOpacity ); + opacity = new CustomMaterialProperty( this, CCHairShadowShader.opacity ); + opacityGamma = new CustomMaterialProperty( this, CCHairShadowShader.opacityGamma ); + opacityFarScale = new CustomMaterialProperty( this, CCHairShadowShader.opacityFarScale ); + opacityBlur = new CustomMaterialProperty( this, CCHairShadowShader.opacityBlur ); + opacityBlurFarScale = new CustomMaterialProperty( this, CCHairShadowShader.opacityBlurFarScale ); + opacityFarStart = new CustomMaterialProperty( this, CCHairShadowShader.opacityFarStart ); + opacityFarRange = new CustomMaterialProperty( this, CCHairShadowShader.opacityFarRange ); + opacityFarPower = new CustomMaterialProperty( this, CCHairShadowShader.opacityFarPower ); + extending = new CustomMaterialProperty( this, CCHairShadowShader.extending ); + rootMap = new CustomMaterialProperty( this, CCHairShadowShader.rootMap ); + flowMap = new CustomMaterialProperty( this, CCHairShadowShader.flowMap ); + idMap = new CustomMaterialProperty( this, CCHairShadowShader.idMap ); + diffuseStrength = new CustomMaterialProperty( this, CCHairShadowShader.diffuseStrength ); + vertexColorStrength = new CustomMaterialProperty( this, CCHairShadowShader.vertexColorStrength ); + vertexGreyToColor = new CustomMaterialProperty( this, CCHairShadowShader.vertexGreyToColor ); + activateHairColor = new CustomMaterialProperty( this, CCHairShadowShader.activateHairColor ); + baseColorMapStrength = new CustomMaterialProperty( this, CCHairShadowShader.baseColorMapStrength ); + strandRootColor = new CustomMaterialProperty( this, CCHairShadowShader.strandRootColor ); + strandRootStrength = new CustomMaterialProperty( this, CCHairShadowShader.strandRootStrength ); + strandEndColor = new CustomMaterialProperty( this, CCHairShadowShader.strandEndColor ); + strandEndStrength = new CustomMaterialProperty( this, CCHairShadowShader.strandEndStrength ); + strandGamma = new CustomMaterialProperty( this, CCHairShadowShader.strandGamma ); + maximumHighlightAmount = new CustomMaterialProperty( this, CCHairShadowShader.maximumHighlightAmount ); + highlightFadeOutStart = new CustomMaterialProperty( this, CCHairShadowShader.highlightFadeOutStart ); + highlightFadeOutEnd = new CustomMaterialProperty( this, CCHairShadowShader.highlightFadeOutEnd ); + highlightFadeOutPower = new CustomMaterialProperty( this, CCHairShadowShader.highlightFadeOutPower ); + highlightFadeOutAmount = new CustomMaterialProperty( this, CCHairShadowShader.highlightFadeOutAmount ); + highlightAColor = new CustomMaterialProperty( this, CCHairShadowShader.highlightAColor ); + highlightAStrength = new CustomMaterialProperty( this, CCHairShadowShader.highlightAStrength ); + highlightARange = new CustomMaterialProperty( this, CCHairShadowShader.highlightARange ); + highlightAOverlapEnd = new CustomMaterialProperty( this, CCHairShadowShader.highlightAOverlapEnd ); + highlightAInvert = new CustomMaterialProperty( this, CCHairShadowShader.highlightAInvert ); + highlightBColor = new CustomMaterialProperty( this, CCHairShadowShader.highlightBColor ); + highlightBStrength = new CustomMaterialProperty( this, CCHairShadowShader.highlightBStrength ); + highlightBRange = new CustomMaterialProperty( this, CCHairShadowShader.highlightBRange ); + highlightBOverlapEnd = new CustomMaterialProperty( this, CCHairShadowShader.highlightBOverlapEnd ); + highlightBInvert = new CustomMaterialProperty( this, CCHairShadowShader.highlightBInvert ); + roughness = new CustomMaterialProperty( this, CCHairShadowShader.roughness ); + roughnessOffset = new CustomMaterialProperty( this, CCHairShadowShader.roughnessOffset ); + textureRoughness = new CustomMaterialProperty( this, CCHairShadowShader.textureRoughness ); + metallic = new CustomMaterialProperty( this, CCHairShadowShader.metallic ); + metallicOffset = new CustomMaterialProperty( this, CCHairShadowShader.metallicOffset ); + textureMetallic = new CustomMaterialProperty( this, CCHairShadowShader.textureMetallic ); + specular = new CustomMaterialProperty( this, CCHairShadowShader.specular ); + specularOpacityAmount = new CustomMaterialProperty( this, CCHairShadowShader.specularOpacityAmount ); + specularOpacityGamma = new CustomMaterialProperty( this, CCHairShadowShader.specularOpacityGamma ); + anisotropyRatio = new CustomMaterialProperty( this, CCHairShadowShader.anisotropyRatio ); + textureEmission = new CustomMaterialProperty( this, CCHairShadowShader.textureEmission ); + emission = new CustomMaterialProperty( this, CCHairShadowShader.emission ); + emissionEnergy = new CustomMaterialProperty( this, CCHairShadowShader.emissionEnergy ); + backlight = new CustomMaterialProperty( this, CCHairShadowShader.backlight ); + albedoToBacklightAmount = new CustomMaterialProperty( this, CCHairShadowShader.albedoToBacklightAmount ); + textureBacklight = new CustomMaterialProperty( this, CCHairShadowShader.textureBacklight ); + subsurfaceScatteringStrength = new CustomMaterialProperty( this, CCHairShadowShader.subsurfaceScatteringStrength ); + textureAmbientOcclusion = new CustomMaterialProperty( this, CCHairShadowShader.textureAmbientOcclusion ); + aoLightAffect = new CustomMaterialProperty( this, CCHairShadowShader.aoLightAffect ); + ambientOcclusion = new CustomMaterialProperty( this, CCHairShadowShader.ambientOcclusion ); + aoGamma = new CustomMaterialProperty( this, CCHairShadowShader.aoGamma ); + rootOcclusionAmount = new CustomMaterialProperty( this, CCHairShadowShader.rootOcclusionAmount ); + rootOcclusionRange = new CustomMaterialProperty( this, CCHairShadowShader.rootOcclusionRange ); + endOcclusionAmount = new CustomMaterialProperty( this, CCHairShadowShader.endOcclusionAmount ); + endOcclusionRange = new CustomMaterialProperty( this, CCHairShadowShader.endOcclusionRange ); + rootBasedOcclusion = new CustomMaterialProperty( this, CCHairShadowShader.rootBasedOcclusion ); } } diff --git a/Runtime/Sensors/Default-Sensors/Default-Input-Icons-Library.tres b/Runtime/Sensors/Default-Sensors/Default-Input-Icons-Library.tres index 31888ea..4942e11 100644 --- a/Runtime/Sensors/Default-Sensors/Default-Input-Icons-Library.tres +++ b/Runtime/Sensors/Default-Sensors/Default-Input-Icons-Library.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="InputIconsLibrary" load_steps=73 format=3 uid="uid://dq52vhnqr5m6"] +[gd_resource type="Resource" script_class="InputIconsLibrary" load_steps=74 format=3 uid="uid://dq52vhnqr5m6"] [ext_resource type="Script" uid="uid://c3dpplc2slwd5" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Definitions/DefaultInputIconDefinition.cs" id="1_64knt"] [ext_resource type="Script" uid="uid://bx1cm2837cuuc" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/InputIconsLibrary.cs" id="1_urlfx"] @@ -28,6 +28,7 @@ [ext_resource type="Texture2D" uid="uid://dxwnbh3a3fy8w" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Graphics/GamePad-Left-Shoulder-Button.svg" id="13_omll7"] [ext_resource type="Texture2D" uid="uid://1pfyxi7wifn8" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Graphics/Keyboard-SpaceKey.svg" id="14_6vom6"] [ext_resource type="Texture2D" uid="uid://bgi8cbw57gka0" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Graphics/GamePad-MainButton.svg" id="14_n68qo"] +[ext_resource type="SystemFont" uid="uid://s1pi67tbxu24" path="res://3rdPerson/Inputs/Jost-Font.tres" id="15_co1yv"] [ext_resource type="Texture2D" uid="uid://cb8ldiej8234h" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Graphics/GamePad-Axis-Background.svg" id="18_amimm"] [ext_resource type="Texture2D" uid="uid://ddfvjmi7sva6f" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Graphics/GamePad-Axis-Pressed.svg" id="19_7x4g0"] [ext_resource type="Script" uid="uid://bvj322mokkq63" path="res://addons/rokojori_action_library/Runtime/Localization/LocaleText.cs" id="20_55eoq"] @@ -339,6 +340,7 @@ borderBottom = 0.0 [resource] script = ExtResource("1_urlfx") +font = ExtResource("15_co1yv") fontSize = SubResource("Resource_40bf3") iconHeightInEm = 1.5 mouseInputIcon = SubResource("Resource_34cgw") diff --git a/Runtime/Sensors/SensorManager.cs b/Runtime/Sensors/SensorManager.cs index 5739190..3c7d9cc 100644 --- a/Runtime/Sensors/SensorManager.cs +++ b/Runtime/Sensors/SensorManager.cs @@ -23,9 +23,6 @@ namespace Rokojori [Export] public Node[] autoScanForSensors = []; - [Export] - public bool autoScanParent = true; - [Export] public bool separateMouseAndKeyboardTracking = false; @@ -76,7 +73,12 @@ namespace Rokojori public SensorDevice lastActiveDevice { get - { + { + if ( Engine.IsEditorHint() ) + { + return null; + } + if ( testingLastActiveDevice != null ) { return testingLastActiveDevice; @@ -96,7 +98,13 @@ namespace Rokojori void UpdateDevice( SensorDevice d ) { + if ( Engine.IsEditorHint() ) + { + return; + } + var lastActive = lastActiveDevice; + var index = Arrays.IndexOf( deviceList, d ); @@ -121,6 +129,11 @@ namespace Rokojori public void UpdateLastActiveDevice( Sensor sensor, int index ) { + if ( Engine.IsEditorHint() ) + { + return; + } + if ( keyboardDevice.ContainsSensor( sensor ) ) { UpdateDevice( separateMouseAndKeyboardTracking ? keyboardDevice : mouseKeyboardDevice ); @@ -154,21 +167,40 @@ namespace Rokojori } } - public override void _Ready() + // public override void _Ready() + // { + // if ( Engine.IsEditorHint() ) + // { + // return; + // } + + // //this.LogInfo( "" ); + // _startTime = DateTime.Now; + // mouseKeyboardDevice.devices = new SensorDevice[]{ mouseDevice, keyboardDevice }; + + // if ( ! initializeOnReady ) + // { + // return; + // } + + // CreateRunners(); + // } + + public void Initialize() { _startTime = DateTime.Now; mouseKeyboardDevice.devices = new SensorDevice[]{ mouseDevice, keyboardDevice }; - - if ( ! initializeOnReady ) - { - return; - } - CreateRunners(); } public override void _Input( InputEvent ev ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + //this.LogInfo( "" ); inputers.ForEach( ( inp )=> { @@ -179,6 +211,7 @@ namespace Rokojori public override void _Process( double delta ) { + // //this.LogInfo( "" ); if ( Engine.IsEditorHint() || ! processSensors ) { return; @@ -190,7 +223,11 @@ namespace Rokojori public void Register( Sensor s, SensorInputHandler sih ) { - this.LogInfo( "Registrating", s ); + if ( Engine.IsEditorHint() ) + { + return; + } + //this.LogInfo( "Register", s ); var sensorRunner = sensorToRunner[ s ]; @@ -206,12 +243,25 @@ namespace Rokojori public void Unregister( Sensor s, SensorInputHandler sih ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + //this.LogInfo( "Unregister", s ); var sensorRunner = sensorToRunner[ s ]; sensorRunner.listeners.Remove( sih ); } public static void Register( SensorInputHandler handler, params Sensor[] sensors ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + //RJLog.Log( "Register", sensors); + var sm = Unique.Get(); if ( sm == null ) @@ -233,6 +283,14 @@ namespace Rokojori public static void Unregister( SensorInputHandler handler, params Sensor[] sensors ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + + //RJLog.Log( "Unregister", sensors); + var sm = Unique.Get(); foreach ( var s in sensors ) @@ -252,12 +310,19 @@ namespace Rokojori void AddSensor( Sensor s ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + //this.LogInfo( "AddSensor", s); + if ( s == null || sensorsSet.Contains( s ) ) { return; } - // this.LogInfo( "Including:", HierarchyName.Of( s ) ); + // //this.LogInfo( "Including:", HierarchyName.Of( s ) ); AddSensorsFrom( s ); @@ -274,6 +339,13 @@ namespace Rokojori void AddSensorsFrom( object obj ) { + if ( Engine.IsEditorHint() ) + { + return; + } + + //this.LogInfo( "AddSensorsFrom", obj ); + if ( obj == null || _scannedObjects.Contains( obj ) ) { return; @@ -323,6 +395,13 @@ namespace Rokojori void CreateRunners() { + if ( Engine.IsEditorHint() ) + { + return; + } + + //this.LogInfo( "CreateRunners" ); + if ( sensors == null ) { sensors = new Sensor[]{}; @@ -352,10 +431,10 @@ namespace Rokojori Nodes.ForEach( n, AddSensorsFrom ); } - if ( autoScanParent ) - { - Nodes.ForEach( GetParent(), AddSensorsFrom ); - } + // if ( autoScanParent ) + // { + // Nodes.ForEach( GetParent(), AddSensorsFrom ); + // } runners.ForEach( r => diff --git a/Runtime/Sensors/SensorManagerSetup.cs b/Runtime/Sensors/SensorManagerSetup.cs new file mode 100644 index 0000000..a1638e8 --- /dev/null +++ b/Runtime/Sensors/SensorManagerSetup.cs @@ -0,0 +1,67 @@ + +using Godot; +using System.Collections.Generic; +using System; +namespace Rokojori +{ + [Tool] + [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorManager.svg")] + public partial class SensorManagerSetup: Node + { + [Export] + public bool initializeOnReady = true; + + [Export] + public Sensor[] sensors = []; + + [Export] + public SensorGroup[] sensorGroups = []; + + [Export] + public bool processSensors = true; + + [Export] + public Node[] autoScanForSensors = []; + + [Export] + public bool autoScanParent = true; + + [Export] + public bool separateMouseAndKeyboardTracking = false; + + [Export] + public Action onActiveDeviceChange; + + [Export] + public bool showRegistratedSensors = true; + + public override void _Ready() + { + if ( Engine.IsEditorHint() ) + { + return; + } + + var sm = this.CreateChild( "SensorManager" ); + + sm.sensors = sensors; + sm.sensorGroups = sensorGroups; + sm.processSensors = processSensors; + sm.autoScanForSensors = autoScanForSensors; + sm.separateMouseAndKeyboardTracking = separateMouseAndKeyboardTracking; + sm.onActiveDeviceChange = onActiveDeviceChange; + sm.showRegistratedSensors = showRegistratedSensors; + + if ( autoScanParent ) + { + sm.autoScanForSensors = Arrays.Add( sm.autoScanForSensors, GetParent() ); + } + + if ( initializeOnReady ) + { + sm.Initialize(); + } + } + + } +} \ No newline at end of file diff --git a/Runtime/Sensors/SensorManagerSetup.cs.uid b/Runtime/Sensors/SensorManagerSetup.cs.uid new file mode 100644 index 0000000..ab020ea --- /dev/null +++ b/Runtime/Sensors/SensorManagerSetup.cs.uid @@ -0,0 +1 @@ +uid://irn5l5pgo176 diff --git a/Runtime/Sensors/TriggerOnSensor.cs b/Runtime/Sensors/TriggerOnSensor.cs index a1bbd85..50da7a7 100644 --- a/Runtime/Sensors/TriggerOnSensor.cs +++ b/Runtime/Sensors/TriggerOnSensor.cs @@ -16,7 +16,6 @@ namespace Rokojori public override void _Ready() { this.LogInfo( "Root" ); - SensorManager.Register( this, sensor ); } diff --git a/Runtime/Shading/Materials/MaterialDelta.cs b/Runtime/Shading/Materials/MaterialDelta.cs index 664c4f6..3977f43 100644 --- a/Runtime/Shading/Materials/MaterialDelta.cs +++ b/Runtime/Shading/Materials/MaterialDelta.cs @@ -45,7 +45,7 @@ namespace Rokojori return; } - RJLog.Log( "Is Different", u.name, ":", u.type, ">>", colorA, colorB ); + // RJLog.Log( "Is Different", u.name, ":", u.type, ">>", colorA, colorB ); delta.colorProperties.Add( ColorProperty.Create( u.name, colorB ) ); } @@ -61,7 +61,7 @@ namespace Rokojori } - RJLog.Log( "Is Different", u.name, ":", u.type, ">>", floatA, floatB ); + // RJLog.Log( "Is Different", u.name, ":", u.type, ">>", floatA, floatB ); delta.floatProperties.Add( FloatProperty.Create( u.name, floatB ) ); } diff --git a/Runtime/Time/Duration/BeatsDuration.cs b/Runtime/Time/Duration/BeatsDuration.cs new file mode 100644 index 0000000..e319d90 --- /dev/null +++ b/Runtime/Time/Duration/BeatsDuration.cs @@ -0,0 +1,26 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class BeatsDuration:Duration + { + [Export] + public float beats; + + [Export] + public float bpm; + + public override float GetDurationInSeconds() + { + return MathAudio.BeatsToSeconds( beats, bpm ); + } + } +} \ No newline at end of file diff --git a/Runtime/Time/Duration/BeatsDuration.cs.uid b/Runtime/Time/Duration/BeatsDuration.cs.uid new file mode 100644 index 0000000..849b240 --- /dev/null +++ b/Runtime/Time/Duration/BeatsDuration.cs.uid @@ -0,0 +1 @@ +uid://cwjgw33krmh11 diff --git a/Runtime/Time/Duration/Duration.cs b/Runtime/Time/Duration/Duration.cs new file mode 100644 index 0000000..6a2a7d3 --- /dev/null +++ b/Runtime/Time/Duration/Duration.cs @@ -0,0 +1,23 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class Duration:Resource + { + [Export] + public TimeLine timeLine; + + public virtual float GetDurationInSeconds() + { + return 0; + } + } +} \ No newline at end of file diff --git a/Runtime/Time/Duration/Duration.cs.uid b/Runtime/Time/Duration/Duration.cs.uid new file mode 100644 index 0000000..1f98e4b --- /dev/null +++ b/Runtime/Time/Duration/Duration.cs.uid @@ -0,0 +1 @@ +uid://kqxbjjedkjyw diff --git a/Runtime/Time/Duration/SecondsDuration.cs b/Runtime/Time/Duration/SecondsDuration.cs new file mode 100644 index 0000000..f82aff6 --- /dev/null +++ b/Runtime/Time/Duration/SecondsDuration.cs @@ -0,0 +1,23 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class SecondsDuration:Duration + { + [Export] + public float seconds; + + public override float GetDurationInSeconds() + { + return seconds; + } + } +} \ No newline at end of file diff --git a/Runtime/Time/Duration/SecondsDuration.cs.uid b/Runtime/Time/Duration/SecondsDuration.cs.uid new file mode 100644 index 0000000..d8d287b --- /dev/null +++ b/Runtime/Time/Duration/SecondsDuration.cs.uid @@ -0,0 +1 @@ +uid://ddhwhwos5kkrm diff --git a/Runtime/Time/SecondsDuration.cs b/Runtime/Time/SecondsDuration.cs new file mode 100644 index 0000000..e69de29 diff --git a/Runtime/Time/SecondsDuration.cs.uid b/Runtime/Time/SecondsDuration.cs.uid new file mode 100644 index 0000000..0142486 --- /dev/null +++ b/Runtime/Time/SecondsDuration.cs.uid @@ -0,0 +1 @@ +uid://cb610tq0tjv30 diff --git a/Runtime/UI/UI-Settings-Default.tres b/Runtime/UI/UI-Settings-Default.tres index 5f882cd..d372244 100644 --- a/Runtime/UI/UI-Settings-Default.tres +++ b/Runtime/UI/UI-Settings-Default.tres @@ -1,6 +1,6 @@ [gd_resource type="Resource" script_class="UISettings" load_steps=3 format=3 uid="uid://dp57o0ykhkqfj"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/UI/UISettings.cs" id="1_5a283"] +[ext_resource type="Script" uid="uid://cgdxalxhdbmjn" path="res://addons/rokojori_action_library/Runtime/UI/UISettings.cs" id="1_5a283"] [ext_resource type="Resource" uid="uid://bhy8b3gopkq4m" path="res://addons/rokojori_action_library/Runtime/UI/ShaderProperties/Vector2/Size.tres" id="2_cdd3u"] [resource] diff --git a/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs b/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs index 2f69621..ba7a418 100644 --- a/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs +++ b/Runtime/VirtualCameras/CameraSlotSelectors/SetActiveCamera.cs @@ -15,9 +15,13 @@ namespace Rokojori [Export] public VirtualCamera3D virtualCamera; + [ExportGroup( "Create Slot")] [Export] public bool createSlotIfNotPresent = true; + [Export] + public SelectorFlag[] slotFlags; + public override VirtualCamera3DSlot GetCameraSlot() { var vm = VirtualCamera3DManager.Get(); @@ -27,6 +31,7 @@ namespace Rokojori { slot = vm.CreateChild(); slot.camera = virtualCamera; + slot.flags = slotFlags; vm.RefreshSlots(); } diff --git a/Runtime/VirtualCameras/Effects/PlayCameraEffect.cs b/Runtime/VirtualCameras/Effects/PlayCameraEffect.cs index 9a111ff..4302604 100644 --- a/Runtime/VirtualCameras/Effects/PlayCameraEffect.cs +++ b/Runtime/VirtualCameras/Effects/PlayCameraEffect.cs @@ -22,6 +22,9 @@ namespace Rokojori [Export] public VirtualCamera3DSlot cameraSlot; + [Export] + public VirtualCamera3D camera; + [Export] public int cameraSlotIndex = -1; @@ -34,9 +37,13 @@ namespace Rokojori var manager = VirtualCamera3DManager.Get(); var resolvedSlot = useActiveCameraSlot ? manager.activeSlot : cameraSlot; - if ( resolvedSlot == null && cameraSlotIndex != -1 ) - { + if ( resolvedSlot == null && camera != null ) + { + resolvedSlot = manager.GetSlot( camera ); + } + if ( resolvedSlot == null ) + { if ( cameraSlotIndex != -1 ) { resolvedSlot = manager.GetSlot( cameraSlotIndex ); diff --git a/Runtime/VirtualCameras/LookAtCamera.cs b/Runtime/VirtualCameras/LookAtCamera.cs new file mode 100644 index 0000000..5ede411 --- /dev/null +++ b/Runtime/VirtualCameras/LookAtCamera.cs @@ -0,0 +1,44 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + +namespace Rokojori +{ + [Tool] + [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/VirtualCamera3D.svg") ] + public partial class LookAtCamera:VirtualCamera3D + { + [Export] + public Node3D target; + + [Export] + public Smoothing smoothing; + + [Export] + public TimeLine timeLine; + + public override void _Process( double delta ) + { + if ( Engine.IsEditorHint() ) + { + return; + } + + var lookAtPosition = smoothing.Smooth( target.GlobalPosition, timeLine.delta ); + + if ( ! Math3D.IsValid( lookAtPosition ) ) + { + lookAtPosition = target.GlobalPosition; + smoothing.SetCurrent( target.GlobalPosition ); + } + + // this.LogInfo( target.GlobalPosition, lookAtPosition, timeLine.delta ); + this.LookAt( lookAtPosition, Vector3.Up, true ); + } + + } +} \ No newline at end of file diff --git a/Runtime/VirtualCameras/LookAtCamera.cs.uid b/Runtime/VirtualCameras/LookAtCamera.cs.uid new file mode 100644 index 0000000..94a8d95 --- /dev/null +++ b/Runtime/VirtualCameras/LookAtCamera.cs.uid @@ -0,0 +1 @@ +uid://7wfp46dloykf