├── example.png ├── examples └── core │ ├── core_basic_window.bas │ └── core_3d_camera_first_person.bas ├── LICENSE ├── README.md ├── raygui.bi ├── raylib.bi └── raymath.bi /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WIITD/raylib-freebasic/HEAD/example.png -------------------------------------------------------------------------------- /examples/core/core_basic_window.bas: -------------------------------------------------------------------------------- 1 | #include "../../raylib.bi" 2 | 3 | dim as integer screen_width = 800 4 | dim as integer screen_height = 450 5 | 6 | InitWindow(screen_width, screen_height, "raylib-freebasic [core] example - basic window") 7 | 8 | SetTargetFPS(60) 9 | 10 | while not WindowShouldClose() 11 | BeginDrawing() 12 | 13 | ClearBackground(RAYWHITE) 14 | 15 | DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY) 16 | 17 | EndDrawing() 18 | wend 19 | 20 | CloseWindow() 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Michał KM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/core/core_3d_camera_first_person.bas: -------------------------------------------------------------------------------- 1 | #include "../../raylib.bi" 2 | 3 | #define MAX_COLUMNS 20 4 | 5 | dim as integer screen_width = 800 6 | dim as integer screen_height = 450 7 | 8 | InitWindow(screen_width, screen_height, "raylib-freebasic [core] example - 3d camera first person") 9 | 10 | dim as camera cam 11 | cam.position = vector3(4.0, 2.0, 4.0) 12 | cam.target = vector3(0, 1.8, 0) 13 | cam.up = vector3(0, 1, 0) 14 | cam.fovy = 60 15 | cam.projection = CAMERA_PERSPECTIVE 16 | 17 | dim as short heights(MAX_COLUMNS) 18 | dim as vector3 positions(MAX_COLUMNS) 19 | dim as rlcolor col(MAX_COLUMNS) 20 | 21 | for i as integer = 0 to MAX_COLUMNS 22 | heights(i) = GetRandomValue(1, 12) 23 | positions(i) = vector3(GetRandomValue(-15, 15), heights(i)/2.0, GetRandomValue(-15, 15)) 24 | col(i) = rlcolor(GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255) 25 | next i 26 | 27 | SetCameraMode(cam, CAMERA_FIRST_PERSON) 28 | 29 | SetTargetFPS(60) 30 | 31 | while not WindowShouldClose() 32 | 33 | UpdateCamera(@cam) 34 | 35 | BeginDrawing() 36 | 37 | ClearBackground(RAYWHITE) 38 | 39 | BeginMode3D(cam) 40 | 41 | DrawPlane(vector3(0.0, 0.0, 0.0), vector2(32.0, 32.0), LIGHTGRAY) 42 | DrawCube(vector3(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, BLUE) 43 | DrawCube(vector3(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, LIME) 44 | DrawCube(vector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, GOLD) 45 | 46 | for j as integer = 0 to MAX_COLUMNS 47 | DrawCube(positions(j), 2.0, heights(j), 2.0, col(j)) 48 | DrawCubeWires(positions(j), 2.0, heights(j), 2.0, MAROON) 49 | next j 50 | 51 | EndMode3D() 52 | 53 | DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5)) 54 | DrawRectangleLines( 10, 10, 220, 70, BLUE) 55 | 56 | DrawText("First person camera default controls:", 20, 20, 10, BLACK) 57 | DrawText("- Move with keys: W, A, S, D", 40, 40, 10, DARKGRAY) 58 | DrawText("- Mouse move to look around", 40, 60, 10, DARKGRAY) 59 | 60 | 61 | EndDrawing() 62 | wend 63 | 64 | CloseWindow() 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # raylib-freebasic -> v5.0 2 | 3 | [FreeBasic](https://freebasic.net/) bindings for [raylib](https://github.com/raysan5/raylib) 4 | 5 | Lib | Linux | Windows | Mac | BSD | 6 | --- | ----- | ------- | --- | --- | 7 | raylib.bi | tested | tested | not tested | not tested 8 | raymath.bi | tested | tested | not tested | not tested 9 | raygui.bi | tested | not tested | not tested | not tested 10 | 11 | ## example 12 | ```basic 13 | #include "raylib.bi" 14 | 15 | Dim As Const Integer screen_width = 800 16 | Dim As Const Integer screen_height = 450 17 | 18 | InitWindow(screen_width, screen_height, "Hello World") 19 | SetTargetFPS(60) 20 | 21 | While Not WindowShouldClose() 22 | BeginDrawing() 23 | ClearBackground(RAYWHITE) 24 | DrawText("Hello World from raylib and FreeBasic!", 200, 200, 20, GRAY) 25 | EndDrawing() 26 | Wend 27 | 28 | CloseWindow() 29 | ``` 30 | 31 | ![Example](example.png) 32 | 33 | 34 | 35 | ## compiling 36 | you need to have raylib on your device, tested with shared lib but static lib should also work 37 | 38 | ### raylib 39 | 40 | #### linux 41 | include **raylib.bi** in your project and it should work, all of dependencies are defined inside the file 42 | 43 | #### windows 44 | include **raylib.bi** in your project and it should work, all of dependencies are defined inside the file 45 | i primarily use linux so tests were mostly made using mingw and wine without encountering any issues 46 | some users had problems with linking, changing ``` #include "raylib" ``` to ``` #include "raylibdll" ``` helped 47 | 48 | ### raygui 49 | you have to either compile raygui with raylib or as a separate lib 50 | for more info i advice looking into this [thread](https://github.com/WIITD/raylib-freebasic/issues/7) 51 | 52 | for more info about building raylib visit [official wiki](https://github.com/raysan5/raylib/wiki) 53 | and for raygui check [official repo](https://github.com/raysan5/raygui#building) 54 | 55 | ## examples 56 | [examples][https://github.com/WIITD/raylib-freebasic/tree/main/examples] 57 | simple game i wrote that uses [raylib-freebasic](https://github.com/WIITD/asteroid_field/tree/raylib-freebasic) 58 | -------------------------------------------------------------------------------- /raygui.bi: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef RAYLIB_H 4 | #include once "raylib.bi" 5 | #endif 6 | 7 | #inclib "raygui" 8 | 9 | extern "C" 10 | 11 | #define RAYGUI_H 12 | #define RAYGUI_VERSION "3.2" 13 | #define RAYGUI_MALLOC(sz) malloc(sz) 14 | #define RAYGUI_CALLOC(n, sz) calloc(n, sz) 15 | #define RAYGUI_FREE(p) free(p) 16 | #define RAYGUI_SUPPORT_LOG_INFO 17 | #define RAYGUI_LOG(__VA_ARGS__...) printf(__VA_ARGS__) 18 | 19 | type GuiStyleProp 20 | controlId as ushort 21 | propertyId as ushort 22 | propertyValue as ulong 23 | end type 24 | 25 | type GuiState as long 26 | enum 27 | STATE_NORMAL = 0 28 | STATE_FOCUSED 29 | STATE_PRESSED 30 | STATE_DISABLED 31 | end enum 32 | 33 | type GuiTextAlignment as long 34 | enum 35 | TEXT_ALIGN_LEFT = 0 36 | TEXT_ALIGN_CENTER 37 | TEXT_ALIGN_RIGHT 38 | end enum 39 | 40 | type GuiControl as long 41 | enum 42 | DEFAULT = 0 43 | LABEL 44 | BUTTON 45 | TOGGLE 46 | SLIDER 47 | PROGRESSBAR 48 | CHECKBOX 49 | COMBOBOX 50 | DROPDOWNBOX 51 | TEXTBOX 52 | VALUEBOX 53 | SPINNER 54 | LISTVIEW 55 | COLORPICKER 56 | SCROLLBAR 57 | STATUSBAR 58 | end enum 59 | 60 | type GuiControlProperty as long 61 | enum 62 | BORDER_COLOR_NORMAL = 0 63 | BASE_COLOR_NORMAL 64 | TEXT_COLOR_NORMAL 65 | BORDER_COLOR_FOCUSED 66 | BASE_COLOR_FOCUSED 67 | TEXT_COLOR_FOCUSED 68 | BORDER_COLOR_PRESSED 69 | BASE_COLOR_PRESSED 70 | TEXT_COLOR_PRESSED 71 | BORDER_COLOR_DISABLED 72 | BASE_COLOR_DISABLED 73 | TEXT_COLOR_DISABLED 74 | BORDER_WIDTH 75 | TEXT_PADDING 76 | TEXT_ALIGNMENT 77 | RESERVED 78 | end enum 79 | 80 | type GuiDefaultProperty as long 81 | enum 82 | TEXT_SIZE = 16 83 | TEXT_SPACING 84 | LINE_COLOR 85 | BACKGROUND_COLOR 86 | end enum 87 | 88 | type GuiToggleProperty as long 89 | enum 90 | GROUP_PADDING = 16 91 | end enum 92 | 93 | type GuiSliderProperty as long 94 | enum 95 | SLIDER_WIDTH = 16 96 | SLIDER_PADDING 97 | end enum 98 | 99 | type GuiProgressBarProperty as long 100 | enum 101 | PROGRESS_PADDING = 16 102 | end enum 103 | 104 | type GuiScrollBarProperty as long 105 | enum 106 | ARROWS_SIZE = 16 107 | ARROWS_VISIBLE 108 | SCROLL_SLIDER_PADDING 109 | SCROLL_SLIDER_SIZE 110 | SCROLL_PADDING 111 | SCROLL_SPEED 112 | end enum 113 | 114 | type GuiCheckBoxProperty as long 115 | enum 116 | CHECK_PADDING = 16 117 | end enum 118 | 119 | type GuiComboBoxProperty as long 120 | enum 121 | COMBO_BUTTON_WIDTH = 16 122 | COMBO_BUTTON_SPACING 123 | end enum 124 | 125 | type GuiDropdownBoxProperty as long 126 | enum 127 | ARROW_PADDING = 16 128 | DROPDOWN_ITEMS_SPACING 129 | end enum 130 | 131 | type GuiTextBoxProperty as long 132 | enum 133 | TEXT_INNER_PADDING = 16 134 | TEXT_LINES_SPACING 135 | end enum 136 | 137 | type GuiSpinnerProperty as long 138 | enum 139 | SPIN_BUTTON_WIDTH = 16 140 | SPIN_BUTTON_SPACING 141 | end enum 142 | 143 | type GuiListViewProperty as long 144 | enum 145 | LIST_ITEMS_HEIGHT = 16 146 | LIST_ITEMS_SPACING 147 | SCROLLBAR_WIDTH 148 | SCROLLBAR_SIDE 149 | end enum 150 | 151 | type GuiColorPickerProperty as long 152 | enum 153 | COLOR_SELECTOR_SIZE = 16 154 | HUEBAR_WIDTH 155 | HUEBAR_PADDING 156 | HUEBAR_SELECTOR_HEIGHT 157 | HUEBAR_SELECTOR_OVERFLOW 158 | end enum 159 | 160 | const SCROLLBAR_LEFT_SIDE = 0 161 | const SCROLLBAR_RIGHT_SIDE = 1 162 | declare sub GuiEnable() 163 | declare sub GuiDisable() 164 | declare sub GuiLock() 165 | declare sub GuiUnlock() 166 | declare function GuiIsLocked() as boolean 167 | declare sub GuiFade(byval alpha as single) 168 | declare sub GuiSetState(byval state as long) 169 | declare function GuiGetState() as long 170 | declare sub GuiSetFont(byval font as Font) 171 | declare function GuiGetFont() as Font 172 | declare sub GuiSetStyle(byval control as long, byval property as long, byval value as long) 173 | declare function GuiGetStyle(byval control as long, byval property as long) as long 174 | declare function GuiWindowBox(byval bounds as Rectangle, byval title as const zstring ptr) as boolean 175 | declare sub GuiGroupBox(byval bounds as Rectangle, byval text as const zstring ptr) 176 | declare sub GuiLine(byval bounds as Rectangle, byval text as const zstring ptr) 177 | declare sub GuiPanel(byval bounds as Rectangle, byval text as const zstring ptr) 178 | declare function GuiScrollPanel(byval bounds as Rectangle, byval text as const zstring ptr, byval content as Rectangle, byval scroll as Vector2 ptr) as Rectangle 179 | declare sub GuiLabel(byval bounds as Rectangle, byval text as const zstring ptr) 180 | declare function GuiButton(byval bounds as Rectangle, byval text as const zstring ptr) as boolean 181 | declare function GuiLabelButton(byval bounds as Rectangle, byval text as const zstring ptr) as boolean 182 | declare function GuiToggle(byval bounds as Rectangle, byval text as const zstring ptr, byval active as boolean) as boolean 183 | declare function GuiToggleGroup(byval bounds as Rectangle, byval text as const zstring ptr, byval active as long) as long 184 | declare function GuiCheckBox(byval bounds as Rectangle, byval text as const zstring ptr, byval checked as boolean) as boolean 185 | declare function GuiComboBox(byval bounds as Rectangle, byval text as const zstring ptr, byval active as long) as long 186 | declare function GuiDropdownBox(byval bounds as Rectangle, byval text as const zstring ptr, byval active as long ptr, byval editMode as boolean) as boolean 187 | declare function GuiSpinner(byval bounds as Rectangle, byval text as const zstring ptr, byval value as long ptr, byval minValue as long, byval maxValue as long, byval editMode as boolean) as boolean 188 | declare function GuiValueBox(byval bounds as Rectangle, byval text as const zstring ptr, byval value as long ptr, byval minValue as long, byval maxValue as long, byval editMode as boolean) as boolean 189 | declare function GuiTextBox(byval bounds as Rectangle, byval text as zstring ptr, byval textSize as long, byval editMode as boolean) as boolean 190 | declare function GuiTextBoxMulti(byval bounds as Rectangle, byval text as zstring ptr, byval textSize as long, byval editMode as boolean) as boolean 191 | declare function GuiSlider(byval bounds as Rectangle, byval textLeft as const zstring ptr, byval textRight as const zstring ptr, byval value as single, byval minValue as single, byval maxValue as single) as single 192 | declare function GuiSliderBar(byval bounds as Rectangle, byval textLeft as const zstring ptr, byval textRight as const zstring ptr, byval value as single, byval minValue as single, byval maxValue as single) as single 193 | declare function GuiProgressBar(byval bounds as Rectangle, byval textLeft as const zstring ptr, byval textRight as const zstring ptr, byval value as single, byval minValue as single, byval maxValue as single) as single 194 | declare sub GuiStatusBar(byval bounds as Rectangle, byval text as const zstring ptr) 195 | declare sub GuiDummyRec(byval bounds as Rectangle, byval text as const zstring ptr) 196 | declare function GuiGrid(byval bounds as Rectangle, byval text as const zstring ptr, byval spacing as single, byval subdivs as long) as Vector2 197 | declare function GuiListView(byval bounds as Rectangle, byval text as const zstring ptr, byval scrollIndex as long ptr, byval active as long) as long 198 | declare function GuiListViewEx(byval bounds as Rectangle, byval text as const zstring ptr ptr, byval count as long, byval focus as long ptr, byval scrollIndex as long ptr, byval active as long) as long 199 | declare function GuiMessageBox(byval bounds as Rectangle, byval title as const zstring ptr, byval message as const zstring ptr, byval buttons as const zstring ptr) as long 200 | declare function GuiTextInputBox(byval bounds as Rectangle, byval title as const zstring ptr, byval message as const zstring ptr, byval buttons as const zstring ptr, byval text as zstring ptr, byval textMaxSize as long, byval secretViewActive as long ptr) as long 201 | declare function GuiColorPicker(byval bounds as Rectangle, byval text as const zstring ptr, byval color as RLColor) as RLColor 202 | declare function GuiColorPanel(byval bounds as Rectangle, byval text as const zstring ptr, byval color as RLColor) as RLColor 203 | declare function GuiColorBarAlpha(byval bounds as Rectangle, byval text as const zstring ptr, byval alpha as single) as single 204 | declare function GuiColorBarHue(byval bounds as Rectangle, byval text as const zstring ptr, byval value as single) as single 205 | declare sub GuiLoadStyle(byval fileName as const zstring ptr) 206 | declare sub GuiLoadStyleDefault() 207 | declare function GuiIconText(byval iconId as long, byval text as const zstring ptr) as const zstring ptr 208 | declare sub GuiDrawIcon(byval iconId as long, byval posX as long, byval posY as long, byval pixelSize as long, byval color as RLColor) 209 | declare function GuiGetIcons() as ulong ptr 210 | declare function GuiGetIconData(byval iconId as long) as ulong ptr 211 | declare sub GuiSetIconData(byval iconId as long, byval data_ as ulong ptr) 212 | declare sub GuiSetIconScale(byval scale as ulong) 213 | declare sub GuiSetIconPixel(byval iconId as long, byval x as long, byval y as long) 214 | declare sub GuiClearIconPixel(byval iconId as long, byval x as long, byval y as long) 215 | declare function GuiCheckIconPixel(byval iconId as long, byval x as long, byval y as long) as boolean 216 | 217 | type GuiIconName as long 218 | enum 219 | ICON_NONE = 0 220 | ICON_FOLDER_FILE_OPEN = 1 221 | ICON_FILE_SAVE_CLASSIC = 2 222 | ICON_FOLDER_OPEN = 3 223 | ICON_FOLDER_SAVE = 4 224 | ICON_FILE_OPEN = 5 225 | ICON_FILE_SAVE = 6 226 | ICON_FILE_EXPORT = 7 227 | ICON_FILE_ADD = 8 228 | ICON_FILE_DELETE = 9 229 | ICON_FILETYPE_TEXT = 10 230 | ICON_FILETYPE_AUDIO = 11 231 | ICON_FILETYPE_IMAGE = 12 232 | ICON_FILETYPE_PLAY = 13 233 | ICON_FILETYPE_VIDEO = 14 234 | ICON_FILETYPE_INFO = 15 235 | ICON_FILE_COPY = 16 236 | ICON_FILE_CUT = 17 237 | ICON_FILE_PASTE = 18 238 | ICON_CURSOR_HAND = 19 239 | ICON_CURSOR_POINTER = 20 240 | ICON_CURSOR_CLASSIC = 21 241 | ICON_PENCIL = 22 242 | ICON_PENCIL_BIG = 23 243 | ICON_BRUSH_CLASSIC = 24 244 | ICON_BRUSH_PAINTER = 25 245 | ICON_WATER_DROP = 26 246 | ICON_COLOR_PICKER = 27 247 | ICON_RUBBER = 28 248 | ICON_COLOR_BUCKET = 29 249 | ICON_TEXT_T = 30 250 | ICON_TEXT_A = 31 251 | ICON_SCALE = 32 252 | ICON_RESIZE = 33 253 | ICON_FILTER_POINT = 34 254 | ICON_FILTER_BILINEAR = 35 255 | ICON_CROP = 36 256 | ICON_CROP_ALPHA = 37 257 | ICON_SQUARE_TOGGLE = 38 258 | ICON_SYMMETRY = 39 259 | ICON_SYMMETRY_HORIZONTAL = 40 260 | ICON_SYMMETRY_VERTICAL = 41 261 | ICON_LENS = 42 262 | ICON_LENS_BIG = 43 263 | ICON_EYE_ON = 44 264 | ICON_EYE_OFF = 45 265 | ICON_FILTER_TOP = 46 266 | ICON_FILTER = 47 267 | ICON_TARGET_POINT = 48 268 | ICON_TARGET_SMALL = 49 269 | ICON_TARGET_BIG = 50 270 | ICON_TARGET_MOVE = 51 271 | ICON_CURSOR_MOVE = 52 272 | ICON_CURSOR_SCALE = 53 273 | ICON_CURSOR_SCALE_RIGHT = 54 274 | ICON_CURSOR_SCALE_LEFT = 55 275 | ICON_UNDO = 56 276 | ICON_REDO = 57 277 | ICON_REREDO = 58 278 | ICON_MUTATE = 59 279 | ICON_ROTATE = 60 280 | ICON_REPEAT = 61 281 | ICON_SHUFFLE = 62 282 | ICON_EMPTYBOX = 63 283 | ICON_TARGET = 64 284 | ICON_TARGET_SMALL_FILL = 65 285 | ICON_TARGET_BIG_FILL = 66 286 | ICON_TARGET_MOVE_FILL = 67 287 | ICON_CURSOR_MOVE_FILL = 68 288 | ICON_CURSOR_SCALE_FILL = 69 289 | ICON_CURSOR_SCALE_RIGHT_FILL = 70 290 | ICON_CURSOR_SCALE_LEFT_FILL = 71 291 | ICON_UNDO_FILL = 72 292 | ICON_REDO_FILL = 73 293 | ICON_REREDO_FILL = 74 294 | ICON_MUTATE_FILL = 75 295 | ICON_ROTATE_FILL = 76 296 | ICON_REPEAT_FILL = 77 297 | ICON_SHUFFLE_FILL = 78 298 | ICON_EMPTYBOX_SMALL = 79 299 | ICON_BOX = 80 300 | ICON_BOX_TOP = 81 301 | ICON_BOX_TOP_RIGHT = 82 302 | ICON_BOX_RIGHT = 83 303 | ICON_BOX_BOTTOM_RIGHT = 84 304 | ICON_BOX_BOTTOM = 85 305 | ICON_BOX_BOTTOM_LEFT = 86 306 | ICON_BOX_LEFT = 87 307 | ICON_BOX_TOP_LEFT = 88 308 | ICON_BOX_CENTER = 89 309 | ICON_BOX_CIRCLE_MASK = 90 310 | ICON_POT = 91 311 | ICON_ALPHA_MULTIPLY = 92 312 | ICON_ALPHA_CLEAR = 93 313 | ICON_DITHERING = 94 314 | ICON_MIPMAPS = 95 315 | ICON_BOX_GRID = 96 316 | ICON_GRID = 97 317 | ICON_BOX_CORNERS_SMALL = 98 318 | ICON_BOX_CORNERS_BIG = 99 319 | ICON_FOUR_BOXES = 100 320 | ICON_GRID_FILL = 101 321 | ICON_BOX_MULTISIZE = 102 322 | ICON_ZOOM_SMALL = 103 323 | ICON_ZOOM_MEDIUM = 104 324 | ICON_ZOOM_BIG = 105 325 | ICON_ZOOM_ALL = 106 326 | ICON_ZOOM_CENTER = 107 327 | ICON_BOX_DOTS_SMALL = 108 328 | ICON_BOX_DOTS_BIG = 109 329 | ICON_BOX_CONCENTRIC = 110 330 | ICON_BOX_GRID_BIG = 111 331 | ICON_OK_TICK = 112 332 | ICON_CROSS = 113 333 | ICON_ARROW_LEFT = 114 334 | ICON_ARROW_RIGHT = 115 335 | ICON_ARROW_DOWN = 116 336 | ICON_ARROW_UP = 117 337 | ICON_ARROW_LEFT_FILL = 118 338 | ICON_ARROW_RIGHT_FILL = 119 339 | ICON_ARROW_DOWN_FILL = 120 340 | ICON_ARROW_UP_FILL = 121 341 | ICON_AUDIO = 122 342 | ICON_FX = 123 343 | ICON_WAVE = 124 344 | ICON_WAVE_SINUS = 125 345 | ICON_WAVE_SQUARE = 126 346 | ICON_WAVE_TRIANGULAR = 127 347 | ICON_CROSS_SMALL = 128 348 | ICON_PLAYER_PREVIOUS = 129 349 | ICON_PLAYER_PLAY_BACK = 130 350 | ICON_PLAYER_PLAY = 131 351 | ICON_PLAYER_PAUSE = 132 352 | ICON_PLAYER_STOP = 133 353 | ICON_PLAYER_NEXT = 134 354 | ICON_PLAYER_RECORD = 135 355 | ICON_MAGNET = 136 356 | ICON_LOCK_CLOSE = 137 357 | ICON_LOCK_OPEN = 138 358 | ICON_CLOCK = 139 359 | ICON_TOOLS = 140 360 | ICON_GEAR = 141 361 | ICON_GEAR_BIG = 142 362 | ICON_BIN = 143 363 | ICON_HAND_POINTER = 144 364 | ICON_LASER = 145 365 | ICON_COIN = 146 366 | ICON_EXPLOSION = 147 367 | ICON_1UP = 148 368 | ICON_PLAYER = 149 369 | ICON_PLAYER_JUMP = 150 370 | ICON_KEY = 151 371 | ICON_DEMON = 152 372 | ICON_TEXT_POPUP = 153 373 | ICON_GEAR_EX = 154 374 | ICON_CRACK = 155 375 | ICON_CRACK_POINTS = 156 376 | ICON_STAR = 157 377 | ICON_DOOR = 158 378 | ICON_EXIT = 159 379 | ICON_MODE_2D = 160 380 | ICON_MODE_3D = 161 381 | ICON_CUBE = 162 382 | ICON_CUBE_FACE_TOP = 163 383 | ICON_CUBE_FACE_LEFT = 164 384 | ICON_CUBE_FACE_FRONT = 165 385 | ICON_CUBE_FACE_BOTTOM = 166 386 | ICON_CUBE_FACE_RIGHT = 167 387 | ICON_CUBE_FACE_BACK = 168 388 | ICON_CAMERA = 169 389 | ICON_SPECIAL = 170 390 | ICON_LINK_NET = 171 391 | ICON_LINK_BOXES = 172 392 | ICON_LINK_MULTI = 173 393 | ICON_LINK = 174 394 | ICON_LINK_BROKE = 175 395 | ICON_TEXT_NOTES = 176 396 | ICON_NOTEBOOK = 177 397 | ICON_SUITCASE = 178 398 | ICON_SUITCASE_ZIP = 179 399 | ICON_MAILBOX = 180 400 | ICON_MONITOR = 181 401 | ICON_PRINTER = 182 402 | ICON_PHOTO_CAMERA = 183 403 | ICON_PHOTO_CAMERA_FLASH = 184 404 | ICON_HOUSE = 185 405 | ICON_HEART = 186 406 | ICON_CORNER = 187 407 | ICON_VERTICAL_BARS = 188 408 | ICON_VERTICAL_BARS_FILL = 189 409 | ICON_LIFE_BARS = 190 410 | ICON_INFO = 191 411 | ICON_CROSSLINE = 192 412 | ICON_HELP = 193 413 | ICON_FILETYPE_ALPHA = 194 414 | ICON_FILETYPE_HOME = 195 415 | ICON_LAYERS_VISIBLE = 196 416 | ICON_LAYERS = 197 417 | ICON_WINDOW = 198 418 | ICON_HIDPI = 199 419 | ICON_FILETYPE_BINARY = 200 420 | ICON_HEX = 201 421 | ICON_SHIELD = 202 422 | ICON_FILE_NEW = 203 423 | ICON_FOLDER_ADD = 204 424 | ICON_ALARM = 205 425 | ICON_206 = 206 426 | ICON_207 = 207 427 | ICON_208 = 208 428 | ICON_209 = 209 429 | ICON_210 = 210 430 | ICON_211 = 211 431 | ICON_212 = 212 432 | ICON_213 = 213 433 | ICON_214 = 214 434 | ICON_215 = 215 435 | ICON_216 = 216 436 | ICON_217 = 217 437 | ICON_218 = 218 438 | ICON_219 = 219 439 | ICON_220 = 220 440 | ICON_221 = 221 441 | ICON_222 = 222 442 | ICON_223 = 223 443 | ICON_224 = 224 444 | ICON_225 = 225 445 | ICON_226 = 226 446 | ICON_227 = 227 447 | ICON_228 = 228 448 | ICON_229 = 229 449 | ICON_230 = 230 450 | ICON_231 = 231 451 | ICON_232 = 232 452 | ICON_233 = 233 453 | ICON_234 = 234 454 | ICON_235 = 235 455 | ICON_236 = 236 456 | ICON_237 = 237 457 | ICON_238 = 238 458 | ICON_239 = 239 459 | ICON_240 = 240 460 | ICON_241 = 241 461 | ICON_242 = 242 462 | ICON_243 = 243 463 | ICON_244 = 244 464 | ICON_245 = 245 465 | ICON_246 = 246 466 | ICON_247 = 247 467 | ICON_248 = 248 468 | ICON_249 = 249 469 | ICON_250 = 250 470 | ICON_251 = 251 471 | ICON_252 = 252 472 | ICON_253 = 253 473 | ICON_254 = 254 474 | ICON_255 = 255 475 | end enum 476 | 477 | end extern 478 | -------------------------------------------------------------------------------- /raylib.bi: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include once "crt/long.bi" 4 | #include once "crt/stdarg.bi" 5 | 6 | '' The following symbols have been renamed: 7 | '' struct Color => RLColor 8 | 9 | #inclib "raylib" 10 | 11 | #if defined(__FB_CYGWIN__) or defined(__FB_LINUX__) or defined(__FB_FREEBSD__) or defined(__FB_OPENBSD__) or defined(__FB_NETBSD__) 12 | #inclib "GL" 13 | #inclib "X11" 14 | #endif 15 | 16 | #ifdef __FB_LINUX__ 17 | #inclib "dl" 18 | #inclib "rt" 19 | #elseif defined(__FB_CYGWIN__) or defined(__FB_FREEBSD__) or defined(__FB_OPENBSD__) or defined(__FB_NETBSD__) 20 | #inclib "Xrandr" 21 | #inclib "Xinerama" 22 | #inclib "Xi" 23 | #inclib "Xxf86vm" 24 | #inclib "Xcursor" 25 | #elseif defined(__FB_DARWIN__) 26 | #inclib "OpenGL" 27 | #inclib "Cocoa" 28 | #elseif defined(__FB_WIN32__) 29 | #inclib "opengl32" 30 | #inclib "gdi32" 31 | #inclib "winmm" 32 | #endif 33 | 34 | extern "C" 35 | 36 | #define RAYLIB_H 37 | const RAYLIB_VERSION_MAJOR = 5 38 | const RAYLIB_VERSION_MINOR = 0 39 | const RAYLIB_VERSION_PATCH = 0 40 | #define RAYLIB_VERSION "5.0" 41 | 42 | #ifndef PI 43 | const PI = 3.14159265358979323846 44 | #endif 45 | 46 | const DEG2RAD = PI / 180.0f 47 | const RAD2DEG = 180.0f / PI 48 | #define RL_MALLOC(sz) malloc(sz) 49 | #define RL_CALLOC(n, sz) calloc(n, sz) 50 | #define RL_REALLOC(ptr, sz) realloc(ptr, sz) 51 | #define RL_FREE(ptr) free(ptr) 52 | #define RL_COLOR_TYPE 53 | #define RL_RECTANGLE_TYPE 54 | #define RL_VECTOR2_TYPE 55 | #define RL_VECTOR3_TYPE 56 | #define RL_VECTOR4_TYPE 57 | #define RL_QUATERNION_TYPE 58 | #define RL_MATRIX_TYPE 59 | 60 | #define LIGHTGRAY RLColor( 200, 200, 200, 255 ) 61 | #define GRAY RLColor( 130, 130, 130, 255 ) 62 | #define DARKGRAY RLColor( 80, 80, 80, 255 ) 63 | #define YELLOW RLColor( 253, 249, 0, 255 ) 64 | #define GOLD RLColor( 255, 203, 0, 255 ) 65 | #define ORANGE RLColor( 255, 161, 0, 255 ) 66 | #define PINK RLColor( 255, 109, 194, 255 ) 67 | #define RED RLColor( 230, 41, 55, 255 ) 68 | #define MAROON RLColor( 190, 33, 55, 255 ) 69 | #define GREEN RLColor( 0, 228, 48, 255 ) 70 | #define LIME RLColor( 0, 158, 47, 255 ) 71 | #define DARKGREEN RLColor( 0, 117, 44, 255 ) 72 | #define SKYBLUE RLColor( 102, 191, 255, 255 ) 73 | #define BLUE RLColor( 0, 121, 241, 255 ) 74 | #define DARKBLUE RLColor( 0, 82, 172, 255 ) 75 | #define PURPLE RLColor( 200, 122, 255, 255 ) 76 | #define VIOLET RLColor( 135, 60, 190, 255 ) 77 | #define DARKPURPLE RLColor( 112, 31, 126, 255 ) 78 | #define BEIGE RLColor( 211, 176, 131, 255 ) 79 | #define BROWN RLColor( 127, 106, 79, 255 ) 80 | #define DARKBROWN RLColor( 76, 63, 47, 255 ) 81 | #define WHITE RLColor( 255, 255, 255, 255 ) 82 | #define BLACK RLColor( 0, 0, 0, 255 ) 83 | #define BLANK RLColor( 0, 0, 0, 0 ) 84 | #define MAGENTA RLColor( 255, 0, 255, 255 ) 85 | #define RAYWHITE RLColor( 245, 245, 245, 255 ) 86 | 87 | #ifndef Vector2 88 | type Vector2 89 | x as single 90 | y as single 91 | declare constructor() 92 | declare constructor(x as single, y as single) 93 | end type 94 | 95 | constructor Vector2(x as single, y as single) 96 | this.x = x 97 | this.y = y 98 | end constructor 99 | 100 | constructor Vector2() 101 | end constructor 102 | #endif 103 | 104 | #ifndef Vector3 105 | type Vector3 106 | x as single 107 | y as single 108 | z as single 109 | declare constructor() 110 | declare constructor(x as single, y as single, z as single) 111 | end type 112 | 113 | constructor Vector3() 114 | end constructor 115 | 116 | constructor Vector3(x as single, y as single, z as single) 117 | this.x = x 118 | this.y = y 119 | this.z = z 120 | end constructor 121 | #endif 122 | 123 | #ifndef Vector4 124 | type Vector4 125 | x as single 126 | y as single 127 | z as single 128 | w as single 129 | declare constructor() 130 | declare constructor(x as single, y as single, z as single, w as single) 131 | end type 132 | 133 | constructor Vector4() 134 | end constructor 135 | 136 | constructor Vector4(x as single, y as single, z as single, w as single) 137 | this.x = x 138 | this.y = y 139 | this.z = z 140 | this.w = w 141 | end constructor 142 | #endif 143 | 144 | #ifndef Quaternion 145 | type Quaternion as Vector4 146 | #endif 147 | 148 | #ifndef Matrix 149 | type Matrix 150 | m0 as single 151 | m4 as single 152 | m8 as single 153 | m12 as single 154 | m1 as single 155 | m5 as single 156 | m9 as single 157 | m13 as single 158 | m2 as single 159 | m6 as single 160 | m10 as single 161 | m14 as single 162 | m3 as single 163 | m7 as single 164 | m11 as single 165 | m15 as single 166 | end type 167 | #endif 168 | 169 | type RLColor 170 | r as ubyte 171 | g as ubyte 172 | b as ubyte 173 | a as ubyte 174 | declare constructor() 175 | declare constructor(r as ubyte, g as ubyte, b as ubyte, a as ubyte) 176 | end type 177 | 178 | constructor RLColor(r as ubyte, g as ubyte, b as ubyte, a as ubyte) 179 | this.r = r 180 | this.g = g 181 | this.b = b 182 | this.a = a 183 | end constructor 184 | 185 | constructor RLColor() 186 | end constructor 187 | 188 | type Rectangle 189 | x as single 190 | y as single 191 | width_ as single 192 | height_ as single 193 | declare constructor() 194 | declare constructor(x as single, y as single, width_ as single, height_ as single) 195 | end type 196 | 197 | constructor Rectangle() 198 | end constructor 199 | 200 | constructor Rectangle(x as single, y as single, width_ as single, height_ as single) 201 | this.x = x 202 | this.y = y 203 | this.width_ = width_ 204 | this.height_ = height_ 205 | end constructor 206 | 207 | type Image 208 | data_ as any ptr 209 | width_ as long 210 | height_ as long 211 | mipmaps as long 212 | format_ as long 213 | end type 214 | 215 | type Texture 216 | id as ulong 217 | width_ as long 218 | height_ as long 219 | mipmaps as long 220 | format_ as long 221 | end type 222 | 223 | type Texture2D as Texture 224 | type TextureCubemap as Texture 225 | 226 | type RenderTexture 227 | id as ulong 228 | texture as Texture 229 | depth as Texture 230 | end type 231 | 232 | type RenderTexture2D as RenderTexture 233 | 234 | type NPatchInfo 235 | source as Rectangle 236 | left_ as long 237 | top as long 238 | right_ as long 239 | bottom as long 240 | layout as long 241 | end type 242 | 243 | type GlyphInfo 244 | value as long 245 | offsetX as long 246 | offsetY as long 247 | advanceX as long 248 | image_ as Image 249 | end type 250 | 251 | type Font 252 | baseSize as long 253 | glyphCount as long 254 | glyphPadding as long 255 | texture as Texture2D 256 | recs as Rectangle ptr 257 | glyphs as GlyphInfo ptr 258 | end type 259 | 260 | type Camera3D 261 | position as Vector3 262 | target as Vector3 263 | up as Vector3 264 | fovy as single 265 | projection as long 266 | declare constructor() 267 | declare constructor(position as Vector3, target as Vector3, up as Vector3, fovy as single, projection as long) 268 | end type 269 | 270 | constructor Camera3D() 271 | end constructor 272 | 273 | constructor Camera3D(position as Vector3, target as Vector3, up as Vector3, fovy as single, projection as long) 274 | this.position = position 275 | this.target = target 276 | this.up = up 277 | this.fovy = fovy 278 | this.projection = projection 279 | end constructor 280 | 281 | type Camera as Camera3D 282 | 283 | type Camera2D 284 | offset as Vector2 285 | target as Vector2 286 | rotation as single 287 | zoom as single 288 | declare constructor() 289 | declare constructor(offset as Vector2, target as Vector2, rototation as single, zoom as single) 290 | end type 291 | 292 | constructor Camera2D() 293 | end constructor 294 | 295 | constructor Camera2D(offset as Vector2, target as Vector2, rotation as single, zoom as single) 296 | this.offset = offset 297 | this.target = target 298 | this.rotation = rotation 299 | this.zoom = zoom 300 | end constructor 301 | 302 | type Mesh 303 | vertexCount as long 304 | triangleCount as long 305 | vertices as single ptr 306 | texcoords as single ptr 307 | texcoords2 as single ptr 308 | normals as single ptr 309 | tangents as single ptr 310 | colors as ubyte ptr 311 | indices as ushort ptr 312 | animVertices as single ptr 313 | animNormals as single ptr 314 | boneIds as ubyte ptr 315 | boneWeights as single ptr 316 | vaoId as ulong 317 | vboId as ulong ptr 318 | end type 319 | 320 | type Shader 321 | id as ulong 322 | locs as long ptr 323 | end type 324 | 325 | type MaterialMap 326 | texture as Texture2D 327 | color as RLColor 328 | value as single 329 | end type 330 | 331 | type Material 332 | shader as Shader 333 | maps as MaterialMap ptr 334 | params(0 to 3) as single 335 | end type 336 | 337 | type Transform 338 | translation as Vector3 339 | rotation as Quaternion 340 | scale as Vector3 341 | end type 342 | 343 | type BoneInfo 344 | name_ as zstring * 32 345 | parent as long 346 | end type 347 | 348 | type Model 349 | transform as Matrix 350 | meshCount as long 351 | materialCount as long 352 | meshes as Mesh ptr 353 | materials as Material ptr 354 | meshMaterial as long ptr 355 | boneCount as long 356 | bones as BoneInfo ptr 357 | bindPose as Transform ptr 358 | end type 359 | 360 | type ModelAnimation 361 | boneCount as long 362 | frameCount as long 363 | bones as BoneInfo ptr 364 | framePoses as Transform ptr ptr 365 | end type 366 | 367 | type Ray 368 | position as Vector3 369 | direction as Vector3 370 | end type 371 | 372 | type RayCollision 373 | hit as boolean 374 | distance as single 375 | point_ as Vector3 376 | normal as Vector3 377 | end type 378 | 379 | type BoundingBox 380 | min as Vector3 381 | max as Vector3 382 | end type 383 | 384 | type Wave 385 | frameCount as ulong 386 | sampleRate as ulong 387 | sampleSize as ulong 388 | channels as ulong 389 | data_ as any ptr 390 | end type 391 | 392 | type rAudioBuffer as rAudioBuffer_ 393 | type rAudioProcessor as rAudioProcessor_ 394 | 395 | type AudioStream 396 | buffer as rAudioBuffer ptr 397 | processor as rAudioProcessor ptr 398 | sampleRate as ulong 399 | sampleSize as ulong 400 | channels as ulong 401 | end type 402 | 403 | type Sound 404 | stream as AudioStream 405 | frameCount as ulong 406 | end type 407 | 408 | type Music 409 | stream as AudioStream 410 | frameCount as ulong 411 | looping as boolean 412 | ctxType as long 413 | ctxData as any ptr 414 | end type 415 | 416 | type VrDeviceInfo 417 | hResolution as long 418 | vResolution as long 419 | hScreenSize as single 420 | vScreenSize as single 421 | vScreenCenter as single 422 | eyeToScreenDistance as single 423 | lensSeparationDistance as single 424 | interpupillaryDistance as single 425 | lensDistortionValues(0 to 3) as single 426 | chromaAbCorrection(0 to 3) as single 427 | end type 428 | 429 | type VrStereoConfig 430 | projection(0 to 1) as Matrix 431 | viewOffset(0 to 1) as Matrix 432 | leftLensCenter(0 to 1) as single 433 | rightLensCenter(0 to 1) as single 434 | leftScreenCenter(0 to 1) as single 435 | rightScreenCenter(0 to 1) as single 436 | scale(0 to 1) as single 437 | scaleIn(0 to 1) as single 438 | end type 439 | 440 | type FilePathList 441 | capacity as ulong 442 | count as ulong 443 | paths as zstring ptr ptr 444 | end type 445 | 446 | type AutomationEvent 447 | frame as ulong 448 | type_ as ulong 449 | params(0 to 4) as long 450 | end type 451 | 452 | type AutomationEventList 453 | capacity as ulong 454 | count as ulong 455 | events as AutomationEvent ptr 456 | end type 457 | 458 | type ConfigFlags as long 459 | enum 460 | FLAG_VSYNC_HINT = &h00000040 461 | FLAG_FULLSCREEN_MODE = &h00000002 462 | FLAG_WINDOW_RESIZABLE = &h00000004 463 | FLAG_WINDOW_UNDECORATED = &h00000008 464 | FLAG_WINDOW_HIDDEN = &h00000080 465 | FLAG_WINDOW_MINIMIZED = &h00000200 466 | FLAG_WINDOW_MAXIMIZED = &h00000400 467 | FLAG_WINDOW_UNFOCUSED = &h00000800 468 | FLAG_WINDOW_TOPMOST = &h00001000 469 | FLAG_WINDOW_ALWAYS_RUN = &h00000100 470 | FLAG_WINDOW_TRANSPARENT = &h00000010 471 | FLAG_WINDOW_HIGHDPI = &h00002000 472 | FLAG_WINDOW_MOUSE_PASSTHROUGH = &h00004000 473 | FLAG_MSAA_4X_HINT = &h00000020 474 | FLAG_INTERLACED_HINT = &h00010000 475 | end enum 476 | 477 | type TraceLogLevel as long 478 | enum 479 | LOG_ALL = 0 480 | LOG_TRACE 481 | LOG_DEBUG 482 | LOG_INFO 483 | LOG_WARNING 484 | LOG_ERROR 485 | LOG_FATAL 486 | LOG_NONE 487 | end enum 488 | 489 | type KeyboardKey as long 490 | enum 491 | KEY_NULL = 0 492 | KEY_APOSTROPHE = 39 493 | KEY_COMMA = 44 494 | KEY_MINUS = 45 495 | KEY_PERIOD = 46 496 | KEY_SLASH = 47 497 | KEY_ZERO = 48 498 | KEY_ONE = 49 499 | KEY_TWO = 50 500 | KEY_THREE = 51 501 | KEY_FOUR = 52 502 | KEY_FIVE = 53 503 | KEY_SIX = 54 504 | KEY_SEVEN = 55 505 | KEY_EIGHT = 56 506 | KEY_NINE = 57 507 | KEY_SEMICOLON = 59 508 | KEY_EQUAL = 61 509 | KEY_A = 65 510 | KEY_B = 66 511 | KEY_C = 67 512 | KEY_D = 68 513 | KEY_E = 69 514 | KEY_F = 70 515 | KEY_G = 71 516 | KEY_H = 72 517 | KEY_I = 73 518 | KEY_J = 74 519 | KEY_K = 75 520 | KEY_L = 76 521 | KEY_M = 77 522 | KEY_N = 78 523 | KEY_O = 79 524 | KEY_P = 80 525 | KEY_Q = 81 526 | KEY_R = 82 527 | KEY_S = 83 528 | KEY_T = 84 529 | KEY_U = 85 530 | KEY_V = 86 531 | KEY_W = 87 532 | KEY_X = 88 533 | KEY_Y = 89 534 | KEY_Z = 90 535 | KEY_LEFT_BRACKET = 91 536 | KEY_BACKSLASH = 92 537 | KEY_RIGHT_BRACKET = 93 538 | KEY_GRAVE = 96 539 | KEY_SPACE = 32 540 | KEY_ESCAPE = 256 541 | KEY_ENTER = 257 542 | KEY_TAB = 258 543 | KEY_BACKSPACE = 259 544 | KEY_INSERT = 260 545 | KEY_DELETE = 261 546 | KEY_RIGHT = 262 547 | KEY_LEFT = 263 548 | KEY_DOWN = 264 549 | KEY_UP = 265 550 | KEY_PAGE_UP = 266 551 | KEY_PAGE_DOWN = 267 552 | KEY_HOME = 268 553 | KEY_END = 269 554 | KEY_CAPS_LOCK = 280 555 | KEY_SCROLL_LOCK = 281 556 | KEY_NUM_LOCK = 282 557 | KEY_PRINT_SCREEN = 283 558 | KEY_PAUSE = 284 559 | KEY_F1 = 290 560 | KEY_F2 = 291 561 | KEY_F3 = 292 562 | KEY_F4 = 293 563 | KEY_F5 = 294 564 | KEY_F6 = 295 565 | KEY_F7 = 296 566 | KEY_F8 = 297 567 | KEY_F9 = 298 568 | KEY_F10 = 299 569 | KEY_F11 = 300 570 | KEY_F12 = 301 571 | KEY_LEFT_SHIFT = 340 572 | KEY_LEFT_CONTROL = 341 573 | KEY_LEFT_ALT = 342 574 | KEY_LEFT_SUPER = 343 575 | KEY_RIGHT_SHIFT = 344 576 | KEY_RIGHT_CONTROL = 345 577 | KEY_RIGHT_ALT = 346 578 | KEY_RIGHT_SUPER = 347 579 | KEY_KB_MENU = 348 580 | KEY_KP_0 = 320 581 | KEY_KP_1 = 321 582 | KEY_KP_2 = 322 583 | KEY_KP_3 = 323 584 | KEY_KP_4 = 324 585 | KEY_KP_5 = 325 586 | KEY_KP_6 = 326 587 | KEY_KP_7 = 327 588 | KEY_KP_8 = 328 589 | KEY_KP_9 = 329 590 | KEY_KP_DECIMAL = 330 591 | KEY_KP_DIVIDE = 331 592 | KEY_KP_MULTIPLY = 332 593 | KEY_KP_SUBTRACT = 333 594 | KEY_KP_ADD = 334 595 | KEY_KP_ENTER = 335 596 | KEY_KP_EQUAL = 336 597 | KEY_BACK = 4 598 | KEY_MENU = 82 599 | KEY_VOLUME_UP = 24 600 | KEY_VOLUME_DOWN = 25 601 | end enum 602 | 603 | type MouseButton as long 604 | enum 605 | MOUSE_BUTTON_LEFT = 0 606 | MOUSE_BUTTON_RIGHT = 1 607 | MOUSE_BUTTON_MIDDLE = 2 608 | MOUSE_BUTTON_SIDE = 3 609 | MOUSE_BUTTON_EXTRA = 4 610 | MOUSE_BUTTON_FORWARD = 5 611 | MOUSE_BUTTON_BACK = 6 612 | end enum 613 | 614 | const MOUSE_MIDDLE_BUTTON = MOUSE_BUTTON_MIDDLE 615 | const MOUSE_RIGHT_BUTTON = MOUSE_BUTTON_RIGHT 616 | const MOUSE_LEFT_BUTTON = MOUSE_BUTTON_LEFT 617 | 618 | type MouseCursor as long 619 | enum 620 | MOUSE_CURSOR_DEFAULT = 0 621 | MOUSE_CURSOR_ARROW = 1 622 | MOUSE_CURSOR_IBEAM = 2 623 | MOUSE_CURSOR_CROSSHAIR = 3 624 | MOUSE_CURSOR_POINTING_HAND = 4 625 | MOUSE_CURSOR_RESIZE_EW = 5 626 | MOUSE_CURSOR_RESIZE_NS = 6 627 | MOUSE_CURSOR_RESIZE_NWSE = 7 628 | MOUSE_CURSOR_RESIZE_NESW = 8 629 | MOUSE_CURSOR_RESIZE_ALL = 9 630 | MOUSE_CURSOR_NOT_ALLOWED = 10 631 | end enum 632 | 633 | type GamepadButton as long 634 | enum 635 | GAMEPAD_BUTTON_UNKNOWN = 0 636 | GAMEPAD_BUTTON_LEFT_FACE_UP 637 | GAMEPAD_BUTTON_LEFT_FACE_RIGHT 638 | GAMEPAD_BUTTON_LEFT_FACE_DOWN 639 | GAMEPAD_BUTTON_LEFT_FACE_LEFT 640 | GAMEPAD_BUTTON_RIGHT_FACE_UP 641 | GAMEPAD_BUTTON_RIGHT_FACE_RIGHT 642 | GAMEPAD_BUTTON_RIGHT_FACE_DOWN 643 | GAMEPAD_BUTTON_RIGHT_FACE_LEFT 644 | GAMEPAD_BUTTON_LEFT_TRIGGER_1 645 | GAMEPAD_BUTTON_LEFT_TRIGGER_2 646 | GAMEPAD_BUTTON_RIGHT_TRIGGER_1 647 | GAMEPAD_BUTTON_RIGHT_TRIGGER_2 648 | GAMEPAD_BUTTON_MIDDLE_LEFT 649 | GAMEPAD_BUTTON_MIDDLE 650 | GAMEPAD_BUTTON_MIDDLE_RIGHT 651 | GAMEPAD_BUTTON_LEFT_THUMB 652 | GAMEPAD_BUTTON_RIGHT_THUMB 653 | end enum 654 | 655 | type GamepadAxis as long 656 | enum 657 | GAMEPAD_AXIS_LEFT_X = 0 658 | GAMEPAD_AXIS_LEFT_Y = 1 659 | GAMEPAD_AXIS_RIGHT_X = 2 660 | GAMEPAD_AXIS_RIGHT_Y = 3 661 | GAMEPAD_AXIS_LEFT_TRIGGER = 4 662 | GAMEPAD_AXIS_RIGHT_TRIGGER = 5 663 | end enum 664 | 665 | type MaterialMapIndex as long 666 | enum 667 | MATERIAL_MAP_ALBEDO = 0 668 | MATERIAL_MAP_METALNESS 669 | MATERIAL_MAP_NORMAL 670 | MATERIAL_MAP_ROUGHNESS 671 | MATERIAL_MAP_OCCLUSION 672 | MATERIAL_MAP_EMISSION 673 | MATERIAL_MAP_HEIGHT 674 | MATERIAL_MAP_CUBEMAP 675 | MATERIAL_MAP_IRRADIANCE 676 | MATERIAL_MAP_PREFILTER 677 | MATERIAL_MAP_BRDF 678 | end enum 679 | 680 | const MATERIAL_MAP_DIFFUSE = MATERIAL_MAP_ALBEDO 681 | const MATERIAL_MAP_SPECULAR = MATERIAL_MAP_METALNESS 682 | 683 | type ShaderLocationIndex as long 684 | enum 685 | SHADER_LOC_VERTEX_POSITION = 0 686 | SHADER_LOC_VERTEX_TEXCOORD01 687 | SHADER_LOC_VERTEX_TEXCOORD02 688 | SHADER_LOC_VERTEX_NORMAL 689 | SHADER_LOC_VERTEX_TANGENT 690 | SHADER_LOC_VERTEX_COLOR 691 | SHADER_LOC_MATRIX_MVP 692 | SHADER_LOC_MATRIX_VIEW 693 | SHADER_LOC_MATRIX_PROJECTION 694 | SHADER_LOC_MATRIX_MODEL 695 | SHADER_LOC_MATRIX_NORMAL 696 | SHADER_LOC_VECTOR_VIEW 697 | SHADER_LOC_COLOR_DIFFUSE 698 | SHADER_LOC_COLOR_SPECULAR 699 | SHADER_LOC_COLOR_AMBIENT 700 | SHADER_LOC_MAP_ALBEDO 701 | SHADER_LOC_MAP_METALNESS 702 | SHADER_LOC_MAP_NORMAL 703 | SHADER_LOC_MAP_ROUGHNESS 704 | SHADER_LOC_MAP_OCCLUSION 705 | SHADER_LOC_MAP_EMISSION 706 | SHADER_LOC_MAP_HEIGHT 707 | SHADER_LOC_MAP_CUBEMAP 708 | SHADER_LOC_MAP_IRRADIANCE 709 | SHADER_LOC_MAP_PREFILTER 710 | SHADER_LOC_MAP_BRDF 711 | end enum 712 | 713 | const SHADER_LOC_MAP_DIFFUSE = SHADER_LOC_MAP_ALBEDO 714 | const SHADER_LOC_MAP_SPECULAR = SHADER_LOC_MAP_METALNESS 715 | 716 | type ShaderUniformDataType as long 717 | enum 718 | SHADER_UNIFORM_FLOAT = 0 719 | SHADER_UNIFORM_VEC2 720 | SHADER_UNIFORM_VEC3 721 | SHADER_UNIFORM_VEC4 722 | SHADER_UNIFORM_INT 723 | SHADER_UNIFORM_IVEC2 724 | SHADER_UNIFORM_IVEC3 725 | SHADER_UNIFORM_IVEC4 726 | SHADER_UNIFORM_SAMPLER2D 727 | end enum 728 | 729 | type ShaderAttributeDataType as long 730 | enum 731 | SHADER_ATTRIB_FLOAT = 0 732 | SHADER_ATTRIB_VEC2 733 | SHADER_ATTRIB_VEC3 734 | SHADER_ATTRIB_VEC4 735 | end enum 736 | 737 | type PixelFormat as long 738 | enum 739 | PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 740 | PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA 741 | PIXELFORMAT_UNCOMPRESSED_R5G6B5 742 | PIXELFORMAT_UNCOMPRESSED_R8G8B8 743 | PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 744 | PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 745 | PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 746 | PIXELFORMAT_UNCOMPRESSED_R32 747 | PIXELFORMAT_UNCOMPRESSED_R32G32B32 748 | PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 749 | PIXELFORMAT_UNCOMPRESSED_R16 750 | PIXELFORMAT_UNCOMPRESSED_R16G16B16 751 | PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 752 | PIXELFORMAT_COMPRESSED_DXT1_RGB 753 | PIXELFORMAT_COMPRESSED_DXT1_RGBA 754 | PIXELFORMAT_COMPRESSED_DXT3_RGBA 755 | PIXELFORMAT_COMPRESSED_DXT5_RGBA 756 | PIXELFORMAT_COMPRESSED_ETC1_RGB 757 | PIXELFORMAT_COMPRESSED_ETC2_RGB 758 | PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA 759 | PIXELFORMAT_COMPRESSED_PVRT_RGB 760 | PIXELFORMAT_COMPRESSED_PVRT_RGBA 761 | PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA 762 | PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA 763 | end enum 764 | 765 | type TextureFilter as long 766 | enum 767 | TEXTURE_FILTER_POINT = 0 768 | TEXTURE_FILTER_BILINEAR 769 | TEXTURE_FILTER_TRILINEAR 770 | TEXTURE_FILTER_ANISOTROPIC_4X 771 | TEXTURE_FILTER_ANISOTROPIC_8X 772 | TEXTURE_FILTER_ANISOTROPIC_16X 773 | end enum 774 | 775 | type TextureWrap as long 776 | enum 777 | TEXTURE_WRAP_REPEAT = 0 778 | TEXTURE_WRAP_CLAMP 779 | TEXTURE_WRAP_MIRROR_REPEAT 780 | TEXTURE_WRAP_MIRROR_CLAMP 781 | end enum 782 | 783 | type CubemapLayout as long 784 | enum 785 | CUBEMAP_LAYOUT_AUTO_DETECT = 0 786 | CUBEMAP_LAYOUT_LINE_VERTICAL 787 | CUBEMAP_LAYOUT_LINE_HORIZONTAL 788 | CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR 789 | CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE 790 | CUBEMAP_LAYOUT_PANORAMA 791 | end enum 792 | 793 | type FontType as long 794 | enum 795 | FONT_DEFAULT = 0 796 | FONT_BITMAP 797 | FONT_SDF 798 | end enum 799 | 800 | type BlendMode as long 801 | enum 802 | BLEND_ALPHA = 0 803 | BLEND_ADDITIVE 804 | BLEND_MULTIPLIED 805 | BLEND_ADD_COLORS 806 | BLEND_SUBTRACT_COLORS 807 | BLEND_ALPHA_PREMULTIPLY 808 | BLEND_CUSTOM 809 | BLEND_CUSTOM_SEPARATE 810 | end enum 811 | 812 | type Gesture as long 813 | enum 814 | GESTURE_NONE = 0 815 | GESTURE_TAP = 1 816 | GESTURE_DOUBLETAP = 2 817 | GESTURE_HOLD = 4 818 | GESTURE_DRAG = 8 819 | GESTURE_SWIPE_RIGHT = 16 820 | GESTURE_SWIPE_LEFT = 32 821 | GESTURE_SWIPE_UP = 64 822 | GESTURE_SWIPE_DOWN = 128 823 | GESTURE_PINCH_IN = 256 824 | GESTURE_PINCH_OUT = 512 825 | end enum 826 | 827 | type CameraMode as long 828 | enum 829 | CAMERA_CUSTOM = 0 830 | CAMERA_FREE 831 | CAMERA_ORBITAL 832 | CAMERA_FIRST_PERSON 833 | CAMERA_THIRD_PERSON 834 | end enum 835 | 836 | type CameraProjection as long 837 | enum 838 | CAMERA_PERSPECTIVE = 0 839 | CAMERA_ORTHOGRAPHIC 840 | end enum 841 | 842 | type NPatchLayout as long 843 | enum 844 | NPATCH_NINE_PATCH = 0 845 | NPATCH_THREE_PATCH_VERTICAL 846 | NPATCH_THREE_PATCH_HORIZONTAL 847 | end enum 848 | 849 | type TraceLogCallback as sub(byval logLevel as long, byval text as const zstring ptr, byval args as va_list) 850 | 851 | type LoadFileDataCallback as function(byval fileName as const zstring ptr, byval dataSize as long ptr) as ubyte ptr 852 | 853 | type SaveFileDataCallback as function(byval fileName as const zstring ptr, byval data_ as any ptr, byval dataSize as long) as boolean 854 | 855 | type LoadFileTextCallback as function(byval fileName as const zstring ptr) as zstring ptr 856 | 857 | type SaveFileTextCallback as function(byval fileName as const zstring ptr, byval text as zstring ptr) as boolean 858 | 859 | declare sub InitWindow(byval width_ as long, byval height_ as long, byval title as const zstring ptr) 860 | declare function WindowShouldClose() as boolean 861 | declare sub CloseWindow() 862 | declare function IsWindowReady() as boolean 863 | declare function IsWindowFullscreen() as boolean 864 | declare function IsWindowHidden() as boolean 865 | declare function IsWindowMinimized() as boolean 866 | declare function IsWindowMaximized() as boolean 867 | declare function IsWindowFocused() as boolean 868 | declare function IsWindowResized() as boolean 869 | declare function IsWindowState(byval flag as ulong) as boolean 870 | declare sub SetWindowState(byval flags as ulong) 871 | declare sub ClearWindowState(byval flags as ulong) 872 | declare sub ToggleFullscreen() 873 | declare sub ToggleBorderlessWindow() 874 | declare sub MaximizeWindow() 875 | declare sub MinimizeWindow() 876 | declare sub RestoreWindow() 877 | declare sub SetWindowIcon(byval image_ as Image) 878 | declare sub SetWindowIcons(byval images as Image ptr, byval count as long) 879 | declare sub SetWindowTitle(byval title as const zstring ptr) 880 | declare sub SetWindowPosition(byval x as long, byval y as long) 881 | declare sub SetWindowMonitor(byval monitor as long) 882 | declare sub SetWindowMinSize(byval width_ as long, byval height_ as long) 883 | declare sub SetWindowMaxSize(byval width_ as long, byval height_ as long) 884 | declare sub SetWindowSize(byval width_ as long, byval height_ as long) 885 | declare sub SetWindowOpacity(byval opacity as single) 886 | declare sub SetWindowFocused() 887 | declare function GetWindowHandle() as any ptr 888 | declare function GetScreenWidth() as long 889 | declare function GetScreenHeight() as long 890 | declare function GetRenderWidth() as long 891 | declare function GetRenderHeight() as long 892 | declare function GetMonitorCount() as long 893 | declare function GetCurrentMonitor() as long 894 | declare function GetMonitorPosition(byval monitor as long) as Vector2 895 | declare function GetMonitorWidth(byval monitor as long) as long 896 | declare function GetMonitorHeight(byval monitor as long) as long 897 | declare function GetMonitorPhysicalWidth(byval monitor as long) as long 898 | declare function GetMonitorPhysicalHeight(byval monitor as long) as long 899 | declare function GetMonitorRefreshRate(byval monitor as long) as long 900 | declare function GetWindowPosition() as Vector2 901 | declare function GetWindowScaleDPI() as Vector2 902 | declare function GetMonitorName(byval monitor as long) as const zstring ptr 903 | declare sub SetClipboardText(byval text as const zstring ptr) 904 | declare function GetClipboardText() as const zstring ptr 905 | declare sub EnableEventWaiting() 906 | declare sub DisableEventWaiting() 907 | declare sub SwapScreenBuffer() 908 | declare sub PollInputEvents() 909 | declare sub WaitTime(byval seconds as double) 910 | declare sub ShowCursor() 911 | declare sub HideCursor() 912 | declare function IsCursorHidden() as boolean 913 | declare sub EnableCursor() 914 | declare sub DisableCursor() 915 | declare function IsCursorOnScreen() as boolean 916 | declare sub ClearBackground(byval color as RLColor) 917 | declare sub BeginDrawing() 918 | declare sub EndDrawing() 919 | declare sub BeginMode2D(byval camera as Camera2D) 920 | declare sub EndMode2D() 921 | declare sub BeginMode3D(byval camera as Camera3D) 922 | declare sub EndMode3D() 923 | declare sub BeginTextureMode(byval target as RenderTexture2D) 924 | declare sub EndTextureMode() 925 | declare sub BeginShaderMode(byval shader as Shader) 926 | declare sub EndShaderMode() 927 | declare sub BeginBlendMode(byval mode as long) 928 | declare sub EndBlendMode() 929 | declare sub BeginScissorMode(byval x as long, byval y as long, byval width_ as long, byval height_ as long) 930 | declare sub EndScissorMode() 931 | declare sub BeginVrStereoMode(byval config as VrStereoConfig) 932 | declare sub EndVrStereoMode() 933 | declare function LoadVrStereoConfig(byval device as VrDeviceInfo) as VrStereoConfig 934 | declare sub UnloadVrStereoConfig(byval config as VrStereoConfig) 935 | declare function LoadShader(byval vsFileName as const zstring ptr, byval fsFileName as const zstring ptr) as Shader 936 | declare function LoadShaderFromMemory(byval vsCode as const zstring ptr, byval fsCode as const zstring ptr) as Shader 937 | declare function IsShaderReady(byval shader as Shader) as byte 938 | declare function GetShaderLocation(byval shader as Shader, byval uniformName as const zstring ptr) as long 939 | declare function GetShaderLocationAttrib(byval shader as Shader, byval attribName as const zstring ptr) as long 940 | declare sub SetShaderValue(byval shader as Shader, byval locIndex as long, byval value as const any ptr, byval uniformType as long) 941 | declare sub SetShaderValueV(byval shader as Shader, byval locIndex as long, byval value as const any ptr, byval uniformType as long, byval count as long) 942 | declare sub SetShaderValueMatrix(byval shader as Shader, byval locIndex as long, byval mat as Matrix) 943 | declare sub SetShaderValueTexture(byval shader as Shader, byval locIndex as long, byval texture as Texture2D) 944 | declare sub UnloadShader(byval shader as Shader) 945 | declare function GetMouseRay(byval mousePosition as Vector2, byval camera as Camera) as Ray 946 | declare function GetCameraMatrix(byval camera as Camera) as Matrix 947 | declare function GetCameraMatrix2D(byval camera as Camera2D) as Matrix 948 | declare function GetWorldToScreen(byval position as Vector3, byval camera as Camera) as Vector2 949 | declare function GetScreenToWorld2D(byval position as Vector2, byval camera as Camera2D) as Vector2 950 | declare function GetWorldToScreenEx(byval position as Vector3, byval camera as Camera, byval width_ as long, byval height_ as long) as Vector2 951 | declare function GetWorldToScreen2D(byval position as Vector2, byval camera as Camera2D) as Vector2 952 | declare sub SetTargetFPS(byval fps as long) 953 | declare function GetFPS() as long 954 | declare function GetFrameTime() as single 955 | declare function GetTime() as double 956 | declare function GetRandomValue(byval min as long, byval max as long) as long 957 | declare sub SetRandomSeed(byval seed as ulong) 958 | declare sub TakeScreenshot(byval fileName as const zstring ptr) 959 | declare sub SetConfigFlags(byval flags as ulong) 960 | declare sub TraceLog(byval logLevel as long, byval text as const zstring ptr, ...) 961 | declare sub SetTraceLogLevel(byval logLevel as long) 962 | declare function MemAlloc(byval size as long) as any ptr 963 | declare function MemRealloc(byval ptr as any ptr, byval size as long) as any ptr 964 | declare sub MemFree(byval ptr as any ptr) 965 | declare sub OpenURL(byval url as const zstring ptr) 966 | declare sub SetTraceLogCallback(byval callback as TraceLogCallback) 967 | declare sub SetLoadFileDataCallback(byval callback as LoadFileDataCallback) 968 | declare sub SetSaveFileDataCallback(byval callback as SaveFileDataCallback) 969 | declare sub SetLoadFileTextCallback(byval callback as LoadFileTextCallback) 970 | declare sub SetSaveFileTextCallback(byval callback as SaveFileTextCallback) 971 | declare function LoadFileData(byval fileName as const zstring ptr, byval dataSize as long ptr) as ubyte ptr 972 | declare sub UnloadFileData(byval data_ as ubyte ptr) 973 | declare function SaveFileData(byval fileName as const zstring ptr, byval data_ as any ptr, byval dataSize as long) as boolean 974 | declare function ExportDataAsCode(byval data_ as const zstring ptr, byval dataSize as long, byval fileName as const zstring ptr) as boolean 975 | declare function LoadFileText(byval fileName as const zstring ptr) as zstring ptr 976 | declare sub UnloadFileText(byval text as zstring ptr) 977 | declare function SaveFileText(byval fileName as const zstring ptr, byval text as zstring ptr) as boolean 978 | declare function FileExists(byval fileName as const zstring ptr) as boolean 979 | declare function DirectoryExists(byval dirPath as const zstring ptr) as boolean 980 | declare function IsFileExtension(byval fileName as const zstring ptr, byval ext as const zstring ptr) as boolean 981 | declare function GetFileLength(byval fileName as const zstring ptr) as long 982 | declare function GetFileExtension(byval fileName as const zstring ptr) as const zstring ptr 983 | declare function GetFileName(byval filePath as const zstring ptr) as const zstring ptr 984 | declare function GetFileNameWithoutExt(byval filePath as const zstring ptr) as const zstring ptr 985 | declare function GetDirectoryPath(byval filePath as const zstring ptr) as const zstring ptr 986 | declare function GetPrevDirectoryPath(byval dirPath as const zstring ptr) as const zstring ptr 987 | declare function GetWorkingDirectory() as const zstring ptr 988 | declare function GetApplicationDirectory() as const zstring ptr 989 | declare function ChangeDirectory(byval dir_ as const zstring ptr) as boolean 990 | declare function IsPathFile(byval path as const zstring ptr) as boolean 991 | declare function LoadDirectoryFiles(byval dirPath as const zstring ptr) as FilePathList 992 | declare function LoadDirectoryFilesEx(byval basePath as const zstring ptr, byval filter as const zstring ptr, byval scanSubdirs as boolean) as FilePathList 993 | declare sub UnloadDirectoryFiles(byval files as FilePathList) 994 | declare function IsFileDropped() as boolean 995 | declare function LoadDroppedFiles() as FilePathList 996 | declare sub UnloadDroppedFiles(byval files as FilePathList) 997 | declare function GetFileModTime(byval fileName as const zstring ptr) as clong 998 | declare function CompressData(byval data_ as const ubyte ptr, byval dataSize as long, byval compDataSize as long ptr) as ubyte ptr 999 | declare function DecompressData(byval compData as const ubyte ptr, byval compDataSize as long, byval dataSize as long ptr) as ubyte ptr 1000 | declare function EncodeDataBase64(byval data_ as const ubyte ptr, byval dataSize as long, byval outputSize as long ptr) as zstring ptr 1001 | declare function DecodeDataBase64(byval data_ as const ubyte ptr, byval outputSize as long ptr) as ubyte ptr 1002 | 1003 | declare function LoadAutomationEventList(byval fileName as const zstring ptr) as AutomationEventList 1004 | declare sub UnloadAutomationEventList(byval list_ as AutomationEventList ptr) 1005 | declare function ExportAutomationEventList(byval list_ as AutomationEventList, byval fileName as const zstring ptr) as boolean 1006 | declare sub SetAutomationEventList(byval list_ as AutomationEventList ptr) 1007 | declare sub SetAutomationEventBaseFrame(byval frame_ as long) 1008 | declare sub StartAutomationEventRecording() 1009 | declare sub StopAutomationEventRecording() 1010 | declare sub PlayAutomationEvent(byval frame_ as AutomationEvent) 1011 | 1012 | 1013 | declare function IsKeyPressed(byval key as long) as boolean 1014 | declare function IsKeyPressedRepeat(byval key as long) as boolean 1015 | declare function IsKeyDown(byval key as long) as boolean 1016 | declare function IsKeyReleased(byval key as long) as boolean 1017 | declare function IsKeyUp(byval key as long) as boolean 1018 | declare sub SetExitKey(byval key as long) 1019 | declare function GetKeyPressed() as long 1020 | declare function GetCharPressed() as long 1021 | declare function IsGamepadAvailable(byval gamepad as long) as boolean 1022 | declare function GetGamepadName(byval gamepad as long) as const zstring ptr 1023 | declare function IsGamepadButtonPressed(byval gamepad as long, byval button as long) as boolean 1024 | declare function IsGamepadButtonDown(byval gamepad as long, byval button as long) as boolean 1025 | declare function IsGamepadButtonReleased(byval gamepad as long, byval button as long) as boolean 1026 | declare function IsGamepadButtonUp(byval gamepad as long, byval button as long) as boolean 1027 | declare function GetGamepadButtonPressed() as long 1028 | declare function GetGamepadAxisCount(byval gamepad as long) as long 1029 | declare function GetGamepadAxisMovement(byval gamepad as long, byval axis as long) as single 1030 | declare function SetGamepadMappings(byval mappings as const zstring ptr) as long 1031 | declare function IsMouseButtonPressed(byval button as long) as boolean 1032 | declare function IsMouseButtonDown(byval button as long) as boolean 1033 | declare function IsMouseButtonReleased(byval button as long) as boolean 1034 | declare function IsMouseButtonUp(byval button as long) as boolean 1035 | declare function GetMouseX() as long 1036 | declare function GetMouseY() as long 1037 | declare function GetMousePosition() as Vector2 1038 | declare function GetMouseDelta() as Vector2 1039 | declare sub SetMousePosition(byval x as long, byval y as long) 1040 | declare sub SetMouseOffset(byval offsetX as long, byval offsetY as long) 1041 | declare sub SetMouseScale(byval scaleX as single, byval scaleY as single) 1042 | declare function GetMouseWheelMove() as single 1043 | declare function GetMouseWheelMoveV() as Vector2 1044 | declare sub SetMouseCursor(byval cursor as long) 1045 | declare function GetTouchX() as long 1046 | declare function GetTouchY() as long 1047 | declare function GetTouchPosition(byval index as long) as Vector2 1048 | declare function GetTouchPointId(byval index as long) as long 1049 | declare function GetTouchPointCount() as long 1050 | declare sub SetGesturesEnabled(byval flags as ulong) 1051 | declare function IsGestureDetected(byval gesture as ulong) as boolean 1052 | declare function GetGestureDetected() as long 1053 | declare function GetGestureHoldDuration() as single 1054 | declare function GetGestureDragVector() as Vector2 1055 | declare function GetGestureDragAngle() as single 1056 | declare function GetGesturePinchVector() as Vector2 1057 | declare function GetGesturePinchAngle() as single 1058 | declare sub UpdateCamera(byval camera as Camera ptr, byval mode as long) 1059 | declare sub UpdateCameraPro(byval camera as Camera ptr, byval movement as Vector3, byval rotation as Vector3, byval zoom as single) 1060 | declare sub SetShapesTexture(byval texture as Texture2D, byval source as Rectangle) 1061 | declare sub DrawPixel(byval posX as long, byval posY as long, byval color as RLColor) 1062 | declare sub DrawPixelV(byval position as Vector2, byval color as RLColor) 1063 | declare sub DrawLine(byval startPosX as long, byval startPosY as long, byval endPosX as long, byval endPosY as long, byval color as RLColor) 1064 | declare sub DrawLineV(byval startPos as Vector2, byval endPos as Vector2, byval color as RLColor) 1065 | declare sub DrawLineEx(byval startPos as Vector2, byval endPos as Vector2, byval thick as single, byval color as RLColor) 1066 | declare sub DrawLineBezier(byval startPos as Vector2, byval endPos as Vector2, byval thick as single, byval color as RLColor) 1067 | declare sub DrawLineBezierQuad(byval startPos as Vector2, byval endPos as Vector2, byval controlPos as Vector2, byval thick as single, byval color as RLColor) 1068 | declare sub DrawLineBezierCubic(byval startPos as Vector2, byval endPos as Vector2, byval startControlPos as Vector2, byval endControlPos as Vector2, byval thick as single, byval color as RLColor) 1069 | declare sub DrawLineStrip(byval points as Vector2 ptr, byval pointCount as long, byval color as RLColor) 1070 | declare sub DrawCircle(byval centerX as long, byval centerY as long, byval radius as single, byval color as RLColor) 1071 | declare sub DrawCircleSector(byval center as Vector2, byval radius as single, byval startAngle as single, byval endAngle as single, byval segments as long, byval color as RLColor) 1072 | declare sub DrawCircleSectorLines(byval center as Vector2, byval radius as single, byval startAngle as single, byval endAngle as single, byval segments as long, byval color as RLColor) 1073 | declare sub DrawCircleGradient(byval centerX as long, byval centerY as long, byval radius as single, byval color1 as RLColor, byval color2 as RLColor) 1074 | declare sub DrawCircleV(byval center as Vector2, byval radius as single, byval color as RLColor) 1075 | declare sub DrawCircleLines(byval centerX as long, byval centerY as long, byval radius as single, byval color as RLColor) 1076 | declare sub DrawEllipse(byval centerX as long, byval centerY as long, byval radiusH as single, byval radiusV as single, byval color as RLColor) 1077 | declare sub DrawEllipseLines(byval centerX as long, byval centerY as long, byval radiusH as single, byval radiusV as single, byval color as RLColor) 1078 | declare sub DrawRing(byval center as Vector2, byval innerRadius as single, byval outerRadius as single, byval startAngle as single, byval endAngle as single, byval segments as long, byval color as RLColor) 1079 | declare sub DrawRingLines(byval center as Vector2, byval innerRadius as single, byval outerRadius as single, byval startAngle as single, byval endAngle as single, byval segments as long, byval color as RLColor) 1080 | declare sub DrawRectangle(byval posX as long, byval posY as long, byval width_ as long, byval height_ as long, byval color as RLColor) 1081 | declare sub DrawRectangleV(byval position as Vector2, byval size as Vector2, byval color as RLColor) 1082 | declare sub DrawRectangleRec(byval rec as Rectangle, byval color as RLColor) 1083 | declare sub DrawRectanglePro(byval rec as Rectangle, byval origin as Vector2, byval rotation as single, byval color as RLColor) 1084 | declare sub DrawRectangleGradientV(byval posX as long, byval posY as long, byval width_ as long, byval height_ as long, byval color1 as RLColor, byval color2 as RLColor) 1085 | declare sub DrawRectangleGradientH(byval posX as long, byval posY as long, byval width_ as long, byval height_ as long, byval color1 as RLColor, byval color2 as RLColor) 1086 | declare sub DrawRectangleGradientEx(byval rec as Rectangle, byval col1 as RLColor, byval col2 as RLColor, byval col3 as RLColor, byval col4 as RLColor) 1087 | declare sub DrawRectangleLines(byval posX as long, byval posY as long, byval width_ as long, byval height_ as long, byval color as RLColor) 1088 | declare sub DrawRectangleLinesEx(byval rec as Rectangle, byval lineThick as single, byval color as RLColor) 1089 | declare sub DrawRectangleRounded(byval rec as Rectangle, byval roundness as single, byval segments as long, byval color as RLColor) 1090 | declare sub DrawRectangleRoundedLines(byval rec as Rectangle, byval roundness as single, byval segments as long, byval lineThick as single, byval color as RLColor) 1091 | declare sub DrawTriangle(byval v1 as Vector2, byval v2 as Vector2, byval v3 as Vector2, byval color as RLColor) 1092 | declare sub DrawTriangleLines(byval v1 as Vector2, byval v2 as Vector2, byval v3 as Vector2, byval color as RLColor) 1093 | declare sub DrawTriangleFan(byval points as Vector2 ptr, byval pointCount as long, byval color as RLColor) 1094 | declare sub DrawTriangleStrip(byval points as Vector2 ptr, byval pointCount as long, byval color as RLColor) 1095 | declare sub DrawPoly(byval center as Vector2, byval sides as long, byval radius as single, byval rotation as single, byval color as RLColor) 1096 | declare sub DrawPolyLines(byval center as Vector2, byval sides as long, byval radius as single, byval rotation as single, byval color as RLColor) 1097 | declare sub DrawPolyLinesEx(byval center as Vector2, byval sides as long, byval radius as single, byval rotation as single, byval lineThick as single, byval color as RLColor) 1098 | declare function CheckCollisionRecs(byval rec1 as Rectangle, byval rec2 as Rectangle) as boolean 1099 | declare function CheckCollisionCircles(byval center1 as Vector2, byval radius1 as single, byval center2 as Vector2, byval radius2 as single) as boolean 1100 | declare function CheckCollisionCircleRec(byval center as Vector2, byval radius as single, byval rec as Rectangle) as boolean 1101 | declare function CheckCollisionPointRec(byval point_ as Vector2, byval rec as Rectangle) as boolean 1102 | declare function CheckCollisionPointCircle(byval point_ as Vector2, byval center as Vector2, byval radius as single) as boolean 1103 | declare function CheckCollisionPointTriangle(byval point_ as Vector2, byval p1 as Vector2, byval p2 as Vector2, byval p3 as Vector2) as boolean 1104 | declare function CheckCollisionPointPoly(byval point as Vector2, byval points as Vector2 ptr, byval pointCount as long) as byte 1105 | declare function CheckCollisionLines(byval startPos1 as Vector2, byval endPos1 as Vector2, byval startPos2 as Vector2, byval endPos2 as Vector2, byval collisionPoint as Vector2 ptr) as boolean 1106 | declare function CheckCollisionPointLine(byval point_ as Vector2, byval p1 as Vector2, byval p2 as Vector2, byval threshold as long) as boolean 1107 | declare function GetCollisionRec(byval rec1 as Rectangle, byval rec2 as Rectangle) as Rectangle 1108 | declare function LoadImage(byval fileName as const zstring ptr) as Image 1109 | declare function LoadImageRaw(byval fileName as const zstring ptr, byval width_ as long, byval height_ as long, byval format_ as long, byval headerSize as long) as Image 1110 | declare function LoadImageSVG(byval fileNameOrString as const zstring ptr, byval width_ as long, byval height_ as long) as Image 1111 | declare function LoadImageAnim(byval fileName as const zstring ptr, byval frames as long ptr) as Image 1112 | declare function LoadImageFromMemory(byval fileType as const zstring ptr, byval fileData as const ubyte ptr, byval dataSize as long) as Image 1113 | declare function LoadImageFromTexture(byval texture as Texture2D) as Image 1114 | declare function LoadImageFromScreen() as Image 1115 | declare function IsImageReady(byval image_ as Image) as byte 1116 | declare sub UnloadImage(byval image_ as Image) 1117 | declare function ExportImage(byval image_ as Image, byval fileName as const zstring ptr) as boolean 1118 | declare function ExportImageToMemory(byval image_ as Image, byval fileType as const zstring ptr, byval fileSie as long) as zstring ptr 1119 | declare function ExportImageAsCode(byval image_ as Image, byval fileName as const zstring ptr) as boolean 1120 | declare function GenImageColor(byval width_ as long, byval height_ as long, byval color as RLColor) as Image 1121 | declare function GenImageGradientLinear(byval width_ as long, byval height_ as long, byval direction as long, byval start_ as RLColor, byval end_ as RLColor) as Image 1122 | declare function GenImageGradientRadial(byval width_ as long, byval height_ as long, byval density as single, byval inner as RLColor, byval outer as RLColor) as Image 1123 | declare function GenImageGradientSquare(byval width_ as long, byval height_ as long, byval density as single, byval inner as RLColor, byval outer as RLColor) as Image 1124 | declare function GenImageChecked(byval width_ as long, byval height_ as long, byval checksX as long, byval checksY as long, byval col1 as RLColor, byval col2 as RLColor) as Image 1125 | declare function GenImageWhiteNoise(byval width_ as long, byval height_ as long, byval factor as single) as Image 1126 | declare function GenImagePerlinNoise(byval width_ as long, byval height_ as long, byval offsetX as long, byval offsetY as long, byval scale as single) as Image 1127 | declare function GenImageCellular(byval width_ as long, byval height_ as long, byval tileSize as long) as Image 1128 | declare function GenImageText(byval width_ as long, byval height_ as long, byval text_ as const zstring ptr) as Image 1129 | declare function ImageCopy(byval image_ as Image) as Image 1130 | declare function ImageFromImage(byval image_ as Image, byval rec as Rectangle) as Image 1131 | declare function ImageText(byval text as const zstring ptr, byval fontSize as long, byval color as RLColor) as Image 1132 | declare function ImageTextEx(byval font as Font, byval text as const zstring ptr, byval fontSize as single, byval spacing as single, byval tint as RLColor) as Image 1133 | declare sub ImageFormat(byval image_ as Image ptr, byval newFormat as long) 1134 | declare sub ImageToPOT(byval image_ as Image ptr, byval fill as RLColor) 1135 | declare sub ImageCrop(byval image_ as Image ptr, byval crop as Rectangle) 1136 | declare sub ImageAlphaCrop(byval image_ as Image ptr, byval threshold as single) 1137 | declare sub ImageAlphaClear(byval image_ as Image ptr, byval color as RLColor, byval threshold as single) 1138 | declare sub ImageAlphaMask(byval image_ as Image ptr, byval alphaMask as Image) 1139 | declare sub ImageAlphaPremultiply(byval image_ as Image ptr) 1140 | declare sub ImageBlurGaussian(byval image_ as Image ptr, byval blurSize as long) 1141 | declare sub ImageResize(byval image_ as Image ptr, byval newWidth as long, byval newHeight as long) 1142 | declare sub ImageResizeNN(byval image_ as Image ptr, byval newWidth as long, byval newHeight as long) 1143 | declare sub ImageResizeCanvas(byval image_ as Image ptr, byval newWidth as long, byval newHeight as long, byval offsetX as long, byval offsetY as long, byval fill as RLColor) 1144 | declare sub ImageMipmaps(byval image_ as Image ptr) 1145 | declare sub ImageDither(byval image_ as Image ptr, byval rBpp as long, byval gBpp as long, byval bBpp as long, byval aBpp as long) 1146 | declare sub ImageFlipVertical(byval image_ as Image ptr) 1147 | declare sub ImageFlipHorizontal(byval image_ as Image ptr) 1148 | declare sub ImageRotate(byval image_ as Image ptr, byval degrees as long) 1149 | declare sub ImageRotateCW(byval image_ as Image ptr) 1150 | declare sub ImageRotateCCW(byval image_ as Image ptr) 1151 | declare sub ImageColorTint(byval image_ as Image ptr, byval color as RLColor) 1152 | declare sub ImageColorInvert(byval image_ as Image ptr) 1153 | declare sub ImageColorGrayscale(byval image_ as Image ptr) 1154 | declare sub ImageColorContrast(byval image_ as Image ptr, byval contrast as single) 1155 | declare sub ImageColorBrightness(byval image_ as Image ptr, byval brightness as long) 1156 | declare sub ImageColorReplace(byval image_ as Image ptr, byval color as RLColor, byval replace as RLColor) 1157 | declare function LoadImageColors(byval image_ as Image) as RLColor ptr 1158 | declare function LoadImagePalette(byval image_ as Image, byval maxPaletteSize as long, byval colorCount as long ptr) as RLColor ptr 1159 | declare sub UnloadImageColors(byval colors as RLColor ptr) 1160 | declare sub UnloadImagePalette(byval colors as RLColor ptr) 1161 | declare function GetImageAlphaBorder(byval image_ as Image, byval threshold as single) as Rectangle 1162 | declare function GetImageColor(byval image_ as Image, byval x as long, byval y as long) as RLColor 1163 | declare sub ImageClearBackground(byval dst as Image ptr, byval color as RLColor) 1164 | declare sub ImageDrawPixel(byval dst as Image ptr, byval posX as long, byval posY as long, byval color as RLColor) 1165 | declare sub ImageDrawPixelV(byval dst as Image ptr, byval position as Vector2, byval color as RLColor) 1166 | declare sub ImageDrawLine(byval dst as Image ptr, byval startPosX as long, byval startPosY as long, byval endPosX as long, byval endPosY as long, byval color as RLColor) 1167 | declare sub ImageDrawLineV(byval dst as Image ptr, byval start as Vector2, byval end_ as Vector2, byval color as RLColor) 1168 | declare sub ImageDrawCircle(byval dst as Image ptr, byval centerX as long, byval centerY as long, byval radius as long, byval color as RLColor) 1169 | declare sub ImageDrawCircleV(byval dst as Image ptr, byval center as Vector2, byval radius as long, byval color as RLColor) 1170 | declare sub ImageDrawCircleLines(byval dst as Image ptr, byval centerX as long, byval centerY as long, byval radius as long, byval color_ as RLColor) 1171 | declare sub ImageDrawCircleLinesV(byval dst as Image ptr, byval center as Vector2, byval radius as long, byval color_ as RLColor) 1172 | declare sub ImageDrawRectangle(byval dst as Image ptr, byval posX as long, byval posY as long, byval width_ as long, byval height_ as long, byval color as RLColor) 1173 | declare sub ImageDrawRectangleV(byval dst as Image ptr, byval position as Vector2, byval size as Vector2, byval color as RLColor) 1174 | declare sub ImageDrawRectangleRec(byval dst as Image ptr, byval rec as Rectangle, byval color as RLColor) 1175 | declare sub ImageDrawRectangleLines(byval dst as Image ptr, byval rec as Rectangle, byval thick as long, byval color as RLColor) 1176 | declare sub ImageDraw(byval dst as Image ptr, byval src as Image, byval srcRec as Rectangle, byval dstRec as Rectangle, byval tint as RLColor) 1177 | declare sub ImageDrawText(byval dst as Image ptr, byval text as const zstring ptr, byval posX as long, byval posY as long, byval fontSize as long, byval color as RLColor) 1178 | declare sub ImageDrawTextEx(byval dst as Image ptr, byval font as Font, byval text as const zstring ptr, byval position as Vector2, byval fontSize as single, byval spacing as single, byval tint as RLColor) 1179 | declare function LoadTexture(byval fileName as const zstring ptr) as Texture2D 1180 | declare function LoadTextureFromImage(byval image_ as Image) as Texture2D 1181 | declare function LoadTextureCubemap(byval image_ as Image, byval layout as long) as TextureCubemap 1182 | declare function LoadRenderTexture(byval width_ as long, byval height_ as long) as RenderTexture2D 1183 | declare function IsTextureReady(byval texture as Texture2D) as byte 1184 | declare sub UnloadTexture(byval texture as Texture2D) 1185 | declare function IsRenderTextureReady(byval target as RenderTexture2D) as byte 1186 | declare sub UnloadRenderTexture(byval target as RenderTexture2D) 1187 | declare sub UpdateTexture(byval texture as Texture2D, byval pixels as const any ptr) 1188 | declare sub UpdateTextureRec(byval texture as Texture2D, byval rec as Rectangle, byval pixels as const any ptr) 1189 | declare sub GenTextureMipmaps(byval texture as Texture2D ptr) 1190 | declare sub SetTextureFilter(byval texture as Texture2D, byval filter as long) 1191 | declare sub SetTextureWrap(byval texture as Texture2D, byval wrap as long) 1192 | declare sub DrawTexture(byval texture as Texture2D, byval posX as long, byval posY as long, byval tint as RLColor) 1193 | declare sub DrawTextureV(byval texture as Texture2D, byval position as Vector2, byval tint as RLColor) 1194 | declare sub DrawTextureEx(byval texture as Texture2D, byval position as Vector2, byval rotation as single, byval scale as single, byval tint as RLColor) 1195 | declare sub DrawTextureRec(byval texture as Texture2D, byval source as Rectangle, byval position as Vector2, byval tint as RLColor) 1196 | declare sub DrawTexturePro(byval texture as Texture2D, byval source as Rectangle, byval dest as Rectangle, byval origin as Vector2, byval rotation as single, byval tint as RLColor) 1197 | declare sub DrawTextureNPatch(byval texture as Texture2D, byval nPatchInfo as NPatchInfo, byval dest as Rectangle, byval origin as Vector2, byval rotation as single, byval tint as RLColor) 1198 | declare function Fade(byval color as RLColor, byval alpha_ as single) as RLColor 1199 | declare function ColorToInt(byval color_ as RLColor) as long 1200 | declare function ColorNormalize(byval color_ as RLColor) as Vector4 1201 | declare function ColorFromNormalized(byval normalized as Vector4) as RLColor 1202 | declare function ColorToHSV(byval color as RLColor) as Vector3 1203 | declare function ColorFromHSV(byval hue as single, byval saturation as single, byval value as single) as RLColor 1204 | declare function ColorTint(byval color_ as RLColor, byval tint as RLColor) as RLColor 1205 | declare function ColorBrightness(byval color_ as RLColor, byval factor as single) as RLColor 1206 | declare function ColorContrast(byval color_ as RLColor, byval contrast as single) as RLColor 1207 | declare function ColorAlpha(byval color_ as RLColor, byval alpha_ as single) as RLColor 1208 | declare function ColorAlphaBlend(byval dst as RLColor, byval src as RLColor, byval tint as RLColor) as RLColor 1209 | declare function GetColor(byval hexValue as ulong) as RLColor 1210 | declare function GetPixelColor(byval srcPtr as any ptr, byval format_ as long) as RLColor 1211 | declare sub SetPixelColor(byval dstPtr as any ptr, byval color as RLColor, byval format_ as long) 1212 | declare function GetPixelDataSize(byval width_ as long, byval height_ as long, byval format_ as long) as long 1213 | declare function GetFontDefault() as Font 1214 | declare function LoadFont(byval fileName as const zstring ptr) as Font 1215 | declare function LoadFontEx(byval fileName as const zstring ptr, byval fontSize as long, byval codepoints as long ptr, byval codepointCount as long) as Font 1216 | declare function LoadFontFromImage(byval image_ as Image, byval key as RLColor, byval firstChar as long) as Font 1217 | declare function LoadFontFromMemory(byval fileType as const zstring ptr, byval fileData as const ubyte ptr, byval dataSize as long, byval fontSize as long, byval codepoints as long ptr, byval codepointCount as long) as Font 1218 | declare function IsFontReady(byval font as Font) as byte 1219 | declare function LoadFontData(byval fileData as const ubyte ptr, byval dataSize as long, byval fontSize as long, byval codepoints as long ptr, byval codepointCount as long, byval type as long) as GlyphInfo ptr 1220 | declare function GenImageFontAtlas(byval glyphs as const GlyphInfo ptr, byval glyphRecs as Rectangle ptr ptr, byval glyphCount as long, byval fontSize as long, byval padding as long, byval packMethod as long) as Image 1221 | declare sub UnloadFontData(byval glyphs as GlyphInfo ptr, byval glyphCount as long) 1222 | declare sub UnloadFont(byval font as Font) 1223 | declare function ExportFontAsCode(byval font as Font, byval fileName as const zstring ptr) as boolean 1224 | declare sub DrawFPS(byval posX as long, byval posY as long) 1225 | declare sub DrawText(byval text as const zstring ptr, byval posX as long, byval posY as long, byval fontSize as long, byval color as RLColor) 1226 | declare sub DrawTextEx(byval font as Font, byval text as const zstring ptr, byval position as Vector2, byval fontSize as single, byval spacing as single, byval tint as RLColor) 1227 | declare sub DrawTextPro(byval font as Font, byval text as const zstring ptr, byval position as Vector2, byval origin as Vector2, byval rotation as single, byval fontSize as single, byval spacing as single, byval tint as RLColor) 1228 | declare sub DrawTextCodepoint(byval font as Font, byval codepoint as long, byval position as Vector2, byval fontSize as single, byval tint as RLColor) 1229 | declare sub DrawTextCodepoints(byval font as Font, byval codepoints as const long ptr, byval codepointCount as long, byval position as Vector2, byval fontSize as single, byval spacing as single, byval tint as RLColor) 1230 | 1231 | declare sub SetTextLineSpacing(byval spaceing as long) 1232 | 1233 | declare function MeasureText(byval text as const zstring ptr, byval fontSize as long) as long 1234 | declare function MeasureTextEx(byval font as Font, byval text as const zstring ptr, byval fontSize as single, byval spacing as single) as Vector2 1235 | declare function GetGlyphIndex(byval font as Font, byval codepoint as long) as long 1236 | declare function GetGlyphInfo(byval font as Font, byval codepoint as long) as GlyphInfo 1237 | declare function GetGlyphAtlasRec(byval font as Font, byval codepoint as long) as Rectangle 1238 | declare function LoadUTF8(byval codepoints as const long ptr, byval length_ as long) as zstring ptr 1239 | declare sub UnloadUTF8(byval text as zstring ptr) 1240 | declare function LoadCodepoints(byval text_ as const zstring ptr, byval count as long ptr) as long ptr 1241 | declare sub UnloadCodepoints(byval codepoints as long ptr) 1242 | declare function GetCodepoint(byval text as const zstring ptr, byval codepointSize as long ptr) as long 1243 | declare function GetCodepointNext(byval text as const zstring ptr, byval codepointSize as long ptr) as long 1244 | declare function GetCodepointPrevious(byval text as const zstring ptr, byval codepointSize as long ptr) as long 1245 | declare function CodepointToUTF8(byval codepoint as long, byval utf8Size as long ptr) as const zstring ptr 1246 | declare function TextCodepointsToUTF8(byval codepoints as const long ptr, byval length as long) as zstring ptr 1247 | declare function TextCopy(byval dst as zstring ptr, byval src as const zstring ptr) as long 1248 | declare function TextIsEqual(byval text1 as const zstring ptr, byval text2 as const zstring ptr) as boolean 1249 | declare function TextLength(byval text as const zstring ptr) as ulong 1250 | declare function TextFormat(byval text as const zstring ptr, ...) as const zstring ptr 1251 | declare function TextSubtext(byval text as const zstring ptr, byval position as long, byval length as long) as const zstring ptr 1252 | declare function TextReplace(byval text as zstring ptr, byval replace as const zstring ptr, byval by as const zstring ptr) as zstring ptr 1253 | declare function TextInsert(byval text as const zstring ptr, byval insert as const zstring ptr, byval position as long) as zstring ptr 1254 | declare function TextJoin(byval textList as const zstring ptr ptr, byval count as long, byval delimiter as const zstring ptr) as const zstring ptr 1255 | declare function TextSplit(byval text as const zstring ptr, byval delimiter as byte, byval count as long ptr) as const zstring ptr ptr 1256 | declare sub TextAppend(byval text as zstring ptr, byval append as const zstring ptr, byval position as long ptr) 1257 | declare function TextFindIndex(byval text as const zstring ptr, byval find as const zstring ptr) as long 1258 | declare function TextToUpper(byval text as const zstring ptr) as const zstring ptr 1259 | declare function TextToLower(byval text as const zstring ptr) as const zstring ptr 1260 | declare function TextToPascal(byval text as const zstring ptr) as const zstring ptr 1261 | declare function TextToInteger(byval text as const zstring ptr) as long 1262 | declare sub DrawLine3D(byval startPos as Vector3, byval endPos as Vector3, byval color as RLColor) 1263 | declare sub DrawPoint3D(byval position as Vector3, byval color as RLColor) 1264 | declare sub DrawCircle3D(byval center as Vector3, byval radius as single, byval rotationAxis as Vector3, byval rotationAngle as single, byval color as RLColor) 1265 | declare sub DrawTriangle3D(byval v1 as Vector3, byval v2 as Vector3, byval v3 as Vector3, byval color as RLColor) 1266 | declare sub DrawTriangleStrip3D(byval points as Vector3 ptr, byval pointCount as long, byval color as RLColor) 1267 | declare sub DrawCube(byval position as Vector3, byval width_ as single, byval height_ as single, byval length as single, byval color as RLColor) 1268 | declare sub DrawCubeV(byval position as Vector3, byval size as Vector3, byval color as RLColor) 1269 | declare sub DrawCubeWires(byval position as Vector3, byval width_ as single, byval height_ as single, byval length as single, byval color as RLColor) 1270 | declare sub DrawCubeWiresV(byval position as Vector3, byval size as Vector3, byval color as RLColor) 1271 | declare sub DrawSphere(byval centerPos as Vector3, byval radius as single, byval color as RLColor) 1272 | declare sub DrawSphereEx(byval centerPos as Vector3, byval radius as single, byval rings as long, byval slices as long, byval color as RLColor) 1273 | declare sub DrawSphereWires(byval centerPos as Vector3, byval radius as single, byval rings as long, byval slices as long, byval color as RLColor) 1274 | declare sub DrawCylinder(byval position as Vector3, byval radiusTop as single, byval radiusBottom as single, byval height_ as single, byval slices as long, byval color as RLColor) 1275 | declare sub DrawCylinderEx(byval startPos as Vector3, byval endPos as Vector3, byval startRadius as single, byval endRadius as single, byval sides as long, byval color as RLColor) 1276 | declare sub DrawCylinderWires(byval position as Vector3, byval radiusTop as single, byval radiusBottom as single, byval height_ as single, byval slices as long, byval color as RLColor) 1277 | declare sub DrawCylinderWiresEx(byval startPos as Vector3, byval endPos as Vector3, byval startRadius as single, byval endRadius as single, byval sides as long, byval color as RLColor) 1278 | declare sub DrawCapsule(byval startPos as Vector3, byval endPos as Vector3, byval radius as single, byval slices as long, byval rings as long, byval color_ as RLColor) 1279 | declare sub DrawCapsuleWires(byval startPos as Vector3, byval endPos as Vector3, byval radius as single, byval slices as long, byval rings as long, byval color_ as RLColor) 1280 | declare sub DrawPlane(byval centerPos as Vector3, byval size as Vector2, byval color as RLColor) 1281 | declare sub DrawRay(byval ray as Ray, byval color as RLColor) 1282 | declare sub DrawGrid(byval slices as long, byval spacing as single) 1283 | declare function LoadModel(byval fileName as const zstring ptr) as Model 1284 | declare function LoadModelFromMesh(byval mesh as Mesh) as Model 1285 | declare function IsModelReady(byval model as Model) as byte 1286 | declare sub UnloadModel(byval model as Model) 1287 | declare function GetModelBoundingBox(byval model as Model) as BoundingBox 1288 | declare sub DrawModel(byval model as Model, byval position as Vector3, byval scale as single, byval tint as RLColor) 1289 | declare sub DrawModelEx(byval model as Model, byval position as Vector3, byval rotationAxis as Vector3, byval rotationAngle as single, byval scale as Vector3, byval tint as RLColor) 1290 | declare sub DrawModelWires(byval model as Model, byval position as Vector3, byval scale as single, byval tint as RLColor) 1291 | declare sub DrawModelWiresEx(byval model as Model, byval position as Vector3, byval rotationAxis as Vector3, byval rotationAngle as single, byval scale as Vector3, byval tint as RLColor) 1292 | declare sub DrawBoundingBox(byval box as BoundingBox, byval color as RLColor) 1293 | declare sub DrawBillboard(byval camera as Camera, byval texture as Texture2D, byval position as Vector3, byval size as single, byval tint as RLColor) 1294 | declare sub DrawBillboardRec(byval camera as Camera, byval texture as Texture2D, byval source as Rectangle, byval position as Vector3, byval size as Vector2, byval tint as RLColor) 1295 | declare sub DrawBillboardPro(byval camera as Camera, byval texture as Texture2D, byval source as Rectangle, byval position as Vector3, byval up as Vector3, byval size as Vector2, byval origin as Vector2, byval rotation as single, byval tint as RLColor) 1296 | declare sub UploadMesh(byval mesh as Mesh ptr, byval dynamic as boolean) 1297 | declare sub UpdateMeshBuffer(byval mesh as Mesh, byval index as long, byval data_ as const any ptr, byval dataSize as long, byval offset as long) 1298 | declare sub UnloadMesh(byval mesh as Mesh) 1299 | declare sub DrawMesh(byval mesh as Mesh, byval material as Material, byval transform as Matrix) 1300 | declare sub DrawMeshInstanced(byval mesh as Mesh, byval material as Material, byval transforms as const Matrix ptr, byval instances as long) 1301 | declare function ExportMesh(byval mesh as Mesh, byval fileName as const zstring ptr) as boolean 1302 | declare function GetMeshBoundingBox(byval mesh as Mesh) as BoundingBox 1303 | declare sub GenMeshTangents(byval mesh as Mesh ptr) 1304 | declare function GenMeshPoly(byval sides as long, byval radius as single) as Mesh 1305 | declare function GenMeshPlane(byval width_ as single, byval length as single, byval resX as long, byval resZ as long) as Mesh 1306 | declare function GenMeshCube(byval width_ as single, byval height_ as single, byval length as single) as Mesh 1307 | declare function GenMeshSphere(byval radius as single, byval rings as long, byval slices as long) as Mesh 1308 | declare function GenMeshHemiSphere(byval radius as single, byval rings as long, byval slices as long) as Mesh 1309 | declare function GenMeshCylinder(byval radius as single, byval height_ as single, byval slices as long) as Mesh 1310 | declare function GenMeshCone(byval radius as single, byval height_ as single, byval slices as long) as Mesh 1311 | declare function GenMeshTorus(byval radius as single, byval size as single, byval radSeg as long, byval sides as long) as Mesh 1312 | declare function GenMeshKnot(byval radius as single, byval size as single, byval radSeg as long, byval sides as long) as Mesh 1313 | declare function GenMeshHeightmap(byval heightmap as Image, byval size as Vector3) as Mesh 1314 | declare function GenMeshCubicmap(byval cubicmap as Image, byval cubeSize as Vector3) as Mesh 1315 | declare function LoadMaterials(byval fileName as const zstring ptr, byval materialCount as long ptr) as Material ptr 1316 | declare function LoadMaterialDefault() as Material 1317 | declare function IsMaterialReady(byval material as Material) as byte 1318 | declare sub UnloadMaterial(byval material as Material) 1319 | declare sub SetMaterialTexture(byval material as Material ptr, byval mapType as long, byval texture as Texture2D) 1320 | declare sub SetModelMeshMaterial(byval model as Model ptr, byval meshId as long, byval materialId as long) 1321 | declare function LoadModelAnimations(byval fileName as const zstring ptr, byval animCount as long ptr) as ModelAnimation ptr 1322 | declare sub UpdateModelAnimation(byval model as Model, byval anim as ModelAnimation, byval frame as long) 1323 | declare sub UnloadModelAnimation(byval anim as ModelAnimation) 1324 | declare sub UnloadModelAnimations(byval animations as ModelAnimation ptr, byval count as long) 1325 | declare function IsModelAnimationValid(byval model as Model, byval anim as ModelAnimation) as boolean 1326 | declare function CheckCollisionSpheres(byval center1 as Vector3, byval radius1 as single, byval center2 as Vector3, byval radius2 as single) as boolean 1327 | declare function CheckCollisionBoxes(byval box1 as BoundingBox, byval box2 as BoundingBox) as boolean 1328 | declare function CheckCollisionBoxSphere(byval box as BoundingBox, byval center as Vector3, byval radius as single) as boolean 1329 | declare function GetRayCollisionSphere(byval ray as Ray, byval center as Vector3, byval radius as single) as RayCollision 1330 | declare function GetRayCollisionBox(byval ray as Ray, byval box as BoundingBox) as RayCollision 1331 | declare function GetRayCollisionMesh(byval ray as Ray, byval mesh as Mesh, byval transform as Matrix) as RayCollision 1332 | declare function GetRayCollisionTriangle(byval ray as Ray, byval p1 as Vector3, byval p2 as Vector3, byval p3 as Vector3) as RayCollision 1333 | declare function GetRayCollisionQuad(byval ray as Ray, byval p1 as Vector3, byval p2 as Vector3, byval p3 as Vector3, byval p4 as Vector3) as RayCollision 1334 | type AudioCallback as sub(byval bufferData as any ptr, byval frames as ulong) 1335 | declare sub InitAudioDevice() 1336 | declare sub CloseAudioDevice() 1337 | declare function IsAudioDeviceReady() as boolean 1338 | declare sub SetMasterVolume(byval volume as single) 1339 | declare function GetMasterVolume() as single 1340 | declare function LoadWave(byval fileName as const zstring ptr) as Wave 1341 | declare function LoadWaveFromMemory(byval fileType as const zstring ptr, byval fileData as const ubyte ptr, byval dataSize as long) as Wave 1342 | declare function IsWaveReady(byval wave as Wave) as byte 1343 | declare function LoadSound(byval fileName as const zstring ptr) as Sound 1344 | declare function LoadSoundFromWave(byval wave as Wave) as Sound 1345 | declare function LoadSoundAlias(byval source as Sound) as Sound 1346 | declare function IsSoundReady(byval sound as Sound) as byte 1347 | declare sub UpdateSound(byval sound as Sound, byval data_ as const any ptr, byval sampleCount as long) 1348 | declare sub UnloadWave(byval wave as Wave) 1349 | declare sub UnloadSound(byval sound as Sound) 1350 | declare sub UnloadSoundAlias(byval alias as Sound) 1351 | declare function ExportWave(byval wave as Wave, byval fileName as const zstring ptr) as boolean 1352 | declare function ExportWaveAsCode(byval wave as Wave, byval fileName as const zstring ptr) as boolean 1353 | declare sub PlaySound(byval sound as Sound) 1354 | declare sub StopSound(byval sound as Sound) 1355 | declare sub PauseSound(byval sound as Sound) 1356 | declare sub ResumeSound(byval sound as Sound) 1357 | declare function IsSoundPlaying(byval sound as Sound) as boolean 1358 | declare sub SetSoundVolume(byval sound as Sound, byval volume as single) 1359 | declare sub SetSoundPitch(byval sound as Sound, byval pitch as single) 1360 | declare sub SetSoundPan(byval sound as Sound, byval pan as single) 1361 | declare function WaveCopy(byval wave as Wave) as Wave 1362 | declare sub WaveCrop(byval wave as Wave ptr, byval initSample as long, byval finalSample as long) 1363 | declare sub WaveFormat(byval wave as Wave ptr, byval sampleRate as long, byval sampleSize as long, byval channels as long) 1364 | declare function LoadWaveSamples(byval wave as Wave) as single ptr 1365 | declare sub UnloadWaveSamples(byval samples as single ptr) 1366 | declare function LoadMusicStream(byval fileName as const zstring ptr) as Music 1367 | declare function LoadMusicStreamFromMemory(byval fileType as const zstring ptr, byval data_ as const ubyte ptr, byval dataSize as long) as Music 1368 | declare function IsMusicReady(byval music as Music) as byte 1369 | declare sub UnloadMusicStream(byval music as Music) 1370 | declare sub PlayMusicStream(byval music as Music) 1371 | declare function IsMusicStreamPlaying(byval music as Music) as boolean 1372 | declare sub UpdateMusicStream(byval music as Music) 1373 | declare sub StopMusicStream(byval music as Music) 1374 | declare sub PauseMusicStream(byval music as Music) 1375 | declare sub ResumeMusicStream(byval music as Music) 1376 | declare sub SeekMusicStream(byval music as Music, byval position as single) 1377 | declare sub SetMusicVolume(byval music as Music, byval volume as single) 1378 | declare sub SetMusicPitch(byval music as Music, byval pitch as single) 1379 | declare sub SetMusicPan(byval music as Music, byval pan as single) 1380 | declare function GetMusicTimeLength(byval music as Music) as single 1381 | declare function GetMusicTimePlayed(byval music as Music) as single 1382 | declare function LoadAudioStream(byval sampleRate as ulong, byval sampleSize as ulong, byval channels as ulong) as AudioStream 1383 | declare function IsAudioStreamReady(byval stream as AudioStream) as byte 1384 | declare sub UnloadAudioStream(byval stream as AudioStream) 1385 | declare sub UpdateAudioStream(byval stream as AudioStream, byval data_ as const any ptr, byval frameCount as long) 1386 | declare function IsAudioStreamProcessed(byval stream as AudioStream) as boolean 1387 | declare sub PlayAudioStream(byval stream as AudioStream) 1388 | declare sub PauseAudioStream(byval stream as AudioStream) 1389 | declare sub ResumeAudioStream(byval stream as AudioStream) 1390 | declare function IsAudioStreamPlaying(byval stream as AudioStream) as boolean 1391 | declare sub StopAudioStream(byval stream as AudioStream) 1392 | declare sub SetAudioStreamVolume(byval stream as AudioStream, byval volume as single) 1393 | declare sub SetAudioStreamPitch(byval stream as AudioStream, byval pitch as single) 1394 | declare sub SetAudioStreamPan(byval stream as AudioStream, byval pan as single) 1395 | declare sub SetAudioStreamBufferSizeDefault(byval size as long) 1396 | declare sub SetAudioStreamCallback(byval stream as AudioStream, byval callback as AudioCallback) 1397 | declare sub AttachAudioStreamProcessor(byval stream as AudioStream, byval processor as AudioCallback) 1398 | declare sub DetachAudioStreamProcessor(byval stream as AudioStream, byval processor as AudioCallback) 1399 | declare sub AttachAudioMixedProcessor(byval processor as AudioCallback) 1400 | declare sub DetachAudioMixedProcessor(byval processor as AudioCallback) 1401 | 1402 | end extern 1403 | -------------------------------------------------------------------------------- /raymath.bi: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include once "crt/math.bi" 4 | 5 | extern "C" 6 | 7 | #define RAYMATH_H 8 | 9 | const PI = 3.14159265358979323846 10 | 11 | const EPSILON = 0.000001f 12 | const DEG2RAD = PI / 180.0f 13 | const RAD2DEG = 180.0f / PI 14 | #define MatrixToFloat(mat) MatrixToFloatV(mat).v 15 | #define Vector3ToFloat(vec) Vector3ToFloatV(vec).v 16 | 17 | type Vector2 18 | x as single 19 | y as single 20 | declare constructor() 21 | declare constructor(x as single, y as single) 22 | end type 23 | 24 | constructor Vector2(x as single, y as single) 25 | this.x = x 26 | this.y = y 27 | end constructor 28 | 29 | constructor Vector2() 30 | end constructor 31 | 32 | #define RL_VECTOR2_TYPE 33 | 34 | type Vector3 35 | x as single 36 | y as single 37 | z as single 38 | declare constructor() 39 | declare constructor(x as single, y as single, z as single) 40 | end type 41 | 42 | constructor Vector3() 43 | end constructor 44 | 45 | constructor Vector3(x as single, y as single, z as single) 46 | this.x = x 47 | this.y = y 48 | this.z = z 49 | end constructor 50 | 51 | #define RL_VECTOR3_TYPE 52 | 53 | type Vector4 54 | x as single 55 | y as single 56 | z as single 57 | w as single 58 | declare constructor() 59 | declare constructor(x as single, y as single, z as single, w as single) 60 | end type 61 | 62 | constructor Vector4() 63 | end constructor 64 | 65 | constructor Vector4(x as single, y as single, z as single, w as single) 66 | this.x = x 67 | this.y = y 68 | this.z = z 69 | this.w = w 70 | end constructor 71 | 72 | #define RL_VECTOR4_TYPE 73 | type Quaternion as Vector4 74 | #define RL_QUATERNION_TYPE 75 | 76 | type Matrix 77 | m0 as single 78 | m4 as single 79 | m8 as single 80 | m12 as single 81 | m1 as single 82 | m5 as single 83 | m9 as single 84 | m13 as single 85 | m2 as single 86 | m6 as single 87 | m10 as single 88 | m14 as single 89 | m3 as single 90 | m7 as single 91 | m11 as single 92 | m15 as single 93 | end type 94 | 95 | #define RL_MATRIX_TYPE 96 | 97 | type float3 98 | v(0 to 2) as single 99 | end type 100 | 101 | type float16 102 | v(0 to 15) as single 103 | end type 104 | 105 | #if (not defined(RAYMATH_HEADER_ONLY)) and defined(RAYLIB_H) 106 | declare function Clamp(byval value as single, byval min as single, byval max as single) as single 107 | declare function Lerp(byval start as single, byval end_ as single, byval amount as single) as single 108 | declare function Normalize(byval value as single, byval start as single, byval end_ as single) as single 109 | declare function Remap(byval value as single, byval inputStart as single, byval inputEnd as single, byval outputStart as single, byval outputEnd as single) as single 110 | declare function Wrap(byval value as single, byval min as single, byval max as single) as single 111 | declare function FloatEquals(byval x as single, byval y as single) as long 112 | declare function Vector2Zero() as Vector2 113 | declare function Vector2One() as Vector2 114 | declare function Vector2Add(byval v1 as Vector2, byval v2 as Vector2) as Vector2 115 | declare function Vector2AddValue(byval v as Vector2, byval add as single) as Vector2 116 | declare function Vector2Subtract(byval v1 as Vector2, byval v2 as Vector2) as Vector2 117 | declare function Vector2SubtractValue(byval v as Vector2, byval sub_ as single) as Vector2 118 | declare function Vector2Length(byval v as Vector2) as single 119 | declare function Vector2LengthSqr(byval v as Vector2) as single 120 | declare function Vector2DotProduct(byval v1 as Vector2, byval v2 as Vector2) as single 121 | declare function Vector2Distance(byval v1 as Vector2, byval v2 as Vector2) as single 122 | declare function Vector2DistanceSqr(byval v1 as Vector2, byval v2 as Vector2) as single 123 | declare function Vector2Angle(byval v1 as Vector2, byval v2 as Vector2) as single 124 | declare function Vector2Scale(byval v as Vector2, byval scale as single) as Vector2 125 | declare function Vector2Multiply(byval v1 as Vector2, byval v2 as Vector2) as Vector2 126 | declare function Vector2Negate(byval v as Vector2) as Vector2 127 | declare function Vector2Divide(byval v1 as Vector2, byval v2 as Vector2) as Vector2 128 | declare function Vector2Normalize(byval v as Vector2) as Vector2 129 | declare function Vector2Transform(byval v as Vector2, byval mat as Matrix) as Vector2 130 | declare function Vector2Lerp(byval v1 as Vector2, byval v2 as Vector2, byval amount as single) as Vector2 131 | declare function Vector2Reflect(byval v as Vector2, byval normal as Vector2) as Vector2 132 | declare function Vector2Rotate(byval v as Vector2, byval angle as single) as Vector2 133 | declare function Vector2MoveTowards(byval v as Vector2, byval target as Vector2, byval maxDistance as single) as Vector2 134 | declare function Vector2Invert(byval v as Vector2) as Vector2 135 | declare function Vector2Clamp(byval v as Vector2, byval min as Vector2, byval max as Vector2) as Vector2 136 | declare function Vector2ClampValue(byval v as Vector2, byval min as single, byval max as single) as Vector2 137 | declare function Vector2Equals(byval p as Vector2, byval q as Vector2) as long 138 | declare function Vector3Zero() as Vector3 139 | declare function Vector3One() as Vector3 140 | declare function Vector3Add(byval v1 as Vector3, byval v2 as Vector3) as Vector3 141 | declare function Vector3AddValue(byval v as Vector3, byval add as single) as Vector3 142 | declare function Vector3Subtract(byval v1 as Vector3, byval v2 as Vector3) as Vector3 143 | declare function Vector3SubtractValue(byval v as Vector3, byval sub_ as single) as Vector3 144 | declare function Vector3Scale(byval v as Vector3, byval scalar as single) as Vector3 145 | declare function Vector3Multiply(byval v1 as Vector3, byval v2 as Vector3) as Vector3 146 | declare function Vector3CrossProduct(byval v1 as Vector3, byval v2 as Vector3) as Vector3 147 | declare function Vector3Perpendicular(byval v as Vector3) as Vector3 148 | declare function Vector3Length(byval v as const Vector3) as single 149 | declare function Vector3LengthSqr(byval v as const Vector3) as single 150 | declare function Vector3DotProduct(byval v1 as Vector3, byval v2 as Vector3) as single 151 | declare function Vector3Distance(byval v1 as Vector3, byval v2 as Vector3) as single 152 | declare function Vector3DistanceSqr(byval v1 as Vector3, byval v2 as Vector3) as single 153 | declare function Vector3Angle(byval v1 as Vector3, byval v2 as Vector3) as single 154 | declare function Vector3Negate(byval v as Vector3) as Vector3 155 | declare function Vector3Divide(byval v1 as Vector3, byval v2 as Vector3) as Vector3 156 | declare function Vector3Normalize(byval v as Vector3) as Vector3 157 | declare sub Vector3OrthoNormalize(byval v1 as Vector3 ptr, byval v2 as Vector3 ptr) 158 | declare function Vector3Transform(byval v as Vector3, byval mat as Matrix) as Vector3 159 | declare function Vector3RotateByQuaternion(byval v as Vector3, byval q as Quaternion) as Vector3 160 | declare function Vector3RotateByAxisAngle(byval v as Vector3, byval axis as Vector3, byval angle as single) as Vector3 161 | declare function Vector3Lerp(byval v1 as Vector3, byval v2 as Vector3, byval amount as single) as Vector3 162 | declare function Vector3Reflect(byval v as Vector3, byval normal as Vector3) as Vector3 163 | declare function Vector3Min(byval v1 as Vector3, byval v2 as Vector3) as Vector3 164 | declare function Vector3Max(byval v1 as Vector3, byval v2 as Vector3) as Vector3 165 | declare function Vector3Barycenter(byval p as Vector3, byval a as Vector3, byval b as Vector3, byval c as Vector3) as Vector3 166 | declare function Vector3Unproject(byval source as Vector3, byval projection as Matrix, byval view_ as Matrix) as Vector3 167 | declare function Vector3ToFloatV(byval v as Vector3) as float3 168 | declare function Vector3Invert(byval v as Vector3) as Vector3 169 | declare function Vector3Clamp(byval v as Vector3, byval min as Vector3, byval max as Vector3) as Vector3 170 | declare function Vector3ClampValue(byval v as Vector3, byval min as single, byval max as single) as Vector3 171 | declare function Vector3Equals(byval p as Vector3, byval q as Vector3) as long 172 | declare function Vector3Refract(byval v as Vector3, byval n as Vector3, byval r as single) as Vector3 173 | declare function MatrixDeterminant(byval mat as Matrix) as single 174 | declare function MatrixTrace(byval mat as Matrix) as single 175 | declare function MatrixTranspose(byval mat as Matrix) as Matrix 176 | declare function MatrixInvert(byval mat as Matrix) as Matrix 177 | declare function MatrixIdentity() as Matrix 178 | declare function MatrixAdd(byval left_ as Matrix, byval right_ as Matrix) as Matrix 179 | declare function MatrixSubtract(byval left_ as Matrix, byval right_ as Matrix) as Matrix 180 | declare function MatrixMultiply(byval left_ as Matrix, byval right_ as Matrix) as Matrix 181 | declare function MatrixTranslate(byval x as single, byval y as single, byval z as single) as Matrix 182 | declare function MatrixRotate(byval axis as Vector3, byval angle as single) as Matrix 183 | declare function MatrixRotateX(byval angle as single) as Matrix 184 | declare function MatrixRotateY(byval angle as single) as Matrix 185 | declare function MatrixRotateZ(byval angle as single) as Matrix 186 | declare function MatrixRotateXYZ(byval angle as Vector3) as Matrix 187 | declare function MatrixRotateZYX(byval angle as Vector3) as Matrix 188 | declare function MatrixScale(byval x as single, byval y as single, byval z as single) as Matrix 189 | declare function MatrixFrustum(byval left_ as double, byval right_ as double, byval bottom as double, byval top as double, byval near as double, byval far as double) as Matrix 190 | declare function MatrixPerspective(byval fovy as double, byval aspect as double, byval near as double, byval far as double) as Matrix 191 | declare function MatrixOrtho(byval left_ as double, byval right_ as double, byval bottom as double, byval top as double, byval near as double, byval far as double) as Matrix 192 | declare function MatrixLookAt(byval eye as Vector3, byval target as Vector3, byval up as Vector3) as Matrix 193 | declare function MatrixToFloatV(byval mat as Matrix) as float16 194 | declare function QuaternionAdd(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 195 | declare function QuaternionAddValue(byval q as Quaternion, byval add as single) as Quaternion 196 | declare function QuaternionSubtract(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 197 | declare function QuaternionSubtractValue(byval q as Quaternion, byval sub_ as single) as Quaternion 198 | declare function QuaternionIdentity() as Quaternion 199 | declare function QuaternionLength(byval q as Quaternion) as single 200 | declare function QuaternionNormalize(byval q as Quaternion) as Quaternion 201 | declare function QuaternionInvert(byval q as Quaternion) as Quaternion 202 | declare function QuaternionMultiply(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 203 | declare function QuaternionScale(byval q as Quaternion, byval mul as single) as Quaternion 204 | declare function QuaternionDivide(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 205 | declare function QuaternionLerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 206 | declare function QuaternionNlerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 207 | declare function QuaternionSlerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 208 | declare function QuaternionFromVector3ToVector3(byval from as Vector3, byval to_ as Vector3) as Quaternion 209 | declare function QuaternionFromMatrix(byval mat as Matrix) as Quaternion 210 | declare function QuaternionToMatrix(byval q as Quaternion) as Matrix 211 | declare function QuaternionFromAxisAngle(byval axis as Vector3, byval angle as single) as Quaternion 212 | declare sub QuaternionToAxisAngle(byval q as Quaternion, byval outAxis as Vector3 ptr, byval outAngle as single ptr) 213 | declare function QuaternionFromEuler(byval pitch as single, byval yaw as single, byval roll as single) as Quaternion 214 | declare function QuaternionToEuler(byval q as Quaternion) as Vector3 215 | declare function QuaternionTransform(byval q as Quaternion, byval mat as Matrix) as Quaternion 216 | declare function QuaternionEquals(byval p as Quaternion, byval q as Quaternion) as long 217 | #else 218 | private function Clamp(byval value as single, byval min as single, byval max as single) as single 219 | dim result as single = iif(value < min, min, value) 220 | if result > max then 221 | result = max 222 | end if 223 | return result 224 | end function 225 | 226 | private function Lerp(byval start as single, byval end_ as single, byval amount as single) as single 227 | dim result as single = start + (amount * (end_ - start)) 228 | return result 229 | end function 230 | 231 | private function Normalize(byval value as single, byval start as single, byval end_ as single) as single 232 | dim result as single = (value - start) / (end_ - start) 233 | return result 234 | end function 235 | 236 | private function Remap(byval value as single, byval inputStart as single, byval inputEnd as single, byval outputStart as single, byval outputEnd as single) as single 237 | dim result as single = (((value - inputStart) / (inputEnd - inputStart)) * (outputEnd - outputStart)) + outputStart 238 | return result 239 | end function 240 | 241 | private function Wrap(byval value as single, byval min as single, byval max as single) as single 242 | dim result as single = value - ((max - min) * floorf((value - min) / (max - min))) 243 | return result 244 | end function 245 | 246 | private function FloatEquals(byval x as single, byval y as single) as long 247 | dim result as long = -(fabsf(x - y) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(x), fabsf(y))))) 248 | return result 249 | end function 250 | 251 | private function Vector2Zero() as Vector2 252 | dim result as Vector2 = Vector2(0.0f, 0.0f) 253 | return result 254 | end function 255 | 256 | private function Vector2One() as Vector2 257 | dim result as Vector2 = Vector2(1.0f, 1.0f) 258 | return result 259 | end function 260 | 261 | private function Vector2Add(byval v1 as Vector2, byval v2 as Vector2) as Vector2 262 | dim result as Vector2 = Vector2(v1.x + v2.x, v1.y + v2.y) 263 | return result 264 | end function 265 | 266 | private function Vector2AddValue(byval v as Vector2, byval add as single) as Vector2 267 | dim result as Vector2 = Vector2(v.x + add, v.y + add) 268 | return result 269 | end function 270 | 271 | private function Vector2Subtract(byval v1 as Vector2, byval v2 as Vector2) as Vector2 272 | dim result as Vector2 = Vector2(v1.x - v2.x, v1.y - v2.y) 273 | return result 274 | end function 275 | 276 | private function Vector2SubtractValue(byval v as Vector2, byval sub_ as single) as Vector2 277 | dim result as Vector2 = Vector2(v.x - sub_, v.y - sub_) 278 | return result 279 | end function 280 | 281 | private function Vector2Length(byval v as Vector2) as single 282 | dim result as single = sqrtf((v.x * v.x) + (v.y * v.y)) 283 | return result 284 | end function 285 | 286 | private function Vector2LengthSqr(byval v as Vector2) as single 287 | dim result as single = (v.x * v.x) + (v.y * v.y) 288 | return result 289 | end function 290 | 291 | private function Vector2DotProduct(byval v1 as Vector2, byval v2 as Vector2) as single 292 | dim result as single = (v1.x * v2.x) + (v1.y * v2.y) 293 | return result 294 | end function 295 | 296 | private function Vector2Distance(byval v1 as Vector2, byval v2 as Vector2) as single 297 | dim result as single = sqrtf(((v1.x - v2.x) * (v1.x - v2.x)) + ((v1.y - v2.y) * (v1.y - v2.y))) 298 | return result 299 | end function 300 | 301 | private function Vector2DistanceSqr(byval v1 as Vector2, byval v2 as Vector2) as single 302 | dim result as single = ((v1.x - v2.x) * (v1.x - v2.x)) + ((v1.y - v2.y) * (v1.y - v2.y)) 303 | return result 304 | end function 305 | 306 | private function Vector2Angle(byval v1 as Vector2, byval v2 as Vector2) as single 307 | dim result as single = atan2f(v2.y, v2.x) - atan2f(v1.y, v1.x) 308 | return result 309 | end function 310 | 311 | private function Vector2Scale(byval v as Vector2, byval scale as single) as Vector2 312 | dim result as Vector2 = Vector2(v.x * scale, v.y * scale) 313 | return result 314 | end function 315 | 316 | private function Vector2Multiply(byval v1 as Vector2, byval v2 as Vector2) as Vector2 317 | dim result as Vector2 = Vector2(v1.x * v2.x, v1.y * v2.y) 318 | return result 319 | end function 320 | 321 | private function Vector2Negate(byval v as Vector2) as Vector2 322 | dim result as Vector2 = Vector2(-v.x, -v.y) 323 | return result 324 | end function 325 | 326 | private function Vector2Divide(byval v1 as Vector2, byval v2 as Vector2) as Vector2 327 | dim result as Vector2 = Vector2(v1.x / v2.x, v1.y / v2.y) 328 | return result 329 | end function 330 | 331 | private function Vector2Normalize(byval v as Vector2) as Vector2 332 | dim result as Vector2 333 | dim length as single = sqrtf((v.x * v.x) + (v.y * v.y)) 334 | if length > 0 then 335 | dim ilength as single = 1.0f / length 336 | result.x = v.x * ilength 337 | result.y = v.y * ilength 338 | end if 339 | return result 340 | end function 341 | 342 | private function Vector2Transform(byval v as Vector2, byval mat as Matrix) as Vector2 343 | dim result as Vector2 344 | dim x as single = v.x 345 | dim y as single = v.y 346 | dim z as single = 0 347 | result.x = (((mat.m0 * x) + (mat.m4 * y)) + (mat.m8 * z)) + mat.m12 348 | result.y = (((mat.m1 * x) + (mat.m5 * y)) + (mat.m9 * z)) + mat.m13 349 | return result 350 | end function 351 | 352 | private function Vector2Lerp(byval v1 as Vector2, byval v2 as Vector2, byval amount as single) as Vector2 353 | dim result as Vector2 354 | result.x = v1.x + (amount * (v2.x - v1.x)) 355 | result.y = v1.y + (amount * (v2.y - v1.y)) 356 | return result 357 | end function 358 | 359 | private function Vector2Reflect(byval v as Vector2, byval normal as Vector2) as Vector2 360 | dim result as Vector2 361 | dim dotProduct as single = (v.x * normal.x) + (v.y * normal.y) 362 | result.x = v.x - ((2.0f * normal.x) * dotProduct) 363 | result.y = v.y - ((2.0f * normal.y) * dotProduct) 364 | return result 365 | end function 366 | 367 | private function Vector2Rotate(byval v as Vector2, byval angle as single) as Vector2 368 | dim result as Vector2 369 | dim cosres as single = cosf(angle) 370 | dim sinres as single = sinf(angle) 371 | result.x = (v.x * cosres) - (v.y * sinres) 372 | result.y = (v.x * sinres) + (v.y * cosres) 373 | return result 374 | end function 375 | 376 | private function Vector2MoveTowards(byval v as Vector2, byval target as Vector2, byval maxDistance as single) as Vector2 377 | dim result as Vector2 378 | dim dx as single = target.x - v.x 379 | dim dy as single = target.y - v.y 380 | dim value as single = (dx * dx) + (dy * dy) 381 | if (value = 0) orelse ((maxDistance >= 0) andalso (value <= (maxDistance * maxDistance))) then 382 | return target 383 | end if 384 | dim dist as single = sqrtf(value) 385 | result.x = v.x + ((dx / dist) * maxDistance) 386 | result.y = v.y + ((dy / dist) * maxDistance) 387 | return result 388 | end function 389 | 390 | private function Vector2Invert(byval v as Vector2) as Vector2 391 | dim result as Vector2 = Vector2(1.0f / v.x, 1.0f / v.y) 392 | return result 393 | end function 394 | 395 | private function Vector2Clamp(byval v as Vector2, byval min as Vector2, byval max as Vector2) as Vector2 396 | dim result as Vector2 397 | result.x = fminf(max.x, fmaxf(min.x, v.x)) 398 | result.y = fminf(max.y, fmaxf(min.y, v.y)) 399 | return result 400 | end function 401 | 402 | private function Vector2ClampValue(byval v as Vector2, byval min as single, byval max as single) as Vector2 403 | dim result as Vector2 = v 404 | dim length as single = (v.x * v.x) + (v.y * v.y) 405 | if length > 0.0f then 406 | length = sqrtf(length) 407 | if length < min then 408 | dim scale as single = min / length 409 | result.x = v.x * scale 410 | result.y = v.y * scale 411 | elseif length > max then 412 | dim scale as single = max / length 413 | result.x = v.x * scale 414 | result.y = v.y * scale 415 | end if 416 | end if 417 | return result 418 | end function 419 | 420 | private function Vector2Equals(byval p as Vector2, byval q as Vector2) as long 421 | dim result as long = -((fabsf(p.x - q.x) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) andalso (fabsf(p.y - q.y) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y)))))) 422 | return result 423 | end function 424 | 425 | private function Vector3Zero() as Vector3 426 | dim result as Vector3 = Vector3(0.0f, 0.0f, 0.0f) 427 | return result 428 | end function 429 | 430 | private function Vector3One() as Vector3 431 | dim result as Vector3 = Vector3(1.0f, 1.0f, 1.0f) 432 | return result 433 | end function 434 | 435 | private function Vector3Add(byval v1 as Vector3, byval v2 as Vector3) as Vector3 436 | dim result as Vector3 = Vector3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z) 437 | return result 438 | end function 439 | 440 | private function Vector3AddValue(byval v as Vector3, byval add as single) as Vector3 441 | dim result as Vector3 = Vector3(v.x + add, v.y + add, v.z + add) 442 | return result 443 | end function 444 | 445 | private function Vector3Subtract(byval v1 as Vector3, byval v2 as Vector3) as Vector3 446 | dim result as Vector3 = Vector3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z) 447 | return result 448 | end function 449 | 450 | private function Vector3SubtractValue(byval v as Vector3, byval sub_ as single) as Vector3 451 | dim result as Vector3 = Vector3(v.x - sub_, v.y - sub_, v.z - sub_) 452 | return result 453 | end function 454 | 455 | private function Vector3Scale(byval v as Vector3, byval scalar as single) as Vector3 456 | dim result as Vector3 = Vector3(v.x * scalar, v.y * scalar, v.z * scalar) 457 | return result 458 | end function 459 | 460 | private function Vector3Multiply(byval v1 as Vector3, byval v2 as Vector3) as Vector3 461 | dim result as Vector3 = Vector3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z) 462 | return result 463 | end function 464 | 465 | private function Vector3CrossProduct(byval v1 as Vector3, byval v2 as Vector3) as Vector3 466 | dim result as Vector3 = Vector3((v1.y * v2.z) - (v1.z * v2.y), (v1.z * v2.x) - (v1.x * v2.z), (v1.x * v2.y) - (v1.y * v2.x)) 467 | return result 468 | end function 469 | 470 | private function Vector3Perpendicular(byval v as Vector3) as Vector3 471 | dim result as Vector3 472 | dim min as single = csng(fabs(v.x)) 473 | dim cardinalAxis as Vector3 = Vector3(1.0f, 0.0f, 0.0f) 474 | if fabsf(v.y) < min then 475 | min = csng(fabs(v.y)) 476 | dim tmp as Vector3 = Vector3(0.0f, 1.0f, 0.0f) 477 | cardinalAxis = tmp 478 | end if 479 | if fabsf(v.z) < min then 480 | dim tmp as Vector3 = Vector3(0.0f, 0.0f, 1.0f) 481 | cardinalAxis = tmp 482 | end if 483 | result.x = (v.y * cardinalAxis.z) - (v.z * cardinalAxis.y) 484 | result.y = (v.z * cardinalAxis.x) - (v.x * cardinalAxis.z) 485 | result.z = (v.x * cardinalAxis.y) - (v.y * cardinalAxis.x) 486 | return result 487 | end function 488 | 489 | private function Vector3Length(byval v as const Vector3) as single 490 | dim result as single = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 491 | return result 492 | end function 493 | 494 | private function Vector3LengthSqr(byval v as const Vector3) as single 495 | dim result as single = ((v.x * v.x) + (v.y * v.y)) + (v.z * v.z) 496 | return result 497 | end function 498 | 499 | private function Vector3DotProduct(byval v1 as Vector3, byval v2 as Vector3) as single 500 | dim result as single = ((v1.x * v2.x) + (v1.y * v2.y)) + (v1.z * v2.z) 501 | return result 502 | end function 503 | 504 | private function Vector3Distance(byval v1 as Vector3, byval v2 as Vector3) as single 505 | dim result as single = 0.0f 506 | dim dx as single = v2.x - v1.x 507 | dim dy as single = v2.y - v1.y 508 | dim dz as single = v2.z - v1.z 509 | result = sqrtf(((dx * dx) + (dy * dy)) + (dz * dz)) 510 | return result 511 | end function 512 | 513 | private function Vector3DistanceSqr(byval v1 as Vector3, byval v2 as Vector3) as single 514 | dim result as single = 0.0f 515 | dim dx as single = v2.x - v1.x 516 | dim dy as single = v2.y - v1.y 517 | dim dz as single = v2.z - v1.z 518 | result = ((dx * dx) + (dy * dy)) + (dz * dz) 519 | return result 520 | end function 521 | 522 | private function Vector3Angle(byval v1 as Vector3, byval v2 as Vector3) as single 523 | dim result as single = 0.0f 524 | dim cross as Vector3 = Vector3((v1.y * v2.z) - (v1.z * v2.y), (v1.z * v2.x) - (v1.x * v2.z), (v1.x * v2.y) - (v1.y * v2.x)) 525 | dim len_ as single = sqrtf(((cross.x * cross.x) + (cross.y * cross.y)) + (cross.z * cross.z)) 526 | dim dot as single = ((v1.x * v2.x) + (v1.y * v2.y)) + (v1.z * v2.z) 527 | result = atan2f(len_, dot) 528 | return result 529 | end function 530 | 531 | private function Vector3Negate(byval v as Vector3) as Vector3 532 | dim result as Vector3 = Vector3(-v.x, -v.y, -v.z) 533 | return result 534 | end function 535 | 536 | private function Vector3Divide(byval v1 as Vector3, byval v2 as Vector3) as Vector3 537 | dim result as Vector3 = Vector3(v1.x / v2.x, v1.y / v2.y, v1.z / v2.z) 538 | return result 539 | end function 540 | 541 | private function Vector3Normalize(byval v as Vector3) as Vector3 542 | dim result as Vector3 = v 543 | dim length as single = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 544 | if length = 0.0f then 545 | length = 1.0f 546 | end if 547 | dim ilength as single = 1.0f / length 548 | result.x *= ilength 549 | result.y *= ilength 550 | result.z *= ilength 551 | return result 552 | end function 553 | 554 | private sub Vector3OrthoNormalize(byval v1 as Vector3 ptr, byval v2 as Vector3 ptr) 555 | dim length as single = 0.0f 556 | dim ilength as single = 0.0f 557 | dim v as Vector3 = *v1 558 | length = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 559 | if length = 0.0f then 560 | length = 1.0f 561 | end if 562 | ilength = 1.0f / length 563 | v1->x *= ilength 564 | v1->y *= ilength 565 | v1->z *= ilength 566 | dim vn1 as Vector3 = Vector3((v1->y * v2->z) - (v1->z * v2->y), (v1->z * v2->x) - (v1->x * v2->z), (v1->x * v2->y) - (v1->y * v2->x)) 567 | v = vn1 568 | length = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 569 | if length = 0.0f then 570 | length = 1.0f 571 | end if 572 | ilength = 1.0f / length 573 | vn1.x *= ilength 574 | vn1.y *= ilength 575 | vn1.z *= ilength 576 | dim vn2 as Vector3 = Vector3((vn1.y * v1->z) - (vn1.z * v1->y), (vn1.z * v1->x) - (vn1.x * v1->z), (vn1.x * v1->y) - (vn1.y * v1->x)) 577 | (*v2) = vn2 578 | end sub 579 | 580 | private function Vector3Transform(byval v as Vector3, byval mat as Matrix) as Vector3 581 | dim result as Vector3 582 | dim x as single = v.x 583 | dim y as single = v.y 584 | dim z as single = v.z 585 | result.x = (((mat.m0 * x) + (mat.m4 * y)) + (mat.m8 * z)) + mat.m12 586 | result.y = (((mat.m1 * x) + (mat.m5 * y)) + (mat.m9 * z)) + mat.m13 587 | result.z = (((mat.m2 * x) + (mat.m6 * y)) + (mat.m10 * z)) + mat.m14 588 | return result 589 | end function 590 | 591 | private function Vector3RotateByQuaternion(byval v as Vector3, byval q as Quaternion) as Vector3 592 | dim result as Vector3 593 | result.x = ((v.x * ((((q.x * q.x) + (q.w * q.w)) - (q.y * q.y)) - (q.z * q.z))) + (v.y * (((2 * q.x) * q.y) - ((2 * q.w) * q.z)))) + (v.z * (((2 * q.x) * q.z) + ((2 * q.w) * q.y))) 594 | result.y = ((v.x * (((2 * q.w) * q.z) + ((2 * q.x) * q.y))) + (v.y * ((((q.w * q.w) - (q.x * q.x)) + (q.y * q.y)) - (q.z * q.z)))) + (v.z * ((((-2) * q.w) * q.x) + ((2 * q.y) * q.z))) 595 | result.z = ((v.x * ((((-2) * q.w) * q.y) + ((2 * q.x) * q.z))) + (v.y * (((2 * q.w) * q.x) + ((2 * q.y) * q.z)))) + (v.z * ((((q.w * q.w) - (q.x * q.x)) - (q.y * q.y)) + (q.z * q.z))) 596 | return result 597 | end function 598 | 599 | private function Vector3RotateByAxisAngle(byval v as Vector3, byval axis as Vector3, byval angle as single) as Vector3 600 | dim result as Vector3 = v 601 | dim length as single = sqrtf(((axis.x * axis.x) + (axis.y * axis.y)) + (axis.z * axis.z)) 602 | if length = 0.0f then 603 | length = 1.0f 604 | end if 605 | dim ilength as single = 1.0f / length 606 | axis.x *= ilength 607 | axis.y *= ilength 608 | axis.z *= ilength 609 | angle /= 2.0f 610 | dim a as single = sinf(angle) 611 | dim b as single = axis.x * a 612 | dim c as single = axis.y * a 613 | dim d as single = axis.z * a 614 | a = cosf(angle) 615 | dim w as Vector3 = Vector3(b, c, d) 616 | dim wv as Vector3 = Vector3((w.y * v.z) - (w.z * v.y), (w.z * v.x) - (w.x * v.z), (w.x * v.y) - (w.y * v.x)) 617 | dim wwv as Vector3 = Vector3((w.y * wv.z) - (w.z * wv.y), (w.z * wv.x) - (w.x * wv.z), (w.x * wv.y) - (w.y * wv.x)) 618 | a *= 2 619 | wv.x *= a 620 | wv.y *= a 621 | wv.z *= a 622 | wwv.x *= 2 623 | wwv.y *= 2 624 | wwv.z *= 2 625 | result.x += wv.x 626 | result.y += wv.y 627 | result.z += wv.z 628 | result.x += wwv.x 629 | result.y += wwv.y 630 | result.z += wwv.z 631 | return result 632 | end function 633 | 634 | private function Vector3Lerp(byval v1 as Vector3, byval v2 as Vector3, byval amount as single) as Vector3 635 | dim result as Vector3 636 | result.x = v1.x + (amount * (v2.x - v1.x)) 637 | result.y = v1.y + (amount * (v2.y - v1.y)) 638 | result.z = v1.z + (amount * (v2.z - v1.z)) 639 | return result 640 | end function 641 | 642 | private function Vector3Reflect(byval v as Vector3, byval normal as Vector3) as Vector3 643 | dim result as Vector3 644 | dim dotProduct as single = ((v.x * normal.x) + (v.y * normal.y)) + (v.z * normal.z) 645 | result.x = v.x - ((2.0f * normal.x) * dotProduct) 646 | result.y = v.y - ((2.0f * normal.y) * dotProduct) 647 | result.z = v.z - ((2.0f * normal.z) * dotProduct) 648 | return result 649 | end function 650 | 651 | private function Vector3Min(byval v1 as Vector3, byval v2 as Vector3) as Vector3 652 | dim result as Vector3 653 | result.x = fminf(v1.x, v2.x) 654 | result.y = fminf(v1.y, v2.y) 655 | result.z = fminf(v1.z, v2.z) 656 | return result 657 | end function 658 | 659 | private function Vector3Max(byval v1 as Vector3, byval v2 as Vector3) as Vector3 660 | dim result as Vector3 661 | result.x = fmaxf(v1.x, v2.x) 662 | result.y = fmaxf(v1.y, v2.y) 663 | result.z = fmaxf(v1.z, v2.z) 664 | return result 665 | end function 666 | 667 | private function Vector3Barycenter(byval p as Vector3, byval a as Vector3, byval b as Vector3, byval c as Vector3) as Vector3 668 | dim result as Vector3 669 | dim v0 as Vector3 = Vector3(b.x - a.x, b.y - a.y, b.z - a.z) 670 | dim v1 as Vector3 = Vector3(c.x - a.x, c.y - a.y, c.z - a.z) 671 | dim v2 as Vector3 = Vector3(p.x - a.x, p.y - a.y, p.z - a.z) 672 | dim d00 as single = ((v0.x * v0.x) + (v0.y * v0.y)) + (v0.z * v0.z) 673 | dim d01 as single = ((v0.x * v1.x) + (v0.y * v1.y)) + (v0.z * v1.z) 674 | dim d11 as single = ((v1.x * v1.x) + (v1.y * v1.y)) + (v1.z * v1.z) 675 | dim d20 as single = ((v2.x * v0.x) + (v2.y * v0.y)) + (v2.z * v0.z) 676 | dim d21 as single = ((v2.x * v1.x) + (v2.y * v1.y)) + (v2.z * v1.z) 677 | dim denom as single = (d00 * d11) - (d01 * d01) 678 | result.y = ((d11 * d20) - (d01 * d21)) / denom 679 | result.z = ((d00 * d21) - (d01 * d20)) / denom 680 | result.x = 1.0f - (result.z + result.y) 681 | return result 682 | end function 683 | 684 | private function Vector3Unproject(byval source as Vector3, byval projection as Matrix, byval view_ as Matrix) as Vector3 685 | dim result as Vector3 686 | dim matViewProj as Matrix = ((((view_.m0 * projection.m0) + (view_.m1 * projection.m4)) + (view_.m2 * projection.m8)) + (view_.m3 * projection.m12), (((view_.m0 * projection.m1) + (view_.m1 * projection.m5)) + (view_.m2 * projection.m9)) + (view_.m3 * projection.m13), (((view_.m0 * projection.m2) + (view_.m1 * projection.m6)) + (view_.m2 * projection.m10)) + (view_.m3 * projection.m14), (((view_.m0 * projection.m3) + (view_.m1 * projection.m7)) + (view_.m2 * projection.m11)) + (view_.m3 * projection.m15), (((view_.m4 * projection.m0) + (view_.m5 * projection.m4)) + (view_.m6 * projection.m8)) + (view_.m7 * projection.m12), (((view_.m4 * projection.m1) + (view_.m5 * projection.m5)) + (view_.m6 * projection.m9)) + (view_.m7 * projection.m13), (((view_.m4 * projection.m2) + (view_.m5 * projection.m6)) + (view_.m6 * projection.m10)) + (view_.m7 * projection.m14), (((view_.m4 * projection.m3) + (view_.m5 * projection.m7)) + (view_.m6 * projection.m11)) + (view_.m7 * projection.m15), (((view_.m8 * projection.m0) + (view_.m9 * projection.m4)) + (view_.m10 * projection.m8)) + (view_.m11 * projection.m12), (((view_.m8 * projection.m1) + (view_.m9 * projection.m5)) + (view_.m10 * projection.m9)) + (view_.m11 * projection.m13), (((view_.m8 * projection.m2) + (view_.m9 * projection.m6)) + (view_.m10 * projection.m10)) + (view_.m11 * projection.m14), (((view_.m8 * projection.m3) + (view_.m9 * projection.m7)) + (view_.m10 * projection.m11)) + (view_.m11 * projection.m15), (((view_.m12 * projection.m0) + (view_.m13 * projection.m4)) + (view_.m14 * projection.m8)) + (view_.m15 * projection.m12), (((view_.m12 * projection.m1) + (view_.m13 * projection.m5)) + (view_.m14 * projection.m9)) + (view_.m15 * projection.m13), (((view_.m12 * projection.m2) + (view_.m13 * projection.m6)) + (view_.m14 * projection.m10)) + (view_.m15 * projection.m14), (((view_.m12 * projection.m3) + (view_.m13 * projection.m7)) + (view_.m14 * projection.m11)) + (view_.m15 * projection.m15)) 687 | dim a00 as single = matViewProj.m0 688 | dim a01 as single = matViewProj.m1 689 | dim a02 as single = matViewProj.m2 690 | dim a03 as single = matViewProj.m3 691 | dim a10 as single = matViewProj.m4 692 | dim a11 as single = matViewProj.m5 693 | dim a12 as single = matViewProj.m6 694 | dim a13 as single = matViewProj.m7 695 | dim a20 as single = matViewProj.m8 696 | dim a21 as single = matViewProj.m9 697 | dim a22 as single = matViewProj.m10 698 | dim a23 as single = matViewProj.m11 699 | dim a30 as single = matViewProj.m12 700 | dim a31 as single = matViewProj.m13 701 | dim a32 as single = matViewProj.m14 702 | dim a33 as single = matViewProj.m15 703 | dim b00 as single = (a00 * a11) - (a01 * a10) 704 | dim b01 as single = (a00 * a12) - (a02 * a10) 705 | dim b02 as single = (a00 * a13) - (a03 * a10) 706 | dim b03 as single = (a01 * a12) - (a02 * a11) 707 | dim b04 as single = (a01 * a13) - (a03 * a11) 708 | dim b05 as single = (a02 * a13) - (a03 * a12) 709 | dim b06 as single = (a20 * a31) - (a21 * a30) 710 | dim b07 as single = (a20 * a32) - (a22 * a30) 711 | dim b08 as single = (a20 * a33) - (a23 * a30) 712 | dim b09 as single = (a21 * a32) - (a22 * a31) 713 | dim b10 as single = (a21 * a33) - (a23 * a31) 714 | dim b11 as single = (a22 * a33) - (a23 * a32) 715 | dim invDet as single = 1.0f / ((((((b00 * b11) - (b01 * b10)) + (b02 * b09)) + (b03 * b08)) - (b04 * b07)) + (b05 * b06)) 716 | dim matViewProjInv as Matrix = ((((a11 * b11) - (a12 * b10)) + (a13 * b09)) * invDet, ((((-a01) * b11) + (a02 * b10)) - (a03 * b09)) * invDet, (((a31 * b05) - (a32 * b04)) + (a33 * b03)) * invDet, ((((-a21) * b05) + (a22 * b04)) - (a23 * b03)) * invDet, ((((-a10) * b11) + (a12 * b08)) - (a13 * b07)) * invDet, (((a00 * b11) - (a02 * b08)) + (a03 * b07)) * invDet, ((((-a30) * b05) + (a32 * b02)) - (a33 * b01)) * invDet, (((a20 * b05) - (a22 * b02)) + (a23 * b01)) * invDet, (((a10 * b10) - (a11 * b08)) + (a13 * b06)) * invDet, ((((-a00) * b10) + (a01 * b08)) - (a03 * b06)) * invDet, (((a30 * b04) - (a31 * b02)) + (a33 * b00)) * invDet, ((((-a20) * b04) + (a21 * b02)) - (a23 * b00)) * invDet, ((((-a10) * b09) + (a11 * b07)) - (a12 * b06)) * invDet, (((a00 * b09) - (a01 * b07)) + (a02 * b06)) * invDet, ((((-a30) * b03) + (a31 * b01)) - (a32 * b00)) * invDet, (((a20 * b03) - (a21 * b01)) + (a22 * b00)) * invDet) 717 | dim quat as Quaternion = Quaternion(source.x, source.y, source.z, 1.0f) 718 | dim qtransformed as Quaternion = Quaternion((((matViewProjInv.m0 * quat.x) + (matViewProjInv.m4 * quat.y)) + (matViewProjInv.m8 * quat.z)) + (matViewProjInv.m12 * quat.w), (((matViewProjInv.m1 * quat.x) + (matViewProjInv.m5 * quat.y)) + (matViewProjInv.m9 * quat.z)) + (matViewProjInv.m13 * quat.w), (((matViewProjInv.m2 * quat.x) + (matViewProjInv.m6 * quat.y)) + (matViewProjInv.m10 * quat.z)) + (matViewProjInv.m14 * quat.w), (((matViewProjInv.m3 * quat.x) + (matViewProjInv.m7 * quat.y)) + (matViewProjInv.m11 * quat.z)) + (matViewProjInv.m15 * quat.w)) 719 | result.x = qtransformed.x / qtransformed.w 720 | result.y = qtransformed.y / qtransformed.w 721 | result.z = qtransformed.z / qtransformed.w 722 | return result 723 | end function 724 | 725 | private function Vector3ToFloatV(byval v as Vector3) as float3 726 | dim buffer as float3 727 | buffer.v(0) = v.x 728 | buffer.v(1) = v.y 729 | buffer.v(2) = v.z 730 | return buffer 731 | end function 732 | 733 | private function Vector3Invert(byval v as Vector3) as Vector3 734 | dim result as Vector3 = Vector3(1.0f / v.x, 1.0f / v.y, 1.0f / v.z) 735 | return result 736 | end function 737 | 738 | private function Vector3Clamp(byval v as Vector3, byval min as Vector3, byval max as Vector3) as Vector3 739 | dim result as Vector3 740 | result.x = fminf(max.x, fmaxf(min.x, v.x)) 741 | result.y = fminf(max.y, fmaxf(min.y, v.y)) 742 | result.z = fminf(max.z, fmaxf(min.z, v.z)) 743 | return result 744 | end function 745 | 746 | private function Vector3ClampValue(byval v as Vector3, byval min as single, byval max as single) as Vector3 747 | dim result as Vector3 = v 748 | dim length as single = ((v.x * v.x) + (v.y * v.y)) + (v.z * v.z) 749 | if length > 0.0f then 750 | length = sqrtf(length) 751 | if length < min then 752 | dim scale as single = min / length 753 | result.x = v.x * scale 754 | result.y = v.y * scale 755 | result.z = v.z * scale 756 | elseif length > max then 757 | dim scale as single = max / length 758 | result.x = v.x * scale 759 | result.y = v.y * scale 760 | result.z = v.z * scale 761 | end if 762 | end if 763 | return result 764 | end function 765 | 766 | private function Vector3Equals(byval p as Vector3, byval q as Vector3) as long 767 | dim result as long = -(((fabsf(p.x - q.x) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) andalso (fabsf(p.y - q.y) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y)))))) andalso (fabsf(p.z - q.z) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z)))))) 768 | return result 769 | end function 770 | 771 | private function Vector3Refract(byval v as Vector3, byval n as Vector3, byval r as single) as Vector3 772 | dim result as Vector3 773 | dim dot as single = ((v.x * n.x) + (v.y * n.y)) + (v.z * n.z) 774 | dim d as single = 1.0f - ((r * r) * (1.0f - (dot * dot))) 775 | if d >= 0.0f then 776 | d = sqrtf(d) 777 | v.x = (r * v.x) - (((r * dot) + d) * n.x) 778 | v.y = (r * v.y) - (((r * dot) + d) * n.y) 779 | v.z = (r * v.z) - (((r * dot) + d) * n.z) 780 | result = v 781 | end if 782 | return result 783 | end function 784 | 785 | private function MatrixDeterminant(byval mat as Matrix) as single 786 | dim result as single = 0.0f 787 | dim a00 as single = mat.m0 788 | dim a01 as single = mat.m1 789 | dim a02 as single = mat.m2 790 | dim a03 as single = mat.m3 791 | dim a10 as single = mat.m4 792 | dim a11 as single = mat.m5 793 | dim a12 as single = mat.m6 794 | dim a13 as single = mat.m7 795 | dim a20 as single = mat.m8 796 | dim a21 as single = mat.m9 797 | dim a22 as single = mat.m10 798 | dim a23 as single = mat.m11 799 | dim a30 as single = mat.m12 800 | dim a31 as single = mat.m13 801 | dim a32 as single = mat.m14 802 | dim a33 as single = mat.m15 803 | result = (((((((((((((((((((((((((a30 * a21) * a12) * a03) - (((a20 * a31) * a12) * a03)) - (((a30 * a11) * a22) * a03)) + (((a10 * a31) * a22) * a03)) + (((a20 * a11) * a32) * a03)) - (((a10 * a21) * a32) * a03)) - (((a30 * a21) * a02) * a13)) + (((a20 * a31) * a02) * a13)) + (((a30 * a01) * a22) * a13)) - (((a00 * a31) * a22) * a13)) - (((a20 * a01) * a32) * a13)) + (((a00 * a21) * a32) * a13)) + (((a30 * a11) * a02) * a23)) - (((a10 * a31) * a02) * a23)) - (((a30 * a01) * a12) * a23)) + (((a00 * a31) * a12) * a23)) + (((a10 * a01) * a32) * a23)) - (((a00 * a11) * a32) * a23)) - (((a20 * a11) * a02) * a33)) + (((a10 * a21) * a02) * a33)) + (((a20 * a01) * a12) * a33)) - (((a00 * a21) * a12) * a33)) - (((a10 * a01) * a22) * a33)) + (((a00 * a11) * a22) * a33) 804 | return result 805 | end function 806 | 807 | private function MatrixTrace(byval mat as Matrix) as single 808 | dim result as single = ((mat.m0 + mat.m5) + mat.m10) + mat.m15 809 | return result 810 | end function 811 | 812 | private function MatrixTranspose(byval mat as Matrix) as Matrix 813 | dim result as Matrix = (0) 814 | result.m0 = mat.m0 815 | result.m1 = mat.m4 816 | result.m2 = mat.m8 817 | result.m3 = mat.m12 818 | result.m4 = mat.m1 819 | result.m5 = mat.m5 820 | result.m6 = mat.m9 821 | result.m7 = mat.m13 822 | result.m8 = mat.m2 823 | result.m9 = mat.m6 824 | result.m10 = mat.m10 825 | result.m11 = mat.m14 826 | result.m12 = mat.m3 827 | result.m13 = mat.m7 828 | result.m14 = mat.m11 829 | result.m15 = mat.m15 830 | return result 831 | end function 832 | 833 | private function MatrixInvert(byval mat as Matrix) as Matrix 834 | dim result as Matrix = (0) 835 | dim a00 as single = mat.m0 836 | dim a01 as single = mat.m1 837 | dim a02 as single = mat.m2 838 | dim a03 as single = mat.m3 839 | dim a10 as single = mat.m4 840 | dim a11 as single = mat.m5 841 | dim a12 as single = mat.m6 842 | dim a13 as single = mat.m7 843 | dim a20 as single = mat.m8 844 | dim a21 as single = mat.m9 845 | dim a22 as single = mat.m10 846 | dim a23 as single = mat.m11 847 | dim a30 as single = mat.m12 848 | dim a31 as single = mat.m13 849 | dim a32 as single = mat.m14 850 | dim a33 as single = mat.m15 851 | dim b00 as single = (a00 * a11) - (a01 * a10) 852 | dim b01 as single = (a00 * a12) - (a02 * a10) 853 | dim b02 as single = (a00 * a13) - (a03 * a10) 854 | dim b03 as single = (a01 * a12) - (a02 * a11) 855 | dim b04 as single = (a01 * a13) - (a03 * a11) 856 | dim b05 as single = (a02 * a13) - (a03 * a12) 857 | dim b06 as single = (a20 * a31) - (a21 * a30) 858 | dim b07 as single = (a20 * a32) - (a22 * a30) 859 | dim b08 as single = (a20 * a33) - (a23 * a30) 860 | dim b09 as single = (a21 * a32) - (a22 * a31) 861 | dim b10 as single = (a21 * a33) - (a23 * a31) 862 | dim b11 as single = (a22 * a33) - (a23 * a32) 863 | dim invDet as single = 1.0f / ((((((b00 * b11) - (b01 * b10)) + (b02 * b09)) + (b03 * b08)) - (b04 * b07)) + (b05 * b06)) 864 | result.m0 = (((a11 * b11) - (a12 * b10)) + (a13 * b09)) * invDet 865 | result.m1 = ((((-a01) * b11) + (a02 * b10)) - (a03 * b09)) * invDet 866 | result.m2 = (((a31 * b05) - (a32 * b04)) + (a33 * b03)) * invDet 867 | result.m3 = ((((-a21) * b05) + (a22 * b04)) - (a23 * b03)) * invDet 868 | result.m4 = ((((-a10) * b11) + (a12 * b08)) - (a13 * b07)) * invDet 869 | result.m5 = (((a00 * b11) - (a02 * b08)) + (a03 * b07)) * invDet 870 | result.m6 = ((((-a30) * b05) + (a32 * b02)) - (a33 * b01)) * invDet 871 | result.m7 = (((a20 * b05) - (a22 * b02)) + (a23 * b01)) * invDet 872 | result.m8 = (((a10 * b10) - (a11 * b08)) + (a13 * b06)) * invDet 873 | result.m9 = ((((-a00) * b10) + (a01 * b08)) - (a03 * b06)) * invDet 874 | result.m10 = (((a30 * b04) - (a31 * b02)) + (a33 * b00)) * invDet 875 | result.m11 = ((((-a20) * b04) + (a21 * b02)) - (a23 * b00)) * invDet 876 | result.m12 = ((((-a10) * b09) + (a11 * b07)) - (a12 * b06)) * invDet 877 | result.m13 = (((a00 * b09) - (a01 * b07)) + (a02 * b06)) * invDet 878 | result.m14 = ((((-a30) * b03) + (a31 * b01)) - (a32 * b00)) * invDet 879 | result.m15 = (((a20 * b03) - (a21 * b01)) + (a22 * b00)) * invDet 880 | return result 881 | end function 882 | 883 | private function MatrixIdentity() as Matrix 884 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 885 | return result 886 | end function 887 | 888 | private function MatrixAdd(byval left_ as Matrix, byval right_ as Matrix) as Matrix 889 | dim result as Matrix = (0) 890 | result.m0 = left_.m0 + right_.m0 891 | result.m1 = left_.m1 + right_.m1 892 | result.m2 = left_.m2 + right_.m2 893 | result.m3 = left_.m3 + right_.m3 894 | result.m4 = left_.m4 + right_.m4 895 | result.m5 = left_.m5 + right_.m5 896 | result.m6 = left_.m6 + right_.m6 897 | result.m7 = left_.m7 + right_.m7 898 | result.m8 = left_.m8 + right_.m8 899 | result.m9 = left_.m9 + right_.m9 900 | result.m10 = left_.m10 + right_.m10 901 | result.m11 = left_.m11 + right_.m11 902 | result.m12 = left_.m12 + right_.m12 903 | result.m13 = left_.m13 + right_.m13 904 | result.m14 = left_.m14 + right_.m14 905 | result.m15 = left_.m15 + right_.m15 906 | return result 907 | end function 908 | 909 | private function MatrixSubtract(byval left_ as Matrix, byval right_ as Matrix) as Matrix 910 | dim result as Matrix = (0) 911 | result.m0 = left_.m0 - right_.m0 912 | result.m1 = left_.m1 - right_.m1 913 | result.m2 = left_.m2 - right_.m2 914 | result.m3 = left_.m3 - right_.m3 915 | result.m4 = left_.m4 - right_.m4 916 | result.m5 = left_.m5 - right_.m5 917 | result.m6 = left_.m6 - right_.m6 918 | result.m7 = left_.m7 - right_.m7 919 | result.m8 = left_.m8 - right_.m8 920 | result.m9 = left_.m9 - right_.m9 921 | result.m10 = left_.m10 - right_.m10 922 | result.m11 = left_.m11 - right_.m11 923 | result.m12 = left_.m12 - right_.m12 924 | result.m13 = left_.m13 - right_.m13 925 | result.m14 = left_.m14 - right_.m14 926 | result.m15 = left_.m15 - right_.m15 927 | return result 928 | end function 929 | 930 | private function MatrixMultiply(byval left_ as Matrix, byval right_ as Matrix) as Matrix 931 | dim result as Matrix = (0) 932 | result.m0 = (((left_.m0 * right_.m0) + (left_.m1 * right_.m4)) + (left_.m2 * right_.m8)) + (left_.m3 * right_.m12) 933 | result.m1 = (((left_.m0 * right_.m1) + (left_.m1 * right_.m5)) + (left_.m2 * right_.m9)) + (left_.m3 * right_.m13) 934 | result.m2 = (((left_.m0 * right_.m2) + (left_.m1 * right_.m6)) + (left_.m2 * right_.m10)) + (left_.m3 * right_.m14) 935 | result.m3 = (((left_.m0 * right_.m3) + (left_.m1 * right_.m7)) + (left_.m2 * right_.m11)) + (left_.m3 * right_.m15) 936 | result.m4 = (((left_.m4 * right_.m0) + (left_.m5 * right_.m4)) + (left_.m6 * right_.m8)) + (left_.m7 * right_.m12) 937 | result.m5 = (((left_.m4 * right_.m1) + (left_.m5 * right_.m5)) + (left_.m6 * right_.m9)) + (left_.m7 * right_.m13) 938 | result.m6 = (((left_.m4 * right_.m2) + (left_.m5 * right_.m6)) + (left_.m6 * right_.m10)) + (left_.m7 * right_.m14) 939 | result.m7 = (((left_.m4 * right_.m3) + (left_.m5 * right_.m7)) + (left_.m6 * right_.m11)) + (left_.m7 * right_.m15) 940 | result.m8 = (((left_.m8 * right_.m0) + (left_.m9 * right_.m4)) + (left_.m10 * right_.m8)) + (left_.m11 * right_.m12) 941 | result.m9 = (((left_.m8 * right_.m1) + (left_.m9 * right_.m5)) + (left_.m10 * right_.m9)) + (left_.m11 * right_.m13) 942 | result.m10 = (((left_.m8 * right_.m2) + (left_.m9 * right_.m6)) + (left_.m10 * right_.m10)) + (left_.m11 * right_.m14) 943 | result.m11 = (((left_.m8 * right_.m3) + (left_.m9 * right_.m7)) + (left_.m10 * right_.m11)) + (left_.m11 * right_.m15) 944 | result.m12 = (((left_.m12 * right_.m0) + (left_.m13 * right_.m4)) + (left_.m14 * right_.m8)) + (left_.m15 * right_.m12) 945 | result.m13 = (((left_.m12 * right_.m1) + (left_.m13 * right_.m5)) + (left_.m14 * right_.m9)) + (left_.m15 * right_.m13) 946 | result.m14 = (((left_.m12 * right_.m2) + (left_.m13 * right_.m6)) + (left_.m14 * right_.m10)) + (left_.m15 * right_.m14) 947 | result.m15 = (((left_.m12 * right_.m3) + (left_.m13 * right_.m7)) + (left_.m14 * right_.m11)) + (left_.m15 * right_.m15) 948 | return result 949 | end function 950 | 951 | private function MatrixTranslate(byval x as single, byval y as single, byval z as single) as Matrix 952 | dim result as Matrix = (1.0f, 0.0f, 0.0f, x, 0.0f, 1.0f, 0.0f, y, 0.0f, 0.0f, 1.0f, z, 0.0f, 0.0f, 0.0f, 1.0f) 953 | return result 954 | end function 955 | 956 | private function MatrixRotate(byval axis as Vector3, byval angle as single) as Matrix 957 | dim result as Matrix = (0) 958 | dim x as single = axis.x 959 | dim y as single = axis.y 960 | dim z as single = axis.z 961 | dim lengthSquared as single = ((x * x) + (y * y)) + (z * z) 962 | if (lengthSquared <> 1.0f) andalso (lengthSquared <> 0.0f) then 963 | dim ilength as single = 1.0f / sqrtf(lengthSquared) 964 | x *= ilength 965 | y *= ilength 966 | z *= ilength 967 | end if 968 | dim sinres as single = sinf(angle) 969 | dim cosres as single = cosf(angle) 970 | dim t as single = 1.0f - cosres 971 | result.m0 = ((x * x) * t) + cosres 972 | result.m1 = ((y * x) * t) + (z * sinres) 973 | result.m2 = ((z * x) * t) - (y * sinres) 974 | result.m3 = 0.0f 975 | result.m4 = ((x * y) * t) - (z * sinres) 976 | result.m5 = ((y * y) * t) + cosres 977 | result.m6 = ((z * y) * t) + (x * sinres) 978 | result.m7 = 0.0f 979 | result.m8 = ((x * z) * t) + (y * sinres) 980 | result.m9 = ((y * z) * t) - (x * sinres) 981 | result.m10 = ((z * z) * t) + cosres 982 | result.m11 = 0.0f 983 | result.m12 = 0.0f 984 | result.m13 = 0.0f 985 | result.m14 = 0.0f 986 | result.m15 = 1.0f 987 | return result 988 | end function 989 | 990 | private function MatrixRotateX(byval angle as single) as Matrix 991 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 992 | dim cosres as single = cosf(angle) 993 | dim sinres as single = sinf(angle) 994 | result.m5 = cosres 995 | result.m6 = sinres 996 | result.m9 = -sinres 997 | result.m10 = cosres 998 | return result 999 | end function 1000 | 1001 | private function MatrixRotateY(byval angle as single) as Matrix 1002 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 1003 | dim cosres as single = cosf(angle) 1004 | dim sinres as single = sinf(angle) 1005 | result.m0 = cosres 1006 | result.m2 = -sinres 1007 | result.m8 = sinres 1008 | result.m10 = cosres 1009 | return result 1010 | end function 1011 | 1012 | private function MatrixRotateZ(byval angle as single) as Matrix 1013 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 1014 | dim cosres as single = cosf(angle) 1015 | dim sinres as single = sinf(angle) 1016 | result.m0 = cosres 1017 | result.m1 = sinres 1018 | result.m4 = -sinres 1019 | result.m5 = cosres 1020 | return result 1021 | end function 1022 | 1023 | private function MatrixRotateXYZ(byval angle as Vector3) as Matrix 1024 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 1025 | dim cosz as single = cosf(-angle.z) 1026 | dim sinz as single = sinf(-angle.z) 1027 | dim cosy as single = cosf(-angle.y) 1028 | dim siny as single = sinf(-angle.y) 1029 | dim cosx as single = cosf(-angle.x) 1030 | dim sinx as single = sinf(-angle.x) 1031 | result.m0 = cosz * cosy 1032 | result.m1 = ((cosz * siny) * sinx) - (sinz * cosx) 1033 | result.m2 = ((cosz * siny) * cosx) + (sinz * sinx) 1034 | result.m4 = sinz * cosy 1035 | result.m5 = ((sinz * siny) * sinx) + (cosz * cosx) 1036 | result.m6 = ((sinz * siny) * cosx) - (cosz * sinx) 1037 | result.m8 = -siny 1038 | result.m9 = cosy * sinx 1039 | result.m10 = cosy * cosx 1040 | return result 1041 | end function 1042 | 1043 | private function MatrixRotateZYX(byval angle as Vector3) as Matrix 1044 | dim result as Matrix = (0) 1045 | dim cz as single = cosf(angle.z) 1046 | dim sz as single = sinf(angle.z) 1047 | dim cy as single = cosf(angle.y) 1048 | dim sy as single = sinf(angle.y) 1049 | dim cx as single = cosf(angle.x) 1050 | dim sx as single = sinf(angle.x) 1051 | result.m0 = cz * cy 1052 | result.m4 = ((cz * sy) * sx) - (cx * sz) 1053 | result.m8 = (sz * sx) + ((cz * cx) * sy) 1054 | result.m12 = 0 1055 | result.m1 = cy * sz 1056 | result.m5 = (cz * cx) + ((sz * sy) * sx) 1057 | result.m9 = ((cx * sz) * sy) - (cz * sx) 1058 | result.m13 = 0 1059 | result.m2 = -sy 1060 | result.m6 = cy * sx 1061 | result.m10 = cy * cx 1062 | result.m14 = 0 1063 | result.m3 = 0 1064 | result.m7 = 0 1065 | result.m11 = 0 1066 | result.m15 = 1 1067 | return result 1068 | end function 1069 | 1070 | private function MatrixScale(byval x as single, byval y as single, byval z as single) as Matrix 1071 | dim result as Matrix = (x, 0.0f, 0.0f, 0.0f, 0.0f, y, 0.0f, 0.0f, 0.0f, 0.0f, z, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 1072 | return result 1073 | end function 1074 | 1075 | private function MatrixFrustum(byval left_ as double, byval right_ as double, byval bottom as double, byval top as double, byval near as double, byval far as double) as Matrix 1076 | dim result as Matrix = (0) 1077 | dim rl as single = csng(right_ - left_) 1078 | dim tb as single = csng(top - bottom) 1079 | dim fn as single = csng(far - near) 1080 | result.m0 = (csng(near) * 2.0f) / rl 1081 | result.m1 = 0.0f 1082 | result.m2 = 0.0f 1083 | result.m3 = 0.0f 1084 | result.m4 = 0.0f 1085 | result.m5 = (csng(near) * 2.0f) / tb 1086 | result.m6 = 0.0f 1087 | result.m7 = 0.0f 1088 | result.m8 = (csng(right_) + csng(left_)) / rl 1089 | result.m9 = (csng(top) + csng(bottom)) / tb 1090 | result.m10 = (-(csng(far) + csng(near))) / fn 1091 | result.m11 = -1.0f 1092 | result.m12 = 0.0f 1093 | result.m13 = 0.0f 1094 | result.m14 = (-((csng(far) * csng(near)) * 2.0f)) / fn 1095 | result.m15 = 0.0f 1096 | return result 1097 | end function 1098 | 1099 | private function MatrixPerspective(byval fovy as double, byval aspect as double, byval near as double, byval far as double) as Matrix 1100 | dim result as Matrix = (0) 1101 | dim top as double = near * tan(fovy * 0.5) 1102 | dim bottom as double = -top 1103 | dim right_ as double = top * aspect 1104 | dim left_ as double = -right_ 1105 | dim rl as single = csng(right_ - left_) 1106 | dim tb as single = csng(top - bottom) 1107 | dim fn as single = csng(far - near) 1108 | result.m0 = (csng(near) * 2.0f) / rl 1109 | result.m5 = (csng(near) * 2.0f) / tb 1110 | result.m8 = (csng(right_) + csng(left_)) / rl 1111 | result.m9 = (csng(top) + csng(bottom)) / tb 1112 | result.m10 = (-(csng(far) + csng(near))) / fn 1113 | result.m11 = -1.0f 1114 | result.m14 = (-((csng(far) * csng(near)) * 2.0f)) / fn 1115 | return result 1116 | end function 1117 | 1118 | private function MatrixOrtho(byval left_ as double, byval right_ as double, byval bottom as double, byval top as double, byval near as double, byval far as double) as Matrix 1119 | dim result as Matrix = (0) 1120 | dim rl as single = csng(right_ - left_) 1121 | dim tb as single = csng(top - bottom) 1122 | dim fn as single = csng(far - near) 1123 | result.m0 = 2.0f / rl 1124 | result.m1 = 0.0f 1125 | result.m2 = 0.0f 1126 | result.m3 = 0.0f 1127 | result.m4 = 0.0f 1128 | result.m5 = 2.0f / tb 1129 | result.m6 = 0.0f 1130 | result.m7 = 0.0f 1131 | result.m8 = 0.0f 1132 | result.m9 = 0.0f 1133 | result.m10 = (-2.0f) / fn 1134 | result.m11 = 0.0f 1135 | result.m12 = (-(csng(left_) + csng(right_))) / rl 1136 | result.m13 = (-(csng(top) + csng(bottom))) / tb 1137 | result.m14 = (-(csng(far) + csng(near))) / fn 1138 | result.m15 = 1.0f 1139 | return result 1140 | end function 1141 | 1142 | private function MatrixLookAt(byval eye as Vector3, byval target as Vector3, byval up as Vector3) as Matrix 1143 | dim result as Matrix = (0) 1144 | dim length as single = 0.0f 1145 | dim ilength as single = 0.0f 1146 | dim vz as Vector3 = Vector3(eye.x - target.x, eye.y - target.y, eye.z - target.z) 1147 | dim v as Vector3 = vz 1148 | length = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 1149 | if length = 0.0f then 1150 | length = 1.0f 1151 | end if 1152 | ilength = 1.0f / length 1153 | vz.x *= ilength 1154 | vz.y *= ilength 1155 | vz.z *= ilength 1156 | dim vx as Vector3 = Vector3((up.y * vz.z) - (up.z * vz.y), (up.z * vz.x) - (up.x * vz.z), (up.x * vz.y) - (up.y * vz.x)) 1157 | v = vx 1158 | length = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 1159 | if length = 0.0f then 1160 | length = 1.0f 1161 | end if 1162 | ilength = 1.0f / length 1163 | vx.x *= ilength 1164 | vx.y *= ilength 1165 | vx.z *= ilength 1166 | dim vy as Vector3 = Vector3((vz.y * vx.z) - (vz.z * vx.y), (vz.z * vx.x) - (vz.x * vx.z), (vz.x * vx.y) - (vz.y * vx.x)) 1167 | result.m0 = vx.x 1168 | result.m1 = vy.x 1169 | result.m2 = vz.x 1170 | result.m3 = 0.0f 1171 | result.m4 = vx.y 1172 | result.m5 = vy.y 1173 | result.m6 = vz.y 1174 | result.m7 = 0.0f 1175 | result.m8 = vx.z 1176 | result.m9 = vy.z 1177 | result.m10 = vz.z 1178 | result.m11 = 0.0f 1179 | result.m12 = -(((vx.x * eye.x) + (vx.y * eye.y)) + (vx.z * eye.z)) 1180 | result.m13 = -(((vy.x * eye.x) + (vy.y * eye.y)) + (vy.z * eye.z)) 1181 | result.m14 = -(((vz.x * eye.x) + (vz.y * eye.y)) + (vz.z * eye.z)) 1182 | result.m15 = 1.0f 1183 | return result 1184 | end function 1185 | 1186 | private function MatrixToFloatV(byval mat as Matrix) as float16 1187 | dim result as float16 1188 | result.v(0) = mat.m0 1189 | result.v(1) = mat.m1 1190 | result.v(2) = mat.m2 1191 | result.v(3) = mat.m3 1192 | result.v(4) = mat.m4 1193 | result.v(5) = mat.m5 1194 | result.v(6) = mat.m6 1195 | result.v(7) = mat.m7 1196 | result.v(8) = mat.m8 1197 | result.v(9) = mat.m9 1198 | result.v(10) = mat.m10 1199 | result.v(11) = mat.m11 1200 | result.v(12) = mat.m12 1201 | result.v(13) = mat.m13 1202 | result.v(14) = mat.m14 1203 | result.v(15) = mat.m15 1204 | return result 1205 | end function 1206 | 1207 | private function QuaternionAdd(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 1208 | dim result as Quaternion = Quaternion(q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w) 1209 | return result 1210 | end function 1211 | 1212 | private function QuaternionAddValue(byval q as Quaternion, byval add as single) as Quaternion 1213 | dim result as Quaternion = Quaternion(q.x + add, q.y + add, q.z + add, q.w + add) 1214 | return result 1215 | end function 1216 | 1217 | private function QuaternionSubtract(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 1218 | dim result as Quaternion = Quaternion(q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w) 1219 | return result 1220 | end function 1221 | 1222 | private function QuaternionSubtractValue(byval q as Quaternion, byval sub_ as single) as Quaternion 1223 | dim result as Quaternion = Quaternion(q.x - sub_, q.y - sub_, q.z - sub_, q.w - sub_) 1224 | return result 1225 | end function 1226 | 1227 | private function QuaternionIdentity() as Quaternion 1228 | dim result as Quaternion = Quaternion(0.0f, 0.0f, 0.0f, 1.0f) 1229 | return result 1230 | end function 1231 | 1232 | private function QuaternionLength(byval q as Quaternion) as single 1233 | dim result as single = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1234 | return result 1235 | end function 1236 | 1237 | private function QuaternionNormalize(byval q as Quaternion) as Quaternion 1238 | dim result as Quaternion 1239 | dim length as single = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1240 | if length = 0.0f then 1241 | length = 1.0f 1242 | end if 1243 | dim ilength as single = 1.0f / length 1244 | result.x = q.x * ilength 1245 | result.y = q.y * ilength 1246 | result.z = q.z * ilength 1247 | result.w = q.w * ilength 1248 | return result 1249 | end function 1250 | 1251 | private function QuaternionInvert(byval q as Quaternion) as Quaternion 1252 | dim result as Quaternion = q 1253 | dim lengthSq as single = (((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w) 1254 | if lengthSq <> 0.0f then 1255 | dim invLength as single = 1.0f / lengthSq 1256 | result.x *= -invLength 1257 | result.y *= -invLength 1258 | result.z *= -invLength 1259 | result.w *= invLength 1260 | end if 1261 | return result 1262 | end function 1263 | 1264 | private function QuaternionMultiply(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 1265 | dim result as Quaternion 1266 | dim qax as single = q1.x 1267 | dim qay as single = q1.y 1268 | dim qaz as single = q1.z 1269 | dim qaw as single = q1.w 1270 | dim qbx as single = q2.x 1271 | dim qby as single = q2.y 1272 | dim qbz as single = q2.z 1273 | dim qbw as single = q2.w 1274 | result.x = (((qax * qbw) + (qaw * qbx)) + (qay * qbz)) - (qaz * qby) 1275 | result.y = (((qay * qbw) + (qaw * qby)) + (qaz * qbx)) - (qax * qbz) 1276 | result.z = (((qaz * qbw) + (qaw * qbz)) + (qax * qby)) - (qay * qbx) 1277 | result.w = (((qaw * qbw) - (qax * qbx)) - (qay * qby)) - (qaz * qbz) 1278 | return result 1279 | end function 1280 | 1281 | private function QuaternionScale(byval q as Quaternion, byval mul as single) as Quaternion 1282 | dim result as Quaternion 1283 | result.x = q.x * mul 1284 | result.y = q.y * mul 1285 | result.z = q.z * mul 1286 | result.w = q.w * mul 1287 | return result 1288 | end function 1289 | 1290 | private function QuaternionDivide(byval q1 as Quaternion, byval q2 as Quaternion) as Quaternion 1291 | dim result as Quaternion = Quaternion(q1.x / q2.x, q1.y / q2.y, q1.z / q2.z, q1.w / q2.w) 1292 | return result 1293 | end function 1294 | 1295 | private function QuaternionLerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 1296 | dim result as Quaternion 1297 | result.x = q1.x + (amount * (q2.x - q1.x)) 1298 | result.y = q1.y + (amount * (q2.y - q1.y)) 1299 | result.z = q1.z + (amount * (q2.z - q1.z)) 1300 | result.w = q1.w + (amount * (q2.w - q1.w)) 1301 | return result 1302 | end function 1303 | 1304 | private function QuaternionNlerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 1305 | dim result as Quaternion 1306 | result.x = q1.x + (amount * (q2.x - q1.x)) 1307 | result.y = q1.y + (amount * (q2.y - q1.y)) 1308 | result.z = q1.z + (amount * (q2.z - q1.z)) 1309 | result.w = q1.w + (amount * (q2.w - q1.w)) 1310 | dim q as Quaternion = result 1311 | dim length as single = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1312 | if length = 0.0f then 1313 | length = 1.0f 1314 | end if 1315 | dim ilength as single = 1.0f / length 1316 | result.x = q.x * ilength 1317 | result.y = q.y * ilength 1318 | result.z = q.z * ilength 1319 | result.w = q.w * ilength 1320 | return result 1321 | end function 1322 | 1323 | private function QuaternionSlerp(byval q1 as Quaternion, byval q2 as Quaternion, byval amount as single) as Quaternion 1324 | dim result as Quaternion 1325 | dim cosHalfTheta as single = (((q1.x * q2.x) + (q1.y * q2.y)) + (q1.z * q2.z)) + (q1.w * q2.w) 1326 | if cosHalfTheta < 0 then 1327 | q2.x = -q2.x 1328 | q2.y = -q2.y 1329 | q2.z = -q2.z 1330 | q2.w = -q2.w 1331 | cosHalfTheta = -cosHalfTheta 1332 | end if 1333 | if fabsf(cosHalfTheta) >= 1.0f then 1334 | result = q1 1335 | elseif cosHalfTheta > 0.95f then 1336 | result = QuaternionNlerp(q1, q2, amount) 1337 | else 1338 | dim halfTheta as single = acosf(cosHalfTheta) 1339 | dim sinHalfTheta as single = sqrtf(1.0f - (cosHalfTheta * cosHalfTheta)) 1340 | if fabsf(sinHalfTheta) < 0.001f then 1341 | result.x = (q1.x * 0.5f) + (q2.x * 0.5f) 1342 | result.y = (q1.y * 0.5f) + (q2.y * 0.5f) 1343 | result.z = (q1.z * 0.5f) + (q2.z * 0.5f) 1344 | result.w = (q1.w * 0.5f) + (q2.w * 0.5f) 1345 | else 1346 | dim ratioA as single = sinf((1 - amount) * halfTheta) / sinHalfTheta 1347 | dim ratioB as single = sinf(amount * halfTheta) / sinHalfTheta 1348 | result.x = (q1.x * ratioA) + (q2.x * ratioB) 1349 | result.y = (q1.y * ratioA) + (q2.y * ratioB) 1350 | result.z = (q1.z * ratioA) + (q2.z * ratioB) 1351 | result.w = (q1.w * ratioA) + (q2.w * ratioB) 1352 | end if 1353 | end if 1354 | return result 1355 | end function 1356 | 1357 | private function QuaternionFromVector3ToVector3(byval from as Vector3, byval to_ as Vector3) as Quaternion 1358 | dim result as Quaternion 1359 | dim cos2Theta as single = ((from.x * to_.x) + (from.y * to_.y)) + (from.z * to_.z) 1360 | dim cross as Vector3 = Vector3((from.y * to_.z) - (from.z * to_.y), (from.z * to_.x) - (from.x * to_.z), (from.x * to_.y) - (from.y * to_.x)) 1361 | result.x = cross.x 1362 | result.y = cross.y 1363 | result.z = cross.z 1364 | result.w = 1.0f + cos2Theta 1365 | dim q as Quaternion = result 1366 | dim length as single = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1367 | if length = 0.0f then 1368 | length = 1.0f 1369 | end if 1370 | dim ilength as single = 1.0f / length 1371 | result.x = q.x * ilength 1372 | result.y = q.y * ilength 1373 | result.z = q.z * ilength 1374 | result.w = q.w * ilength 1375 | return result 1376 | end function 1377 | 1378 | private function QuaternionFromMatrix(byval mat as Matrix) as Quaternion 1379 | dim result as Quaternion 1380 | dim fourWSquaredMinus1 as single = (mat.m0 + mat.m5) + mat.m10 1381 | dim fourXSquaredMinus1 as single = (mat.m0 - mat.m5) - mat.m10 1382 | dim fourYSquaredMinus1 as single = (mat.m5 - mat.m0) - mat.m10 1383 | dim fourZSquaredMinus1 as single = (mat.m10 - mat.m0) - mat.m5 1384 | dim biggestIndex as long = 0 1385 | dim fourBiggestSquaredMinus1 as single = fourWSquaredMinus1 1386 | if fourXSquaredMinus1 > fourBiggestSquaredMinus1 then 1387 | fourBiggestSquaredMinus1 = fourXSquaredMinus1 1388 | biggestIndex = 1 1389 | end if 1390 | if fourYSquaredMinus1 > fourBiggestSquaredMinus1 then 1391 | fourBiggestSquaredMinus1 = fourYSquaredMinus1 1392 | biggestIndex = 2 1393 | end if 1394 | if fourZSquaredMinus1 > fourBiggestSquaredMinus1 then 1395 | fourBiggestSquaredMinus1 = fourZSquaredMinus1 1396 | biggestIndex = 3 1397 | end if 1398 | dim biggestVal as single = sqrtf(fourBiggestSquaredMinus1 + 1.0f) * 0.5f 1399 | dim mult as single = 0.25f / biggestVal 1400 | '' TODO: switch (biggestIndex) { case 0: result.w = biggestVal; result.x = (mat.m6 - mat.m9) * mult; result.y = (mat.m8 - mat.m2) * mult; result.z = (mat.m1 - mat.m4) * mult; break; case 1: result.x = biggestVal; result.w = (mat.m6 - mat.m9) * mult; result.y = (mat.m1 + mat.m4) * mult; result.z = (mat.m8 + mat.m2) * mult; break; case 2: result.y = biggestVal; result.w = (mat.m8 - mat.m2) * mult; result.x = (mat.m1 + mat.m4) * mult; result.z = (mat.m6 + mat.m9) * mult; break; case 3: result.z = biggestVal; result.w = (mat.m1 - mat.m4) * mult; result.x = (mat.m8 + mat.m2) * mult; result.y = (mat.m6 + mat.m9) * mult; break; } 1401 | return result 1402 | end function 1403 | 1404 | private function QuaternionToMatrix(byval q as Quaternion) as Matrix 1405 | dim result as Matrix = (1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) 1406 | dim a2 as single = q.x * q.x 1407 | dim b2 as single = q.y * q.y 1408 | dim c2 as single = q.z * q.z 1409 | dim ac as single = q.x * q.z 1410 | dim ab as single = q.x * q.y 1411 | dim bc as single = q.y * q.z 1412 | dim ad as single = q.w * q.x 1413 | dim bd as single = q.w * q.y 1414 | dim cd as single = q.w * q.z 1415 | result.m0 = 1 - (2 * (b2 + c2)) 1416 | result.m1 = 2 * (ab + cd) 1417 | result.m2 = 2 * (ac - bd) 1418 | result.m4 = 2 * (ab - cd) 1419 | result.m5 = 1 - (2 * (a2 + c2)) 1420 | result.m6 = 2 * (bc + ad) 1421 | result.m8 = 2 * (ac + bd) 1422 | result.m9 = 2 * (bc - ad) 1423 | result.m10 = 1 - (2 * (a2 + b2)) 1424 | return result 1425 | end function 1426 | 1427 | private function QuaternionFromAxisAngle(byval axis as Vector3, byval angle as single) as Quaternion 1428 | dim result as Quaternion = Quaternion(0.0f, 0.0f, 0.0f, 1.0f) 1429 | dim axisLength as single = sqrtf(((axis.x * axis.x) + (axis.y * axis.y)) + (axis.z * axis.z)) 1430 | if axisLength <> 0.0f then 1431 | angle *= 0.5f 1432 | dim length as single = 0.0f 1433 | dim ilength as single = 0.0f 1434 | dim v as Vector3 = axis 1435 | length = sqrtf(((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)) 1436 | if length = 0.0f then 1437 | length = 1.0f 1438 | end if 1439 | ilength = 1.0f / length 1440 | axis.x *= ilength 1441 | axis.y *= ilength 1442 | axis.z *= ilength 1443 | dim sinres as single = sinf(angle) 1444 | dim cosres as single = cosf(angle) 1445 | result.x = axis.x * sinres 1446 | result.y = axis.y * sinres 1447 | result.z = axis.z * sinres 1448 | result.w = cosres 1449 | dim q as Quaternion = result 1450 | length = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1451 | if length = 0.0f then 1452 | length = 1.0f 1453 | end if 1454 | ilength = 1.0f / length 1455 | result.x = q.x * ilength 1456 | result.y = q.y * ilength 1457 | result.z = q.z * ilength 1458 | result.w = q.w * ilength 1459 | end if 1460 | return result 1461 | end function 1462 | 1463 | private sub QuaternionToAxisAngle(byval q as Quaternion, byval outAxis as Vector3 ptr, byval outAngle as single ptr) 1464 | if fabsf(q.w) > 1.0f then 1465 | dim length as single = sqrtf((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)) 1466 | if length = 0.0f then 1467 | length = 1.0f 1468 | end if 1469 | dim ilength as single = 1.0f / length 1470 | q.x = q.x * ilength 1471 | q.y = q.y * ilength 1472 | q.z = q.z * ilength 1473 | q.w = q.w * ilength 1474 | end if 1475 | dim resAxis as Vector3 = Vector3(0.0f, 0.0f, 0.0f) 1476 | dim resAngle as single = 2.0f * acosf(q.w) 1477 | dim den as single = sqrtf(1.0f - (q.w * q.w)) 1478 | if den > 0.0001f then 1479 | resAxis.x = q.x / den 1480 | resAxis.y = q.y / den 1481 | resAxis.z = q.z / den 1482 | else 1483 | resAxis.x = 1.0f 1484 | end if 1485 | (*outAxis) = resAxis 1486 | (*outAngle) = resAngle 1487 | end sub 1488 | 1489 | private function QuaternionFromEuler(byval pitch as single, byval yaw as single, byval roll as single) as Quaternion 1490 | dim result as Quaternion 1491 | dim x0 as single = cosf(pitch * 0.5f) 1492 | dim x1 as single = sinf(pitch * 0.5f) 1493 | dim y0 as single = cosf(yaw * 0.5f) 1494 | dim y1 as single = sinf(yaw * 0.5f) 1495 | dim z0 as single = cosf(roll * 0.5f) 1496 | dim z1 as single = sinf(roll * 0.5f) 1497 | result.x = ((x1 * y0) * z0) - ((x0 * y1) * z1) 1498 | result.y = ((x0 * y1) * z0) + ((x1 * y0) * z1) 1499 | result.z = ((x0 * y0) * z1) - ((x1 * y1) * z0) 1500 | result.w = ((x0 * y0) * z0) + ((x1 * y1) * z1) 1501 | return result 1502 | end function 1503 | 1504 | private function QuaternionToEuler(byval q as Quaternion) as Vector3 1505 | dim result as Vector3 1506 | dim x0 as single = 2.0f * ((q.w * q.x) + (q.y * q.z)) 1507 | dim x1 as single = 1.0f - (2.0f * ((q.x * q.x) + (q.y * q.y))) 1508 | result.x = atan2f(x0, x1) 1509 | dim y0 as single = 2.0f * ((q.w * q.y) - (q.z * q.x)) 1510 | y0 = iif(y0 > 1.0f, 1.0f, y0) 1511 | y0 = iif(y0 < (-1.0f), -1.0f, y0) 1512 | result.y = asinf(y0) 1513 | dim z0 as single = 2.0f * ((q.w * q.z) + (q.x * q.y)) 1514 | dim z1 as single = 1.0f - (2.0f * ((q.y * q.y) + (q.z * q.z))) 1515 | result.z = atan2f(z0, z1) 1516 | return result 1517 | end function 1518 | 1519 | private function QuaternionTransform(byval q as Quaternion, byval mat as Matrix) as Quaternion 1520 | dim result as Quaternion 1521 | result.x = (((mat.m0 * q.x) + (mat.m4 * q.y)) + (mat.m8 * q.z)) + (mat.m12 * q.w) 1522 | result.y = (((mat.m1 * q.x) + (mat.m5 * q.y)) + (mat.m9 * q.z)) + (mat.m13 * q.w) 1523 | result.z = (((mat.m2 * q.x) + (mat.m6 * q.y)) + (mat.m10 * q.z)) + (mat.m14 * q.w) 1524 | result.w = (((mat.m3 * q.x) + (mat.m7 * q.y)) + (mat.m11 * q.z)) + (mat.m15 * q.w) 1525 | return result 1526 | end function 1527 | 1528 | private function QuaternionEquals(byval p as Quaternion, byval q as Quaternion) as long 1529 | dim result as long = -(((((fabsf(p.x - q.x) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) andalso (fabsf(p.y - q.y) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y)))))) andalso (fabsf(p.z - q.z) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z)))))) andalso (fabsf(p.w - q.w) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w)))))) orelse ((((fabsf(p.x + q.x) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) andalso (fabsf(p.y + q.y) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y)))))) andalso (fabsf(p.z + q.z) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z)))))) andalso (fabsf(p.w + q.w) <= (0.000001f * fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w))))))) 1530 | return result 1531 | end function 1532 | #endif 1533 | 1534 | end extern 1535 | --------------------------------------------------------------------------------