daily update on 20240513 by nitload youmu, instancing render added

This commit is contained in:
YoumuLiu
2024-05-13 03:39:54 +08:00
parent 56459deec5
commit a3506c96a3
78 changed files with 2562 additions and 1098 deletions
@@ -40,62 +40,100 @@ using System.Threading.Tasks;
namespace StgSharp.Geometries
{
public interface IInstancing<T> where T : IInstancing<T>
public interface IInstancing<T> where T : IInstancing<T>
{
public int BufferId
{
get;
get;
set;
}
public vec2d CenterPositionGlobal
public vec3d CenterPositionGlobal
{
get;
set;
}
public vec2d Coord
public vec3d Coord
{
get { return new(GlobalBuffer.CoordList[BufferId]); }
set { GlobalBuffer.CoordList[BufferId] = value.vec; }
get { return GlobalBuffer.CoordList[BufferId].XYZ; }
set { GlobalBuffer.CoordList[BufferId] = new vec4d( value.vec); }
}
public PlainInstancingBuffer<T> GlobalBuffer
{
public PlainInstancingBuffer<T> GlobalBuffer
{
get;
internal set;
}
public float Rotation
{
get { return GlobalBuffer.CoordList[BufferId].W; }
set
{
vec4d temp = GlobalBuffer.CoordList[BufferId];
temp.W = value;
GlobalBuffer.CoordList[BufferId] = temp;
}
}
public float Scale
{
get { return GlobalBuffer.ScalingList[BufferId]; }
set { GlobalBuffer.ScalingList[BufferId] = value; }
}
public GeometryMotion Motion
{
get; set;
}
public void Move()
{
(vec3d coord , float rotation) =(Coord, Rotation);
Motion.RunMotion(ref coord, ref rotation);
(Rotation, Coord) = (rotation, coord);
}
}
public class ParticalOnPlain : IInstancing<ParticalOnPlain>
public class ParticleOnPlain : IInstancing<ParticleOnPlain>
{
public int BufferId
{
get;
set;
}
vec2d IInstancing<ParticalOnPlain>.CenterPositionGlobal
public ParticleOnPlain(PlainInstancingBuffer<ParticleOnPlain> buffer)
{
get ;
set ;
if (buffer == null)
{
throw new ArgumentNullException(paramName: nameof(buffer));
}
GlobalBuffer = buffer;
BufferId = buffer.CreateInstanceID();
buffer.InstanceList.Add(this);
}
public PlainInstancingBuffer<ParticalOnPlain> GlobalBuffer
public int BufferId
{
get;
set;
}
public ParticalOnPlain(PlainInstancingBuffer<ParticalOnPlain> buffer)
public PlainInstancingBuffer<ParticleOnPlain> GlobalBuffer
{
GlobalBuffer = buffer;
BufferId = buffer.CreateInstanceID();
get;
set;
}
public GeometryMotion Motion
{
get;
set;
}
vec3d IInstancing<ParticleOnPlain>.CenterPositionGlobal
{
get;
set;
}
}
}