Grass Patch Update
This commit is contained in:
parent
73b4d04a7d
commit
fb983f7da3
|
@ -119,6 +119,8 @@ namespace Rokojori
|
|||
cache = new Dictionary<object, SerializedGodotObject>();
|
||||
}
|
||||
|
||||
cache.Clear();
|
||||
|
||||
var objectData = new SerializedGodotObject();
|
||||
|
||||
var serializer = GodotBuiltInDataLibrary.serializers.Find( s => s.Handles( obj ) );
|
||||
|
|
|
@ -96,8 +96,6 @@ namespace Rokojori
|
|||
|
||||
|
||||
[ExportGroup( "Blade Shape")]
|
||||
[Export]
|
||||
public Curve bladeScale = MathX.Curve( 1f );
|
||||
|
||||
[Export]
|
||||
public Curve bladeHeight = MathX.Curve( 0.4f );
|
||||
|
@ -137,7 +135,7 @@ namespace Rokojori
|
|||
public Curve rolling2 = null;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Offset & Scale")]
|
||||
[ExportGroup( "Blade Offset")]
|
||||
|
||||
[Export]
|
||||
public Curve positionJitter = MathX.Curve( 0.05f );
|
||||
|
@ -148,12 +146,38 @@ namespace Rokojori
|
|||
[Export]
|
||||
public Curve positionJitterZ = MathX.Curve( 0.05f );
|
||||
|
||||
|
||||
|
||||
[ExportGroup( "Blade Scale")]
|
||||
|
||||
[Export]
|
||||
public Curve bladeScale = MathX.Curve( 1f );
|
||||
|
||||
[Export]
|
||||
public Curve scaleByDistanceX = MathX.Curve( 1f );
|
||||
|
||||
[Export]
|
||||
public Curve scaleByDistanceZ = MathX.Curve( 1f );
|
||||
|
||||
[Export]
|
||||
public Curve xRemapper = null;
|
||||
|
||||
[Export]
|
||||
public Curve yRemapper = null;
|
||||
|
||||
[Export]
|
||||
public Curve zRemapper = null;
|
||||
|
||||
[Export]
|
||||
public Curve scaleXZForY = null;
|
||||
|
||||
[Export]
|
||||
public Curve scaleXForY = null;
|
||||
|
||||
[Export]
|
||||
public Curve scaleZForY = null;
|
||||
|
||||
|
||||
[ExportGroup( "Blade Rotation")]
|
||||
|
||||
[Export]
|
||||
|
@ -195,7 +219,7 @@ namespace Rokojori
|
|||
[Export]
|
||||
public int currentLODLevel = -1;
|
||||
|
||||
SerializedGodotObject _cached;
|
||||
// SerializedGodotObject _cached;
|
||||
|
||||
public override void _Process( double delta )
|
||||
{
|
||||
|
@ -207,20 +231,20 @@ namespace Rokojori
|
|||
update = false;
|
||||
|
||||
|
||||
var current = SerializedGodotObject.Create( this );
|
||||
/*var current = SerializedGodotObject.Create( this );
|
||||
|
||||
var isEquals = _cached != null && _cached.Equals( current );
|
||||
|
||||
if ( _cached != null && _cached.Equals( current ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
CreatePatch();
|
||||
|
||||
_cached = current;
|
||||
// _cached = current;
|
||||
}
|
||||
|
||||
float _maxWidth = 0;
|
||||
|
@ -388,6 +412,35 @@ namespace Rokojori
|
|||
mg.CenterMesh( true, false, true, box );
|
||||
}
|
||||
|
||||
if ( xRemapper != null )
|
||||
{
|
||||
mg.RemapX( xRemapper );
|
||||
}
|
||||
|
||||
if ( yRemapper != null )
|
||||
{
|
||||
mg.RemapY( yRemapper );
|
||||
}
|
||||
|
||||
if ( zRemapper != null )
|
||||
{
|
||||
mg.RemapZ( zRemapper );
|
||||
}
|
||||
|
||||
if ( scaleXZForY != null )
|
||||
{
|
||||
mg.ScaleXZForY( scaleXZForY );
|
||||
}
|
||||
|
||||
if ( scaleXForY != null )
|
||||
{
|
||||
mg.ScaleXForY( scaleXForY );
|
||||
}
|
||||
|
||||
if ( scaleZForY != null )
|
||||
{
|
||||
mg.ScaleZForY( scaleZForY );
|
||||
}
|
||||
|
||||
X_numTriangles = mg.indices.Count / 3;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Rokojori
|
|||
{
|
||||
public class MeshGeometry
|
||||
{
|
||||
public string name = "";
|
||||
public string name;
|
||||
public List<Vector3> vertices = new List<Vector3>();
|
||||
public List<int> indices = new List<int>();
|
||||
|
||||
|
@ -437,7 +437,7 @@ namespace Rokojori
|
|||
{
|
||||
this.name = name;
|
||||
Initialize( normals, uvs, colors, uvs2 );
|
||||
}
|
||||
}
|
||||
|
||||
public static MeshGeometry BillboardQuad( float size = 1 )
|
||||
{
|
||||
|
@ -791,6 +791,66 @@ namespace Rokojori
|
|||
}
|
||||
}
|
||||
|
||||
public void RemapX( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
v.X = curve.Sample( v.X );
|
||||
vertices[ i ] = v;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemapY( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
v.Y = curve.Sample( v.Y );
|
||||
vertices[ i ] = v;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemapZ( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
v.Z = curve.Sample( v.Z );
|
||||
vertices[ i ] = v;
|
||||
}
|
||||
}
|
||||
|
||||
public void ScaleXForY( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
v.X = v.X * curve.Sample( v.Y );
|
||||
vertices[ i ] = v;
|
||||
}
|
||||
}
|
||||
|
||||
public void ScaleZForY( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
v.Z = v.Z * curve.Sample( v.Y );
|
||||
vertices[ i ] = v;
|
||||
}
|
||||
}
|
||||
|
||||
public void ScaleXZForY( Curve curve )
|
||||
{
|
||||
for ( int i = 0; i < vertices.Count; i++ )
|
||||
{
|
||||
var v = vertices[ i ];
|
||||
var s = curve.Sample( v.Y );
|
||||
vertices[ i ] = new Vector3( v.X * s, v.Y, v.Z * s );
|
||||
}
|
||||
}
|
||||
|
||||
public void CenterMesh( bool onX = true, bool onY = true, bool onZ = true, Box3 centerCalcluationBox = null )
|
||||
{
|
||||
var offset = new Vector3( 0, 0, 0 );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="Resource" script_class="Texture2DPropertyName" load_steps=2 format=3 uid="uid://dldbju3x0x2ow"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Texture2DPropertyName.cs" id="1_d1083"]
|
||||
[ext_resource type="Script" uid="uid://bsreukpi8eiyy" path="res://addons/rokojori_action_library/Runtime/Shading/Properties/Texture2DPropertyName.cs" id="1_d1083"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_d1083")
|
||||
|
|
Loading…
Reference in New Issue