2024-09-14 06:41:52 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Godot;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
2025-01-03 12:09:23 +00:00
|
|
|
public class ScatterPoint:PointData
|
2024-09-14 06:41:52 +00:00
|
|
|
{
|
2025-01-03 12:09:23 +00:00
|
|
|
public bool instanced = false;
|
2025-06-23 11:16:01 +00:00
|
|
|
|
|
|
|
public float instanceCullDistance = 200;
|
|
|
|
public float instanceCullRange = 100;
|
|
|
|
|
2025-06-10 13:16:36 +00:00
|
|
|
public float instanceSplitSize = 25;
|
2025-06-23 11:16:01 +00:00
|
|
|
public Vector3 instancingSplitScatterNoiseAmount = Vector3.Zero;
|
|
|
|
public Vector3 instancingSplitScatterNoiseFrequency = Vector3.Zero;
|
|
|
|
|
|
|
|
public GeometryInstance3D.ShadowCastingSetting shadowCasting = GeometryInstance3D.ShadowCastingSetting.On;
|
2024-09-14 06:41:52 +00:00
|
|
|
protected Scatterer _creator;
|
|
|
|
public Scatterer creator => _creator;
|
|
|
|
protected int _creatorID;
|
|
|
|
public int creatorID => _creatorID;
|
|
|
|
|
2025-06-10 13:16:36 +00:00
|
|
|
|
2024-09-14 06:41:52 +00:00
|
|
|
public ScatterPoint( Scatterer creator, int id )
|
|
|
|
{
|
|
|
|
this._creator = creator;
|
|
|
|
this._creatorID = id;
|
|
|
|
}
|
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
|
2024-09-14 06:41:52 +00:00
|
|
|
public PackedScene scene;
|
|
|
|
|
|
|
|
public bool CanBeReusedBy( ScatterPoint other )
|
|
|
|
{
|
|
|
|
return parent == other.parent && scene == other.scene;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateInstantiated( Node3D node )
|
|
|
|
{
|
|
|
|
ApplyTransform( node );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Node3D Instantiate()
|
|
|
|
{
|
|
|
|
if ( ! visible || scene == null || parent == null )
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var node3D = scene.Instantiate<Node3D>();
|
|
|
|
|
|
|
|
parent.AddChild( node3D );
|
|
|
|
node3D.Owner = parent.Owner;
|
|
|
|
|
|
|
|
ApplyTransform( node3D );
|
|
|
|
|
|
|
|
return node3D;
|
|
|
|
}
|
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
|
2024-09-14 06:41:52 +00:00
|
|
|
}
|
|
|
|
}
|