daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange

This commit is contained in:
Nitload
2024-10-03 04:03:06 +08:00
parent 0979123ac0
commit 6e2f93b053
265 changed files with 26732 additions and 19058 deletions
@@ -39,8 +39,10 @@ using System.Text;
namespace StgSharp.Geometries
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate vec3d GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation);
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
public delegate Vec3 GeometryMotionDelegate(
TimeSpanProvider timeSource,
out float rotation );
public class GeometryMotion
{
@@ -54,69 +56,60 @@ namespace StgSharp.Geometries
public unsafe GeometryMotion(
bool isIncreament,
TimeSpanProvider timeSource,
GeometryMotionDelegate motionDelegate
)
GeometryMotionDelegate motionDelegate )
{
isIncrementMode = isIncreament;
time = timeSource;
if (motionDelegate == null)
{
handle = (IntPtr)(delegate*<TimeSpanProvider, out float, vec3d>)&defaultMotion;
if( motionDelegate == null ) {
handle = ( IntPtr )( delegate*<TimeSpanProvider, out float, Vec3> )&defaultMotion;
movement = defaultMotion;
}
else if (motionDelegate.Method.IsStatic)
{
} else if( motionDelegate.Method.IsStatic ) {
sourceIsStatic = true;
handle = Marshal.GetFunctionPointerForDelegate(motionDelegate);
handle = Marshal.GetFunctionPointerForDelegate( motionDelegate );
movement = motionDelegate;
}
else
{
} else {
movement = motionDelegate;
}
//sourceIsStatic = false;
}
public bool IsIncrement
{
get => isIncrementMode;
}
public static GeometryMotion DefaultMotion
{
get => new GeometryMotion(true, null, null);
get => new GeometryMotion( true, null, null );
}
public unsafe void RunMotion(ref vec3d coord, ref float rotation)
public unsafe void RunMotion( ref Vec3 coord, ref float rotation )
{
float rot;
vec3d vec;
if (sourceIsStatic)
{
vec = ((delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, vec3d>)handle)(time, out rot);
}
else
{
vec = movement(time, out rot);
Vec3 vec;
if( sourceIsStatic ) {
vec = ( ( delegate* unmanaged[Cdecl]<TimeSpanProvider, out float, Vec3> )handle )(
time, out rot );
} else {
vec = movement( time, out rot );
}
if (isIncrementMode)
{
if( isIncrementMode ) {
coord += vec;
rotation += rot;
}
else
{
} else {
coord = vec;
rotation = rot;
}
}
private static vec3d defaultMotion(TimeSpanProvider provider, out float rotation)
private static Vec3 defaultMotion(
TimeSpanProvider provider,
out float rotation )
{
rotation = 0;
return Vec3d.Zero;
return Vec3.Zero;
}
}//------------------------------- End of Class -------------------------------