|
| 1 | +using System; |
| 2 | +using System.Numerics; |
| 3 | +using System.Runtime.InteropServices; |
| 4 | +using System.Text; |
| 5 | + |
| 6 | +namespace ImGuiNET |
| 7 | +{ |
| 8 | + public static unsafe partial class ImGuizmo |
| 9 | + { |
| 10 | + public static void BeginFrame() |
| 11 | + { |
| 12 | + ImGuizmoNative.ImGuizmo_BeginFrame(); |
| 13 | + } |
| 14 | + public static void DecomposeMatrixToComponents(ref float matrix, ref float translation, ref float rotation, ref float scale) |
| 15 | + { |
| 16 | + fixed (float* native_matrix = &matrix) |
| 17 | + { |
| 18 | + fixed (float* native_translation = &translation) |
| 19 | + { |
| 20 | + fixed (float* native_rotation = &rotation) |
| 21 | + { |
| 22 | + fixed (float* native_scale = &scale) |
| 23 | + { |
| 24 | + ImGuizmoNative.ImGuizmo_DecomposeMatrixToComponents(native_matrix, native_translation, native_rotation, native_scale); |
| 25 | + } |
| 26 | + } |
| 27 | + } |
| 28 | + } |
| 29 | + } |
| 30 | + public static void DrawCubes(ref float view, ref float projection, ref float matrices, int matrixCount) |
| 31 | + { |
| 32 | + fixed (float* native_view = &view) |
| 33 | + { |
| 34 | + fixed (float* native_projection = &projection) |
| 35 | + { |
| 36 | + fixed (float* native_matrices = &matrices) |
| 37 | + { |
| 38 | + ImGuizmoNative.ImGuizmo_DrawCubes(native_view, native_projection, native_matrices, matrixCount); |
| 39 | + } |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + public static void DrawGrid(ref float view, ref float projection, ref float matrix, float gridSize) |
| 44 | + { |
| 45 | + fixed (float* native_view = &view) |
| 46 | + { |
| 47 | + fixed (float* native_projection = &projection) |
| 48 | + { |
| 49 | + fixed (float* native_matrix = &matrix) |
| 50 | + { |
| 51 | + ImGuizmoNative.ImGuizmo_DrawGrid(native_view, native_projection, native_matrix, gridSize); |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + } |
| 56 | + public static void Enable(bool enable) |
| 57 | + { |
| 58 | + byte native_enable = enable ? (byte)1 : (byte)0; |
| 59 | + ImGuizmoNative.ImGuizmo_Enable(native_enable); |
| 60 | + } |
| 61 | + public static bool IsOver() |
| 62 | + { |
| 63 | + byte ret = ImGuizmoNative.ImGuizmo_IsOverNil(); |
| 64 | + return ret != 0; |
| 65 | + } |
| 66 | + public static bool IsOver(OPERATION op) |
| 67 | + { |
| 68 | + byte ret = ImGuizmoNative.ImGuizmo_IsOverOPERATION(op); |
| 69 | + return ret != 0; |
| 70 | + } |
| 71 | + public static bool IsUsing() |
| 72 | + { |
| 73 | + byte ret = ImGuizmoNative.ImGuizmo_IsUsing(); |
| 74 | + return ret != 0; |
| 75 | + } |
| 76 | + public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix) |
| 77 | + { |
| 78 | + float* deltaMatrix = null; |
| 79 | + float* snap = null; |
| 80 | + float* localBounds = null; |
| 81 | + float* boundsSnap = null; |
| 82 | + fixed (float* native_view = &view) |
| 83 | + { |
| 84 | + fixed (float* native_projection = &projection) |
| 85 | + { |
| 86 | + fixed (float* native_matrix = &matrix) |
| 87 | + { |
| 88 | + byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, deltaMatrix, snap, localBounds, boundsSnap); |
| 89 | + return ret != 0; |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + } |
| 94 | + public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix, ref float deltaMatrix) |
| 95 | + { |
| 96 | + float* snap = null; |
| 97 | + float* localBounds = null; |
| 98 | + float* boundsSnap = null; |
| 99 | + fixed (float* native_view = &view) |
| 100 | + { |
| 101 | + fixed (float* native_projection = &projection) |
| 102 | + { |
| 103 | + fixed (float* native_matrix = &matrix) |
| 104 | + { |
| 105 | + fixed (float* native_deltaMatrix = &deltaMatrix) |
| 106 | + { |
| 107 | + byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, native_deltaMatrix, snap, localBounds, boundsSnap); |
| 108 | + return ret != 0; |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | + public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix, ref float deltaMatrix, ref float snap) |
| 115 | + { |
| 116 | + float* localBounds = null; |
| 117 | + float* boundsSnap = null; |
| 118 | + fixed (float* native_view = &view) |
| 119 | + { |
| 120 | + fixed (float* native_projection = &projection) |
| 121 | + { |
| 122 | + fixed (float* native_matrix = &matrix) |
| 123 | + { |
| 124 | + fixed (float* native_deltaMatrix = &deltaMatrix) |
| 125 | + { |
| 126 | + fixed (float* native_snap = &snap) |
| 127 | + { |
| 128 | + byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, native_deltaMatrix, native_snap, localBounds, boundsSnap); |
| 129 | + return ret != 0; |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + } |
| 136 | + public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix, ref float deltaMatrix, ref float snap, ref float localBounds) |
| 137 | + { |
| 138 | + float* boundsSnap = null; |
| 139 | + fixed (float* native_view = &view) |
| 140 | + { |
| 141 | + fixed (float* native_projection = &projection) |
| 142 | + { |
| 143 | + fixed (float* native_matrix = &matrix) |
| 144 | + { |
| 145 | + fixed (float* native_deltaMatrix = &deltaMatrix) |
| 146 | + { |
| 147 | + fixed (float* native_snap = &snap) |
| 148 | + { |
| 149 | + fixed (float* native_localBounds = &localBounds) |
| 150 | + { |
| 151 | + byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, native_deltaMatrix, native_snap, native_localBounds, boundsSnap); |
| 152 | + return ret != 0; |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | + } |
| 160 | + public static bool Manipulate(ref float view, ref float projection, OPERATION operation, MODE mode, ref float matrix, ref float deltaMatrix, ref float snap, ref float localBounds, ref float boundsSnap) |
| 161 | + { |
| 162 | + fixed (float* native_view = &view) |
| 163 | + { |
| 164 | + fixed (float* native_projection = &projection) |
| 165 | + { |
| 166 | + fixed (float* native_matrix = &matrix) |
| 167 | + { |
| 168 | + fixed (float* native_deltaMatrix = &deltaMatrix) |
| 169 | + { |
| 170 | + fixed (float* native_snap = &snap) |
| 171 | + { |
| 172 | + fixed (float* native_localBounds = &localBounds) |
| 173 | + { |
| 174 | + fixed (float* native_boundsSnap = &boundsSnap) |
| 175 | + { |
| 176 | + byte ret = ImGuizmoNative.ImGuizmo_Manipulate(native_view, native_projection, operation, mode, native_matrix, native_deltaMatrix, native_snap, native_localBounds, native_boundsSnap); |
| 177 | + return ret != 0; |
| 178 | + } |
| 179 | + } |
| 180 | + } |
| 181 | + } |
| 182 | + } |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + public static void RecomposeMatrixFromComponents(ref float translation, ref float rotation, ref float scale, ref float matrix) |
| 187 | + { |
| 188 | + fixed (float* native_translation = &translation) |
| 189 | + { |
| 190 | + fixed (float* native_rotation = &rotation) |
| 191 | + { |
| 192 | + fixed (float* native_scale = &scale) |
| 193 | + { |
| 194 | + fixed (float* native_matrix = &matrix) |
| 195 | + { |
| 196 | + ImGuizmoNative.ImGuizmo_RecomposeMatrixFromComponents(native_translation, native_rotation, native_scale, native_matrix); |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | + } |
| 201 | + } |
| 202 | + public static void SetDrawlist() |
| 203 | + { |
| 204 | + ImDrawList* drawlist = null; |
| 205 | + ImGuizmoNative.ImGuizmo_SetDrawlist(drawlist); |
| 206 | + } |
| 207 | + public static void SetDrawlist(ImDrawListPtr drawlist) |
| 208 | + { |
| 209 | + ImDrawList* native_drawlist = drawlist.NativePtr; |
| 210 | + ImGuizmoNative.ImGuizmo_SetDrawlist(native_drawlist); |
| 211 | + } |
| 212 | + public static void SetID(int id) |
| 213 | + { |
| 214 | + ImGuizmoNative.ImGuizmo_SetID(id); |
| 215 | + } |
| 216 | + public static void SetOrthographic(bool isOrthographic) |
| 217 | + { |
| 218 | + byte native_isOrthographic = isOrthographic ? (byte)1 : (byte)0; |
| 219 | + ImGuizmoNative.ImGuizmo_SetOrthographic(native_isOrthographic); |
| 220 | + } |
| 221 | + public static void SetRect(float x, float y, float width, float height) |
| 222 | + { |
| 223 | + ImGuizmoNative.ImGuizmo_SetRect(x, y, width, height); |
| 224 | + } |
| 225 | + public static void ViewManipulate(ref float view, float length, Vector2 position, Vector2 size, uint backgroundColor) |
| 226 | + { |
| 227 | + fixed (float* native_view = &view) |
| 228 | + { |
| 229 | + ImGuizmoNative.ImGuizmo_ViewManipulate(native_view, length, position, size, backgroundColor); |
| 230 | + } |
| 231 | + } |
| 232 | + } |
| 233 | +} |
0 commit comments