Removed Unneeded Materials, Added Default Actions, Plugin AutoLoad
This commit is contained in:
parent
1808c82c51
commit
24e6ca84c3
|
@ -6,7 +6,7 @@ uniform int u_distance = 16;
|
|||
uniform bool u_alpha_overwrite = true;
|
||||
|
||||
|
||||
vec4 dilate(sampler2D a_tex, sampler2D tex, vec2 coords, vec2 texel_size, int dist, float alpha_cutoff)
|
||||
vec4 dilate( sampler2D a_tex, sampler2D tex, vec2 coords, vec2 texel_size, int dist, float alpha_cutoff )
|
||||
{
|
||||
|
||||
vec2 offsets[8] = {
|
||||
|
@ -40,7 +40,7 @@ vec4 dilate(sampler2D a_tex, sampler2D tex, vec2 coords, vec2 texel_size, int di
|
|||
return sample;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
COLOR = dilate(u_alpha_tex, TEXTURE, UV, TEXTURE_PIXEL_SIZE, u_distance, 0.95);
|
||||
//COLOR.a = 1.0;
|
||||
void fragment()
|
||||
{
|
||||
COLOR = dilate(u_alpha_tex, TEXTURE, UV, TEXTURE_PIXEL_SIZE, u_distance, 0.95);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,19 @@ namespace Rokojori
|
|||
{
|
||||
GizmoDrawerPlugin gizmoDrawerPlugin = new GizmoDrawerPlugin();
|
||||
|
||||
static readonly string RokojoriRootAutoLoad = "RokojoriRootAutoLoad";
|
||||
static readonly string RokojoriRootAutoLoadPath = "res://addons/rokojori_action_library/Runtime/Godot/Root.cs";
|
||||
|
||||
public override void _EnablePlugin()
|
||||
{
|
||||
AddAutoloadSingleton( RokojoriRootAutoLoad, RokojoriRootAutoLoadPath );
|
||||
}
|
||||
|
||||
public override void _DisablePlugin()
|
||||
{
|
||||
RemoveAutoloadSingleton( RokojoriRootAutoLoad );
|
||||
}
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
AddNode3DGizmoPlugin( gizmoDrawerPlugin );
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Rokojori
|
|||
</summary>
|
||||
*/
|
||||
|
||||
[Tool]
|
||||
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ActionList.svg") ]
|
||||
public partial class ActionList : Action
|
||||
{
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
using Rokojori;
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
[Tool]
|
||||
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/OnEvent.svg") ]
|
||||
public partial class OnCollision:Node
|
||||
{
|
||||
[Export]
|
||||
public Area3D area;
|
||||
|
||||
[Export]
|
||||
public Selector selector;
|
||||
|
||||
[Export]
|
||||
public Action onEntered;
|
||||
|
||||
[Export]
|
||||
public Action onInside;
|
||||
|
||||
[Export]
|
||||
public Action onExit;
|
||||
|
||||
|
||||
|
||||
Dictionary<Node,System.Action> _inside = new Dictionary<Node,System.Action>();
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if ( area == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
area.AreaEntered += TriggerOnEnter;
|
||||
area.BodyEntered += TriggerOnEnter;
|
||||
|
||||
area.AreaExited += TriggerOnExited;
|
||||
area.BodyExited += TriggerOnExited;
|
||||
}
|
||||
|
||||
void TriggerOnEnter( Node n )
|
||||
{
|
||||
if ( ! Selector.IsSelecting( selector, n ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Action.Trigger( onEntered );
|
||||
|
||||
if ( onInside == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tm = Unique<TimeLineManager>.Get();
|
||||
|
||||
if ( tm == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var callback = ()=>{ Action.Trigger( onInside ); };
|
||||
_inside[ n ] = callback;
|
||||
tm.AddProcessCallback( callback );
|
||||
|
||||
}
|
||||
|
||||
void TriggerOnExited( Node n )
|
||||
{
|
||||
if ( ! Selector.IsSelecting( selector, n ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Action.Trigger( onExit );
|
||||
|
||||
if ( ! _inside.ContainsKey( n ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tm = Unique<TimeLineManager>.Get();
|
||||
|
||||
if ( tm == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var callback = _inside[ n ];
|
||||
tm.RemoveProcessCallback( callback );
|
||||
|
||||
_inside.Remove( n );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://c8gcunaffcaww
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
using Godot;
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
[GlobalClass]
|
||||
public partial class PlayParticles:Action
|
||||
{
|
||||
[Export]
|
||||
public GpuParticles3D particles3D;
|
||||
|
||||
protected override void _OnTrigger()
|
||||
{
|
||||
particles3D.Restart();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://dnstanbmrqthf
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
using Godot;
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
[GlobalClass]
|
||||
public partial class PlaySound:Action
|
||||
{
|
||||
[Export]
|
||||
public AudioStreamPlayer player;
|
||||
|
||||
protected override void _OnTrigger()
|
||||
{
|
||||
player.Play();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://ddgf2mfdmqywc
|
|
@ -226,6 +226,34 @@ namespace Rokojori
|
|||
return CreateChildIn<T>( parent, name );
|
||||
}
|
||||
|
||||
public static T CreateChildLocal3D<T>( this Node parent, Vector3 position, Quaternion? rotation, string name = null ) where T:Node3D,new()
|
||||
{
|
||||
var c = CreateChildIn<T>( parent, name );
|
||||
|
||||
c.Position = position;
|
||||
|
||||
if ( rotation != null )
|
||||
{
|
||||
Math3D.SetLocalQuaternion( c, (Quaternion)rotation );
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public static T CreateChildGlobal3D<T>( this Node parent, Vector3 position, Quaternion? rotation, string name = null ) where T:Node3D,new()
|
||||
{
|
||||
var c = CreateChildIn<T>( parent, name );
|
||||
|
||||
c.GlobalPosition = position;
|
||||
|
||||
if ( rotation != null )
|
||||
{
|
||||
Math3D.SetGlobalQuaternion( c, (Quaternion)rotation );
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public static Node CreateChildWithType( this Node parent, Type type, string name = null )
|
||||
{
|
||||
return CreateChildInWithType( parent, type, name );
|
||||
|
|
|
@ -242,16 +242,26 @@ namespace Rokojori
|
|||
return quaternion;
|
||||
}
|
||||
|
||||
public static Vector3 MinPosition( Node3D a, Node3D b )
|
||||
public static Vector3 MinGlobalPosition( Node3D a, Node3D b )
|
||||
{
|
||||
return a.GlobalPosition.Min( b.GlobalPosition );
|
||||
}
|
||||
|
||||
public static Vector3 MaxPosition( Node3D a, Node3D b )
|
||||
public static Vector3 MaxGlobalPosition( Node3D a, Node3D b )
|
||||
{
|
||||
return a.GlobalPosition.Max( b.GlobalPosition );
|
||||
}
|
||||
|
||||
public static Vector3 MinLocalPosition( Node3D a, Node3D b )
|
||||
{
|
||||
return a.Position.Min( b.Position );
|
||||
}
|
||||
|
||||
public static Vector3 MaxLocalPosition( Node3D a, Node3D b )
|
||||
{
|
||||
return a.Position.Max( b.Position );
|
||||
}
|
||||
|
||||
public static Vector3 SnapRounded( Vector3 v, Vector3 snapping )
|
||||
{
|
||||
v.X = MathX.SnapRounded( v.X, snapping.X );
|
||||
|
@ -443,6 +453,13 @@ namespace Rokojori
|
|||
node.Scale = localScale;
|
||||
}
|
||||
|
||||
public static void SetLocalQuaternion( this Node3D node, Quaternion quaternion )
|
||||
{
|
||||
var localScale = node.Scale;
|
||||
node.Basis = new Basis( quaternion );
|
||||
node.Scale = localScale;
|
||||
}
|
||||
|
||||
public static void SetGlobalRotationTo( Node3D node, Quaternion quaternion )
|
||||
{
|
||||
var forward = quaternion * Vector3.Forward;
|
||||
|
|
|
@ -24,6 +24,26 @@ namespace Rokojori
|
|||
[Export]
|
||||
public bool updateAlways;
|
||||
|
||||
[ExportGroup( "Patch")]
|
||||
[Export]
|
||||
public float patchSize = 2;
|
||||
|
||||
[Export]
|
||||
public float patchSizeX = 0;
|
||||
|
||||
[Export]
|
||||
public float patchSizeZ = 0;
|
||||
|
||||
[Export]
|
||||
public Vector2 patchOffsetPosition = new Vector2( 0.5f, 0.5f );
|
||||
|
||||
[Export]
|
||||
public bool centerPatch = false;
|
||||
|
||||
[Export]
|
||||
public float centerPatchComputationHeightTreshold = 0.1f;
|
||||
|
||||
|
||||
[ExportGroup( "Blades")]
|
||||
|
||||
[Export( PropertyHint.Range, "0,100")]
|
||||
|
@ -38,27 +58,10 @@ namespace Rokojori
|
|||
[Export]
|
||||
public int X_numBlades;
|
||||
|
||||
[ExportGroup( "Patch")]
|
||||
[Export]
|
||||
public float patchSize = 2;
|
||||
|
||||
[Export]
|
||||
public float patchSizeX = 0;
|
||||
|
||||
[Export]
|
||||
public float patchSizeZ = 0;
|
||||
|
||||
[Export]
|
||||
public Vector2 patchOffsetPosition = new Vector2( 0.5f, 0.5f );
|
||||
|
||||
[Export]
|
||||
public bool centerPatch = false;
|
||||
|
||||
[Export]
|
||||
public float centerPatchComputationHeightTreshold = 0.1f;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Triangles")]
|
||||
|
||||
[ExportGroup( "Triangles")]
|
||||
[Export( PropertyHint.Range, "1,256")]
|
||||
public int bladeSegments = 3;
|
||||
|
||||
|
@ -75,7 +78,7 @@ namespace Rokojori
|
|||
[Export]
|
||||
public Curve bladeSegmentMapping = MathX.Curve( 0, 1 );
|
||||
|
||||
[ExportGroup( "Blade Segmentation")]
|
||||
[ExportGroup( "Segmentation")]
|
||||
[Export]
|
||||
public int uvSegmentColumns = 1;
|
||||
|
||||
|
@ -95,7 +98,7 @@ namespace Rokojori
|
|||
public float uvSegmentMaxRange = 0.3f;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Shape")]
|
||||
[ExportGroup( "Shape")]
|
||||
|
||||
[Export]
|
||||
public Curve bladeHeight = MathX.Curve( 0.4f );
|
||||
|
@ -109,19 +112,14 @@ namespace Rokojori
|
|||
[Export]
|
||||
public Curve bladeWidth2 = null;
|
||||
|
||||
[ExportGroup( "Curve")]
|
||||
|
||||
[Export]
|
||||
public Curve bladeBending = MathX.Curve( 0f );
|
||||
|
||||
[Export]
|
||||
public Curve bladeBending2 = null;
|
||||
|
||||
[Export]
|
||||
public Curve bladeArching = MathX.Curve( 0f );
|
||||
|
||||
[Export]
|
||||
public Curve bladeArching2 = null;
|
||||
|
||||
|
||||
[Export]
|
||||
public Curve bladeTwisting = null;
|
||||
|
||||
|
@ -135,7 +133,7 @@ namespace Rokojori
|
|||
public Curve rolling2 = null;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Offset")]
|
||||
[ExportGroup( "Offset")]
|
||||
|
||||
[Export]
|
||||
public Curve positionJitter = MathX.Curve( 0.05f );
|
||||
|
@ -148,7 +146,7 @@ namespace Rokojori
|
|||
|
||||
|
||||
|
||||
[ExportGroup( "Blade Scale")]
|
||||
[ExportGroup( "Scale")]
|
||||
|
||||
[Export]
|
||||
public Curve bladeScale = MathX.Curve( 1f );
|
||||
|
@ -178,7 +176,7 @@ namespace Rokojori
|
|||
public Curve scaleZForY = null;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Rotation")]
|
||||
[ExportGroup( "Rotation")]
|
||||
|
||||
[Export]
|
||||
public Curve yawRotation = MathX.Curve( 0f, 1f );
|
||||
|
@ -186,8 +184,24 @@ namespace Rokojori
|
|||
[Export]
|
||||
public Curve randomRotation = MathX.Curve( 0f, 20f );
|
||||
|
||||
[ExportGroup( "Noise")]
|
||||
[Export]
|
||||
public Curve vertexTurbulenceAmount = MathX.Curve( 0f, 0f );
|
||||
|
||||
[ExportGroup( "Blade Normals")]
|
||||
[Export]
|
||||
public Curve vertexTurbulenceScale = MathX.Curve( 1f, 1f );
|
||||
|
||||
[Export]
|
||||
public Curve vertexTurbulenceScaleX = MathX.Curve( 1f, 1f );
|
||||
|
||||
[Export]
|
||||
public Curve vertexTurbulenceScaleY = MathX.Curve( 1f, 1f );
|
||||
|
||||
[Export]
|
||||
public Curve vertexTurbulenceScaleZ = MathX.Curve( 1f, 1f );
|
||||
|
||||
|
||||
[ExportGroup( "Normals")]
|
||||
[Export]
|
||||
public Curve normalBlending = MathX.Curve( 0.5f );
|
||||
|
||||
|
@ -199,7 +213,7 @@ namespace Rokojori
|
|||
|
||||
|
||||
|
||||
[ExportGroup( "Blade Filter")]
|
||||
[ExportGroup( "Filter")]
|
||||
[Export (PropertyHint.Range, "0,1")]
|
||||
public float filterTreshold = 1;
|
||||
|
||||
|
@ -412,6 +426,29 @@ namespace Rokojori
|
|||
mg.CenterMesh( true, false, true, box );
|
||||
}
|
||||
|
||||
if ( vertexTurbulenceAmount != null )
|
||||
{
|
||||
var turbulenceAmount = random.Sample( vertexTurbulenceAmount );
|
||||
var turbulenceScale = Vector3.One * ( vertexTurbulenceScale == null ? 1 : random.Sample( vertexTurbulenceScale ) );
|
||||
|
||||
if ( vertexTurbulenceScaleX != null )
|
||||
{
|
||||
turbulenceScale.X *= random.Sample( vertexTurbulenceScaleX );
|
||||
}
|
||||
|
||||
if ( vertexTurbulenceScaleY != null )
|
||||
{
|
||||
turbulenceScale.Y *= random.Sample( vertexTurbulenceScaleY );
|
||||
}
|
||||
|
||||
if ( vertexTurbulenceScaleZ != null )
|
||||
{
|
||||
turbulenceScale.Z *= random.Sample( vertexTurbulenceScaleX );
|
||||
}
|
||||
|
||||
mg.Turbulence( turbulenceAmount, turbulenceScale, Vector3.Zero );
|
||||
}
|
||||
|
||||
if ( xRemapper != null )
|
||||
{
|
||||
mg.RemapX( xRemapper );
|
||||
|
@ -441,6 +478,8 @@ namespace Rokojori
|
|||
{
|
||||
mg.ScaleZForY( scaleZForY );
|
||||
}
|
||||
|
||||
|
||||
|
||||
X_numTriangles = mg.indices.Count / 3;
|
||||
|
||||
|
|
|
@ -111,6 +111,22 @@ namespace Rokojori
|
|||
[Export]
|
||||
public float distance = 1;
|
||||
|
||||
public static Baker Create( Node parent, Node3D target, Vector2I size, string name )
|
||||
{
|
||||
var bakingView = parent.CreateChild<SubViewport>( "Viewport " + name );
|
||||
bakingView.TransparentBg = true;
|
||||
bakingView.Size = size;
|
||||
|
||||
var bakingCamera = bakingView.CreateChild<Camera3D>( "Camera View " + name );
|
||||
var baker = bakingView.CreateChild<Baker>( "Baker " + name );
|
||||
|
||||
baker.camera = bakingCamera;
|
||||
baker.target = target;
|
||||
baker.viewport = bakingView;
|
||||
|
||||
return baker;
|
||||
}
|
||||
|
||||
public override void _Process( double delta )
|
||||
{
|
||||
if ( ! ( update || updateAlways ) )
|
||||
|
|
|
@ -180,8 +180,8 @@ namespace Rokojori
|
|||
[Export]
|
||||
public WorldEnvironment X_worldEnvironment;
|
||||
|
||||
[Export]
|
||||
public DilateTexture X_dilateTexture;
|
||||
// [Export]
|
||||
// public DilateTexture X_dilateTexture;
|
||||
|
||||
[Export]
|
||||
public MeshInstance3D X_outputMesh;
|
||||
|
@ -211,22 +211,23 @@ namespace Rokojori
|
|||
public Texture2D X_bakedTextureDepth;
|
||||
|
||||
|
||||
|
||||
|
||||
bool _initialized = false;
|
||||
bool _baking = false;
|
||||
|
||||
|
||||
SerializedGodotObject _cached;
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Initialize();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public bool preventProcessing = true;
|
||||
|
||||
public override void _Process( double delta )
|
||||
{
|
||||
{
|
||||
if ( preventProcessing )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
X_texturePreview.Visible = showOutputTexture;
|
||||
|
||||
if ( _baking )
|
||||
|
@ -234,20 +235,14 @@ namespace Rokojori
|
|||
return;
|
||||
}
|
||||
|
||||
if ( initialize || ! _initialized )
|
||||
if ( initialize )
|
||||
{
|
||||
initialize = false;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
||||
var current = SerializedGodotObject.Create( this );
|
||||
|
||||
var changed = _cached != null && ! _cached.Equals( current );
|
||||
|
||||
_cached = current;
|
||||
|
||||
if ( bake || changed && preview_UpdateAlways )
|
||||
if ( bake || preview_UpdateAlways )
|
||||
{
|
||||
bake = false;
|
||||
Bake();
|
||||
|
@ -338,19 +333,19 @@ namespace Rokojori
|
|||
|
||||
this.LogInfo( "Texture created:", bakingMaterialModes[ i ] );
|
||||
|
||||
if ( preview_DilateTextures )
|
||||
{
|
||||
this.LogInfo( "Dilating:", bakingMaterialModes[ i ] );
|
||||
texture = await CreateDilatedTexture();
|
||||
// if ( preview_DilateTextures )
|
||||
// {
|
||||
// this.LogInfo( "Dilating:", bakingMaterialModes[ i ] );
|
||||
// texture = await CreateDilatedTexture();
|
||||
|
||||
this.LogInfo( "Dilating done:", bakingMaterialModes[ i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.LogInfo( "Dilating done:", bakingMaterialModes[ i ] );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
texture = Textures.Copy( texture );
|
||||
await this.RequestNextFrame();
|
||||
await this.RequestNextFrame();
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
this.LogInfo( "Assigning Texture", bakingMaterialModes[ i ] );
|
||||
|
@ -379,37 +374,37 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
|
||||
public async Task<Texture2D> CreateDilatedTexture()
|
||||
{
|
||||
var viewports = GetAllViewports();
|
||||
var textures = Lists.Map( viewports, v => v.GetTexture() as Texture2D );
|
||||
var dilatedTextures = new List<Texture2D>();
|
||||
// public async Task<Texture2D> CreateDilatedTexture()
|
||||
// {
|
||||
// var viewports = GetAllViewports();
|
||||
// var textures = Lists.Map( viewports, v => v.GetTexture() as Texture2D );
|
||||
// var dilatedTextures = new List<Texture2D>();
|
||||
|
||||
var index = 0;
|
||||
// var index = 0;
|
||||
|
||||
foreach ( var t in textures )
|
||||
{
|
||||
index ++;
|
||||
// foreach ( var t in textures )
|
||||
// {
|
||||
// index ++;
|
||||
|
||||
var dilatedTexture = await X_dilateTexture.Create( t );
|
||||
dilatedTextures.Add( dilatedTexture );
|
||||
}
|
||||
// var dilatedTexture = await X_dilateTexture.Create( t );
|
||||
// dilatedTextures.Add( dilatedTexture );
|
||||
// }
|
||||
|
||||
X_textureMerger.sourceTextures = dilatedTextures.ToArray();
|
||||
X_textureMerger.sourceMode = TextureMerger.SourceMode.Textures;
|
||||
// X_textureMerger.sourceTextures = dilatedTextures.ToArray();
|
||||
// X_textureMerger.sourceMode = TextureMerger.SourceMode.Textures;
|
||||
|
||||
X_textureMerger.Initialize();
|
||||
// X_textureMerger.Initialize();
|
||||
|
||||
await this.RequestNextFrame();
|
||||
// await this.RequestNextFrame();
|
||||
|
||||
X_textureMerger.CreateLayout();
|
||||
// X_textureMerger.CreateLayout();
|
||||
|
||||
await this.RequestNextFrame();
|
||||
// await this.RequestNextFrame();
|
||||
|
||||
var finalTexture = await X_dilateTexture.Create( X_textureMerger.X_textureMergerViewport.GetTexture() );
|
||||
// var finalTexture = await X_dilateTexture.Create( X_textureMerger.X_textureMergerViewport.GetTexture() );
|
||||
|
||||
return finalTexture;
|
||||
}
|
||||
// return finalTexture;
|
||||
// }
|
||||
|
||||
public List<SubViewport> GetAllViewports()
|
||||
{
|
||||
|
@ -474,7 +469,7 @@ namespace Rokojori
|
|||
|
||||
X_views = X_bakingViewport.CreateChild<Node>( "Views" );
|
||||
|
||||
X_dilateTexture = this.CreateChild<DilateTexture>( "Dilate Texture" );
|
||||
// X_dilateTexture = this.CreateChild<DilateTexture>( "Dilate Texture" );
|
||||
|
||||
X_textureMerger = this.CreateChild<TextureMerger>( "Texture Merger" );
|
||||
X_textureMerger.multiBaker = this;
|
||||
|
|
|
@ -791,6 +791,16 @@ namespace Rokojori
|
|||
}
|
||||
}
|
||||
|
||||
public void Turbulence( float amount, Vector3 noiseScale, Vector3 noiseOffset )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
var offset = Noise.PerlinPolar3( v * noiseScale + noiseOffset ) * amount;
|
||||
vertices[ i ] = v + offset;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemapX( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
|
@ -821,6 +831,8 @@ namespace Rokojori
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ScaleXForY( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace Rokojori
|
|||
{
|
||||
CreateWeights();
|
||||
|
||||
var minPosition = Math3D.MinPosition( cornerA, cornerB );
|
||||
var maxPosition = Math3D.MaxPosition( cornerA, cornerB );
|
||||
var minPosition = Math3D.MinLocalPosition( cornerA, cornerB );
|
||||
var maxPosition = Math3D.MaxLocalPosition( cornerA, cornerB );
|
||||
|
||||
if ( snapToWorldGrid )
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace Rokojori
|
|||
|
||||
if ( xzOnly )
|
||||
{
|
||||
var y = ( cornerA.GlobalPosition.Y + cornerB.GlobalPosition.Y ) / 2f;
|
||||
var y = ( cornerA.Position.Y + cornerB.Position.Y ) / 2f;
|
||||
|
||||
for ( int x = 0; x < pointsX; x++ )
|
||||
{
|
||||
|
@ -89,6 +89,8 @@ namespace Rokojori
|
|||
var p = new ScatterPoint( this, id++ );
|
||||
|
||||
p.position = new Vector3( x, y, z );
|
||||
p.useGlobalPosition = false;
|
||||
|
||||
p.visible = ! setDiscarded;
|
||||
p.seed = Noise.CreateSeed( p.position );
|
||||
|
||||
|
|
|
@ -103,6 +103,15 @@ namespace Rokojori
|
|||
|
||||
Dictionary<Scatterer,int> _scattererIDs = new Dictionary<Scatterer, int>();
|
||||
|
||||
public enum PositionMode
|
||||
{
|
||||
Local_As_Global,
|
||||
Local_Plus_ScattererGlobal
|
||||
}
|
||||
|
||||
[Export]
|
||||
public PositionMode positionMode;
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
_instantiatedPoints.Clear();
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace Rokojori
|
|||
[Export]
|
||||
public Vector3 scaleNoiseOffset = Vector3.Zero;
|
||||
|
||||
|
||||
|
||||
protected override List<ScatterPoint> _Scatter( List<ScatterPoint> points, Scatterer root )
|
||||
{
|
||||
var output = points;
|
||||
|
|
|
@ -377,6 +377,30 @@ namespace Rokojori
|
|||
return IndexFromUnnormalizedWeights( weights, 1 );
|
||||
}
|
||||
|
||||
public List<int> Numbers( int numValues, int offset = 0 )
|
||||
{
|
||||
var list = new List<int>();
|
||||
|
||||
for ( int i = 0; i < numValues; i++ )
|
||||
{
|
||||
list.Add( i + offset );
|
||||
}
|
||||
|
||||
return new RandomList<int>( list, this ).GetList();
|
||||
}
|
||||
|
||||
public List<int> Selection( int possibleValues, int selection )
|
||||
{
|
||||
var list = new List<int>();
|
||||
|
||||
for ( int i = 0; i < possibleValues; i++ )
|
||||
{
|
||||
list.Add( i );
|
||||
}
|
||||
|
||||
return new RandomList<int>( list, this ).GetList().GetRange( 0, selection );
|
||||
}
|
||||
|
||||
int _FindElementIndexWithWeights( List<float> weights, float value )
|
||||
{
|
||||
var limit = 0f;
|
||||
|
|
|
@ -16,5 +16,10 @@ namespace Rokojori
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsSelecting( Selector selector, Node node )
|
||||
{
|
||||
return selector == null || selector.Selects( node );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,6 +15,16 @@ vec3 applyMatrixWithTranslation( vec3 v, mat4 m )
|
|||
return ( mw * vec4( v, 1.0 ) ).xyz;
|
||||
}
|
||||
|
||||
// L W V
|
||||
// L
|
||||
// W
|
||||
// V
|
||||
|
||||
// LD WD VD
|
||||
// LD
|
||||
// WD
|
||||
// VD
|
||||
|
||||
vec3 localToWorld( vec3 _VERTEX, mat4 _MODEL_MATRIX )
|
||||
{
|
||||
return ( _MODEL_MATRIX * vec4( _VERTEX, 1.0 ) ).xyz;
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||
namespace Rokojori
|
||||
{
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class CustomMaterial:ShaderMaterial
|
||||
{
|
||||
public void CopyUniformsFrom( ShaderMaterial material )
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
|
||||
|
||||
uniform float kernelOffset = 1;
|
||||
|
||||
void fragment()
|
||||
{
|
||||
vec2 pixelSize = SCREEN_PIXEL_SIZE * kernelOffset;
|
||||
|
||||
vec4 blurred = vec4( 0, 0, 0, 0 );
|
||||
int kernel = 2;
|
||||
|
||||
for ( int x = -kernel; x<= kernel; ++x )
|
||||
{
|
||||
for ( int y = -kernel; y<= kernel; ++y )
|
||||
{
|
||||
vec2 sampledUV = SCREEN_UV + pixelSize * vec2( float(x), float( y ) );
|
||||
vec4 value = textureLod( screen_texture, sampledUV, 0 );
|
||||
|
||||
if ( ( value.r + value.g + value.b ) * 255.0 < 10.0 )
|
||||
{
|
||||
value.a = 0.0;
|
||||
}
|
||||
|
||||
blurred += value;
|
||||
}
|
||||
}
|
||||
|
||||
blurred /= float( kernel * kernel );
|
||||
|
||||
|
||||
COLOR = blurred;
|
||||
;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
uid://djf46k1sq5eks
|
|
@ -49,7 +49,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class QuadBillboardMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class FancyOutlineMaterial:CustomMaterial
|
||||
{
|
||||
public static readonly CachedResource<FancyOutlineMaterial> ScanWhite500Ms20x = CustomMaterial.Cached<FancyOutlineMaterial>(
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class FresnelOverlayMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class OutlineMaterial:CustomMaterial
|
||||
{
|
||||
public static readonly CachedResource<OutlineMaterial> BoldYellow = CustomMaterial.Cached<OutlineMaterial>(
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class OverlayMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class ScanGradientMaterial:CustomMaterial
|
||||
{
|
||||
public static readonly CachedResource<ScanGradientMaterial> White = CustomMaterial.Cached<ScanGradientMaterial>(
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class TriPlanarOverlayMaterial:CustomMaterial
|
||||
{
|
||||
public static readonly CachedResource<TriPlanarOverlayMaterial> BlueShield = CustomMaterial.Cached<TriPlanarOverlayMaterial>(
|
||||
|
|
|
@ -24,7 +24,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class FadeWipeMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class ${ShaderName}Material:CustomMaterial
|
||||
{
|
||||
${MaterialPresets}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Rokojori
|
||||
{
|
||||
public class QueueList<T>:List<T>
|
||||
{
|
||||
List<T> _queuedInsertions = new List<T>();
|
||||
List<T> _queuedRemovals = new List<T>();
|
||||
|
||||
public void QueueInsert( T t )
|
||||
{
|
||||
_queuedInsertions.Add( t );
|
||||
}
|
||||
|
||||
public void QueueRemoval( T t )
|
||||
{
|
||||
_queuedRemovals.Add( t );
|
||||
}
|
||||
|
||||
public void IterateAndResolve( System.Action<T> callback )
|
||||
{
|
||||
ResolveRemovalsQueue();
|
||||
ResolveInsertionQueue();
|
||||
|
||||
this.ForEach( t => callback( t ) );
|
||||
|
||||
ResolveRemovalsQueue();
|
||||
}
|
||||
|
||||
protected void ResolveInsertionQueue()
|
||||
{
|
||||
if ( _queuedInsertions.Count == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddRange( _queuedInsertions );
|
||||
_queuedInsertions.Clear();
|
||||
}
|
||||
|
||||
protected void ResolveRemovalsQueue()
|
||||
{
|
||||
if ( _queuedRemovals.Count == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Lists.RemoveRange( this, _queuedRemovals );
|
||||
_queuedRemovals.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -50,16 +50,31 @@ namespace Rokojori
|
|||
|
||||
float _lastTimeScale = 1;
|
||||
|
||||
QueueList<System.Action> _processCallbacks = new QueueList<System.Action>();
|
||||
|
||||
public override void _Process( double delta )
|
||||
{
|
||||
UpdateRealTime( delta );
|
||||
|
||||
if ( ! Engine.IsEditorHint() && gametimeTimeline != null )
|
||||
{
|
||||
Engine.TimeScale = gametimeTimeline.runner.modulatedSpeed;
|
||||
Engine.TimeScale = GetRunner( gametimeTimeline ).modulatedSpeed;
|
||||
|
||||
}
|
||||
|
||||
_runners.ForEach( r => r.UpdateTimeLine( unscaledTimeDelta ) );
|
||||
_runners.ForEach( r => r.UpdateTimeLine( unscaledTimeDelta ) );
|
||||
|
||||
_processCallbacks.IterateAndResolve( t => t() );
|
||||
}
|
||||
|
||||
public void AddProcessCallback( System.Action a )
|
||||
{
|
||||
_processCallbacks.QueueInsert( a );
|
||||
}
|
||||
|
||||
public void RemoveProcessCallback( System.Action a )
|
||||
{
|
||||
_processCallbacks.QueueRemoval( a );
|
||||
}
|
||||
|
||||
public int GetTimeLineIndex( TimeLine timeLine )
|
||||
|
|
|
@ -16,7 +16,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class UINinePatchMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace Rokojori
|
|||
}
|
||||
|
||||
[Tool]
|
||||
[GlobalClass]
|
||||
public partial class RoundedRectangleMaterial:CustomMaterial
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue