OpenGL rebuild project start!

This commit is contained in:
Nitload
2023-04-29 03:06:32 +08:00
parent 7dba067146
commit 4dd3f4f6d1
263 changed files with 51374 additions and 1522 deletions
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic
{
/// <summary>
/// Provides methods for querying available functions in a bindings context.
/// </summary>
public interface IBindingsContext
{
/// <summary>
/// Retrieves an unmanaged function pointer to the specified function on the specified bindings context.
/// </summary>
/// <param name="procName">An ASCII-encoded string that defines the name of the function.</param>
/// <returns>
/// A <see cref="System.IntPtr"/> that contains the address of procName or IntPtr.Zero,
/// if the function is not supported by the drivers.
/// </returns>
/// <remarks>
/// Note: some drivers are known to return non-zero values for unsupported functions.
/// Typical values include 1 and 2 - inheritors are advised to check for and ignore these
/// values.
/// </remarks>
IntPtr GetProcAddress(string procName);
}
}
@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// Provides a common foundation for all flat API bindings and implements the extension loading interface.
/// </summary>
public abstract class BindingsBase
{
/// <summary>
/// Constructs a new BindingsBase instance.
/// </summary>
public BindingsBase()
{
}
/// <summary>
/// Marshals a pointer to a null-terminated byte array to a new <c>System.String</c>.
/// This method supports OpenTK and is not intended to be called by user code.
/// </summary>
/// <param name="ptr">A pointer to a null-terminated byte array.</param>
/// <returns>
/// A <c>System.String</c> with the data from <paramref name="ptr"/>.
/// </returns>
protected static string MarshalPtrToString(IntPtr ptr)
{
if (ptr == IntPtr.Zero)
{
throw new ArgumentException("ptr");
}
unsafe
{
sbyte* str = (sbyte*)ptr;
int len = 0;
while (*str != 0)
{
++len;
++str;
}
return new string((sbyte*)ptr, 0, len, Encoding.UTF8);
}
}
/// <summary>
/// Marshal a <c>System.String</c> to unmanaged memory.
/// The resulting string is encoded in UTF8 and must be freed
/// with <c>FreeStringPtr</c>.
/// </summary>
/// <param name="str">The <c>System.String</c> to marshal.</param>
/// <returns>
/// An unmanaged pointer containing the marshalled string.
/// This pointer must be freed with <c>FreeStringPtr</c>
/// </returns>
protected static IntPtr MarshalStringToPtr(string str)
{
if (string.IsNullOrEmpty(str))
{
return IntPtr.Zero;
}
// Allocate a buffer big enough to hold the marshalled string.
// GetMaxByteCount() appears to allocate space for the final NUL
// character, but allocate an extra one just in case (who knows
// what old Mono version would do here.)
int max_count = Encoding.UTF8.GetMaxByteCount(str.Length) + 1;
IntPtr ptr = Marshal.AllocHGlobal(max_count);
if (ptr == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
// Pin the managed string and convert it to UTF8 using
// the pointer overload of System.Encoding.UTF8.GetBytes().
unsafe
{
fixed (char* pstr = str)
{
int actual_count = Encoding.UTF8.GetBytes(pstr, str.Length, (byte*)ptr, max_count);
Marshal.WriteByte(ptr, actual_count, 0); // Append '\0' at the end of the string
return ptr;
}
}
}
/// <summary>
/// Frees a marshalled string that allocated by <c>MarshalStringToPtr</c>.
/// </summary>
/// <param name="ptr">An unmanaged pointer allocated with <c>MarshalStringToPtr</c></param>
protected static void FreeStringPtr(IntPtr ptr)
{
Marshal.FreeHGlobal(ptr);
}
/// <summary>
/// Marshals a <c>System.String</c> array to unmanaged memory by calling
/// Marshal.AllocHGlobal for each element.
/// </summary>
/// <returns>An unmanaged pointer to an array of null-terminated strings</returns>
/// <param name="str_array">The string array to marshal.</param>
protected static IntPtr MarshalStringArrayToPtr(string[] str_array)
{
IntPtr ptr = IntPtr.Zero;
if (str_array != null && str_array.Length != 0)
{
ptr = Marshal.AllocHGlobal(str_array.Length * IntPtr.Size);
if (ptr == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
int i = 0;
try
{
for (i = 0; i < str_array.Length; i++)
{
IntPtr str = MarshalStringToPtr(str_array[i]);
Marshal.WriteIntPtr(ptr, i * IntPtr.Size, str);
}
}
catch (OutOfMemoryException)
{
for (i = i - 1; i >= 0; --i)
{
Marshal.FreeHGlobal(Marshal.ReadIntPtr(ptr, i * IntPtr.Size));
}
Marshal.FreeHGlobal(ptr);
throw;
}
}
return ptr;
}
/// <summary>
/// Frees a marshalled string that allocated by <c>MarshalStringArrayToPtr</c>.
/// </summary>
/// <param name="ptr">An unmanaged pointer allocated with <c>MarshalStringArrayToPtr</c></param>
/// <param name="length">The length of the string array.</param>
protected static void FreeStringArrayPtr(IntPtr ptr, int length)
{
for (int i = 0; i < length; i++)
{
Marshal.FreeHGlobal(Marshal.ReadIntPtr(ptr, i * IntPtr.Size));
}
Marshal.FreeHGlobal(ptr);
}
private protected static void InitializeDummyEntryPoints(IntPtr[] entryPoints)
{
var ptr = Marshal.GetFunctionPointerForDelegate(UninitializedDelegate);
for (var i = 0; i < entryPoints.Length; i++)
{
entryPoints[i] = ptr;
}
}
private static readonly Action UninitializedDelegate = Uninitialized;
private static void Uninitialized()
{
throw new InvalidOperationException("You need to initialize the OpenGL binding first by calling LoadBindings() or creating a compatible OpenGL window.");
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// A delegate used to receive debug information.
/// </summary>
/// <param name="source">The source of the callback.</param>
/// <param name="type">The type of the callback.</param>
/// <param name="id">The ID of the callback.</param>
/// <param name="severity">The severity of the callback.</param>
/// <param name="length">The length of the callback message.</param>
/// <param name="message">A pointer to the callback message.</param>
/// <param name="userParam">A user supplied pointer that will be passed on each callback.</param>
public delegate void DebugProc(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam);
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic.GL
{
public struct CombinerPortionNV { }
public struct DebugProcAmd { }
public struct DebugProcArb { }
public struct DebugProcKhr { }
public struct ElementPointerTypeATI { }
public struct FragmentLightParameterSGIX { }
public struct IglooFunctionSelectSGIX { }
public struct IndexFunctionEXT { }
public struct MapTypeNV { }
public struct MatrixIndexPointerTypeARB { }
public struct ProgramFormat { }
public struct ProgramStringProperty { }
public struct ProgramTarget { }
public struct ReplacementCodeTypeSUN { }
public struct SecondaryColorPointerTypeIBM { }
public struct Struct_cl_context { }
public struct Struct_cl_event { }
public struct VertexShaderWriteMaskEXT { }
public struct VertexWeightPointerTypeEXT { }
public struct WeightPointerTypeARB { }
}
@@ -0,0 +1,33 @@
using System.Runtime.InteropServices;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// Contains the library name of OpenGL.
/// </summary>
internal class LibraryNameContainer
{
/// <inheritdoc />
public static string Linux => "libGL.so";
/// <inheritdoc />
public static string MacOS => "/System/Library/Frameworks/OpenGL.framework/OpenGL";
/// <inheritdoc />
public static string Android => "libGL.so";
/// <inheritdoc />
public static string IOS => "/System/Library/Frameworks/OpenGL.framework/OpenGL";
/// <inheritdoc />
public static string Windows => "opengl32.dll";
public static string GetLibraryNameForCurrentPlatform()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return Linux;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return Windows;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) return MacOS;
else return "unknown platform";
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,15 @@
namespace StgSharp.Graphic.Input
{
public enum HidConsumerUsage : ushort
{
/// <summary>
/// General consumer control device.
/// </summary>
ConsumerControl = 0x01,
/// <summary>
/// Set the horizontal offset of the display in the document.
/// </summary>
ACPan = 0x0238,
}
}
@@ -0,0 +1,258 @@
namespace StgSharp.Graphic.Input
{
public enum HidGenericDesktopUsage : ushort
{
/// <summary>
/// A collection of axes that generates a value to direct, indicate, or point
/// user intentions to an application.
/// </summary>
Pointer = 0x01,
/// <summary>
/// A hand-held, button-activated input device that when rolled along a flat surface,
/// directs an indicator to move correspondingly about a computer screen, allowing the
/// operator to move the indicator freely in select operations or to manipulate text or graphics.
/// </summary>
Mouse = 0x02,
// 0x03 // Reserved
/// <summary>
/// A manual control or cursor device.
/// </summary>
Joystick = 0x04,
/// <summary>
/// A manual control or cursor device.
/// </summary>
GamePad = 0x05,
/// <summary>
/// The primary computer input device.
/// </summary>
Keyboard = 0x06,
/// <summary>
/// Any keyboard configuration that does not meet the minimum requirements of the Boot Keyboard.
/// </summary>
Keypad = 0x07,
/// <summary>
/// An input device used to orient eyepoints and or objects in 3 dimensional space.
/// </summary>
MultiAxisController = 0x08,
// 0x09 - 0x2F // Reserved
/// <summary>
/// A linear translation in the X direction.
/// </summary>
X = 0x30,
/// <summary>
/// A linear translation in the Y direction.
/// </summary>
Y = 0x31,
/// <summary>
/// A linear translation in the Z direction.
/// </summary>
Z = 0x32,
/// <summary>
/// A rotation about the X axis. Angular position report values follow the righthand rule.
/// </summary>
RotationX = 0x33,
/// <summary>
/// A rotation about the Y axis. Angular position report values follow the righthand rule.
/// </summary>
RotationY = 0x34,
/// <summary>
/// A rotation about the Z axis. Angular position report values follow the righthand rule.
/// </summary>
RotationZ = 0x35,
/// <summary>
/// A linear control for generating a variable value, normally in the form of a thumb slide in a slot.
/// </summary>
Slider = 0x36,
/// <summary>
/// A rotary control for generating a variable value,
/// normally in the form of a knob spun by the index finger and thumb.
/// </summary>
Dial = 0x37,
/// <summary>
/// A rotary control for generating a variable value, normally rolled, unlike a dial.
/// </summary>
Wheel = 0x38,
/// <summary>
/// A specialized mechanical configuration of switches generating a variable value with a null state.
/// </summary>
Hatswitch = 0x39,
/// <summary>
/// Used with buffered –byte data to indicate the number of valid bytes in the buffered-byte field.
/// </summary>
CountedBuffer = 0x3A,
/// <summary>
/// Defines a report field that indicates the number of meaningful data bytes
/// in an associated buffered-byte field.
/// </summary>
ByteCount = 0x3B,
/// <summary>
/// Enables the generation of a USB remote wakeup when the device detects motion.
/// </summary>
MotionWakeup = 0x3C,
/// <summary>
/// Session start button.
/// </summary>
Start = 0x3D,
/// <summary>
/// Application option select button.
/// </summary>
Select = 0x3E,
// 0x3F // Reserved
/// <summary>
/// A vector in the X direction.
/// </summary>
VectorX = 0x40,
/// <summary>
/// A vector in the Y direction.
/// </summary>
VectorY = 0x41,
/// <summary>
/// A vector in the Z direction.
/// </summary>
VectorZ = 0x42,
/// <summary>
/// A vector in the X direction relative to the body of an object.
/// </summary>
VectorXBodyRelative = 0x43,
/// <summary>
/// A vector in the Y direction relative to the body of an object.
/// </summary>
VectorYBodyRelative = 0x44,
/// <summary>
/// A vector in the Z direction relative to the body of an object.
/// </summary>
VectorZBodyRelative = 0x45,
/// <summary>
/// A non oriented vector or value.
/// </summary>
VectorNonOriented = 0x46,
// 0x47 - 0x7F // Reserved
/// <summary>
/// An application-level collection that contains system-software-specific usages.
/// </summary>
SystemControl = 0x80,
/// <summary>
/// Asserted when the intended action is to initiate system-wide power down now from
/// Full Power or Sleep states.
/// </summary>
SystemPowerDown = 0x81,
/// <summary>
/// Asserted when the intended action is to initiate system-wide low power mode now.
/// </summary>
SystemSleep = 0x82,
/// <summary>
/// Asserted when the intended action is to initiate system-wide Full Power state now.
/// </summary>
SystemWakeUp = 0x83,
/// <summary>
/// Evokes a context-sensitive menu.
/// </summary>
SystemContextMenu = 0x84,
/// <summary>
/// Evokes the OS main-level selection menu.
/// </summary>
SystemMainMenu = 0x85,
/// <summary>
/// Displays an application-specific menu.
/// </summary>
SystemAppMenu = 0x86,
/// <summary>
/// Displays the help menu.
/// </summary>
SystemMenuHelp = 0x87,
/// <summary>
/// Exits a menu.
/// </summary>
SystemMenuExit = 0x88,
/// <summary>
/// Selects a menu item.
/// </summary>
SystemMenuSelect = 0x89,
/// <summary>
/// Menu select right.
/// </summary>
SystemMenuRight = 0x8A,
/// <summary>
/// Menu select left.
/// </summary>
SystemMenuLeft = 0x8B,
/// <summary>
/// Menu select up.
/// </summary>
SystemMenuUp = 0x8C,
/// <summary>
/// Menu select down.
/// </summary>
SystemMenuDown = 0x8D,
// 0x8E - 0x8F // Reserved
/// <summary>
/// Indicates that top of a Direction Pad is pressed.
/// </summary>
DPadUp = 0x90,
/// <summary>
/// Indicates that bottom of a Direction Pad is pressed
/// </summary>
DPadDown = 0x91,
/// <summary>
/// Indicates that right side of a Direction Pad is pressed
/// </summary>
DPadRight = 0x92,
/// <summary>
/// Indicates that left side of a Direction Pad is pressed
/// </summary>
DPadLeft = 0x93,
// 0x94 - 0xFFFF // Reserved
}
}
@@ -0,0 +1,57 @@
using System.Diagnostics;
namespace StgSharp.Graphic.Input
{
public static class HidHelper
{
/// <summary>
/// Translates a generic HID usage value to a specific joystick axis for the specified <see cref="HidPage"/>.
/// </summary>
/// <param name="page">The HID usage page.</param>
/// <param name="usage">The generic usage value.</param>
/// <returns>An <see cref="int"/> that maps the HID usage value to a joystick axis.</returns>
public static int TranslateJoystickAxis(HidPage page, int usage)
{
switch (page)
{
case HidPage.GenericDesktop:
switch ((HidGenericDesktopUsage)usage)
{
case HidGenericDesktopUsage.X:
return 0;
case HidGenericDesktopUsage.Y:
return 1;
case HidGenericDesktopUsage.Z:
return 2;
case HidGenericDesktopUsage.RotationZ:
return 3;
case HidGenericDesktopUsage.RotationX:
return 4;
case HidGenericDesktopUsage.RotationY:
return 5;
case HidGenericDesktopUsage.Slider:
return 6;
case HidGenericDesktopUsage.Dial:
return 7;
case HidGenericDesktopUsage.Wheel:
return 8;
}
break;
case HidPage.Simulation:
switch ((HidSimulationUsage)usage)
{
case HidSimulationUsage.Rudder:
return 9;
case HidSimulationUsage.Throttle:
return 10;
}
break;
}
Debug.Print($"[Input] Unknown axis with HID page/usage {page}/{usage}");
return 0;
}
}
}
+170
View File
@@ -0,0 +1,170 @@
namespace StgSharp.Graphic.Input
{
public enum HidPage : ushort
{
/// <summary>
/// This page describes an undefined usage.
/// </summary>
Undefined = 0x00,
/// <summary>
/// This page describes generic desktop controls.
/// </summary>
GenericDesktop = 0x01,
/// <summary>
/// This page provides detailed descriptions of the usages employed by simulation devices.
/// </summary>
Simulation = 0x02,
/// <summary>
/// Describes virtual reality controls. The usages depend on designators to identify the individual controls.
/// </summary>
VR = 0x03,
/// <summary>
/// This page describes sport controls.
/// </summary>
Sport = 0x04,
/// <summary>
/// This page describes game controls.
/// </summary>
Game = 0x05,
/// <summary>
/// This page provides usage definitions for controls that can be on any type of device.
/// </summary>
GenericDevice = 0x06,
/// <summary>
/// This page is for key codes to be used in implementing a USB keyboard.
/// </summary>
/// <remarks>
/// The usage type of all key codes is Selectors (Sel), except for the modifier keys 'Keyboard Left Control'
/// (0x224) to 'Keyboard Right GUI' (0x231) which are Dynamic Flags (DV).
/// </remarks>
KeyboardOrKeypad = 0x07,
/// <summary>
/// This page describes an LED or indicator that is implemented as an On/Off control (OOC)
/// using the "Single button toggle" mode,
/// where a value of 1 will turn on the indicator, and a value of 0 will turn it off.
/// </summary>
LEDs = 0x08,
/// <summary>
/// This page describes a set of buttons which can be defined as Sel, OOC, MC or OSC depending on
/// the context of their declaration.
/// </summary>
Button = 0x09,
/// <summary>
/// This page allows multiple instances of a control or sets of controls to be declared without
/// requiring indiviual enumeration in the native usage page.
/// </summary>
Ordinal = 0x0A,
/// <summary>
/// This page defines the keytop and control usages for telephony devices.
/// </summary>
/// <remarks>
/// Note that in many cases usage definitions are intentionally vague, since it is assumed that
/// the controls are interpreted by the telephone software application.
/// </remarks>
Telephony = 0x0B,
/// <summary>
/// This page describes application-specific controls.
/// They only affect a specific device, not the system as a whole.
/// </summary>
Consumer = 0x0C,
/// <summary>
/// This section provides detailed descriptions of the usages employed by Digitizer Devices.
/// </summary>
Digitizer = 0x0D,
// 0x0E // Reserved
/// <summary>
/// Describes force feedback and related devices.
/// </summary>
PID = 0x0F,
/// <summary>
/// The Unicode page directly maps to the two-octet form defined in the Unicode Standard.
/// </summary>
Unicode = 0x10,
// 0x11 - 0x13 // Reserved
/// <summary>
/// The Alphanumeric display page is intended for use by simple alphanumeric
/// displays that are used on consumer devices.
/// </summary>
AlphanumericDisplay = 0x14,
// 0x15 - 0x3F // Reserved
/// <summary>
/// This page provides usage definitions for medical instruments.
/// </summary>
MedicalInstruments = 0x40,
// 0x41 - 0x7F
// 0x80 - 0x83 // USB Device Class Definition for Monitor Devices
/// <summary>
/// Power device page.
/// </summary>
PowerDevice = 0x84,
/// <summary>
/// Battery system page.
/// </summary>
BatterySystem = 0x85,
// 0x86 - 0x87 // USB Device Class Definition for Power Devices (also includes 0x84 and 0x85)
// 0x88 - 0x8B // Reserved
/// <summary>
/// This page describes the USB Device Class definition for a bar code scanner ("Point of Sale" device).
/// </summary>
BarCodeScanner = 0x8C,
/// <summary>
/// This page describes the USB Device Class definition for a scale ("Point of Sale" device).
/// </summary>
Scale = 0x8D,
/// <summary>
/// This page describes the USB Device Class definition for a magnetic stripe reading device
/// ("Point of Sale" device).
/// </summary>
MagneticStripeReader = 0x8E,
// 0x8F // Reserved Point of Sale pages
/// <summary>
/// This page describes the USB Device Class definition for "Image Class Devices".
/// </summary>
CameraControl = 0x90,
/// <summary>
/// This page describes the OAAF definitions for arcade and coinop related devices.
/// </summary>
Arcade = 0x91,
// 0x92 - 0xFEFF // Reserved
/// <summary>
/// Marks the beginning of vendor-defined usage pages.
/// </summary>
VendorDefinedStart = 0xFF00,
// 0xFF00 - 0xFFFF // Vendor-defined
}
}
@@ -0,0 +1,288 @@
using StgSharp.Graphic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic.Input
{
public enum HidSimulationUsage : ushort
{
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found on an airplane.
/// </summary>
FlightSimulationDevice = 0x01,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found in an automobile or truck.
/// </summary>
AutomobileSimulationDevice = 0x02,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found in a tank or a treaded vehicle.
/// </summary>
TankSimulationDevice = 0x03,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a spaceship.
/// </summary>
SpaceshipSimulationDevice = 0x04,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a submarine.
/// </summary>
SubmarineSimulationDevice = 0x05,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a sailboat.
/// </summary>
SailingSimulationDevice = 0x06,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a motorcycle.
/// </summary>
MotorcycleSimulationDevice = 0x07,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a sports simulation device.
/// </summary>
SportsSimulationDevice = 0x08,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on an airplane.
/// </summary>
AirplaneSimulationDevice = 0x09,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a helicopter.
/// </summary>
HelicopterSimulationDevice = 0x0A,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard control of a magic carpet.
/// </summary>
MagicCarpetSimulationDevice = 0x0B,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a bicycle.
/// </summary>
BicycleSimulationDevice = 0x0C,
// 0x0D - 0x1F // Reserved
/// <summary>
/// A Flight Control Stick controls the Pitch and Roll of an airplane.
/// </summary>
FlightControlStick = 0x20,
/// <summary>
/// A Flight Stick defines a class of device commonly used for flight simulator games.
/// </summary>
FlightStick = 0x21,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// A cyclic control is a stick between the pilot’s legs that moves in two axes.
/// </summary>
CyclicControl = 0x22,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// Cyclic Trim allows fine adjustment of the cyclic position in two dimensions.
/// </summary>
CyclicTrim = 0x23,
/// <summary>
/// A flight yoke (also called a control wheel) controls the pitch and roll of an airplane.
/// </summary>
FlightYoke = 0x24,
/// <summary>
/// A device for controlling the direction and velocity of a vehicle that is driven by tracks.
/// </summary>
TrackControl = 0x25,
// 0x26 - 0xAF // Reserved
/// <summary>
/// An aileron is one of two movable flaps on the wings of an airplane that can be used
/// to control the plane’s rolling and banking movements.
/// </summary>
Aileron = 0xB0,
/// <summary>
/// Allows fine adjustment of the Aileron position.
/// </summary>
AileronTrim = 0xB1,
/// <summary>
/// This control mechanically behaves the same as rudder pedals.
/// </summary>
AntiTorqueControl = 0xB2,
/// <summary>
/// This control enables or disables an airplane’s autopilot.
/// </summary>
AutopilotEnable = 0xB3,
/// <summary>
/// Chaff is used to reflect electromagnetic energy as a radar countermeasure.
/// </summary>
ChaffRelease = 0xB4,
/// <summary>
/// This control is specifically for a helicopter.
/// It controls the vertical acceleration or lift of the helicopter.
/// </summary>
CollectiveControl = 0xB5,
/// <summary>
/// A flap that can be extended on an aircraft to increase drag and reduce the speed of descent.
/// </summary>
DiveBrake = 0xB6,
/// <summary>
/// A pushbutton that enables electronic countermeasures.
/// </summary>
ElectronicCountermeasures = 0xB7,
/// <summary>
/// A movable control surface, usually attached to the horizontal stabilizer of an aircraft,
/// that is used to produce motion up or down.
/// </summary>
Elevator = 0xB8,
/// <summary>
/// Elevator Trim allows fine adjustment of the Elevator position.
/// </summary>
ElevatorTrim = 0xB9,
/// <summary>
/// The zero position is centered, positive values turn right, and negative values turn left.
/// </summary>
Rudder = 0xBA,
/// <summary>
/// A valve that regulates the flow of a fluid, such as the valve in an internal-combustion engine
/// that controls the amount of vaporized fuel entering the cylinders.
/// </summary>
Throttle = 0xBB,
/// <summary>
/// Typically this is a two-position pushbutton where the first position enables communications with the
/// crew and the second position enables the transmitter for communication external to the plane.
/// </summary>
FlightCommunications = 0xBC,
/// <summary>
/// A flare is a device that produces a bright light for signaling, illumination, identification,
/// or heat for infrared missile countermeasures.
/// </summary>
FlareRelease = 0xBD,
/// <summary>
/// A control for raising or lowering an airplane’s landing gear.
/// </summary>
LandingGear = 0xBE,
/// <summary>
/// A device for slowing or stopping the motion of an airplane when it is on the ground.
/// </summary>
ToeBrake = 0xBF,
/// <summary>
/// A lever pressed by the finger to release or activate a mechanism, typically used to discharge a firearm.
/// </summary>
Trigger = 0xC0,
/// <summary>
/// This device is normally a covered toggle switch that must be selected to enable the weapons system.
/// </summary>
WeaponsArm = 0xC1,
/// <summary>
/// This device can either be a pushbutton that steps through the available weapons or
/// a radio button that selects them individually.
/// </summary>
WeaponsSelect = 0xC2,
/// <summary>
/// Wing flap controls are usually powered either hydraulically or by electric motors,
/// and are used for low-speed control of an airplane.
/// </summary>
WingFlaps = 0xC3,
/// <summary>
/// A device, especially the gas pedal of a motor vehicle, for increasing speed.
/// </summary>
Accelerator = 0xC4,
/// <summary>
/// A device for slowing or stopping motion, as of a vehicle, especially by contact friction.
/// </summary>
Brake = 0xC5,
/// <summary>
/// A device for disengaging the transmission of a vehicle to allow shifting of gears.
/// </summary>
Clutch = 0xC6,
/// <summary>
/// A device for shifting gears in a vehicle.
/// </summary>
Shifter = 0xC7,
/// <summary>
/// A steering wheel is a single degree-of-freedom device that rotates about an axis.
/// </summary>
Steering = 0xC8,
/// <summary>
/// This control determines the right-to-left positioning of the tank turret.
/// </summary>
TurretDirection = 0xC9,
/// <summary>
/// This control determines the elevation of the gun barrel in a turret.
/// </summary>
BarrelElevation = 0xCA,
/// <summary>
/// Dive planes control the vertical ascent or descent of the submarine under power.
/// </summary>
DivePlane = 0xCB,
/// <summary>
/// Ballast controls the vertical ascent or descent of the submarine.
/// </summary>
Ballast = 0xCC,
/// <summary>
/// A foot-operated assembly of pedals attached to a crank that is used for powering a bicycle.
/// </summary>
BicycleCrank = 0xCD,
/// <summary>
/// A steering control, held in both hands, for a motorcycle or bicycle.
/// </summary>
HandleBars = 0xCE,
/// <summary>
/// Engages the front brake of the motorcycle to slow the vehicle.
/// </summary>
FrontBrake = 0xCF,
/// <summary>
/// Engages the rear brake of the motorcycle to slow the vehicle.
/// </summary>
RearBrake = 0xD0,
// 0xD1 - 0xFFFF // Reserved
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics
{
public struct GLclampd
{
private double value;
public void SetValue(double v)
{
if (v<0||v>1)
{
throw new ArgumentOutOfRangeException("Input is out of range");
}
else
{
value = v;
}
}
public double Value()
{
return this.value;
}
public static implicit operator double(GLclampd gLclampd)
{
return gLclampd.value;
}
}
}
@@ -0,0 +1,31 @@
using System;
namespace StgSharp.Graphics
{
public struct GLclampf
{
private float value;
public void Value(float v)
{
if (v<0||v>1)
{
throw new ArgumentOutOfRangeException("Input is out of range!");
}
else
{
value = v;
}
}
public float Value()
{
return value;
}
public static implicit operator float(GLclampf gLclampf)
{
return gLclampf.value;
}
}
}
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic
namespace StgSharp.Graphics
{
internal class Class1
public enum GLenum:uint
{
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x2Int:IEquatable<matrix2x2>
{
[FieldOffset(0)]
public vec2dInt row1;
[FieldOffset(8)]
public vec2dInt row2;
public matrix2x2Int(vec2d c0, vec2d c1)
{
row1 = c0;
row2 = c1;
}
public matrix2x2Int(
int a11,
int a12,
int a21,
int a22
)
{
row1 = new vec2dInt(a11, a12);
row2 = new vec2dInt(a21, a22);
}
bool IEquatable<matrix2x2>.Equals(matrix2x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x2))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1,row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
public static matrix2x2Int operator +(matrix2x2Int matrix1 , matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x2Int operator -(matrix2x2Int matrix1, matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x3Int:IEquatable<matrix2x3Int>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public matrix2x3Int(vec3d r1, vec3d r2)
{
row1 = r1;
row2 = r2;
}
public matrix2x3Int(
int r11, int r12, int r13,
int r21, int r22, int r23
)
{
row1 = new vec3d(r11, r12, r13);
row2 = new vec3d(r21, r22, r23);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x3Int))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
bool IEquatable<matrix2x3Int>.Equals(matrix2x3Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public static matrix2x3Int operator +(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x3Int operator -(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
public static matrix2x3Int operator *(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 * x,
array.row2 * x
) ;
}
public static matrix2x3Int operator /(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 / x,
array.row2 / x
);
}
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x2Int:IEquatable<matrix3x2Int>
{
[FieldOffset(0)]
public vec2d row1;
[FieldOffset(8)]
public vec2d row2;
[FieldOffset(16)]
public vec2d row3;
public matrix3x2Int(vec2d r1,vec2d r2,vec2d r3)
{
row1= r1;
row2= r2;
row3= r3;
}
public matrix3x2Int(
int a11, int a12,
int a21, int a22,
int a31, int a32
)
{
row1 = new vec2d(a11, a12);
row2 = new vec2d(a21, a22);
row3 = new vec2d(a31, a32);
}
bool IEquatable<matrix3x2Int>.Equals(matrix3x2Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x2Int))
{
return false;
}
else
{
return this.Equals((matrix3x2Int)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3);
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}";
}
public static matrix3x2Int operator +(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3
);
}
public static matrix3x2Int operator -(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3
);
}
}
}
@@ -0,0 +1,44 @@
using Steamworks;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size = 8)]
public unsafe struct vec2dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
public vec2dInt(int x, int y)
{
this.X = x;
this.Y = y;
}
public static implicit operator vec2d(vec2dInt vec)
{
return new vec2d(vec.X,vec.Y);
}
public static implicit operator vec2dInt(vec2d vec)
{
return new vec2dInt((int)vec.X, (int)vec.Y);
}
public static vec2dInt operator +(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X + vec2.X, vec1.Y + vec2.Y);
}
public static vec2dInt operator -(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X - vec2.X, vec1.Y - vec2.Y);
}
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =12)]
public struct vec3dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =16)]
public struct vec4dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
[FieldOffset(12)]
public int W;
}
}
@@ -7,6 +7,19 @@ namespace StgSharp.Math
{
public static unsafe partial class VectorCalc
{
private static float getMatrixMember(float* p1, float* p2)
{
float result = 0;
for (int i = 0; i < 4; i++)
{
result += *p1 * *p2;
p1 += 1;
p2 += 3;
}
return result;
}
/// <summary>
///
/// </summary>
@@ -439,18 +452,7 @@ namespace StgSharp.Math
getMatrixMember(p1+4, p2), getMatrixMember(p1+4, p2+1), getMatrixMember(p1+4, p2 + 2)
);
static float getMatrixMember(float* p1, float* p2)
{
float result = 0;
for (int i = 0; i < 4; i++)
{
result += *p1 * *p2;
p1 += 1;
p2 += 3;
}
return result;
}
}
/// <summary>
+105
View File
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x4 : IEquatable<matrix2x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
public matrix2x4( vec4d r1, vec4d r2)
{
row1 = r1;
row2 = r2;
}
public matrix2x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
}
public bool Equals(matrix2x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x4))
{
return false;
}
else
{
return this.Equals((matrix2x4)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(this.row1, this.row2);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}";
}
public static matrix2x4 operator +(matrix2x4 matrix1 ,matrix2x4 matrix2)
{
return new matrix2x4(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
) ;
}
public static matrix2x4 operator -(matrix2x4 matrix1, matrix2x4 matrix2)
{
return new matrix2x4(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
public static matrix2x4 operator *(matrix2x4 array, float x)
{
return new matrix2x4(
array.row1 * x,
array.row2 * x
);
}
public static matrix2x4 operator /(matrix2x4 array, float x)
{
return new matrix2x4(
array.row1 / x,
array.row2 / x
);
}
}
}
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x3:IEquatable<matrix3x3>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
[FieldOffset(24)]
public vec3d row3;
public matrix3x3(vec3d r0,vec3d r1,vec3d r2)
{
row1 = r0;
row2 = r1;
row3 = r2;
}
public matrix3x3(
float a11,float a12,float a13,
float a21,float a22,float a23,
float a31,float a32,float a33
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
}
public override int GetHashCode()
{
return HashCode.Combine(row1,row2,row3);
}
bool IEquatable<matrix3x3>.Equals(matrix3x3 other)
{
if (this.GetHashCode()!=other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x3))
{
return false;
}
else
{
return this.Equals((matrix3x3)obj);
}
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}";
}
public static bool operator ==(matrix3x3 matrix1, matrix3x3 matrix2)
{
return matrix1.Equals(matrix2);
}
public static bool operator !=(matrix3x3 matrix1, matrix3x3 matrix2)
{
return !matrix1.Equals(matrix2);
}
public static matrix3x3 operator +(matrix3x3 matrix1, matrix3x3 matrix2)
{
return new matrix3x3(
matrix1.row1.X + matrix2.row1.X,
matrix1.row1.Y + matrix2.row1.Y,
matrix1.row1.Z + matrix2.row1.Z,
matrix1.row2.X + matrix2.row2.X,
matrix1.row2.Y + matrix2.row2.Y,
matrix1.row2.Z + matrix2.row2.Z,
matrix1.row3.X + matrix2.row3.X,
matrix1.row3.Y + matrix2.row3.Y,
matrix1.row3.Z + matrix2.row3.Z
);
}
public static matrix3x3 operator -(matrix3x3 matrix1, matrix3x3 matrix2)
{
return new matrix3x3(
matrix1.row1.X - matrix2.row1.X,
matrix1.row1.Y - matrix2.row1.Y,
matrix1.row1.Z - matrix2.row1.Z,
matrix1.row2.X - matrix2.row2.X,
matrix1.row2.Y - matrix2.row2.Y,
matrix1.row2.Z - matrix2.row2.Z,
matrix1.row3.X - matrix2.row3.X,
matrix1.row3.Y - matrix2.row3.Y,
matrix1.row3.Z - matrix2.row3.Z
);
}
public static matrix3x3 operator *(matrix3x3 array, float x)
{
return new matrix3x3(
array.row1 * x,
array.row2 * x,
array.row3 * x
);
}
public static matrix3x3 operator /(matrix3x3 array, float x)
{
return new matrix3x3(
array.row1/x,
array.row2/x,
array.row3/x
);
}
}
}
@@ -0,0 +1,83 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x4:IEquatable<matrix3x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
[FieldOffset(32)]
public vec4d row3;
public matrix3x4(
vec4d r1,vec4d r2,vec4d r3
)
{
this.row1 = r1;
this.row2 = r2;
this.row3 = r3;
}
public matrix3x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34
)
{
row1 = new vec4d(a11,a12,a13,a14);
row2 = new vec4d(a21,a22,a23,a24);
row3 = new vec4d(a31,a32,a33,a34);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x4))
{
return false;
}
else
{
return this.Equals((matrix3x4)obj);
}
}
bool IEquatable<matrix3x4>.Equals(matrix3x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3;
}
}
public override int GetHashCode()
{
return HashCode.Combine(this.row1,this.row2,this.row3);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}\n{this.row3}";
}
}
}
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x2:IEquatable<matrix4x2>
{
[FieldOffset(0)]
public vec2d row1;
[FieldOffset(8)]
public vec2d row2;
[FieldOffset(16)]
public vec2d row3;
[FieldOffset(24)]
public vec2d row4;
public matrix4x2(vec2d r1, vec2d r2, vec2d r3, vec2d r4)
{
row1 = r1;
row2 = r2;
row3 = r3;
row4 = r4;
}
public matrix4x2(
float a11, float a12,
float a21, float a22,
float a31, float a32,
float a41, float a42
)
{
row1 = new vec2d(a11, a12);
row2 = new vec2d(a21, a22);
row3 = new vec2d(a31, a32);
row4 = new vec2d(a41, a42);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() == typeof(matrix4x2))
{
return false;
}
else
{
return this.Equals((matrix4x2)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3, row4);
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}\n{row4}";
}
bool IEquatable<matrix4x2>.Equals(matrix4x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
}
}
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x3:IEquatable<matrix4x3>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
[FieldOffset(24)]
public vec3d row3;
[FieldOffset(36)]
public vec3d row4;
public matrix4x3(
float a11, float a12, float a13,
float a21, float a22, float a23,
float a31, float a32, float a33,
float a41, float a42, float a43
)
{
row1 = new vec3d(a11, a12, a13);
row2 = new vec3d(a21, a22, a23);
row3 = new vec3d(a31, a32, a33);
row4 = new vec3d(a41, a42, a43);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix4x3))
{
return false;
}
else
{
return this.Equals((matrix4x3)obj);
}
}
bool IEquatable<matrix4x3>.Equals(matrix4x3 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return base.ToString();
}
}
}
+107
View File
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix4x4:IEquatable<matrix4x4>
{
[FieldOffset(0)]
public vec4d row1;
[FieldOffset(16)]
public vec4d row2;
[FieldOffset(32)]
public vec4d row3;
[FieldOffset(48)]
public vec4d row4;
public matrix4x4( vec4d r1,vec4d r2,vec4d r3,vec4d r4)
{
row1 = r1;
row2 = r2;
row3 = r3;
row4 = r4;
}
public matrix4x4(
float a11, float a12, float a13, float a14,
float a21, float a22, float a23, float a24,
float a31, float a32, float a33, float a34,
float a41, float a42, float a43, float a44
)
{
row1 = new vec4d(a11, a12, a13, a14);
row2 = new vec4d(a21, a22, a23, a24);
row3 = new vec4d(a31, a32, a33, a34);
row4 = new vec4d(a41, a42, a43, a44);
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
bool IEquatable<matrix4x4>.Equals(matrix4x4 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
&& this.row4 == other.row4;
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3, row4);
}
public override string ToString()
{
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
}
public static matrix4x4 operator +(matrix4x4 matrix1, matrix4x4 matrix2)
{
return new matrix4x4(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3,
matrix1.row4 + matrix2.row4
);
}
public static matrix4x4 operator -(matrix4x4 matrix1, matrix4x4 matrix2)
{
return new matrix4x4(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3,
matrix1.row4 - matrix2.row4
);
}
public static matrix4x4 operator *(matrix4x4 array, float x)
{
return new matrix4x4(
array.row1 * x,
array.row2 * x,
array.row3 * x,
array.row4 * x
);
}
}
}
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using System.Numerics;
using System.Globalization;
namespace StgSharp.Math
{
@@ -23,6 +24,20 @@ namespace StgSharp.Math
return *(int*)a;
}
internal static string GetListSeparator(IFormatProvider formatProvider)
{
if (formatProvider is CultureInfo cultureInfo)
{
return cultureInfo.TextInfo.ListSeparator;
}
if (formatProvider?.GetFormat(typeof(TextInfo)) is TextInfo textInfo)
{
return textInfo.ListSeparator;
}
return CultureInfo.CurrentCulture.TextInfo.ListSeparator;
}
}
}
+27
View File
@@ -0,0 +1,27 @@
using StgSharp.Optimization;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
public unsafe delegate float ScalarCalcHandler(float* x);
public static unsafe partial class Calc
{
[DllImport("Kernel32.dll", EntryPoint = "VirtualAlloc")]
private static extern IntPtr VirtualAlloc(IntPtr address, int size, uint allocType, uint protect);
[DllImport("Kernel32.dll", EntryPoint = "VirtualFree")]
private static extern bool VirtualFree(IntPtr address, int size, uint freeType);
const uint MEM_COMMIT = 0x1000;
const uint MEM_RESERVE = 0x2000;
const uint PAGE_EXECUTE_READWRITE = 0x40;
const uint MEM_RELEASE = 0x8000;
static Calc()
{
}
}
}
@@ -1,9 +1,13 @@
using System;
using StgSharp.Optimization;
using System;
using System.Runtime.InteropServices;
namespace StgSharp.Math
{
public static partial class Calc
{
private static m128 sqrtCache;
public static unsafe float Sqrt(float x)
{
/*
@@ -67,10 +71,18 @@ namespace StgSharp.Math
float result = *(float*)&e;
result = (result + x / result) / 2;
return (result + x / result) / 2;
/**/
/*
fixed (m128* p = &sqrtCache)
{
sqrtCache.float0 = x;
return (SSE.Sqrtss(p)).float0;
}
*/
}
[DllImport("xmmintrin.h",EntryPoint = "_mm_sqrt_ss")]
public static extern m128 Sqrtss(m128 a);
}
}
+28 -87
View File
@@ -1,112 +1,53 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using static StgSharp.Optimization.CpuInfo;
namespace StgSharp.Optimization
{
public static unsafe partial class SSE
{
public static m128 sqrtssM128Cache = new m128();
public static m128* sqrtssM128CachePointer;
private static IntPtr sqrtssCodePointer;
private static sqrtssDelegate sqrtssDele;
private static byte[] sqrtssCodeBytes
= new byte[]
{
0x48,0xb8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // mov rax, [pointer location]
0x48,0x8b,0x00, // mov rax, [rax]
0xf3,0x0f,0x6f,0x00, // movqdu xmm0,xmmword ptr [rax]
0xf3,0x0f,0x51,0xc0, // sqrtss xmm0,xmm0
0xf3,0x0f,0x7f,0x00 // movdqu xmmword ptr [rax],xmm0
internal static readonly byte[] SqrtssCodeBytes = new byte[] {
0x48, 0x89, 0xc8, //mov rax,rcx
0xf3, 0x0f, 0x6f, 0x00, //movdqu xmm0,xmmword ptr [rax]
//0x66, 0x0f, 0x6f, 0x00, //movdqa xmm0,xmmword ptr [rax]
0xf3,0x0f, 0x51, 0xc0, //sqrtss xmm0,xmm0
0xf3, 0x0f, 0x7f, 0x00, //movdqu xmmqord ptr [rax],xmm0
//0x66, 0x0f, 0x7f, 0x00, //movdqa xmmword ptr [rax],xmm0
0xc3, //ret
};
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr VirtualAlloc(
IntPtr lpAddress,
UIntPtr dwSize,
AllocationType flAllocationType,
MemoryProtection flProtect
);
[DllImport("kernel32")]
private static extern bool VirtualFree(
IntPtr lpAddress,
UInt32 dwSize,
UInt32 dwFreeType
);
static asmfuncDelegate sqrtssDelegate;
[Flags()]
protected enum AllocationType : uint
{
COMMIT = 0x1000,
RESERVE = 0x2000,
RESET = 0x80000,
LARGE_PAGES = 0x20000000,
PHYSICAL = 0x400000,
TOP_DOWN = 0x100000,
WRITE_WATCH = 0x200000
}
[Flags()]
protected enum MemoryProtection : uint
{
EXECUTE = 0x10,
EXECUTE_READ = 0x20,
EXECUTE_READWRITE = 0x40,
EXECUTE_WRITECOPY = 0x80,
NOACCESS = 0x01,
READONLY = 0x02,
READWRITE = 0x04,
WRITECOPY = 0x08,
GUARD_Modifierflag = 0x100,
NOCACHE_Modifierflag = 0x200,
WRITECOMBINE_Modifierflag = 0x400
}
private unsafe static void InitSqrtss()
{
byte[] sqrtssM128PointerBytes = BitConverter.GetBytes((ulong)sqrtssM128CachePointer);
for (int i = 0; i < sqrtssM128PointerBytes.Length; i++)
{
sqrtssCodeBytes[2+i] = sqrtssCodeBytes[7-i];
}
if (IntPtr.Size!=8)
{
throw new Exception("This SSE class support 64bits OS only presently!");
}
sqrtssCodePointer = VirtualAlloc(
private static IntPtr sqrtssHandle = VirtualAlloc(
IntPtr.Zero,
new UIntPtr((uint)sqrtssCodeBytes.Length),
AllocationType.COMMIT | AllocationType.RESERVE,
MemoryProtection.EXECUTE_READWRITE
);
SqrtssCodeBytes.Length,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
Marshal.Copy(sqrtssCodeBytes, 0, sqrtssCodePointer, sqrtssCodeBytes.Length);
sqrtssDele = (sqrtssDelegate)Marshal.GetDelegateForFunctionPointer(sqrtssCodePointer,typeof(sqrtssDelegate));
private static void InitSqrtss()
{
Marshal.Copy(SqrtssCodeBytes,0,sqrtssHandle,SqrtssCodeBytes.Length);
sqrtssDelegate = Marshal.GetDelegateForFunctionPointer(sqrtssHandle,typeof(asmfuncDelegate)) as asmfuncDelegate;
}
public static float Sqrtss(float a)
public unsafe static m128 Sqrtss(m128* m)
{
fixed (m128* p = &sqrtssM128Cache)
{
sqrtssM128Cache.float0 = a;
sqrtssDele(sqrtssM128Cache);
return sqrtssM128Cache.float0;
}
sqrtssDelegate((ulong)m);
return *m;
}
}
[UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)]
internal delegate void sqrtssDelegate(m128 a);
/// <summary>
/// A delegate for asm sse functions
/// </summary>
/// <param name="m128Pointrter">The m128* pointer to the target m128 transformed in ulong form</param>
[UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
internal delegate void asmfuncDelegate(ulong m128Pointrter);
}
+11 -3
View File
@@ -1,18 +1,26 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Optimization
{
public static unsafe partial class SSE
{
[DllImport("Kernel32.dll", EntryPoint = "VirtualAlloc")]
private static extern IntPtr VirtualAlloc(IntPtr address, int size, uint allocType, uint protect);
[DllImport("Kernel32.dll", EntryPoint = "VirtualFree")]
private static extern bool VirtualFree(IntPtr address, int size, uint freeType);
const uint MEM_COMMIT = 0x1000;
const uint MEM_RESERVE = 0x2000;
const uint PAGE_EXECUTE_READWRITE = 0x40;
const uint MEM_RELEASE = 0x8000;
static SSE()
{
//编译模拟Sqrtss指令
var sqrtssCachePointer = stackalloc ulong[1];
InitSqrtss();
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Text;
namespace StgSharp.Optimization
{
[StructLayout(LayoutKind.Explicit,Size =16)]
[StructLayout(LayoutKind.Explicit,Size =16,Pack =16)]
public struct m128
{
[FieldOffset(0)] public float float0;
+22 -4
View File
@@ -5,19 +5,37 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Platforms>AnyCPU;x64</Platforms>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseExpression> MIT</PackageLicenseExpression>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Steamworks.NET" Version="20.1.0" />
<Compile Remove="Graphic\**" />
<Compile Remove="Math\Graphic\**" />
<EmbeddedResource Remove="Graphic\**" />
<EmbeddedResource Remove="Math\Graphic\**" />
<None Remove="Graphic\**" />
<None Remove="Math\Graphic\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="Graphic\" />
<PackageReference Include="Facepunch.Steamworks" Version="2.3.3" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Geometries\SpaceGeometry\" />
</ItemGroup>
</Project>
@@ -0,0 +1,111 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"StgSharp/1.0.0": {
"dependencies": {
"Facepunch.Steamworks": "2.3.3",
"Microsoft.Bcl.HashCode": "1.1.1",
"Microsoft.CSharp": "4.7.0",
"NETStandard.Library": "2.0.3",
"OpenTK": "3.3.3"
},
"runtime": {
"StgSharp.dll": {}
}
},
"Facepunch.Steamworks/2.3.3": {
"runtime": {
"lib/netstandard2.0/Facepunch.Steamworks.Win64.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Microsoft.Bcl.HashCode/1.1.1": {
"runtime": {
"lib/netstandard2.0/Microsoft.Bcl.HashCode.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "4.700.20.56604"
}
}
},
"Microsoft.CSharp/4.7.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.CSharp.dll": {
"assemblyVersion": "4.0.5.0",
"fileVersion": "4.700.19.56404"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"OpenTK/3.3.3": {
"runtime": {
"lib/net20/OpenTK.dll": {
"assemblyVersion": "3.3.3.0",
"fileVersion": "3.3.3.0"
}
}
}
}
},
"libraries": {
"StgSharp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Facepunch.Steamworks/2.3.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7nUjWX/uy6JbDX7Q3n8ij7vrpWjTM0S8hXO24R3ZwQ0QgY0sXVlxzh3unmYoLvKGi31rzDHqGX68I169hnHNxQ==",
"path": "facepunch.steamworks/2.3.3",
"hashPath": "facepunch.steamworks.2.3.3.nupkg.sha512"
},
"Microsoft.Bcl.HashCode/1.1.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-MalY0Y/uM/LjXtHfX/26l2VtN4LDNZ2OE3aumNOHDLsT4fNYy2hiHXI4CXCqKpNUNm7iJ2brrc4J89UdaL56FA==",
"path": "microsoft.bcl.hashcode/1.1.1",
"hashPath": "microsoft.bcl.hashcode.1.1.1.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
"OpenTK/3.3.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-KtnygHEuYj4+agNsZRtzh5iSiKlelDZvDB/OhfebEvIDX/97Pzygv8n5llZHgrI7Xa29vvkucVBeN55R6/k+4w==",
"path": "opentk/3.3.3",
"hashPath": "opentk.3.3.3.nupkg.sha512"
}
}
}
@@ -0,0 +1,322 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>StgSharp</name>
</assembly>
<members>
<member name="P:StgSharp.IEntity.CollisionSensor">
<summary>
A sensor used for cheking out if a bullet hit a player or something else
</summary>
</member>
<member name="P:StgSharp.IEntity.Location">
<summary>
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
</summary>
</member>
<member name="P:StgSharp.IEntity.X">
<summary>
X position of an enenmy entity
</summary>
</member>
<member name="P:StgSharp.IEntity.Y">
<summary>
Y position of an enemy entity
</summary>
</member>
<member name="T:StgSharp.Geometries.UnusedVertexException">
<summary>
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
</summary>
</member>
<member name="T:StgSharp.Geometries.GetLocationHandler">
<summary>
计算位移失量,需要手动输入游戏刻以提供时间数据
</summary>
<param name="tickCounter"></param>
<returns>表示位移量的三维矢量</returns>
</member>
<member name="T:StgSharp.Geometries.IPlainGeometry">
<summary>
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
</summary>
</member>
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
<summary>
移动平行四边形的第三个顶点,是一个多余的方法,调用会引发多余变量异常
</summary>
<param name="tick">当前游戏刻</param>
<returns></returns>
<exception cref="T:StgSharp.Geometries.UnusedVertexException">几何体过定义</exception>
</member>
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
<summary>
刷新点的位置,即移动点。当该点是某个几何体的从动点时
(即点坐标由几何体其他点约束或点参数已经在创建几何体时定义)
请不要再次进行定义,程序将自行忽略此处的代码。
</summary>
<param name="tick">当前游戏刻</param>
</member>
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
<summary>
计算中心点相对于参考原点的位移
</summary>
<param name="tick">当前游戏刻</param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
<summary>
</summary>
<param name="colum"></param>
<param name="vec"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.vec2d)">
<summary>
</summary>
<param name="vec1"></param>
<param name="vec2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.colum2)">
<summary>
</summary>
<param name="vec"></param>
<param name="colum"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.colum2)">
<summary>
</summary>
<param name="matrix"></param>
<param name="colum"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.colum3)">
<summary>
</summary>
<param name="matrix"></param>
<param name="vec"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x3,StgSharp.Math.matrix3x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x3,StgSharp.Math.matrix3x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix4x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix4x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
<summary>
Reurns the value of ArcSin(x)
</summary>
<param name="x">The sine value of the angle</param>
<returns></returns>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
<summary>
Get the value of E ^ x;
</summary>
<param name="x"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
<summary>
</summary>
<param name="x"></param>
<returns>
Returns the value of ln(x).
</returns>
</member>
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
<summary>
calculate the value of x^y
</summary>
<param name="x"></param>
<param name="y"></param>
<returns>Returns the value of x^y</returns>
</member>
<member name="T:StgSharp.Optimization.asmfuncDelegate">
<summary>
A delegate for asm sse functions
</summary>
<param name="m128Pointrter">The m128* pointer to the target m128 transformed in ulong form</param>
</member>
</members>
</doc>
@@ -0,0 +1,74 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.1/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"StgSharp/1.0.0": {
"dependencies": {
"Facepunch.Steamworks": "2.3.3",
"Microsoft.Bcl.HashCode": "1.1.1",
"Microsoft.CSharp": "4.7.0"
},
"runtime": {
"StgSharp.dll": {}
}
},
"Facepunch.Steamworks/2.3.3": {
"runtime": {
"lib/netstandard2.0/Facepunch.Steamworks.Win64.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Microsoft.Bcl.HashCode/1.1.1": {
"runtime": {
"lib/netstandard2.1/Microsoft.Bcl.HashCode.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "4.700.20.56604"
}
}
},
"Microsoft.CSharp/4.7.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.CSharp.dll": {
"assemblyVersion": "4.0.5.0",
"fileVersion": "4.700.19.56404"
}
}
}
}
},
"libraries": {
"StgSharp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Facepunch.Steamworks/2.3.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7nUjWX/uy6JbDX7Q3n8ij7vrpWjTM0S8hXO24R3ZwQ0QgY0sXVlxzh3unmYoLvKGi31rzDHqGX68I169hnHNxQ==",
"path": "facepunch.steamworks/2.3.3",
"hashPath": "facepunch.steamworks.2.3.3.nupkg.sha512"
},
"Microsoft.Bcl.HashCode/1.1.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-MalY0Y/uM/LjXtHfX/26l2VtN4LDNZ2OE3aumNOHDLsT4fNYy2hiHXI4CXCqKpNUNm7iJ2brrc4J89UdaL56FA==",
"path": "microsoft.bcl.hashcode/1.1.1",
"hashPath": "microsoft.bcl.hashcode.1.1.1.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
}
}
}
@@ -0,0 +1,322 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>StgSharp</name>
</assembly>
<members>
<member name="P:StgSharp.IEntity.CollisionSensor">
<summary>
A sensor used for cheking out if a bullet hit a player or something else
</summary>
</member>
<member name="P:StgSharp.IEntity.Location">
<summary>
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
</summary>
</member>
<member name="P:StgSharp.IEntity.X">
<summary>
X position of an enenmy entity
</summary>
</member>
<member name="P:StgSharp.IEntity.Y">
<summary>
Y position of an enemy entity
</summary>
</member>
<member name="T:StgSharp.Geometries.UnusedVertexException">
<summary>
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
</summary>
</member>
<member name="T:StgSharp.Geometries.GetLocationHandler">
<summary>
计算位移失量,需要手动输入游戏刻以提供时间数据
</summary>
<param name="tickCounter"></param>
<returns>表示位移量的三维矢量</returns>
</member>
<member name="T:StgSharp.Geometries.IPlainGeometry">
<summary>
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
</summary>
</member>
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
<summary>
移动平行四边形的第三个顶点,是一个多余的方法,调用会引发多余变量异常
</summary>
<param name="tick">当前游戏刻</param>
<returns></returns>
<exception cref="T:StgSharp.Geometries.UnusedVertexException">几何体过定义</exception>
</member>
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
<summary>
刷新点的位置,即移动点。当该点是某个几何体的从动点时
(即点坐标由几何体其他点约束或点参数已经在创建几何体时定义)
请不要再次进行定义,程序将自行忽略此处的代码。
</summary>
<param name="tick">当前游戏刻</param>
</member>
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
<summary>
计算中心点相对于参考原点的位移
</summary>
<param name="tick">当前游戏刻</param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
<summary>
</summary>
<param name="colum"></param>
<param name="vec"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.vec2d)">
<summary>
</summary>
<param name="vec1"></param>
<param name="vec2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.colum2)">
<summary>
</summary>
<param name="vec"></param>
<param name="colum"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.vec2d,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="vec"></param>
<param name="matrix"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.colum2)">
<summary>
</summary>
<param name="matrix"></param>
<param name="colum"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.colum3)">
<summary>
</summary>
<param name="matrix"></param>
<param name="vec"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x3,StgSharp.Math.matrix3x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix2x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x3,StgSharp.Math.matrix3x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x3,StgSharp.Math.matrix3x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x2)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x3)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix3x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix4x2,StgSharp.Math.matrix2x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.matrix4x4,StgSharp.Math.matrix4x4)">
<summary>
</summary>
<param name="matrix1"></param>
<param name="matrix2"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
<summary>
Reurns the value of ArcSin(x)
</summary>
<param name="x">The sine value of the angle</param>
<returns></returns>
<exception cref="T:System.ArgumentException"></exception>
</member>
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
<summary>
Get the value of E ^ x;
</summary>
<param name="x"></param>
<returns></returns>
</member>
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
<summary>
</summary>
<param name="x"></param>
<returns>
Returns the value of ln(x).
</returns>
</member>
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
<summary>
calculate the value of x^y
</summary>
<param name="x"></param>
<param name="y"></param>
<returns>Returns the value of x^y</returns>
</member>
<member name="T:StgSharp.Optimization.asmfuncDelegate">
<summary>
A delegate for asm sse functions
</summary>
<param name="m128Pointrter">The m128* pointer to the target m128 transformed in ulong form</param>
</member>
</members>
</doc>
@@ -45,13 +45,17 @@
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"Facepunch.Steamworks": {
"target": "Package",
"version": "[2.3.3, )"
},
"Microsoft.Bcl.HashCode": {
"target": "Package",
"version": "[1.1.1, )"
},
"Microsoft.CSharp": {
"target": "Package",
"version": "[4.7.0, )"
},
"Steamworks.NET": {
"target": "Package",
"version": "[20.1.0, )"
}
},
"imports": [
+80 -61
View File
@@ -2,6 +2,30 @@
"version": 3,
"targets": {
".NETStandard,Version=v2.1": {
"Facepunch.Steamworks/2.3.3": {
"type": "package",
"compile": {
"lib/netstandard2.0/Facepunch.Steamworks.Win64.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Facepunch.Steamworks.Win64.dll": {
"related": ".xml"
}
}
},
"Microsoft.Bcl.HashCode/1.1.1": {
"type": "package",
"compile": {
"ref/netstandard2.1/Microsoft.Bcl.HashCode.dll": {}
},
"runtime": {
"lib/netstandard2.1/Microsoft.Bcl.HashCode.dll": {
"related": ".xml"
}
}
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"compile": {
@@ -14,45 +38,55 @@
"related": ".xml"
}
}
},
"Steamworks.NET/20.1.0": {
"type": "package",
"compile": {
"ref/netstandard2.1/Steamworks.NET.dll": {}
},
"runtime": {
"lib/netstandard2.1/Steamworks.NET.dll": {}
},
"runtimeTargets": {
"runtimes/linux-x64/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "linux-x64"
},
"runtimes/linux-x86/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "linux-x86"
},
"runtimes/osx-x64/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "osx-x64"
},
"runtimes/osx-x86/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "osx-x86"
},
"runtimes/win-x64/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "win-x64"
},
"runtimes/win-x86/lib/netstandard2.1/Steamworks.NET.dll": {
"assetType": "runtime",
"rid": "win-x86"
}
}
}
}
},
"libraries": {
"Facepunch.Steamworks/2.3.3": {
"sha512": "7nUjWX/uy6JbDX7Q3n8ij7vrpWjTM0S8hXO24R3ZwQ0QgY0sXVlxzh3unmYoLvKGi31rzDHqGX68I169hnHNxQ==",
"type": "package",
"path": "facepunch.steamworks/2.3.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"Facepunch.Steamworks.jpg",
"content/steam_api64.dll",
"facepunch.steamworks.2.3.3.nupkg.sha512",
"facepunch.steamworks.nuspec",
"lib/net46/Facepunch.Steamworks.Win64.dll",
"lib/net46/Facepunch.Steamworks.Win64.xml",
"lib/netstandard2.0/Facepunch.Steamworks.Win64.dll",
"lib/netstandard2.0/Facepunch.Steamworks.Win64.xml"
]
},
"Microsoft.Bcl.HashCode/1.1.1": {
"sha512": "MalY0Y/uM/LjXtHfX/26l2VtN4LDNZ2OE3aumNOHDLsT4fNYy2hiHXI4CXCqKpNUNm7iJ2brrc4J89UdaL56FA==",
"type": "package",
"path": "microsoft.bcl.hashcode/1.1.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/net461/Microsoft.Bcl.HashCode.dll",
"lib/net461/Microsoft.Bcl.HashCode.xml",
"lib/netcoreapp2.1/Microsoft.Bcl.HashCode.dll",
"lib/netcoreapp2.1/Microsoft.Bcl.HashCode.xml",
"lib/netstandard2.0/Microsoft.Bcl.HashCode.dll",
"lib/netstandard2.0/Microsoft.Bcl.HashCode.xml",
"lib/netstandard2.1/Microsoft.Bcl.HashCode.dll",
"lib/netstandard2.1/Microsoft.Bcl.HashCode.xml",
"microsoft.bcl.hashcode.1.1.1.nupkg.sha512",
"microsoft.bcl.hashcode.nuspec",
"ref/net461/Microsoft.Bcl.HashCode.dll",
"ref/netcoreapp2.1/Microsoft.Bcl.HashCode.dll",
"ref/netstandard2.0/Microsoft.Bcl.HashCode.dll",
"ref/netstandard2.1/Microsoft.Bcl.HashCode.dll",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"Microsoft.CSharp/4.7.0": {
"sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"type": "package",
@@ -121,32 +155,13 @@
"useSharedDesignerContext.txt",
"version.txt"
]
},
"Steamworks.NET/20.1.0": {
"sha512": "+GntwnyJ5tCNvUIaQxv2+ehDvZJzGUqlSB5xRBk1hTj1qqBJ6s4vK/OfGD/jae7aTmXiGSm8wpJORosNtQevJQ==",
"type": "package",
"path": "steamworks.net/20.1.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/netstandard2.1/Steamworks.NET.dll",
"readme.md",
"ref/netstandard2.1/Steamworks.NET.dll",
"runtimes/linux-x64/lib/netstandard2.1/Steamworks.NET.dll",
"runtimes/linux-x86/lib/netstandard2.1/Steamworks.NET.dll",
"runtimes/osx-x64/lib/netstandard2.1/Steamworks.NET.dll",
"runtimes/osx-x86/lib/netstandard2.1/Steamworks.NET.dll",
"runtimes/win-x64/lib/netstandard2.1/Steamworks.NET.dll",
"runtimes/win-x86/lib/netstandard2.1/Steamworks.NET.dll",
"steamworks.net.20.1.0.nupkg.sha512",
"steamworks.net.nuspec"
]
}
},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.1": [
"Microsoft.CSharp >= 4.7.0",
"Steamworks.NET >= 20.1.0"
"Facepunch.Steamworks >= 2.3.3",
"Microsoft.Bcl.HashCode >= 1.1.1",
"Microsoft.CSharp >= 4.7.0"
]
},
"packageFolders": {
@@ -194,13 +209,17 @@
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"Facepunch.Steamworks": {
"target": "Package",
"version": "[2.3.3, )"
},
"Microsoft.Bcl.HashCode": {
"target": "Package",
"version": "[1.1.1, )"
},
"Microsoft.CSharp": {
"target": "Package",
"version": "[4.7.0, )"
},
"Steamworks.NET": {
"target": "Package",
"version": "[20.1.0, )"
}
},
"imports": [

Some files were not shown because too many files have changed in this diff Show More