diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml new file mode 100644 index 00000000..bc55f166 --- /dev/null +++ b/.github/workflows/cmake-multi-platform.yml @@ -0,0 +1,76 @@ +name: CMake (Linux and Windows) + +on: + push: + branches: [ "master", "dev", "workflow-test" ] + pull_request: + branches: [ "master", "dev" ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + + matrix: + os: [ubuntu-latest, windows-latest] + build_type: [Release, Debug] + c_compiler: [gcc, clang, cl] + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: ubuntu-latest + c_compiler: gcc + cpp_compiler: g++ + - os: ubuntu-latest + c_compiler: clang + cpp_compiler: clang++ + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + steps: + - uses: actions/checkout@v3 + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Setup libraries + if: startsWith(matrix.os, 'ubuntu') + run: sudo apt-get install libsdl2-dev libassimp5 libglew2.2 libglew-dev + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Upload Linux build + if: startsWith(matrix.os, 'ubuntu') + uses: actions/upload-artifact@v3 + with: + name: HatchGameEngine-Linux-${{ matrix.build_type }}-${{ github.sha }}-${{ matrix.c_compiler }} + path: build/HatchGameEngine-${{ matrix.build_type }} + retention-days: 7 + + - name: Upload Windows build + if: startsWith(matrix.os, 'windows') + uses: actions/upload-artifact@v3 + with: + name: HatchGameEngine-Windows-${{ matrix.build_type }}-${{ github.sha }} + path: build/${{ matrix.build_type }}/HatchGameEngine-${{ matrix.build_type }}.exe + retention-days: 7 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4e7f74ef..9634f5d4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,8 +34,6 @@ mono_crash.* [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ -x64/ -x86/ [Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 29bf24b5..dc84b252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,17 @@ cmake_minimum_required(VERSION 3.10) # set the project name and version -project(HatchGameEngine VERSION 1.1.0) +project(HatchGameEngine VERSION 1.2.2) # specify the C++ standard -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=nocona") + +if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(CMAKE_CXX_FLAGS "/wd4244 /wd4267 /wd4305 /wd4717 /EHsc") +else() + set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -march=nocona") +endif() # Set up CMake modules path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -44,16 +49,16 @@ endif() option(USE_OPEN_ASSET_IMPORT_LIBRARY "Use Open Asset Import Library" ON) option(USE_FREETYPE_LIBRARY "Use FreeType" OFF) +if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(USE_OPEN_ASSET_IMPORT_LIBRARY OFF) +endif() + # Renderers option(USING_OPENGL "Use OpenGL" ON) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") option(USING_DIRECT3D "Use Direct3D" OFF) endif() -if(USE_OPEN_ASSET_IMPORT_LIBRARY) - add_definitions(-DUSING_ASSIMP) -endif() - if(USE_FREETYPE_LIBRARY) add_definitions(-DUSING_FREETYPE) endif() @@ -70,6 +75,8 @@ if(NOT ENABLE_SCRIPT_COMPILING) add_definitions(-DNO_SCRIPT_COMPILING) endif() +add_definitions(-DMINIZ_NO_ARCHIVE_APIS -DMINIZ_NO_ARCHIVE_WRITING_APIS -DMINIZ_NO_TIME ) + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(MAKEHEADERS_BINARY makeheaders.exe) else() @@ -82,6 +89,18 @@ add_custom_target(makeheaders ALL BYPRODUCTS "${CMAKE_SOURCE_DIR}/include/makeheaders.bin" "${CMAKE_SOURCE_DIR}/include/Engine" COMMENT "Generating header files") +find_file(REPO_DIR NAMES .git PATHS ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH) + +if (REPO_DIR) + execute_process( + COMMAND git log -1 --format=%H + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) + + add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"") +endif() + add_executable(${PROJECT_NAME} ${HATCH_SOURCES}) add_dependencies(${PROJECT_NAME} makeheaders) @@ -112,21 +131,30 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") add_definitions(-DUSING_LIBPNG) endif() if(USE_OPEN_ASSET_IMPORT_LIBRARY) - find_package(assimp REQUIRED) - set(ASSIMP_INCLUDE_DIRS assimp_INCLUDE_DIRS) - set(ASSIMP_LIBRARIES assimp) + find_package(assimp) + if(assimp_FOUND) + add_definitions(-DUSING_ASSIMP) + set(ASSIMP_INCLUDE_DIRS assimp_INCLUDE_DIRS) + set(ASSIMP_LIBRARIES assimp) + endif() endif() if(USING_OPENGL) set(OPENGL_LIBRARIES "-lGL -lGLEW") endif() else() set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/SDL2/") - if(USE_OPEN_ASSET_IMPORT_LIBRARY) - set(ASSIMP_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/assimp/") - set(ASSIMP_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libassimp.a;${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libzlibstatic.a") - endif() - if(USING_OPENGL) - set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libglew32.a;-lgdi32;-lopengl32") + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + if(USING_OPENGL) + set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/msvc/x64/glew32s.lib") + endif() + else() + if(USE_OPEN_ASSET_IMPORT_LIBRARY) + set(ASSIMP_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/meta/win/include/assimp/") + set(ASSIMP_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libassimp.a;${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libzlibstatic.a") + endif() + if(USING_OPENGL) + set(OPENGL_LIBRARIES "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libglew32.a;-lgdi32;-lopengl32") + endif() endif() endif() @@ -161,11 +189,16 @@ endif() # Add libraries if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - target_link_libraries(${PROJECT_NAME} - "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libSDL2.a" - -static -mwindows -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8 - -luser32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 - -lversion -luuid -lhid -lsetupapi -lws2_32) + if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + target_link_libraries(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/msvc/x64/SDL2.lib" + Ws2_32.lib opengl32.lib) + else() + target_link_libraries(${PROJECT_NAME} + "${CMAKE_CURRENT_LIST_DIR}/meta/win/lib/mingw/${TOOLCHAIN_PREFIX}/libSDL2.a" + -static -mwindows -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8 + -luser32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 + -lversion -luuid -lhid -lsetupapi -lws2_32) + endif() add_definitions(-DSDL_MAIN_HANDLED) else() target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES}) diff --git a/VisualC/HatchGameEngine.vcxproj b/VisualC/HatchGameEngine.vcxproj index b66f3d3c..1d74ea4a 100644 --- a/VisualC/HatchGameEngine.vcxproj +++ b/VisualC/HatchGameEngine.vcxproj @@ -66,23 +66,24 @@ true $(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath) - $(SolutionDir)..\meta\win\lib;$(LibraryPath) + $(SolutionDir)..\meta\win\lib\msvc\x86;$(LibraryPath) true $(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath) - $(SolutionDir)..\meta\win\lib;$(LibraryPath) + $(SolutionDir)..\meta\win\lib\msvc\x86;$(LibraryPath) $(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath) - $(SolutionDir)..\meta\win\lib;$(LibraryPath) + $(SolutionDir)..\meta\win\lib\msvc\x64;$(LibraryPath) $(SolutionDir)..\meta\win\include;$(SolutionDir)..\include;$(SolutionDir)..\source;$(IncludePath) - $(SolutionDir)..\meta\win\lib;$(LibraryPath) + $(SolutionDir)..\meta\win\lib\msvc\x64;$(LibraryPath) + stdcpp17 WIN32;TARGET_NAME="$(ProjectName)";GLEW_STATIC;USING_OPENGL;USING_FREETYPE;_DEBUG;_WINDOWS;DEBUG;%(PreprocessorDefinitions) Level3 ProgramDatabase @@ -104,6 +105,7 @@ CD .. + stdcpp17 WIN32;TARGET_NAME="$(ProjectName)";GLEW_STATIC;USING_OPENGL;USING_FREETYPE;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) Level3 ProgramDatabase @@ -126,7 +128,9 @@ CD .. - + + stdcpp17 + CD "..\tools" "makeheaders.exe" ../source @@ -137,6 +141,9 @@ CD .. + + stdcpp17 + CD "..\tools" "makeheaders.exe" ../source @@ -153,6 +160,7 @@ CD .. + @@ -195,6 +203,7 @@ CD .. + @@ -236,7 +245,10 @@ CD .. + + + @@ -245,6 +257,7 @@ CD .. + @@ -263,6 +276,14 @@ CD .. + + + + + + + + diff --git a/VisualC/HatchGameEngine.vcxproj.filters b/VisualC/HatchGameEngine.vcxproj.filters index cf4440b3..602081df 100644 --- a/VisualC/HatchGameEngine.vcxproj.filters +++ b/VisualC/HatchGameEngine.vcxproj.filters @@ -36,6 +36,9 @@ Source Files + + Source Files + Source Files @@ -156,6 +159,9 @@ Source Files + + Source Files + Source Files @@ -279,9 +285,18 @@ Source Files + + Source Files + Source Files + + Source Files + + + Source Files + Source Files @@ -306,6 +321,9 @@ Source Files + + Source Files + Source Files diff --git a/guides/Documentation.htm b/guides/Documentation.htm index c22184d9..abfa1a6b 100644 --- a/guides/Documentation.htm +++ b/guides/Documentation.htm @@ -56,9 +56,12 @@

Namespaces

  • Directory
  • Display
  • Draw
  • +
  • Draw3D
  • Ease
  • File
  • +
  • Geometry
  • HTTP
  • +
  • Image
  • Input
  • Instance
  • JSON
  • @@ -74,6 +77,7 @@

    Namespaces

  • Resources
  • Scene
  • Scene3D
  • +
  • SceneList
  • Serializer
  • Settings
  • Shader
  • @@ -114,6 +118,9 @@

    Enums

  • FileStream_*
  • Filter_*
  • FogEquation_*
  • +
  • GeoBooleanOp_*
  • +
  • GeoFillRule_*
  • +
  • HitboxSide_*
  • KeyBind_*
  • Persistence_*
  • Platform_*
  • @@ -122,7 +129,9 @@

    Enums

  • StencilOp_*
  • StencilTest_*
  • TILECOLLISION_*
  • +
  • TimeOfDay_*
  • TintMode_*
  • +
  • Weekday_*
  • Constants

    @@ -250,6 +261,8 @@

    Controller

  • Controller.HasShareButton
  • Controller.HasMicrophoneButton
  • Controller.HasPaddles
  • +
  • Controller.IsButtonHeld
  • +
  • Controller.IsButtonPressed
  • Controller.GetButton
  • Controller.GetAxis
  • Controller.GetType
  • @@ -323,40 +336,6 @@

    Draw

  • Draw.ViewPart
  • Draw.ViewSized
  • Draw.ViewPartSized
  • -
  • Draw.BindVertexBuffer
  • -
  • Draw.UnbindVertexBuffer
  • -
  • Draw.InitArrayBuffer
  • -
  • Draw.SetArrayBufferDrawMode
  • -
  • Draw.SetProjectionMatrix
  • -
  • Draw.SetViewMatrix
  • -
  • Draw.SetAmbientLighting
  • -
  • Draw.SetDiffuseLighting
  • -
  • Draw.SetSpecularLighting
  • -
  • Draw.SetFogDensity
  • -
  • Draw.SetFogColor
  • -
  • Draw.SetClipPolygons
  • -
  • Draw.SetPointSize
  • -
  • Draw.BindArrayBuffer
  • -
  • Draw.BindScene3D
  • -
  • Draw.Model
  • -
  • Draw.ModelSkinned
  • -
  • Draw.ModelSimple
  • -
  • Draw.Triangle3D
  • -
  • Draw.Quad3D
  • -
  • Draw.Sprite3D
  • -
  • Draw.SpritePart3D
  • -
  • Draw.Image3D
  • -
  • Draw.ImagePart3D
  • -
  • Draw.Tile3D
  • -
  • Draw.TriangleTextured
  • -
  • Draw.QuadTextured
  • -
  • Draw.SpritePoints
  • -
  • Draw.TilePoints
  • -
  • Draw.SceneLayer3D
  • -
  • Draw.SceneLayerPart3D
  • -
  • Draw.VertexBuffer
  • -
  • Draw.RenderArrayBuffer
  • -
  • Draw.RenderScene3D
  • Draw.Video
  • Draw.VideoPart
  • Draw.VideoSized
  • @@ -402,7 +381,10 @@

    Draw

  • Draw.Ellipse
  • Draw.Triangle
  • Draw.TriangleBlend
  • +
  • Draw.Quad
  • Draw.QuadBlend
  • +
  • Draw.TriangleTextured
  • +
  • Draw.QuadTextured
  • Draw.Rectangle
  • Draw.CircleStroke
  • Draw.EllipseStroke
  • @@ -427,6 +409,33 @@

    Draw

  • Draw.CopyScreen
  • +

    +

    Draw3D

    + Class methods: + +

    Ease

    Class methods: @@ -473,6 +482,16 @@

    File

  • File.WriteAllText
  • +

    +

    Geometry

    + Class methods: + +

    HTTP

    Class methods: @@ -481,6 +500,14 @@

    HTTP

  • HTTP.GetToFile
  • +

    +

    Image

    + Class methods: + +

    Input

    Class methods: @@ -493,12 +520,6 @@

    Input

  • Input.IsKeyDown
  • Input.IsKeyPressed
  • Input.IsKeyReleased
  • -
  • Input.GetControllerCount
  • -
  • Input.GetControllerAttached
  • -
  • Input.GetControllerHat
  • -
  • Input.GetControllerAxis
  • -
  • Input.GetControllerButton
  • -
  • Input.GetControllerName
  • Input.GetKeyName
  • Input.GetButtonName
  • Input.GetAxisName
  • @@ -527,13 +548,14 @@

    Instance

  • instance.SetAnimation
  • instance.ResetAnimation
  • instance.Animate
  • +
  • instance.GetIDWithinClass
  • instance.AddToRegistry
  • instance.RemoveFromRegistry
  • instance.ApplyMotion
  • instance.InView
  • instance.CollidedWithObject
  • instance.GetHitboxFromSprite
  • -
  • instance.GetHitboxFromSprite
  • +
  • instance.ReturnHitboxFromSprite
  • instance.CollideWithObject
  • instance.SolidCollideWithObject
  • instance.TopSolidCollideWithObject
  • @@ -601,6 +623,10 @@

    Instance

  • instance.HitboxH
  • instance.HitboxOffX
  • instance.HitboxOffY
  • +
  • instance.HitboxLeft
  • +
  • instance.HitboxTop
  • +
  • instance.HitboxRight
  • +
  • instance.HitboxBottom
  • instance.FlipFlag
  • instance.VelocityX
  • instance.VelocityX
  • @@ -743,10 +769,13 @@

    Palette

  • Palette.LoadFromImage
  • Palette.GetColor
  • Palette.SetColor
  • +
  • Palette.GetColorTransparent
  • +
  • Palette.SetColorTransparent
  • Palette.MixPalettes
  • Palette.RotateColorsLeft
  • Palette.RotateColorsRight
  • Palette.CopyColors
  • +
  • Palette.UsePaletteIndexLines
  • Palette.SetPaletteIndexLines
  • @@ -827,6 +856,7 @@

    Scene

  • Scene.GetLayerIndex
  • Scene.GetLayerVisible
  • Scene.GetLayerOpacity
  • +
  • Scene.GetLayerUsePaletteIndexLines
  • Scene.GetLayerProperty
  • Scene.GetLayerExists
  • Scene.GetLayerDeformSplitLine
  • @@ -841,14 +871,16 @@

    Scene

  • Scene.GetLayerOffsetX
  • Scene.GetLayerOffsetY
  • Scene.GetLayerDrawGroup
  • +
  • Scene.GetLayerHorizontalRepeat
  • +
  • Scene.GetLayerVerticalRepeat
  • Scene.GetTilesetCount
  • Scene.GetTilesetIndex
  • Scene.GetTilesetName
  • Scene.GetTilesetTileCount
  • Scene.GetTilesetFirstTileID
  • +
  • Scene.GetTilesetPaletteIndex
  • Scene.GetTileWidth
  • Scene.GetTileHeight
  • -
  • Scene.GetTileSize
  • Scene.GetTileID
  • Scene.GetTileFlipX
  • Scene.GetTileFlipY
  • @@ -891,6 +923,7 @@

    Scene

  • Scene.SetTileAnimSequencePaused
  • Scene.SetTileAnimSequenceSpeed
  • Scene.SetTileAnimSequenceFrame
  • +
  • Scene.SetTilesetPaletteIndex
  • Scene.SetLayerVisible
  • Scene.SetLayerCollidable
  • Scene.SetLayerInternalSize
  • @@ -900,10 +933,13 @@

    Scene

  • Scene.SetLayerDrawGroup
  • Scene.SetLayerDrawBehavior
  • Scene.SetLayerRepeat
  • +
  • Scene.SetLayerHorizontalRepeat
  • +
  • Scene.SetLayerVerticalRepeat
  • Scene.SetDrawGroupCount
  • Scene.SetDrawGroupEntityDepthSorting
  • Scene.SetLayerBlend
  • Scene.SetLayerOpacity
  • +
  • Scene.SetLayerUsePaletteIndexLines
  • Scene.SetLayerScroll
  • Scene.SetLayerSetParallaxLinesBegin
  • Scene.SetLayerSetParallaxLines
  • @@ -946,6 +982,23 @@

    Scene3D

  • Scene3D.Clear
  • +

    +

    SceneList

    + Class methods: + +

    Serializer

    Class methods: @@ -1283,13 +1336,14 @@

    Instance

  • instance.SetAnimation
  • instance.ResetAnimation
  • instance.Animate
  • +
  • instance.GetIDWithinClass
  • instance.AddToRegistry
  • instance.RemoveFromRegistry
  • instance.ApplyMotion
  • instance.InView
  • instance.CollidedWithObject
  • instance.GetHitboxFromSprite
  • -
  • instance.GetHitboxFromSprite
  • +
  • instance.ReturnHitboxFromSprite
  • instance.CollideWithObject
  • instance.SolidCollideWithObject
  • instance.TopSolidCollideWithObject
  • @@ -1357,6 +1411,10 @@

    Instance

  • instance.HitboxH
  • instance.HitboxOffX
  • instance.HitboxOffY
  • +
  • instance.HitboxLeft
  • +
  • instance.HitboxTop
  • +
  • instance.HitboxRight
  • +
  • instance.HitboxBottom
  • instance.FlipFlag
  • instance.VelocityX
  • instance.VelocityX
  • @@ -1571,6 +1629,33 @@

    FogEquation_*

  • FogEquation_Exp
  • +

    +

    GeoBooleanOp_*

    + +

    +

    +

    GeoFillRule_*

    + +

    +

    +

    HitboxSide_*

    + +

    KeyBind_*

    +

    +

    TimeOfDay_*

    + +

    TintMode_*

    +

    +

    Weekday_*

    + +

    Constants

    Globals


    @@ -2166,6 +2272,27 @@

    Array.SetAll

  • value (Value): Value to set to.
  • +

    +

    Array.Reverse

    + Array.Reverse(array[, startIndex, endIndex]) +
    Reverses the elements of an array through the specified range, exclusive. The array is reversed from startIndex to, but not including, endIndex.
    +
    Parameters:
    +
      +
    • array (Array): Array to reverse.
    • +
    • startIndex (Integer): Start range. Default is zero.
    • +
    • endIndex (Integer): End range. Default is size of array.
    • +
    +

    +

    +

    Array.Sort

    + Array.Sort(array[, compFunction]) +
    Sorts the entries of the given array.
    +
    Parameters:
    +
      +
    • array (Array): Array to sort.
    • +
    • compFunction (Function): Comparison function. If not given, a default comparison function is used; the entries of the array are sorted in ascending order, and non-numeric values do not participate in the comparison.
    • +
    +

    Audio.GetMasterVolume

    Audio.GetMasterVolume() @@ -2298,10 +2425,34 @@

    Controller.HasPaddles

    Returns:
    Returns whether the controller at the index has paddles.

    +

    +

    Controller.IsButtonHeld

    + Controller.IsButtonHeld(controllerIndex, buttonIndex) +
    Checks if a button is held.
    +
    Parameters:
    +
      +
    • controllerIndex (Integer): Index of the controller to check.
    • +
    • buttonIndex (Enum): Index of the button to check.
    • +
    +
    Returns:
    +
    Returns a Boolean value.
    +

    +

    +

    Controller.IsButtonPressed

    + Controller.IsButtonPressed(controllerIndex, buttonIndex) +
    Checks if a button is pressed.
    +
    Parameters:
    +
      +
    • controllerIndex (Integer): Index of the controller to check.
    • +
    • buttonIndex (Enum): Index of the button to check.
    • +
    +
    Returns:
    +
    Returns a Boolean value.
    +

    Controller.GetButton

    Controller.GetButton(controllerIndex, buttonIndex) -
    Gets the button value from the controller at the index.
    +
    Gets the button value from the controller at the index. (Deprecated; use Controller.IsButtonHeld instead.)
    Parameters:
    • controllerIndex (Integer): Index of the controller to check.
    • @@ -2378,13 +2529,12 @@

      Controller.IsRumbleActive

      Controller.Rumble

      - Controller.Rumble(controllerIndex, largeMotorFrequency, smallMotorFrequency, duration) + Controller.Rumble(controllerIndex, strength, duration)
      Rumbles a controller.
      Parameters:
      • controllerIndex (Integer): Index of the controller to rumble.
      • -
      • largeMotorFrequency (Number): Frequency of the large motor. (0.0 - 1.0)
      • -
      • smallMotorFrequency (Number): Frequency of the small motor. (0.0 - 1.0)
      • +
      • strength (Number): Rumble strength. (0.0 - 1.0)
      • duration (Integer): Duration in milliseconds. Use 0 for infinite duration.

      @@ -2420,7 +2570,7 @@

      Controller.SetRumblePaused

      Controller.SetLargeMotorFrequency

      Controller.SetLargeMotorFrequency(controllerIndex, frequency) -
      Sets the frequency of a controller's large motor.
      +
      Sets the frequency of a controller's large motor. (Deprecated)
      Parameters:
      • controllerIndex (Integer): Index of the controller.
      • @@ -2430,7 +2580,7 @@

        Controller.SetLargeMotorFrequency

        Controller.SetSmallMotorFrequency

        Controller.SetSmallMotorFrequency(controllerIndex, frequency) -
        Sets the frequency of a controller's small motor.
        +
        Sets the frequency of a controller's small motor. (Deprecated)
        Parameters:
        • controllerIndex (Integer): Index of the controller.
        • @@ -2579,7 +2729,7 @@

          Display.GetHeight

          Draw.Sprite

          - Draw.Sprite(sprite, animation, frame, x, y, flipX, flipY[, scaleX, scaleY, rotation, useInteger]) + Draw.Sprite(sprite, animation, frame, x, y, flipX, flipY[, scaleX, scaleY, rotation, useInteger, paletteID])
          Draws a sprite.
          Parameters:
            @@ -2592,8 +2742,9 @@

            Draw.Sprite

          • flipY (Integer): Whether or not to flip the sprite vertically.
          • scaleX (Number): Scale multiplier of the sprite horizontally.
          • scaleY (Number): Scale multiplier of the sprite vertically.
          • -
          • rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true
          • -
          • useInteger (Number): Whether or not the rotation argument is already in radians
          • +
          • rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true.
          • +
          • useInteger (Number): Whether or not the rotation argument is already in radians.
          • +
          • paletteID (Integer): Which palette index to use.

          @@ -2635,7 +2786,7 @@

          Draw.AnimatorBasic

          Draw.SpritePart

          - Draw.SpritePart(sprite, animation, frame, x, y, partX, partY, partW, partH, flipX, flipY[, scaleX, scaleY, rotation, useInteger]) + Draw.SpritePart(sprite, animation, frame, x, y, partX, partY, partW, partH, flipX, flipY[, scaleX, scaleY, rotation, useInteger, paletteID])
          Draws part of a sprite.
          Parameters:
            @@ -2652,8 +2803,9 @@

            Draw.SpritePart

          • flipY (Integer): Whether or not to flip the sprite vertically.
          • scaleX (Number): Scale multiplier of the sprite horizontally.
          • scaleY (Number): Scale multiplier of the sprite vertically.
          • -
          • rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true
          • -
          • useInteger (Number): Whether or not the rotation argument is already in radians
          • +
          • rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true.
          • +
          • useInteger (Number): Whether or not the rotation argument is already in radians.
          • +
          • paletteID (Integer): Which palette index to use.

          @@ -2777,1141 +2929,1074 @@

          Draw.ViewPartSized

        • height (Number): Height to draw the view.

        -

        -

        Draw.BindVertexBuffer

        - Draw.BindVertexBuffer(vertexBufferIndex) -
        Binds a vertex buffer.
        -
        Parameters:
        -
          -
        • vertexBufferIndex (Integer): Sets the vertex buffer to bind.
        • -
        +

        +

        Draw.Video

        + Draw.Video()

        -

        -

        Draw.UnbindVertexBuffer

        - Draw.UnbindVertexBuffer() -
        Unbinds the currently bound vertex buffer.
        +

        +

        Draw.VideoPart

        + Draw.VideoPart() +

        +

        +

        Draw.VideoSized

        + Draw.VideoSized() +

        +

        +

        Draw.VideoPartSized

        + Draw.VideoPartSized()

        -

        -

        Draw.InitArrayBuffer

        - Draw.InitArrayBuffer(arrayBufferIndex, numVertices) -
        Initializes an array buffer. There are 32 array buffers. (Deprecated; use Scene3D.Create instead.)
        +

        +

        Draw.Tile

        + Draw.Tile(ID, x, y, flipX, flipY) +
        Draws a tile.
        Parameters:
          -
        • arrayBufferIndex (Integer): The array buffer at the index to use. (Maximum index: 31)
        • -
        • numVertices (Integer): The initial capacity of this array buffer.
        • +
        • ID (Integer): ID of the tile to draw.
        • +
        • x (Number): X position of where to draw the tile.
        • +
        • y (Number): Y position of where to draw the tile.
        • +
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • +
        • flipY (Integer): Whether or not to flip the tile vertically.

        -

        -

        Draw.SetArrayBufferDrawMode

        - Draw.SetArrayBufferDrawMode(arrayBufferIndex, drawMode) -
        Sets the draw mode of the array buffer. (Deprecated; use Scene3D.SetDrawMode instead.)
        +

        +

        Draw.Texture

        + Draw.Texture(texture, x, y) +
        Draws a texture.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • drawMode (Integer): The type of drawing to use for the vertices in the array buffer.
        • +
        • texture (Integer): Texture index.
        • +
        • x (Number): X position of where to draw the texture.
        • +
        • y (Number): Y position of where to draw the texture.

        -

        -

        Draw.SetProjectionMatrix

        - Draw.SetProjectionMatrix(arrayBufferIndex, projMatrix) -
        Sets the projection matrix. (Deprecated; use Scene3D.SetCustomProjectionMatrix instead.)
        +

        +

        Draw.TextureSized

        + Draw.TextureSized(texture, x, y, width, height) +
        Draws a texture, but sized.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • projMatrix (Matrix): The projection matrix.
        • +
        • texture (Integer): Texture index.
        • +
        • x (Number): X position of where to draw the texture.
        • +
        • y (Number): Y position of where to draw the texture.
        • +
        • width (Number): Width to draw the texture.
        • +
        • height (Number): Height to draw the texture.

        -

        -

        Draw.SetViewMatrix

        - Draw.SetViewMatrix(arrayBufferIndex, viewMatrix) -
        Sets the view matrix. (Deprecated; use Scene3D.SetViewMatrix instead.)
        +

        +

        Draw.TexturePart

        + Draw.TexturePart(texture, partX, partY, partW, partH, x, y) +
        Draws part of a texture.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • viewMatrix (Matrix): The view matrix.
        • +
        • texture (Integer): Texture index.
        • +
        • partX (Integer): X coordinate of part of texture to draw.
        • +
        • partY (Integer): Y coordinate of part of texture to draw.
        • +
        • partW (Integer): Width of part of texture to draw.
        • +
        • partH (Integer): Height of part of texture to draw.
        • +
        • x (Number): X position of where to draw the texture.
        • +
        • y (Number): Y position of where to draw the texture.

        -

        -

        Draw.SetAmbientLighting

        - Draw.SetAmbientLighting(arrayBufferIndex, red, green, blue) -
        Sets the ambient lighting of the array buffer. (Deprecated; use Scene3D.SetAmbientLighting instead.)
        +

        +

        Draw.SetFont

        + Draw.SetFont() +

        +

        +

        Draw.SetTextAlign

        + Draw.SetTextAlign(baseline) +
        Sets the text drawing horizontal alignment. (default: left)
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • red (Number): The red color value, bounded by 0.0 - 1.0.
        • -
        • green (Number): The green color value, bounded by 0.0 - 1.0.
        • -
        • blue (Number): The blue color value, bounded by 0.0 - 1.0.
        • +
        • baseline (Integer): 0 for left, 1 for center, 2 for right.

        -

        -

        Draw.SetDiffuseLighting

        - Draw.SetDiffuseLighting(arrayBufferIndex, red, green, blue) -
        Sets the diffuse lighting of the array buffer. (Deprecated; use Scene3D.SetDiffuseLighting instead.)
        +

        +

        Draw.SetTextBaseline

        + Draw.SetTextBaseline(baseline) +
        Sets the text drawing vertical alignment. (default: top)
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • red (Number): The red color value, bounded by 0.0 - 1.0.
        • -
        • green (Number): The green color value, bounded by 0.0 - 1.0.
        • -
        • blue (Number): The blue color value, bounded by 0.0 - 1.0.
        • +
        • baseline (Integer): 0 for top, 1 for baseline, 2 for bottom.

        -

        -

        Draw.SetSpecularLighting

        - Draw.SetSpecularLighting(arrayBufferIndex, red, green, blue) -
        Sets the specular lighting of the array buffer. (Deprecated; use Scene3D.SetSpecularLighting instead.)
        +

        +

        Draw.SetTextAdvance

        + Draw.SetTextAdvance(ascent) +
        Sets the character spacing multiplier. (default: 1.0)
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • red (Number): The red color value, bounded by 0.0 - 1.0.
        • -
        • green (Number): The green color value, bounded by 0.0 - 1.0.
        • -
        • blue (Number): The blue color value, bounded by 0.0 - 1.0.
        • +
        • ascent (Number): Multiplier for character spacing.

        -

        -

        Draw.SetFogDensity

        - Draw.SetFogDensity(arrayBufferIndex, density) -
        Sets the density of the array buffer's fog. (Deprecated; use Scene3D.SetFogDensity instead.)
        +

        +

        Draw.SetTextLineAscent

        + Draw.SetTextLineAscent(ascent) +
        Sets the line height multiplier. (default: 1.25)
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • density (Number): The fog density.
        • +
        • ascent (Number): Multiplier for line height.

        -

        -

        Draw.SetFogColor

        - Draw.SetFogColor(arrayBufferIndex, red, green, blue) -
        Sets the fog color of the array buffer. (Deprecated; use Scene3D.SetFogColor instead.)
        +

        +

        Draw.MeasureText

        + Draw.MeasureText(outArray, sprite, text) +
        Measures Extended UTF8 text using a sprite or font and stores max width and max height into the array.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • red (Number): The red color value, bounded by 0.0 - 1.0.
        • -
        • green (Number): The green color value, bounded by 0.0 - 1.0.
        • -
        • blue (Number): The blue color value, bounded by 0.0 - 1.0.
        • +
        • outArray (Array): Array to output size values to.
        • +
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • +
        • text (String): Text to measure.
        +
        Returns:
        +
        Returns the array inputted into the function.

        -

        -

        Draw.SetClipPolygons

        - Draw.SetClipPolygons(arrayBufferIndex, clipPolygons) -
        Enables or disables polygon clipping by the view frustum of the array buffer. (Deprecated; software-renderer only.)
        +

        +

        Draw.MeasureTextWrapped

        + Draw.MeasureTextWrapped(outArray, sprite, text, maxWidth[, maxLines]) +
        Measures wrapped Extended UTF8 text using a sprite or font and stores max width and max height into the array.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • clipPolygons (Boolean): Whether or not to clip polygons.
        • +
        • outArray (Array): Array to output size values to.
        • +
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • +
        • text (String): Text to measure.
        • +
        • maxWidth (Number): Max width that a line can be.
        • +
        • maxLines (Integer): Max number of lines to measure.
        +
        Returns:
        +
        Returns the array inputted into the function.

        -

        -

        Draw.SetPointSize

        - Draw.SetPointSize(arrayBufferIndex, pointSize) -
        Sets the point size of the array buffer. (Deprecated; use Scene3D.SetPointSize instead.)
        +

        +

        Draw.Text

        + Draw.Text(sprite, text, x, y) +
        Draws Extended UTF8 text using a sprite or font.
        Parameters:
          -
        • arrayBufferIndex (Integer): The index of the array buffer.
        • -
        • pointSize (Decimal): The point size.
        • +
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • +
        • text (String): Text to draw.
        • +
        • x (Number): X position of where to draw the text.
        • +
        • y (Number): Y position of where to draw the text.

        -

        -

        Draw.BindArrayBuffer

        - Draw.BindArrayBuffer(arrayBufferIndex) -
        Binds an array buffer for drawing polygons in 3D space. (Deprecated; use Draw.BindScene3D instead.)
        +

        +

        Draw.TextWrapped

        + Draw.TextWrapped(sprite, text, x, y, maxWidth, maxLines) +
        Draws wrapped Extended UTF8 text using a sprite or font.
        Parameters:
          -
        • arrayBufferIndex (Integer): Sets the array buffer to bind.
        • +
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • +
        • text (String): Text to draw.
        • +
        • x (Number): X position of where to draw the tile.
        • +
        • y (Number): Y position of where to draw the tile.
        • +
        • maxWidth (Number): Max width the text can draw in.
        • +
        • maxLines (Integer): Max lines the text can draw.

        -

        -

        Draw.BindScene3D

        - Draw.BindScene3D(scene3DIndex) -
        Binds a 3D scene for drawing polygons in 3D space.
        +

        +

        Draw.TextEllipsis

        + Draw.TextEllipsis() +

        +

        +

        Draw.SetBlendColor

        + Draw.SetBlendColor(hex, alpha) +
        Sets the color to be used for drawing and blending.
        Parameters:
          -
        • scene3DIndex (Integer): Sets the 3D scene to bind.
        • +
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
        • +
        • alpha (Number): Opacity to use for drawing, 0.0 to 1.0.

        -

        -

        Draw.Model

        - Draw.Model(modelIndex, animation, frame[, matrixModel, matrixNormal]) -
        Draws a model.
        +

        +

        Draw.SetTextureBlend

        + Draw.SetTextureBlend(doBlend) +
        Sets whether or not to use color and alpha blending on sprites, images, and textures.
        Parameters:
          -
        • modelIndex (Integer): Index of loaded model.
        • -
        • animation (Integer): Animation of model to draw.
        • -
        • frame (Decimal): Frame of model to draw.
        • -
        • matrixModel (Matrix): Matrix for transforming model coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming model normals.
        • +
        • doBlend (Boolean): Whether or not to use blending.

        -

        -

        Draw.ModelSkinned

        - Draw.ModelSkinned(modelIndex, skeleton[, matrixModel, matrixNormal]) -
        Draws a skinned model.
        +

        +

        Draw.SetBlendMode

        + Draw.SetBlendMode(blendMode) +
        Sets the blend mode used for drawing.
        Parameters:
          -
        • modelIndex (Integer): Index of loaded model.
        • -
        • skeleton (Integer): Skeleton of model to skin the model.
        • -
        • matrixModel (Matrix): Matrix for transforming model coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming model normals.
        • +
        • blendMode (Enum): The desired blend mode.

        -

        -

        Draw.ModelSimple

        - Draw.ModelSimple(modelIndex, animation, frame, x, y, scale, rx, ry, rz) -
        Draws a model without using matrices.
        +

        +

        Draw.SetBlendFactor

        + Draw.SetBlendFactor(sourceFactor, destinationFactor) +
        Sets the blend factors used for drawing. (Only for hardware-rendering)
        Parameters:
          -
        • modelIndex (Integer): Index of loaded model.
        • -
        • animation (Integer): Animation of model to draw.
        • -
        • frame (Integer): Frame of model to draw.
        • -
        • x (Number): X position
        • -
        • y (Number): Y position
        • -
        • scale (Number): Model scale
        • -
        • rx (Number): X rotation in radians
        • -
        • ry (Number): Y rotation in radians
        • -
        • rz (Number): Z rotation in radians
        • +
        • sourceFactor (Enum): Source factor for blending.
        • +
        • destinationFactor (Enum): Destination factor for blending.

        -

        -

        Draw.Triangle3D

        - Draw.Triangle3D(x1, y1, z1, x2, y2, z2, x3, y3, z3[, color1, color2, color3, matrixModel, matrixNormal]) -
        Draws a triangle in 3D space.
        +

        +

        Draw.SetBlendFactorExtended

        + Draw.SetBlendFactorExtended(sourceColorFactor, destinationColorFactor, sourceAlphaFactor, destinationAlphaFactor) +
        Sets all the blend factors used for drawing. (Only for hardware-rendering)
        Parameters:
          -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • sourceColorFactor (Enum): Source factor for blending color.
        • +
        • destinationColorFactor (Enum): Destination factor for blending color.
        • +
        • sourceAlphaFactor (Enum): Source factor for blending alpha.
        • +
        • destinationAlphaFactor (Enum): Destination factor for blending alpha.

        -

        -

        Draw.Quad3D

        - Draw.Quad3D(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) -
        Draws a quadrilateral in 3D space.
        +

        +

        Draw.SetCompareColor

        + Draw.SetCompareColor(hex) +
        Sets the Comparison Color to draw over for Comparison Drawing.
        Parameters:
          -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • x4 (Number): X position of the fourth vertex.
        • -
        • y4 (Number): Y position of the fourth vertex.
        • -
        • z4 (Number): Z position of the fourth vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • color4 (Integer): Color of the fourth vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)

        -

        -

        Draw.Sprite3D

        - Draw.Sprite3D(sprite, animation, frame, x, y, z, flipX, flipY[, scaleX, scaleY, matrixModel, matrixNormal]) -
        Draws a sprite in 3D space.
        +

        +

        Draw.SetTintColor

        + Draw.SetTintColor(hex, amount) +
        Sets the color to be used for tinting.
        Parameters:
          -
        • sprite (Integer): Index of the loaded sprite.
        • -
        • animation (Integer): Index of the animation entry.
        • -
        • frame (Integer): Index of the frame in the animation entry.
        • -
        • x (Number): X position of where to draw the sprite.
        • -
        • y (Number): Y position of where to draw the sprite.
        • -
        • z (Number): Z position of where to draw the sprite.
        • -
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • -
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • -
        • scaleX (Number): Scale multiplier of the sprite horizontally.
        • -
        • scaleY (Number): Scale multiplier of the sprite vertically.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
        • +
        • amount (Number): Tint amount, from 0.0 to 1.0.

        -

        -

        Draw.SpritePart3D

        - Draw.SpritePart3D(sprite, animation, frame, x, y, z, partX, partY, partW, partH, flipX, flipY[, scaleX, scaleY, matrixModel, matrixNormal]) -
        Draws part of a sprite in 3D space.
        +

        +

        Draw.SetTintMode

        + Draw.SetTintMode(tintMode) +
        Sets the tint mode used for drawing.
        Parameters:
          -
        • sprite (Integer): Index of the loaded sprite.
        • -
        • animation (Integer): Index of the animation entry.
        • -
        • frame (Integer): Index of the frame in the animation entry.
        • -
        • x (Number): X position of where to draw the sprite.
        • -
        • y (Number): Y position of where to draw the sprite.
        • -
        • z (Number): Z position of where to draw the sprite.
        • -
        • partX (Integer): X coordinate of part of frame to draw.
        • -
        • partY (Integer): Y coordinate of part of frame to draw.
        • -
        • partW (Integer): Width of part of frame to draw.
        • -
        • partH (Integer): Height of part of frame to draw.
        • -
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • -
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • -
        • scaleX (Number): Scale multiplier of the sprite horizontally.
        • -
        • scaleY (Number): Scale multiplier of the sprite vertically.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • tintMode (Enum): The desired tint mode.

        -

        -

        Draw.Image3D

        - Draw.Image3D(image, x, y, z[, matrixModel, matrixNormal]) -
        Draws an image in 3D space.
        +

        +

        Draw.UseTinting

        + Draw.UseTinting(useTinting) +
        Sets whether or not to use color tinting when drawing.
        Parameters:
          -
        • image (Integer): Index of the loaded image.
        • -
        • x (Number): X position of where to draw the image.
        • -
        • y (Number): Y position of where to draw the image.
        • -
        • z (Number): Z position of where to draw the image.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • useTinting (Boolean): Whether or not to use color tinting when drawing.

        -

        -

        Draw.ImagePart3D

        - Draw.ImagePart3D(image, x, y, z, partX, partY, partW, partH[, matrixModel, matrixNormal]) -
        Draws part of an image in 3D space.
        +

        +

        Draw.SetFilter

        + Draw.SetFilter(filterType) +
        Sets a filter type.
        Parameters:
          -
        • image (Integer): Index of the loaded image.
        • -
        • x (Number): X position of where to draw the image.
        • -
        • y (Number): Y position of where to draw the image.
        • -
        • z (Number): Z position of where to draw the image.
        • -
        • partX (Integer): X coordinate of part of image to draw.
        • -
        • partY (Integer): Y coordinate of part of image to draw.
        • -
        • partW (Integer): Width of part of image to draw.
        • -
        • partH (Integer): Height of part of image to draw.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • filterType (Enum): The filter type.

        -

        -

        Draw.Tile3D

        - Draw.Tile3D(ID, x, y, z, flipX, flipY[, matrixModel, matrixNormal]) -
        Draws a tile in 3D space.
        +

        +

        Draw.UseStencil

        + Draw.UseStencil(enabled) +
        Enables or disables stencil operations.
        Parameters:
          -
        • ID (Integer): ID of the tile to draw.
        • -
        • x (Number): X position of where to draw the tile.
        • -
        • y (Number): Y position of where to draw the tile.
        • -
        • z (Number): Z position of where to draw the tile.
        • -
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • -
        • flipY (Integer): Whether or not to flip the tile vertically.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • enabled (Boolean): Whether to enable or disable stencil operations.

        -

        -

        Draw.TriangleTextured

        - Draw.TriangleTextured(image, x1, y1, z1, x2, y2, z2, x3, y3, z3[, color1, color2, color3, u1, v1, u2, v2, u3, v3, matrixModel, matrixNormal]) -
        Draws a textured triangle in 3D space. The texture source should be an image.
        +

        +

        Draw.SetStencilTestFunction

        + Draw.SetStencilTestFunction(stencilTest) +
        Sets a stencil test function.
        Parameters:
          -
        • image (Integer): Index of the loaded image.
        • -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • u1 (Number): Texture U of the first vertex.
        • -
        • v1 (Number): Texture V of the first vertex.
        • -
        • u2 (Number): Texture U of the second vertex.
        • -
        • v2 (Number): Texture V of the second vertex.
        • -
        • u3 (Number): Texture U of the third vertex.
        • -
        • v3 (Number): Texture V of the third vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • stencilTest (Enum): One of the stencil test functions.

        -

        -

        Draw.QuadTextured

        - Draw.QuadTextured(image, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, u1, v1, u2, v2, u3, v3, u4, v4, matrixModel, matrixNormal]) -
        Draws a textured quad in 3D space. The texture source should be an image.
        +

        +

        Draw.SetStencilPassOperation

        + Draw.SetStencilPassOperation(stencilOp) +
        Sets a stencil operation for when the stencil test passes.
        Parameters:
          -
        • image (Integer): Index of the loaded image.
        • -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • x4 (Number): X position of the fourth vertex.
        • -
        • y4 (Number): Y position of the fourth vertex.
        • -
        • z4 (Number): Z position of the fourth vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • color4 (Integer): Color of the fourth vertex.
        • -
        • u1 (Number): Texture U of the first vertex.
        • -
        • v1 (Number): Texture V of the first vertex.
        • -
        • u2 (Number): Texture U of the second vertex.
        • -
        • v2 (Number): Texture V of the second vertex.
        • -
        • u3 (Number): Texture U of the third vertex.
        • -
        • v3 (Number): Texture V of the third vertex.
        • -
        • u4 (Number): Texture U of the fourth vertex.
        • -
        • v4 (Number): Texture V of the fourth vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • stencilOp (Enum): One of the stencil operations.

        -

        -

        Draw.SpritePoints

        - Draw.SpritePoints(sprite, animation, frame, flipX, flipY, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) -
        Draws a textured rectangle in 3D space. The texture source should be a sprite.
        +

        +

        Draw.SetStencilFailOperation

        + Draw.SetStencilFailOperation(stencilOp) +
        Sets a stencil operation for when the stencil test fails.
        Parameters:
          -
        • sprite (Integer): Index of the loaded sprite.
        • -
        • animation (Integer): Index of the animation entry.
        • -
        • frame (Integer): Index of the frame in the animation entry.
        • -
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • -
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • x4 (Number): X position of the fourth vertex.
        • -
        • y4 (Number): Y position of the fourth vertex.
        • -
        • z4 (Number): Z position of the fourth vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • color4 (Integer): Color of the fourth vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • stencilOp (Enum): One of the stencil operations.

        -

        -

        Draw.TilePoints

        - Draw.TilePoints(ID, flipX, flipY, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) -
        Draws a textured rectangle in 3D space. The texture source should be a tile.
        +

        +

        Draw.SetStencilValue

        + Draw.SetStencilValue(value) +
        Sets the stencil value.
        Parameters:
          -
        • ID (Integer): ID of the tile to draw.
        • -
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • -
        • flipY (Integer): Whether or not to flip the tile vertically.
        • -
        • x1 (Number): X position of the first vertex.
        • -
        • y1 (Number): Y position of the first vertex.
        • -
        • z1 (Number): Z position of the first vertex.
        • -
        • x2 (Number): X position of the second vertex.
        • -
        • y2 (Number): Y position of the second vertex.
        • -
        • z2 (Number): Z position of the second vertex.
        • -
        • x3 (Number): X position of the third vertex.
        • -
        • y3 (Number): Y position of the third vertex.
        • -
        • z3 (Number): Z position of the third vertex.
        • -
        • x4 (Number): X position of the fourth vertex.
        • -
        • y4 (Number): Y position of the fourth vertex.
        • -
        • z4 (Number): Z position of the fourth vertex.
        • -
        • color1 (Integer): Color of the first vertex.
        • -
        • color2 (Integer): Color of the second vertex.
        • -
        • color3 (Integer): Color of the third vertex.
        • -
        • color4 (Integer): Color of the fourth vertex.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • value (Integer): The stencil value. This value is clamped by the stencil buffer's bit depth.

        -

        -

        Draw.SceneLayer3D

        - Draw.SceneLayer3D(layer[, matrixModel, matrixNormal]) -
        Draws a scene layer in 3D space.
        +

        +

        Draw.SetStencilMask

        + Draw.SetStencilMask(mask) +
        Sets the mask used for all stencil tests.
        Parameters:
          -
        • layer (Integer): Index of the layer.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • mask (Integer): The stencil mask. This value is clamped by the stencil buffer's bit depth.

        -

        -

        Draw.SceneLayerPart3D

        - Draw.SceneLayerPart3D(layer, partX, partY, partW, partH[, matrixModel, matrixNormal]) -
        Draws part of a scene layer in 3D space.
        -
        Parameters:
        -
          -
        • layer (Integer): Index of the layer.
        • -
        • partX (Integer): X coordinate (in tiles) of part of layer to draw.
        • -
        • partY (Integer): Y coordinate (in tiles) of part of layer to draw.
        • -
        • partW (Integer): Width (in tiles) of part of layer to draw.
        • -
        • partH (Integer): Height (in tiles) of part of layer to draw.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • -
        +

        +

        Draw.ClearStencil

        + Draw.ClearStencil() +
        Clears the stencil.

        -

        -

        Draw.VertexBuffer

        - Draw.VertexBuffer(vertexBufferIndex[, matrixModel, matrixNormal]) -
        Draws a vertex buffer.
        +

        +

        Draw.SetDotMask

        + Draw.SetDotMask(mask) +
        Sets the dot mask.
        Parameters:
          -
        • vertexBufferIndex (Integer): The vertex buffer to draw.
        • -
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • -
        • matrixNormal (Matrix): Matrix for transforming normals.
        • +
        • mask (Integer): The mask.

        -

        -

        Draw.RenderArrayBuffer

        - Draw.RenderArrayBuffer(arrayBufferIndex[, drawMode]) -
        Draws everything in the array buffer. (Deprecated; use Draw.RenderScene3D instead.)
        +

        +

        Draw.SetHorizontalDotMask

        + Draw.SetHorizontalDotMask(mask) +
        Sets the horizontal dot mask.
        Parameters:
          -
        • arrayBufferIndex (Integer): The array buffer at the index to draw.
        • -
        • drawMode (Integer): The type of drawing to use for the vertices in the array buffer.
        • +
        • mask (Integer): The mask.

        -

        -

        Draw.RenderScene3D

        - Draw.RenderScene3D(scene3DIndex[, drawMode]) -
        Draws everything in the 3D scene.
        +

        +

        Draw.SetVerticalDotMask

        + Draw.SetVerticalDotMask(mask) +
        Sets the vertical dot mask.
        Parameters:
          -
        • scene3DIndex (Integer): The 3D scene at the index to draw.
        • -
        • drawMode (Integer): The type of drawing to use for the vertices in the 3D scene.
        • +
        • mask (Integer): The mask.

        -

        -

        Draw.Video

        - Draw.Video() -

        -

        -

        Draw.VideoPart

        - Draw.VideoPart() -

        -

        -

        Draw.VideoSized

        - Draw.VideoSized() -

        -

        -

        Draw.VideoPartSized

        - Draw.VideoPartSized() -

        -

        -

        Draw.Tile

        - Draw.Tile(ID, x, y, flipX, flipY) -
        Draws a tile.
        +

        +

        Draw.SetHorizontalDotMaskOffset

        + Draw.SetHorizontalDotMaskOffset(offsetH) +
        Sets the offset of the horizontal dot mask.
        Parameters:
          -
        • ID (Integer): ID of the tile to draw.
        • -
        • x (Number): X position of where to draw the tile.
        • -
        • y (Number): Y position of where to draw the tile.
        • -
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • -
        • flipY (Integer): Whether or not to flip the tile vertically.
        • +
        • offsetH (Integer): The offset.

        -

        -

        Draw.Texture

        - Draw.Texture(texture, x, y) -
        Draws a texture.
        +

        +

        Draw.SetVerticalDotMaskOffset

        + Draw.SetVerticalDotMaskOffset(offsetV) +
        Sets the offset of the vertical dot mask.
        Parameters:
          -
        • texture (Integer): Texture index.
        • -
        • x (Number): X position of where to draw the texture.
        • -
        • y (Number): Y position of where to draw the texture.
        • +
        • offsetV (Integer): The offset.

        -

        -

        Draw.TextureSized

        - Draw.TextureSized(texture, x, y, width, height) -
        Draws a texture, but sized.
        +

        +

        Draw.Line

        + Draw.Line(x1, y1, x2, y2) +
        Draws a line.
        Parameters:
          -
        • texture (Integer): Texture index.
        • -
        • x (Number): X position of where to draw the texture.
        • -
        • y (Number): Y position of where to draw the texture.
        • -
        • width (Number): Width to draw the texture.
        • -
        • height (Number): Height to draw the texture.
        • +
        • x1 (Number): X position of where to start drawing the line.
        • +
        • y1 (Number): Y position of where to start drawing the line.
        • +
        • x2 (Number): X position of where to end drawing the line.
        • +
        • y2 (Number): Y position of where to end drawing the line.

        -

        -

        Draw.TexturePart

        - Draw.TexturePart(texture, partX, partY, partW, partH, x, y) -
        Draws part of a texture.
        +

        +

        Draw.Circle

        + Draw.Circle(x, y, radius) +
        Draws a circle.
        Parameters:
          -
        • texture (Integer): Texture index.
        • -
        • partX (Integer): X coordinate of part of texture to draw.
        • -
        • partY (Integer): Y coordinate of part of texture to draw.
        • -
        • partW (Integer): Width of part of texture to draw.
        • -
        • partH (Integer): Height of part of texture to draw.
        • -
        • x (Number): X position of where to draw the texture.
        • -
        • y (Number): Y position of where to draw the texture.
        • +
        • x (Number): Center X position of where to draw the circle.
        • +
        • y (Number): Center Y position of where to draw the circle.
        • +
        • radius (Number): Radius of the circle.

        -

        -

        Draw.SetFont

        - Draw.SetFont() -

        -

        -

        Draw.SetTextAlign

        - Draw.SetTextAlign(baseline) -
        Sets the text drawing horizontal alignment. (default: left)
        +

        +

        Draw.Ellipse

        + Draw.Ellipse(x, y, width, height) +
        Draws an ellipse.
        Parameters:
          -
        • baseline (Integer): 0 for left, 1 for center, 2 for right.
        • +
        • x (Number): X position of where to draw the ellipse.
        • +
        • y (Number): Y position of where to draw the ellipse.
        • +
        • width (Number): Width to draw the ellipse at.
        • +
        • height (Number): Height to draw the ellipse at.

        -

        -

        Draw.SetTextBaseline

        - Draw.SetTextBaseline(baseline) -
        Sets the text drawing vertical alignment. (default: top)
        +

        +

        Draw.Triangle

        + Draw.Triangle(x1, y1, x2, y2, x3, y3) +
        Draws a triangle.
        Parameters:
          -
        • baseline (Integer): 0 for top, 1 for baseline, 2 for bottom.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.

        -

        -

        Draw.SetTextAdvance

        - Draw.SetTextAdvance(ascent) -
        Sets the character spacing multiplier. (default: 1.0)
        +

        +

        Draw.TriangleBlend

        + Draw.TriangleBlend(x1, y1, x2, y2, x3, y3, color1, color2, color3) +
        Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do Draw.SetBlendColor(0xFFFFFF, 1.0) if you want the vertex colors unaffected.)
        Parameters:
          -
        • ascent (Number): Multiplier for character spacing.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.

        -

        -

        Draw.SetTextLineAscent

        - Draw.SetTextLineAscent(ascent) -
        Sets the line height multiplier. (default: 1.25)
        +

        +

        Draw.Quad

        + Draw.Quad(x1, y1, x2, y2, x3, y3, x4, y4) +
        Draws a quad.
        Parameters:
          -
        • ascent (Number): Multiplier for line height.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.

        -

        -

        Draw.MeasureText

        - Draw.MeasureText(outArray, sprite, text) -
        Measures Extended UTF8 text using a sprite or font and stores max width and max height into the array.
        +

        +

        Draw.QuadBlend

        + Draw.QuadBlend(x1, y1, x2, y2, x3, y3, x4, y4, color1, color2, color3, color4) +
        Draws a quad, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do Draw.SetBlendColor(0xFFFFFF, 1.0) if you want the vertex colors unaffected.)
        Parameters:
          -
        • outArray (Array): Array to output size values to.
        • -
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • -
        • text (String): Text to measure.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • color4 (Integer): Color of the fourth vertex.
        -
        Returns:
        -
        Returns the array inputted into the function.

        -

        -

        Draw.MeasureTextWrapped

        - Draw.MeasureTextWrapped(outArray, sprite, text, maxWidth[, maxLines]) -
        Measures wrapped Extended UTF8 text using a sprite or font and stores max width and max height into the array.
        +

        +

        Draw.TriangleTextured

        + Draw.TriangleTextured(image, x1, y1, x2, y2, x3, y3[, color1, color2, color3, u1, v1, u2, v2, u3, v3]) +
        Draws a textured triangle.
        Parameters:
          -
        • outArray (Array): Array to output size values to.
        • -
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • -
        • text (String): Text to measure.
        • -
        • maxWidth (Number): Max width that a line can be.
        • -
        • maxLines (Integer): Max number of lines to measure.
        • +
        • image (Integer): Image to draw triangle with.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • u1 (Number): Texture U of the first vertex.
        • +
        • v1 (Number): Texture V of the first vertex.
        • +
        • u2 (Number): Texture U of the second vertex.
        • +
        • v2 (Number): Texture V of the second vertex.
        • +
        • u3 (Number): Texture U of the third vertex.
        • +
        • v3 (Number): Texture V of the third vertex.
        -
        Returns:
        -
        Returns the array inputted into the function.

        -

        -

        Draw.Text

        - Draw.Text(sprite, text, x, y) -
        Draws Extended UTF8 text using a sprite or font.
        +

        +

        Draw.QuadTextured

        + Draw.QuadTextured(image, x1, y1, x2, y2, x3, y3, x4, y4[, color1, color2, color3, color4, u1, v1, u2, v2, u3, v3, u4, v4]) +
        Draws a textured quad.
        Parameters:
          -
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • -
        • text (String): Text to draw.
        • -
        • x (Number): X position of where to draw the text.
        • -
        • y (Number): Y position of where to draw the text.
        • +
        • image (Integer): Image to draw quad with.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • color4 (Integer): Color of the fourth vertex.
        • +
        • u1 (Number): Texture U of the first vertex.
        • +
        • v1 (Number): Texture V of the first vertex.
        • +
        • u2 (Number): Texture U of the second vertex.
        • +
        • v2 (Number): Texture V of the second vertex.
        • +
        • u3 (Number): Texture U of the third vertex.
        • +
        • v3 (Number): Texture V of the third vertex.
        • +
        • u4 (Number): Texture U of the fourth vertex.
        • +
        • v4 (Number): Texture V of the fourth vertex.

        -

        -

        Draw.TextWrapped

        - Draw.TextWrapped(sprite, text, x, y, maxWidth, maxLines) -
        Draws wrapped Extended UTF8 text using a sprite or font.
        +

        +

        Draw.Rectangle

        + Draw.Rectangle(x, y, width, height) +
        Draws a rectangle.
        Parameters:
          -
        • sprite (Integer): Index of the loaded sprite to be used as text.
        • -
        • text (String): Text to draw.
        • -
        • x (Number): X position of where to draw the tile.
        • -
        • y (Number): Y position of where to draw the tile.
        • -
        • maxWidth (Number): Max width the text can draw in.
        • -
        • maxLines (Integer): Max lines the text can draw.
        • +
        • x (Number): X position of where to draw the rectangle.
        • +
        • y (Number): Y position of where to draw the rectangle.
        • +
        • width (Number): Width to draw the rectangle at.
        • +
        • height (Number): Height to draw the rectangle at.

        -

        -

        Draw.TextEllipsis

        - Draw.TextEllipsis() -

        -

        -

        Draw.SetBlendColor

        - Draw.SetBlendColor(hex, alpha) -
        Sets the color to be used for drawing and blending.
        +

        +

        Draw.CircleStroke

        + Draw.CircleStroke(x, y, radius[, thickness]) +
        Draws a circle outline.
        Parameters:
          -
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
        • -
        • alpha (Number): Opacity to use for drawing, 0.0 to 1.0.
        • +
        • x (Number): Center X position of where to draw the circle.
        • +
        • y (Number): Center Y position of where to draw the circle.
        • +
        • radius (Number): Radius of the circle.
        • +
        • thickness (Number): Thickness of the circle.

        -

        -

        Draw.SetTextureBlend

        - Draw.SetTextureBlend(doBlend) -
        Sets whether or not to use color and alpha blending on sprites, images, and textures.
        +

        +

        Draw.EllipseStroke

        + Draw.EllipseStroke(x, y, width, height) +
        Draws an ellipse outline.
        Parameters:
          -
        • doBlend (Boolean): Whether or not to use blending.
        • +
        • x (Number): X position of where to draw the ellipse.
        • +
        • y (Number): Y position of where to draw the ellipse.
        • +
        • width (Number): Width to draw the ellipse at.
        • +
        • height (Number): Height to draw the ellipse at.

        -

        -

        Draw.SetBlendMode

        - Draw.SetBlendMode(blendMode) -
        Sets the blend mode used for drawing.
        +

        +

        Draw.TriangleStroke

        + Draw.TriangleStroke(x1, y1, x2, y2, x3, y3) +
        Draws a triangle outline.
        Parameters:
          -
        • blendMode (Enum): The desired blend mode.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.

        -

        -

        Draw.SetBlendFactor

        - Draw.SetBlendFactor(sourceFactor, destinationFactor) -
        Sets the blend factors used for drawing. (Only for hardware-rendering)
        +

        +

        Draw.RectangleStroke

        + Draw.RectangleStroke(x, y, width, height) +
        Draws a rectangle outline.
        Parameters:
          -
        • sourceFactor (Enum): Source factor for blending.
        • -
        • destinationFactor (Enum): Destination factor for blending.
        • +
        • x (Number): X position of where to draw the rectangle.
        • +
        • y (Number): Y position of where to draw the rectangle.
        • +
        • width (Number): Width to draw the rectangle at.
        • +
        • height (Number): Height to draw the rectangle at.

        -

        -

        Draw.SetBlendFactorExtended

        - Draw.SetBlendFactorExtended(sourceColorFactor, destinationColorFactor, sourceAlphaFactor, destinationAlphaFactor) -
        Sets all the blend factors used for drawing. (Only for hardware-rendering)
        +

        +

        Draw.UseFillSmoothing

        + Draw.UseFillSmoothing(smoothFill) +
        Sets whether or not to use smoothing when drawing filled shapes. (hardware-renderer only)
        Parameters:
          -
        • sourceColorFactor (Enum): Source factor for blending color.
        • -
        • destinationColorFactor (Enum): Destination factor for blending color.
        • -
        • sourceAlphaFactor (Enum): Source factor for blending alpha.
        • -
        • destinationAlphaFactor (Enum): Destination factor for blending alpha.
        • +
        • smoothFill (Boolean): Whether or not to use smoothing.

        -

        -

        Draw.SetCompareColor

        - Draw.SetCompareColor(hex) -
        Sets the Comparison Color to draw over for Comparison Drawing.
        +

        +

        Draw.UseStrokeSmoothing

        + Draw.UseStrokeSmoothing(smoothFill) +
        Sets whether or not to use smoothing when drawing un-filled shapes. (hardware-renderer only)
        Parameters:
          -
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
        • +
        • smoothFill (Boolean): Whether or not to use smoothing.

        -

        -

        Draw.SetTintColor

        - Draw.SetTintColor(hex, amount) -
        Sets the color to be used for tinting.
        +

        +

        Draw.SetClip

        + Draw.SetClip(x, y, width, height) +
        Sets the region in which drawing will occur.
        Parameters:
          -
        • hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF)
        • -
        • amount (Number): Tint amount, from 0.0 to 1.0.
        • +
        • x (Number): X position of where to start the draw region.
        • +
        • y (Number): Y position of where to start the draw region.
        • +
        • width (Number): Width of the draw region.
        • +
        • height (Number): Height of the draw region.

        -

        -

        Draw.SetTintMode

        - Draw.SetTintMode(tintMode) -
        Sets the tint mode used for drawing.
        +

        +

        Draw.ClearClip

        + Draw.ClearClip() +
        Resets the drawing region.
        +

        +

        +

        Draw.Save

        + Draw.Save() +

        +

        +

        Draw.Scale

        + Draw.Scale() +

        +

        +

        Draw.Rotate

        + Draw.Rotate() +

        +

        +

        Draw.Restore

        + Draw.Restore() +

        +

        +

        Draw.Translate

        + Draw.Translate() +

        +

        +

        Draw.SetTextureTarget

        + Draw.SetTextureTarget() +

        +

        +

        Draw.Clear

        + Draw.Clear() +

        +

        +

        Draw.ResetTextureTarget

        + Draw.ResetTextureTarget() +

        +

        +

        Draw.UseSpriteDeform

        + Draw.UseSpriteDeform(useDeform) +
        Sets whether or not to use sprite deform when drawing.
        Parameters:
          -
        • tintMode (Enum): The desired tint mode.
        • +
        • useDeform (Boolean): Whether or not to use sprite deform when drawing.

        -

        -

        Draw.UseTinting

        - Draw.UseTinting(useTinting) -
        Sets whether or not to use color tinting when drawing.
        +

        +

        Draw.SetSpriteDeformLine

        + Draw.SetSpriteDeformLine(deformIndex, deformValue) +
        Sets the sprite deform line at the specified line index.
        Parameters:
          -
        • useTinting (Boolean): Whether or not to use color tinting when drawing.
        • +
        • deformIndex (Integer): Index of deform line. (0 = top of screen, 1 = the line below it, 2 = etc.)
        • +
        • deformValue (Decimal): Deform value.

        -

        -

        Draw.SetFilter

        - Draw.SetFilter(filterType) -
        Sets a filter type.
        +

        +

        Draw.UseDepthTesting

        + Draw.UseDepthTesting(useDepthTesting) +
        Sets whether or not to do depth tests when drawing.
        Parameters:
          -
        • filterType (Enum): The filter type.
        • +
        • useDepthTesting (Boolean): Whether or not to do depth tests when drawing.

        -

        -

        Draw.UseStencil

        - Draw.UseStencil(enabled) -
        Enables or disables stencil operations.
        -
        Parameters:
        -
          -
        • enabled (Boolean): Whether to enable or disable stencil operations.
        • -
        +

        +

        Draw.GetCurrentDrawGroup

        + Draw.GetCurrentDrawGroup() +
        Gets the draw group currently being drawn.
        +
        Returns:
        +
        Returns an Integer value.

        -

        -

        Draw.SetStencilTestFunction

        - Draw.SetStencilTestFunction(stencilTest) -
        Sets a stencil test function.
        +

        +

        Draw.CopyScreen

        + Draw.CopyScreen(texture) +
        Copies the contents of the screen into a texture.
        Parameters:
          -
        • stencilTest (Enum): One of the stencil test functions.
        • +
        • texture (Integer): Texture index.

        -

        -

        Draw.SetStencilPassOperation

        - Draw.SetStencilPassOperation(stencilOp) -
        Sets a stencil operation for when the stencil test passes.
        +

        +

        Draw3D.BindVertexBuffer

        + Draw3D.BindVertexBuffer(vertexBufferIndex) +
        Binds a vertex buffer.
        Parameters:
          -
        • stencilOp (Enum): One of the stencil operations.
        • +
        • vertexBufferIndex (Integer): Sets the vertex buffer to bind.

        -

        -

        Draw.SetStencilFailOperation

        - Draw.SetStencilFailOperation(stencilOp) -
        Sets a stencil operation for when the stencil test fails.
        +

        +

        Draw3D.UnbindVertexBuffer

        + Draw3D.UnbindVertexBuffer() +
        Unbinds the currently bound vertex buffer.
        +

        +

        +

        Draw3D.BindScene

        + Draw3D.BindScene(scene3DIndex) +
        Binds a 3D scene for drawing polygons in 3D space.
        Parameters:
          -
        • stencilOp (Enum): One of the stencil operations.
        • +
        • scene3DIndex (Integer): Sets the 3D scene to bind.

        -

        -

        Draw.SetStencilValue

        - Draw.SetStencilValue(value) -
        Sets the stencil value.
        +

        +

        Draw3D.Model

        + Draw3D.Model(modelIndex, animation, frame[, matrixModel, matrixNormal]) +
        Draws a model.
        Parameters:
          -
        • value (Integer): The stencil value. This value is clamped by the stencil buffer's bit depth.
        • +
        • modelIndex (Integer): Index of loaded model.
        • +
        • animation (Integer): Animation of model to draw.
        • +
        • frame (Decimal): Frame of model to draw.
        • +
        • matrixModel (Matrix): Matrix for transforming model coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming model normals.

        -

        -

        Draw.SetStencilMask

        - Draw.SetStencilMask(mask) -
        Sets the mask used for all stencil tests.
        +

        +

        Draw3D.ModelSkinned

        + Draw3D.ModelSkinned(modelIndex, skeleton[, matrixModel, matrixNormal]) +
        Draws a skinned model.
        Parameters:
          -
        • mask (Integer): The stencil mask. This value is clamped by the stencil buffer's bit depth.
        • +
        • modelIndex (Integer): Index of loaded model.
        • +
        • skeleton (Integer): Skeleton of model to skin the model.
        • +
        • matrixModel (Matrix): Matrix for transforming model coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming model normals.

        -

        -

        Draw.ClearStencil

        - Draw.ClearStencil() -
        Clears the stencil.
        -

        -

        -

        Draw.SetDotMask

        - Draw.SetDotMask(mask) -
        Sets the dot mask.
        +

        +

        Draw3D.ModelSimple

        + Draw3D.ModelSimple(modelIndex, animation, frame, x, y, scale, rx, ry, rz) +
        Draws a model without using matrices.
        Parameters:
          -
        • mask (Integer): The mask.
        • +
        • modelIndex (Integer): Index of loaded model.
        • +
        • animation (Integer): Animation of model to draw.
        • +
        • frame (Integer): Frame of model to draw.
        • +
        • x (Number): X position
        • +
        • y (Number): Y position
        • +
        • scale (Number): Model scale
        • +
        • rx (Number): X rotation in radians
        • +
        • ry (Number): Y rotation in radians
        • +
        • rz (Number): Z rotation in radians

        -

        -

        Draw.SetHorizontalDotMask

        - Draw.SetHorizontalDotMask(mask) -
        Sets the horizontal dot mask.
        +

        +

        Draw.Triangle3D

        + Draw.Triangle3D(x1, y1, z1, x2, y2, z2, x3, y3, z3[, color1, color2, color3, matrixModel, matrixNormal]) +
        Draws a triangle in 3D space.
        Parameters:
          -
        • mask (Integer): The mask.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.SetVerticalDotMask

        - Draw.SetVerticalDotMask(mask) -
        Sets the vertical dot mask.
        +

        +

        Draw3D.Quad

        + Draw3D.Quad(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) +
        Draws a quadrilateral in 3D space.
        Parameters:
          -
        • mask (Integer): The mask.
        • +
        • x1 (Number): X position of the first vertex.
        • +
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • +
        • x2 (Number): X position of the second vertex.
        • +
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • +
        • x3 (Number): X position of the third vertex.
        • +
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.
        • +
        • z4 (Number): Z position of the fourth vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • color4 (Integer): Color of the fourth vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.SetHorizontalDotMaskOffset

        - Draw.SetHorizontalDotMaskOffset(offsetH) -
        Sets the offset of the horizontal dot mask.
        +

        +

        Draw3D.Sprite

        + Draw3D.Sprite(sprite, animation, frame, x, y, z, flipX, flipY[, scaleX, scaleY, matrixModel, matrixNormal]) +
        Draws a sprite in 3D space.
        Parameters:
          -
        • offsetH (Integer): The offset.
        • +
        • sprite (Integer): Index of the loaded sprite.
        • +
        • animation (Integer): Index of the animation entry.
        • +
        • frame (Integer): Index of the frame in the animation entry.
        • +
        • x (Number): X position of where to draw the sprite.
        • +
        • y (Number): Y position of where to draw the sprite.
        • +
        • z (Number): Z position of where to draw the sprite.
        • +
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • +
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • +
        • scaleX (Number): Scale multiplier of the sprite horizontally.
        • +
        • scaleY (Number): Scale multiplier of the sprite vertically.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.SetVerticalDotMaskOffset

        - Draw.SetVerticalDotMaskOffset(offsetV) -
        Sets the offset of the vertical dot mask.
        +

        +

        Draw3D.SpritePart

        + Draw3D.SpritePart(sprite, animation, frame, x, y, z, partX, partY, partW, partH, flipX, flipY[, scaleX, scaleY, matrixModel, matrixNormal]) +
        Draws part of a sprite in 3D space.
        Parameters:
          -
        • offsetV (Integer): The offset.
        • +
        • sprite (Integer): Index of the loaded sprite.
        • +
        • animation (Integer): Index of the animation entry.
        • +
        • frame (Integer): Index of the frame in the animation entry.
        • +
        • x (Number): X position of where to draw the sprite.
        • +
        • y (Number): Y position of where to draw the sprite.
        • +
        • z (Number): Z position of where to draw the sprite.
        • +
        • partX (Integer): X coordinate of part of frame to draw.
        • +
        • partY (Integer): Y coordinate of part of frame to draw.
        • +
        • partW (Integer): Width of part of frame to draw.
        • +
        • partH (Integer): Height of part of frame to draw.
        • +
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • +
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • +
        • scaleX (Number): Scale multiplier of the sprite horizontally.
        • +
        • scaleY (Number): Scale multiplier of the sprite vertically.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.Line

        - Draw.Line(x1, y1, x2, y2) -
        Draws a line.
        +

        +

        Draw3D.Image

        + Draw3D.Image(image, x, y, z[, matrixModel, matrixNormal]) +
        Draws an image in 3D space.
        Parameters:
          -
        • x1 (Number): X position of where to start drawing the line.
        • -
        • y1 (Number): Y position of where to start drawing the line.
        • -
        • x2 (Number): X position of where to end drawing the line.
        • -
        • y2 (Number): Y position of where to end drawing the line.
        • +
        • image (Integer): Index of the loaded image.
        • +
        • x (Number): X position of where to draw the image.
        • +
        • y (Number): Y position of where to draw the image.
        • +
        • z (Number): Z position of where to draw the image.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.Circle

        - Draw.Circle(x, y, radius) -
        Draws a circle.
        +

        +

        Draw3D.ImagePart

        + Draw3D.ImagePart(image, x, y, z, partX, partY, partW, partH[, matrixModel, matrixNormal]) +
        Draws part of an image in 3D space.
        Parameters:
          -
        • x (Number): Center X position of where to draw the circle.
        • -
        • y (Number): Center Y position of where to draw the circle.
        • -
        • radius (Number): Radius of the circle.
        • +
        • image (Integer): Index of the loaded image.
        • +
        • x (Number): X position of where to draw the image.
        • +
        • y (Number): Y position of where to draw the image.
        • +
        • z (Number): Z position of where to draw the image.
        • +
        • partX (Integer): X coordinate of part of image to draw.
        • +
        • partY (Integer): Y coordinate of part of image to draw.
        • +
        • partW (Integer): Width of part of image to draw.
        • +
        • partH (Integer): Height of part of image to draw.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.Ellipse

        - Draw.Ellipse(x, y, width, height) -
        Draws an ellipse.
        +

        +

        Draw3D.Tile

        + Draw3D.Tile(ID, x, y, z, flipX, flipY[, matrixModel, matrixNormal]) +
        Draws a tile in 3D space.
        Parameters:
          -
        • x (Number): X position of where to draw the ellipse.
        • -
        • y (Number): Y position of where to draw the ellipse.
        • -
        • width (Number): Width to draw the ellipse at.
        • -
        • height (Number): Height to draw the ellipse at.
        • +
        • ID (Integer): ID of the tile to draw.
        • +
        • x (Number): X position of where to draw the tile.
        • +
        • y (Number): Y position of where to draw the tile.
        • +
        • z (Number): Z position of where to draw the tile.
        • +
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • +
        • flipY (Integer): Whether or not to flip the tile vertically.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.Triangle

        - Draw.Triangle(x1, y1, x2, y2, x3, y3) -
        Draws a triangle.
        +

        +

        Draw3D.TriangleTextured

        + Draw3D.TriangleTextured(image, x1, y1, z1, x2, y2, z2, x3, y3, z3[, color1, color2, color3, u1, v1, u2, v2, u3, v3, matrixModel, matrixNormal]) +
        Draws a textured triangle in 3D space. The texture source should be an image.
        Parameters:
          +
        • image (Integer): Index of the loaded image.
        • x1 (Number): X position of the first vertex.
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • x2 (Number): X position of the second vertex.
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • x3 (Number): X position of the third vertex.
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • u1 (Number): Texture U of the first vertex.
        • +
        • v1 (Number): Texture V of the first vertex.
        • +
        • u2 (Number): Texture U of the second vertex.
        • +
        • v2 (Number): Texture V of the second vertex.
        • +
        • u3 (Number): Texture U of the third vertex.
        • +
        • v3 (Number): Texture V of the third vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.TriangleBlend

        - Draw.TriangleBlend(x1, y1, x2, y2, x3, y3, color1, color2, color3) -
        Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do Draw.SetBlendColor(0xFFFFFF, 1.0) if you want the vertex colors unaffected.)
        +

        +

        Draw3D.QuadTextured

        + Draw3D.QuadTextured(image, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, u1, v1, u2, v2, u3, v3, u4, v4, matrixModel, matrixNormal]) +
        Draws a textured quad in 3D space. The texture source should be an image.
        Parameters:
          +
        • image (Integer): Index of the loaded image.
        • x1 (Number): X position of the first vertex.
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • x2 (Number): X position of the second vertex.
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • x3 (Number): X position of the third vertex.
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.
        • +
        • z4 (Number): Z position of the fourth vertex.
        • color1 (Integer): Color of the first vertex.
        • color2 (Integer): Color of the second vertex.
        • color3 (Integer): Color of the third vertex.
        • +
        • color4 (Integer): Color of the fourth vertex.
        • +
        • u1 (Number): Texture U of the first vertex.
        • +
        • v1 (Number): Texture V of the first vertex.
        • +
        • u2 (Number): Texture U of the second vertex.
        • +
        • v2 (Number): Texture V of the second vertex.
        • +
        • u3 (Number): Texture U of the third vertex.
        • +
        • v3 (Number): Texture V of the third vertex.
        • +
        • u4 (Number): Texture U of the fourth vertex.
        • +
        • v4 (Number): Texture V of the fourth vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.QuadBlend

        - Draw.QuadBlend(x1, y1, x2, y2, x3, y3, x4, y4, color1, color2, color3, color4) -
        Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do Draw.SetBlendColor(0xFFFFFF, 1.0) if you want the vertex colors unaffected.)
        +

        +

        Draw3D.SpritePoints

        + Draw3D.SpritePoints(sprite, animation, frame, flipX, flipY, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) +
        Draws a textured rectangle in 3D space. The texture source should be a sprite.
        Parameters:
          +
        • sprite (Integer): Index of the loaded sprite.
        • +
        • animation (Integer): Index of the animation entry.
        • +
        • frame (Integer): Index of the frame in the animation entry.
        • +
        • flipX (Integer): Whether or not to flip the sprite horizontally.
        • +
        • flipY (Integer): Whether or not to flip the sprite vertically.
        • x1 (Number): X position of the first vertex.
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • x2 (Number): X position of the second vertex.
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • x3 (Number): X position of the third vertex.
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • x4 (Number): X position of the fourth vertex.
        • y4 (Number): Y position of the fourth vertex.
        • +
        • z4 (Number): Z position of the fourth vertex.
        • color1 (Integer): Color of the first vertex.
        • color2 (Integer): Color of the second vertex.
        • color3 (Integer): Color of the third vertex.
        • color4 (Integer): Color of the fourth vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.Rectangle

        - Draw.Rectangle(x, y, width, height) -
        Draws a rectangle.
        -
        Parameters:
        -
          -
        • x (Number): X position of where to draw the rectangle.
        • -
        • y (Number): Y position of where to draw the rectangle.
        • -
        • width (Number): Width to draw the rectangle at.
        • -
        • height (Number): Height to draw the rectangle at.
        • -
        -

        -

        -

        Draw.CircleStroke

        - Draw.CircleStroke(x, y, radius) -
        Draws a circle outline.
        -
        Parameters:
        -
          -
        • x (Number): Center X position of where to draw the circle.
        • -
        • y (Number): Center Y position of where to draw the circle.
        • -
        • radius (Number): Radius of the circle.
        • -
        -

        -

        -

        Draw.EllipseStroke

        - Draw.EllipseStroke(x, y, width, height) -
        Draws an ellipse outline.
        -
        Parameters:
        -
          -
        • x (Number): X position of where to draw the ellipse.
        • -
        • y (Number): Y position of where to draw the ellipse.
        • -
        • width (Number): Width to draw the ellipse at.
        • -
        • height (Number): Height to draw the ellipse at.
        • -
        -

        -

        -

        Draw.TriangleStroke

        - Draw.TriangleStroke(x1, y1, x2, y2, x3, y3) -
        Draws a triangle outline.
        +

        +

        Draw3D.TilePoints

        + Draw3D.TilePoints(ID, flipX, flipY, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4[, color1, color2, color3, color4, matrixModel, matrixNormal]) +
        Draws a textured rectangle in 3D space.
        Parameters:
          +
        • ID (Integer): ID of the tile to draw.
        • +
        • flipX (Integer): Whether or not to flip the tile horizontally.
        • +
        • flipY (Integer): Whether or not to flip the tile vertically.
        • x1 (Number): X position of the first vertex.
        • y1 (Number): Y position of the first vertex.
        • +
        • z1 (Number): Z position of the first vertex.
        • x2 (Number): X position of the second vertex.
        • y2 (Number): Y position of the second vertex.
        • +
        • z2 (Number): Z position of the second vertex.
        • x3 (Number): X position of the third vertex.
        • y3 (Number): Y position of the third vertex.
        • +
        • z3 (Number): Z position of the third vertex.
        • +
        • x4 (Number): X position of the fourth vertex.
        • +
        • y4 (Number): Y position of the fourth vertex.
        • +
        • z4 (Number): Z position of the fourth vertex.
        • +
        • color1 (Integer): Color of the first vertex.
        • +
        • color2 (Integer): Color of the second vertex.
        • +
        • color3 (Integer): Color of the third vertex.
        • +
        • color4 (Integer): Color of the fourth vertex.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.RectangleStroke

        - Draw.RectangleStroke(x, y, width, height) -
        Draws a rectangle outline.
        -
        Parameters:
        -
          -
        • x (Number): X position of where to draw the rectangle.
        • -
        • y (Number): Y position of where to draw the rectangle.
        • -
        • width (Number): Width to draw the rectangle at.
        • -
        • height (Number): Height to draw the rectangle at.
        • -
        -

        -

        -

        Draw.UseFillSmoothing

        - Draw.UseFillSmoothing(smoothFill) -
        Sets whether or not to use smoothing when drawing filled shapes. (hardware-renderer only)
        -
        Parameters:
        -
          -
        • smoothFill (Boolean): Whether or not to use smoothing.
        • -
        -

        -

        -

        Draw.UseStrokeSmoothing

        - Draw.UseStrokeSmoothing(smoothFill) -
        Sets whether or not to use smoothing when drawing un-filled shapes. (hardware-renderer only)
        -
        Parameters:
        -
          -
        • smoothFill (Boolean): Whether or not to use smoothing.
        • -
        -

        -

        -

        Draw.SetClip

        - Draw.SetClip(x, y, width, height) -
        Sets the region in which drawing will occur.
        -
        Parameters:
        -
          -
        • x (Number): X position of where to start the draw region.
        • -
        • y (Number): Y position of where to start the draw region.
        • -
        • width (Number): Width of the draw region.
        • -
        • height (Number): Height of the draw region.
        • -
        -

        -

        -

        Draw.ClearClip

        - Draw.ClearClip() -
        Resets the drawing region.
        -

        -

        -

        Draw.Save

        - Draw.Save() -

        -

        -

        Draw.Scale

        - Draw.Scale() -

        -

        -

        Draw.Rotate

        - Draw.Rotate() -

        -

        -

        Draw.Restore

        - Draw.Restore() -

        -

        -

        Draw.Translate

        - Draw.Translate() -

        -

        -

        Draw.SetTextureTarget

        - Draw.SetTextureTarget() -

        -

        -

        Draw.Clear

        - Draw.Clear() -

        -

        -

        Draw.ResetTextureTarget

        - Draw.ResetTextureTarget() -

        -

        -

        Draw.UseSpriteDeform

        - Draw.UseSpriteDeform(useDeform) -
        Sets whether or not to use sprite deform when drawing.
        +

        +

        Draw3D.SceneLayer

        + Draw3D.SceneLayer(layer[, matrixModel, matrixNormal]) +
        Draws a scene layer in 3D space.
        Parameters:
          -
        • useDeform (Boolean): Whether or not to use sprite deform when drawing.
        • +
        • layer (Integer): Index of the layer.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.SetSpriteDeformLine

        - Draw.SetSpriteDeformLine(deformIndex, deformValue) -
        Sets the sprite deform line at the specified line index.
        +

        +

        Draw3D.SceneLayerPart

        + Draw3D.SceneLayerPart(layer, partX, partY, partW, partH[, matrixModel, matrixNormal]) +
        Draws part of a scene layer in 3D space.
        Parameters:
          -
        • deformIndex (Integer): Index of deform line. (0 = top of screen, 1 = the line below it, 2 = etc.)
        • -
        • deformValue (Decimal): Deform value.
        • +
        • layer (Integer): Index of the layer.
        • +
        • partX (Integer): X coordinate (in tiles) of part of layer to draw.
        • +
        • partY (Integer): Y coordinate (in tiles) of part of layer to draw.
        • +
        • partW (Integer): Width (in tiles) of part of layer to draw.
        • +
        • partH (Integer): Height (in tiles) of part of layer to draw.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.UseDepthTesting

        - Draw.UseDepthTesting(useDepthTesting) -
        Sets whether or not to do depth tests when drawing.
        +

        +

        Draw3D.VertexBuffer

        + Draw3D.VertexBuffer(vertexBufferIndex[, matrixModel, matrixNormal]) +
        Draws a vertex buffer.
        Parameters:
          -
        • useDepthTesting (Boolean): Whether or not to do depth tests when drawing.
        • +
        • vertexBufferIndex (Integer): The vertex buffer to draw.
        • +
        • matrixModel (Matrix): Matrix for transforming coordinates to world space.
        • +
        • matrixNormal (Matrix): Matrix for transforming normals.

        -

        -

        Draw.GetCurrentDrawGroup

        - Draw.GetCurrentDrawGroup() -
        Gets the draw group currently being drawn.
        -
        Returns:
        -
        Returns an Integer value.
        -

        -

        -

        Draw.CopyScreen

        - Draw.CopyScreen(texture) -
        Copies the contents of the screen into a texture.
        +

        +

        Draw3D.RenderScene

        + Draw3D.RenderScene(scene3DIndex[, drawMode]) +
        Draws everything in the 3D scene.
        Parameters:
          -
        • texture (Integer): Texture index.
        • +
        • scene3DIndex (Integer): The 3D scene at the index to draw.
        • +
        • drawMode (Integer): The type of drawing to use for the vertices in the 3D scene.

        @@ -4261,33 +4346,87 @@

        File.Exists

        Determines if the file at the path exists.
        Parameters:
          -
        • path (String): The path of the file to check for existence.
        • +
        • path (String): The path of the file to check for existence.
        • +
        +
        Returns:
        +
        Returns 1 if the file exists, 0 if otherwise
        +

        +

        +

        File.ReadAllText

        + File.ReadAllText(path) +
        Reads all text from the given filename.
        +
        Parameters:
        +
          +
        • path (String): The path of the file to read.
        • +
        +
        Returns:
        +
        Returns all the text in the file as a String value if it can be read, otherwise it returns a null value if it cannot be read.
        +

        +

        +

        File.WriteAllText

        + File.WriteAllText(path, text) +
        Writes all text to the given filename.
        +
        Parameters:
        +
          +
        • path (String): The path of the file to read.
        • +
        • text (String): The text to write to the file.
        • +
        +
        Returns:
        +
        Returns true if successful, false if otherwise.
        +

        +

        +

        Geometry.Triangulate

        + Geometry.Triangulate(polygon[, holes]) +
        Triangulates a 2D polygon.
        +
        Parameters:
        +
          +
        • polygon (Array): Array of vertices that compromise the polygon to triangulate.
        • +
        • holes (Array): Array of polygons that compromise the holes to be made in the resulting shape.
        • +
        +
        Returns:
        +
        Returns an Array containing a list of triangles, or null if the polygon could not be triangulated.
        +

        +

        +

        Geometry.Intersect

        + Geometry.Intersect(subjects, clips[, booleanOp, fillRule]) +
        Intersects a 2D polygon.
        +
        Parameters:
        +
        Returns:
        -
        Returns 1 if the file exists, 0 if otherwise
        +
        Returns an Array containing a list of intersected polygons, or null if the polygon could not be intersected.

        -

        -

        File.ReadAllText

        - File.ReadAllText(path) -
        Reads all text from the given filename.
        +

        +

        Geometry.IsPointInsidePolygon

        + Geometry.IsPointInsidePolygon(polygon, pointX, pointY) +
        Checks if a point is inside a polygon.
        Parameters:
          -
        • path (String): The path of the file to read.
        • +
        • polygon (Array): The polygon.
        • +
        • pointX (Decimal): The X of the point.
        • +
        • pointY (Decimal): The Y of the point.
        Returns:
        -
        Returns all the text in the file as a String value if it can be read, otherwise it returns a null value if it cannot be read.
        +
        Returns true if the point is inside, or false if the point is outside.

        -

        -

        File.WriteAllText

        - File.WriteAllText(path, text) -
        Writes all text to the given filename.
        +

        +

        Geometry.IsLineIntersectingPolygon

        + Geometry.IsLineIntersectingPolygon(polygon, x1, y1, x2, y2) +
        Checks if a line segment is intersecting a polygon.
        Parameters:
          -
        • path (String): The path of the file to read.
        • -
        • text (String): The text to write to the file.
        • +
        • polygon (Array): The polygon to check.
        • +
        • x1 (Decimal): The starting X of the segment.
        • +
        • y1 (Decimal): The starting Y of the segment.
        • +
        • x2 (Decimal): The ending X of the segment.
        • +
        • y2 (Decimal): The ending Y of the segment.
        Returns:
        -
        Returns true if successful, false if otherwise.
        +
        Returns true if the line segment is intersecting the polygon, or false if it is not.

        HTTP.GetString

        @@ -4297,6 +4436,28 @@

        HTTP.GetString

        HTTP.GetToFile

        HTTP.GetToFile()

        +

        +

        Image.GetWidth

        + Image.GetWidth(image) +
        Gets the width of the specified image.
        +
        Parameters:
        +
          +
        • image (Integer): The image index to check.
        • +
        +
        Returns:
        +
        Returns an Integer value.
        +

        +

        +

        Image.GetHeight

        + Image.GetHeight(image) +
        Gets the height of the specified image.
        +
        Parameters:
        +
          +
        • image (Integer): The image index to check.
        • +
        +
        Returns:
        +
        Returns an Integer value.
        +

        Input.GetMouseX

        Input.GetMouseX() @@ -4377,71 +4538,6 @@

        Input.IsKeyReleased

        Returns:
        Returns whether the key released during the current frame.

        -

        -

        Input.GetControllerCount

        - Input.GetControllerCount() -
        Gets the amount of connected controllers in the device. (Deprecated; use Controller.GetCount instead.)
        -
        Returns:
        -
        Returns the amount of connected controllers in the device.
        -

        -

        -

        Input.GetControllerAttached

        - Input.GetControllerAttached(controllerIndex) -
        Gets whether the controller at the index is connected. (Deprecated; use Controller.IsConnected instead.)
        -
        Parameters:
        -
          -
        • controllerIndex (Integer): Index of the controller to check.
        • -
        -
        Returns:
        -
        Returns whether the controller at the index is connected.
        -

        -

        -

        Input.GetControllerHat

        - Input.GetControllerHat(controllerIndex, hatIndex) -
        Gets the hat value from the controller at the index. (Deprecated; use Controller.GetButton instead.)
        -
        Parameters:
        -
          -
        • controllerIndex (Integer): Index of the controller to check.
        • -
        • hatIndex (Integer): Index of the hat to check.
        • -
        -
        Returns:
        -
        Returns the hat value from the controller at the index.
        -

        -

        -

        Input.GetControllerAxis

        - Input.GetControllerAxis(controllerIndex, axisIndex) -
        Gets the axis value from the controller at the index. (Deprecated; use Controller.GetAxis instead.)
        -
        Parameters:
        -
          -
        • controllerIndex (Integer): Index of the controller to check.
        • -
        • axisIndex (Integer): Index of the axis to check.
        • -
        -
        Returns:
        -
        Returns the axis value from the controller at the index.
        -

        -

        -

        Input.GetControllerButton

        - Input.GetControllerButton(controllerIndex, buttonIndex) -
        Gets the button value from the controller at the index. (Deprecated; use Controller.GetButton instead.)
        -
        Parameters:
        -
          -
        • controllerIndex (Integer): Index of the controller to check.
        • -
        • buttonIndex (Integer): Index of the button to check.
        • -
        -
        Returns:
        -
        Returns the button value from the controller at the index.
        -

        -

        -

        Input.GetControllerName

        - Input.GetControllerName(controllerIndex) -
        Gets the name of the controller at the index. (Deprecated; use Controller.GetName instead.)
        -
        Parameters:
        -
          -
        • controllerIndex (Integer): Index of the controller to check.
        • -
        -
        Returns:
        -
        Returns the name of the controller at the index.
        -

        Input.GetKeyName

        Input.GetKeyName(keyID) @@ -4589,7 +4685,7 @@

        Instance.GetBySlotID

      • slotID (Integer): The slot ID to search a corresponding instance for.
      Returns:
      -
      Returns the instance corresponding to the specified slot ID, null if the instance could not be found.
      +
      Returns the instance corresponding to the specified slot ID, or null if no instance was found.

      Instance.DisableAutoAnimate

      @@ -5046,7 +5142,7 @@

      Model.GetAnimationCount

    • model (Integer): The model index to check.
    Returns:
    -
    The animation count. Will always return 0 for vertex-animated models.
    +
    Returns an Integer value.

    Model.GetAnimationName

    @@ -5075,13 +5171,13 @@

    Model.GetAnimationIndex

    Model.GetFrameCount

    Model.GetFrameCount(model) -
    Returns how many frames exist in the model.
    +
    Returns how many frames exist in the model. (Deprecated; use Model.GetAnimationLength instead.)
    Parameters:
    • model (Integer): The model index to check.
    Returns:
    -
    The frame count. Will always return 0 for skeletal-animated models.
    +
    Returns an Integer value.

    Model.GetAnimationLength

    @@ -5260,7 +5356,7 @@

    Music.IsPlaying

  • music (Integer): The music index to play.
  • Returns:
    -
    Returns whether or not the music is playing.
    +
    Returns a Boolean value.

    Music.GetPosition

    @@ -5270,6 +5366,8 @@

    Music.GetPosition

    • music (Integer): The music index to get the current position (in seconds) of.
    +
    Returns:
    +
    Returns a Decimal value.

    Music.Alter

    @@ -5289,8 +5387,10 @@

    Number.ToString

    Parameters:
    • n (Number): Number value.
    • -
    • base (Integer): radix
    • +
    • base (Integer): The numerical base, or radix.
    +
    Returns:
    +
    Returns a String value.

    Number.AsInteger

    @@ -5306,13 +5406,13 @@

    Number.AsInteger

    Number.AsDecimal

    Number.AsDecimal(n) -
    Converts a Integer to an Decimal.
    +
    Converts a Integer to a Decimal.
    Parameters:
    • n (Number): Number value.
    Returns:
    -
    Returns an Decimal value.
    +
    Returns a Decimal value.

    Object.Loaded

    @@ -5385,6 +5485,8 @@

    Palette.GetColor

  • paletteIndex (Integer): Index of palette.
  • colorIndex (Integer): Index of color.
  • +
    Returns:
    +
    Returns an Integer value.

    Palette.SetColor

    @@ -5397,6 +5499,29 @@

    Palette.SetColor

  • hex (Integer): Hexadecimal color value to set the color to. (format: 0xRRGGBB)
  • +

    +

    Palette.GetColorTransparent

    + Palette.GetColorTransparent(paletteIndex, colorIndex) +
    Gets if the color on the specified palette is transparent.
    +
    Parameters:
    +
      +
    • paletteIndex (Integer): Index of palette.
    • +
    • colorIndex (Integer): Index of color.
    • +
    +
    Returns:
    +
    Returns a Boolean value.
    +

    +

    +

    Palette.SetColorTransparent

    + Palette.SetColorTransparent(paletteIndex, colorIndex, isTransparent) +
    Sets a color on the specified palette transparent.
    +
    Parameters:
    +
      +
    • paletteIndex (Integer): Index of palette.
    • +
    • colorIndex (Integer): Index of color.
    • +
    • isTransparent (Boolean): Whether to make the color transparent or not.
    • +
    +

    Palette.MixPalettes

    Palette.MixPalettes(destinationPaletteIndex, paletteIndexA, paletteIndexB, mixRatio, colorIndexStart, colorCount) @@ -5446,6 +5571,15 @@

    Palette.CopyColors

  • colorCount (Integer): Amount of colors to be copied.
  • +

    +

    Palette.UsePaletteIndexLines

    + Palette.UsePaletteIndexLines(usePaletteIndexLines) +
    Enables or disables the global palette index table.
    +
    Parameters:
    +
      +
    • usePaletteIndexLines (Boolean): Whether or not to use the global palette index table.
    • +
    +

    Palette.SetPaletteIndexLines

    Palette.SetPaletteIndexLines(paletteIndex, lineStart, lineEnd) @@ -5624,13 +5758,13 @@

    RSDK.Math.RadianToInteger

    RSDK.Math.IntegerToRadian

    RSDK.Math.IntegerToRadian(integer) -
    Gets the radian decimal conversion of an integer, based on 256.
    +
    Gets the radia Decimal conversion of an integer, based on 256.
    Parameters:
    • integer (Integer): Integer value to convert.
    Returns:
    -
    A radian decimal value of the converted integer.
    +
    A radia Decimal value of the converted integer.

    RSDK.Matrix.Create256

    @@ -5953,7 +6087,7 @@

    Scene.LoadNoPersistency

    Scene.LoadPosition

    Scene.LoadPosition([persistency]) -
    Loads the scene located in the scene list's position slot, if a scene sist is loaded.
    +
    Loads the scene located in the scene list's position slot, if a scene list is loaded.
    Parameters:
    • persistency (Boolean): Whether or not the scene should load with persistency.
    • @@ -6054,6 +6188,17 @@

      Scene.GetLayerOpacity

      Returns:
      Returns a Decimal value.

      +

      +

      Scene.GetLayerUsePaletteIndexLines

      + Scene.GetLayerUsePaletteIndexLines(layerIndex) +
      Gets whether the layer is using the global palette index table.
      +
      Parameters:
      +
        +
      • layerIndex (Integer): Index of layer.
      • +
      +
      Returns:
      +
      Returns a Boolean value.
      +

      Scene.GetLayerProperty

      Scene.GetLayerProperty(layerIndex, property) @@ -6173,13 +6318,36 @@

      Scene.GetLayerOffsetY

      Scene.GetLayerDrawGroup

      - Scene.GetLayerDrawGroup(layerIndex, drawGroup) -
      Sets the draw group of the specified layer.
      + Scene.GetLayerDrawGroup(layerIndex) +
      Gets the draw group of the specified layer.
      +
      Parameters:
      +
        +
      • layerIndex (Integer): Index of layer.
      • +
      +
      Returns:
      +
      Returns an Integer value.
      +

      +

      +

      Scene.GetLayerHorizontalRepeat

      + Scene.GetLayerHorizontalRepeat(layerIndex) +
      Gets whether or not the layer repeats horizontally.
      Parameters:
      • layerIndex (Integer): Index of layer.
      • -
      • drawGroup (Integer): Number from 0 to 15. (0 = Back, 15 = Front)
      +
      Returns:
      +
      Returns a Boolean value.
      +

      +

      +

      Scene.GetLayerVerticalRepeat

      + Scene.GetLayerVerticalRepeat(layerIndex) +
      Gets whether or not the layer repeats vertically.
      +
      Parameters:
      +
        +
      • layerIndex (Integer): Index of layer.
      • +
      +
      Returns:
      +
      Returns a Boolean value.

      Scene.GetTilesetCount

      @@ -6232,6 +6400,17 @@

      Scene.GetTilesetFirstTileID

      Returns:
      Returns an Integer value.

      +

      +

      Scene.GetTilesetPaletteIndex

      + Scene.GetTilesetPaletteIndex(tilesetID) +
      Gets the palette index for the specified tileset.
      +
      Parameters:
      +
        +
      • tilesetID (Integer): The tileset index.
      • +
      +
      Returns:
      +
      Returns an Integer value.
      +

      Scene.GetTileWidth

      Scene.GetTileWidth() @@ -6246,13 +6425,6 @@

      Scene.GetTileHeight

      Returns:
      Returns the height of tiles.

      -

      -

      Scene.GetTileSize

      - Scene.GetTileSize() -
      Gets the size of tiles. (Deprecated; use Scene.GetTileWidth and Scene.GetTileHeight instead.)
      -
      Returns:
      -
      Returns the size of tiles.
      -

      Scene.GetTileID

      Scene.GetTileID(layer, x, y) @@ -6313,7 +6485,7 @@

      Scene.GetDrawGroupEntityDepthSorting

      Scene.GetListPos

      Scene.GetListPos() -
      Gets the current list position of the scene.
      +
      Gets the current list position of the scene. (Deprecated)
      Returns:
      Returns an Integer value.

      @@ -6355,14 +6527,14 @@

      Scene.GetActiveCategory

      Scene.GetCategoryCount

      Scene.GetCategoryCount() -
      Gets the amount of categories in the scene list.
      +
      Gets the amount of categories in the scene list. (Deprecated; use SceneList.GetCategoryCount instead.)
      Returns:
      Returns an Integer value.

      Scene.GetStageCount

      Scene.GetStageCount() -
      Gets the amount of stages in the scene list.
      +
      Gets the amount of stages in the scene list. (Deprecated; use SceneList.GetSceneCount instead.)
      Returns:
      Returns an Integer value.

      @@ -6473,14 +6645,14 @@

      Scene.GetTileAnimSequenceFrame

      Scene.CheckValidScene

      Scene.CheckValidScene() -
      Checks whether the scene list's position is within the list's size, if a scene list is loaded.
      +
      Checks whether the scene list's position is within the list's size, if a scene list is loaded. (Deprecated)
      Returns:
      Returns a Boolean value.

      Scene.CheckSceneFolder

      Scene.CheckSceneFolder(folder) -
      Checks whether the current scene's folder matches the string to check, if a scene list is loaded.
      +
      Checks whether the current scene's folder matches the string to check, if a scene list is loaded. (Deprecated)
      Parameters:
      • folder (String): Folder name to compare.
      • @@ -6491,7 +6663,7 @@

        Scene.CheckSceneFolder

        Scene.CheckSceneID

        Scene.CheckSceneID(id) -
        Checks whether the current scene's ID matches the string to check, if a scene list is loaded.
        +
        Checks whether the current scene's ID matches the string to check, if a scene list is loaded. (Deprecated)
        Parameters:
        • id (String): ID to compare.
        • @@ -6509,12 +6681,12 @@

          Scene.IsPaused

          Scene.SetListPos

          Scene.SetListPos() -
          Sets the current list position of the scene.
          +
          Sets the current list position of the scene. (Deprecated)

          Scene.SetActiveCategory

          Scene.SetActiveCategory() -
          Sets the current category number of the scene.
          +
          Sets the current category number of the scene. (Deprecated)

          Scene.SetDebugMode

          @@ -6524,11 +6696,11 @@

          Scene.SetDebugMode

          Scene.SetScene

          Scene.SetScene(category, scene) -
          Sets the scene if the category and scene names exist within the scene list.
          +
          Sets the scene if the category and scene names exist within the scene list. (Deprecated)
          Parameters:
          • category (String): Category name.
          • -
          • scene (String): Scene name. If the scene name is not found but the category name is, the
          • +
          • scene (String): Scene name. If the scene name is not found but the category name is, the first scene in the category is used.

          @@ -6630,6 +6802,16 @@

          Scene.SetTileAnimSequenceFrame

        • index (Integer): The frame index.

        +

        +

        Scene.SetTilesetPaletteIndex

        + Scene.SetTilesetPaletteIndex(tilesetID, paletteIndex) +
        Sets the palette index of the specified tileset.
        +
        Parameters:
        +
          +
        • tilesetID (Integer): The tileset index.
        • +
        • paletteIndex (Integer): The palette index.
        • +
        +

        Scene.SetLayerVisible

        Scene.SetLayerVisible(layerIndex, isVisible) @@ -6716,6 +6898,26 @@

        Scene.SetLayerRepeat

      • doesRepeat (Boolean): Whether or not the layer repeats.

      +

      +

      Scene.SetLayerHorizontalRepeat

      + Scene.SetLayerHorizontalRepeat(layerIndex, doesRepeat) +
      Sets whether or not the specified layer repeats horizontally.
      +
      Parameters:
      +
        +
      • layerIndex (Integer): Index of layer.
      • +
      • doesRepeat (Boolean): Whether or not the layer repeats horizontally.
      • +
      +

      +

      +

      Scene.SetLayerVerticalRepeat

      + Scene.SetLayerVerticalRepeat(layerIndex, doesRepeat) +
      Sets whether or not the specified layer repeats vertically.
      +
      Parameters:
      +
        +
      • layerIndex (Integer): Index of layer.
      • +
      • doesRepeat (Boolean): Whether or not the layer repeats vertically.
      • +
      +

      Scene.SetDrawGroupCount

      Scene.SetDrawGroupCount(count) @@ -6756,6 +6958,16 @@

      Scene.SetLayerOpacity

    • opacity (Decimal): Opacity from 0.0 to 1.0.

    +

    +

    Scene.SetLayerUsePaletteIndexLines

    + Scene.SetLayerUsePaletteIndexLines(layerIndex, usePaletteIndexLines) +
    Enables or disables the use of the global palette index table for the specified layer.
    +
    Parameters:
    +
      +
    • layerIndex (Integer): Index of layer.
    • +
    • usePaletteIndexLines (Boolean): Whether the layer is using the global palette index table.
    • +
    +

    Scene.SetLayerScroll

    Scene.SetLayerScroll(layerIndex, relative, constant) @@ -7110,6 +7322,132 @@

    Scene3D.Clear

  • scene3DIndex (Integer): The index of the 3D scene.
  • +

    +

    SceneList.Get

    + SceneList.Get(category, entry) +
    Gets the scene path for the specified category and entry.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • entry (String): The entry.
    • +
    +
    Returns:
    +
    Returns a String value.
    +

    +

    +

    SceneList.GetEntryID

    + SceneList.GetEntryID(categoryName, entryName) +
    Gets the entry ID for the specified category and entry name.
    +
    Parameters:
    +
      +
    • categoryName (String): The category name.
    • +
    • entryName (String): The entry name.
    • +
    +
    Returns:
    +
    Returns the entry ID, or -1 if not found.
    +

    +

    +

    SceneList.GetCategoryID

    + SceneList.GetCategoryID(categoryName) +
    Gets the category ID for the specified category name.
    +
    Parameters:
    +
      +
    • categoryName (String): The category name.
    • +
    +
    Returns:
    +
    Returns the category ID, or -1 if not found.
    +

    +

    +

    SceneList.GetEntryName

    + SceneList.GetEntryName(category, entryID) +
    Gets the entry name for the specified category and entry.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • entryID (Integer): The entry ID.
    • +
    +
    Returns:
    +
    Returns the entry name.
    +

    +

    +

    SceneList.GetCategoryName

    + SceneList.GetCategoryName(categoryID) +
    Gets the category name for the specified category ID.
    +
    Parameters:
    +
      +
    • categoryID (Integer): The category ID.
    • +
    +
    Returns:
    +
    Returns the category name, or -1 if not valid.
    +

    +

    +

    SceneList.GetEntryProperty

    + SceneList.GetEntryProperty(category, entry, property) +
    Gets a property for an entry.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • entry (String): The entry.
    • +
    • property (String): The property.
    • +
    +
    Returns:
    +
    Returns a String value, or null if the entry has no such property.
    +

    +

    +

    SceneList.GetCategoryProperty

    + SceneList.GetCategoryProperty(category, property) +
    Gets a property for a category.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • property (String): The property.
    • +
    +
    Returns:
    +
    Returns a String value, or null if the category has no such property.
    +

    +

    +

    SceneList.HasEntryProperty

    + SceneList.HasEntryProperty(category, entry, property) +
    Checks if a given property exists in the entry.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • entry (String): The entry.
    • +
    • property (String): The property.
    • +
    +
    Returns:
    +
    Returns true if the property exists, false if not.
    +

    +

    +

    SceneList.HasCategoryProperty

    + SceneList.HasCategoryProperty(category, property) +
    Checks if a given property exists in the category.
    +
    Parameters:
    +
      +
    • category (String): The category.
    • +
    • property (String): The property.
    • +
    +
    Returns:
    +
    Returns true if the property exists, false if not.
    +

    +

    +

    SceneList.GetCategoryCount

    + SceneList.GetCategoryCount() +
    Gets the amount of categories in the scene list.
    +
    Returns:
    +
    Returns an Integer value.
    +

    +

    +

    SceneList.GetSceneCount

    + SceneList.GetSceneCount([categoryName]) +
    Gets the amount of scenes in a category.
    +
    Parameters:
    +
      +
    • categoryName (String): The category name.
    • +
    +
    Returns:
    +
    Returns the number of scenes in the category. If categoryName is omitted, this returns the total amount of scenes in the entire list.
    +

    Serializer.WriteToStream

    Serializer.WriteToStream(stream, value) @@ -7383,7 +7721,7 @@

    Sound.Play

  • volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.)
  • Returns:
    -
    Returns the channel index where the sound began to play.
    +
    Returns the channel index where the sound began to play, or -1 if no channel was available.

    Sound.Loop

    @@ -7398,7 +7736,7 @@

    Sound.Loop

  • volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.)
  • Returns:
    -
    Returns the channel index where the sound began to play.
    +
    Returns the channel index where the sound began to play, or -1 if no channel was available.

    Sound.Stop

    @@ -7450,6 +7788,8 @@

    Sound.IsPlaying

    • sound (Integer): The sound index.
    +
    Returns:
    +
    Returns a Boolean value.

    Sound.PlayMultiple

    @@ -7463,7 +7803,7 @@

    Sound.PlayMultiple

  • volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.)
  • Returns:
    -
    Returns the channel index where the sound began to play.
    +
    Returns the channel index where the sound began to play, or -1 if no channel was available.

    Sound.LoopMultiple

    @@ -7478,7 +7818,7 @@

    Sound.LoopMultiple

  • volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.)
  • Returns:
    -
    Returns the channel index where the sound began to play.
    +
    Returns the channel index where the sound began to play, or -1 if no channel was available.

    Sound.PlayAtChannel

    @@ -8245,13 +8585,13 @@

    String.ParseInteger

    String.ParseDecimal

    String.ParseDecimal(string) -
    Convert a String value to an Decimal value if possible.
    +
    Convert a String value to a Decimal value if possible.
    Parameters:
    • string (String): The string to parse.
    Returns:
    -
    Returns the value as an Decimal.
    +
    Returns the value as a Decimal.

    Texture.Create

    @@ -9045,7 +9385,7 @@

    XML.Parse

    Returns:
    Returns a Map value if the text can be decoded, otherwise returns null.

    -

    669 out of 728 functions have descriptions.

    +

    684 out of 743 functions have descriptions.


    Instance methods

    @@ -9073,6 +9413,13 @@

    instance.Animate

    instance.Animate()
    Animates the entity.

    +

    +

    instance.GetIDWithinClass

    + instance.GetIDWithinClass() +
    Gets the ordered ID of the entity amongst other entities of the same type.
    +
    Returns:
    +
    Returns an Integer value.
    +

    instance.AddToRegistry

    instance.AddToRegistry(registry) @@ -9134,9 +9481,9 @@

    instance.GetHitboxFromSprite

  • hitbox (Integer): The hitbox ID.
  • -

    -

    instance.GetHitboxFromSprite

    - instance.GetHitboxFromSprite(sprite, animation, frame, hitbox) +

    +

    instance.ReturnHitboxFromSprite

    + instance.ReturnHitboxFromSprite(sprite, animation, frame, hitbox)
    Gets the hitbox in the specified sprite's animation, frame and hitbox ID.
    Parameters:
      @@ -9295,7 +9642,7 @@

      instance.StopAllSounds

      instance.StopAllSounds()
      Stops all sounds the entity is playing.

      -

      24 out of 24 methods have descriptions.

      +

      25 out of 25 methods have descriptions.


      Instance fields

      @@ -9595,6 +9942,30 @@

      instance.HitboxOffY

      Default: 0.0
      The vertical offset of the hitbox.

      +

      +

      instance.HitboxLeft

      +
      Type: Decimal
      +
      Default: 0.0
      +
      The left extent of the hitbox.
      +

      +

      +

      instance.HitboxTop

      +
      Type: Decimal
      +
      Default: 0.0
      +
      The top extent of the hitbox.
      +

      +

      +

      instance.HitboxRight

      +
      Type: Decimal
      +
      Default: 0.0
      +
      The right extent of the hitbox.
      +

      +

      +

      instance.HitboxBottom

      +
      Type: Decimal
      +
      Default: 0.0
      +
      The bottom extent of the hitbox.
      +

      instance.FlipFlag

      Type: Integer
      @@ -9729,7 +10100,7 @@

      instance.Persistence

      Default: Persistence_NONE
      Whether the entity persists between scenes.

      -

      69 out of 73 fields have descriptions.

      +

      73 out of 77 fields have descriptions.


      Enums

      @@ -10184,6 +10555,54 @@

      FogEquation_Linear

      FogEquation_Exp

      Exponential fog equation.

      +

      +

      GeoBooleanOp_Intersection

      +
      AND operation.
      +

      +

      +

      GeoBooleanOp_Union

      +
      OR operation.
      +

      +

      +

      GeoBooleanOp_Difference

      +
      NOT operation.
      +

      +

      +

      GeoBooleanOp_ExclusiveOr

      +
      XOR operation.
      +

      +

      +

      GeoFillRule_EvenOdd

      +
      Only odd numbered subregions are filled.
      +

      +

      +

      GeoFillRule_NonZero

      +
      Only non-zero subregions are filled.
      +

      +

      +

      GeoFillRule_Positive

      +
      Only subregions that have winding counts greater than zero (> 0) are filled.
      +

      +

      +

      GeoFillRule_Negative

      +
      Only subregions that have winding counts lesser than zero (< 0) are filled.
      +

      +

      +

      HitboxSide_LEFT

      +
      Left side, slot 0 of a hitbox array.
      +

      +

      +

      HitboxSide_TOP

      +
      Top side, slot 1 of a hitbox array.
      +

      +

      +

      HitboxSide_RIGHT

      +
      Right side, slot 2 of a hitbox array.
      +

      +

      +

      HitboxSide_BOTTOM

      +
      Bottom side, slot 3 of a hitbox array.
      +

      KeyBind_Fullscreen

      Fullscreen keybind.
      @@ -10380,6 +10799,22 @@

      TILECOLLISION_DOWN

      TILECOLLISION_UP

      Entity expects upward gravity for tile collision.

      +

      +

      TimeOfDay_MORNING

      +
      The early hours of the day (5AM to 11AM, or 05:00 to 11:00).
      +

      +

      +

      TimeOfDay_MIDDAY

      +
      The middle hours of the day (12PM to 4PM, or 12:00 to 16:00).
      +

      +

      +

      TimeOfDay_EVENING

      +
      The later hours of the day (5PM to 8PM, or 17:00 to 20:00).
      +

      +

      +

      TimeOfDay_NIGHT

      +
      The very late and very early hours of the day (9PM to 4AM, or 21:00 to 4:00).
      +

      TintMode_SRC_NORMAL

      Tints the source pixel with the tint color.
      @@ -10396,7 +10831,35 @@

      TintMode_SRC_BLEND

      TintMode_DST_BLEND

      Blends the destination pixel with the tint color.

      -

      166 out of 181 enums have descriptions.

      +

      +

      Weekday_SUNDAY

      +
      The first day of the week.
      +

      +

      +

      Weekday_MONDAY

      +
      The second day of the week.
      +

      +

      +

      Weekday_TUESDAY

      +
      The third day of the week.
      +

      +

      +

      Weekday_WEDNESDAY

      +
      The fourth day of the week.
      +

      +

      +

      Weekday_THURSDAY

      +
      The fifth day of the week.
      +

      +

      +

      Weekday_FRIDAY

      +
      The sixth day of the week.
      +

      +

      +

      Weekday_SATURDAY

      +
      The seventh day of the week.
      +

      +

      189 out of 189 enums have descriptions.


      Constants

      diff --git a/meta/win/bin/SDL2.dll b/meta/win/bin/SDL2.dll deleted file mode 100644 index 24eb044a..00000000 Binary files a/meta/win/bin/SDL2.dll and /dev/null differ diff --git a/meta/win/bin/SDL2_image.dll b/meta/win/bin/SDL2_image.dll deleted file mode 100644 index ab6f38b3..00000000 Binary files a/meta/win/bin/SDL2_image.dll and /dev/null differ diff --git a/meta/win/bin/avformat-58.dll b/meta/win/bin/avformat-58.dll deleted file mode 100644 index 26f618d4..00000000 Binary files a/meta/win/bin/avformat-58.dll and /dev/null differ diff --git a/meta/win/bin/avutil-56.dll b/meta/win/bin/avutil-56.dll deleted file mode 100644 index 07ee15d3..00000000 Binary files a/meta/win/bin/avutil-56.dll and /dev/null differ diff --git a/meta/win/bin/discord-rpc.dll b/meta/win/bin/discord-rpc.dll deleted file mode 100644 index 4254cfa2..00000000 Binary files a/meta/win/bin/discord-rpc.dll and /dev/null differ diff --git a/meta/win/bin/freeglut.dll b/meta/win/bin/freeglut.dll deleted file mode 100644 index c768c153..00000000 Binary files a/meta/win/bin/freeglut.dll and /dev/null differ diff --git a/meta/win/bin/glew32.dll b/meta/win/bin/glew32.dll deleted file mode 100644 index cbe1d67b..00000000 Binary files a/meta/win/bin/glew32.dll and /dev/null differ diff --git a/meta/win/bin/libjpeg-9.dll b/meta/win/bin/libjpeg-9.dll deleted file mode 100644 index 9d8911ca..00000000 Binary files a/meta/win/bin/libjpeg-9.dll and /dev/null differ diff --git a/meta/win/bin/libpng16-16.dll b/meta/win/bin/libpng16-16.dll deleted file mode 100644 index fd5db8d1..00000000 Binary files a/meta/win/bin/libpng16-16.dll and /dev/null differ diff --git a/meta/win/bin/libtiff-5.dll b/meta/win/bin/libtiff-5.dll deleted file mode 100644 index af3c3e66..00000000 Binary files a/meta/win/bin/libtiff-5.dll and /dev/null differ diff --git a/meta/win/bin/libwebp-7.dll b/meta/win/bin/libwebp-7.dll deleted file mode 100644 index c11bf138..00000000 Binary files a/meta/win/bin/libwebp-7.dll and /dev/null differ diff --git a/meta/win/bin/swresample-3.dll b/meta/win/bin/swresample-3.dll deleted file mode 100644 index d8c3cdeb..00000000 Binary files a/meta/win/bin/swresample-3.dll and /dev/null differ diff --git a/meta/win/bin/swscale-5.dll b/meta/win/bin/swscale-5.dll deleted file mode 100644 index 249e5a4b..00000000 Binary files a/meta/win/bin/swscale-5.dll and /dev/null differ diff --git a/meta/win/bin/zlib1.dll b/meta/win/bin/zlib1.dll deleted file mode 100644 index 3a45deb5..00000000 Binary files a/meta/win/bin/zlib1.dll and /dev/null differ diff --git a/meta/win/bin/zlib12.dll b/meta/win/bin/zlib12.dll deleted file mode 100644 index 2dafa3ce..00000000 Binary files a/meta/win/bin/zlib12.dll and /dev/null differ diff --git a/meta/win/bin/zlibwapi.dll b/meta/win/bin/zlibwapi.dll deleted file mode 100644 index bac1eb1d..00000000 Binary files a/meta/win/bin/zlibwapi.dll and /dev/null differ diff --git a/meta/win/include/GL/eglew.h b/meta/win/include/GL/eglew.h index 46701479..e9e5a0b2 100644 --- a/meta/win/include/GL/eglew.h +++ b/meta/win/include/GL/eglew.h @@ -1,6 +1,6 @@ /* ** The OpenGL Extension Wrangler Library -** Copyright (C) 2008-2017, Nigel Stewart +** Copyright (C) 2008-2019, Nigel Stewart ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev @@ -106,7 +106,11 @@ #include #include -#include +#ifndef GLEW_INCLUDE +# include +#else +# include GLEW_INCLUDE +#endif #ifdef __cplusplus extern "C" { @@ -151,6 +155,7 @@ typedef khronos_utime_nanoseconds_t EGLuint64NV; typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; struct EGLClientPixmapHI; +struct AHardwareBuffer; #define EGL_DONT_CARE ((EGLint)-1) @@ -476,12 +481,21 @@ typedef EGLBoolean ( * PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGL #endif /* EGL_VERSION_1_5 */ +/* ------------------------ EGL_ANDROID_GLES_layers ------------------------ */ + +#ifndef EGL_ANDROID_GLES_layers +#define EGL_ANDROID_GLES_layers 1 + +#define EGLEW_ANDROID_GLES_layers EGLEW_GET_VAR(__EGLEW_ANDROID_GLES_layers) + +#endif /* EGL_ANDROID_GLES_layers */ + /* ------------------------- EGL_ANDROID_blob_cache ------------------------ */ #ifndef EGL_ANDROID_blob_cache #define EGL_ANDROID_blob_cache 1 -typedef void ( * PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +typedef void ( * PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #define eglSetBlobCacheFuncsANDROID EGLEW_GET_FUN(__eglewSetBlobCacheFuncsANDROID) @@ -499,7 +513,7 @@ typedef void ( * PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBl #define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004 #define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 -typedef EGLClientBuffer ( * PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint * attrib_list); +typedef EGLClientBuffer ( * PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint* attrib_list); #define eglCreateNativeClientBufferANDROID EGLEW_GET_FUN(__eglewCreateNativeClientBufferANDROID) @@ -529,6 +543,54 @@ typedef EGLClientBuffer ( * PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const E #endif /* EGL_ANDROID_front_buffer_auto_refresh */ +/* -------------------- EGL_ANDROID_get_frame_timestamps ------------------- */ + +#ifndef EGL_ANDROID_get_frame_timestamps +#define EGL_ANDROID_get_frame_timestamps 1 + +#define EGL_TIMESTAMPS_ANDROID 0x3430 +#define EGL_COMPOSITE_DEADLINE_ANDROID 0x3431 +#define EGL_COMPOSITE_INTERVAL_ANDROID 0x3432 +#define EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID 0x3433 +#define EGL_REQUESTED_PRESENT_TIME_ANDROID 0x3434 +#define EGL_RENDERING_COMPLETE_TIME_ANDROID 0x3435 +#define EGL_COMPOSITION_LATCH_TIME_ANDROID 0x3436 +#define EGL_FIRST_COMPOSITION_START_TIME_ANDROID 0x3437 +#define EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3438 +#define EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3439 +#define EGL_DISPLAY_PRESENT_TIME_ANDROID 0x343A +#define EGL_DEQUEUE_READY_TIME_ANDROID 0x343B +#define EGL_READS_DONE_TIME_ANDROID 0x343C + +typedef EGLBoolean ( * PFNEGLGETCOMPOSITORTIMINGANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint* names, EGLnsecsANDROID* values); +typedef EGLBoolean ( * PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint name); +typedef EGLBoolean ( * PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint timestamp); +typedef EGLBoolean ( * PFNEGLGETFRAMETIMESTAMPSANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint* timestamps, EGLnsecsANDROID* values); +typedef EGLBoolean ( * PFNEGLGETNEXTFRAMEIDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId); + +#define eglGetCompositorTimingANDROID EGLEW_GET_FUN(__eglewGetCompositorTimingANDROID) +#define eglGetCompositorTimingSupportedANDROID EGLEW_GET_FUN(__eglewGetCompositorTimingSupportedANDROID) +#define eglGetFrameTimestampSupportedANDROID EGLEW_GET_FUN(__eglewGetFrameTimestampSupportedANDROID) +#define eglGetFrameTimestampsANDROID EGLEW_GET_FUN(__eglewGetFrameTimestampsANDROID) +#define eglGetNextFrameIdANDROID EGLEW_GET_FUN(__eglewGetNextFrameIdANDROID) + +#define EGLEW_ANDROID_get_frame_timestamps EGLEW_GET_VAR(__EGLEW_ANDROID_get_frame_timestamps) + +#endif /* EGL_ANDROID_get_frame_timestamps */ + +/* ------------------ EGL_ANDROID_get_native_client_buffer ----------------- */ + +#ifndef EGL_ANDROID_get_native_client_buffer +#define EGL_ANDROID_get_native_client_buffer 1 + +typedef EGLClientBuffer ( * PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC) (const struct AHardwareBuffer* buffer); + +#define eglGetNativeClientBufferANDROID EGLEW_GET_FUN(__eglewGetNativeClientBufferANDROID) + +#define EGLEW_ANDROID_get_native_client_buffer EGLEW_GET_VAR(__EGLEW_ANDROID_get_native_client_buffer) + +#endif /* EGL_ANDROID_get_native_client_buffer */ + /* -------------------- EGL_ANDROID_image_native_buffer -------------------- */ #ifndef EGL_ANDROID_image_native_buffer @@ -549,7 +611,7 @@ typedef EGLClientBuffer ( * PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const E #define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 #define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 -typedef EGLint ( * PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint ( * PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); #define eglDupNativeFenceFDANDROID EGLEW_GET_FUN(__eglewDupNativeFenceFDANDROID) @@ -562,7 +624,7 @@ typedef EGLint ( * PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSync #ifndef EGL_ANDROID_presentation_time #define EGL_ANDROID_presentation_time 1 -typedef EGLBoolean ( * PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +typedef EGLBoolean ( * PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); #define eglPresentationTimeANDROID EGLEW_GET_FUN(__eglewPresentationTimeANDROID) @@ -609,7 +671,7 @@ typedef EGLBoolean ( * PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGL #ifndef EGL_ANGLE_query_surface_pointer #define EGL_ANGLE_query_surface_pointer 1 -typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void ** value); +typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void** value); #define eglQuerySurfacePointerANGLE EGLEW_GET_FUN(__eglewQuerySurfacePointerANGLE) @@ -639,6 +701,18 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EG #endif /* EGL_ANGLE_window_fixed_size */ +/* -------------------------- EGL_ARM_image_format ------------------------- */ + +#ifndef EGL_ARM_image_format +#define EGL_ARM_image_format 1 + +#define EGL_COLOR_COMPONENT_TYPE_UNSIGNED_INTEGER_ARM 0x3287 +#define EGL_COLOR_COMPONENT_TYPE_INTEGER_ARM 0x3288 + +#define EGLEW_ARM_image_format EGLEW_GET_VAR(__EGLEW_ARM_image_format) + +#endif /* EGL_ARM_image_format */ + /* --------------------- EGL_ARM_implicit_external_sync -------------------- */ #ifndef EGL_ARM_implicit_external_sync @@ -661,6 +735,17 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EG #endif /* EGL_ARM_pixmap_multisample_discard */ +/* ------------------------- EGL_EXT_bind_to_front ------------------------- */ + +#ifndef EGL_EXT_bind_to_front +#define EGL_EXT_bind_to_front 1 + +#define EGL_FRONT_BUFFER_EXT 0x3464 + +#define EGLEW_EXT_bind_to_front EGLEW_GET_VAR(__EGLEW_EXT_bind_to_front) + +#endif /* EGL_EXT_bind_to_front */ + /* --------------------------- EGL_EXT_buffer_age -------------------------- */ #ifndef EGL_EXT_buffer_age @@ -681,6 +766,52 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EG #endif /* EGL_EXT_client_extensions */ +/* -------------------------- EGL_EXT_client_sync -------------------------- */ + +#ifndef EGL_EXT_client_sync +#define EGL_EXT_client_sync 1 + +#define EGL_SYNC_CLIENT_EXT 0x3364 +#define EGL_SYNC_CLIENT_SIGNAL_EXT 0x3365 + +typedef EGLBoolean ( * PFNEGLCLIENTSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib* attrib_list); + +#define eglClientSignalSyncEXT EGLEW_GET_FUN(__eglewClientSignalSyncEXT) + +#define EGLEW_EXT_client_sync EGLEW_GET_VAR(__EGLEW_EXT_client_sync) + +#endif /* EGL_EXT_client_sync */ + +/* --------------------------- EGL_EXT_compositor -------------------------- */ + +#ifndef EGL_EXT_compositor +#define EGL_EXT_compositor 1 + +#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460 +#define EGL_EXTERNAL_REF_ID_EXT 0x3461 +#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462 +#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463 + +typedef EGLBoolean ( * PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint* context_attributes, EGLint num_entries); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint* external_ref_ids, EGLint num_entries); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint* window_attributes, EGLint num_entries); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint* external_win_ids, EGLint num_entries); +typedef EGLBoolean ( * PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy); + +#define eglCompositorBindTexWindowEXT EGLEW_GET_FUN(__eglewCompositorBindTexWindowEXT) +#define eglCompositorSetContextAttributesEXT EGLEW_GET_FUN(__eglewCompositorSetContextAttributesEXT) +#define eglCompositorSetContextListEXT EGLEW_GET_FUN(__eglewCompositorSetContextListEXT) +#define eglCompositorSetSizeEXT EGLEW_GET_FUN(__eglewCompositorSetSizeEXT) +#define eglCompositorSetWindowAttributesEXT EGLEW_GET_FUN(__eglewCompositorSetWindowAttributesEXT) +#define eglCompositorSetWindowListEXT EGLEW_GET_FUN(__eglewCompositorSetWindowListEXT) +#define eglCompositorSwapPolicyEXT EGLEW_GET_FUN(__eglewCompositorSwapPolicyEXT) + +#define EGLEW_EXT_compositor EGLEW_GET_VAR(__EGLEW_EXT_compositor) + +#endif /* EGL_EXT_compositor */ + /* ------------------- EGL_EXT_create_context_robustness ------------------- */ #ifndef EGL_EXT_create_context_robustness @@ -713,6 +844,7 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EG #define EGL_EXT_device_drm 1 #define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#define EGL_DRM_MASTER_FD_EXT 0x333C #define EGLEW_EXT_device_drm EGLEW_GET_VAR(__EGLEW_EXT_device_drm) @@ -723,7 +855,7 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EG #ifndef EGL_EXT_device_enumeration #define EGL_EXT_device_enumeration 1 -typedef EGLBoolean ( * PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT * devices, EGLint * num_devices); +typedef EGLBoolean ( * PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT* devices, EGLint* num_devices); #define eglQueryDevicesEXT EGLEW_GET_FUN(__eglewQueryDevicesEXT) @@ -750,9 +882,9 @@ typedef EGLBoolean ( * PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDevi #define EGL_BAD_DEVICE_EXT 0x322B #define EGL_DEVICE_EXT 0x322C -typedef EGLBoolean ( * PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib * value); -typedef const char * ( * PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); -typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib * value); +typedef EGLBoolean ( * PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib* value); +typedef const char* ( * PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib* value); #define eglQueryDeviceAttribEXT EGLEW_GET_FUN(__eglewQueryDeviceAttribEXT) #define eglQueryDeviceStringEXT EGLEW_GET_FUN(__eglewQueryDeviceStringEXT) @@ -784,6 +916,50 @@ typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLin #endif /* EGL_EXT_gl_colorspace_bt2020_pq */ +/* -------------------- EGL_EXT_gl_colorspace_display_p3 ------------------- */ + +#ifndef EGL_EXT_gl_colorspace_display_p3 +#define EGL_EXT_gl_colorspace_display_p3 1 + +#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363 + +#define EGLEW_EXT_gl_colorspace_display_p3 EGLEW_GET_VAR(__EGLEW_EXT_gl_colorspace_display_p3) + +#endif /* EGL_EXT_gl_colorspace_display_p3 */ + +/* ---------------- EGL_EXT_gl_colorspace_display_p3_linear ---------------- */ + +#ifndef EGL_EXT_gl_colorspace_display_p3_linear +#define EGL_EXT_gl_colorspace_display_p3_linear 1 + +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 + +#define EGLEW_EXT_gl_colorspace_display_p3_linear EGLEW_GET_VAR(__EGLEW_EXT_gl_colorspace_display_p3_linear) + +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ + +/* -------------- EGL_EXT_gl_colorspace_display_p3_passthrough ------------- */ + +#ifndef EGL_EXT_gl_colorspace_display_p3_passthrough +#define EGL_EXT_gl_colorspace_display_p3_passthrough 1 + +#define EGL_GL_COLORSPACE_DISPLAY_P3_PASSTHROUGH_EXT 0x3490 + +#define EGLEW_EXT_gl_colorspace_display_p3_passthrough EGLEW_GET_VAR(__EGLEW_EXT_gl_colorspace_display_p3_passthrough) + +#endif /* EGL_EXT_gl_colorspace_display_p3_passthrough */ + +/* ---------------------- EGL_EXT_gl_colorspace_scrgb ---------------------- */ + +#ifndef EGL_EXT_gl_colorspace_scrgb +#define EGL_EXT_gl_colorspace_scrgb 1 + +#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351 + +#define EGLEW_EXT_gl_colorspace_scrgb EGLEW_GET_VAR(__EGLEW_EXT_gl_colorspace_scrgb) + +#endif /* EGL_EXT_gl_colorspace_scrgb */ + /* ------------------- EGL_EXT_gl_colorspace_scrgb_linear ------------------ */ #ifndef EGL_EXT_gl_colorspace_scrgb_linear @@ -844,8 +1020,8 @@ typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLin #define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 #define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A -typedef EGLBoolean ( * PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); -typedef EGLBoolean ( * PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +typedef EGLBoolean ( * PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint* formats, EGLint* num_formats); +typedef EGLBoolean ( * PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR* modifiers, EGLBoolean* external_only, EGLint* num_modifiers); #define eglQueryDmaBufFormatsEXT EGLEW_GET_FUN(__eglewQueryDmaBufFormatsEXT) #define eglQueryDmaBufModifiersEXT EGLEW_GET_FUN(__eglewQueryDmaBufModifiersEXT) @@ -854,6 +1030,31 @@ typedef EGLBoolean ( * PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGL #endif /* EGL_EXT_image_dma_buf_import_modifiers */ +/* ---------------------- EGL_EXT_image_gl_colorspace ---------------------- */ + +#ifndef EGL_EXT_image_gl_colorspace +#define EGL_EXT_image_gl_colorspace 1 + +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_DEFAULT_EXT 0x314D + +#define EGLEW_EXT_image_gl_colorspace EGLEW_GET_VAR(__EGLEW_EXT_image_gl_colorspace) + +#endif /* EGL_EXT_image_gl_colorspace */ + +/* ------------------ EGL_EXT_image_implicit_sync_control ------------------ */ + +#ifndef EGL_EXT_image_implicit_sync_control +#define EGL_EXT_image_implicit_sync_control 1 + +#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470 +#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471 +#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472 + +#define EGLEW_EXT_image_implicit_sync_control EGLEW_GET_VAR(__EGLEW_EXT_image_implicit_sync_control) + +#endif /* EGL_EXT_image_implicit_sync_control */ + /* ------------------------ EGL_EXT_multiview_window ----------------------- */ #ifndef EGL_EXT_multiview_window @@ -874,14 +1075,14 @@ typedef EGLBoolean ( * PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGL #define EGL_BAD_OUTPUT_PORT_EXT 0x322E #define EGL_SWAP_INTERVAL_EXT 0x322F -typedef EGLBoolean ( * PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib * attrib_list, EGLOutputLayerEXT * layers, EGLint max_layers, EGLint * num_layers); -typedef EGLBoolean ( * PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib * attrib_list, EGLOutputPortEXT * ports, EGLint max_ports, EGLint * num_ports); -typedef EGLBoolean ( * PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); -typedef EGLBoolean ( * PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); -typedef EGLBoolean ( * PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib * value); -typedef const char * ( * PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); -typedef EGLBoolean ( * PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib * value); -typedef const char * ( * PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +typedef EGLBoolean ( * PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib* attrib_list, EGLOutputLayerEXT* layers, EGLint max_layers, EGLint* num_layers); +typedef EGLBoolean ( * PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib* attrib_list, EGLOutputPortEXT* ports, EGLint max_ports, EGLint* num_ports); +typedef EGLBoolean ( * PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean ( * PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +typedef EGLBoolean ( * PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib* value); +typedef const char* ( * PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean ( * PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib* value); +typedef const char* ( * PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); #define eglGetOutputLayersEXT EGLEW_GET_FUN(__eglewGetOutputLayersEXT) #define eglGetOutputPortsEXT EGLEW_GET_FUN(__eglewGetOutputPortsEXT) @@ -939,9 +1140,9 @@ typedef const char * ( * PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, E #ifndef EGL_EXT_platform_base #define EGL_EXT_platform_base 1 -typedef EGLSurface ( * PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLint * attrib_list); -typedef EGLSurface ( * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void * native_window, const EGLint * attrib_list); -typedef EGLDisplay ( * PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void * native_display, const EGLint * attrib_list); +typedef EGLSurface ( * PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void* native_pixmap, const EGLint* attrib_list); +typedef EGLSurface ( * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void* native_window, const EGLint* attrib_list); +typedef EGLDisplay ( * PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void* native_display, const EGLint* attrib_list); #define eglCreatePlatformPixmapSurfaceEXT EGLEW_GET_FUN(__eglewCreatePlatformPixmapSurfaceEXT) #define eglCreatePlatformWindowSurfaceEXT EGLEW_GET_FUN(__eglewCreatePlatformWindowSurfaceEXT) @@ -1012,7 +1213,7 @@ typedef EGLDisplay ( * PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, voi #ifndef EGL_EXT_stream_consumer_egloutput #define EGL_EXT_stream_consumer_egloutput 1 -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); #define eglStreamConsumerOutputEXT EGLEW_GET_FUN(__eglewStreamConsumerOutputEXT) @@ -1020,6 +1221,18 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGL #endif /* EGL_EXT_stream_consumer_egloutput */ +/* ------------------- EGL_EXT_surface_CTA861_3_metadata ------------------- */ + +#ifndef EGL_EXT_surface_CTA861_3_metadata +#define EGL_EXT_surface_CTA861_3_metadata 1 + +#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360 +#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361 + +#define EGLEW_EXT_surface_CTA861_3_metadata EGLEW_GET_VAR(__EGLEW_EXT_surface_CTA861_3_metadata) + +#endif /* EGL_EXT_surface_CTA861_3_metadata */ + /* ------------------- EGL_EXT_surface_SMPTE2086_metadata ------------------ */ #ifndef EGL_EXT_surface_SMPTE2086_metadata @@ -1035,6 +1248,7 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGL #define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348 #define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349 #define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A +#define EGL_METADATA_SCALING_EXT 50000 #define EGLEW_EXT_surface_SMPTE2086_metadata EGLEW_GET_VAR(__EGLEW_EXT_surface_SMPTE2086_metadata) @@ -1045,7 +1259,7 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGL #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 -typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint * rects, EGLint n_rects); +typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint* rects, EGLint n_rects); #define eglSwapBuffersWithDamageEXT EGLEW_GET_FUN(__eglewSwapBuffersWithDamageEXT) @@ -1053,6 +1267,19 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EG #endif /* EGL_EXT_swap_buffers_with_damage */ +/* --------------------------- EGL_EXT_sync_reuse -------------------------- */ + +#ifndef EGL_EXT_sync_reuse +#define EGL_EXT_sync_reuse 1 + +typedef EGLBoolean ( * PFNEGLUNSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib* attrib_list); + +#define eglUnsignalSyncEXT EGLEW_GET_FUN(__eglewUnsignalSyncEXT) + +#define EGLEW_EXT_sync_reuse EGLEW_GET_VAR(__EGLEW_EXT_sync_reuse) + +#endif /* EGL_EXT_sync_reuse */ + /* -------------------------- EGL_EXT_yuv_surface -------------------------- */ #ifndef EGL_EXT_yuv_surface @@ -1095,7 +1322,7 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EG #define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 -typedef EGLSurface ( * PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI * pixmap); +typedef EGLSurface ( * PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); #define eglCreatePixmapSurfaceHI EGLEW_GET_FUN(__eglewCreatePixmapSurfaceHI) @@ -1165,7 +1392,7 @@ typedef EGLSurface ( * PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLCo #define EGL_SYNC_CL_EVENT_KHR 0x30FE #define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF -typedef EGLSyncKHR ( * PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR * attrib_list); +typedef EGLSyncKHR ( * PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR* attrib_list); #define eglCreateSync64KHR EGLEW_GET_FUN(__eglewCreateSync64KHR) @@ -1261,9 +1488,9 @@ typedef EGLSyncKHR ( * PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum ty #define EGL_DEBUG_MSG_WARN_KHR 0x33BB #define EGL_DEBUG_MSG_INFO_KHR 0x33BC -typedef EGLint ( * PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib * attrib_list); -typedef EGLint ( * PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); -typedef EGLBoolean ( * PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib * value); +typedef EGLint ( * PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib* attrib_list); +typedef EGLint ( * PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +typedef EGLBoolean ( * PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib* value); #define eglDebugMessageControlKHR EGLEW_GET_FUN(__eglewDebugMessageControlKHR) #define eglLabelObjectKHR EGLEW_GET_FUN(__eglewLabelObjectKHR) @@ -1273,6 +1500,21 @@ typedef EGLBoolean ( * PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib * #endif /* EGL_KHR_debug */ +/* ----------------------- EGL_KHR_display_reference ----------------------- */ + +#ifndef EGL_KHR_display_reference +#define EGL_KHR_display_reference 1 + +#define EGL_TRACK_REFERENCES_KHR 0x3352 + +typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib* value); + +#define eglQueryDisplayAttribKHR EGLEW_GET_FUN(__eglewQueryDisplayAttribKHR) + +#define EGLEW_KHR_display_reference EGLEW_GET_VAR(__EGLEW_KHR_display_reference) + +#endif /* EGL_KHR_display_reference */ + /* --------------------------- EGL_KHR_fence_sync -------------------------- */ #ifndef EGL_KHR_fence_sync @@ -1366,8 +1608,8 @@ typedef EGLBoolean ( * PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib * #define EGL_NATIVE_PIXMAP_KHR 0x30B0 -typedef EGLImageKHR ( * PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +typedef EGLImageKHR ( * PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); #define eglCreateImageKHR EGLEW_GET_FUN(__eglewCreateImageKHR) #define eglDestroyImageKHR EGLEW_GET_FUN(__eglewDestroyImageKHR) @@ -1425,8 +1667,8 @@ typedef EGLBoolean ( * PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR #define EGL_LOWER_LEFT_KHR 0x30CE #define EGL_UPPER_LEFT_KHR 0x30CF -typedef EGLBoolean ( * PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); +typedef EGLBoolean ( * PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); #define eglLockSurfaceKHR EGLEW_GET_FUN(__eglewLockSurfaceKHR) #define eglUnlockSurfaceKHR EGLEW_GET_FUN(__eglewUnlockSurfaceKHR) @@ -1509,7 +1751,7 @@ typedef EGLBoolean ( * PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurfac #define EGL_BUFFER_AGE_KHR 0x313D -typedef EGLBoolean ( * PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint * rects, EGLint n_rects); +typedef EGLBoolean ( * PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint* rects, EGLint n_rects); #define eglSetDamageRegionKHR EGLEW_GET_FUN(__eglewSetDamageRegionKHR) @@ -1577,11 +1819,11 @@ typedef EGLBoolean ( * PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurfa #define EGL_SYNC_REUSABLE_KHR 0x30FA #define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFF -typedef EGLint ( * PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -typedef EGLSyncKHR ( * PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); -typedef EGLBoolean ( * PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint * value); -typedef EGLBoolean ( * PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +typedef EGLint ( * PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLSyncKHR ( * PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLBoolean ( * PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint* value); +typedef EGLBoolean ( * PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); #define eglClientWaitSyncKHR EGLEW_GET_FUN(__eglewClientWaitSyncKHR) #define eglCreateSyncKHR EGLEW_GET_FUN(__eglewCreateSyncKHR) @@ -1611,11 +1853,11 @@ typedef EGLBoolean ( * PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR s #define EGL_BAD_STREAM_KHR 0x321B #define EGL_BAD_STATE_KHR 0x321C -typedef EGLStreamKHR ( * PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean ( * PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint * value); -typedef EGLBoolean ( * PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR * value); -typedef EGLBoolean ( * PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLStreamKHR ( * PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean ( * PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint* value); +typedef EGLBoolean ( * PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR* value); +typedef EGLBoolean ( * PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); #define eglCreateStreamKHR EGLEW_GET_FUN(__eglewCreateStreamKHR) #define eglDestroyStreamKHR EGLEW_GET_FUN(__eglewDestroyStreamKHR) @@ -1637,11 +1879,11 @@ typedef EGLBoolean ( * PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKH #define EGL_STREAM_STATE_CREATED_KHR 0x3215 #define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 -typedef EGLStreamKHR ( * PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib * attrib_list); -typedef EGLBoolean ( * PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib * value); -typedef EGLBoolean ( * PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib * attrib_list); -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib * attrib_list); +typedef EGLStreamKHR ( * PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib* attrib_list); +typedef EGLBoolean ( * PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib* value); +typedef EGLBoolean ( * PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib* attrib_list); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib* attrib_list); #define eglCreateStreamAttribKHR EGLEW_GET_FUN(__eglewCreateStreamAttribKHR) #define eglQueryStreamAttribKHR EGLEW_GET_FUN(__eglewQueryStreamAttribKHR) @@ -1660,9 +1902,9 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay d #define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); #define eglStreamConsumerAcquireKHR EGLEW_GET_FUN(__eglewStreamConsumerAcquireKHR) #define eglStreamConsumerGLTextureExternalKHR EGLEW_GET_FUN(__eglewStreamConsumerGLTextureExternalKHR) @@ -1677,8 +1919,8 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EG #ifndef EGL_KHR_stream_cross_process_fd #define EGL_KHR_stream_cross_process_fd 1 -typedef EGLStreamKHR ( * PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); -typedef EGLNativeFileDescriptorKHR ( * PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR ( * PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +typedef EGLNativeFileDescriptorKHR ( * PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); #define eglCreateStreamFromFileDescriptorKHR EGLEW_GET_FUN(__eglewCreateStreamFromFileDescriptorKHR) #define eglGetStreamFileDescriptorKHR EGLEW_GET_FUN(__eglewGetStreamFileDescriptorKHR) @@ -1697,7 +1939,7 @@ typedef EGLNativeFileDescriptorKHR ( * PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (E #define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE #define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF -typedef EGLBoolean ( * PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR * value); +typedef EGLBoolean ( * PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR* value); #define eglQueryStreamTimeKHR EGLEW_GET_FUN(__eglewQueryStreamTimeKHR) @@ -1721,7 +1963,7 @@ typedef EGLBoolean ( * PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStrea #define EGL_STREAM_BIT_KHR 0x0800 -typedef EGLSurface ( * PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint * attrib_list); +typedef EGLSurface ( * PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint* attrib_list); #define eglCreateStreamProducerSurfaceKHR EGLEW_GET_FUN(__eglewCreateStreamProducerSurfaceKHR) @@ -1743,7 +1985,7 @@ typedef EGLSurface ( * PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay d #ifndef EGL_KHR_swap_buffers_with_damage #define EGL_KHR_swap_buffers_with_damage 1 -typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint * rects, EGLint n_rects); +typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint* rects, EGLint n_rects); #define eglSwapBuffersWithDamageKHR EGLEW_GET_FUN(__eglewSwapBuffersWithDamageKHR) @@ -1767,7 +2009,7 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EG #ifndef EGL_KHR_wait_sync #define EGL_KHR_wait_sync 1 -typedef EGLint ( * PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +typedef EGLint ( * PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #define eglWaitSyncKHR EGLEW_GET_FUN(__eglewWaitSyncKHR) @@ -1782,14 +2024,15 @@ typedef EGLint ( * PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, E #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 #define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x00000004 #define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 #define EGL_DRM_BUFFER_USE_MESA 0x31D1 #define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 #define EGL_DRM_BUFFER_MESA 0x31D3 #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 -typedef EGLImageKHR ( * PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint * name, EGLint * handle, EGLint * stride); +typedef EGLImageKHR ( * PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint* name, EGLint* handle, EGLint* stride); #define eglCreateDRMImageMESA EGLEW_GET_FUN(__eglewCreateDRMImageMESA) #define eglExportDRMImageMESA EGLEW_GET_FUN(__eglewExportDRMImageMESA) @@ -1803,8 +2046,8 @@ typedef EGLBoolean ( * PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImage #ifndef EGL_MESA_image_dma_buf_export #define EGL_MESA_image_dma_buf_export 1 -typedef EGLBoolean ( * PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int * fds, EGLint * strides, EGLint * offsets); -typedef EGLBoolean ( * PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int * fourcc, int * num_planes, EGLuint64KHR * modifiers); +typedef EGLBoolean ( * PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int* fds, EGLint* strides, EGLint* offsets); +typedef EGLBoolean ( * PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int* fourcc, int* num_planes, EGLuint64KHR* modifiers); #define eglExportDMABUFImageMESA EGLEW_GET_FUN(__eglewExportDMABUFImageMESA) #define eglExportDMABUFImageQueryMESA EGLEW_GET_FUN(__eglewExportDMABUFImageQueryMESA) @@ -1835,12 +2078,27 @@ typedef EGLBoolean ( * PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, #endif /* EGL_MESA_platform_surfaceless */ +/* ------------------------- EGL_MESA_query_driver ------------------------- */ + +#ifndef EGL_MESA_query_driver +#define EGL_MESA_query_driver 1 + +typedef char* ( * PFNEGLGETDISPLAYDRIVERCONFIGPROC) (EGLDisplay dpy); +typedef const char* ( * PFNEGLGETDISPLAYDRIVERNAMEPROC) (EGLDisplay dpy); + +#define eglGetDisplayDriverConfig EGLEW_GET_FUN(__eglewGetDisplayDriverConfig) +#define eglGetDisplayDriverName EGLEW_GET_FUN(__eglewGetDisplayDriverName) + +#define EGLEW_MESA_query_driver EGLEW_GET_VAR(__EGLEW_MESA_query_driver) + +#endif /* EGL_MESA_query_driver */ + /* -------------------------- EGL_NOK_swap_region -------------------------- */ #ifndef EGL_NOK_swap_region #define EGL_NOK_swap_region 1 -typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint * rects); +typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects); #define eglSwapBuffersRegionNOK EGLEW_GET_FUN(__eglewSwapBuffersRegionNOK) @@ -1853,7 +2111,7 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSur #ifndef EGL_NOK_swap_region2 #define EGL_NOK_swap_region2 1 -typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint * rects); +typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects); #define eglSwapBuffersRegion2NOK EGLEW_GET_FUN(__eglewSwapBuffersRegion2NOK) @@ -1883,6 +2141,17 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSu #endif /* EGL_NV_3dvision_surface */ +/* -------------------- EGL_NV_context_priority_realtime ------------------- */ + +#ifndef EGL_NV_context_priority_realtime +#define EGL_NV_context_priority_realtime 1 + +#define EGL_CONTEXT_PRIORITY_REALTIME_NV 0x3357 + +#define EGLEW_NV_context_priority_realtime EGLEW_GET_VAR(__EGLEW_NV_context_priority_realtime) + +#endif /* EGL_NV_context_priority_realtime */ + /* ------------------------- EGL_NV_coverage_sample ------------------------ */ #ifndef EGL_NV_coverage_sample @@ -1950,9 +2219,9 @@ typedef EGLBoolean ( * PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSu #ifndef EGL_NV_native_query #define EGL_NV_native_query 1 -typedef EGLBoolean ( * PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType * display_id); -typedef EGLBoolean ( * PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType * pixmap); -typedef EGLBoolean ( * PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType * window); +typedef EGLBoolean ( * PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType* display_id); +typedef EGLBoolean ( * PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap); +typedef EGLBoolean ( * PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window); #define eglQueryNativeDisplayNV EGLEW_GET_FUN(__eglewQueryNativeDisplayNV) #define eglQueryNativePixmapNV EGLEW_GET_FUN(__eglewQueryNativePixmapNV) @@ -1978,7 +2247,7 @@ typedef EGLBoolean ( * PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurf #define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE -typedef EGLBoolean ( * PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +typedef EGLBoolean ( * PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #define eglPostSubBufferNV EGLEW_GET_FUN(__eglewPostSubBufferNV) @@ -1986,6 +2255,17 @@ typedef EGLBoolean ( * PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface #endif /* EGL_NV_post_sub_buffer */ +/* ------------------------ EGL_NV_quadruple_buffer ------------------------ */ + +#ifndef EGL_NV_quadruple_buffer +#define EGL_NV_quadruple_buffer 1 + +#define EGL_QUADRUPLE_BUFFER_NV 0x3231 + +#define EGLEW_NV_quadruple_buffer EGLEW_GET_VAR(__EGLEW_NV_quadruple_buffer) + +#endif /* EGL_NV_quadruple_buffer */ + /* ------------------ EGL_NV_robustness_video_memory_purge ----------------- */ #ifndef EGL_NV_robustness_video_memory_purge @@ -2008,7 +2288,7 @@ typedef EGLBoolean ( * PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface #define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D #define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E -typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib* attrib_list); #define eglStreamConsumerGLTextureExternalAttribsNV EGLEW_GET_FUN(__eglewStreamConsumerGLTextureExternalAttribsNV) @@ -2071,6 +2351,18 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGL #endif /* EGL_NV_stream_cross_system */ +/* --------------------------- EGL_NV_stream_dma --------------------------- */ + +#ifndef EGL_NV_stream_dma +#define EGL_NV_stream_dma 1 + +#define EGL_STREAM_DMA_NV 0x3371 +#define EGL_STREAM_DMA_SERVER_NV 0x3372 + +#define EGLEW_NV_stream_dma EGLEW_GET_VAR(__EGLEW_NV_stream_dma) + +#endif /* EGL_NV_stream_dma */ + /* ------------------------ EGL_NV_stream_fifo_next ------------------------ */ #ifndef EGL_NV_stream_fifo_next @@ -2094,6 +2386,19 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGL #endif /* EGL_NV_stream_fifo_synchronous */ +/* -------------------------- EGL_NV_stream_flush -------------------------- */ + +#ifndef EGL_NV_stream_flush +#define EGL_NV_stream_flush 1 + +typedef EGLBoolean ( * PFNEGLSTREAMFLUSHNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); + +#define eglStreamFlushNV EGLEW_GET_FUN(__eglewStreamFlushNV) + +#define EGLEW_NV_stream_flush EGLEW_GET_VAR(__EGLEW_NV_stream_flush) + +#endif /* EGL_NV_stream_flush */ + /* ----------------------- EGL_NV_stream_frame_limits ---------------------- */ #ifndef EGL_NV_stream_frame_limits @@ -2126,9 +2431,9 @@ typedef EGLBoolean ( * PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGL #define EGL_METADATA3_TYPE_NV 0x325C #define EGL_PENDING_METADATA_NV 0x3328 -typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib * value); -typedef EGLBoolean ( * PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void * data); -typedef EGLBoolean ( * PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void * data); +typedef EGLBoolean ( * PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib* value); +typedef EGLBoolean ( * PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void* data); +typedef EGLBoolean ( * PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void* data); #define eglQueryDisplayAttribNV EGLEW_GET_FUN(__eglewQueryDisplayAttribNV) #define eglQueryStreamMetadataNV EGLEW_GET_FUN(__eglewQueryStreamMetadataNV) @@ -2138,6 +2443,27 @@ typedef EGLBoolean ( * PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStre #endif /* EGL_NV_stream_metadata */ +/* -------------------------- EGL_NV_stream_origin ------------------------- */ + +#ifndef EGL_NV_stream_origin +#define EGL_NV_stream_origin 1 + +#define EGL_STREAM_FRAME_ORIGIN_X_NV 0x3366 +#define EGL_STREAM_FRAME_ORIGIN_Y_NV 0x3367 +#define EGL_STREAM_FRAME_MAJOR_AXIS_NV 0x3368 +#define EGL_CONSUMER_AUTO_ORIENTATION_NV 0x3369 +#define EGL_PRODUCER_AUTO_ORIENTATION_NV 0x336A +#define EGL_LEFT_NV 0x336B +#define EGL_RIGHT_NV 0x336C +#define EGL_TOP_NV 0x336D +#define EGL_BOTTOM_NV 0x336E +#define EGL_X_AXIS_NV 0x336F +#define EGL_Y_AXIS_NV 0x3370 + +#define EGLEW_NV_stream_origin EGLEW_GET_VAR(__EGLEW_NV_stream_origin) + +#endif /* EGL_NV_stream_origin */ + /* -------------------------- EGL_NV_stream_remote ------------------------- */ #ifndef EGL_NV_stream_remote @@ -2164,7 +2490,7 @@ typedef EGLBoolean ( * PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStre #define EGL_SUPPORT_RESET_NV 0x3334 #define EGL_SUPPORT_REUSE_NV 0x3335 -typedef EGLBoolean ( * PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean ( * PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); #define eglResetStreamNV EGLEW_GET_FUN(__eglewResetStreamNV) @@ -2215,7 +2541,7 @@ typedef EGLBoolean ( * PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR #define EGL_SYNC_TYPE_KHR 0x30F7 #define EGL_SYNC_NEW_FRAME_NV 0x321F -typedef EGLSyncKHR ( * PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint * attrib_list); +typedef EGLSyncKHR ( * PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint* attrib_list); #define eglCreateStreamSyncNV EGLEW_GET_FUN(__eglewCreateStreamSyncNV) @@ -2241,12 +2567,12 @@ typedef EGLSyncKHR ( * PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStrea #define EGL_SYNC_FENCE_NV 0x30EF #define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFF -typedef EGLint ( * PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -typedef EGLSyncNV ( * PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint * attrib_list); -typedef EGLBoolean ( * PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); -typedef EGLBoolean ( * PFNEGLFENCENVPROC) (EGLSyncNV sync); -typedef EGLBoolean ( * PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint * value); -typedef EGLBoolean ( * PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLint ( * PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLSyncNV ( * PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint* attrib_list); +typedef EGLBoolean ( * PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean ( * PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLBoolean ( * PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint* value); +typedef EGLBoolean ( * PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); #define eglClientWaitSyncNV EGLEW_GET_FUN(__eglewClientWaitSyncNV) #define eglCreateFenceSyncNV EGLEW_GET_FUN(__eglewCreateFenceSyncNV) @@ -2264,8 +2590,8 @@ typedef EGLBoolean ( * PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode) #ifndef EGL_NV_system_time #define EGL_NV_system_time 1 -typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) ( void ); -typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMENVPROC) ( void ); +typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMENVPROC) (void); #define eglGetSystemTimeFrequencyNV EGLEW_GET_FUN(__eglewGetSystemTimeFrequencyNV) #define eglGetSystemTimeNV EGLEW_GET_FUN(__eglewGetSystemTimeNV) @@ -2274,6 +2600,17 @@ typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMENVPROC) ( void ); #endif /* EGL_NV_system_time */ +/* -------------------------- EGL_NV_triple_buffer ------------------------- */ + +#ifndef EGL_NV_triple_buffer +#define EGL_NV_triple_buffer 1 + +#define EGL_TRIPLE_BUFFER_NV 0x3230 + +#define EGLEW_NV_triple_buffer EGLEW_GET_VAR(__EGLEW_NV_triple_buffer) + +#endif /* EGL_NV_triple_buffer */ + /* --------------------- EGL_TIZEN_image_native_buffer --------------------- */ #ifndef EGL_TIZEN_image_native_buffer @@ -2296,6 +2633,44 @@ typedef EGLuint64NV ( * PFNEGLGETSYSTEMTIMENVPROC) ( void ); #endif /* EGL_TIZEN_image_native_surface */ +/* ---------------------- EGL_WL_bind_wayland_display ---------------------- */ + +#ifndef EGL_WL_bind_wayland_display +#define EGL_WL_bind_wayland_display 1 + +#define EGL_WAYLAND_BUFFER_WL 0x31D5 +#define EGL_WAYLAND_PLANE_WL 0x31D6 +#define EGL_TEXTURE_Y_U_V_WL 0x31D7 +#define EGL_TEXTURE_Y_UV_WL 0x31D8 +#define EGL_TEXTURE_Y_XUXV_WL 0x31D9 +#define EGL_TEXTURE_EXTERNAL_WL 0x31DA +#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB + +typedef EGLBoolean ( * PFNEGLBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display* display); +typedef EGLBoolean ( * PFNEGLQUERYWAYLANDBUFFERWLPROC) (EGLDisplay dpy, struct wl_resource* buffer, EGLint attribute, EGLint* value); +typedef EGLBoolean ( * PFNEGLUNBINDWAYLANDDISPLAYWLPROC) (EGLDisplay dpy, struct wl_display* display); + +#define eglBindWaylandDisplayWL EGLEW_GET_FUN(__eglewBindWaylandDisplayWL) +#define eglQueryWaylandBufferWL EGLEW_GET_FUN(__eglewQueryWaylandBufferWL) +#define eglUnbindWaylandDisplayWL EGLEW_GET_FUN(__eglewUnbindWaylandDisplayWL) + +#define EGLEW_WL_bind_wayland_display EGLEW_GET_VAR(__EGLEW_WL_bind_wayland_display) + +#endif /* EGL_WL_bind_wayland_display */ + +/* ---------------- EGL_WL_create_wayland_buffer_from_image ---------------- */ + +#ifndef EGL_WL_create_wayland_buffer_from_image +#define EGL_WL_create_wayland_buffer_from_image 1 + +typedef struct wl_buffer* ( * PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC) (EGLDisplay dpy, EGLImageKHR image); + +#define eglCreateWaylandBufferFromImageWL EGLEW_GET_FUN(__eglewCreateWaylandBufferFromImageWL) + +#define EGLEW_WL_create_wayland_buffer_from_image EGLEW_GET_VAR(__EGLEW_WL_create_wayland_buffer_from_image) + +#endif /* EGL_WL_create_wayland_buffer_from_image */ + /* ------------------------------------------------------------------------- */ #define EGLEW_FUN_EXPORT GLEW_FUN_EXPORT @@ -2353,12 +2728,30 @@ EGLEW_FUN_EXPORT PFNEGLSETBLOBCACHEFUNCSANDROIDPROC __eglewSetBlobCacheFuncsANDR EGLEW_FUN_EXPORT PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC __eglewCreateNativeClientBufferANDROID; +EGLEW_FUN_EXPORT PFNEGLGETCOMPOSITORTIMINGANDROIDPROC __eglewGetCompositorTimingANDROID; +EGLEW_FUN_EXPORT PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC __eglewGetCompositorTimingSupportedANDROID; +EGLEW_FUN_EXPORT PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC __eglewGetFrameTimestampSupportedANDROID; +EGLEW_FUN_EXPORT PFNEGLGETFRAMETIMESTAMPSANDROIDPROC __eglewGetFrameTimestampsANDROID; +EGLEW_FUN_EXPORT PFNEGLGETNEXTFRAMEIDANDROIDPROC __eglewGetNextFrameIdANDROID; + +EGLEW_FUN_EXPORT PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC __eglewGetNativeClientBufferANDROID; + EGLEW_FUN_EXPORT PFNEGLDUPNATIVEFENCEFDANDROIDPROC __eglewDupNativeFenceFDANDROID; EGLEW_FUN_EXPORT PFNEGLPRESENTATIONTIMEANDROIDPROC __eglewPresentationTimeANDROID; EGLEW_FUN_EXPORT PFNEGLQUERYSURFACEPOINTERANGLEPROC __eglewQuerySurfacePointerANGLE; +EGLEW_FUN_EXPORT PFNEGLCLIENTSIGNALSYNCEXTPROC __eglewClientSignalSyncEXT; + +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC __eglewCompositorBindTexWindowEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC __eglewCompositorSetContextAttributesEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC __eglewCompositorSetContextListEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSETSIZEEXTPROC __eglewCompositorSetSizeEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC __eglewCompositorSetWindowAttributesEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC __eglewCompositorSetWindowListEXT; +EGLEW_FUN_EXPORT PFNEGLCOMPOSITORSWAPPOLICYEXTPROC __eglewCompositorSwapPolicyEXT; + EGLEW_FUN_EXPORT PFNEGLQUERYDEVICESEXTPROC __eglewQueryDevicesEXT; EGLEW_FUN_EXPORT PFNEGLQUERYDEVICEATTRIBEXTPROC __eglewQueryDeviceAttribEXT; @@ -2385,6 +2778,8 @@ EGLEW_FUN_EXPORT PFNEGLSTREAMCONSUMEROUTPUTEXTPROC __eglewStreamConsumerOutputEX EGLEW_FUN_EXPORT PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC __eglewSwapBuffersWithDamageEXT; +EGLEW_FUN_EXPORT PFNEGLUNSIGNALSYNCEXTPROC __eglewUnsignalSyncEXT; + EGLEW_FUN_EXPORT PFNEGLCREATEPIXMAPSURFACEHIPROC __eglewCreatePixmapSurfaceHI; EGLEW_FUN_EXPORT PFNEGLCREATESYNC64KHRPROC __eglewCreateSync64KHR; @@ -2393,6 +2788,8 @@ EGLEW_FUN_EXPORT PFNEGLDEBUGMESSAGECONTROLKHRPROC __eglewDebugMessageControlKHR; EGLEW_FUN_EXPORT PFNEGLLABELOBJECTKHRPROC __eglewLabelObjectKHR; EGLEW_FUN_EXPORT PFNEGLQUERYDEBUGKHRPROC __eglewQueryDebugKHR; +EGLEW_FUN_EXPORT PFNEGLQUERYDISPLAYATTRIBKHRPROC __eglewQueryDisplayAttribKHR; + EGLEW_FUN_EXPORT PFNEGLCREATEIMAGEKHRPROC __eglewCreateImageKHR; EGLEW_FUN_EXPORT PFNEGLDESTROYIMAGEKHRPROC __eglewDestroyImageKHR; @@ -2442,6 +2839,9 @@ EGLEW_FUN_EXPORT PFNEGLEXPORTDRMIMAGEMESAPROC __eglewExportDRMImageMESA; EGLEW_FUN_EXPORT PFNEGLEXPORTDMABUFIMAGEMESAPROC __eglewExportDMABUFImageMESA; EGLEW_FUN_EXPORT PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC __eglewExportDMABUFImageQueryMESA; +EGLEW_FUN_EXPORT PFNEGLGETDISPLAYDRIVERCONFIGPROC __eglewGetDisplayDriverConfig; +EGLEW_FUN_EXPORT PFNEGLGETDISPLAYDRIVERNAMEPROC __eglewGetDisplayDriverName; + EGLEW_FUN_EXPORT PFNEGLSWAPBUFFERSREGIONNOKPROC __eglewSwapBuffersRegionNOK; EGLEW_FUN_EXPORT PFNEGLSWAPBUFFERSREGION2NOKPROC __eglewSwapBuffersRegion2NOK; @@ -2454,6 +2854,8 @@ EGLEW_FUN_EXPORT PFNEGLPOSTSUBBUFFERNVPROC __eglewPostSubBufferNV; EGLEW_FUN_EXPORT PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC __eglewStreamConsumerGLTextureExternalAttribsNV; +EGLEW_FUN_EXPORT PFNEGLSTREAMFLUSHNVPROC __eglewStreamFlushNV; + EGLEW_FUN_EXPORT PFNEGLQUERYDISPLAYATTRIBNVPROC __eglewQueryDisplayAttribNV; EGLEW_FUN_EXPORT PFNEGLQUERYSTREAMMETADATANVPROC __eglewQueryStreamMetadataNV; EGLEW_FUN_EXPORT PFNEGLSETSTREAMMETADATANVPROC __eglewSetStreamMetadataNV; @@ -2471,16 +2873,25 @@ EGLEW_FUN_EXPORT PFNEGLSIGNALSYNCNVPROC __eglewSignalSyncNV; EGLEW_FUN_EXPORT PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC __eglewGetSystemTimeFrequencyNV; EGLEW_FUN_EXPORT PFNEGLGETSYSTEMTIMENVPROC __eglewGetSystemTimeNV; + +EGLEW_FUN_EXPORT PFNEGLBINDWAYLANDDISPLAYWLPROC __eglewBindWaylandDisplayWL; +EGLEW_FUN_EXPORT PFNEGLQUERYWAYLANDBUFFERWLPROC __eglewQueryWaylandBufferWL; +EGLEW_FUN_EXPORT PFNEGLUNBINDWAYLANDDISPLAYWLPROC __eglewUnbindWaylandDisplayWL; + +EGLEW_FUN_EXPORT PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC __eglewCreateWaylandBufferFromImageWL; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_0; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_1; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_2; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_3; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_4; EGLEW_VAR_EXPORT GLboolean __EGLEW_VERSION_1_5; +EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_GLES_layers; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_blob_cache; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_create_native_client_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_framebuffer_target; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_front_buffer_auto_refresh; +EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_get_frame_timestamps; +EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_get_native_client_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_image_native_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_native_fence_sync; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANDROID_presentation_time; @@ -2490,10 +2901,14 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_ANGLE_device_d3d; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANGLE_query_surface_pointer; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANGLE_surface_d3d_texture_2d_share_handle; EGLEW_VAR_EXPORT GLboolean __EGLEW_ANGLE_window_fixed_size; +EGLEW_VAR_EXPORT GLboolean __EGLEW_ARM_image_format; EGLEW_VAR_EXPORT GLboolean __EGLEW_ARM_implicit_external_sync; EGLEW_VAR_EXPORT GLboolean __EGLEW_ARM_pixmap_multisample_discard; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_bind_to_front; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_buffer_age; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_client_extensions; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_client_sync; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_compositor; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_create_context_robustness; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_device_base; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_device_drm; @@ -2502,9 +2917,15 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_device_openwf; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_device_query; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_bt2020_linear; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_bt2020_pq; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_display_p3; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_display_p3_linear; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_display_p3_passthrough; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_scrgb; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_gl_colorspace_scrgb_linear; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_image_dma_buf_import; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_image_dma_buf_import_modifiers; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_image_gl_colorspace; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_image_implicit_sync_control; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_multiview_window; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_output_base; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_output_drm; @@ -2517,8 +2938,10 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_platform_x11; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_protected_content; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_protected_surface; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_stream_consumer_egloutput; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_surface_CTA861_3_metadata; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_surface_SMPTE2086_metadata; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_swap_buffers_with_damage; +EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_sync_reuse; EGLEW_VAR_EXPORT GLboolean __EGLEW_EXT_yuv_surface; EGLEW_VAR_EXPORT GLboolean __EGLEW_HI_clientpixmap; EGLEW_VAR_EXPORT GLboolean __EGLEW_HI_colorformats; @@ -2532,6 +2955,7 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_context_flush_control; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_create_context; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_create_context_no_error; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_debug; +EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_display_reference; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_fence_sync; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_get_all_proc_addresses; EGLEW_VAR_EXPORT GLboolean __EGLEW_KHR_gl_colorspace; @@ -2568,10 +2992,12 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_MESA_drm_image; EGLEW_VAR_EXPORT GLboolean __EGLEW_MESA_image_dma_buf_export; EGLEW_VAR_EXPORT GLboolean __EGLEW_MESA_platform_gbm; EGLEW_VAR_EXPORT GLboolean __EGLEW_MESA_platform_surfaceless; +EGLEW_VAR_EXPORT GLboolean __EGLEW_MESA_query_driver; EGLEW_VAR_EXPORT GLboolean __EGLEW_NOK_swap_region; EGLEW_VAR_EXPORT GLboolean __EGLEW_NOK_swap_region2; EGLEW_VAR_EXPORT GLboolean __EGLEW_NOK_texture_from_pixmap; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_3dvision_surface; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_context_priority_realtime; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_coverage_sample; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_coverage_sample_resolve; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_cuda_event; @@ -2580,6 +3006,7 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_device_cuda; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_native_query; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_post_convert_rounding; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_post_sub_buffer; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_quadruple_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_robustness_video_memory_purge; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_consumer_gltexture_yuv; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_cross_display; @@ -2587,10 +3014,13 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_cross_object; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_cross_partition; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_cross_process; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_cross_system; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_dma; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_fifo_next; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_fifo_synchronous; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_flush; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_frame_limits; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_metadata; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_origin; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_remote; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_reset; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_socket; @@ -2599,8 +3029,11 @@ EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_socket_unix; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_stream_sync; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_sync; EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_system_time; +EGLEW_VAR_EXPORT GLboolean __EGLEW_NV_triple_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_TIZEN_image_native_buffer; EGLEW_VAR_EXPORT GLboolean __EGLEW_TIZEN_image_native_surface; +EGLEW_VAR_EXPORT GLboolean __EGLEW_WL_bind_wayland_display; +EGLEW_VAR_EXPORT GLboolean __EGLEW_WL_create_wayland_buffer_from_image; /* ------------------------------------------------------------------------ */ GLEWAPI GLenum GLEWAPIENTRY eglewInit (EGLDisplay display); diff --git a/meta/win/include/GL/glew.h b/meta/win/include/GL/glew.h index b5b6987f..234591bb 100644 --- a/meta/win/include/GL/glew.h +++ b/meta/win/include/GL/glew.h @@ -1,6 +1,6 @@ /* ** The OpenGL Extension Wrangler Library -** Copyright (C) 2008-2017, Nigel Stewart +** Copyright (C) 2008-2019, Nigel Stewart ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev @@ -93,7 +93,7 @@ #if defined(__REGAL_H__) #error Regal.h included before glew.h #endif -#if defined(__glext_h_) || defined(__GLEXT_H_) +#if defined(__glext_h_) || defined(__GLEXT_H_) || defined(__gl_glext_h_) #error glext.h included before glew.h #endif #if defined(__gl_ATI_h_) @@ -109,6 +109,7 @@ #define __X_GL_H #define __glext_h_ #define __GLEXT_H_ +#define __gl_glext_h_ #define __gl_ATI_h_ #if defined(_WIN32) @@ -218,15 +219,26 @@ typedef _W64 int ptrdiff_t; * (mem, 2004-01-04) */ -#include +#if defined(__APPLE__) || defined(__linux__) +# if defined(__cplusplus) +# include +# include +# else +# include +# include +# endif +#else + +# include /* SGI MIPSPro doesn't like stdint.h in C++ mode */ /* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */ -#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__) -#include -#else -#include +# if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__) +# include +# else +# include +# endif #endif #define GLEW_APIENTRY_DEFINED @@ -310,6 +322,8 @@ typedef struct __GLsync *GLsync; typedef char GLchar; +typedef void *GLeglImageOES; /* GL_EXT_EGL_image_storage */ + #define GL_ZERO 0 #define GL_FALSE 0 #define GL_LOGIC_OP 0x0BF1 @@ -1845,7 +1859,7 @@ typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program); typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader); typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program); typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const* string, const GLint* length); -typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); @@ -2688,6 +2702,28 @@ typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GL #endif /* GL_AMD_draw_buffers_blend */ +/* ---------------- GL_AMD_framebuffer_multisample_advanced ---------------- */ + +#ifndef GL_AMD_framebuffer_multisample_advanced +#define GL_AMD_framebuffer_multisample_advanced 1 + +#define GL_RENDERBUFFER_STORAGE_SAMPLES_AMD 0x91B2 +#define GL_MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD 0x91B3 +#define GL_MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD 0x91B4 +#define GL_MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD 0x91B5 +#define GL_NUM_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B6 +#define GL_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B7 + +typedef void (GLAPIENTRY * PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLenum target, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glNamedRenderbufferStorageMultisampleAdvancedAMD GLEW_GET_FUN(__glewNamedRenderbufferStorageMultisampleAdvancedAMD) +#define glRenderbufferStorageMultisampleAdvancedAMD GLEW_GET_FUN(__glewRenderbufferStorageMultisampleAdvancedAMD) + +#define GLEW_AMD_framebuffer_multisample_advanced GLEW_GET_VAR(__GLEW_AMD_framebuffer_multisample_advanced) + +#endif /* GL_AMD_framebuffer_multisample_advanced */ + /* ------------------ GL_AMD_framebuffer_sample_positions ------------------ */ #ifndef GL_AMD_framebuffer_sample_positions @@ -2744,6 +2780,45 @@ typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLuin #endif /* GL_AMD_gpu_shader_half_float */ +/* ------------------- GL_AMD_gpu_shader_half_float_fetch ------------------ */ + +#ifndef GL_AMD_gpu_shader_half_float_fetch +#define GL_AMD_gpu_shader_half_float_fetch 1 + +#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE +#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF +#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0 +#define GL_FLOAT16_SAMPLER_CUBE_AMD 0x91D1 +#define GL_FLOAT16_SAMPLER_2D_RECT_AMD 0x91D2 +#define GL_FLOAT16_SAMPLER_1D_ARRAY_AMD 0x91D3 +#define GL_FLOAT16_SAMPLER_2D_ARRAY_AMD 0x91D4 +#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD 0x91D5 +#define GL_FLOAT16_SAMPLER_BUFFER_AMD 0x91D6 +#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD 0x91D7 +#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD 0x91D8 +#define GL_FLOAT16_SAMPLER_1D_SHADOW_AMD 0x91D9 +#define GL_FLOAT16_SAMPLER_2D_SHADOW_AMD 0x91DA +#define GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD 0x91DB +#define GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD 0x91DC +#define GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD 0x91DD +#define GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD 0x91DE +#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD 0x91DF +#define GL_FLOAT16_IMAGE_1D_AMD 0x91E0 +#define GL_FLOAT16_IMAGE_2D_AMD 0x91E1 +#define GL_FLOAT16_IMAGE_3D_AMD 0x91E2 +#define GL_FLOAT16_IMAGE_2D_RECT_AMD 0x91E3 +#define GL_FLOAT16_IMAGE_CUBE_AMD 0x91E4 +#define GL_FLOAT16_IMAGE_1D_ARRAY_AMD 0x91E5 +#define GL_FLOAT16_IMAGE_2D_ARRAY_AMD 0x91E6 +#define GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD 0x91E7 +#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8 +#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9 +#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA + +#define GLEW_AMD_gpu_shader_half_float_fetch GLEW_GET_VAR(__GLEW_AMD_gpu_shader_half_float_fetch) + +#endif /* GL_AMD_gpu_shader_half_float_fetch */ + /* ------------------------ GL_AMD_gpu_shader_int16 ------------------------ */ #ifndef GL_AMD_gpu_shader_int16 @@ -2972,6 +3047,15 @@ typedef void (GLAPIENTRY * PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint i #endif /* GL_AMD_shader_explicit_vertex_parameter */ +/* ------------------- GL_AMD_shader_image_load_store_lod ------------------ */ + +#ifndef GL_AMD_shader_image_load_store_lod +#define GL_AMD_shader_image_load_store_lod 1 + +#define GLEW_AMD_shader_image_load_store_lod GLEW_GET_VAR(__GLEW_AMD_shader_image_load_store_lod) + +#endif /* GL_AMD_shader_image_load_store_lod */ + /* ---------------------- GL_AMD_shader_stencil_export --------------------- */ #ifndef GL_AMD_shader_stencil_export @@ -4345,7 +4429,7 @@ typedef GLenum (GLAPIENTRY * PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint frame typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat* value); +typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat* value); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint* value); typedef void (GLAPIENTRY * PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint* value); typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); @@ -4594,10 +4678,10 @@ typedef void (GLAPIENTRY * PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLen #ifndef GL_ARB_draw_elements_base_vertex #define GL_ARB_draw_elements_base_vertex 1 -typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, void *indices, GLint basevertex); -typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex); -typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, void *indices, GLint basevertex); -typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei* count, GLenum type, void**indices, GLsizei primcount, GLint *basevertex); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei* count, GLenum type, const void*const *indices, GLsizei drawcount, const GLint *basevertex); #define glDrawElementsBaseVertex GLEW_GET_FUN(__glewDrawElementsBaseVertex) #define glDrawElementsInstancedBaseVertex GLEW_GET_FUN(__glewDrawElementsInstancedBaseVertex) @@ -8491,6 +8575,17 @@ typedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVARBPROC) (const GLshort* p); #endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ +/* ---------------- GL_ARM_texture_unnormalized_coordinates ---------------- */ + +#ifndef GL_ARM_texture_unnormalized_coordinates +#define GL_ARM_texture_unnormalized_coordinates 1 + +#define GL_TEXTURE_UNNORMALIZED_COORDINATES_ARM 0x8F6A + +#define GLEW_ARM_texture_unnormalized_coordinates GLEW_GET_VAR(__GLEW_ARM_texture_unnormalized_coordinates) + +#endif /* GL_ARM_texture_unnormalized_coordinates */ + /* ------------------------- GL_ATIX_point_sprites ------------------------- */ #ifndef GL_ATIX_point_sprites @@ -9042,26 +9137,29 @@ typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GL #endif /* GL_ATI_vertex_streams */ -/* -------------------- GL_EGL_KHR_context_flush_control ------------------- */ +/* ------------------------- GL_DMP_program_binary ------------------------- */ -#ifndef GL_EGL_KHR_context_flush_control -#define GL_EGL_KHR_context_flush_control 1 +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 -#define GLEW_EGL_KHR_context_flush_control GLEW_GET_VAR(__GLEW_EGL_KHR_context_flush_control) +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 -#endif /* GL_EGL_KHR_context_flush_control */ +#define GLEW_DMP_program_binary GLEW_GET_VAR(__GLEW_DMP_program_binary) -/* ---------------- GL_EGL_NV_robustness_video_memory_purge ---------------- */ +#endif /* GL_DMP_program_binary */ -#ifndef GL_EGL_NV_robustness_video_memory_purge -#define GL_EGL_NV_robustness_video_memory_purge 1 +/* -------------------------- GL_DMP_shader_binary ------------------------- */ -#define GL_EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C -#define GL_PURGED_CONTEXT_RESET_NV 0x92BB +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 + +#define GL_SHADER_BINARY_DMP 0x9250 -#define GLEW_EGL_NV_robustness_video_memory_purge GLEW_GET_VAR(__GLEW_EGL_NV_robustness_video_memory_purge) +#define GLEW_DMP_shader_binary GLEW_GET_VAR(__GLEW_DMP_shader_binary) -#endif /* GL_EGL_NV_robustness_video_memory_purge */ +#endif /* GL_DMP_shader_binary */ /* --------------------------- GL_EXT_422_pixels --------------------------- */ @@ -9098,6 +9196,39 @@ typedef void (GLAPIENTRY * PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GL #endif /* GL_EXT_EGL_image_array */ +/* ------------------ GL_EXT_EGL_image_external_wrap_modes ----------------- */ + +#ifndef GL_EXT_EGL_image_external_wrap_modes +#define GL_EXT_EGL_image_external_wrap_modes 1 + +#define GLEW_EXT_EGL_image_external_wrap_modes GLEW_GET_VAR(__GLEW_EXT_EGL_image_external_wrap_modes) + +#endif /* GL_EXT_EGL_image_external_wrap_modes */ + +/* ------------------------ GL_EXT_EGL_image_storage ----------------------- */ + +#ifndef GL_EXT_EGL_image_storage +#define GL_EXT_EGL_image_storage 1 + +typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list); +typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list); + +#define glEGLImageTargetTexStorageEXT GLEW_GET_FUN(__glewEGLImageTargetTexStorageEXT) +#define glEGLImageTargetTextureStorageEXT GLEW_GET_FUN(__glewEGLImageTargetTextureStorageEXT) + +#define GLEW_EXT_EGL_image_storage GLEW_GET_VAR(__GLEW_EXT_EGL_image_storage) + +#endif /* GL_EXT_EGL_image_storage */ + +/* ---------------------------- GL_EXT_EGL_sync ---------------------------- */ + +#ifndef GL_EXT_EGL_sync +#define GL_EXT_EGL_sync 1 + +#define GLEW_EXT_EGL_sync GLEW_GET_VAR(__GLEW_EXT_EGL_sync) + +#endif /* GL_EXT_EGL_sync */ + /* --------------------------- GL_EXT_YUV_target --------------------------- */ #ifndef GL_EXT_YUV_target @@ -9330,6 +9461,26 @@ typedef void (GLAPIENTRY * PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint #endif /* GL_EXT_clear_texture */ +/* -------------------------- GL_EXT_clip_control -------------------------- */ + +#ifndef GL_EXT_clip_control +#define GL_EXT_clip_control 1 + +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F + +typedef void (GLAPIENTRY * PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth); + +#define glClipControlEXT GLEW_GET_FUN(__glewClipControlEXT) + +#define GLEW_EXT_clip_control GLEW_GET_VAR(__GLEW_EXT_clip_control) + +#endif /* GL_EXT_clip_control */ + /* ----------------------- GL_EXT_clip_cull_distance ----------------------- */ #ifndef GL_EXT_clip_cull_distance @@ -9648,6 +9799,17 @@ typedef void (GLAPIENTRY * PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zma #endif /* GL_EXT_depth_bounds_test */ +/* --------------------------- GL_EXT_depth_clamp -------------------------- */ + +#ifndef GL_EXT_depth_clamp +#define GL_EXT_depth_clamp 1 + +#define GL_DEPTH_CLAMP_EXT 0x864F + +#define GLEW_EXT_depth_clamp GLEW_GET_VAR(__GLEW_EXT_depth_clamp) + +#endif /* GL_EXT_depth_clamp */ + /* ----------------------- GL_EXT_direct_state_access ---------------------- */ #ifndef GL_EXT_direct_state_access @@ -10108,6 +10270,45 @@ typedef void (GLAPIENTRY * PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsiz #endif /* GL_EXT_discard_framebuffer */ +/* ---------------------- GL_EXT_disjoint_timer_query ---------------------- */ + +#ifndef GL_EXT_disjoint_timer_query +#define GL_EXT_disjoint_timer_query 1 + +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB + +typedef void (GLAPIENTRY * PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GLAPIENTRY * PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint* ids); +typedef void (GLAPIENTRY * PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint* ids); +typedef void (GLAPIENTRY * PFNGLGETINTEGER64VEXTPROC) (GLenum pname, GLint64* data); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GLAPIENTRY * PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); + +#define glBeginQueryEXT GLEW_GET_FUN(__glewBeginQueryEXT) +#define glDeleteQueriesEXT GLEW_GET_FUN(__glewDeleteQueriesEXT) +#define glEndQueryEXT GLEW_GET_FUN(__glewEndQueryEXT) +#define glGenQueriesEXT GLEW_GET_FUN(__glewGenQueriesEXT) +#define glGetInteger64vEXT GLEW_GET_FUN(__glewGetInteger64vEXT) +#define glGetQueryObjectivEXT GLEW_GET_FUN(__glewGetQueryObjectivEXT) +#define glGetQueryObjectuivEXT GLEW_GET_FUN(__glewGetQueryObjectuivEXT) +#define glGetQueryivEXT GLEW_GET_FUN(__glewGetQueryivEXT) +#define glIsQueryEXT GLEW_GET_FUN(__glewIsQueryEXT) +#define glQueryCounterEXT GLEW_GET_FUN(__glewQueryCounterEXT) + +#define GLEW_EXT_disjoint_timer_query GLEW_GET_VAR(__GLEW_EXT_disjoint_timer_query) + +#endif /* GL_EXT_disjoint_timer_query */ + /* -------------------------- GL_EXT_draw_buffers -------------------------- */ #ifndef GL_EXT_draw_buffers @@ -10256,6 +10457,21 @@ typedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint s #endif /* GL_EXT_draw_range_elements */ +/* --------------------- GL_EXT_draw_transform_feedback -------------------- */ + +#ifndef GL_EXT_draw_transform_feedback +#define GL_EXT_draw_transform_feedback 1 + +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id); +typedef void (GLAPIENTRY * PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount); + +#define glDrawTransformFeedbackEXT GLEW_GET_FUN(__glewDrawTransformFeedbackEXT) +#define glDrawTransformFeedbackInstancedEXT GLEW_GET_FUN(__glewDrawTransformFeedbackInstancedEXT) + +#define GLEW_EXT_draw_transform_feedback GLEW_GET_VAR(__GLEW_EXT_draw_transform_feedback) + +#endif /* GL_EXT_draw_transform_feedback */ + /* ------------------------- GL_EXT_external_buffer ------------------------ */ #ifndef GL_EXT_external_buffer @@ -10958,13 +11174,6 @@ typedef void * (GLAPIENTRY * PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintpt #define GL_TILING_TYPES_EXT 0x9583 #define GL_OPTIMAL_TILING_EXT 0x9584 #define GL_LINEAR_TILING_EXT 0x9585 -#define GL_LAYOUT_GENERAL_EXT 0x958D -#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E -#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F -#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 -#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 -#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 -#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 #define GL_NUM_DEVICE_UUIDS_EXT 0x9596 #define GL_DEVICE_UUID_EXT 0x9597 #define GL_DRIVER_UUID_EXT 0x9598 @@ -11199,6 +11408,48 @@ typedef void (GLAPIENTRY * PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint ind #endif /* GL_EXT_multiview_draw_buffers */ +/* ------------- GL_EXT_multiview_tessellation_geometry_shader ------------- */ + +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 + +#define GLEW_EXT_multiview_tessellation_geometry_shader GLEW_GET_VAR(__GLEW_EXT_multiview_tessellation_geometry_shader) + +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +/* ------------------ GL_EXT_multiview_texture_multisample ----------------- */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 + +#define GLEW_EXT_multiview_texture_multisample GLEW_GET_VAR(__GLEW_EXT_multiview_texture_multisample) + +#endif /* GL_EXT_multiview_texture_multisample */ + +/* ---------------------- GL_EXT_multiview_timer_query --------------------- */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 + +#define GLEW_EXT_multiview_timer_query GLEW_GET_VAR(__GLEW_EXT_multiview_timer_query) + +#endif /* GL_EXT_multiview_timer_query */ + +/* --------------------- GL_EXT_occlusion_query_boolean -------------------- */ + +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 + +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A + +#define GLEW_EXT_occlusion_query_boolean GLEW_GET_VAR(__GLEW_EXT_occlusion_query_boolean) + +#endif /* GL_EXT_occlusion_query_boolean */ + /* ---------------------- GL_EXT_packed_depth_stencil ---------------------- */ #ifndef GL_EXT_packed_depth_stencil @@ -11399,6 +11650,33 @@ typedef void (GLAPIENTRY * PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfl #endif /* GL_EXT_post_depth_coverage */ +/* --------------------- GL_EXT_primitive_bounding_box --------------------- */ + +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 + +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE + +typedef void (GLAPIENTRY * PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); + +#define glPrimitiveBoundingBoxEXT GLEW_GET_FUN(__glewPrimitiveBoundingBoxEXT) + +#define GLEW_EXT_primitive_bounding_box GLEW_GET_VAR(__GLEW_EXT_primitive_bounding_box) + +#endif /* GL_EXT_primitive_bounding_box */ + +/* ----------------------- GL_EXT_protected_textures ----------------------- */ + +#ifndef GL_EXT_protected_textures +#define GL_EXT_protected_textures 1 + +#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010 +#define GL_TEXTURE_PROTECTED_EXT 0x8BFA + +#define GLEW_EXT_protected_textures GLEW_GET_VAR(__GLEW_EXT_protected_textures) + +#endif /* GL_EXT_protected_textures */ + /* ------------------------ GL_EXT_provoking_vertex ------------------------ */ #ifndef GL_EXT_provoking_vertex @@ -11507,6 +11785,31 @@ typedef void (GLAPIENTRY * PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean #endif /* GL_EXT_rescale_normal */ +/* --------------------------- GL_EXT_robustness --------------------------- */ + +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 + +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 + +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint* params); +typedef void (GLAPIENTRY * PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); + +#define glGetnUniformfvEXT GLEW_GET_FUN(__glewGetnUniformfvEXT) +#define glGetnUniformivEXT GLEW_GET_FUN(__glewGetnUniformivEXT) +#define glReadnPixelsEXT GLEW_GET_FUN(__glewReadnPixelsEXT) + +#define GLEW_EXT_robustness GLEW_GET_VAR(__GLEW_EXT_robustness) + +#endif /* GL_EXT_robustness */ + /* ------------------------------ GL_EXT_sRGB ------------------------------ */ #ifndef GL_EXT_sRGB @@ -11605,6 +11908,16 @@ typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenu #ifndef GL_EXT_semaphore #define GL_EXT_semaphore 1 +#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530 +#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 + typedef void (GLAPIENTRY * PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint* semaphores); typedef void (GLAPIENTRY * PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint* semaphores); typedef void (GLAPIENTRY * PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64* params); @@ -11692,10 +12005,25 @@ typedef void (GLAPIENTRY * PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint pr #define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void); + +#define glFramebufferFetchBarrierEXT GLEW_GET_FUN(__glewFramebufferFetchBarrierEXT) + #define GLEW_EXT_shader_framebuffer_fetch GLEW_GET_VAR(__GLEW_EXT_shader_framebuffer_fetch) #endif /* GL_EXT_shader_framebuffer_fetch */ +/* -------------- GL_EXT_shader_framebuffer_fetch_non_coherent ------------- */ + +#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent +#define GL_EXT_shader_framebuffer_fetch_non_coherent 1 + +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 + +#define GLEW_EXT_shader_framebuffer_fetch_non_coherent GLEW_GET_VAR(__GLEW_EXT_shader_framebuffer_fetch_non_coherent) + +#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */ + /* ------------------------ GL_EXT_shader_group_vote ----------------------- */ #ifndef GL_EXT_shader_group_vote @@ -11939,6 +12267,15 @@ typedef void (GLAPIENTRY * PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, G #endif /* GL_EXT_sparse_texture2 */ +/* ----------------------- GL_EXT_static_vertex_array ---------------------- */ + +#ifndef GL_EXT_static_vertex_array +#define GL_EXT_static_vertex_array 1 + +#define GLEW_EXT_static_vertex_array GLEW_GET_VAR(__GLEW_EXT_static_vertex_array) + +#endif /* GL_EXT_static_vertex_array */ + /* ------------------------ GL_EXT_stencil_clear_tag ----------------------- */ #ifndef GL_EXT_stencil_clear_tag @@ -11996,6 +12333,116 @@ typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint leve #endif /* GL_EXT_subtexture */ +/* --------------------- GL_EXT_tessellation_point_size -------------------- */ + +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 + +#define GL_QUADS_EXT 0x0007 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_PATCHES_EXT 0xE +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 + +typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); + +#define glPatchParameteriEXT GLEW_GET_FUN(__glewPatchParameteriEXT) + +#define GLEW_EXT_tessellation_point_size GLEW_GET_VAR(__GLEW_EXT_tessellation_point_size) + +#endif /* GL_EXT_tessellation_point_size */ + +/* ----------------------- GL_EXT_tessellation_shader ---------------------- */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 + +#define GL_QUADS_EXT 0x0007 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_PATCHES_EXT 0xE +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 + +#define GLEW_EXT_tessellation_shader GLEW_GET_VAR(__GLEW_EXT_tessellation_shader) + +#endif /* GL_EXT_tessellation_shader */ + /* ----------------------------- GL_EXT_texture ---------------------------- */ #ifndef GL_EXT_texture @@ -12093,6 +12540,52 @@ typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, #endif /* GL_EXT_texture_array */ +/* ---------------------- GL_EXT_texture_border_clamp ---------------------- */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 + +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D + +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint* params); + +#define glGetSamplerParameterIivEXT GLEW_GET_FUN(__glewGetSamplerParameterIivEXT) +#define glGetSamplerParameterIuivEXT GLEW_GET_FUN(__glewGetSamplerParameterIuivEXT) +#define glSamplerParameterIivEXT GLEW_GET_FUN(__glewSamplerParameterIivEXT) +#define glSamplerParameterIuivEXT GLEW_GET_FUN(__glewSamplerParameterIuivEXT) + +#define GLEW_EXT_texture_border_clamp GLEW_GET_VAR(__GLEW_EXT_texture_border_clamp) + +#endif /* GL_EXT_texture_border_clamp */ + +/* ------------------------- GL_EXT_texture_buffer ------------------------- */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 + +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F + +#define GLEW_EXT_texture_buffer GLEW_GET_VAR(__GLEW_EXT_texture_buffer) + +#endif /* GL_EXT_texture_buffer */ + /* ---------------------- GL_EXT_texture_buffer_object --------------------- */ #ifndef GL_EXT_texture_buffer_object @@ -12199,6 +12692,20 @@ typedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum interna #endif /* GL_EXT_texture_compression_s3tc */ +/* ------------------ GL_EXT_texture_compression_s3tc_srgb ----------------- */ + +#ifndef GL_EXT_texture_compression_s3tc_srgb +#define GL_EXT_texture_compression_s3tc_srgb 1 + +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F + +#define GLEW_EXT_texture_compression_s3tc_srgb GLEW_GET_VAR(__GLEW_EXT_texture_compression_s3tc_srgb) + +#endif /* GL_EXT_texture_compression_s3tc_srgb */ + /* ------------------------ GL_EXT_texture_cube_map ------------------------ */ #ifndef GL_EXT_texture_cube_map @@ -12347,6 +12854,17 @@ typedef void (GLAPIENTRY * PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum interna #endif /* GL_EXT_texture_format_BGRA8888 */ +/* ------------------ GL_EXT_texture_format_sRGB_override ------------------ */ + +#ifndef GL_EXT_texture_format_sRGB_override +#define GL_EXT_texture_format_sRGB_override 1 + +#define GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT 0x8FBF + +#define GLEW_EXT_texture_format_sRGB_override GLEW_GET_VAR(__GLEW_EXT_texture_format_sRGB_override) + +#endif /* GL_EXT_texture_format_sRGB_override */ + /* ------------------------- GL_EXT_texture_integer ------------------------ */ #ifndef GL_EXT_texture_integer @@ -12444,6 +12962,17 @@ typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum #endif /* GL_EXT_texture_mirror_clamp */ +/* ------------------ GL_EXT_texture_mirror_clamp_to_edge ------------------ */ + +#ifndef GL_EXT_texture_mirror_clamp_to_edge +#define GL_EXT_texture_mirror_clamp_to_edge 1 + +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 + +#define GLEW_EXT_texture_mirror_clamp_to_edge GLEW_GET_VAR(__GLEW_EXT_texture_mirror_clamp_to_edge) + +#endif /* GL_EXT_texture_mirror_clamp_to_edge */ + /* ------------------------- GL_EXT_texture_norm16 ------------------------- */ #ifndef GL_EXT_texture_norm16 @@ -12507,6 +13036,15 @@ typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); #endif /* GL_EXT_texture_perturb_normal */ +/* ------------------------ GL_EXT_texture_query_lod ----------------------- */ + +#ifndef GL_EXT_texture_query_lod +#define GL_EXT_texture_query_lod 1 + +#define GLEW_EXT_texture_query_lod GLEW_GET_VAR(__GLEW_EXT_texture_query_lod) + +#endif /* GL_EXT_texture_query_lod */ + /* ------------------------ GL_EXT_texture_rectangle ----------------------- */ #ifndef GL_EXT_texture_rectangle @@ -12596,6 +13134,15 @@ typedef void (GLAPIENTRY * PFNGLTEXTURENORMALEXTPROC) (GLenum mode); #endif /* GL_EXT_texture_sRGB_decode */ +/* ----------------------- GL_EXT_texture_shadow_lod ----------------------- */ + +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 + +#define GLEW_EXT_texture_shadow_lod GLEW_GET_VAR(__GLEW_EXT_texture_shadow_lod) + +#endif /* GL_EXT_texture_shadow_lod */ + /* --------------------- GL_EXT_texture_shared_exponent -------------------- */ #ifndef GL_EXT_texture_shared_exponent @@ -13230,6 +13777,17 @@ typedef GLsync (GLAPIENTRY * PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, #endif /* GL_EXT_x11_sync_object */ +/* ----------------------- GL_FJ_shader_binary_GCCSO ----------------------- */ + +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 + +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 + +#define GLEW_FJ_shader_binary_GCCSO GLEW_GET_VAR(__GLEW_FJ_shader_binary_GCCSO) + +#endif /* GL_FJ_shader_binary_GCCSO */ + /* ---------------------- GL_GREMEDY_frame_terminator ---------------------- */ #ifndef GL_GREMEDY_frame_terminator @@ -13410,6 +13968,159 @@ typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum ty #endif /* GL_IBM_vertex_array_lists */ +/* ------------------------ GL_IMG_bindless_texture ------------------------ */ + +#ifndef GL_IMG_bindless_texture +#define GL_IMG_bindless_texture 1 + +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture); +typedef GLuint64 (GLAPIENTRY * PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64* values); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value); +typedef void (GLAPIENTRY * PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64* value); + +#define glGetTextureHandleIMG GLEW_GET_FUN(__glewGetTextureHandleIMG) +#define glGetTextureSamplerHandleIMG GLEW_GET_FUN(__glewGetTextureSamplerHandleIMG) +#define glProgramUniformHandleui64IMG GLEW_GET_FUN(__glewProgramUniformHandleui64IMG) +#define glProgramUniformHandleui64vIMG GLEW_GET_FUN(__glewProgramUniformHandleui64vIMG) +#define glUniformHandleui64IMG GLEW_GET_FUN(__glewUniformHandleui64IMG) +#define glUniformHandleui64vIMG GLEW_GET_FUN(__glewUniformHandleui64vIMG) + +#define GLEW_IMG_bindless_texture GLEW_GET_VAR(__GLEW_IMG_bindless_texture) + +#endif /* GL_IMG_bindless_texture */ + +/* --------------------- GL_IMG_framebuffer_downsample --------------------- */ + +#ifndef GL_IMG_framebuffer_downsample +#define GL_IMG_framebuffer_downsample 1 + +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C +#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D +#define GL_DOWNSAMPLE_SCALES_IMG 0x913E +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); + +#define glFramebufferTexture2DDownsampleIMG GLEW_GET_FUN(__glewFramebufferTexture2DDownsampleIMG) +#define glFramebufferTextureLayerDownsampleIMG GLEW_GET_FUN(__glewFramebufferTextureLayerDownsampleIMG) + +#define GLEW_IMG_framebuffer_downsample GLEW_GET_VAR(__GLEW_IMG_framebuffer_downsample) + +#endif /* GL_IMG_framebuffer_downsample */ + +/* ----------------- GL_IMG_multisampled_render_to_texture ----------------- */ + +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 + +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +#define glFramebufferTexture2DMultisampleIMG GLEW_GET_FUN(__glewFramebufferTexture2DMultisampleIMG) +#define glRenderbufferStorageMultisampleIMG GLEW_GET_FUN(__glewRenderbufferStorageMultisampleIMG) + +#define GLEW_IMG_multisampled_render_to_texture GLEW_GET_VAR(__GLEW_IMG_multisampled_render_to_texture) + +#endif /* GL_IMG_multisampled_render_to_texture */ + +/* ------------------------- GL_IMG_program_binary ------------------------- */ + +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 + +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 + +#define GLEW_IMG_program_binary GLEW_GET_VAR(__GLEW_IMG_program_binary) + +#endif /* GL_IMG_program_binary */ + +/* --------------------------- GL_IMG_read_format -------------------------- */ + +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 + +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 + +#define GLEW_IMG_read_format GLEW_GET_VAR(__GLEW_IMG_read_format) + +#endif /* GL_IMG_read_format */ + +/* -------------------------- GL_IMG_shader_binary ------------------------- */ + +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 + +#define GL_SGX_BINARY_IMG 0x8C0A + +#define GLEW_IMG_shader_binary GLEW_GET_VAR(__GLEW_IMG_shader_binary) + +#endif /* GL_IMG_shader_binary */ + +/* -------------------- GL_IMG_texture_compression_pvrtc ------------------- */ + +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 + +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 + +#define GLEW_IMG_texture_compression_pvrtc GLEW_GET_VAR(__GLEW_IMG_texture_compression_pvrtc) + +#endif /* GL_IMG_texture_compression_pvrtc */ + +/* ------------------- GL_IMG_texture_compression_pvrtc2 ------------------- */ + +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 + +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 + +#define GLEW_IMG_texture_compression_pvrtc2 GLEW_GET_VAR(__GLEW_IMG_texture_compression_pvrtc2) + +#endif /* GL_IMG_texture_compression_pvrtc2 */ + +/* --------------- GL_IMG_texture_env_enhanced_fixed_function -------------- */ + +#ifndef GL_IMG_texture_env_enhanced_fixed_function +#define GL_IMG_texture_env_enhanced_fixed_function 1 + +#define GL_DOT3_RGBA_IMG 0x86AF +#define GL_MODULATE_COLOR_IMG 0x8C04 +#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05 +#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06 +#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07 +#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08 +#define GL_ADD_BLEND_IMG 0x8C09 + +#define GLEW_IMG_texture_env_enhanced_fixed_function GLEW_GET_VAR(__GLEW_IMG_texture_env_enhanced_fixed_function) + +#endif /* GL_IMG_texture_env_enhanced_fixed_function */ + +/* ---------------------- GL_IMG_texture_filter_cubic ---------------------- */ + +#ifndef GL_IMG_texture_filter_cubic +#define GL_IMG_texture_filter_cubic 1 + +#define GL_CUBIC_IMG 0x9139 +#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A +#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B + +#define GLEW_IMG_texture_filter_cubic GLEW_GET_VAR(__GLEW_IMG_texture_filter_cubic) + +#endif /* GL_IMG_texture_filter_cubic */ + /* -------------------------- GL_INGR_color_clamp -------------------------- */ #ifndef GL_INGR_color_clamp @@ -13439,6 +14150,17 @@ typedef void (GLAPIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum ty #endif /* GL_INGR_interlace_read */ +/* ----------------------- GL_INTEL_blackhole_render ----------------------- */ + +#ifndef GL_INTEL_blackhole_render +#define GL_INTEL_blackhole_render 1 + +#define GL_BLACKHOLE_RENDER_INTEL 0x83FC + +#define GLEW_INTEL_blackhole_render GLEW_GET_VAR(__GLEW_INTEL_blackhole_render) + +#endif /* GL_INTEL_blackhole_render */ + /* ------------------ GL_INTEL_conservative_rasterization ------------------ */ #ifndef GL_INTEL_conservative_rasterization @@ -13567,6 +14289,15 @@ typedef void (GLAPIENTRY * PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLui #endif /* GL_INTEL_performance_query */ +/* ------------------- GL_INTEL_shader_integer_functions2 ------------------ */ + +#ifndef GL_INTEL_shader_integer_functions2 +#define GL_INTEL_shader_integer_functions2 1 + +#define GLEW_INTEL_shader_integer_functions2 GLEW_GET_VAR(__GLEW_INTEL_shader_integer_functions2) + +#endif /* GL_INTEL_shader_integer_functions2 */ + /* ------------------------ GL_INTEL_texture_scissor ----------------------- */ #ifndef GL_INTEL_texture_scissor @@ -13626,6 +14357,9 @@ typedef void (GLAPIENTRY * PFNGLBLENDBARRIERKHRPROC) (void); #ifndef GL_KHR_context_flush_control #define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC + #define GLEW_KHR_context_flush_control GLEW_GET_VAR(__GLEW_KHR_context_flush_control) #endif /* GL_KHR_context_flush_control */ @@ -13768,12 +14502,34 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #endif /* GL_KHR_robustness */ -/* ------------------ GL_KHR_texture_compression_astc_hdr ------------------ */ +/* ------------------------- GL_KHR_shader_subgroup ------------------------ */ -#ifndef GL_KHR_texture_compression_astc_hdr -#define GL_KHR_texture_compression_astc_hdr 1 +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 + +#define GLEW_KHR_shader_subgroup GLEW_GET_VAR(__GLEW_KHR_shader_subgroup) + +#endif /* GL_KHR_shader_subgroup */ + +/* ------------------ GL_KHR_texture_compression_astc_hdr ------------------ */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 + +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 #define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 #define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 #define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 @@ -13787,6 +14543,16 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB #define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC #define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 @@ -13801,6 +14567,16 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 #define GLEW_KHR_texture_compression_astc_hdr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_hdr) @@ -13825,6 +14601,16 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB #define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC #define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 @@ -13839,6 +14625,16 @@ typedef void (GLAPIENTRY * PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei widt #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC #define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 #define GLEW_KHR_texture_compression_astc_ldr GLEW_GET_VAR(__GLEW_KHR_texture_compression_astc_ldr) @@ -13895,6 +14691,23 @@ typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, G #endif /* GL_MESAX_texture_stack */ +/* ----------------------- GL_MESA_framebuffer_flip_y ---------------------- */ + +#ifndef GL_MESA_framebuffer_flip_y +#define GL_MESA_framebuffer_flip_y 1 + +#define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB + +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint* params); + +#define glFramebufferParameteriMESA GLEW_GET_FUN(__glewFramebufferParameteriMESA) +#define glGetFramebufferParameterivMESA GLEW_GET_FUN(__glewGetFramebufferParameterivMESA) + +#define GLEW_MESA_framebuffer_flip_y GLEW_GET_VAR(__GLEW_MESA_framebuffer_flip_y) + +#endif /* GL_MESA_framebuffer_flip_y */ + /* -------------------------- GL_MESA_pack_invert -------------------------- */ #ifndef GL_MESA_pack_invert @@ -13906,6 +14719,17 @@ typedef void (GLAPIENTRY * PFNGLREADBUFFERREGIONPROC) (GLuint region, GLint x, G #endif /* GL_MESA_pack_invert */ +/* --------------------- GL_MESA_program_binary_formats -------------------- */ + +#ifndef GL_MESA_program_binary_formats +#define GL_MESA_program_binary_formats 1 + +#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F + +#define GLEW_MESA_program_binary_formats GLEW_GET_VAR(__GLEW_MESA_program_binary_formats) + +#endif /* GL_MESA_program_binary_formats */ + /* ------------------------- GL_MESA_resize_buffers ------------------------ */ #ifndef GL_MESA_resize_buffers @@ -13928,6 +14752,15 @@ typedef void (GLAPIENTRY * PFNGLRESIZEBUFFERSMESAPROC) (void); #endif /* GL_MESA_shader_integer_functions */ +/* ----------------------- GL_MESA_tile_raster_order ----------------------- */ + +#ifndef GL_MESA_tile_raster_order +#define GL_MESA_tile_raster_order 1 + +#define GLEW_MESA_tile_raster_order GLEW_GET_VAR(__GLEW_MESA_tile_raster_order) + +#endif /* GL_MESA_tile_raster_order */ + /* --------------------------- GL_MESA_window_pos -------------------------- */ #ifndef GL_MESA_window_pos @@ -14039,6 +14872,31 @@ typedef void (GLAPIENTRY * PFNGLENDCONDITIONALRENDERNVXPROC) (void); #endif /* GL_NVX_gpu_memory_info */ +/* ------------------------- GL_NVX_gpu_multicast2 ------------------------- */ + +#ifndef GL_NVX_gpu_multicast2 +#define GL_NVX_gpu_multicast2 1 + +#define GL_UPLOAD_GPU_MASK_NVX 0x954A + +typedef GLsync (GLAPIENTRY * PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint* waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +typedef GLuint (GLAPIENTRY * PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint* waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +typedef void (GLAPIENTRY * PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint* v); +typedef void (GLAPIENTRY * PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); +typedef void (GLAPIENTRY * PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask); + +#define glAsyncCopyBufferSubDataNVX GLEW_GET_FUN(__glewAsyncCopyBufferSubDataNVX) +#define glAsyncCopyImageSubDataNVX GLEW_GET_FUN(__glewAsyncCopyImageSubDataNVX) +#define glMulticastScissorArrayvNVX GLEW_GET_FUN(__glewMulticastScissorArrayvNVX) +#define glMulticastViewportArrayvNVX GLEW_GET_FUN(__glewMulticastViewportArrayvNVX) +#define glMulticastViewportPositionWScaleNVX GLEW_GET_FUN(__glewMulticastViewportPositionWScaleNVX) +#define glUploadGpuMaskNVX GLEW_GET_FUN(__glewUploadGpuMaskNVX) + +#define GLEW_NVX_gpu_multicast2 GLEW_GET_VAR(__GLEW_NVX_gpu_multicast2) + +#endif /* GL_NVX_gpu_multicast2 */ + /* ---------------------- GL_NVX_linked_gpu_multicast ---------------------- */ #ifndef GL_NVX_linked_gpu_multicast @@ -14059,6 +14917,23 @@ typedef void (GLAPIENTRY * PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMa #endif /* GL_NVX_linked_gpu_multicast */ +/* ------------------------- GL_NVX_progress_fence ------------------------- */ + +#ifndef GL_NVX_progress_fence +#define GL_NVX_progress_fence 1 + +typedef void (GLAPIENTRY * PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint* semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (GLAPIENTRY * PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint* semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (GLAPIENTRY * PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint* semaphoreArray, const GLuint64 *fenceValueArray); + +#define glClientWaitSemaphoreui64NVX GLEW_GET_FUN(__glewClientWaitSemaphoreui64NVX) +#define glSignalSemaphoreui64NVX GLEW_GET_FUN(__glewSignalSemaphoreui64NVX) +#define glWaitSemaphoreui64NVX GLEW_GET_FUN(__glewWaitSemaphoreui64NVX) + +#define GLEW_NVX_progress_fence GLEW_GET_VAR(__GLEW_NVX_progress_fence) + +#endif /* GL_NVX_progress_fence */ + /* ------------------------ GL_NV_3dvision_settings ------------------------ */ #ifndef GL_NV_3dvision_settings @@ -14106,6 +14981,10 @@ typedef void (GLAPIENTRY * PFNGLSTEREOPARAMETERINVPROC) (GLenum pname, GLint par #define GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV 0x934E #define GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV 0x934F +typedef void (GLAPIENTRY * PFNGLALPHATOCOVERAGEDITHERCONTROLNVPROC) (GLenum mode); + +#define glAlphaToCoverageDitherControlNV GLEW_GET_FUN(__glewAlphaToCoverageDitherControlNV) + #define GLEW_NV_alpha_to_coverage_dither_control GLEW_GET_VAR(__GLEW_NV_alpha_to_coverage_dither_control) #endif /* GL_NV_alpha_to_coverage_dither_control */ @@ -14378,6 +15257,15 @@ typedef void (GLAPIENTRY * PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); #endif /* GL_NV_compute_program5 */ +/* -------------------- GL_NV_compute_shader_derivatives ------------------- */ + +#ifndef GL_NV_compute_shader_derivatives +#define GL_NV_compute_shader_derivatives 1 + +#define GLEW_NV_compute_shader_derivatives GLEW_GET_VAR(__GLEW_NV_compute_shader_derivatives) + +#endif /* GL_NV_compute_shader_derivatives */ + /* ------------------------ GL_NV_conditional_render ----------------------- */ #ifndef GL_NV_conditional_render @@ -14433,6 +15321,17 @@ typedef void (GLAPIENTRY * PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pnam #endif /* GL_NV_conservative_raster_dilate */ +/* ------------------- GL_NV_conservative_raster_pre_snap ------------------ */ + +#ifndef GL_NV_conservative_raster_pre_snap +#define GL_NV_conservative_raster_pre_snap 1 + +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550 + +#define GLEW_NV_conservative_raster_pre_snap GLEW_GET_VAR(__GLEW_NV_conservative_raster_pre_snap) + +#endif /* GL_NV_conservative_raster_pre_snap */ + /* -------------- GL_NV_conservative_raster_pre_snap_triangles ------------- */ #ifndef GL_NV_conservative_raster_pre_snap_triangles @@ -14450,6 +15349,15 @@ typedef void (GLAPIENTRY * PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pnam #endif /* GL_NV_conservative_raster_pre_snap_triangles */ +/* --------------- GL_NV_conservative_raster_underestimation --------------- */ + +#ifndef GL_NV_conservative_raster_underestimation +#define GL_NV_conservative_raster_underestimation 1 + +#define GLEW_NV_conservative_raster_underestimation GLEW_GET_VAR(__GLEW_NV_conservative_raster_underestimation) + +#endif /* GL_NV_conservative_raster_underestimation */ + /* --------------------------- GL_NV_copy_buffer --------------------------- */ #ifndef GL_NV_copy_buffer @@ -14536,6 +15444,17 @@ typedef void (GLAPIENTRY * PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFa #endif /* GL_NV_depth_clamp */ +/* ------------------------- GL_NV_depth_nonlinear ------------------------- */ + +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 + +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C + +#define GLEW_NV_depth_nonlinear GLEW_GET_VAR(__GLEW_NV_depth_nonlinear) + +#endif /* GL_NV_depth_nonlinear */ + /* ---------------------- GL_NV_depth_range_unclamped ---------------------- */ #ifndef GL_NV_depth_range_unclamped @@ -14924,6 +15843,15 @@ typedef void (GLAPIENTRY * PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsi #endif /* GL_NV_fragment_program_option */ +/* ------------------- GL_NV_fragment_shader_barycentric ------------------- */ + +#ifndef GL_NV_fragment_shader_barycentric +#define GL_NV_fragment_shader_barycentric 1 + +#define GLEW_NV_fragment_shader_barycentric GLEW_GET_VAR(__GLEW_NV_fragment_shader_barycentric) + +#endif /* GL_NV_fragment_shader_barycentric */ + /* -------------------- GL_NV_fragment_shader_interlock -------------------- */ #ifndef GL_NV_fragment_shader_interlock @@ -15442,6 +16370,108 @@ typedef void (GLAPIENTRY * PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, #endif /* GL_NV_light_max_exponent */ +/* ------------------------ GL_NV_memory_attachment ------------------------ */ + +#ifndef GL_NV_memory_attachment +#define GL_NV_memory_attachment 1 + +#define GL_ATTACHED_MEMORY_OBJECT_NV 0x95A4 +#define GL_ATTACHED_MEMORY_OFFSET_NV 0x95A5 +#define GL_MEMORY_ATTACHABLE_ALIGNMENT_NV 0x95A6 +#define GL_MEMORY_ATTACHABLE_SIZE_NV 0x95A7 +#define GL_MEMORY_ATTACHABLE_NV 0x95A8 +#define GL_DETACHED_MEMORY_INCARNATION_NV 0x95A9 +#define GL_DETACHED_TEXTURES_NV 0x95AA +#define GL_DETACHED_BUFFERS_NV 0x95AB +#define GL_MAX_DETACHED_TEXTURES_NV 0x95AC +#define GL_MAX_DETACHED_BUFFERS_NV 0x95AD + +typedef void (GLAPIENTRY * PFNGLBUFFERATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (GLAPIENTRY * PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC) (GLuint memory, GLenum pname, GLint first, GLsizei count, GLuint* params); +typedef void (GLAPIENTRY * PFNGLNAMEDBUFFERATTACHMEMORYNVPROC) (GLuint buffer, GLuint memory, GLuint64 offset); +typedef void (GLAPIENTRY * PFNGLRESETMEMORYOBJECTPARAMETERNVPROC) (GLuint memory, GLenum pname); +typedef void (GLAPIENTRY * PFNGLTEXATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (GLAPIENTRY * PFNGLTEXTUREATTACHMEMORYNVPROC) (GLuint texture, GLuint memory, GLuint64 offset); + +#define glBufferAttachMemoryNV GLEW_GET_FUN(__glewBufferAttachMemoryNV) +#define glGetMemoryObjectDetachedResourcesuivNV GLEW_GET_FUN(__glewGetMemoryObjectDetachedResourcesuivNV) +#define glNamedBufferAttachMemoryNV GLEW_GET_FUN(__glewNamedBufferAttachMemoryNV) +#define glResetMemoryObjectParameterNV GLEW_GET_FUN(__glewResetMemoryObjectParameterNV) +#define glTexAttachMemoryNV GLEW_GET_FUN(__glewTexAttachMemoryNV) +#define glTextureAttachMemoryNV GLEW_GET_FUN(__glewTextureAttachMemoryNV) + +#define GLEW_NV_memory_attachment GLEW_GET_VAR(__GLEW_NV_memory_attachment) + +#endif /* GL_NV_memory_attachment */ + +/* --------------------------- GL_NV_mesh_shader --------------------------- */ + +#ifndef GL_NV_mesh_shader +#define GL_NV_mesh_shader 1 + +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_MAX_MESH_UNIFORM_BLOCKS_NV 0x8E60 +#define GL_MAX_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 +#define GL_MAX_MESH_IMAGE_UNIFORMS_NV 0x8E62 +#define GL_MAX_MESH_UNIFORM_COMPONENTS_NV 0x8E63 +#define GL_MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 +#define GL_MAX_MESH_ATOMIC_COUNTERS_NV 0x8E65 +#define GL_MAX_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 +#define GL_MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 +#define GL_MAX_TASK_UNIFORM_BLOCKS_NV 0x8E68 +#define GL_MAX_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 +#define GL_MAX_TASK_IMAGE_UNIFORMS_NV 0x8E6A +#define GL_MAX_TASK_UNIFORM_COMPONENTS_NV 0x8E6B +#define GL_MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C +#define GL_MAX_TASK_ATOMIC_COUNTERS_NV 0x8E6D +#define GL_MAX_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E +#define GL_MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F +#define GL_MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF +#define GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 +#define GL_MAX_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 +#define GL_MAX_MESH_OUTPUT_VERTICES_NV 0x9538 +#define GL_MAX_MESH_OUTPUT_PRIMITIVES_NV 0x9539 +#define GL_MAX_TASK_OUTPUT_COUNT_NV 0x953A +#define GL_MAX_MESH_WORK_GROUP_SIZE_NV 0x953B +#define GL_MAX_TASK_WORK_GROUP_SIZE_NV 0x953C +#define GL_MAX_DRAW_MESH_TASKS_COUNT_NV 0x953D +#define GL_MESH_WORK_GROUP_SIZE_NV 0x953E +#define GL_TASK_WORK_GROUP_SIZE_NV 0x953F +#define GL_MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 +#define GL_MAX_MESH_VIEWS_NV 0x9557 +#define GL_MESH_SHADER_NV 0x9559 +#define GL_TASK_SHADER_NV 0x955A +#define GL_MESH_VERTICES_OUT_NV 0x9579 +#define GL_MESH_PRIMITIVES_OUT_NV 0x957A +#define GL_MESH_OUTPUT_TYPE_NV 0x957B +#define GL_MESH_SUBROUTINE_NV 0x957C +#define GL_TASK_SUBROUTINE_NV 0x957D +#define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E +#define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F +#define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 +#define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MAX_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 +#define GL_MAX_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 + +typedef void (GLAPIENTRY * PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); +typedef void (GLAPIENTRY * PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC) (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (GLAPIENTRY * PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); + +#define glDrawMeshTasksIndirectNV GLEW_GET_FUN(__glewDrawMeshTasksIndirectNV) +#define glDrawMeshTasksNV GLEW_GET_FUN(__glewDrawMeshTasksNV) +#define glMultiDrawMeshTasksIndirectCountNV GLEW_GET_FUN(__glewMultiDrawMeshTasksIndirectCountNV) +#define glMultiDrawMeshTasksIndirectNV GLEW_GET_FUN(__glewMultiDrawMeshTasksIndirectNV) + +#define GLEW_NV_mesh_shader GLEW_GET_VAR(__GLEW_NV_mesh_shader) + +#endif /* GL_NV_mesh_shader */ + /* ----------------------- GL_NV_multisample_coverage ---------------------- */ #ifndef GL_NV_multisample_coverage @@ -16039,6 +17069,41 @@ typedef void (GLAPIENTRY * PFNGLPRIMITIVERESTARTNVPROC) (void); #endif /* GL_NV_primitive_restart */ +/* ------------------------ GL_NV_query_resource_tag ----------------------- */ + +#ifndef GL_NV_query_resource_tag +#define GL_NV_query_resource_tag 1 + +#define GLEW_NV_query_resource_tag GLEW_GET_VAR(__GLEW_NV_query_resource_tag) + +#endif /* GL_NV_query_resource_tag */ + +/* --------------------------- GL_NV_read_buffer --------------------------- */ + +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 + +#define GL_READ_BUFFER_NV 0x0C02 + +typedef void (GLAPIENTRY * PFNGLREADBUFFERNVPROC) (GLenum mode); + +#define glReadBufferNV GLEW_GET_FUN(__glewReadBufferNV) + +#define GLEW_NV_read_buffer GLEW_GET_VAR(__GLEW_NV_read_buffer) + +#endif /* GL_NV_read_buffer */ + +/* ------------------------ GL_NV_read_buffer_front ------------------------ */ + +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 + +#define GL_READ_BUFFER_NV 0x0C02 + +#define GLEW_NV_read_buffer_front GLEW_GET_VAR(__GLEW_NV_read_buffer_front) + +#endif /* GL_NV_read_buffer_front */ + /* ---------------------------- GL_NV_read_depth --------------------------- */ #ifndef GL_NV_read_depth @@ -16172,12 +17237,22 @@ typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage #endif /* GL_NV_register_combiners2 */ +/* ------------------- GL_NV_representative_fragment_test ------------------ */ + +#ifndef GL_NV_representative_fragment_test +#define GL_NV_representative_fragment_test 1 + +#define GL_REPRESENTATIVE_FRAGMENT_TEST_NV 0x937F + +#define GLEW_NV_representative_fragment_test GLEW_GET_VAR(__GLEW_NV_representative_fragment_test) + +#endif /* GL_NV_representative_fragment_test */ + /* ------------------ GL_NV_robustness_video_memory_purge ------------------ */ #ifndef GL_NV_robustness_video_memory_purge #define GL_NV_robustness_video_memory_purge 1 -#define GL_EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C #define GL_PURGED_CONTEXT_RESET_NV 0x92BB #define GLEW_NV_robustness_video_memory_purge GLEW_GET_VAR(__GLEW_NV_robustness_video_memory_purge) @@ -16220,9 +17295,11 @@ typedef void (GLAPIENTRY * PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat* v); typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat* v); +typedef void (GLAPIENTRY * PFNGLRESOLVEDEPTHVALUESNVPROC) (void); #define glFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewFramebufferSampleLocationsfvNV) #define glNamedFramebufferSampleLocationsfvNV GLEW_GET_FUN(__glewNamedFramebufferSampleLocationsfvNV) +#define glResolveDepthValuesNV GLEW_GET_FUN(__glewResolveDepthValuesNV) #define GLEW_NV_sample_locations GLEW_GET_VAR(__GLEW_NV_sample_locations) @@ -16237,6 +17314,24 @@ typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint #endif /* GL_NV_sample_mask_override_coverage */ +/* ------------------------ GL_NV_scissor_exclusive ------------------------ */ + +#ifndef GL_NV_scissor_exclusive +#define GL_NV_scissor_exclusive 1 + +#define GL_SCISSOR_TEST_EXCLUSIVE_NV 0x9555 +#define GL_SCISSOR_BOX_EXCLUSIVE_NV 0x9556 + +typedef void (GLAPIENTRY * PFNGLSCISSOREXCLUSIVEARRAYVNVPROC) (GLuint first, GLsizei count, const GLint* v); +typedef void (GLAPIENTRY * PFNGLSCISSOREXCLUSIVENVPROC) (GLint x, GLint y, GLsizei width, GLsizei height); + +#define glScissorExclusiveArrayvNV GLEW_GET_FUN(__glewScissorExclusiveArrayvNV) +#define glScissorExclusiveNV GLEW_GET_FUN(__glewScissorExclusiveNV) + +#define GLEW_NV_scissor_exclusive GLEW_GET_VAR(__GLEW_NV_scissor_exclusive) + +#endif /* GL_NV_scissor_exclusive */ + /* ---------------------- GL_NV_shader_atomic_counters --------------------- */ #ifndef GL_NV_shader_atomic_counters @@ -16341,6 +17436,26 @@ typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei cou #endif /* GL_NV_shader_storage_buffer_object */ +/* ------------------- GL_NV_shader_subgroup_partitioned ------------------- */ + +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 + +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 + +#define GLEW_NV_shader_subgroup_partitioned GLEW_GET_VAR(__GLEW_NV_shader_subgroup_partitioned) + +#endif /* GL_NV_shader_subgroup_partitioned */ + +/* --------------------- GL_NV_shader_texture_footprint -------------------- */ + +#ifndef GL_NV_shader_texture_footprint +#define GL_NV_shader_texture_footprint 1 + +#define GLEW_NV_shader_texture_footprint GLEW_GET_VAR(__GLEW_NV_shader_texture_footprint) + +#endif /* GL_NV_shader_texture_footprint */ + /* ----------------------- GL_NV_shader_thread_group ----------------------- */ #ifndef GL_NV_shader_thread_group @@ -16363,6 +17478,51 @@ typedef void (GLAPIENTRY * PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei cou #endif /* GL_NV_shader_thread_shuffle */ +/* ------------------------ GL_NV_shading_rate_image ----------------------- */ + +#ifndef GL_NV_shading_rate_image +#define GL_NV_shading_rate_image 1 + +#define GL_SHADING_RATE_IMAGE_BINDING_NV 0x955B +#define GL_SHADING_RATE_IMAGE_TEXEL_WIDTH_NV 0x955C +#define GL_SHADING_RATE_IMAGE_TEXEL_HEIGHT_NV 0x955D +#define GL_SHADING_RATE_IMAGE_PALETTE_SIZE_NV 0x955E +#define GL_MAX_COARSE_FRAGMENT_SAMPLES_NV 0x955F +#define GL_SHADING_RATE_IMAGE_NV 0x9563 +#define GL_SHADING_RATE_NO_INVOCATIONS_NV 0x9564 +#define GL_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV 0x9565 +#define GL_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV 0x9566 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV 0x9567 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV 0x9568 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV 0x9569 +#define GL_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV 0x956A +#define GL_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV 0x956B +#define GL_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV 0x956C +#define GL_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV 0x956D +#define GL_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV 0x956E +#define GL_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV 0x956F +#define GL_SHADING_RATE_SAMPLE_ORDER_DEFAULT_NV 0x95AE +#define GL_SHADING_RATE_SAMPLE_ORDER_PIXEL_MAJOR_NV 0x95AF +#define GL_SHADING_RATE_SAMPLE_ORDER_SAMPLE_MAJOR_NV 0x95B0 + +typedef void (GLAPIENTRY * PFNGLBINDSHADINGRATEIMAGENVPROC) (GLuint texture); +typedef void (GLAPIENTRY * PFNGLGETSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint entry, GLenum* rate); +typedef void (GLAPIENTRY * PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC) (GLenum rate, GLuint samples, GLuint index, GLint* location); +typedef void (GLAPIENTRY * PFNGLSHADINGRATEIMAGEBARRIERNVPROC) (GLenum order); +typedef void (GLAPIENTRY * PFNGLSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint first, GLsizei count, const GLenum* rates); +typedef void (GLAPIENTRY * PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC) (GLenum rate, GLuint samples, const GLint* locations); + +#define glBindShadingRateImageNV GLEW_GET_FUN(__glewBindShadingRateImageNV) +#define glGetShadingRateImagePaletteNV GLEW_GET_FUN(__glewGetShadingRateImagePaletteNV) +#define glGetShadingRateSampleLocationivNV GLEW_GET_FUN(__glewGetShadingRateSampleLocationivNV) +#define glShadingRateImageBarrierNV GLEW_GET_FUN(__glewShadingRateImageBarrierNV) +#define glShadingRateImagePaletteNV GLEW_GET_FUN(__glewShadingRateImagePaletteNV) +#define glShadingRateSampleOrderCustomNV GLEW_GET_FUN(__glewShadingRateSampleOrderCustomNV) + +#define GLEW_NV_shading_rate_image GLEW_GET_VAR(__GLEW_NV_shading_rate_image) + +#endif /* GL_NV_shading_rate_image */ + /* ---------------------- GL_NV_shadow_samplers_array ---------------------- */ #ifndef GL_NV_shadow_samplers_array @@ -16908,6 +18068,19 @@ typedef void (GLAPIENTRY * PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV #endif /* GL_NV_vdpau_interop */ +/* -------------------------- GL_NV_vdpau_interop2 ------------------------- */ + +#ifndef GL_NV_vdpau_interop2 +#define GL_NV_vdpau_interop2 1 + +typedef GLvdpauSurfaceNV (GLAPIENTRY * PFNGLVDPAUREGISTERVIDEOSURFACEWITHPICTURESTRUCTURENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames, GLboolean isFrameStructure); + +#define glVDPAURegisterVideoSurfaceWithPictureStructureNV GLEW_GET_FUN(__glewVDPAURegisterVideoSurfaceWithPictureStructureNV) + +#define GLEW_NV_vdpau_interop2 GLEW_GET_VAR(__GLEW_NV_vdpau_interop2) + +#endif /* GL_NV_vdpau_interop2 */ + /* ------------------------ GL_NV_vertex_array_range ----------------------- */ #ifndef GL_NV_vertex_array_range @@ -17472,6 +18645,96 @@ typedef void (GLAPIENTRY * PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swi #endif /* GL_NV_viewport_swizzle */ +/* ---------------------------- GL_OES_EGL_image --------------------------- */ + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 + +typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GLAPIENTRY * PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); + +#define glEGLImageTargetRenderbufferStorageOES GLEW_GET_FUN(__glewEGLImageTargetRenderbufferStorageOES) +#define glEGLImageTargetTexture2DOES GLEW_GET_FUN(__glewEGLImageTargetTexture2DOES) + +#define GLEW_OES_EGL_image GLEW_GET_VAR(__GLEW_OES_EGL_image) + +#endif /* GL_OES_EGL_image */ + +/* ----------------------- GL_OES_EGL_image_external ----------------------- */ + +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 + +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 + +#define GLEW_OES_EGL_image_external GLEW_GET_VAR(__GLEW_OES_EGL_image_external) + +#endif /* GL_OES_EGL_image_external */ + +/* -------------------- GL_OES_EGL_image_external_essl3 -------------------- */ + +#ifndef GL_OES_EGL_image_external_essl3 +#define GL_OES_EGL_image_external_essl3 1 + +#define GLEW_OES_EGL_image_external_essl3 GLEW_GET_VAR(__GLEW_OES_EGL_image_external_essl3) + +#endif /* GL_OES_EGL_image_external_essl3 */ + +/* --------------------- GL_OES_blend_equation_separate -------------------- */ + +#ifndef GL_OES_blend_equation_separate +#define GL_OES_blend_equation_separate 1 + +#define GL_BLEND_EQUATION_RGB_OES 0x8009 +#define GL_BLEND_EQUATION_ALPHA_OES 0x883D + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha); + +#define glBlendEquationSeparateOES GLEW_GET_FUN(__glewBlendEquationSeparateOES) + +#define GLEW_OES_blend_equation_separate GLEW_GET_VAR(__GLEW_OES_blend_equation_separate) + +#endif /* GL_OES_blend_equation_separate */ + +/* ----------------------- GL_OES_blend_func_separate ---------------------- */ + +#ifndef GL_OES_blend_func_separate +#define GL_OES_blend_func_separate 1 + +#define GL_BLEND_DST_RGB_OES 0x80C8 +#define GL_BLEND_SRC_RGB_OES 0x80C9 +#define GL_BLEND_DST_ALPHA_OES 0x80CA +#define GL_BLEND_SRC_ALPHA_OES 0x80CB + +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + +#define glBlendFuncSeparateOES GLEW_GET_FUN(__glewBlendFuncSeparateOES) + +#define GLEW_OES_blend_func_separate GLEW_GET_VAR(__GLEW_OES_blend_func_separate) + +#endif /* GL_OES_blend_func_separate */ + +/* ------------------------- GL_OES_blend_subtract ------------------------- */ + +#ifndef GL_OES_blend_subtract +#define GL_OES_blend_subtract 1 + +#define GL_FUNC_ADD_OES 0x8006 +#define GL_BLEND_EQUATION_OES 0x8009 +#define GL_FUNC_SUBTRACT_OES 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONOESPROC) (GLenum mode); + +#define glBlendEquationOES GLEW_GET_FUN(__glewBlendEquationOES) + +#define GLEW_OES_blend_subtract GLEW_GET_VAR(__GLEW_OES_blend_subtract) + +#endif /* GL_OES_blend_subtract */ + /* ------------------------ GL_OES_byte_coordinates ------------------------ */ #ifndef GL_OES_byte_coordinates @@ -17481,6 +18744,1100 @@ typedef void (GLAPIENTRY * PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swi #endif /* GL_OES_byte_coordinates */ +/* ------------------ GL_OES_compressed_ETC1_RGB8_texture ------------------ */ + +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 + +#define GL_ETC1_RGB8_OES 0x8D64 + +#define GLEW_OES_compressed_ETC1_RGB8_texture GLEW_GET_VAR(__GLEW_OES_compressed_ETC1_RGB8_texture) + +#endif /* GL_OES_compressed_ETC1_RGB8_texture */ + +/* ------------------- GL_OES_compressed_paletted_texture ------------------ */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 + +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 + +#define GLEW_OES_compressed_paletted_texture GLEW_GET_VAR(__GLEW_OES_compressed_paletted_texture) + +#endif /* GL_OES_compressed_paletted_texture */ + +/* --------------------------- GL_OES_copy_image --------------------------- */ + +#ifndef GL_OES_copy_image +#define GL_OES_copy_image 1 + +typedef void (GLAPIENTRY * PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); + +#define glCopyImageSubDataOES GLEW_GET_FUN(__glewCopyImageSubDataOES) + +#define GLEW_OES_copy_image GLEW_GET_VAR(__GLEW_OES_copy_image) + +#endif /* GL_OES_copy_image */ + +/* ----------------------------- GL_OES_depth24 ---------------------------- */ + +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 + +#define GL_DEPTH_COMPONENT24_OES 0x81A6 + +#define GLEW_OES_depth24 GLEW_GET_VAR(__GLEW_OES_depth24) + +#endif /* GL_OES_depth24 */ + +/* ----------------------------- GL_OES_depth32 ---------------------------- */ + +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 + +#define GL_DEPTH_COMPONENT32_OES 0x81A7 + +#define GLEW_OES_depth32 GLEW_GET_VAR(__GLEW_OES_depth32) + +#endif /* GL_OES_depth32 */ + +/* -------------------------- GL_OES_depth_texture ------------------------- */ + +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 + +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_INT 0x1405 +#define GL_DEPTH_COMPONENT 0x1902 + +#define GLEW_OES_depth_texture GLEW_GET_VAR(__GLEW_OES_depth_texture) + +#endif /* GL_OES_depth_texture */ + +/* --------------------- GL_OES_depth_texture_cube_map --------------------- */ + +#ifndef GL_OES_depth_texture_cube_map +#define GL_OES_depth_texture_cube_map 1 + +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_INT 0x1405 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_DEPTH24_STENCIL8_OES 0x88F0 + +#define GLEW_OES_depth_texture_cube_map GLEW_GET_VAR(__GLEW_OES_depth_texture_cube_map) + +#endif /* GL_OES_depth_texture_cube_map */ + +/* ---------------------- GL_OES_draw_buffers_indexed ---------------------- */ + +#ifndef GL_OES_draw_buffers_indexed +#define GL_OES_draw_buffers_indexed 1 + +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GLAPIENTRY * PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GLAPIENTRY * PFNGLCOLORMASKIOESPROC) (GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (GLAPIENTRY * PFNGLDISABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GLAPIENTRY * PFNGLENABLEIOESPROC) (GLenum target, GLuint index); +typedef GLboolean (GLAPIENTRY * PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index); + +#define glBlendEquationSeparateiOES GLEW_GET_FUN(__glewBlendEquationSeparateiOES) +#define glBlendEquationiOES GLEW_GET_FUN(__glewBlendEquationiOES) +#define glBlendFuncSeparateiOES GLEW_GET_FUN(__glewBlendFuncSeparateiOES) +#define glBlendFunciOES GLEW_GET_FUN(__glewBlendFunciOES) +#define glColorMaskiOES GLEW_GET_FUN(__glewColorMaskiOES) +#define glDisableiOES GLEW_GET_FUN(__glewDisableiOES) +#define glEnableiOES GLEW_GET_FUN(__glewEnableiOES) +#define glIsEnablediOES GLEW_GET_FUN(__glewIsEnablediOES) + +#define GLEW_OES_draw_buffers_indexed GLEW_GET_VAR(__GLEW_OES_draw_buffers_indexed) + +#endif /* GL_OES_draw_buffers_indexed */ + +/* -------------------------- GL_OES_draw_texture -------------------------- */ + +#ifndef GL_OES_draw_texture +#define GL_OES_draw_texture 1 + +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D + +#define GLEW_OES_draw_texture GLEW_GET_VAR(__GLEW_OES_draw_texture) + +#endif /* GL_OES_draw_texture */ + +/* ----------------------- GL_OES_element_index_uint ----------------------- */ + +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 + +#define GL_UNSIGNED_INT 0x1405 + +#define GLEW_OES_element_index_uint GLEW_GET_VAR(__GLEW_OES_element_index_uint) + +#endif /* GL_OES_element_index_uint */ + +/* --------------------- GL_OES_extended_matrix_palette -------------------- */ + +#ifndef GL_OES_extended_matrix_palette +#define GL_OES_extended_matrix_palette 1 + +#define GLEW_OES_extended_matrix_palette GLEW_GET_VAR(__GLEW_OES_extended_matrix_palette) + +#endif /* GL_OES_extended_matrix_palette */ + +/* ------------------------ GL_OES_fbo_render_mipmap ----------------------- */ + +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 + +#define GLEW_OES_fbo_render_mipmap GLEW_GET_VAR(__GLEW_OES_fbo_render_mipmap) + +#endif /* GL_OES_fbo_render_mipmap */ + +/* --------------------- GL_OES_fragment_precision_high -------------------- */ + +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 + +#define GLEW_OES_fragment_precision_high GLEW_GET_VAR(__GLEW_OES_fragment_precision_high) + +#endif /* GL_OES_fragment_precision_high */ + +/* ----------------------- GL_OES_framebuffer_object ----------------------- */ + +#ifndef GL_OES_framebuffer_object +#define GL_OES_framebuffer_object 1 + +#define GL_NONE_OES 0 +#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 +#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 +#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD +#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 +#define GL_DEPTH_ATTACHMENT_OES 0x8D00 +#define GL_STENCIL_ATTACHMENT_OES 0x8D20 +#define GL_FRAMEBUFFER_OES 0x8D40 +#define GL_RENDERBUFFER_OES 0x8D41 +#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 +#define GL_RGB565_OES 0x8D62 + +typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); +typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); +typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); +typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GLAPIENTRY * PFNGLGENERATEMIPMAPOESPROC) (GLenum target); +typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); +typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); +typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + +#define glBindFramebufferOES GLEW_GET_FUN(__glewBindFramebufferOES) +#define glBindRenderbufferOES GLEW_GET_FUN(__glewBindRenderbufferOES) +#define glCheckFramebufferStatusOES GLEW_GET_FUN(__glewCheckFramebufferStatusOES) +#define glDeleteFramebuffersOES GLEW_GET_FUN(__glewDeleteFramebuffersOES) +#define glDeleteRenderbuffersOES GLEW_GET_FUN(__glewDeleteRenderbuffersOES) +#define glFramebufferRenderbufferOES GLEW_GET_FUN(__glewFramebufferRenderbufferOES) +#define glFramebufferTexture2DOES GLEW_GET_FUN(__glewFramebufferTexture2DOES) +#define glGenFramebuffersOES GLEW_GET_FUN(__glewGenFramebuffersOES) +#define glGenRenderbuffersOES GLEW_GET_FUN(__glewGenRenderbuffersOES) +#define glGenerateMipmapOES GLEW_GET_FUN(__glewGenerateMipmapOES) +#define glGetFramebufferAttachmentParameterivOES GLEW_GET_FUN(__glewGetFramebufferAttachmentParameterivOES) +#define glGetRenderbufferParameterivOES GLEW_GET_FUN(__glewGetRenderbufferParameterivOES) +#define glIsFramebufferOES GLEW_GET_FUN(__glewIsFramebufferOES) +#define glIsRenderbufferOES GLEW_GET_FUN(__glewIsRenderbufferOES) +#define glRenderbufferStorageOES GLEW_GET_FUN(__glewRenderbufferStorageOES) + +#define GLEW_OES_framebuffer_object GLEW_GET_VAR(__GLEW_OES_framebuffer_object) + +#endif /* GL_OES_framebuffer_object */ + +/* ----------------------- GL_OES_geometry_point_size ---------------------- */ + +#ifndef GL_OES_geometry_point_size +#define GL_OES_geometry_point_size 1 + +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_LINES_ADJACENCY_OES 0xA +#define GL_LINE_STRIP_ADJACENCY_OES 0xB +#define GL_TRIANGLES_ADJACENCY_OES 0xC +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0xD +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 + +#define GLEW_OES_geometry_point_size GLEW_GET_VAR(__GLEW_OES_geometry_point_size) + +#endif /* GL_OES_geometry_point_size */ + +/* ------------------------- GL_OES_geometry_shader ------------------------ */ + +#ifndef GL_OES_geometry_shader +#define GL_OES_geometry_shader 1 + +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_LINES_ADJACENCY_OES 0xA +#define GL_LINE_STRIP_ADJACENCY_OES 0xB +#define GL_TRIANGLES_ADJACENCY_OES 0xC +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0xD +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 + +#define GLEW_OES_geometry_shader GLEW_GET_VAR(__GLEW_OES_geometry_shader) + +#endif /* GL_OES_geometry_shader */ + +/* ----------------------- GL_OES_get_program_binary ----------------------- */ + +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 + +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF + +typedef void (GLAPIENTRY * PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum *binaryFormat, void*binary); +typedef void (GLAPIENTRY * PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); + +#define glGetProgramBinaryOES GLEW_GET_FUN(__glewGetProgramBinaryOES) +#define glProgramBinaryOES GLEW_GET_FUN(__glewProgramBinaryOES) + +#define GLEW_OES_get_program_binary GLEW_GET_VAR(__GLEW_OES_get_program_binary) + +#endif /* GL_OES_get_program_binary */ + +/* --------------------------- GL_OES_gpu_shader5 -------------------------- */ + +#ifndef GL_OES_gpu_shader5 +#define GL_OES_gpu_shader5 1 + +#define GLEW_OES_gpu_shader5 GLEW_GET_VAR(__GLEW_OES_gpu_shader5) + +#endif /* GL_OES_gpu_shader5 */ + +/* ---------------------------- GL_OES_mapbuffer --------------------------- */ + +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 + +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD + +typedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params); +typedef void * (GLAPIENTRY * PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFEROESPROC) (GLenum target); + +#define glGetBufferPointervOES GLEW_GET_FUN(__glewGetBufferPointervOES) +#define glMapBufferOES GLEW_GET_FUN(__glewMapBufferOES) +#define glUnmapBufferOES GLEW_GET_FUN(__glewUnmapBufferOES) + +#define GLEW_OES_mapbuffer GLEW_GET_VAR(__GLEW_OES_mapbuffer) + +#endif /* GL_OES_mapbuffer */ + +/* --------------------------- GL_OES_matrix_get --------------------------- */ + +#ifndef GL_OES_matrix_get +#define GL_OES_matrix_get 1 + +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898d +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898e +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898f + +#define GLEW_OES_matrix_get GLEW_GET_VAR(__GLEW_OES_matrix_get) + +#endif /* GL_OES_matrix_get */ + +/* ------------------------- GL_OES_matrix_palette ------------------------- */ + +#ifndef GL_OES_matrix_palette +#define GL_OES_matrix_palette 1 + +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E + +typedef void (GLAPIENTRY * PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint index); +typedef void (GLAPIENTRY * PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, void *pointer); +typedef void (GLAPIENTRY * PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, void *pointer); + +#define glCurrentPaletteMatrixOES GLEW_GET_FUN(__glewCurrentPaletteMatrixOES) +#define glMatrixIndexPointerOES GLEW_GET_FUN(__glewMatrixIndexPointerOES) +#define glWeightPointerOES GLEW_GET_FUN(__glewWeightPointerOES) + +#define GLEW_OES_matrix_palette GLEW_GET_VAR(__GLEW_OES_matrix_palette) + +#endif /* GL_OES_matrix_palette */ + +/* ---------------------- GL_OES_packed_depth_stencil ---------------------- */ + +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 + +#define GLEW_OES_packed_depth_stencil GLEW_GET_VAR(__GLEW_OES_packed_depth_stencil) + +#endif /* GL_OES_packed_depth_stencil */ + +/* ------------------------ GL_OES_point_size_array ------------------------ */ + +#ifndef GL_OES_point_size_array +#define GL_OES_point_size_array 1 + +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F + +#define GLEW_OES_point_size_array GLEW_GET_VAR(__GLEW_OES_point_size_array) + +#endif /* GL_OES_point_size_array */ + +/* -------------------------- GL_OES_point_sprite -------------------------- */ + +#ifndef GL_OES_point_sprite +#define GL_OES_point_sprite 1 + +#define GL_POINT_SPRITE_OES 0x8861 +#define GL_COORD_REPLACE_OES 0x8862 + +#define GLEW_OES_point_sprite GLEW_GET_VAR(__GLEW_OES_point_sprite) + +#endif /* GL_OES_point_sprite */ + +/* --------------------------- GL_OES_read_format -------------------------- */ + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 + +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B + +#define GLEW_OES_read_format GLEW_GET_VAR(__GLEW_OES_read_format) + +#endif /* GL_OES_read_format */ + +/* --------------------- GL_OES_required_internalformat -------------------- */ + +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 + +#define GL_ALPHA8_OES 0x803C +#define GL_LUMINANCE8_OES 0x8040 +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_RGB8_OES 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGBA8_OES 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#define GL_RGB565_OES 0x8D62 + +#define GLEW_OES_required_internalformat GLEW_GET_VAR(__GLEW_OES_required_internalformat) + +#endif /* GL_OES_required_internalformat */ + +/* --------------------------- GL_OES_rgb8_rgba8 --------------------------- */ + +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 + +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 + +#define GLEW_OES_rgb8_rgba8 GLEW_GET_VAR(__GLEW_OES_rgb8_rgba8) + +#endif /* GL_OES_rgb8_rgba8 */ + +/* ------------------------- GL_OES_sample_shading ------------------------- */ + +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 + +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 + +typedef void (GLAPIENTRY * PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); + +#define glMinSampleShadingOES GLEW_GET_FUN(__glewMinSampleShadingOES) + +#define GLEW_OES_sample_shading GLEW_GET_VAR(__GLEW_OES_sample_shading) + +#endif /* GL_OES_sample_shading */ + +/* ------------------------ GL_OES_sample_variables ------------------------ */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 + +#define GLEW_OES_sample_variables GLEW_GET_VAR(__GLEW_OES_sample_variables) + +#endif /* GL_OES_sample_variables */ + +/* ----------------------- GL_OES_shader_image_atomic ---------------------- */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 + +#define GLEW_OES_shader_image_atomic GLEW_GET_VAR(__GLEW_OES_shader_image_atomic) + +#endif /* GL_OES_shader_image_atomic */ + +/* ------------------------ GL_OES_shader_io_blocks ------------------------ */ + +#ifndef GL_OES_shader_io_blocks +#define GL_OES_shader_io_blocks 1 + +#define GLEW_OES_shader_io_blocks GLEW_GET_VAR(__GLEW_OES_shader_io_blocks) + +#endif /* GL_OES_shader_io_blocks */ + +/* ---------------- GL_OES_shader_multisample_interpolation ---------------- */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 + +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D + +#define GLEW_OES_shader_multisample_interpolation GLEW_GET_VAR(__GLEW_OES_shader_multisample_interpolation) + +#endif /* GL_OES_shader_multisample_interpolation */ + +/* ------------------------ GL_OES_single_precision ------------------------ */ + +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 + +typedef void (GLAPIENTRY * PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +typedef void (GLAPIENTRY * PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat* equation); +typedef void (GLAPIENTRY * PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); +typedef void (GLAPIENTRY * PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (GLAPIENTRY * PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat* equation); +typedef void (GLAPIENTRY * PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); + +#define glClearDepthfOES GLEW_GET_FUN(__glewClearDepthfOES) +#define glClipPlanefOES GLEW_GET_FUN(__glewClipPlanefOES) +#define glDepthRangefOES GLEW_GET_FUN(__glewDepthRangefOES) +#define glFrustumfOES GLEW_GET_FUN(__glewFrustumfOES) +#define glGetClipPlanefOES GLEW_GET_FUN(__glewGetClipPlanefOES) +#define glOrthofOES GLEW_GET_FUN(__glewOrthofOES) + +#define GLEW_OES_single_precision GLEW_GET_VAR(__GLEW_OES_single_precision) + +#endif /* GL_OES_single_precision */ + +/* ---------------------- GL_OES_standard_derivatives ---------------------- */ + +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 + +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B + +#define GLEW_OES_standard_derivatives GLEW_GET_VAR(__GLEW_OES_standard_derivatives) + +#endif /* GL_OES_standard_derivatives */ + +/* ---------------------------- GL_OES_stencil1 ---------------------------- */ + +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 + +#define GL_STENCIL_INDEX1_OES 0x8D46 + +#define GLEW_OES_stencil1 GLEW_GET_VAR(__GLEW_OES_stencil1) + +#endif /* GL_OES_stencil1 */ + +/* ---------------------------- GL_OES_stencil4 ---------------------------- */ + +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 + +#define GL_STENCIL_INDEX4_OES 0x8D47 + +#define GLEW_OES_stencil4 GLEW_GET_VAR(__GLEW_OES_stencil4) + +#endif /* GL_OES_stencil4 */ + +/* ---------------------------- GL_OES_stencil8 ---------------------------- */ + +#ifndef GL_OES_stencil8 +#define GL_OES_stencil8 1 + +#define GL_STENCIL_INDEX8_OES 0x8D48 + +#define GLEW_OES_stencil8 GLEW_GET_VAR(__GLEW_OES_stencil8) + +#endif /* GL_OES_stencil8 */ + +/* ----------------------- GL_OES_surfaceless_context ---------------------- */ + +#ifndef GL_OES_surfaceless_context +#define GL_OES_surfaceless_context 1 + +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 + +#define GLEW_OES_surfaceless_context GLEW_GET_VAR(__GLEW_OES_surfaceless_context) + +#endif /* GL_OES_surfaceless_context */ + +/* --------------------- GL_OES_tessellation_point_size -------------------- */ + +#ifndef GL_OES_tessellation_point_size +#define GL_OES_tessellation_point_size 1 + +#define GL_QUADS_OES 0x0007 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_PATCHES_OES 0xE +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 + +#define GLEW_OES_tessellation_point_size GLEW_GET_VAR(__GLEW_OES_tessellation_point_size) + +#endif /* GL_OES_tessellation_point_size */ + +/* ----------------------- GL_OES_tessellation_shader ---------------------- */ + +#ifndef GL_OES_tessellation_shader +#define GL_OES_tessellation_shader 1 + +#define GL_QUADS_OES 0x0007 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_PATCHES_OES 0xE +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 + +#define GLEW_OES_tessellation_shader GLEW_GET_VAR(__GLEW_OES_tessellation_shader) + +#endif /* GL_OES_tessellation_shader */ + +/* --------------------------- GL_OES_texture_3D --------------------------- */ + +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 + +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 + +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); + +#define glCompressedTexImage3DOES GLEW_GET_FUN(__glewCompressedTexImage3DOES) +#define glCompressedTexSubImage3DOES GLEW_GET_FUN(__glewCompressedTexSubImage3DOES) +#define glCopyTexSubImage3DOES GLEW_GET_FUN(__glewCopyTexSubImage3DOES) +#define glFramebufferTexture3DOES GLEW_GET_FUN(__glewFramebufferTexture3DOES) +#define glTexImage3DOES GLEW_GET_FUN(__glewTexImage3DOES) +#define glTexSubImage3DOES GLEW_GET_FUN(__glewTexSubImage3DOES) + +#define GLEW_OES_texture_3D GLEW_GET_VAR(__GLEW_OES_texture_3D) + +#endif /* GL_OES_texture_3D */ + +/* ---------------------- GL_OES_texture_border_clamp ---------------------- */ + +#ifndef GL_OES_texture_border_clamp +#define GL_OES_texture_border_clamp 1 + +#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 +#define GL_CLAMP_TO_BORDER_OES 0x812D + +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint* params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint* params); + +#define glGetSamplerParameterIivOES GLEW_GET_FUN(__glewGetSamplerParameterIivOES) +#define glGetSamplerParameterIuivOES GLEW_GET_FUN(__glewGetSamplerParameterIuivOES) +#define glGetTexParameterIivOES GLEW_GET_FUN(__glewGetTexParameterIivOES) +#define glGetTexParameterIuivOES GLEW_GET_FUN(__glewGetTexParameterIuivOES) +#define glSamplerParameterIivOES GLEW_GET_FUN(__glewSamplerParameterIivOES) +#define glSamplerParameterIuivOES GLEW_GET_FUN(__glewSamplerParameterIuivOES) +#define glTexParameterIivOES GLEW_GET_FUN(__glewTexParameterIivOES) +#define glTexParameterIuivOES GLEW_GET_FUN(__glewTexParameterIuivOES) + +#define GLEW_OES_texture_border_clamp GLEW_GET_VAR(__GLEW_OES_texture_border_clamp) + +#endif /* GL_OES_texture_border_clamp */ + +/* ------------------------- GL_OES_texture_buffer ------------------------- */ + +#ifndef GL_OES_texture_buffer +#define GL_OES_texture_buffer 1 + +#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A +#define GL_TEXTURE_BUFFER_OES 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D +#define GL_SAMPLER_BUFFER_OES 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 +#define GL_IMAGE_BUFFER_OES 0x9051 +#define GL_INT_IMAGE_BUFFER_OES 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D +#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F + +typedef void (GLAPIENTRY * PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GLAPIENTRY * PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); + +#define glTexBufferOES GLEW_GET_FUN(__glewTexBufferOES) +#define glTexBufferRangeOES GLEW_GET_FUN(__glewTexBufferRangeOES) + +#define GLEW_OES_texture_buffer GLEW_GET_VAR(__GLEW_OES_texture_buffer) + +#endif /* GL_OES_texture_buffer */ + +/* -------------------- GL_OES_texture_compression_astc -------------------- */ + +#ifndef GL_OES_texture_compression_astc +#define GL_OES_texture_compression_astc 1 + +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 + +#define GLEW_OES_texture_compression_astc GLEW_GET_VAR(__GLEW_OES_texture_compression_astc) + +#endif /* GL_OES_texture_compression_astc */ + +/* ------------------------ GL_OES_texture_cube_map ------------------------ */ + +#ifndef GL_OES_texture_cube_map +#define GL_OES_texture_cube_map 1 + +#define GL_TEXTURE_GEN_MODE_OES 0x2500 +#define GL_NORMAL_MAP_OES 0x8511 +#define GL_REFLECTION_MAP_OES 0x8512 +#define GL_TEXTURE_CUBE_MAP_OES 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C +#define GL_TEXTURE_GEN_STR_OES 0x8D60 + +typedef void (GLAPIENTRY * PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat* params); +typedef void (GLAPIENTRY * PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint* params); +typedef void (GLAPIENTRY * PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed* params); +typedef void (GLAPIENTRY * PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); +typedef void (GLAPIENTRY * PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat* params); +typedef void (GLAPIENTRY * PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); +typedef void (GLAPIENTRY * PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint* params); +typedef void (GLAPIENTRY * PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (GLAPIENTRY * PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed* params); + +#define glGetTexGenfvOES GLEW_GET_FUN(__glewGetTexGenfvOES) +#define glGetTexGenivOES GLEW_GET_FUN(__glewGetTexGenivOES) +#define glGetTexGenxvOES GLEW_GET_FUN(__glewGetTexGenxvOES) +#define glTexGenfOES GLEW_GET_FUN(__glewTexGenfOES) +#define glTexGenfvOES GLEW_GET_FUN(__glewTexGenfvOES) +#define glTexGeniOES GLEW_GET_FUN(__glewTexGeniOES) +#define glTexGenivOES GLEW_GET_FUN(__glewTexGenivOES) +#define glTexGenxOES GLEW_GET_FUN(__glewTexGenxOES) +#define glTexGenxvOES GLEW_GET_FUN(__glewTexGenxvOES) + +#define GLEW_OES_texture_cube_map GLEW_GET_VAR(__GLEW_OES_texture_cube_map) + +#endif /* GL_OES_texture_cube_map */ + +/* --------------------- GL_OES_texture_cube_map_array --------------------- */ + +#ifndef GL_OES_texture_cube_map_array +#define GL_OES_texture_cube_map_array 1 + +#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A + +#define GLEW_OES_texture_cube_map_array GLEW_GET_VAR(__GLEW_OES_texture_cube_map_array) + +#endif /* GL_OES_texture_cube_map_array */ + +/* ---------------------- GL_OES_texture_env_crossbar ---------------------- */ + +#ifndef GL_OES_texture_env_crossbar +#define GL_OES_texture_env_crossbar 1 + +#define GLEW_OES_texture_env_crossbar GLEW_GET_VAR(__GLEW_OES_texture_env_crossbar) + +#endif /* GL_OES_texture_env_crossbar */ + +/* --------------------- GL_OES_texture_mirrored_repeat -------------------- */ + +#ifndef GL_OES_texture_mirrored_repeat +#define GL_OES_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT 0x8370 + +#define GLEW_OES_texture_mirrored_repeat GLEW_GET_VAR(__GLEW_OES_texture_mirrored_repeat) + +#endif /* GL_OES_texture_mirrored_repeat */ + +/* -------------------------- GL_OES_texture_npot -------------------------- */ + +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 + +#define GLEW_OES_texture_npot GLEW_GET_VAR(__GLEW_OES_texture_npot) + +#endif /* GL_OES_texture_npot */ + +/* ------------------------ GL_OES_texture_stencil8 ------------------------ */ + +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 + +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GLEW_OES_texture_stencil8 GLEW_GET_VAR(__GLEW_OES_texture_stencil8) + +#endif /* GL_OES_texture_stencil8 */ + +/* -------------- GL_OES_texture_storage_multisample_2d_array -------------- */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 + +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D + +typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); + +#define glTexStorage3DMultisampleOES GLEW_GET_FUN(__glewTexStorage3DMultisampleOES) + +#define GLEW_OES_texture_storage_multisample_2d_array GLEW_GET_VAR(__GLEW_OES_texture_storage_multisample_2d_array) + +#endif /* GL_OES_texture_storage_multisample_2d_array */ + +/* -------------------------- GL_OES_texture_view -------------------------- */ + +#ifndef GL_OES_texture_view +#define GL_OES_texture_view 1 + +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF + +typedef void (GLAPIENTRY * PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); + +#define glTextureViewOES GLEW_GET_FUN(__glewTextureViewOES) + +#define GLEW_OES_texture_view GLEW_GET_VAR(__GLEW_OES_texture_view) + +#endif /* GL_OES_texture_view */ + +/* ----------------------- GL_OES_vertex_array_object ---------------------- */ + +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 + +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 + +typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GLAPIENTRY * PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint* arrays); +typedef void (GLAPIENTRY * PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint* arrays); +typedef GLboolean (GLAPIENTRY * PFNGLISVERTEXARRAYOESPROC) (GLuint array); + +#define glBindVertexArrayOES GLEW_GET_FUN(__glewBindVertexArrayOES) +#define glDeleteVertexArraysOES GLEW_GET_FUN(__glewDeleteVertexArraysOES) +#define glGenVertexArraysOES GLEW_GET_FUN(__glewGenVertexArraysOES) +#define glIsVertexArrayOES GLEW_GET_FUN(__glewIsVertexArrayOES) + +#define GLEW_OES_vertex_array_object GLEW_GET_VAR(__GLEW_OES_vertex_array_object) + +#endif /* GL_OES_vertex_array_object */ + +/* ------------------------ GL_OES_vertex_half_float ----------------------- */ + +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 + +#define GL_HALF_FLOAT_OES 0x8D61 + +#define GLEW_OES_vertex_half_float GLEW_GET_VAR(__GLEW_OES_vertex_half_float) + +#endif /* GL_OES_vertex_half_float */ + +/* --------------------- GL_OES_vertex_type_10_10_10_2 --------------------- */ + +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 + +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 + +#define GLEW_OES_vertex_type_10_10_10_2 GLEW_GET_VAR(__GLEW_OES_vertex_type_10_10_10_2) + +#endif /* GL_OES_vertex_type_10_10_10_2 */ + /* ---------------------------- GL_OML_interlace --------------------------- */ #ifndef GL_OML_interlace @@ -17532,8 +19889,10 @@ typedef void (GLAPIENTRY * PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swi #define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +typedef void (GLAPIENTRY * PFNGLNAMEDFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); #define glFramebufferTextureMultiviewOVR GLEW_GET_FUN(__glewFramebufferTextureMultiviewOVR) +#define glNamedFramebufferTextureMultiviewOVR GLEW_GET_FUN(__glewNamedFramebufferTextureMultiviewOVR) #define GLEW_OVR_multiview GLEW_GET_VAR(__GLEW_OVR_multiview) @@ -17623,6 +19982,15 @@ typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) ( #endif /* GL_PGI_vertex_hints */ +/* ----------------------- GL_QCOM_YUV_texture_gather ---------------------- */ + +#ifndef GL_QCOM_YUV_texture_gather +#define GL_QCOM_YUV_texture_gather 1 + +#define GLEW_QCOM_YUV_texture_gather GLEW_GET_VAR(__GLEW_QCOM_YUV_texture_gather) + +#endif /* GL_QCOM_YUV_texture_gather */ + /* --------------------------- GL_QCOM_alpha_test -------------------------- */ #ifndef GL_QCOM_alpha_test @@ -17776,6 +20144,48 @@ typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void); #endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */ +/* ----------------- GL_QCOM_shader_framebuffer_fetch_rate ----------------- */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_rate +#define GL_QCOM_shader_framebuffer_fetch_rate 1 + +#define GLEW_QCOM_shader_framebuffer_fetch_rate GLEW_GET_VAR(__GLEW_QCOM_shader_framebuffer_fetch_rate) + +#endif /* GL_QCOM_shader_framebuffer_fetch_rate */ + +/* ------------------------ GL_QCOM_texture_foveated ----------------------- */ + +#ifndef GL_QCOM_texture_foveated +#define GL_QCOM_texture_foveated 1 + +#define GL_FOVEATION_ENABLE_BIT_QCOM 0x1 +#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x2 +#define GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB +#define GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM 0x8BFC +#define GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 0x8BFD +#define GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 0x8BFE +#define GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM 0x8BFF + +typedef void (GLAPIENTRY * PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC) (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); + +#define glTextureFoveationParametersQCOM GLEW_GET_FUN(__glewTextureFoveationParametersQCOM) + +#define GLEW_QCOM_texture_foveated GLEW_GET_VAR(__GLEW_QCOM_texture_foveated) + +#endif /* GL_QCOM_texture_foveated */ + +/* --------------- GL_QCOM_texture_foveated_subsampled_layout -------------- */ + +#ifndef GL_QCOM_texture_foveated_subsampled_layout +#define GL_QCOM_texture_foveated_subsampled_layout 1 + +#define GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM 0x4 +#define GL_MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM 0x8FA1 + +#define GLEW_QCOM_texture_foveated_subsampled_layout GLEW_GET_VAR(__GLEW_QCOM_texture_foveated_subsampled_layout) + +#endif /* GL_QCOM_texture_foveated_subsampled_layout */ + /* ------------------------ GL_QCOM_tiled_rendering ------------------------ */ #ifndef GL_QCOM_tiled_rendering @@ -18740,8 +21150,8 @@ typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum typedef void (GLAPIENTRY * PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* params); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum value, GLfloat* data); typedef void (GLAPIENTRY * PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum value, GLint* data); -typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat* data); -typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat* data); +typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint* data); #define glFragmentColorMaterialSGIX GLEW_GET_FUN(__glewFragmentColorMaterialSGIX) #define glFragmentLightModelfSGIX GLEW_GET_FUN(__glewFragmentLightModelfSGIX) @@ -19808,6 +22218,17 @@ typedef void (GLAPIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat* tc, #endif /* GL_SUN_vertex */ +/* -------------------------- GL_VIV_shader_binary ------------------------- */ + +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 + +#define GL_SHADER_BINARY_VIV 0x8FC4 + +#define GLEW_VIV_shader_binary GLEW_GET_VAR(__GLEW_VIV_shader_binary) + +#endif /* GL_VIV_shader_binary */ + /* -------------------------- GL_WIN_phong_shading ------------------------- */ #ifndef GL_WIN_phong_shading @@ -20172,6 +22593,9 @@ GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC __glewBlendEquationSepa GLEW_FUN_EXPORT PFNGLBLENDFUNCINDEXEDAMDPROC __glewBlendFuncIndexedAMD; GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC __glewBlendFuncSeparateIndexedAMD; +GLEW_FUN_EXPORT PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC __glewNamedRenderbufferStorageMultisampleAdvancedAMD; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC __glewRenderbufferStorageMultisampleAdvancedAMD; + GLEW_FUN_EXPORT PFNGLFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC __glewFramebufferSamplePositionsfvAMD; GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERFVAMDPROC __glewGetFramebufferParameterfvAMD; GLEW_FUN_EXPORT PFNGLGETNAMEDFRAMEBUFFERPARAMETERFVAMDPROC __glewGetNamedFramebufferParameterfvAMD; @@ -21223,6 +23647,9 @@ GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4IVATIPROC __glewVertexStream4ivATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SATIPROC __glewVertexStream4sATI; GLEW_FUN_EXPORT PFNGLVERTEXSTREAM4SVATIPROC __glewVertexStream4svATI; +GLEW_FUN_EXPORT PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC __glewEGLImageTargetTexStorageEXT; +GLEW_FUN_EXPORT PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC __glewEGLImageTargetTextureStorageEXT; + GLEW_FUN_EXPORT PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC __glewDrawArraysInstancedBaseInstanceEXT; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC __glewDrawElementsInstancedBaseInstanceEXT; GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC __glewDrawElementsInstancedBaseVertexBaseInstanceEXT; @@ -21249,6 +23676,8 @@ GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEEXTPROC __glewNamedBufferStorageEXT; GLEW_FUN_EXPORT PFNGLCLEARTEXIMAGEEXTPROC __glewClearTexImageEXT; GLEW_FUN_EXPORT PFNGLCLEARTEXSUBIMAGEEXTPROC __glewClearTexSubImageEXT; +GLEW_FUN_EXPORT PFNGLCLIPCONTROLEXTPROC __glewClipControlEXT; + GLEW_FUN_EXPORT PFNGLCOLORSUBTABLEEXTPROC __glewColorSubTableEXT; GLEW_FUN_EXPORT PFNGLCOPYCOLORSUBTABLEEXTPROC __glewCopyColorSubTableEXT; @@ -21509,6 +23938,17 @@ GLEW_FUN_EXPORT PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC __glewVertexArrayVertexOffse GLEW_FUN_EXPORT PFNGLDISCARDFRAMEBUFFEREXTPROC __glewDiscardFramebufferEXT; +GLEW_FUN_EXPORT PFNGLBEGINQUERYEXTPROC __glewBeginQueryEXT; +GLEW_FUN_EXPORT PFNGLDELETEQUERIESEXTPROC __glewDeleteQueriesEXT; +GLEW_FUN_EXPORT PFNGLENDQUERYEXTPROC __glewEndQueryEXT; +GLEW_FUN_EXPORT PFNGLGENQUERIESEXTPROC __glewGenQueriesEXT; +GLEW_FUN_EXPORT PFNGLGETINTEGER64VEXTPROC __glewGetInteger64vEXT; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTIVEXTPROC __glewGetQueryObjectivEXT; +GLEW_FUN_EXPORT PFNGLGETQUERYOBJECTUIVEXTPROC __glewGetQueryObjectuivEXT; +GLEW_FUN_EXPORT PFNGLGETQUERYIVEXTPROC __glewGetQueryivEXT; +GLEW_FUN_EXPORT PFNGLISQUERYEXTPROC __glewIsQueryEXT; +GLEW_FUN_EXPORT PFNGLQUERYCOUNTEREXTPROC __glewQueryCounterEXT; + GLEW_FUN_EXPORT PFNGLDRAWBUFFERSEXTPROC __glewDrawBuffersEXT; GLEW_FUN_EXPORT PFNGLCOLORMASKINDEXEDEXTPROC __glewColorMaskIndexedEXT; @@ -21537,6 +23977,9 @@ GLEW_FUN_EXPORT PFNGLDRAWELEMENTSINSTANCEDEXTPROC __glewDrawElementsInstancedEXT GLEW_FUN_EXPORT PFNGLDRAWRANGEELEMENTSEXTPROC __glewDrawRangeElementsEXT; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKEXTPROC __glewDrawTransformFeedbackEXT; +GLEW_FUN_EXPORT PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC __glewDrawTransformFeedbackInstancedEXT; + GLEW_FUN_EXPORT PFNGLBUFFERSTORAGEEXTERNALEXTPROC __glewBufferStorageExternalEXT; GLEW_FUN_EXPORT PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC __glewNamedBufferStorageExternalEXT; @@ -21712,6 +24155,8 @@ GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETEXTPROC __glewPolygonOffsetEXT; GLEW_FUN_EXPORT PFNGLPOLYGONOFFSETCLAMPEXTPROC __glewPolygonOffsetClampEXT; +GLEW_FUN_EXPORT PFNGLPRIMITIVEBOUNDINGBOXEXTPROC __glewPrimitiveBoundingBoxEXT; + GLEW_FUN_EXPORT PFNGLPROVOKINGVERTEXEXTPROC __glewProvokingVertexEXT; GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONNVPROC __glewCoverageModulationNV; @@ -21719,6 +24164,10 @@ GLEW_FUN_EXPORT PFNGLCOVERAGEMODULATIONTABLENVPROC __glewCoverageModulationTable GLEW_FUN_EXPORT PFNGLGETCOVERAGEMODULATIONTABLENVPROC __glewGetCoverageModulationTableNV; GLEW_FUN_EXPORT PFNGLRASTERSAMPLESEXTPROC __glewRasterSamplesEXT; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMFVEXTPROC __glewGetnUniformfvEXT; +GLEW_FUN_EXPORT PFNGLGETNUNIFORMIVEXTPROC __glewGetnUniformivEXT; +GLEW_FUN_EXPORT PFNGLREADNPIXELSEXTPROC __glewReadnPixelsEXT; + GLEW_FUN_EXPORT PFNGLBEGINSCENEEXTPROC __glewBeginSceneEXT; GLEW_FUN_EXPORT PFNGLENDSCENEEXTPROC __glewEndSceneEXT; @@ -21757,6 +24206,8 @@ GLEW_FUN_EXPORT PFNGLACTIVEPROGRAMEXTPROC __glewActiveProgramEXT; GLEW_FUN_EXPORT PFNGLCREATESHADERPROGRAMEXTPROC __glewCreateShaderProgramEXT; GLEW_FUN_EXPORT PFNGLUSESHADERPROGRAMEXTPROC __glewUseShaderProgramEXT; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC __glewFramebufferFetchBarrierEXT; + GLEW_FUN_EXPORT PFNGLBINDIMAGETEXTUREEXTPROC __glewBindImageTextureEXT; GLEW_FUN_EXPORT PFNGLMEMORYBARRIEREXTPROC __glewMemoryBarrierEXT; @@ -21773,10 +24224,17 @@ GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE1DEXTPROC __glewTexSubImage1DEXT; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE2DEXTPROC __glewTexSubImage2DEXT; GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DEXTPROC __glewTexSubImage3DEXT; +GLEW_FUN_EXPORT PFNGLPATCHPARAMETERIEXTPROC __glewPatchParameteriEXT; + GLEW_FUN_EXPORT PFNGLTEXIMAGE3DEXTPROC __glewTexImage3DEXT; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC __glewFramebufferTextureLayerEXT; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVEXTPROC __glewGetSamplerParameterIivEXT; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVEXTPROC __glewGetSamplerParameterIuivEXT; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVEXTPROC __glewSamplerParameterIivEXT; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVEXTPROC __glewSamplerParameterIuivEXT; + GLEW_FUN_EXPORT PFNGLTEXBUFFEREXTPROC __glewTexBufferEXT; GLEW_FUN_EXPORT PFNGLCLEARCOLORIIEXTPROC __glewClearColorIiEXT; @@ -21917,6 +24375,19 @@ GLEW_FUN_EXPORT PFNGLSECONDARYCOLORPOINTERLISTIBMPROC __glewSecondaryColorPointe GLEW_FUN_EXPORT PFNGLTEXCOORDPOINTERLISTIBMPROC __glewTexCoordPointerListIBM; GLEW_FUN_EXPORT PFNGLVERTEXPOINTERLISTIBMPROC __glewVertexPointerListIBM; +GLEW_FUN_EXPORT PFNGLGETTEXTUREHANDLEIMGPROC __glewGetTextureHandleIMG; +GLEW_FUN_EXPORT PFNGLGETTEXTURESAMPLERHANDLEIMGPROC __glewGetTextureSamplerHandleIMG; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC __glewProgramUniformHandleui64IMG; +GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC __glewProgramUniformHandleui64vIMG; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64IMGPROC __glewUniformHandleui64IMG; +GLEW_FUN_EXPORT PFNGLUNIFORMHANDLEUI64VIMGPROC __glewUniformHandleui64vIMG; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC __glewFramebufferTexture2DDownsampleIMG; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC __glewFramebufferTextureLayerDownsampleIMG; + +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC __glewFramebufferTexture2DMultisampleIMG; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC __glewRenderbufferStorageMultisampleIMG; + GLEW_FUN_EXPORT PFNGLMAPTEXTURE2DINTELPROC __glewMapTexture2DINTEL; GLEW_FUN_EXPORT PFNGLSYNCTEXTUREINTELPROC __glewSyncTextureINTEL; GLEW_FUN_EXPORT PFNGLUNMAPTEXTURE2DINTELPROC __glewUnmapTexture2DINTEL; @@ -21966,6 +24437,9 @@ GLEW_FUN_EXPORT PFNGLDRAWBUFFERREGIONPROC __glewDrawBufferRegion; GLEW_FUN_EXPORT PFNGLNEWBUFFERREGIONPROC __glewNewBufferRegion; GLEW_FUN_EXPORT PFNGLREADBUFFERREGIONPROC __glewReadBufferRegion; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERPARAMETERIMESAPROC __glewFramebufferParameteriMESA; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC __glewGetFramebufferParameterivMESA; + GLEW_FUN_EXPORT PFNGLRESIZEBUFFERSMESAPROC __glewResizeBuffersMESA; GLEW_FUN_EXPORT PFNGLWINDOWPOS2DMESAPROC __glewWindowPos2dMESA; @@ -21996,13 +24470,26 @@ GLEW_FUN_EXPORT PFNGLWINDOWPOS4SVMESAPROC __glewWindowPos4svMESA; GLEW_FUN_EXPORT PFNGLBEGINCONDITIONALRENDERNVXPROC __glewBeginConditionalRenderNVX; GLEW_FUN_EXPORT PFNGLENDCONDITIONALRENDERNVXPROC __glewEndConditionalRenderNVX; +GLEW_FUN_EXPORT PFNGLASYNCCOPYBUFFERSUBDATANVXPROC __glewAsyncCopyBufferSubDataNVX; +GLEW_FUN_EXPORT PFNGLASYNCCOPYIMAGESUBDATANVXPROC __glewAsyncCopyImageSubDataNVX; +GLEW_FUN_EXPORT PFNGLMULTICASTSCISSORARRAYVNVXPROC __glewMulticastScissorArrayvNVX; +GLEW_FUN_EXPORT PFNGLMULTICASTVIEWPORTARRAYVNVXPROC __glewMulticastViewportArrayvNVX; +GLEW_FUN_EXPORT PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC __glewMulticastViewportPositionWScaleNVX; +GLEW_FUN_EXPORT PFNGLUPLOADGPUMASKNVXPROC __glewUploadGpuMaskNVX; + GLEW_FUN_EXPORT PFNGLLGPUCOPYIMAGESUBDATANVXPROC __glewLGPUCopyImageSubDataNVX; GLEW_FUN_EXPORT PFNGLLGPUINTERLOCKNVXPROC __glewLGPUInterlockNVX; GLEW_FUN_EXPORT PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC __glewLGPUNamedBufferSubDataNVX; +GLEW_FUN_EXPORT PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC __glewClientWaitSemaphoreui64NVX; +GLEW_FUN_EXPORT PFNGLSIGNALSEMAPHOREUI64NVXPROC __glewSignalSemaphoreui64NVX; +GLEW_FUN_EXPORT PFNGLWAITSEMAPHOREUI64NVXPROC __glewWaitSemaphoreui64NVX; + GLEW_FUN_EXPORT PFNGLSTEREOPARAMETERFNVPROC __glewStereoParameterfNV; GLEW_FUN_EXPORT PFNGLSTEREOPARAMETERINVPROC __glewStereoParameteriNV; +GLEW_FUN_EXPORT PFNGLALPHATOCOVERAGEDITHERCONTROLNVPROC __glewAlphaToCoverageDitherControlNV; + GLEW_FUN_EXPORT PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC __glewMultiDrawArraysIndirectBindlessNV; GLEW_FUN_EXPORT PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC __glewMultiDrawElementsIndirectBindlessNV; @@ -22227,6 +24714,18 @@ GLEW_FUN_EXPORT PFNGLVERTEXATTRIBDIVISORNVPROC __glewVertexAttribDivisorNV; GLEW_FUN_EXPORT PFNGLGETINTERNALFORMATSAMPLEIVNVPROC __glewGetInternalformatSampleivNV; +GLEW_FUN_EXPORT PFNGLBUFFERATTACHMEMORYNVPROC __glewBufferAttachMemoryNV; +GLEW_FUN_EXPORT PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC __glewGetMemoryObjectDetachedResourcesuivNV; +GLEW_FUN_EXPORT PFNGLNAMEDBUFFERATTACHMEMORYNVPROC __glewNamedBufferAttachMemoryNV; +GLEW_FUN_EXPORT PFNGLRESETMEMORYOBJECTPARAMETERNVPROC __glewResetMemoryObjectParameterNV; +GLEW_FUN_EXPORT PFNGLTEXATTACHMEMORYNVPROC __glewTexAttachMemoryNV; +GLEW_FUN_EXPORT PFNGLTEXTUREATTACHMEMORYNVPROC __glewTextureAttachMemoryNV; + +GLEW_FUN_EXPORT PFNGLDRAWMESHTASKSINDIRECTNVPROC __glewDrawMeshTasksIndirectNV; +GLEW_FUN_EXPORT PFNGLDRAWMESHTASKSNVPROC __glewDrawMeshTasksNV; +GLEW_FUN_EXPORT PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC __glewMultiDrawMeshTasksIndirectCountNV; +GLEW_FUN_EXPORT PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC __glewMultiDrawMeshTasksIndirectNV; + GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X3FVNVPROC __glewUniformMatrix2x3fvNV; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX2X4FVNVPROC __glewUniformMatrix2x4fvNV; GLEW_FUN_EXPORT PFNGLUNIFORMMATRIX3X2FVNVPROC __glewUniformMatrix3x2fvNV; @@ -22329,6 +24828,8 @@ GLEW_FUN_EXPORT PFNGLPRESENTFRAMEKEYEDNVPROC __glewPresentFrameKeyedNV; GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTINDEXNVPROC __glewPrimitiveRestartIndexNV; GLEW_FUN_EXPORT PFNGLPRIMITIVERESTARTNVPROC __glewPrimitiveRestartNV; +GLEW_FUN_EXPORT PFNGLREADBUFFERNVPROC __glewReadBufferNV; + GLEW_FUN_EXPORT PFNGLCOMBINERINPUTNVPROC __glewCombinerInputNV; GLEW_FUN_EXPORT PFNGLCOMBINEROUTPUTNVPROC __glewCombinerOutputNV; GLEW_FUN_EXPORT PFNGLCOMBINERPARAMETERFNVPROC __glewCombinerParameterfNV; @@ -22348,6 +24849,10 @@ GLEW_FUN_EXPORT PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC __glewGetCombinerStagePar GLEW_FUN_EXPORT PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewFramebufferSampleLocationsfvNV; GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC __glewNamedFramebufferSampleLocationsfvNV; +GLEW_FUN_EXPORT PFNGLRESOLVEDEPTHVALUESNVPROC __glewResolveDepthValuesNV; + +GLEW_FUN_EXPORT PFNGLSCISSOREXCLUSIVEARRAYVNVPROC __glewScissorExclusiveArrayvNV; +GLEW_FUN_EXPORT PFNGLSCISSOREXCLUSIVENVPROC __glewScissorExclusiveNV; GLEW_FUN_EXPORT PFNGLGETBUFFERPARAMETERUI64VNVPROC __glewGetBufferParameterui64vNV; GLEW_FUN_EXPORT PFNGLGETINTEGERUI64VNVPROC __glewGetIntegerui64vNV; @@ -22363,6 +24868,13 @@ GLEW_FUN_EXPORT PFNGLPROGRAMUNIFORMUI64VNVPROC __glewProgramUniformui64vNV; GLEW_FUN_EXPORT PFNGLUNIFORMUI64NVPROC __glewUniformui64NV; GLEW_FUN_EXPORT PFNGLUNIFORMUI64VNVPROC __glewUniformui64vNV; +GLEW_FUN_EXPORT PFNGLBINDSHADINGRATEIMAGENVPROC __glewBindShadingRateImageNV; +GLEW_FUN_EXPORT PFNGLGETSHADINGRATEIMAGEPALETTENVPROC __glewGetShadingRateImagePaletteNV; +GLEW_FUN_EXPORT PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC __glewGetShadingRateSampleLocationivNV; +GLEW_FUN_EXPORT PFNGLSHADINGRATEIMAGEBARRIERNVPROC __glewShadingRateImageBarrierNV; +GLEW_FUN_EXPORT PFNGLSHADINGRATEIMAGEPALETTENVPROC __glewShadingRateImagePaletteNV; +GLEW_FUN_EXPORT PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC __glewShadingRateSampleOrderCustomNV; + GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DNVPROC __glewCompressedTexImage3DNV; GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DNVPROC __glewCompressedTexSubImage3DNV; GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DNVPROC __glewCopyTexSubImage3DNV; @@ -22410,6 +24922,8 @@ GLEW_FUN_EXPORT PFNGLVDPAUSURFACEACCESSNVPROC __glewVDPAUSurfaceAccessNV; GLEW_FUN_EXPORT PFNGLVDPAUUNMAPSURFACESNVPROC __glewVDPAUUnmapSurfacesNV; GLEW_FUN_EXPORT PFNGLVDPAUUNREGISTERSURFACENVPROC __glewVDPAUUnregisterSurfaceNV; +GLEW_FUN_EXPORT PFNGLVDPAUREGISTERVIDEOSURFACEWITHPICTURESTRUCTURENVPROC __glewVDPAURegisterVideoSurfaceWithPictureStructureNV; + GLEW_FUN_EXPORT PFNGLFLUSHVERTEXARRAYRANGENVPROC __glewFlushVertexArrayRangeNV; GLEW_FUN_EXPORT PFNGLVERTEXARRAYRANGENVPROC __glewVertexArrayRangeNV; @@ -22539,7 +25053,102 @@ GLEW_FUN_EXPORT PFNGLVIEWPORTINDEXEDFVNVPROC __glewViewportIndexedfvNV; GLEW_FUN_EXPORT PFNGLVIEWPORTSWIZZLENVPROC __glewViewportSwizzleNV; +GLEW_FUN_EXPORT PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __glewEGLImageTargetRenderbufferStorageOES; +GLEW_FUN_EXPORT PFNGLEGLIMAGETARGETTEXTURE2DOESPROC __glewEGLImageTargetTexture2DOES; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEOESPROC __glewBlendEquationSeparateOES; + +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEOESPROC __glewBlendFuncSeparateOES; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONOESPROC __glewBlendEquationOES; + +GLEW_FUN_EXPORT PFNGLCOPYIMAGESUBDATAOESPROC __glewCopyImageSubDataOES; + +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONSEPARATEIOESPROC __glewBlendEquationSeparateiOES; +GLEW_FUN_EXPORT PFNGLBLENDEQUATIONIOESPROC __glewBlendEquationiOES; +GLEW_FUN_EXPORT PFNGLBLENDFUNCSEPARATEIOESPROC __glewBlendFuncSeparateiOES; +GLEW_FUN_EXPORT PFNGLBLENDFUNCIOESPROC __glewBlendFunciOES; +GLEW_FUN_EXPORT PFNGLCOLORMASKIOESPROC __glewColorMaskiOES; +GLEW_FUN_EXPORT PFNGLDISABLEIOESPROC __glewDisableiOES; +GLEW_FUN_EXPORT PFNGLENABLEIOESPROC __glewEnableiOES; +GLEW_FUN_EXPORT PFNGLISENABLEDIOESPROC __glewIsEnablediOES; + +GLEW_FUN_EXPORT PFNGLBINDFRAMEBUFFEROESPROC __glewBindFramebufferOES; +GLEW_FUN_EXPORT PFNGLBINDRENDERBUFFEROESPROC __glewBindRenderbufferOES; +GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSOESPROC __glewCheckFramebufferStatusOES; +GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSOESPROC __glewDeleteFramebuffersOES; +GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSOESPROC __glewDeleteRenderbuffersOES; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFEROESPROC __glewFramebufferRenderbufferOES; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DOESPROC __glewFramebufferTexture2DOES; +GLEW_FUN_EXPORT PFNGLGENFRAMEBUFFERSOESPROC __glewGenFramebuffersOES; +GLEW_FUN_EXPORT PFNGLGENRENDERBUFFERSOESPROC __glewGenRenderbuffersOES; +GLEW_FUN_EXPORT PFNGLGENERATEMIPMAPOESPROC __glewGenerateMipmapOES; +GLEW_FUN_EXPORT PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC __glewGetFramebufferAttachmentParameterivOES; +GLEW_FUN_EXPORT PFNGLGETRENDERBUFFERPARAMETERIVOESPROC __glewGetRenderbufferParameterivOES; +GLEW_FUN_EXPORT PFNGLISFRAMEBUFFEROESPROC __glewIsFramebufferOES; +GLEW_FUN_EXPORT PFNGLISRENDERBUFFEROESPROC __glewIsRenderbufferOES; +GLEW_FUN_EXPORT PFNGLRENDERBUFFERSTORAGEOESPROC __glewRenderbufferStorageOES; + +GLEW_FUN_EXPORT PFNGLGETPROGRAMBINARYOESPROC __glewGetProgramBinaryOES; +GLEW_FUN_EXPORT PFNGLPROGRAMBINARYOESPROC __glewProgramBinaryOES; + +GLEW_FUN_EXPORT PFNGLGETBUFFERPOINTERVOESPROC __glewGetBufferPointervOES; +GLEW_FUN_EXPORT PFNGLMAPBUFFEROESPROC __glewMapBufferOES; +GLEW_FUN_EXPORT PFNGLUNMAPBUFFEROESPROC __glewUnmapBufferOES; + +GLEW_FUN_EXPORT PFNGLCURRENTPALETTEMATRIXOESPROC __glewCurrentPaletteMatrixOES; +GLEW_FUN_EXPORT PFNGLMATRIXINDEXPOINTEROESPROC __glewMatrixIndexPointerOES; +GLEW_FUN_EXPORT PFNGLWEIGHTPOINTEROESPROC __glewWeightPointerOES; + +GLEW_FUN_EXPORT PFNGLMINSAMPLESHADINGOESPROC __glewMinSampleShadingOES; + +GLEW_FUN_EXPORT PFNGLCLEARDEPTHFOESPROC __glewClearDepthfOES; +GLEW_FUN_EXPORT PFNGLCLIPPLANEFOESPROC __glewClipPlanefOES; +GLEW_FUN_EXPORT PFNGLDEPTHRANGEFOESPROC __glewDepthRangefOES; +GLEW_FUN_EXPORT PFNGLFRUSTUMFOESPROC __glewFrustumfOES; +GLEW_FUN_EXPORT PFNGLGETCLIPPLANEFOESPROC __glewGetClipPlanefOES; +GLEW_FUN_EXPORT PFNGLORTHOFOESPROC __glewOrthofOES; + +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXIMAGE3DOESPROC __glewCompressedTexImage3DOES; +GLEW_FUN_EXPORT PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __glewCompressedTexSubImage3DOES; +GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DOESPROC __glewCopyTexSubImage3DOES; +GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DOESPROC __glewFramebufferTexture3DOES; +GLEW_FUN_EXPORT PFNGLTEXIMAGE3DOESPROC __glewTexImage3DOES; +GLEW_FUN_EXPORT PFNGLTEXSUBIMAGE3DOESPROC __glewTexSubImage3DOES; + +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIIVOESPROC __glewGetSamplerParameterIivOES; +GLEW_FUN_EXPORT PFNGLGETSAMPLERPARAMETERIUIVOESPROC __glewGetSamplerParameterIuivOES; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIIVOESPROC __glewGetTexParameterIivOES; +GLEW_FUN_EXPORT PFNGLGETTEXPARAMETERIUIVOESPROC __glewGetTexParameterIuivOES; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIIVOESPROC __glewSamplerParameterIivOES; +GLEW_FUN_EXPORT PFNGLSAMPLERPARAMETERIUIVOESPROC __glewSamplerParameterIuivOES; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIIVOESPROC __glewTexParameterIivOES; +GLEW_FUN_EXPORT PFNGLTEXPARAMETERIUIVOESPROC __glewTexParameterIuivOES; + +GLEW_FUN_EXPORT PFNGLTEXBUFFEROESPROC __glewTexBufferOES; +GLEW_FUN_EXPORT PFNGLTEXBUFFERRANGEOESPROC __glewTexBufferRangeOES; + +GLEW_FUN_EXPORT PFNGLGETTEXGENFVOESPROC __glewGetTexGenfvOES; +GLEW_FUN_EXPORT PFNGLGETTEXGENIVOESPROC __glewGetTexGenivOES; +GLEW_FUN_EXPORT PFNGLGETTEXGENXVOESPROC __glewGetTexGenxvOES; +GLEW_FUN_EXPORT PFNGLTEXGENFOESPROC __glewTexGenfOES; +GLEW_FUN_EXPORT PFNGLTEXGENFVOESPROC __glewTexGenfvOES; +GLEW_FUN_EXPORT PFNGLTEXGENIOESPROC __glewTexGeniOES; +GLEW_FUN_EXPORT PFNGLTEXGENIVOESPROC __glewTexGenivOES; +GLEW_FUN_EXPORT PFNGLTEXGENXOESPROC __glewTexGenxOES; +GLEW_FUN_EXPORT PFNGLTEXGENXVOESPROC __glewTexGenxvOES; + +GLEW_FUN_EXPORT PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC __glewTexStorage3DMultisampleOES; + +GLEW_FUN_EXPORT PFNGLTEXTUREVIEWOESPROC __glewTextureViewOES; + +GLEW_FUN_EXPORT PFNGLBINDVERTEXARRAYOESPROC __glewBindVertexArrayOES; +GLEW_FUN_EXPORT PFNGLDELETEVERTEXARRAYSOESPROC __glewDeleteVertexArraysOES; +GLEW_FUN_EXPORT PFNGLGENVERTEXARRAYSOESPROC __glewGenVertexArraysOES; +GLEW_FUN_EXPORT PFNGLISVERTEXARRAYOESPROC __glewIsVertexArrayOES; + GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __glewFramebufferTextureMultiviewOVR; +GLEW_FUN_EXPORT PFNGLNAMEDFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __glewNamedFramebufferTextureMultiviewOVR; GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC __glewFramebufferTextureMultisampleMultiviewOVR; @@ -22569,6 +25178,8 @@ GLEW_FUN_EXPORT PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC __glewFramebufferFov GLEW_FUN_EXPORT PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC __glewFramebufferFetchBarrierQCOM; +GLEW_FUN_EXPORT PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC __glewTextureFoveationParametersQCOM; + GLEW_FUN_EXPORT PFNGLENDTILINGQCOMPROC __glewEndTilingQCOM; GLEW_FUN_EXPORT PFNGLSTARTTILINGQCOMPROC __glewStartTilingQCOM; @@ -22843,9 +25454,11 @@ GLEW_VAR_EXPORT GLboolean __GLEW_AMD_conservative_depth; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_debug_output; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_depth_clamp_separate; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_draw_buffers_blend; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_framebuffer_multisample_advanced; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_framebuffer_sample_positions; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gcn_shader; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_half_float; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_half_float_fetch; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_int16; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_gpu_shader_int64; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_interleaved_elements; @@ -22861,6 +25474,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_AMD_seamless_cubemap_per_texture; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_atomic_counter_ops; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_ballot; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_explicit_vertex_parameter; +GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_image_load_store_lod; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_export; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_stencil_value_export; GLEW_VAR_EXPORT GLboolean __GLEW_AMD_shader_trinary_minmax; @@ -23089,6 +25703,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_ARM_mali_shader_binary; GLEW_VAR_EXPORT GLboolean __GLEW_ARM_rgba8; GLEW_VAR_EXPORT GLboolean __GLEW_ARM_shader_framebuffer_fetch; GLEW_VAR_EXPORT GLboolean __GLEW_ARM_shader_framebuffer_fetch_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_ARM_texture_unnormalized_coordinates; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_point_sprites; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_combine3; GLEW_VAR_EXPORT GLboolean __GLEW_ATIX_texture_env_route; @@ -23110,11 +25725,14 @@ GLEW_VAR_EXPORT GLboolean __GLEW_ATI_texture_mirror_once; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_attrib_array_object; GLEW_VAR_EXPORT GLboolean __GLEW_ATI_vertex_streams; -GLEW_VAR_EXPORT GLboolean __GLEW_EGL_KHR_context_flush_control; -GLEW_VAR_EXPORT GLboolean __GLEW_EGL_NV_robustness_video_memory_purge; +GLEW_VAR_EXPORT GLboolean __GLEW_DMP_program_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_DMP_shader_binary; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_422_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_Cg_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_EGL_image_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_EGL_image_external_wrap_modes; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_EGL_image_storage; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_EGL_sync; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_YUV_target; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_abgr; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_base_instance; @@ -23129,6 +25747,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_minmax; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_blend_subtract; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_buffer_storage; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clear_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_control; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_cull_distance; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_clip_volume_hint; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cmyka; @@ -23146,14 +25765,17 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_cull_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_label; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_debug_marker; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_bounds_test; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_depth_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_direct_state_access; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_discard_framebuffer; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_disjoint_timer_query; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers2; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_buffers_indexed; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_elements_base_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_instanced; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_range_elements; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_draw_transform_feedback; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_external_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_float_blend; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_fog_coord; @@ -23190,6 +25812,10 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisample_compatibility; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisampled_render_to_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multisampled_render_to_texture2; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multiview_draw_buffers; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multiview_tessellation_geometry_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multiview_texture_multisample; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_multiview_timer_query; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_occlusion_query_boolean; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_depth_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_float; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_packed_pixels; @@ -23201,12 +25827,15 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_point_parameters; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_polygon_offset_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_post_depth_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_primitive_bounding_box; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_protected_textures; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_provoking_vertex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_pvrtc_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_raster_multisample; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_read_format_bgra; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_render_snorm; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_rescale_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_robustness; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sRGB_write_control; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_scene_marker; @@ -23217,6 +25846,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_semaphore_win32; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_shader_objects; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_separate_specular_color; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_framebuffer_fetch; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_framebuffer_fetch_non_coherent; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_group_vote; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_formatted; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shader_image_load_store; @@ -23232,13 +25862,18 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shadow_samplers; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_shared_texture_palette; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sparse_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_sparse_texture2; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_static_vertex_array; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_clear_tag; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_two_side; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_stencil_wrap; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_subtexture; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_tessellation_point_size; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_tessellation_shader; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture3D; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_array; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_buffer_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_astc_decode_mode; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_astc_decode_mode_rgb9e5; @@ -23247,6 +25882,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_dxt1; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_latc; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_rgtc; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_compression_s3tc_srgb; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_cube_map_array; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_edge_clamp; @@ -23257,18 +25893,22 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_env_dot3; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_anisotropic; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_filter_minmax; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_format_BGRA8888; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_format_sRGB_override; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_integer; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_lod_bias; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_mirror_clamp_to_edge; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_norm16; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_object; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_perturb_normal; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_query_lod; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rectangle; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_rg; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_R8; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_RG8; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_sRGB_decode; +GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shadow_lod; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_shared_exponent; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_snorm; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_texture_storage; @@ -23287,6 +25927,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_EXT_vertex_weighting; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_win32_keyed_mutex; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_window_rectangles; GLEW_VAR_EXPORT GLboolean __GLEW_EXT_x11_sync_object; +GLEW_VAR_EXPORT GLboolean __GLEW_FJ_shader_binary_GCCSO; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_frame_terminator; GLEW_VAR_EXPORT GLboolean __GLEW_GREMEDY_string_marker; GLEW_VAR_EXPORT GLboolean __GLEW_HP_convolution_border_modes; @@ -23299,14 +25940,26 @@ GLEW_VAR_EXPORT GLboolean __GLEW_IBM_rasterpos_clip; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_static_data; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_texture_mirrored_repeat; GLEW_VAR_EXPORT GLboolean __GLEW_IBM_vertex_array_lists; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_bindless_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_framebuffer_downsample; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_multisampled_render_to_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_program_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_read_format; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_shader_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_texture_compression_pvrtc; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_texture_compression_pvrtc2; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_texture_env_enhanced_fixed_function; +GLEW_VAR_EXPORT GLboolean __GLEW_IMG_texture_filter_cubic; GLEW_VAR_EXPORT GLboolean __GLEW_INGR_color_clamp; GLEW_VAR_EXPORT GLboolean __GLEW_INGR_interlace_read; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_blackhole_render; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_conservative_rasterization; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_fragment_shader_ordering; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_framebuffer_CMAA; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_map_texture; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_parallel_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_performance_query; +GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_shader_integer_functions2; GLEW_VAR_EXPORT GLboolean __GLEW_INTEL_texture_scissor; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_blend_equation_advanced_coherent; @@ -23316,20 +25969,26 @@ GLEW_VAR_EXPORT GLboolean __GLEW_KHR_no_error; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_parallel_shader_compile; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robust_buffer_access_behavior; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_robustness; +GLEW_VAR_EXPORT GLboolean __GLEW_KHR_shader_subgroup; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_hdr; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_ldr; GLEW_VAR_EXPORT GLboolean __GLEW_KHR_texture_compression_astc_sliced_3d; GLEW_VAR_EXPORT GLboolean __GLEW_KTX_buffer_region; GLEW_VAR_EXPORT GLboolean __GLEW_MESAX_texture_stack; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_framebuffer_flip_y; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_pack_invert; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_program_binary_formats; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_resize_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_shader_integer_functions; +GLEW_VAR_EXPORT GLboolean __GLEW_MESA_tile_raster_order; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_window_pos; GLEW_VAR_EXPORT GLboolean __GLEW_MESA_ycbcr_texture; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_blend_equation_advanced_multi_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_conditional_render; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_memory_info; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_gpu_multicast2; GLEW_VAR_EXPORT GLboolean __GLEW_NVX_linked_gpu_multicast; +GLEW_VAR_EXPORT GLboolean __GLEW_NVX_progress_fence; GLEW_VAR_EXPORT GLboolean __GLEW_NV_3dvision_settings; GLEW_VAR_EXPORT GLboolean __GLEW_NV_EGL_stream_consumer_external; GLEW_VAR_EXPORT GLboolean __GLEW_NV_alpha_to_coverage_dither_control; @@ -23344,16 +26003,20 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_blend_square; GLEW_VAR_EXPORT GLboolean __GLEW_NV_clip_space_w_scaling; GLEW_VAR_EXPORT GLboolean __GLEW_NV_command_list; GLEW_VAR_EXPORT GLboolean __GLEW_NV_compute_program5; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_compute_shader_derivatives; GLEW_VAR_EXPORT GLboolean __GLEW_NV_conditional_render; GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster; GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_dilate; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_pre_snap; GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_pre_snap_triangles; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_conservative_raster_underestimation; GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_buffer; GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_depth_to_color; GLEW_VAR_EXPORT GLboolean __GLEW_NV_copy_image; GLEW_VAR_EXPORT GLboolean __GLEW_NV_deep_texture3D; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_buffer_float; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_nonlinear; GLEW_VAR_EXPORT GLboolean __GLEW_NV_depth_range_unclamped; GLEW_VAR_EXPORT GLboolean __GLEW_NV_draw_buffers; GLEW_VAR_EXPORT GLboolean __GLEW_NV_draw_instanced; @@ -23372,6 +26035,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program4; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_program_option; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_shader_barycentric; GLEW_VAR_EXPORT GLboolean __GLEW_NV_fragment_shader_interlock; GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_blit; GLEW_VAR_EXPORT GLboolean __GLEW_NV_framebuffer_mixed_samples; @@ -23392,6 +26056,8 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_image_formats; GLEW_VAR_EXPORT GLboolean __GLEW_NV_instanced_arrays; GLEW_VAR_EXPORT GLboolean __GLEW_NV_internalformat_sample_query; GLEW_VAR_EXPORT GLboolean __GLEW_NV_light_max_exponent; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_memory_attachment; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_mesh_shader; GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_coverage; GLEW_VAR_EXPORT GLboolean __GLEW_NV_multisample_filter_hint; GLEW_VAR_EXPORT GLboolean __GLEW_NV_non_square_matrices; @@ -23411,15 +26077,20 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_point_sprite; GLEW_VAR_EXPORT GLboolean __GLEW_NV_polygon_mode; GLEW_VAR_EXPORT GLboolean __GLEW_NV_present_video; GLEW_VAR_EXPORT GLboolean __GLEW_NV_primitive_restart; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_query_resource_tag; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_read_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_read_buffer_front; GLEW_VAR_EXPORT GLboolean __GLEW_NV_read_depth; GLEW_VAR_EXPORT GLboolean __GLEW_NV_read_depth_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_NV_read_stencil; GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners; GLEW_VAR_EXPORT GLboolean __GLEW_NV_register_combiners2; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_representative_fragment_test; GLEW_VAR_EXPORT GLboolean __GLEW_NV_robustness_video_memory_purge; GLEW_VAR_EXPORT GLboolean __GLEW_NV_sRGB_formats; GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_locations; GLEW_VAR_EXPORT GLboolean __GLEW_NV_sample_mask_override_coverage; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_scissor_exclusive; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_counters; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_float64; @@ -23428,8 +26099,11 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_atomic_int64; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_buffer_load; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_noperspective_interpolation; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_storage_buffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_subgroup_partitioned; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_texture_footprint; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_group; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shader_thread_shuffle; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_shading_rate_image; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shadow_samplers_array; GLEW_VAR_EXPORT GLboolean __GLEW_NV_shadow_samplers_cube; GLEW_VAR_EXPORT GLboolean __GLEW_NV_stereo_view_rendering; @@ -23456,6 +26130,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback; GLEW_VAR_EXPORT GLboolean __GLEW_NV_transform_feedback2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_uniform_buffer_unified_memory; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop; +GLEW_VAR_EXPORT GLboolean __GLEW_NV_vdpau_interop2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_array_range2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_vertex_attrib_integer_64bit; @@ -23470,7 +26145,68 @@ GLEW_VAR_EXPORT GLboolean __GLEW_NV_video_capture; GLEW_VAR_EXPORT GLboolean __GLEW_NV_viewport_array; GLEW_VAR_EXPORT GLboolean __GLEW_NV_viewport_array2; GLEW_VAR_EXPORT GLboolean __GLEW_NV_viewport_swizzle; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_EGL_image; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_EGL_image_external; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_EGL_image_external_essl3; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_blend_equation_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_blend_func_separate; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_blend_subtract; GLEW_VAR_EXPORT GLboolean __GLEW_OES_byte_coordinates; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_ETC1_RGB8_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_compressed_paletted_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_copy_image; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_depth24; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_depth32; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_depth_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_depth_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_draw_buffers_indexed; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_draw_texture; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_element_index_uint; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_extended_matrix_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_fbo_render_mipmap; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_fragment_precision_high; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_framebuffer_object; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_geometry_point_size; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_geometry_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_get_program_binary; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_gpu_shader5; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_mapbuffer; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_matrix_get; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_matrix_palette; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_packed_depth_stencil; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_point_size_array; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_point_sprite; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_read_format; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_required_internalformat; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_rgb8_rgba8; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_sample_shading; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_sample_variables; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_shader_image_atomic; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_shader_io_blocks; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_shader_multisample_interpolation; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_single_precision; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_standard_derivatives; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_stencil1; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_stencil4; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_stencil8; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_surfaceless_context; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_tessellation_point_size; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_tessellation_shader; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_3D; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_border_clamp; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_buffer; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_compression_astc; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_cube_map; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_cube_map_array; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_env_crossbar; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_mirrored_repeat; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_npot; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_stencil8; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_storage_multisample_2d_array; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_texture_view; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_vertex_array_object; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_vertex_half_float; +GLEW_VAR_EXPORT GLboolean __GLEW_OES_vertex_type_10_10_10_2; GLEW_VAR_EXPORT GLboolean __GLEW_OML_interlace; GLEW_VAR_EXPORT GLboolean __GLEW_OML_resample; GLEW_VAR_EXPORT GLboolean __GLEW_OML_subsample; @@ -23479,6 +26215,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_OVR_multiview2; GLEW_VAR_EXPORT GLboolean __GLEW_OVR_multiview_multisampled_render_to_texture; GLEW_VAR_EXPORT GLboolean __GLEW_PGI_misc_hints; GLEW_VAR_EXPORT GLboolean __GLEW_PGI_vertex_hints; +GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_YUV_texture_gather; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_alpha_test; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_binning_control; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_driver_control; @@ -23487,6 +26224,9 @@ GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_extended_get2; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_framebuffer_foveated; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_perfmon_global_mode; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_shader_framebuffer_fetch_noncoherent; +GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_shader_framebuffer_fetch_rate; +GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_texture_foveated; +GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_texture_foveated_subsampled_layout; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_tiled_rendering; GLEW_VAR_EXPORT GLboolean __GLEW_QCOM_writeonly_rendering; GLEW_VAR_EXPORT GLboolean __GLEW_REGAL_ES1_0_compatibility; @@ -23612,6 +26352,7 @@ GLEW_VAR_EXPORT GLboolean __GLEW_SUN_read_video_pixels; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_slice_accum; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_triangle_list; GLEW_VAR_EXPORT GLboolean __GLEW_SUN_vertex; +GLEW_VAR_EXPORT GLboolean __GLEW_VIV_shader_binary; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_phong_shading; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_scene_markerXXX; GLEW_VAR_EXPORT GLboolean __GLEW_WIN_specular_fog; @@ -23637,9 +26378,9 @@ GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; /* GLEW version info */ /* -VERSION 2.1.0 +VERSION 2.2.0 VERSION_MAJOR 2 -VERSION_MINOR 1 +VERSION_MINOR 2 VERSION_MICRO 0 */ diff --git a/meta/win/include/GL/glxew.h b/meta/win/include/GL/glxew.h index 7e39c2fd..0474ed5e 100644 --- a/meta/win/include/GL/glxew.h +++ b/meta/win/include/GL/glxew.h @@ -1,6 +1,6 @@ /* ** The OpenGL Extension Wrangler Library -** Copyright (C) 2008-2017, Nigel Stewart +** Copyright (C) 2008-2019, Nigel Stewart ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev @@ -98,7 +98,12 @@ #include #include #include -#include + +#ifndef GLEW_INCLUDE +# include +#else +# include GLEW_INCLUDE +#endif #ifdef __cplusplus extern "C" { @@ -392,6 +397,10 @@ typedef Bool ( * PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); #ifndef GLX_ARB_context_flush_control #define GLX_ARB_context_flush_control 1 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 + #define GLXEW_ARB_context_flush_control GLXEW_GET_VAR(__GLXEW_ARB_context_flush_control) #endif /* GLX_ARB_context_flush_control */ @@ -401,13 +410,13 @@ typedef Bool ( * PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); #ifndef GLX_ARB_create_context #define GLX_ARB_create_context 1 -#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 #define GLX_CONTEXT_FLAGS_ARB 0x2094 -typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int* attrib_list); #define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB) @@ -420,6 +429,8 @@ typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBCo #ifndef GLX_ARB_create_context_no_error #define GLX_ARB_create_context_no_error 1 +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 + #define GLXEW_ARB_create_context_no_error GLXEW_GET_VAR(__GLXEW_ARB_create_context_no_error) #endif /* GLX_ARB_create_context_no_error */ @@ -605,6 +616,20 @@ typedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, i #endif /* GLX_EXT_buffer_age */ +/* ------------------------ GLX_EXT_context_priority ----------------------- */ + +#ifndef GLX_EXT_context_priority +#define GLX_EXT_context_priority 1 + +#define GLX_CONTEXT_PRIORITY_LEVEL_EXT 0x3100 +#define GLX_CONTEXT_PRIORITY_HIGH_EXT 0x3101 +#define GLX_CONTEXT_PRIORITY_MEDIUM_EXT 0x3102 +#define GLX_CONTEXT_PRIORITY_LOW_EXT 0x3103 + +#define GLXEW_EXT_context_priority GLXEW_GET_VAR(__GLXEW_EXT_context_priority) + +#endif /* GLX_EXT_context_priority */ + /* ------------------- GLX_EXT_create_context_es2_profile ------------------ */ #ifndef GLX_EXT_create_context_es2_profile @@ -663,11 +688,13 @@ typedef XID GLXContextID; typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context); typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef Display* ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID); -typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute, int* value); #define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT) #define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT) +#define glXGetCurrentDisplayEXT GLXEW_GET_FUN(__glewXGetCurrentDisplayEXT) #define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT) #define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT) @@ -686,6 +713,15 @@ typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context #endif /* GLX_EXT_libglvnd */ +/* ----------------------- GLX_EXT_no_config_context ----------------------- */ + +#ifndef GLX_EXT_no_config_context +#define GLX_EXT_no_config_context 1 + +#define GLXEW_EXT_no_config_context GLXEW_GET_VAR(__GLXEW_EXT_no_config_context) + +#endif /* GLX_EXT_no_config_context */ + /* -------------------------- GLX_EXT_scene_marker ------------------------- */ #ifndef GLX_EXT_scene_marker @@ -757,8 +793,10 @@ typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, #define GLX_TEXTURE_1D_EXT 0x20DB #define GLX_TEXTURE_2D_EXT 0x20DC #define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_EXT 0x20DE #define GLX_FRONT_LEFT_EXT 0x20DE #define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_EXT 0x20E0 #define GLX_BACK_LEFT_EXT 0x20E0 #define GLX_BACK_RIGHT_EXT 0x20E1 #define GLX_AUX0_EXT 0x20E2 @@ -772,8 +810,8 @@ typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, #define GLX_AUX8_EXT 0x20EA #define GLX_AUX9_EXT 0x20EB -typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list); -typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer); +typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* dpy, GLXDrawable drawable, int buffer, const int* attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* dpy, GLXDrawable drawable, int buffer); #define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT) #define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT) @@ -866,7 +904,7 @@ typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawabl #ifndef GLX_MESA_pixmap_colormap #define GLX_MESA_pixmap_colormap 1 -typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo* visual, Pixmap pixmap, Colormap cmap); #define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA) @@ -890,12 +928,11 @@ typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo #define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B #define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C #define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D -#define GLX_RENDERER_ID_MESA 0x818E typedef Bool ( * PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int* value); typedef const char* ( * PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute); -typedef Bool ( * PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display* dpy, int screen, int renderer, int attribute, unsigned int *value); -typedef const char* ( * PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute); +typedef Bool ( * PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display* dpy, int screen, int renderer, int attribute, unsigned int* value); +typedef const char* ( * PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display* dpy, int screen, int renderer, int attribute); #define glXQueryCurrentRendererIntegerMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererIntegerMESA) #define glXQueryCurrentRendererStringMESA GLXEW_GET_FUN(__glewXQueryCurrentRendererStringMESA) @@ -911,7 +948,7 @@ typedef const char* ( * PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int sc #ifndef GLX_MESA_release_buffers #define GLX_MESA_release_buffers 1 -typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d); +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable drawable); #define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA) @@ -1002,6 +1039,21 @@ typedef Bool ( * PFNGLXDELAYBEFORESWAPNVPROC) (Display* dpy, GLXDrawable drawabl #endif /* GLX_NV_float_buffer */ +/* ------------------------ GLX_NV_multigpu_context ------------------------ */ + +#ifndef GLX_NV_multigpu_context +#define GLX_NV_multigpu_context 1 + +#define GLX_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE + +#define GLXEW_NV_multigpu_context GLXEW_GET_VAR(__GLXEW_NV_multigpu_context) + +#endif /* GLX_NV_multigpu_context */ + /* ---------------------- GLX_NV_multisample_coverage ---------------------- */ #ifndef GLX_NV_multisample_coverage @@ -1021,8 +1073,8 @@ typedef Bool ( * PFNGLXDELAYBEFORESWAPNVPROC) (Display* dpy, GLXDrawable drawabl #define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 -typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); -typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); +typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int* attrib_list); +typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display* dpy, int screen, int* nelements); #define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV) #define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV) @@ -1049,9 +1101,9 @@ typedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier); typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group); -typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count); -typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); -typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint* count); +typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint* maxGroups, GLuint* maxBarriers); +typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint* group, GLuint* barrier); typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen); #define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV) @@ -1092,9 +1144,9 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer); typedef XID GLXVideoCaptureDeviceNV; typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); -typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements); +typedef GLXVideoCaptureDeviceNV* ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int* nelements); typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); -typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int* value); typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device); #define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV) @@ -1124,11 +1176,11 @@ typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoC #define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); -typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); -typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV* pVideoDevice); +typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long* pulCounterOutputVideo); typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice); typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf); -typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long* pulCounterPbuffer, GLboolean bBlock); #define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV) #define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV) @@ -1240,12 +1292,12 @@ typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, i typedef XID GLXFBConfigIDSGIX; typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; -typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); -typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap); -typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value); -typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis); -typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config); +typedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display* dpy, int screen, int* attrib_list, int* nelements); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int* value); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo* vis); +typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display* dpy, GLXFBConfigSGIX config); #define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX) #define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX) @@ -1359,10 +1411,10 @@ typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Disp typedef XID GLXPbufferSGIX; typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX; -typedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list); -typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf); -typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask); -typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value); +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int* attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbufferSGIX pbuf); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long* mask); +typedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int* value); typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask); #define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX) @@ -1380,8 +1432,8 @@ typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, #ifndef GLX_SGIX_swap_barrier #define GLX_SGIX_swap_barrier 1 -typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); -typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display* dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display* dpy, int screen, int* max); #define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX) #define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX) @@ -1395,7 +1447,7 @@ typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, #ifndef GLX_SGIX_swap_group #define GLX_SGIX_swap_group 1 -typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display* dpy, GLXDrawable drawable, GLXDrawable member); #define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX) @@ -1414,8 +1466,8 @@ typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawabl typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window); typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h); typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype); -typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h); -typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int* x, int* y, int* w, int* h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int* dx, int* dy, int* dw, int* dh); #define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX) #define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX) @@ -1499,7 +1551,7 @@ typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigne #ifndef GLX_SUN_get_transparent_index #define GLX_SUN_get_transparent_index 1 -typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex); +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long* pTransparentIndex); #define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN) @@ -1568,6 +1620,7 @@ GLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI; GLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT; GLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT; +GLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYEXTPROC __glewXGetCurrentDisplayEXT; GLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT; GLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT; @@ -1702,12 +1755,14 @@ GLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object; GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float; GLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_buffer_age; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_context_priority; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_libglvnd; +GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_no_config_context; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_stereo_tree; GLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control; @@ -1727,6 +1782,7 @@ GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_buffer; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_delay_before_swap; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer; +GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multigpu_context; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video; GLXEW_VAR_EXPORT GLboolean __GLXEW_NV_robustness_video_memory_purge; diff --git a/meta/win/include/GL/wglew.h b/meta/win/include/GL/wglew.h index 2097c0f0..7e2d0904 100644 --- a/meta/win/include/GL/wglew.h +++ b/meta/win/include/GL/wglew.h @@ -1,6 +1,6 @@ /* ** The OpenGL Extension Wrangler Library -** Copyright (C) 2008-2017, Nigel Stewart +** Copyright (C) 2008-2019, Nigel Stewart ** Copyright (C) 2002-2008, Milan Ikits ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev @@ -188,6 +188,10 @@ typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, in #ifndef WGL_ARB_context_flush_control #define WGL_ARB_context_flush_control 1 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 + #define WGLEW_ARB_context_flush_control WGLEW_GET_VAR(__WGLEW_ARB_context_flush_control) #endif /* WGL_ARB_context_flush_control */ @@ -197,14 +201,13 @@ typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, in #ifndef WGL_ARB_create_context #define WGL_ARB_create_context 1 -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 #define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 #define WGL_CONTEXT_FLAGS_ARB 0x2094 #define ERROR_INVALID_VERSION_ARB 0x2095 -#define ERROR_INVALID_PROFILE_ARB 0x2096 typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList); @@ -219,6 +222,8 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar #ifndef WGL_ARB_create_context_no_error #define WGL_ARB_create_context_no_error 1 +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 + #define WGLEW_ARB_create_context_no_error WGLEW_GET_VAR(__WGLEW_ARB_create_context_no_error) #endif /* WGL_ARB_create_context_no_error */ @@ -230,6 +235,7 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define ERROR_INVALID_PROFILE_ARB 0x2096 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile) @@ -282,7 +288,7 @@ typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); #define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); #define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB) @@ -391,9 +397,9 @@ typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT* pfAttribFList, UINT nMaxFormats, int* piFormats, UINT* nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT* pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int* piValues); #define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB) #define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB) @@ -564,8 +570,8 @@ typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, con typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); -typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort* table, GLuint length); #define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT) #define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT) @@ -607,7 +613,7 @@ typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); #define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 -typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); #define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT) @@ -713,9 +719,9 @@ typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC #define WGL_TYPE_RGBA_EXT 0x202B #define WGL_TYPE_COLORINDEX_EXT 0x202C -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT* pfAttribFList, UINT nMaxFormats, int* piFormats, UINT* nNumFormats); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT* pfValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int* piValues); #define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT) #define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT) @@ -788,9 +794,9 @@ typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAt #define WGL_GAMMA_TABLE_SIZE_I3D 0x204E #define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F -typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT* puGreen, USHORT* puBlue); typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue); -typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT* puGreen, const USHORT* puBlue); typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue); #define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D) @@ -828,7 +834,7 @@ typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDela typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge); typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource); typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag); -typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT* uMaxPixelDelay); #define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D) #define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D) @@ -855,10 +861,10 @@ typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* #define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 #define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 -typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE* pEvent, const LPVOID* pAddress, const DWORD* pSize, UINT count); typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); -typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID* pAddress, UINT count); #define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D) #define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D) @@ -874,8 +880,8 @@ typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* #ifndef WGL_I3D_swap_frame_lock #define WGL_I3D_swap_frame_lock 1 -typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID); -typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag); typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); @@ -896,7 +902,7 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag); typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage); -typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD* pMissedFrames, float* pLastMissedUsage); #define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D) #define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D) @@ -912,9 +918,9 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWO #ifndef WGL_NV_DX_interop #define WGL_NV_DX_interop 1 -#define WGL_ACCESS_READ_ONLY_NV 0x0000 -#define WGL_ACCESS_READ_WRITE_NV 0x0001 -#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002 +#define WGL_ACCESS_READ_ONLY_NV 0x00000000 +#define WGL_ACCESS_READ_WRITE_NV 0x00000001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002 typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects); @@ -1025,6 +1031,21 @@ typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); #endif /* WGL_NV_gpu_affinity */ +/* ------------------------ WGL_NV_multigpu_context ------------------------ */ + +#ifndef WGL_NV_multigpu_context +#define WGL_NV_multigpu_context 1 + +#define WGL_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define WGL_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define WGL_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define WGL_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE + +#define WGLEW_NV_multigpu_context WGLEW_GET_VAR(__WGLEW_NV_multigpu_context) + +#endif /* WGL_NV_multigpu_context */ + /* ---------------------- WGL_NV_multisample_coverage ---------------------- */ #ifndef WGL_NV_multisample_coverage @@ -1063,7 +1084,6 @@ typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* pi #ifndef WGL_NV_render_depth_texture #define WGL_NV_render_depth_texture 1 -#define WGL_NO_TEXTURE_ARB 0x2077 #define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 #define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 #define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 @@ -1095,8 +1115,8 @@ typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* pi typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count); -typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers); -typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint* maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint* barrier); typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); #define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV) @@ -1115,8 +1135,8 @@ typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); #ifndef WGL_NV_vertex_array_range #define WGL_NV_vertex_array_range 1 -typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); -typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void* pointer); #define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV) #define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV) @@ -1174,7 +1194,7 @@ DECLARE_HANDLE(HPVIDEODEV); typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice); -typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long* pulCounterOutputVideo); typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock); @@ -1195,12 +1215,12 @@ typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, in #ifndef WGL_OML_sync_control #define WGL_OML_sync_control 1 -typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator); -typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32* denominator); +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64* msc, INT64* sbc); typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); -typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc); -typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64* msc, INT64* sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64* msc, INT64* sbc); #define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML) #define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML) @@ -1414,6 +1434,7 @@ WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_delay_before_swap; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity; +WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multigpu_context; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video; WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture; diff --git a/meta/win/include/SDL2/SDL.h b/meta/win/include/SDL2/SDL.h index 12e7f31a..20c903b2 100644 --- a/meta/win/include/SDL2/SDL.h +++ b/meta/win/include/SDL2/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_assert.h b/meta/win/include/SDL2/SDL_assert.h index e71cf979..a396d4e0 100644 --- a/meta/win/include/SDL2/SDL_assert.h +++ b/meta/win/include/SDL2/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,8 @@ assert can have unique static variables associated with it. #define SDL_TriggerBreakpoint() __builtin_debugtrap() #elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) +#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv) + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" ) #elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) #elif defined(__APPLE__) && defined(__arm__) @@ -125,12 +127,10 @@ typedef struct SDL_AssertData const struct SDL_AssertData *next; } SDL_AssertData; -#if (SDL_ASSERT_LEVEL > 0) - /* Never call this directly. Use the SDL_assert* macros. */ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, - const char *, - const char *, int) + const char *, + const char *, int) #if defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) /* this tells Clang's static analysis that we're a custom assert function, @@ -151,9 +151,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, #define SDL_enabled_assert(condition) \ do { \ while ( !(condition) ) { \ - static struct SDL_AssertData sdl_assert_data = { \ - 0, 0, #condition, 0, 0, 0, 0 \ - }; \ + static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ continue; /* go again. */ \ @@ -164,8 +162,6 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, } \ } while (SDL_NULL_WHILE_LOOP_CONDITION) -#endif /* enabled assertions support code */ - /* Enable various levels of assertions. */ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ # define SDL_assert(condition) SDL_disabled_assert(condition) diff --git a/meta/win/include/SDL2/SDL_atomic.h b/meta/win/include/SDL2/SDL_atomic.h index 2eace208..1fa18f49 100644 --- a/meta/win/include/SDL2/SDL_atomic.h +++ b/meta/win/include/SDL2/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -209,7 +209,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ #define SDL_MEMORY_BARRIER_USES_FUNCTION @@ -240,7 +240,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); /* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ #if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) #define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ -#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) +#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__) #define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") #elif (defined(__powerpc__) || defined(__powerpc64__)) #define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); @@ -249,9 +249,8 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) #define SDL_CPUPauseInstruction() __yield() #elif defined(__WATCOMC__) && defined(__386__) - /* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ extern __inline void SDL_CPUPauseInstruction(void); - #pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h" + #pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause" #else #define SDL_CPUPauseInstruction() #endif diff --git a/meta/win/include/SDL2/SDL_audio.h b/meta/win/include/SDL2/SDL_audio.h index c42de3ed..bd8e7ab6 100644 --- a/meta/win/include/SDL2/SDL_audio.h +++ b/meta/win/include/SDL2/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -169,13 +169,13 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, * The calculated values in this structure are calculated by SDL_OpenAudio(). * * For multi-channel audio, the default SDL channel mapping is: - * 2: FL FR (stereo) - * 3: FL FR LFE (2.1 surround) - * 4: FL FR BL BR (quad) - * 5: FL FR LFE BL BR (4.1 surround) - * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) - * 7: FL FR FC LFE BC SL SR (6.1 surround) - * 8: FL FR FC LFE BL BR SL SR (7.1 surround) + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR LFE BL BR (4.1 surround) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { diff --git a/meta/win/include/SDL2/SDL_bits.h b/meta/win/include/SDL2/SDL_bits.h index 22cb8531..83e8a78c 100644 --- a/meta/win/include/SDL2/SDL_bits.h +++ b/meta/win/include/SDL2/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_blendmode.h b/meta/win/include/SDL2/SDL_blendmode.h index 08c9f9dd..09d01477 100644 --- a/meta/win/include/SDL2/SDL_blendmode.h +++ b/meta/win/include/SDL2/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ typedef enum dstA = dstA */ SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) - dstA = (srcA * dstA) + (dstA * (1-srcA)) */ + dstA = dstA */ SDL_BLENDMODE_INVALID = 0x7FFFFFFF /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ @@ -65,8 +65,8 @@ typedef enum typedef enum { SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ - SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ - SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ } SDL_BlendOperation; diff --git a/meta/win/include/SDL2/SDL_clipboard.h b/meta/win/include/SDL2/SDL_clipboard.h index 93513630..bd4b044c 100644 --- a/meta/win/include/SDL2/SDL_clipboard.h +++ b/meta/win/include/SDL2/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,6 +82,53 @@ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); +/** + * Put UTF-8 text into the primary selection. + * + * \param text the text to store in the primary selection + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_HasPrimarySelectionText + */ +extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); + +/** + * Get UTF-8 text from the primary selection, which must be freed with + * SDL_free(). + * + * This functions returns empty string if there was not enough memory left for + * a copy of the primary selection's content. + * + * \returns the primary selection text on success or an empty string on + * failure; call SDL_GetError() for more information. Caller must + * call SDL_free() on the returned pointer when done with it (even if + * there was an error). + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_HasPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + */ +extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); + +/** + * Query whether the primary selection exists and contains a non-empty text + * string. + * + * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it + * does not. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/meta/win/include/SDL2/SDL_config.h b/meta/win/include/SDL2/SDL_config.h index f91cb47e..dba78086 100644 --- a/meta/win/include/SDL2/SDL_config.h +++ b/meta/win/include/SDL2/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,43 +19,313 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef SDL_config_h_ +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ #define SDL_config_h_ #include "SDL_platform.h" -/** - * \file SDL_config.h - */ - -/* Add any platform that doesn't build using the configure system. */ -#if defined(__WIN32__) -#include "SDL_config_windows.h" -#elif defined(__WINRT__) -#include "SDL_config_winrt.h" -#elif defined(__WINGDK__) -#include "SDL_config_wingdk.h" -#elif defined(__XBOXONE__) || defined(__XBOXSERIES__) -#include "SDL_config_xbox.h" -#elif defined(__MACOSX__) -#include "SDL_config_macosx.h" -#elif defined(__IPHONEOS__) -#include "SDL_config_iphoneos.h" -#elif defined(__ANDROID__) -#include "SDL_config_android.h" -#elif defined(__OS2__) -#include "SDL_config_os2.h" -#elif defined(__EMSCRIPTEN__) -#include "SDL_config_emscripten.h" -#elif defined(__NGAGE__) -#include "SDL_config_ngage.h" +/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK, + * but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence. + * If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */ +#if !defined(HAVE_WINSDKVER_H) && defined(__has_include) +#if __has_include() +#define HAVE_WINSDKVER_H 1 +#endif +#endif + +#ifdef HAVE_WINSDKVER_H +#include +#endif + +/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the + * Windows 10 SDK have broken declarations for the C API for DirectX 12. */ +#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include) +#if __has_include() +#define HAVE_SDKDDKVER_H 1 +#endif +#endif + +#ifdef HAVE_SDKDDKVER_H +#include +#endif + +/* This is a set of defines to configure the SDL features */ + +#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_) +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +#else +#define HAVE_STDINT_H 1 +#endif /* Visual Studio 2008 */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +#ifdef __clang__ +# define HAVE_GCC_ATOMICS 1 +#endif + +#define HAVE_DDRAW_H 1 +#define HAVE_DINPUT_H 1 +#define HAVE_DSOUND_H 1 +#ifndef __WATCOMC__ +#define HAVE_DXGI_H 1 +#define HAVE_XINPUT_H 1 +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ +#define HAVE_WINDOWS_GAMING_INPUT_H 1 +#endif +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */ +#define HAVE_D3D11_H 1 +#define HAVE_ROAPI_H 1 +#endif +#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ +#define HAVE_D3D12_H 1 +#endif +#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ +#define HAVE_SHELLSCALINGAPI_H 1 +#endif +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_TPCSHRD_H 1 +#define HAVE_SENSORSAPI_H 1 +#endif +#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) +#define HAVE_IMMINTRIN_H 1 +#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) +# if __has_include() +# define HAVE_IMMINTRIN_H 1 +# endif +#endif + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +/* OpenWatcom requires specific calling conventions for qsort and bsearch */ +#ifndef __WATCOMC__ +#define HAVE_QSORT 1 +#define HAVE_BSEARCH 1 +#endif +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE__WCSICMP 1 +#define HAVE__WCSNICMP 1 +#define HAVE__WCSDUP 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE_COS 1 +#define HAVE_EXP 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_FMOD 1 +#define HAVE_LOG 1 +#define HAVE_LOG10 1 +#define HAVE_POW 1 +#define HAVE_SIN 1 +#define HAVE_SQRT 1 +#define HAVE_TAN 1 +#ifndef __WATCOMC__ +#define HAVE_ACOSF 1 +#define HAVE_ASINF 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COSF 1 +#define HAVE_EXPF 1 +#define HAVE_FABSF 1 +#define HAVE_FLOORF 1 +#define HAVE_FMODF 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10F 1 +#define HAVE_POWF 1 +#define HAVE_SINF 1 +#define HAVE_SQRTF 1 +#define HAVE_TANF 1 +#endif +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ +#if _MSC_VER >= 1800 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_VSSCANF 1 +#define HAVE_LROUND 1 +#define HAVE_LROUNDF 1 +#define HAVE_ROUND 1 +#define HAVE_ROUNDF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif +#ifdef _USE_MATH_DEFINES +#define HAVE_M_PI 1 +#endif +#elif defined(__WATCOMC__) +#define HAVE__FSEEKI64 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_VSSCANF 1 +#define HAVE_ROUND 1 +#define HAVE_SCALBN 1 +#define HAVE_TRUNC 1 +#else +#define HAVE_M_PI 1 +#endif #else -/* This is a minimal configuration just to get SDL running on new platforms. */ -#include "SDL_config_minimal.h" -#endif /* platform config */ +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) +#define SDL_AUDIO_DRIVER_WASAPI 1 +#endif +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 -#ifdef USING_GENERATED_CONFIG_H -#error Wrong SDL_config.h, check your include path? +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 +#ifndef __WINRT__ +#define SDL_JOYSTICK_RAWINPUT 1 #endif +#define SDL_JOYSTICK_VIRTUAL 1 +#ifdef HAVE_WINDOWS_GAMING_INPUT_H +#define SDL_JOYSTICK_WGI 1 +#endif +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_DINPUT 1 +#define SDL_HAPTIC_XINPUT 1 + +/* Enable the sensor driver */ +#ifdef HAVE_SENSORSAPI_H +#define SDL_SENSOR_WINDOWS 1 +#else +#define SDL_SENSOR_DUMMY 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_GENERIC_COND_SUFFIX 1 +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif +#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) +#define SDL_VIDEO_RENDER_D3D11 1 +#endif +#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) +#define SDL_VIDEO_RENDER_D3D12 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable filesystem support */ +#define SDL_FILESYSTEM_WINDOWS 1 + +#endif /* SDL_config_windows_h_ */ -#endif /* SDL_config_h_ */ +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/meta/win/include/SDL2/SDL_config.h.cmake b/meta/win/include/SDL2/SDL_config.h.cmake deleted file mode 100644 index 2d21b37d..00000000 --- a/meta/win/include/SDL2/SDL_config.h.cmake +++ /dev/null @@ -1,594 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_h_ -#define SDL_config_h_ - -/** - * \file SDL_config.h.in - * - * This is a set of defines to configure the SDL features - */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -/* C language features */ -#cmakedefine const @HAVE_CONST@ -#cmakedefine inline @HAVE_INLINE@ -#cmakedefine volatile @HAVE_VOLATILE@ - -/* C datatypes */ -/* Define SIZEOF_VOIDP for 64/32 architectures */ -#if defined(__LP64__) || defined(_LP64) || defined(_WIN64) -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ -#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ - -/* Comment this if you want to build without any C library requirements */ -#cmakedefine HAVE_LIBC 1 -#if HAVE_LIBC - -/* Useful headers */ -#cmakedefine STDC_HEADERS 1 -#cmakedefine HAVE_ALLOCA_H 1 -#cmakedefine HAVE_CTYPE_H 1 -#cmakedefine HAVE_FLOAT_H 1 -#cmakedefine HAVE_ICONV_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_LIMITS_H 1 -#cmakedefine HAVE_MALLOC_H 1 -#cmakedefine HAVE_MATH_H 1 -#cmakedefine HAVE_MEMORY_H 1 -#cmakedefine HAVE_SIGNAL_H 1 -#cmakedefine HAVE_STDARG_H 1 -#cmakedefine HAVE_STDDEF_H 1 -#cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_STDIO_H 1 -#cmakedefine HAVE_STDLIB_H 1 -#cmakedefine HAVE_STRINGS_H 1 -#cmakedefine HAVE_STRING_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_WCHAR_H 1 -#cmakedefine HAVE_PTHREAD_NP_H 1 -#cmakedefine HAVE_LIBUNWIND_H 1 - -/* C library functions */ -#cmakedefine HAVE_DLOPEN 1 -#cmakedefine HAVE_MALLOC 1 -#cmakedefine HAVE_CALLOC 1 -#cmakedefine HAVE_REALLOC 1 -#cmakedefine HAVE_FREE 1 -#cmakedefine HAVE_ALLOCA 1 -#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ -#cmakedefine HAVE_GETENV 1 -#cmakedefine HAVE_SETENV 1 -#cmakedefine HAVE_PUTENV 1 -#cmakedefine HAVE_UNSETENV 1 -#endif -#cmakedefine HAVE_QSORT 1 -#cmakedefine HAVE_BSEARCH 1 -#cmakedefine HAVE_ABS 1 -#cmakedefine HAVE_BCOPY 1 -#cmakedefine HAVE_MEMSET 1 -#cmakedefine HAVE_MEMCPY 1 -#cmakedefine HAVE_MEMMOVE 1 -#cmakedefine HAVE_MEMCMP 1 -#cmakedefine HAVE_WCSLEN 1 -#cmakedefine HAVE_WCSLCPY 1 -#cmakedefine HAVE_WCSLCAT 1 -#cmakedefine HAVE__WCSDUP 1 -#cmakedefine HAVE_WCSDUP 1 -#cmakedefine HAVE_WCSSTR 1 -#cmakedefine HAVE_WCSCMP 1 -#cmakedefine HAVE_WCSNCMP 1 -#cmakedefine HAVE_WCSCASECMP 1 -#cmakedefine HAVE__WCSICMP 1 -#cmakedefine HAVE_WCSNCASECMP 1 -#cmakedefine HAVE__WCSNICMP 1 -#cmakedefine HAVE_STRLEN 1 -#cmakedefine HAVE_STRLCPY 1 -#cmakedefine HAVE_STRLCAT 1 -#cmakedefine HAVE__STRREV 1 -#cmakedefine HAVE__STRUPR 1 -#cmakedefine HAVE__STRLWR 1 -#cmakedefine HAVE_INDEX 1 -#cmakedefine HAVE_RINDEX 1 -#cmakedefine HAVE_STRCHR 1 -#cmakedefine HAVE_STRRCHR 1 -#cmakedefine HAVE_STRSTR 1 -#cmakedefine HAVE_STRTOK_R 1 -#cmakedefine HAVE_ITOA 1 -#cmakedefine HAVE__LTOA 1 -#cmakedefine HAVE__UITOA 1 -#cmakedefine HAVE__ULTOA 1 -#cmakedefine HAVE_STRTOL 1 -#cmakedefine HAVE_STRTOUL 1 -#cmakedefine HAVE__I64TOA 1 -#cmakedefine HAVE__UI64TOA 1 -#cmakedefine HAVE_STRTOLL 1 -#cmakedefine HAVE_STRTOULL 1 -#cmakedefine HAVE_STRTOD 1 -#cmakedefine HAVE_ATOI 1 -#cmakedefine HAVE_ATOF 1 -#cmakedefine HAVE_STRCMP 1 -#cmakedefine HAVE_STRNCMP 1 -#cmakedefine HAVE__STRICMP 1 -#cmakedefine HAVE_STRCASECMP 1 -#cmakedefine HAVE__STRNICMP 1 -#cmakedefine HAVE_STRNCASECMP 1 -#cmakedefine HAVE_SSCANF 1 -#cmakedefine HAVE_VSSCANF 1 -#cmakedefine HAVE_VSNPRINTF 1 -#cmakedefine HAVE_M_PI 1 -#cmakedefine HAVE_ACOS 1 -#cmakedefine HAVE_ACOSF 1 -#cmakedefine HAVE_ASIN 1 -#cmakedefine HAVE_ASINF 1 -#cmakedefine HAVE_ATAN 1 -#cmakedefine HAVE_ATANF 1 -#cmakedefine HAVE_ATAN2 1 -#cmakedefine HAVE_ATAN2F 1 -#cmakedefine HAVE_CEIL 1 -#cmakedefine HAVE_CEILF 1 -#cmakedefine HAVE_COPYSIGN 1 -#cmakedefine HAVE_COPYSIGNF 1 -#cmakedefine HAVE_COS 1 -#cmakedefine HAVE_COSF 1 -#cmakedefine HAVE_EXP 1 -#cmakedefine HAVE_EXPF 1 -#cmakedefine HAVE_FABS 1 -#cmakedefine HAVE_FABSF 1 -#cmakedefine HAVE_FLOOR 1 -#cmakedefine HAVE_FLOORF 1 -#cmakedefine HAVE_FMOD 1 -#cmakedefine HAVE_FMODF 1 -#cmakedefine HAVE_LOG 1 -#cmakedefine HAVE_LOGF 1 -#cmakedefine HAVE_LOG10 1 -#cmakedefine HAVE_LOG10F 1 -#cmakedefine HAVE_LROUND 1 -#cmakedefine HAVE_LROUNDF 1 -#cmakedefine HAVE_POW 1 -#cmakedefine HAVE_POWF 1 -#cmakedefine HAVE_ROUND 1 -#cmakedefine HAVE_ROUNDF 1 -#cmakedefine HAVE_SCALBN 1 -#cmakedefine HAVE_SCALBNF 1 -#cmakedefine HAVE_SIN 1 -#cmakedefine HAVE_SINF 1 -#cmakedefine HAVE_SQRT 1 -#cmakedefine HAVE_SQRTF 1 -#cmakedefine HAVE_TAN 1 -#cmakedefine HAVE_TANF 1 -#cmakedefine HAVE_TRUNC 1 -#cmakedefine HAVE_TRUNCF 1 -#cmakedefine HAVE_FOPEN64 1 -#cmakedefine HAVE_FSEEKO 1 -#cmakedefine HAVE_FSEEKO64 1 -#cmakedefine HAVE_SIGACTION 1 -#cmakedefine HAVE_SA_SIGACTION 1 -#cmakedefine HAVE_SETJMP 1 -#cmakedefine HAVE_NANOSLEEP 1 -#cmakedefine HAVE_SYSCONF 1 -#cmakedefine HAVE_SYSCTLBYNAME 1 -#cmakedefine HAVE_CLOCK_GETTIME 1 -#cmakedefine HAVE_GETPAGESIZE 1 -#cmakedefine HAVE_MPROTECT 1 -#cmakedefine HAVE_ICONV 1 -#cmakedefine HAVE_PTHREAD_SETNAME_NP 1 -#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 -#cmakedefine HAVE_SEM_TIMEDWAIT 1 -#cmakedefine HAVE_GETAUXVAL 1 -#cmakedefine HAVE_ELF_AUX_INFO 1 -#cmakedefine HAVE_POLL 1 -#cmakedefine HAVE__EXIT 1 - -#elif defined(__WIN32__) -#cmakedefine HAVE_STDARG_H 1 -#cmakedefine HAVE_STDDEF_H 1 -#cmakedefine HAVE_FLOAT_H 1 - -#else -/* We may need some replacement for stdarg.h here */ -#include -#endif /* HAVE_LIBC */ - -#cmakedefine HAVE_ALTIVEC_H 1 -#cmakedefine HAVE_DBUS_DBUS_H 1 -#cmakedefine HAVE_FCITX 1 -#cmakedefine HAVE_IBUS_IBUS_H 1 -#cmakedefine HAVE_SYS_INOTIFY_H 1 -#cmakedefine HAVE_INOTIFY_INIT 1 -#cmakedefine HAVE_INOTIFY_INIT1 1 -#cmakedefine HAVE_INOTIFY 1 -#cmakedefine HAVE_O_CLOEXEC 1 - -/* Apple platforms might be building universal binaries, where Intel builds - can use immintrin.h but other architectures can't. */ -#ifdef __APPLE__ -# if defined(__has_include) && (defined(__i386__) || defined(__x86_64)) -# if __has_include() -# define HAVE_IMMINTRIN_H 1 -# endif -# endif -#else /* non-Apple platforms can use the normal CMake check for this. */ -#cmakedefine HAVE_IMMINTRIN_H 1 -#endif - -#cmakedefine HAVE_LIBUDEV_H 1 -#cmakedefine HAVE_LIBSAMPLERATE_H 1 -#cmakedefine HAVE_LIBDECOR_H 1 - -#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ -#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_D3D12_H @HAVE_D3D12_H@ -#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ -#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ -#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ -#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ -#cmakedefine HAVE_WINDOWS_GAMING_INPUT_H @HAVE_WINDOWS_GAMING_INPUT_H@ -#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ - -#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@ -#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@ -#cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@ -#cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@ -#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@ -#cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_H@ - -#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ -#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ - -/* SDL internal assertion support */ -#if @SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED@ -#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ -#endif - -/* Allow disabling of core subsystems */ -#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@ -#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@ -#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@ -#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@ -#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@ -#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@ -#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@ -#cmakedefine SDL_HIDAPI_DISABLED @SDL_HIDAPI_DISABLED@ -#cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@ -#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@ -#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@ -#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@ -#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@ -#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ -#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ -#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ -#cmakedefine SDL_LOCALE_DISABLED @SDL_LOCALE_DISABLED@ -#cmakedefine SDL_MISC_DISABLED @SDL_MISC_DISABLED@ - -/* Enable various audio drivers */ -#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ -#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ -#cmakedefine SDL_AUDIO_DRIVER_OPENSLES @SDL_AUDIO_DRIVER_OPENSLES@ -#cmakedefine SDL_AUDIO_DRIVER_AAUDIO @SDL_AUDIO_DRIVER_AAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ -#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ -#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ -#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ -#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ -#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ -#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ -#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ -#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ -#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE @SDL_AUDIO_DRIVER_PIPEWIRE@ -#cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ -#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@ -#cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ -#cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ -#cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ - -/* Enable various input drivers */ -#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ -#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ -#cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@ -#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ -#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ -#cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@ -#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ -#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ -#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ -#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ -#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ -#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_OS2 @SDL_JOYSTICK_OS2@ -#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ -#cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ -#cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ -#cmakedefine SDL_JOYSTICK_RAWINPUT @SDL_JOYSTICK_RAWINPUT@ -#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ -#cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@ -#cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ -#cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ -#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ -#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ -#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ -#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ -#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ -#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ -#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ -#cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@ - -/* Enable various sensor drivers */ -#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@ -#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@ -#cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@ -#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@ -#cmakedefine SDL_SENSOR_VITA @SDL_SENSOR_VITA@ - -/* Enable various shared object loading systems */ -#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ -#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ -#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ -#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ -#cmakedefine SDL_LOADSO_OS2 @SDL_LOADSO_OS2@ - -/* Enable various threading systems */ -#cmakedefine SDL_THREAD_GENERIC_COND_SUFFIX @SDL_THREAD_GENERIC_COND_SUFFIX@ -#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@ -#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ -#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ -#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ -#cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ -#cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ -#cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ -#cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ - -/* Enable various timer systems */ -#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ -#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ -#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ -#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ -#cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ -#cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ -#cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ -#cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ - -/* Enable various video drivers */ -#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ -#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@ -#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ -#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ -#cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@ -#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ -#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@ -#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ -#cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@ -#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ -#cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@ -#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ -#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ -#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ -#cmakedefine SDL_VIDEO_DRIVER_OS2 @SDL_VIDEO_DRIVER_OS2@ -#cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@ -#cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@ -#cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@ -#cmakedefine SDL_VIDEO_DRIVER_PS2 @SDL_VIDEO_DRIVER_PS2@ - -#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ -#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ -#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ - -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@ -#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR@ - -#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES @SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@ -#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XFIXES @SDL_VIDEO_DRIVER_X11_XFIXES@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@ -#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ -#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ -#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ -#cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@ - -#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ -#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ -#cmakedefine SDL_VIDEO_RENDER_D3D12 @SDL_VIDEO_RENDER_D3D12@ -#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ -#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ -#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ -#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ -#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ -#cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@ -#cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@ -#cmakedefine SDL_VIDEO_RENDER_PSP @SDL_VIDEO_RENDER_PSP@ - -/* Enable OpenGL support */ -#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ -#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@ -#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@ -#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@ -#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@ -#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@ -#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@ -#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@ -#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ -#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ - -/* Enable Vulkan support */ -#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ - -/* Enable Metal support */ -#cmakedefine SDL_VIDEO_METAL @SDL_VIDEO_METAL@ - -/* Enable system power support */ -#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ -#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ -#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ -#cmakedefine SDL_POWER_WINRT @SDL_POWER_WINRT@ -#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ -#cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@ -#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@ -#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@ -#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ -#cmakedefine SDL_POWER_VITA @SDL_POWER_VITA@ -#cmakedefine SDL_POWER_PSP @SDL_POWER_PSP@ - -/* Enable system filesystem support */ -#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@ -#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@ -#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@ -#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@ -#cmakedefine SDL_FILESYSTEM_RISCOS @SDL_FILESYSTEM_RISCOS@ -#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ -#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ -#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ -#cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ -#cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ -#cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ -#cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ - -/* Enable misc subsystem */ -#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@ - -/* Enable locale subsystem */ -#cmakedefine SDL_LOCALE_DUMMY @SDL_LOCALE_DUMMY@ - -/* Enable assembly routines */ -#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ -#cmakedefine SDL_ARM_SIMD_BLITTERS @SDL_ARM_SIMD_BLITTERS@ -#cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@ - -/* Whether SDL_DYNAMIC_API needs dlopen */ -#cmakedefine DYNAPI_NEEDS_DLOPEN @DYNAPI_NEEDS_DLOPEN@ - -/* Enable dynamic libsamplerate support */ -#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ - -/* Enable ime support */ -#cmakedefine SDL_USE_IME @SDL_USE_IME@ - -/* Platform specific definitions */ -#cmakedefine SDL_IPHONE_KEYBOARD @SDL_IPHONE_KEYBOARD@ -#cmakedefine SDL_IPHONE_LAUNCHSCREEN @SDL_IPHONE_LAUNCHSCREEN@ - -#cmakedefine SDL_VIDEO_VITA_PIB @SDL_VIDEO_VITA_PIB@ -#cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@ -#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@ - -#if !defined(__WIN32__) && !defined(__WINRT__) -# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) -typedef unsigned int size_t; -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -typedef unsigned long uintptr_t; -# endif /* if (stdint.h isn't available) */ -#else /* __WIN32__ */ -# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) -# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__CODEGEARC__) -#define HAVE_STDINT_H 1 -# elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -# ifndef _UINTPTR_T_DEFINED -# ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -# else -typedef unsigned int uintptr_t; -# endif -#define _UINTPTR_T_DEFINED -# endif -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -# endif -# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) -#define LONG_PTR LONG -# endif -# else /* !__GNUC__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -# ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -# endif -typedef unsigned int uintptr_t; -# endif /* __GNUC__ || _MSC_VER */ -# endif /* !_STDINT_H_ && !HAVE_STDINT_H */ -#endif /* __WIN32__ */ - -#endif /* SDL_config_h_ */ diff --git a/meta/win/include/SDL2/SDL_config.h.in b/meta/win/include/SDL2/SDL_config.h.in deleted file mode 100644 index 7b6eb5db..00000000 --- a/meta/win/include/SDL2/SDL_config.h.in +++ /dev/null @@ -1,492 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_h_ -#define SDL_config_h_ - -/** - * \file SDL_config.h.in - * - * This is a set of defines to configure the SDL features - */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -/* Make sure that this isn't included by Visual C++ */ -#ifdef _MSC_VER -#error You should run git checkout -f include/SDL_config.h -#endif - -/* C language features */ -#undef const -#undef inline -#undef volatile - -/* C datatypes */ -#if defined(__LP64__) || defined(_LP64) || defined(_WIN64) -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#undef HAVE_GCC_ATOMICS -#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET - -/* Comment this if you want to build without any C library requirements */ -#undef HAVE_LIBC -#if HAVE_LIBC - -/* Useful headers */ -#undef STDC_HEADERS -#undef HAVE_ALLOCA_H -#undef HAVE_CTYPE_H -#undef HAVE_FLOAT_H -#undef HAVE_ICONV_H -#undef HAVE_INTTYPES_H -#undef HAVE_LIMITS_H -#undef HAVE_MALLOC_H -#undef HAVE_MATH_H -#undef HAVE_MEMORY_H -#undef HAVE_SIGNAL_H -#undef HAVE_STDARG_H -#undef HAVE_STDINT_H -#undef HAVE_STDIO_H -#undef HAVE_STDLIB_H -#undef HAVE_STRINGS_H -#undef HAVE_STRING_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_WCHAR_H -#undef HAVE_PTHREAD_NP_H -#undef HAVE_LIBUNWIND_H - -/* C library functions */ -#undef HAVE_DLOPEN -#undef HAVE_MALLOC -#undef HAVE_CALLOC -#undef HAVE_REALLOC -#undef HAVE_FREE -#undef HAVE_ALLOCA -#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ -#undef HAVE_GETENV -#undef HAVE_SETENV -#undef HAVE_PUTENV -#undef HAVE_UNSETENV -#endif -#undef HAVE_QSORT -#undef HAVE_BSEARCH -#undef HAVE_ABS -#undef HAVE_BCOPY -#undef HAVE_MEMSET -#undef HAVE_MEMCPY -#undef HAVE_MEMMOVE -#undef HAVE_MEMCMP -#undef HAVE_WCSLEN -#undef HAVE_WCSLCPY -#undef HAVE_WCSLCAT -#undef HAVE__WCSDUP -#undef HAVE_WCSDUP -#undef HAVE_WCSSTR -#undef HAVE_WCSCMP -#undef HAVE_WCSNCMP -#undef HAVE_WCSCASECMP -#undef HAVE__WCSICMP -#undef HAVE_WCSNCASECMP -#undef HAVE__WCSNICMP -#undef HAVE_STRLEN -#undef HAVE_STRLCPY -#undef HAVE_STRLCAT -#undef HAVE__STRREV -#undef HAVE__STRUPR -#undef HAVE__STRLWR -#undef HAVE_INDEX -#undef HAVE_RINDEX -#undef HAVE_STRCHR -#undef HAVE_STRRCHR -#undef HAVE_STRSTR -#undef HAVE_STRTOK_R -#undef HAVE_ITOA -#undef HAVE__LTOA -#undef HAVE__UITOA -#undef HAVE__ULTOA -#undef HAVE_STRTOL -#undef HAVE_STRTOUL -#undef HAVE__I64TOA -#undef HAVE__UI64TOA -#undef HAVE_STRTOLL -#undef HAVE_STRTOULL -#undef HAVE_STRTOD -#undef HAVE_ATOI -#undef HAVE_ATOF -#undef HAVE_STRCMP -#undef HAVE_STRNCMP -#undef HAVE__STRICMP -#undef HAVE_STRCASECMP -#undef HAVE__STRNICMP -#undef HAVE_STRNCASECMP -#undef HAVE_SSCANF -#undef HAVE_VSSCANF -#undef HAVE_SNPRINTF -#undef HAVE_VSNPRINTF -#undef HAVE_M_PI -#undef HAVE_ACOS -#undef HAVE_ACOSF -#undef HAVE_ASIN -#undef HAVE_ASINF -#undef HAVE_ATAN -#undef HAVE_ATANF -#undef HAVE_ATAN2 -#undef HAVE_ATAN2F -#undef HAVE_CEIL -#undef HAVE_CEILF -#undef HAVE_COPYSIGN -#undef HAVE_COPYSIGNF -#undef HAVE_COS -#undef HAVE_COSF -#undef HAVE_EXP -#undef HAVE_EXPF -#undef HAVE_FABS -#undef HAVE_FABSF -#undef HAVE_FLOOR -#undef HAVE_FLOORF -#undef HAVE_FMOD -#undef HAVE_FMODF -#undef HAVE_LOG -#undef HAVE_LOGF -#undef HAVE_LOG10 -#undef HAVE_LOG10F -#undef HAVE_LROUND -#undef HAVE_LROUNDF -#undef HAVE_POW -#undef HAVE_POWF -#undef HAVE_ROUND -#undef HAVE_ROUNDF -#undef HAVE_SCALBN -#undef HAVE_SCALBNF -#undef HAVE_SIN -#undef HAVE_SINF -#undef HAVE_SQRT -#undef HAVE_SQRTF -#undef HAVE_TAN -#undef HAVE_TANF -#undef HAVE_TRUNC -#undef HAVE_TRUNCF -#undef HAVE_FOPEN64 -#undef HAVE_FSEEKO -#undef HAVE_FSEEKO64 -#undef HAVE_SIGACTION -#undef HAVE_SA_SIGACTION -#undef HAVE_SETJMP -#undef HAVE_NANOSLEEP -#undef HAVE_SYSCONF -#undef HAVE_SYSCTLBYNAME -#undef HAVE_CLOCK_GETTIME -#undef HAVE_GETPAGESIZE -#undef HAVE_MPROTECT -#undef HAVE_ICONV -#undef HAVE_PTHREAD_SETNAME_NP -#undef HAVE_PTHREAD_SET_NAME_NP -#undef HAVE_SEM_TIMEDWAIT -#undef HAVE_GETAUXVAL -#undef HAVE_ELF_AUX_INFO -#undef HAVE_POLL -#undef HAVE__EXIT - -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 -#endif /* HAVE_LIBC */ - -#undef HAVE_O_CLOEXEC -#undef HAVE_ALTIVEC_H -#undef HAVE_DBUS_DBUS_H -#undef HAVE_FCITX -#undef HAVE_SYS_INOTIFY_H -#undef HAVE_INOTIFY_INIT -#undef HAVE_INOTIFY_INIT1 -#undef HAVE_INOTIFY -#undef HAVE_IBUS_IBUS_H -#undef HAVE_IMMINTRIN_H -#undef HAVE_LIBUDEV_H -#undef HAVE_LIBSAMPLERATE_H -#undef HAVE_LIBDECOR_H -#undef HAVE_LSXINTRIN_H -#undef HAVE_LASXINTRIN_H - -#undef HAVE_DDRAW_H -#undef HAVE_DINPUT_H -#undef HAVE_DSOUND_H -#undef HAVE_DXGI_H -#undef HAVE_WINDOWS_GAMING_INPUT_H -#undef HAVE_XINPUT_H -#undef HAVE_XINPUT_GAMEPAD_EX -#undef HAVE_XINPUT_STATE_EX - -#undef HAVE_MMDEVICEAPI_H -#undef HAVE_AUDIOCLIENT_H -#undef HAVE_TPCSHRD_H -#undef HAVE_SENSORSAPI_H -#undef HAVE_ROAPI_H -#undef HAVE_SHELLSCALINGAPI_H - -/* SDL internal assertion support */ -#undef SDL_DEFAULT_ASSERT_LEVEL - -/* Allow disabling of core subsystems */ -#undef SDL_ATOMIC_DISABLED -#undef SDL_AUDIO_DISABLED -#undef SDL_CPUINFO_DISABLED -#undef SDL_EVENTS_DISABLED -#undef SDL_FILE_DISABLED -#undef SDL_JOYSTICK_DISABLED -#undef SDL_HAPTIC_DISABLED -#undef SDL_HIDAPI_DISABLED -#undef SDL_SENSOR_DISABLED -#undef SDL_LOADSO_DISABLED -#undef SDL_RENDER_DISABLED -#undef SDL_THREADS_DISABLED -#undef SDL_TIMERS_DISABLED -#undef SDL_VIDEO_DISABLED -#undef SDL_POWER_DISABLED -#undef SDL_FILESYSTEM_DISABLED -#undef SDL_LOCALE_DISABLED -#undef SDL_MISC_DISABLED - -/* Enable various audio drivers */ -#undef SDL_AUDIO_DRIVER_AAUDIO -#undef SDL_AUDIO_DRIVER_ALSA -#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC -#undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_ARTS -#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#undef SDL_AUDIO_DRIVER_COREAUDIO -#undef SDL_AUDIO_DRIVER_DISK -#undef SDL_AUDIO_DRIVER_DSOUND -#undef SDL_AUDIO_DRIVER_DUMMY -#undef SDL_AUDIO_DRIVER_EMSCRIPTEN -#undef SDL_AUDIO_DRIVER_ESD -#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#undef SDL_AUDIO_DRIVER_HAIKU -#undef SDL_AUDIO_DRIVER_JACK -#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC -#undef SDL_AUDIO_DRIVER_NACL -#undef SDL_AUDIO_DRIVER_NAS -#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC -#undef SDL_AUDIO_DRIVER_NETBSD -#undef SDL_AUDIO_DRIVER_OPENSLES -#undef SDL_AUDIO_DRIVER_OSS -#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H -#undef SDL_AUDIO_DRIVER_PAUDIO -#undef SDL_AUDIO_DRIVER_PIPEWIRE -#undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC -#undef SDL_AUDIO_DRIVER_PULSEAUDIO -#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_QSA -#undef SDL_AUDIO_DRIVER_SNDIO -#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_SUNAUDIO -#undef SDL_AUDIO_DRIVER_WASAPI -#undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_OS2 - -/* Enable various input drivers */ -#undef SDL_INPUT_LINUXEV -#undef SDL_INPUT_FBSDKBIO -#undef SDL_INPUT_LINUXKD -#undef SDL_INPUT_WSCONS -#undef SDL_JOYSTICK_HAIKU -#undef SDL_JOYSTICK_DINPUT -#undef SDL_JOYSTICK_WGI -#undef SDL_JOYSTICK_XINPUT -#undef SDL_JOYSTICK_DUMMY -#undef SDL_JOYSTICK_IOKIT -#undef SDL_JOYSTICK_MFI -#undef SDL_JOYSTICK_LINUX -#undef SDL_JOYSTICK_ANDROID -#undef SDL_JOYSTICK_OS2 -#undef SDL_JOYSTICK_USBHID -#undef SDL_HAVE_MACHINE_JOYSTICK_H -#undef SDL_JOYSTICK_HIDAPI -#undef SDL_JOYSTICK_RAWINPUT -#undef SDL_JOYSTICK_EMSCRIPTEN -#undef SDL_JOYSTICK_VIRTUAL -#undef SDL_HAPTIC_DUMMY -#undef SDL_HAPTIC_ANDROID -#undef SDL_HAPTIC_LINUX -#undef SDL_HAPTIC_IOKIT -#undef SDL_HAPTIC_DINPUT -#undef SDL_HAPTIC_XINPUT - -/* Enable various sensor drivers */ -#undef SDL_SENSOR_ANDROID -#undef SDL_SENSOR_COREMOTION -#undef SDL_SENSOR_WINDOWS -#undef SDL_SENSOR_DUMMY - -/* Enable various shared object loading systems */ -#undef SDL_LOADSO_DLOPEN -#undef SDL_LOADSO_DUMMY -#undef SDL_LOADSO_LDG -#undef SDL_LOADSO_WINDOWS -#undef SDL_LOADSO_OS2 - -/* Enable various threading systems */ -#undef SDL_THREAD_GENERIC_COND_SUFFIX -#undef SDL_THREAD_PTHREAD -#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX -#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP -#undef SDL_THREAD_WINDOWS -#undef SDL_THREAD_OS2 - -/* Enable various timer systems */ -#undef SDL_TIMER_HAIKU -#undef SDL_TIMER_DUMMY -#undef SDL_TIMER_UNIX -#undef SDL_TIMER_WINDOWS -#undef SDL_TIMER_OS2 - -/* Enable various video drivers */ -#undef SDL_VIDEO_DRIVER_HAIKU -#undef SDL_VIDEO_DRIVER_COCOA -#undef SDL_VIDEO_DRIVER_DIRECTFB -#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC -#undef SDL_VIDEO_DRIVER_DUMMY -#undef SDL_VIDEO_DRIVER_WINDOWS -#undef SDL_VIDEO_DRIVER_WAYLAND -#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH -#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC -#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL -#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR -#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON -#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR -#undef SDL_VIDEO_DRIVER_X11 -#undef SDL_VIDEO_DRIVER_RPI -#undef SDL_VIDEO_DRIVER_KMSDRM -#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC -#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM -#undef SDL_VIDEO_DRIVER_ANDROID -#undef SDL_VIDEO_DRIVER_EMSCRIPTEN -#undef SDL_VIDEO_DRIVER_OFFSCREEN -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR -#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS -#undef SDL_VIDEO_DRIVER_X11_XCURSOR -#undef SDL_VIDEO_DRIVER_X11_XDBE -#undef SDL_VIDEO_DRIVER_X11_XINPUT2 -#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH -#undef SDL_VIDEO_DRIVER_X11_XFIXES -#undef SDL_VIDEO_DRIVER_X11_XRANDR -#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER -#undef SDL_VIDEO_DRIVER_X11_XSHAPE -#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS -#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM -#undef SDL_VIDEO_DRIVER_NACL -#undef SDL_VIDEO_DRIVER_VIVANTE -#undef SDL_VIDEO_DRIVER_VIVANTE_VDK -#undef SDL_VIDEO_DRIVER_OS2 -#undef SDL_VIDEO_DRIVER_QNX -#undef SDL_VIDEO_DRIVER_RISCOS - -#undef SDL_VIDEO_RENDER_D3D -#undef SDL_VIDEO_RENDER_D3D11 -#undef SDL_VIDEO_RENDER_D3D12 -#undef SDL_VIDEO_RENDER_OGL -#undef SDL_VIDEO_RENDER_OGL_ES -#undef SDL_VIDEO_RENDER_OGL_ES2 -#undef SDL_VIDEO_RENDER_DIRECTFB -#undef SDL_VIDEO_RENDER_METAL - -/* Enable OpenGL support */ -#undef SDL_VIDEO_OPENGL -#undef SDL_VIDEO_OPENGL_ES -#undef SDL_VIDEO_OPENGL_ES2 -#undef SDL_VIDEO_OPENGL_BGL -#undef SDL_VIDEO_OPENGL_CGL -#undef SDL_VIDEO_OPENGL_EGL -#undef SDL_VIDEO_OPENGL_GLX -#undef SDL_VIDEO_OPENGL_WGL -#undef SDL_VIDEO_OPENGL_OSMESA -#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC - -/* Enable Vulkan support */ -#undef SDL_VIDEO_VULKAN - -/* Enable Metal support */ -#undef SDL_VIDEO_METAL - -/* Enable system power support */ -#undef SDL_POWER_LINUX -#undef SDL_POWER_WINDOWS -#undef SDL_POWER_MACOSX -#undef SDL_POWER_HAIKU -#undef SDL_POWER_ANDROID -#undef SDL_POWER_EMSCRIPTEN -#undef SDL_POWER_HARDWIRED - -/* Enable system filesystem support */ -#undef SDL_FILESYSTEM_ANDROID -#undef SDL_FILESYSTEM_HAIKU -#undef SDL_FILESYSTEM_COCOA -#undef SDL_FILESYSTEM_DUMMY -#undef SDL_FILESYSTEM_RISCOS -#undef SDL_FILESYSTEM_UNIX -#undef SDL_FILESYSTEM_WINDOWS -#undef SDL_FILESYSTEM_NACL -#undef SDL_FILESYSTEM_EMSCRIPTEN -#undef SDL_FILESYSTEM_OS2 -#undef SDL_FILESYSTEM_VITA -#undef SDL_FILESYSTEM_PSP -#undef SDL_FILESYSTEM_PS2 - -/* Enable misc subsystem */ -#undef SDL_MISC_DUMMY - -/* Enable locale subsystem */ -#undef SDL_LOCALE_DUMMY - -/* Enable assembly routines */ -#undef SDL_ALTIVEC_BLITTERS -#undef SDL_ARM_SIMD_BLITTERS -#undef SDL_ARM_NEON_BLITTERS - -/* Whether SDL_DYNAMIC_API needs dlopen() */ -#undef DYNAPI_NEEDS_DLOPEN - -/* Enable ime support */ -#undef SDL_USE_IME - -/* Enable dynamic udev support */ -#undef SDL_UDEV_DYNAMIC - -/* Enable dynamic libusb support */ -#undef SDL_LIBUSB_DYNAMIC - -/* Enable dynamic libsamplerate support */ -#undef SDL_LIBSAMPLERATE_DYNAMIC - -#endif /* SDL_config_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_android.h b/meta/win/include/SDL2/SDL_config_android.h deleted file mode 100644 index 5a9cfc04..00000000 --- a/meta/win/include/SDL2/SDL_config_android.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_android_h_ -#define SDL_config_android_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/** - * \file SDL_config_android.h - * - * This is a configuration that can be used to build SDL for Android - */ - -#include - -#define HAVE_GCC_ATOMICS 1 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 - -/* C library functions */ -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_SETENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 -#define HAVE_CLOCK_GETTIME 1 - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_ANDROID 1 -#define SDL_AUDIO_DRIVER_OPENSLES 1 -#define SDL_AUDIO_DRIVER_AAUDIO 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_ANDROID 1 -#define SDL_JOYSTICK_HIDAPI 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_ANDROID 1 - -/* Enable sensor driver */ -#define SDL_SENSOR_ANDROID 1 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 - -/* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 - -/* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_ANDROID 1 - -/* Enable OpenGL ES */ -#define SDL_VIDEO_OPENGL_ES 1 -#define SDL_VIDEO_OPENGL_ES2 1 -#define SDL_VIDEO_OPENGL_EGL 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_RENDER_OGL_ES2 1 - -/* Enable Vulkan support */ -/* Android does not support Vulkan in native code using the "armeabi" ABI. */ -#if defined(__ARM_ARCH) && __ARM_ARCH < 7 -#define SDL_VIDEO_VULKAN 0 -#else -#define SDL_VIDEO_VULKAN 1 -#endif - -/* Enable system power support */ -#define SDL_POWER_ANDROID 1 - -/* Enable the filesystem driver */ -#define SDL_FILESYSTEM_ANDROID 1 - -#endif /* SDL_config_android_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_emscripten.h b/meta/win/include/SDL2/SDL_config_emscripten.h deleted file mode 100644 index 989e1243..00000000 --- a/meta/win/include/SDL2/SDL_config_emscripten.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_config_emscripten_h_ -#define _SDL_config_emscripten_h_ - -#include "SDL_platform.h" - -/** - * \file SDL_config_emscripten.h - * - * This is a configuration that can be used to build SDL for Emscripten. - */ - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif -#define HAVE_GCC_ATOMICS 1 - -/* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MATH_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_WCHAR_H 1 - -/* C library functions */ -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSDUP 1 -#define HAVE_WCSSTR 1 -#define HAVE_WCSCMP 1 -#define HAVE_WCSNCMP 1 -#define HAVE_WCSCASECMP 1 -#define HAVE_WCSNCASECMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_FSEEKO 1 -#define HAVE_FSEEKO64 1 -#define HAVE_SIGACTION 1 -#define HAVE_SA_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 -#define HAVE_CLOCK_GETTIME 1 -/* #undef HAVE_GETPAGESIZE */ -#define HAVE_MPROTECT 1 -#define HAVE_ICONV 1 - -/* SDL internal assertion support */ -/* #undef SDL_DEFAULT_ASSERT_LEVEL */ - -#define SDL_CPUINFO_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 -#define SDL_HIDAPI_DISABLED 1 -#ifndef __EMSCRIPTEN_PTHREADS__ -#define SDL_THREADS_DISABLED 1 -#endif - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_EMSCRIPTEN 1 - -/* Enable various sensor drivers */ -#define SDL_SENSOR_DUMMY 1 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 - -/* Enable various threading systems */ -#ifdef __EMSCRIPTEN_PTHREADS__ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 -#endif - -/* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1 - -#define SDL_VIDEO_RENDER_OGL_ES2 1 - -/* Enable OpenGL support */ -/* #undef SDL_VIDEO_OPENGL */ -/* #undef SDL_VIDEO_OPENGL_ES */ -#define SDL_VIDEO_OPENGL_ES2 1 -/* #undef SDL_VIDEO_OPENGL_BGL */ -/* #undef SDL_VIDEO_OPENGL_CGL */ -/* #undef SDL_VIDEO_OPENGL_GLX */ -/* #undef SDL_VIDEO_OPENGL_WGL */ -#define SDL_VIDEO_OPENGL_EGL 1 -/* #undef SDL_VIDEO_OPENGL_OSMESA */ -/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ - -/* Enable system power support */ -#define SDL_POWER_EMSCRIPTEN 1 - -/* Enable system filesystem support */ -#define SDL_FILESYSTEM_EMSCRIPTEN 1 - -#endif /* _SDL_config_emscripten_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_iphoneos.h b/meta/win/include/SDL2/SDL_config_iphoneos.h deleted file mode 100644 index 48f9f9f9..00000000 --- a/meta/win/include/SDL2/SDL_config_iphoneos.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_iphoneos_h_ -#define SDL_config_iphoneos_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#define HAVE_GCC_ATOMICS 1 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 -/* The libunwind functions are only available on x86 */ -/* #undef HAVE_LIBUNWIND_H */ - -/* C library functions */ -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_SETENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTLBYNAME 1 -#define HAVE_O_CLOEXEC 1 - -/* enable iPhone version of Core Audio driver */ -#define SDL_AUDIO_DRIVER_COREAUDIO 1 -/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DUMMY 1 - -/* Enable joystick support */ -/* Only enable HIDAPI support if you want to support Steam Controllers on iOS and tvOS */ -/*#define SDL_JOYSTICK_HIDAPI 1*/ -#define SDL_JOYSTICK_MFI 1 -#define SDL_JOYSTICK_VIRTUAL 1 - -#ifdef __TVOS__ -#define SDL_SENSOR_DUMMY 1 -#else -/* Enable the CoreMotion sensor driver */ -#define SDL_SENSOR_COREMOTION 1 -#endif - -/* Enable Unix style SO loading */ -#define SDL_LOADSO_DLOPEN 1 - -/* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 - -/* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 - -/* Supported video drivers */ -#define SDL_VIDEO_DRIVER_UIKIT 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 - -/* Enable OpenGL ES */ -#if !TARGET_OS_MACCATALYST -#define SDL_VIDEO_OPENGL_ES2 1 -#define SDL_VIDEO_OPENGL_ES 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif - -/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer - Also supported in simulator from iOS 13.0 and tvOS 13.0 - */ -#if (TARGET_OS_SIMULATOR && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (__TV_OS_VERSION_MIN_REQUIRED >= 130000))) || (!TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000))) -#define SDL_PLATFORM_SUPPORTS_METAL 1 -#else -#define SDL_PLATFORM_SUPPORTS_METAL 0 -#endif - -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_RENDER_METAL 1 -#endif - -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_VULKAN 1 -#endif - -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_METAL 1 -#endif - -/* Enable system power support */ -#define SDL_POWER_UIKIT 1 - -/* enable iPhone keyboard support */ -#define SDL_IPHONE_KEYBOARD 1 - -/* enable iOS extended launch screen */ -#define SDL_IPHONE_LAUNCHSCREEN 1 - -/* enable filesystem support */ -#define SDL_FILESYSTEM_COCOA 1 - -#endif /* SDL_config_iphoneos_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_macosx.h b/meta/win/include/SDL2/SDL_config_macosx.h deleted file mode 100644 index 023ecaae..00000000 --- a/meta/win/include/SDL2/SDL_config_macosx.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_macosx_h_ -#define SDL_config_macosx_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ -#include - -/* This is a set of defines to configure the SDL features */ - -#ifdef __LP64__ - #define SIZEOF_VOIDP 8 -#else - #define SIZEOF_VOIDP 4 -#endif - -/* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_LIBUNWIND_H 1 - -/* C library functions */ -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOK_R 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COPYSIGNF 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -#define HAVE_SYSCONF 1 -#define HAVE_SYSCTLBYNAME 1 - -#if defined(__has_include) && (defined(__i386__) || defined(__x86_64)) -# if __has_include() -# define HAVE_IMMINTRIN_H 1 -# endif -#endif - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070) -#define HAVE_O_CLOEXEC 1 -#endif - -#define HAVE_GCC_ATOMICS 1 - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_COREAUDIO 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_HIDAPI 1 -#define SDL_JOYSTICK_IOKIT 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_IOKIT 1 - -/* The MFI controller support requires ARC Objective C runtime */ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !defined(__i386__) -#define SDL_JOYSTICK_MFI 1 -#endif - -/* Enable the dummy sensor driver */ -#define SDL_SENSOR_DUMMY 1 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_DLOPEN 1 - -/* Enable various threading systems */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 - -/* Enable various timer systems */ -#define SDL_TIMER_UNIX 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_COCOA 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#undef SDL_VIDEO_DRIVER_X11 -#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib" -#define SDL_VIDEO_DRIVER_X11_XDBE 1 -#define SDL_VIDEO_DRIVER_X11_XRANDR 1 -#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 -#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 -#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 - -#ifdef MAC_OS_X_VERSION_10_8 -/* - * No matter the versions targeted, this is the 10.8 or later SDK, so you have - * to use the external Xquartz, which is a more modern Xlib. Previous SDKs - * used an older Xlib. - */ -#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 -#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 -#endif - -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif - -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif - -/* Metal only supported on 64-bit architectures with 10.11+ */ -#if TARGET_RT_64_BIT && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) -#define SDL_PLATFORM_SUPPORTS_METAL 1 -#else -#define SDL_PLATFORM_SUPPORTS_METAL 0 -#endif - -#ifndef SDL_VIDEO_RENDER_METAL -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_RENDER_METAL 1 -#else -#define SDL_VIDEO_RENDER_METAL 0 -#endif -#endif - -/* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_CGL -#define SDL_VIDEO_OPENGL_CGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_GLX -#define SDL_VIDEO_OPENGL_GLX 1 -#endif - -/* Enable Vulkan and Metal support */ -#ifndef SDL_VIDEO_VULKAN -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_VULKAN 1 -#else -#define SDL_VIDEO_VULKAN 0 -#endif -#endif - -#ifndef SDL_VIDEO_METAL -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_METAL 1 -#else -#define SDL_VIDEO_METAL 0 -#endif -#endif - -/* Enable system power support */ -#define SDL_POWER_MACOSX 1 - -/* enable filesystem support */ -#define SDL_FILESYSTEM_COCOA 1 - -/* Enable assembly routines */ -#ifdef __ppc__ -#define SDL_ALTIVEC_BLITTERS 1 -#endif - -#endif /* SDL_config_macosx_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_minimal.h b/meta/win/include/SDL2/SDL_config_minimal.h deleted file mode 100644 index c74fcdb1..00000000 --- a/meta/win/include/SDL2/SDL_config_minimal.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_minimal_h_ -#define SDL_config_minimal_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/** - * \file SDL_config_minimal.h - * - * This is the minimal configuration that can be used to build SDL. - */ - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 - -/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ -#if defined(_MSC_VER) && (_MSC_VER < 1600) -/* Here are some reasonable defaults */ -typedef unsigned int size_t; -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -typedef unsigned long uintptr_t; -#else -#define HAVE_STDINT_H 1 -#define HAVE_INTTYPES_H 1 -#endif /* Visual Studio 2008 */ - -#ifdef __GNUC__ -#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 -#endif - -/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ -#define SDL_JOYSTICK_DISABLED 1 - -/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DISABLED 1 - -/* Enable the stub HIDAPI */ -#define SDL_HIDAPI_DISABLED 1 - -/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ -#define SDL_SENSOR_DISABLED 1 - -/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 - -/* Enable the stub thread support (src/thread/generic/\*.c) */ -#define SDL_THREADS_DISABLED 1 - -/* Enable the stub timer support (src/timer/dummy/\*.c) */ -#define SDL_TIMERS_DISABLED 1 - -/* Enable the dummy video driver (src/video/dummy/\*.c) */ -#define SDL_VIDEO_DRIVER_DUMMY 1 - -/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ -#define SDL_FILESYSTEM_DUMMY 1 - -#endif /* SDL_config_minimal_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_ngage.h b/meta/win/include/SDL2/SDL_config_ngage.h deleted file mode 100644 index a9d2d37a..00000000 --- a/meta/win/include/SDL2/SDL_config_ngage.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_ngage_h_ -#define SDL_config_ngage_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -typedef unsigned long uintptr_t; - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MATH_H 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SQRT 1 -#define HAVE_TAN 1 -#define HAVE_MALLOC 1 -#define SDL_MAIN_NEEDED 1 -#define LACKS_SYS_MMAN_H 1 - -/* Enable the N-Gage thread support (src/thread/ngage/\*.c) */ -#define SDL_THREAD_NGAGE 1 - -/* Enable the N-Gage timer support (src/timer/ngage/\*.c) */ -#define SDL_TIMER_NGAGE 1 - -/* Enable the N-Gage video driver (src/video/ngage/\*.c) */ -#define SDL_VIDEO_DRIVER_NGAGE 1 - -/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ -#define SDL_JOYSTICK_DISABLED 1 - -/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ -#define SDL_HAPTIC_DISABLED 1 - -/* Enable the stub HIDAPI */ -#define SDL_HIDAPI_DISABLED 1 - -/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ -#define SDL_SENSOR_DISABLED 1 - -/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 - -/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ -#define SDL_FILESYSTEM_DUMMY 1 - -#endif /* SDL_config_ngage_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_os2.h b/meta/win/include/SDL2/SDL_config_os2.h deleted file mode 100644 index 1583245e..00000000 --- a/meta/win/include/SDL2/SDL_config_os2.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_os2_h_ -#define SDL_config_os2_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#define SIZEOF_VOIDP 4 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_OS2 1 - -#define SDL_POWER_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 - -#define SDL_SENSOR_DUMMY 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_OS2 1 -#define SDL_JOYSTICK_OS2 1 -#ifndef HAVE_LIBUSB_H /* see Makefile */ -#define SDL_HIDAPI_DISABLED 1 -/*#undef SDL_JOYSTICK_HIDAPI */ -#else -#define SDL_JOYSTICK_HIDAPI 1 -/* dynamically loaded libusb-1.0 dll: */ -#define SDL_LIBUSB_DYNAMIC "usb100.dll" -#endif -/*#undef SDL_JOYSTICK_VIRTUAL */ - -/* Enable OpenGL support */ -/* #undef SDL_VIDEO_OPENGL */ - -#define SDL_THREAD_OS2 1 -#define SDL_LOADSO_OS2 1 -#define SDL_TIMER_OS2 1 -#define SDL_FILESYSTEM_OS2 1 - -/* use libsamplerate for audio rate conversion. */ -/*#define HAVE_LIBSAMPLERATE_H 1 */ - -/* Enable dynamic libsamplerate support */ -#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL" - -#define HAVE_LIBC 1 - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 - -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_WCHAR_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_SIGNAL_H 1 - -#if 0 /* see Makefile */ -#define HAVE_ICONV 1 -#define HAVE_ICONV_H 1 -#endif - -/* #undef HAVE_DLOPEN */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#if defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE__FTELLI64 1 -#endif -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -#define HAVE_WCSCMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -/* #undef HAVE_WCSDUP */ -#define HAVE__WCSDUP 1 -#define HAVE_WCSSTR 1 -#define HAVE_WCSCMP 1 -#define HAVE_WCSNCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -#define HAVE_ITOA 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE__I64TOA 1 -#define HAVE__UI64TOA 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_VSSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_SETJMP 1 -#define HAVE_ACOS 1 -/* #undef HAVE_ACOSF */ -#define HAVE_ASIN 1 -/* #undef HAVE_ASINF */ -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -/* #undef HAVE_ATAN2F */ -#define HAVE_CEIL 1 -/* #undef HAVE_CEILF */ -/* #undef HAVE_COPYSIGN */ -/* #undef HAVE_COPYSIGNF */ -#define HAVE_COS 1 -/* #undef HAVE_COSF */ -#define HAVE_EXP 1 -/* #undef HAVE_EXPF */ -#define HAVE_FABS 1 -/* #undef HAVE_FABSF */ -#define HAVE_FLOOR 1 -/* #undef HAVE_FLOORF */ -#define HAVE_FMOD 1 -/* #undef HAVE_FMODF */ -#define HAVE_LOG 1 -/* #undef HAVE_LOGF */ -#define HAVE_LOG10 1 -/* #undef HAVE_LOG10F */ -#define HAVE_POW 1 -/* #undef HAVE_POWF */ -#define HAVE_SIN 1 -/* #undef HAVE_SINF */ -/* #undef HAVE_SCALBN */ -/* #undef HAVE_SCALBNF */ -#define HAVE_SQRT 1 -/* #undef HAVE_SQRTF */ -#define HAVE_TAN 1 -/* #undef HAVE_TANF */ -/* #undef HAVE_TRUNC */ -/* #undef HAVE_TRUNCF */ -/* #undef HAVE_LROUND */ -/* #undef HAVE_LROUNDF */ -/* #undef HAVE_ROUND */ -/* #undef HAVE_ROUNDF */ - -#endif /* SDL_config_os2_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_pandora.h b/meta/win/include/SDL2/SDL_config_pandora.h deleted file mode 100644 index 01bbf49b..00000000 --- a/meta/win/include/SDL2/SDL_config_pandora.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_pandora_h_ -#define SDL_config_pandora_h_ -#define SDL_config_h_ - -/* This is a set of defines to configure the SDL features */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#define SDL_BYTEORDER 1234 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MATH_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 - -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_STRLEN 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_OSS 1 - -#define SDL_INPUT_LINUXEV 1 -#define SDL_JOYSTICK_LINUX 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_LINUX 1 - -#define SDL_SENSOR_DUMMY 1 - -#define SDL_LOADSO_DLOPEN 1 - -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 - -#define SDL_TIMER_UNIX 1 -#define SDL_FILESYSTEM_UNIX 1 - -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_X11 1 -#define SDL_VIDEO_DRIVER_PANDORA 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_OPENGL_ES 1 - -#endif /* SDL_config_pandora_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_windows.h b/meta/win/include/SDL2/SDL_config_windows.h deleted file mode 100644 index 3ad3e8ff..00000000 --- a/meta/win/include/SDL2/SDL_config_windows.h +++ /dev/null @@ -1,351 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_windows_h_ -#define SDL_config_windows_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK, - * but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence. - * If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */ -#if !defined(HAVE_WINSDKVER_H) && defined(__has_include) -#if __has_include() -#define HAVE_WINSDKVER_H 1 -#endif -#endif - -#ifdef HAVE_WINSDKVER_H -#include -#endif - -/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the - * Windows 10 SDK have broken declarations for the C API for DirectX 12. */ -#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include) -#if __has_include() -#define HAVE_SDKDDKVER_H 1 -#endif -#endif - -#ifdef HAVE_SDKDDKVER_H -#include -#endif - -/* This is a set of defines to configure the SDL features */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__clang__) || defined(__BORLANDC__) || defined(__CODEGEARC__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -#endif -#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) -#define LONG_PTR LONG -#endif -#else /* !__GNUC__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __GNUC__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -#ifdef _WIN64 -# define SIZEOF_VOIDP 8 -#else -# define SIZEOF_VOIDP 4 -#endif - -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - -#define HAVE_DDRAW_H 1 -#define HAVE_DINPUT_H 1 -#define HAVE_DSOUND_H 1 -#ifndef __WATCOMC__ -#define HAVE_DXGI_H 1 -#define HAVE_XINPUT_H 1 -#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ -#define HAVE_WINDOWS_GAMING_INPUT_H 1 -#endif -#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */ -#define HAVE_D3D11_H 1 -#define HAVE_ROAPI_H 1 -#endif -#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ -#define HAVE_D3D12_H 1 -#endif -#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ -#define HAVE_SHELLSCALINGAPI_H 1 -#endif -#define HAVE_MMDEVICEAPI_H 1 -#define HAVE_AUDIOCLIENT_H 1 -#define HAVE_TPCSHRD_H 1 -#define HAVE_SENSORSAPI_H 1 -#endif -#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) -#define HAVE_IMMINTRIN_H 1 -#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) -# if __has_include() -# define HAVE_IMMINTRIN_H 1 -# endif -#endif - -/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ -#ifdef HAVE_LIBC -/* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__STRUPR */ -/* #undef HAVE__STRLWR */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__ULTOA */ -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE__WCSDUP 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_FMOD 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SQRT 1 -#define HAVE_TAN 1 -#ifndef __WATCOMC__ -#define HAVE_ACOSF 1 -#define HAVE_ASINF 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEILF 1 -#define HAVE__COPYSIGN 1 -#define HAVE_COSF 1 -#define HAVE_EXPF 1 -#define HAVE_FABSF 1 -#define HAVE_FLOORF 1 -#define HAVE_FMODF 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10F 1 -#define HAVE_POWF 1 -#define HAVE_SINF 1 -#define HAVE_SQRTF 1 -#define HAVE_TANF 1 -#endif -#if defined(_MSC_VER) -/* These functions were added with the VC++ 2013 C runtime library */ -#if _MSC_VER >= 1800 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#endif -/* This function is available with at least the VC++ 2008 C runtime library */ -#if _MSC_VER >= 1400 -#define HAVE__FSEEKI64 1 -#endif -#ifdef _USE_MATH_DEFINES -#define HAVE_M_PI 1 -#endif -#elif defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_ROUND 1 -#define HAVE_SCALBN 1 -#define HAVE_TRUNC 1 -#else -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#endif - -/* Enable various audio drivers */ -#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) -#define SDL_AUDIO_DRIVER_WASAPI 1 -#endif -#define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_WINMM 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_DINPUT 1 -#define SDL_JOYSTICK_HIDAPI 1 -#ifndef __WINRT__ -#define SDL_JOYSTICK_RAWINPUT 1 -#endif -#define SDL_JOYSTICK_VIRTUAL 1 -#ifdef HAVE_WINDOWS_GAMING_INPUT_H -#define SDL_JOYSTICK_WGI 1 -#endif -#define SDL_JOYSTICK_XINPUT 1 -#define SDL_HAPTIC_DINPUT 1 -#define SDL_HAPTIC_XINPUT 1 - -/* Enable the sensor driver */ -#ifdef HAVE_SENSORSAPI_H -#define SDL_SENSOR_WINDOWS 1 -#else -#define SDL_SENSOR_DUMMY 1 -#endif - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 - -/* Enable various threading systems */ -#define SDL_THREAD_GENERIC_COND_SUFFIX 1 -#define SDL_THREAD_WINDOWS 1 - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) -#define SDL_VIDEO_RENDER_D3D11 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) -#define SDL_VIDEO_RENDER_D3D12 1 -#endif - -/* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif - -/* Enable Vulkan support */ -#define SDL_VIDEO_VULKAN 1 - -/* Enable system power support */ -#define SDL_POWER_WINDOWS 1 - -/* Enable filesystem support */ -#define SDL_FILESYSTEM_WINDOWS 1 - -#endif /* SDL_config_windows_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/meta/win/include/SDL2/SDL_config_wingdk.h b/meta/win/include/SDL2/SDL_config_wingdk.h deleted file mode 100644 index d456024f..00000000 --- a/meta/win/include/SDL2/SDL_config_wingdk.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_wingdk_h_ -#define SDL_config_wingdk_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/* Windows GDK does not need Windows SDK version checks because it requires - * a recent version of the Windows 10 SDK. */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -/* At this time, only recent MSVC or clang are supported by Windows GDK */ -#if defined(__clang__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -typedef unsigned __int64 uintptr_t; -#define _UINTPTR_T_DEFINED -#endif -#else /* !__clang__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __clang__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -/* GDK only supports 64-bit */ -# define SIZEOF_VOIDP 8 - -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - -#define HAVE_DDRAW_H 1 -#define HAVE_DINPUT_H 1 -#define HAVE_DSOUND_H 1 -/* No SDK version checks needed for these because the SDK has to be new. */ -#define HAVE_DXGI_H 1 -#define HAVE_XINPUT_H 1 -#define HAVE_WINDOWS_GAMING_INPUT_H 1 -#define HAVE_D3D11_H 1 -#define HAVE_ROAPI_H 1 -#define HAVE_D3D12_H 1 -#define HAVE_SHELLSCALINGAPI_H 1 -#define HAVE_MMDEVICEAPI_H 1 -#define HAVE_AUDIOCLIENT_H 1 -#define HAVE_TPCSHRD_H 1 -#define HAVE_SENSORSAPI_H 1 -#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) -#define HAVE_IMMINTRIN_H 1 -#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) -# if __has_include() -# define HAVE_IMMINTRIN_H 1 -# endif -#endif - -/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ -#ifdef HAVE_LIBC -/* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__STRUPR */ -/* #undef HAVE__STRLWR */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__ULTOA */ -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE__WCSDUP 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_FMOD 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SQRT 1 -#define HAVE_TAN 1 -#define HAVE_ACOSF 1 -#define HAVE_ASINF 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEILF 1 -#define HAVE__COPYSIGN 1 -#define HAVE_COSF 1 -#define HAVE_EXPF 1 -#define HAVE_FABSF 1 -#define HAVE_FLOORF 1 -#define HAVE_FMODF 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10F 1 -#define HAVE_POWF 1 -#define HAVE_SINF 1 -#define HAVE_SQRTF 1 -#define HAVE_TANF 1 -#if defined(_MSC_VER) -/* These functions were added with the VC++ 2013 C runtime library */ -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE__FSEEKI64 1 -#ifdef _USE_MATH_DEFINES -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#endif - -/* Enable various audio drivers */ -#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) -#define SDL_AUDIO_DRIVER_WASAPI 1 -#endif -#define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_WINMM 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#define SDL_JOYSTICK_DINPUT 1 -#define SDL_JOYSTICK_HIDAPI 1 -#define SDL_JOYSTICK_RAWINPUT 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#ifdef HAVE_WINDOWS_GAMING_INPUT_H -#define SDL_JOYSTICK_WGI 1 -#endif -#define SDL_JOYSTICK_XINPUT 1 -#define SDL_HAPTIC_DINPUT 1 -#define SDL_HAPTIC_XINPUT 1 - -/* Enable the sensor driver */ -#ifdef HAVE_SENSORSAPI_H -#define SDL_SENSOR_WINDOWS 1 -#else -#define SDL_SENSOR_DUMMY 1 -#endif - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 - -/* Enable various threading systems */ -#define SDL_THREAD_GENERIC_COND_SUFFIX 1 -#define SDL_THREAD_WINDOWS 1 - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) -#define SDL_VIDEO_RENDER_D3D11 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) -#define SDL_VIDEO_RENDER_D3D12 1 -#endif - -/* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif - -/* Enable Vulkan support */ -#define SDL_VIDEO_VULKAN 1 - -/* Enable system power support */ -#define SDL_POWER_WINDOWS 1 - -/* Enable filesystem support */ -#define SDL_FILESYSTEM_WINDOWS 1 - -#endif /* SDL_config_wingdk_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/meta/win/include/SDL2/SDL_config_winrt.h b/meta/win/include/SDL2/SDL_config_winrt.h deleted file mode 100644 index 55694036..00000000 --- a/meta/win/include/SDL2/SDL_config_winrt.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_winrt_h_ -#define SDL_config_winrt_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used - by SDL to determine which version of the Windows SDK is being used. -*/ -#include - -/* Define possibly-undefined NTDDI values (used when compiling SDL against - older versions of the Windows SDK. -*/ -#ifndef NTDDI_WINBLUE -#define NTDDI_WINBLUE 0x06030000 -#endif -#ifndef NTDDI_WIN10 -#define NTDDI_WIN10 0x0A000000 -#endif - -/* This is a set of defines to configure the SDL features */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif -#define _UINTPTR_T_DEFINED -#endif -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -#endif -#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) -#define LONG_PTR LONG -#endif -#else /* !__GNUC__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __GNUC__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -#ifdef _WIN64 -# define SIZEOF_VOIDP 8 -#else -# define SIZEOF_VOIDP 4 -#endif - -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - -/* Useful headers */ -#define HAVE_DXGI_H 1 -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP -#define HAVE_XINPUT_H 1 -#endif - -#define HAVE_MMDEVICEAPI_H 1 -#define HAVE_AUDIOCLIENT_H 1 -#define HAVE_TPCSHRD_H 1 - -#define HAVE_LIBC 1 -#define STDC_HEADERS 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -/* #undef HAVE_STRTOLL */ -/* #undef HAVE_STRTOULL */ -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE_VSNPRINTF 1 -/* TODO, WinRT: consider using ??_s versions of the following */ -/* #undef HAVE__STRLWR */ -/* #undef HAVE_ITOA */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__ULTOA */ -/* #undef HAVE_SSCANF */ -#define HAVE_M_PI 1 -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE__COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE__SCALB 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE__FSEEKI64 1 - -#define HAVE_ROAPI_H 1 - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_WASAPI 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 -#else -#define SDL_JOYSTICK_VIRTUAL 1 -#if (NTDDI_VERSION >= NTDDI_WIN10) -#define SDL_JOYSTICK_WGI 1 -#define SDL_HAPTIC_DISABLED 1 -#else -#define SDL_JOYSTICK_XINPUT 1 -#define SDL_HAPTIC_XINPUT 1 -#endif /* WIN10 */ -#endif - -/* WinRT doesn't have HIDAPI available */ -#define SDL_HIDAPI_DISABLED 1 - -/* Enable the dummy sensor driver */ -#define SDL_SENSOR_DUMMY 1 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 - -/* Enable various threading systems */ -#if (NTDDI_VERSION >= NTDDI_WINBLUE) -#define SDL_THREAD_GENERIC_COND_SUFFIX 1 -#define SDL_THREAD_WINDOWS 1 -#else -/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ -#define SDL_THREAD_STDCPP 1 -#endif - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_WINRT 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 - -/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ -#define SDL_VIDEO_OPENGL_ES2 1 -#define SDL_VIDEO_OPENGL_EGL 1 - -/* Enable appropriate renderer(s) */ -#define SDL_VIDEO_RENDER_D3D11 1 - -/* Disable D3D12 as it's not implemented for WinRT */ -#define SDL_VIDEO_RENDER_D3D12 0 - -#if SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif - -/* Enable system power support */ -#define SDL_POWER_WINRT 1 - -#endif /* SDL_config_winrt_h_ */ diff --git a/meta/win/include/SDL2/SDL_config_xbox.h b/meta/win/include/SDL2/SDL_config_xbox.h deleted file mode 100644 index 4e68e9f9..00000000 --- a/meta/win/include/SDL2/SDL_config_xbox.h +++ /dev/null @@ -1,267 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_wingdk_h_ -#define SDL_config_wingdk_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -/* Windows GDK does not need Windows SDK version checks because it requires - * a recent version of the Windows 10 SDK. */ - -#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) -/* At this time, only recent MSVC or clang are supported by Windows GDK */ -#if defined(__clang__) -#define HAVE_STDINT_H 1 -#elif defined(_MSC_VER) -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#ifndef _UINTPTR_T_DEFINED -typedef unsigned __int64 uintptr_t; -#define _UINTPTR_T_DEFINED -#endif -#else /* !__clang__ && !_MSC_VER */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#ifndef _SIZE_T_DEFINED_ -#define _SIZE_T_DEFINED_ -typedef unsigned int size_t; -#endif -typedef unsigned int uintptr_t; -#endif /* __clang__ || _MSC_VER */ -#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ - -/* GDK only supports 64-bit */ -# define SIZEOF_VOIDP 8 - -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - -/*#define HAVE_DDRAW_H 1*/ -/*#define HAVE_DINPUT_H 1*/ -/*#define HAVE_DSOUND_H 1*/ -/* No SDK version checks needed for these because the SDK has to be new. */ -/* #define HAVE_DXGI_H 1 */ -#define HAVE_XINPUT_H 1 -/*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/ -/*#define HAVE_D3D11_H 1*/ -/*#define HAVE_ROAPI_H 1*/ -#define HAVE_D3D12_H 1 -/*#define HAVE_SHELLSCALINGAPI_H 1*/ -#define HAVE_MMDEVICEAPI_H 1 -#define HAVE_AUDIOCLIENT_H 1 -/*#define HAVE_TPCSHRD_H 1*/ -/*#define HAVE_SENSORSAPI_H 1*/ -#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) -#define HAVE_IMMINTRIN_H 1 -#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) -# if __has_include() -# define HAVE_IMMINTRIN_H 1 -# endif -#endif - -/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ -#ifdef HAVE_LIBC -/* Useful headers */ -#define STDC_HEADERS 1 -#define HAVE_CTYPE_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STRING_H 1 - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__STRUPR */ -/* #undef HAVE__STRLWR */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -/* These functions have security warnings, so we won't use them */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__ULTOA */ -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE__STRICMP 1 -#define HAVE__STRNICMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE__WCSDUP 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_FMOD 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SQRT 1 -#define HAVE_TAN 1 -#define HAVE_ACOSF 1 -#define HAVE_ASINF 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEILF 1 -#define HAVE__COPYSIGN 1 -#define HAVE_COSF 1 -#define HAVE_EXPF 1 -#define HAVE_FABSF 1 -#define HAVE_FLOORF 1 -#define HAVE_FMODF 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10F 1 -#define HAVE_POWF 1 -#define HAVE_SINF 1 -#define HAVE_SQRTF 1 -#define HAVE_TANF 1 -#if defined(_MSC_VER) -/* These functions were added with the VC++ 2013 C runtime library */ -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SCALBNF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE__FSEEKI64 1 -#ifdef _USE_MATH_DEFINES -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_M_PI 1 -#endif -#else -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#endif - -/* Enable various audio drivers */ -#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) -#define SDL_AUDIO_DRIVER_WASAPI 1 -#endif -/*#define SDL_AUDIO_DRIVER_DSOUND 1*/ -/*#define SDL_AUDIO_DRIVER_WINMM 1*/ -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -/*#define SDL_JOYSTICK_DINPUT 1*/ -/*#define SDL_JOYSTICK_HIDAPI 1*/ -/*#define SDL_JOYSTICK_RAWINPUT 1*/ -#define SDL_JOYSTICK_VIRTUAL 1 -#ifdef HAVE_WINDOWS_GAMING_INPUT_H -#define SDL_JOYSTICK_WGI 1 -#endif -#define SDL_JOYSTICK_XINPUT 1 -/*#define SDL_HAPTIC_DINPUT 1*/ -#define SDL_HAPTIC_XINPUT 1 - -/* Enable the sensor driver */ -#ifdef HAVE_SENSORSAPI_H -#define SDL_SENSOR_WINDOWS 1 -#else -#define SDL_SENSOR_DUMMY 1 -#endif - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 - -/* Enable various threading systems */ -#define SDL_THREAD_GENERIC_COND_SUFFIX 1 -#define SDL_THREAD_WINDOWS 1 - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -/* #ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif*/ -#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) -#define SDL_VIDEO_RENDER_D3D11 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) -#define SDL_VIDEO_RENDER_D3D12 1 -#endif - -/* Enable system power support */ -/*#define SDL_POWER_WINDOWS 1*/ -#define SDL_POWER_HARDWIRED 1 - -/* Enable filesystem support */ -/* #define SDL_FILESYSTEM_WINDOWS 1*/ -#define SDL_FILESYSTEM_XBOX 1 - -/* Disable IME as not supported yet (TODO: Xbox IME?) */ -#define SDL_DISABLE_WINDOWS_IME 1 - -#endif /* SDL_config_wingdk_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/meta/win/include/SDL2/SDL_copying.h b/meta/win/include/SDL2/SDL_copying.h deleted file mode 100644 index 49e3f9da..00000000 --- a/meta/win/include/SDL2/SDL_copying.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ diff --git a/meta/win/include/SDL2/SDL_cpuinfo.h b/meta/win/include/SDL2/SDL_cpuinfo.h index 43a8ac50..2a9dd380 100644 --- a/meta/win/include/SDL2/SDL_cpuinfo.h +++ b/meta/win/include/SDL2/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,6 +90,7 @@ _m_prefetch(void *__P) # include # include # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ +# define __ARM_ARCH 8 # endif # endif #endif diff --git a/meta/win/include/SDL2/SDL_egl.h b/meta/win/include/SDL2/SDL_egl.h index f90e27b2..a4276e68 100644 --- a/meta/win/include/SDL2/SDL_egl.h +++ b/meta/win/include/SDL2/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -192,6 +192,20 @@ typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T +#endif +#endif #elif defined(__VMS ) || defined(__sgi) @@ -274,14 +288,21 @@ typedef unsigned short int khronos_uint16_t; * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ -#ifdef _WIN64 +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif @@ -516,7 +537,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: b35e89ca9a $ on $Git commit date: 2021-09-01 09:34:00 +0530 $ +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ */ /*#include */ @@ -525,7 +546,7 @@ extern "C" { #define EGL_EGL_PROTOTYPES 1 #endif -/* Generated on date 20210901 */ +/* Generated on date 20220525 */ /* Generated C header for: * API: egl @@ -860,12 +881,12 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: b35e89ca9a $ on $Git commit date: 2021-09-01 09:34:00 +0530 $ +** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ */ /*#include */ -#define EGL_EGLEXT_VERSION 20210901 +#define EGL_EGLEXT_VERSION 20220525 /* Generated C header for: * API: egl @@ -1569,6 +1590,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceBinaryEXT (EGLDeviceEXT device, EGLi #define EGL_RENDERER_EXT 0x335F #endif /* EGL_EXT_device_query_name */ +#ifndef EGL_EXT_explicit_device +#define EGL_EXT_explicit_device 1 +#endif /* EGL_EXT_explicit_device */ + #ifndef EGL_EXT_gl_colorspace_bt2020_linear #define EGL_EXT_gl_colorspace_bt2020_linear 1 #define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F @@ -1794,6 +1819,31 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStr #define EGL_METADATA_SCALING_EXT 50000 #endif /* EGL_EXT_surface_SMPTE2086_metadata */ +#ifndef EGL_EXT_surface_compression +#define EGL_EXT_surface_compression 1 +#define EGL_SURFACE_COMPRESSION_EXT 0x34B0 +#define EGL_SURFACE_COMPRESSION_PLANE1_EXT 0x328E +#define EGL_SURFACE_COMPRESSION_PLANE2_EXT 0x328F +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT 0x34B1 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT 0x34B2 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT 0x34B4 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_2BPC_EXT 0x34B5 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_3BPC_EXT 0x34B6 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_4BPC_EXT 0x34B7 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_5BPC_EXT 0x34B8 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_6BPC_EXT 0x34B9 +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_7BPC_EXT 0x34BA +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_8BPC_EXT 0x34BB +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_9BPC_EXT 0x34BC +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_10BPC_EXT 0x34BD +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_11BPC_EXT 0x34BE +#define EGL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT 0x34BF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSUPPORTEDCOMPRESSIONRATESEXTPROC) (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySupportedCompressionRatesEXT (EGLDisplay dpy, EGLConfig config, const EGLAttrib *attrib_list, EGLint *rates, EGLint rate_size, EGLint *num_rates); +#endif +#endif /* EGL_EXT_surface_compression */ + #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *rects, EGLint n_rects); @@ -2028,12 +2078,12 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface sur #define EGL_STREAM_IMAGE_ADD_NV 0x3374 #define EGL_STREAM_IMAGE_REMOVE_NV 0x3375 #define EGL_STREAM_IMAGE_AVAILABLE_NV 0x3376 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, EGLuint64KHR *modifiers, EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMIMAGECONSUMERCONNECTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); typedef EGLint (EGLAPIENTRYP PFNEGLQUERYSTREAMCONSUMEREVENTNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMACQUIREIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMRELEASEIMAGENVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglStreamImageConsumerConnectNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, EGLuint64KHR *modifiers, EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamImageConsumerConnectNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint num_modifiers, const EGLuint64KHR *modifiers, const EGLAttrib *attrib_list); EGLAPI EGLint EGLAPIENTRY eglQueryStreamConsumerEventNV (EGLDisplay dpy, EGLStreamKHR stream, EGLTime timeout, EGLenum *event, EGLAttrib *aux); EGLAPI EGLBoolean EGLAPIENTRY eglStreamAcquireImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage *pImage, EGLSync sync); EGLAPI EGLBoolean EGLAPIENTRY eglStreamReleaseImageNV (EGLDisplay dpy, EGLStreamKHR stream, EGLImage image, EGLSync sync); diff --git a/meta/win/include/SDL2/SDL_endian.h b/meta/win/include/SDL2/SDL_endian.h index c3f84317..591ccac4 100644 --- a/meta/win/include/SDL2/SDL_endian.h +++ b/meta/win/include/SDL2/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,7 @@ extern "C" { #if HAS_BUILTIN_BSWAP16 #define SDL_Swap16(x) __builtin_bswap16(x) -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #pragma intrinsic(_byteswap_ushort) #define SDL_Swap16(x) _byteswap_ushort(x) #elif defined(__i386__) && !HAS_BROKEN_BSWAP @@ -189,7 +189,7 @@ SDL_Swap16(Uint16 x) #if HAS_BUILTIN_BSWAP32 #define SDL_Swap32(x) __builtin_bswap32(x) -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #pragma intrinsic(_byteswap_ulong) #define SDL_Swap32(x) _byteswap_ulong(x) #elif defined(__i386__) && !HAS_BROKEN_BSWAP @@ -241,7 +241,7 @@ SDL_Swap32(Uint32 x) #if HAS_BUILTIN_BSWAP64 #define SDL_Swap64(x) __builtin_bswap64(x) -#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #pragma intrinsic(_byteswap_uint64) #define SDL_Swap64(x) _byteswap_uint64(x) #elif defined(__i386__) && !HAS_BROKEN_BSWAP diff --git a/meta/win/include/SDL2/SDL_error.h b/meta/win/include/SDL2/SDL_error.h index 5c961e42..2df6463a 100644 --- a/meta/win/include/SDL2/SDL_error.h +++ b/meta/win/include/SDL2/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_events.h b/meta/win/include/SDL2/SDL_events.h index c0fc9bb1..eccbba25 100644 --- a/meta/win/include/SDL2/SDL_events.h +++ b/meta/win/include/SDL2/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -131,6 +131,8 @@ typedef enum SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */ SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */ SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */ + SDL_CONTROLLERUPDATECOMPLETE_RESERVED_FOR_SDL3, + SDL_CONTROLLERSTEAMHANDLEUPDATED, /**< Game controller Steam handle has changed */ /* Touch events */ SDL_FINGERDOWN = 0x700, @@ -143,7 +145,7 @@ typedef enum SDL_MULTIGESTURE, /* Clipboard events */ - SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ + SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard or primary selection changed */ /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ @@ -318,6 +320,8 @@ typedef struct SDL_MouseWheelEvent Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */ float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */ + Sint32 mouseX; /**< X coordinate, relative to window (added in 2.26.0) */ + Sint32 mouseY; /**< Y coordinate, relative to window (added in 2.26.0) */ } SDL_MouseWheelEvent; /** @@ -444,7 +448,7 @@ typedef struct SDL_ControllerButtonEvent */ typedef struct SDL_ControllerDeviceEvent { - Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ + Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, ::SDL_CONTROLLERDEVICEREMAPPED, or ::SDL_CONTROLLERSTEAMHANDLEUPDATED */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -474,6 +478,7 @@ typedef struct SDL_ControllerSensorEvent SDL_JoystickID which; /**< The joystick instance id */ Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */ float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ + Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ } SDL_ControllerSensorEvent; /** @@ -565,6 +570,7 @@ typedef struct SDL_SensorEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The instance ID of the sensor */ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ + Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ } SDL_SensorEvent; /** @@ -576,15 +582,6 @@ typedef struct SDL_QuitEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; -/** - * \brief OS Specific event - */ -typedef struct SDL_OSEvent -{ - Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ -} SDL_OSEvent; - /** * \brief A user-defined event type (event.user.*) */ diff --git a/meta/win/include/SDL2/SDL_filesystem.h b/meta/win/include/SDL2/SDL_filesystem.h index a7606bde..07498898 100644 --- a/meta/win/include/SDL2/SDL_filesystem.h +++ b/meta/win/include/SDL2/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,7 +60,11 @@ extern "C" { * - `parent`: the containing directory of the bundle. For example: * `/Applications/SDLApp/` * - * The returned path is guaranteed to end with a path separator ('\' on + * **Nintendo 3DS Specific Functionality**: This function returns "romfs" + * directory of the application as it is uncommon to store resources outside + * the executable. As such it is not a writable directory. + * + * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * The pointer returned is owned by the caller. Please call SDL_free() on the @@ -116,7 +120,7 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. * - * The returned path is guaranteed to end with a path separator ('\' on + * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * The pointer returned is owned by the caller. Please call SDL_free() on the diff --git a/meta/win/include/SDL2/SDL_gamecontroller.h b/meta/win/include/SDL2/SDL_gamecontroller.h index ace1c163..281fa356 100644 --- a/meta/win/include/SDL2/SDL_gamecontroller.h +++ b/meta/win/include/SDL2/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,7 +73,8 @@ typedef enum SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, + SDL_CONTROLLER_TYPE_MAX } SDL_GameControllerType; typedef enum @@ -523,6 +524,20 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont */ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); +/** + * Get the Steam Input handle of an opened controller, if available. + * + * Returns an InputHandle_t for the controller that can be used with Steam Input API: + * https://partner.steamgames.com/doc/api/ISteamInput + * + * \param gamecontroller the game controller object to query. + * \returns the gamepad handle, or 0 if unavailable. + * + * \since This function is available since SDL 2.30.0. + */ +extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller); + + /** * Check if a controller has been opened and is currently connected. * @@ -598,7 +613,9 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); * and are centered within ~8000 of zero, though advanced UI will allow users to set * or autodetect the dead zone, which varies between controllers. * - * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. + * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX + * (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the + * same range that will be reported by the lower-level SDL_GetJoystickAxis(). */ typedef enum { @@ -687,8 +704,13 @@ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameController * * The axis indices start at index 0. * - * The state is a value ranging from -32768 to 32767. Triggers, however, range - * from 0 to 32767 (they never return a negative value). + * For thumbsticks, the state is a value ranging from -32768 (up/left) + * to 32767 (down/right). + * + * Triggers range from 0 when released to 32767 when fully pressed, and + * never return a negative value. Note that this differs from the value + * reported by the lower-level SDL_GetJoystickAxis(), which normally uses + * the full range. * * \param gamecontroller a game controller * \param axis an axis index (one of the SDL_GameControllerAxis values) @@ -724,10 +746,10 @@ typedef enum SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */ - SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 */ - SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 */ - SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 */ - SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 */ + SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */ + SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */ + SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */ + SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */ SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */ SDL_CONTROLLER_BUTTON_MAX } SDL_GameControllerButton; @@ -754,7 +776,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom * The caller should not SDL_free() the returned string. * * \param button an enum value for a given SDL_GameControllerButton - * \returns a string for the given button, or NULL if an invalid axis is + * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by * SDL_GameController mapping strings. * @@ -895,6 +917,25 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); +/** + * Get the current state of a game controller sensor with the timestamp of the + * last update. + * + * The number of values and interpretation of the data is sensor dependent. + * See SDL_sensor.h for the details for each type of sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \return 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); + /** * Start a rumble effect on a game controller. * diff --git a/meta/win/include/SDL2/SDL_gesture.h b/meta/win/include/SDL2/SDL_gesture.h index e2caea2a..4fffa5f3 100644 --- a/meta/win/include/SDL2/SDL_gesture.h +++ b/meta/win/include/SDL2/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_guid.h b/meta/win/include/SDL2/SDL_guid.h index b971636a..7daa5f1f 100644 --- a/meta/win/include/SDL2/SDL_guid.h +++ b/meta/win/include/SDL2/SDL_guid.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_haptic.h b/meta/win/include/SDL2/SDL_haptic.h index f240ae92..c9ed847d 100644 --- a/meta/win/include/SDL2/SDL_haptic.h +++ b/meta/win/include/SDL2/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_hidapi.h b/meta/win/include/SDL2/SDL_hidapi.h index 354af5c5..b9d8ffac 100644 --- a/meta/win/include/SDL2/SDL_hidapi.h +++ b/meta/win/include/SDL2/SDL_hidapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_hints.h b/meta/win/include/SDL2/SDL_hints.h index e7cddba0..e775a650 100644 --- a/meta/win/include/SDL2/SDL_hints.h +++ b/meta/win/include/SDL2/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,7 @@ extern "C" { * By default this hint is not set and the APK expansion files are not searched. */ #define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION" - + /** * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. * @@ -132,13 +132,13 @@ extern "C" { * \brief A variable to control whether we trap the Android back button to handle it manually. * This is necessary for the right mouse button to work on some Android devices, or * to be able to trap the back button for use in your code reliably. If set to true, - * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of * SDL_SCANCODE_AC_BACK. * * The variable can be set to the following values: * "0" - Back button will be handled as usual for system. (default) * "1" - Back button will be trapped, allowing you to handle the key press - * manually. (This will also let right mouse click work on systems + * manually. (This will also let right mouse click work on systems * where the right mouse button functions as back.) * * The value of this hint is used at runtime, so it can be changed at any time. @@ -147,7 +147,7 @@ extern "C" { /** * \brief Specify an application name. - * + * * This hint lets you specify the application name sent to the OS when * required. For example, this will often appear in volume control applets for * audio streams, and in lists of applications which are inhibiting the @@ -278,10 +278,7 @@ extern "C" { * If this hint isn't specified to a valid setting, or libsamplerate isn't * available, SDL will use the default, internal resampling algorithm. * - * Note that this is currently only applicable to resampling audio that is - * being written to a device for playback or audio being read from a device - * for capture. SDL_AudioCVT always uses the default resampler (although this - * might change for SDL 2.1). + * As of SDL 2.26, SDL_ConvertAudio() respects this hint when libsamplerate is available. * * This hint is currently only checked at audio subsystem initialization. * @@ -380,6 +377,17 @@ extern "C" { */ #define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" +/** + * \brief A variable that controls whether the on-screen keyboard should be shown when text input is active + * + * The variable can be set to the following values: + * "0" - Do not show the on-screen keyboard + * "1" - Show the on-screen keyboard + * + * The default value is "1". This hint must be set before text input is activated. + */ +#define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" + /** * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs * @@ -510,7 +518,7 @@ extern "C" { /** * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. - * + * * For example, on Nintendo Switch controllers, normally you'd get: * * (Y) @@ -542,6 +550,14 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() + * + * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might + * have the string "0x2563/0x0523,0x28de/0x0000" + */ +#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES" + /** * \brief A variable controlling whether the idle timer is disabled on iOS. * @@ -564,9 +580,9 @@ extern "C" { * * The variable can be set to the following values: * "0" - SDL_TEXTEDITING events are sent, and it is the application's - * responsibility to render the text from these events and + * responsibility to render the text from these events and * differentiate it somehow from committed text. (default) - * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, + * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, * and text that is being composed will be rendered in its own UI. */ #define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" @@ -615,6 +631,110 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * A variable containing a list of arcade stick style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES "SDL_JOYSTICK_ARCADESTICK_DEVICES" + +/** + * A variable containing a list of devices that are not arcade stick style controllers. This will override SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices that should not be considerd joysticks. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES "SDL_JOYSTICK_BLACKLIST_DEVICES" + +/** + * A variable containing a list of devices that should be considered joysticks. This will override SDL_HINT_JOYSTICK_BLACKLIST_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED" + +/** + * A variable containing a list of flightstick style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES "SDL_JOYSTICK_FLIGHTSTICK_DEVICES" + +/** + * A variable containing a list of devices that are not flightstick style controllers. This will override SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices known to have a GameCube form factor. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES "SDL_JOYSTICK_GAMECUBE_DEVICES" + +/** + * A variable containing a list of devices known not to have a GameCube form factor. This will override SDL_HINT_JOYSTICK_GAMECUBE_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED" + /** * \brief A variable controlling whether the HIDAPI joystick drivers should be used. * @@ -672,6 +792,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" +/** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) + * "1" - Left and right Joy-Con controllers will be in vertical mode + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS" + /** * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. * @@ -705,6 +836,20 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_SHIELD "SDL_JOYSTICK_HIDAPI_SHIELD" +/** + * \brief A variable controlling whether the HIDAPI driver for PS3 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on other platforms. + * + * It is not possible to use this driver on Windows, due to limitations in the default drivers + * installed. See https://github.com/ViGEm/DsHidMini for an alternative driver on Windows. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS3 "SDL_JOYSTICK_HIDAPI_PS3" + /** * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. * @@ -787,7 +932,7 @@ extern "C" { #define SDL_HINT_JOYSTICK_HIDAPI_STADIA "SDL_JOYSTICK_HIDAPI_STADIA" /** - * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * \brief A variable controlling whether the HIDAPI driver for Bluetooth Steam Controllers should be used. * * This variable can be set to the following values: * "0" - HIDAPI driver is not used @@ -798,6 +943,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" +/** + * \brief A variable controlling whether the HIDAPI driver for the Steam Deck builtin controller should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK "SDL_JOYSTICK_HIDAPI_STEAMDECK" + /** * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. * @@ -840,6 +996,26 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED" +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_WII "SDL_JOYSTICK_HIDAPI_WII" + +/** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED" + /** * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. * @@ -851,6 +1027,77 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" +/** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 "SDL_JOYSTICK_HIDAPI_XBOX_360" + +/** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE "SDL_JOYSTICK_HIDAPI_XBOX_ONE" + +/** + * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. The default brightness is 0.4. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" + +/** + * A variable controlling whether IOKit should be used for controller handling. + * + * This variable can be set to the following values: + * "0" - IOKit is not used + * "1" - IOKit is used (the default) + */ +#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT" + +/** + * A variable controlling whether GCController should be used for controller handling. + * + * This variable can be set to the following values: + * "0" - GCController is not used + * "1" - GCController is used (the default) + */ +#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI" + /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * @@ -893,6 +1140,80 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" +/** + * A variable containing a list of throttle style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES "SDL_JOYSTICK_THROTTLE_DEVICES" + +/** + * A variable containing a list of devices that are not throttle style controllers. This will override SDL_HINT_JOYSTICK_THROTTLE_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED" + +/** + * \brief A variable controlling whether Windows.Gaming.Input should be used for controller handling. + * + * This variable can be set to the following values: + * "0" - WGI is not used + * "1" - WGI is used (the default) + */ +#define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI" + +/** + * A variable containing a list of wheel style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES "SDL_JOYSTICK_WHEEL_DEVICES" + +/** + * A variable containing a list of devices that are not wheel style controllers. This will override SDL_HINT_JOYSTICK_WHEEL_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices known to have all axes centered at zero. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES" + /** * \brief Determines whether SDL enforces that DRM master is required in order * to initialize the KMSDRM video backend. @@ -961,6 +1282,22 @@ extern "C" { */ #define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES" +/** + * \brief A variable controlling the default SDL log levels. + * + * This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications. + * + * The category can be a numeric category, one of "app", "error", "assert", "system", "audio", "video", "render", "input", "test", or `*` for any unspecified category. + * + * The level can be a numeric level, one of "verbose", "debug", "info", "warn", "error", "critical", or "quiet" to disable that category. + * + * You can omit the category if you want to set the logging level for all categories. + * + * If this hint isn't set, the default log levels are equivalent to: + * "app=info,assert=warn,test=verbose,*=error" + */ +#define SDL_HINT_LOGGING "SDL_LOGGING" + /** * \brief When set don't force the SDL app to become a foreground process * @@ -1064,6 +1401,17 @@ extern "C" { */ #define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" +/** + * \brief A variable controlling whether the system mouse acceleration curve is used for relative mouse motion. + * + * This variable can be set to the following values: + * "0" - Relative mouse motion will be unscaled (the default) + * "1" - Relative mouse motion will be scaled using the system mouse acceleration curve. + * + * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the system speed scale. + */ +#define SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE "SDL_MOUSE_RELATIVE_SYSTEM_SCALE" + /** * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. * @@ -1162,7 +1510,7 @@ extern "C" { * When polling for events, SDL_PumpEvents is used to gather new events from devices. * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will * become stuck until the new events stop. - * This is most noticable when moving a high frequency mouse. + * This is most noticeable when moving a high frequency mouse. * * By default, poll sentinels are enabled. */ @@ -1196,6 +1544,8 @@ extern "C" { * * This variable can be one of the following values: * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + * + * Since SDL 2.0.22 this variable accepts a comma-separated list of values above. */ #define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" @@ -1338,6 +1688,54 @@ extern "C" { */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" +/** + * \brief A variable controlling whether the Metal render driver select low power device over default one + * + * This variable can be set to the following values: + * "0" - Use the prefered OS device + * "1" - Select a low power one + * + * By default the prefered OS device is used. + */ +#define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE" + +/** + * A variable containing a list of ROG gamepad capable mice. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_ROG_GAMEPAD_MICE "SDL_ROG_GAMEPAD_MICE" + +/** + * A variable containing a list of devices that are not ROG gamepad capable mice. This will override SDL_HINT_ROG_GAMEPAD_MICE and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED" + +/** + * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS + * + * This variable can be set to the following values: + * "0" - It will be using VSYNC as defined in the main flag. Default + * "1" - If VSYNC was previously enabled, then it will disable VSYNC if doesn't reach enough speed + * + * By default SDL does not enable the automatic VSYNC + */ +#define SDL_HINT_PS2_DYNAMIC_VSYNC "SDL_PS2_DYNAMIC_VSYNC" + /** * \brief A variable to control whether the return key on the soft keyboard * should hide the soft keyboard on Android and iOS. @@ -1370,7 +1768,7 @@ extern "C" { * disabled. You should use a string that describes what your program is doing * (and, therefore, why the screensaver is disabled). For example, "Playing a * game" or "Watching a video". - * + * * Setting this to "" or leaving it unset will have SDL use a reasonable * default: "Playing a game" or something similar. * @@ -1384,13 +1782,13 @@ extern "C" { * On some platforms, like Linux, a realtime priority thread may be subject to restrictions * that require special handling by the application. This hint exists to let SDL know that * the app is prepared to handle said restrictions. - * + * * On Linux, SDL will apply the following configuration to any thread that becomes realtime: * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. * * Exceeding this limit will result in the kernel sending SIGKILL to the app, * * Refer to the man pages for more information. - * + * * This variable can be set to the following values: * "0" - default platform specific behaviour * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy @@ -1478,7 +1876,7 @@ extern "C" { #define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** - * \brief A variable controlling whether the screensaver is enabled. + * \brief A variable controlling whether the screensaver is enabled. * * This variable can be set to the following values: * "0" - Disable screensaver @@ -1491,7 +1889,7 @@ extern "C" { /** * \brief Tell the video driver that we only want a double buffer. * - * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * By default, most lowlevel 2D APIs will use a triple buffer scheme that * wastes no CPU time on waiting for vsync after issuing a flip, but * introduces a frame of latency. On the other hand, using a double buffer * scheme instead is recommended for cases where low latency is an important @@ -1603,11 +2001,28 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" +/** + * \brief Enable or disable mouse pointer warp emulation, needed by some older games. + * + * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. + * This is required for some older games (such as Source engine games), which warp the + * mouse to the centre of the screen rather than using relative mouse motion. Note that + * relative mouse mode may have different mouse acceleration behaviour than pointer warps. + * + * This variable can be set to the following values: + * "0" - All mouse warps fail, as mouse warping is not available under wayland. + * "1" - Some mouse warps will be emulated by forcing relative mouse mode. + * + * If not set, this is automatically enabled unless an application uses relative mouse + * mode directly. + */ +#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP" + /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). -* +* * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has -* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly +* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly * created SDL_Window: * * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is @@ -1673,13 +2088,13 @@ extern "C" { /** * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. - * + * * This variable can be set to the following values: * "0" - Disable _NET_WM_BYPASS_COMPOSITOR * "1" - Enable _NET_WM_BYPASS_COMPOSITOR - * + * * By default SDL will use _NET_WM_BYPASS_COMPOSITOR - * + * */ #define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" @@ -1813,7 +2228,29 @@ extern "C" { #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" /** - * \brief A variable controlling whether the windows message loop is processed by SDL + * \brief Controls whether menus can be opened with their keyboard shortcut (Alt+mnemonic). + * + * If the mnemonics are enabled, then menus can be opened by pressing the Alt + * key and the corresponding mnemonic (for example, Alt+F opens the File menu). + * However, in case an invalid mnemonic is pressed, Windows makes an audible + * beep to convey that nothing happened. This is true even if the window has + * no menu at all! + * + * Because most SDL applications don't have menus, and some want to use the Alt + * key for other purposes, SDL disables mnemonics (and the beeping) by default. + * + * Note: This also affects keyboard events: with mnemonics enabled, when a + * menu is opened from the keyboard, you will not receive a KEYUP event for + * the mnemonic key, and *might* not receive one for Alt. + * + * This variable can be set to the following values: + * "0" - Alt+mnemonic does nothing, no beeping. (default) + * "1" - Alt+mnemonic opens menus, invalid mnemonics produce a beep. + */ +#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS" + +/** + * \brief A variable controlling whether the windows message loop is processed by SDL * * This variable can be set to the following values: * "0" - The window message loop is not run @@ -1854,7 +2291,7 @@ extern "C" { #define SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL" /** - * \brief A variable to specify custom icon resource id from RC file on Windows platform + * \brief A variable to specify custom icon resource id from RC file on Windows platform */ #define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" #define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" @@ -1893,16 +2330,16 @@ extern "C" { * * This hint must be set before initializing the video subsystem. * - * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with + * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with * a DPI scale factor. - * + * * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel * even on high-DPI displays. - * + * * For more information, see: * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows - * + * * This variable can be set to the following values: * "" - Do not change the DPI awareness (default). * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). @@ -1920,16 +2357,16 @@ extern "C" { /** * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. - * + * * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. - * + * * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, * will create a window with an 800x600 client area (in pixels). * * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. - * + * * This variable can be set to the following values: * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging * between monitors with different scale factors (unless this is performed by @@ -1940,7 +2377,7 @@ extern "C" { #define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING" /** - * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden + * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * * This variable can be set to the following values: * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) @@ -1951,7 +2388,7 @@ extern "C" { #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" /** -* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called +* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called * * This variable can be set to the following values: * "0" - The window is activated when the SDL_ShowWindow function is called @@ -2245,6 +2682,22 @@ extern "C" { */ #define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" +/** + * Cause SDL to call dbus_shutdown() on quit. + * + * This is useful as a debug tool to validate memory leaks, but shouldn't ever + * be set in production applications, as other libraries used by the application + * might use dbus under the hood and this cause cause crashes if they continue + * after SDL_Quit(). + * + * This variable can be set to the following values: + * "0" - SDL will not call dbus_shutdown() on quit (default) + * "1" - SDL will call dbus_shutdown() on quit + * + * This hint is available since SDL 2.30.0. + */ +#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT" + /** * \brief An enumeration of hint priorities @@ -2314,6 +2767,21 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, */ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +/** + * Reset all hints to the default values. + * + * This will reset all hints to the value of the associated environment + * variable, or NULL if the environment isn't set. Callbacks will be called + * normally with this change. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + * \sa SDL_ResetHint + */ +extern DECLSPEC void SDLCALL SDL_ResetHints(void); + /** * Get the value of a hint. * @@ -2387,9 +2855,16 @@ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, /** * Clear all hints. * - * This function is automatically called during SDL_Quit(). + * This function is automatically called during SDL_Quit(), and deletes all + * callbacks without calling them and frees all memory associated with hints. + * If you're calling this from application code you probably want to call + * SDL_ResetHints() instead. + * + * This function will be removed from the API the next time we rev the ABI. * * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ResetHints */ extern DECLSPEC void SDLCALL SDL_ClearHints(void); diff --git a/meta/win/include/SDL2/SDL_joystick.h b/meta/win/include/SDL2/SDL_joystick.h index 1a7c66ee..561e0109 100644 --- a/meta/win/include/SDL2/SDL_joystick.h +++ b/meta/win/include/SDL2/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,6 +44,7 @@ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_guid.h" +#include "SDL_mutex.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -66,6 +67,9 @@ extern "C" { /** * The joystick structure used to identify an SDL joystick */ +#ifdef SDL_THREAD_SAFETY_ANALYSIS +extern SDL_mutex *SDL_joystick_lock; +#endif struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; @@ -124,9 +128,14 @@ typedef enum * the API functions that take a joystick index will be valid, and joystick * and game controller events will not be delivered. * + * As of SDL 2.26.0, you can take the joystick lock around reinitializing the + * joystick subsystem, to prevent other threads from seeing joysticks in an + * uninitialized state. However, all open joysticks will be closed and SDL + * functions called with them will fail. + * * \since This function is available since SDL 2.0.7. */ -extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock); /** @@ -141,7 +150,7 @@ extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); * * \since This function is available since SDL 2.0.7. */ -extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock); /** * Count the number of joysticks attached to the system. @@ -279,13 +288,12 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in /** * Get the instance ID of a joystick. * - * This can be called before any joysticks are opened. If the index is out of - * range, this function will return -1. + * This can be called before any joysticks are opened. * * \param device_index the index of the joystick to query (the N'th joystick * on the system * \returns the instance id of the selected joystick. If called on an invalid - * index, this function returns zero + * index, this function returns -1. * * \since This function is available since SDL 2.0.6. */ @@ -425,6 +433,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, * SDL_WaitEvent. * + * Note that when sending trigger axes, you should scale the value to the full + * range of Sint16. For example, a trigger at rest would have the value of + * `SDL_JOYSTICK_AXIS_MIN`. + * * \param joystick the virtual joystick on which to set state. * \param axis the specific axis on the virtual joystick to set. * \param value the new value for the specified axis. @@ -643,6 +655,25 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); +/** + * Get the device information encoded in a SDL_JoystickGUID structure + * + * \param guid the SDL_JoystickGUID you wish to get info about + * \param vendor A pointer filled in with the device VID, or 0 if not + * available + * \param product A pointer filled in with the device PID, or 0 if not + * available + * \param version A pointer filled in with the device version, or 0 if not + * available + * \param crc16 A pointer filled in with a CRC used to distinguish different + * products with the same VID/PID, or 0 if not available + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_JoystickGetDeviceGUID + */ +extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16); + /** * Get the status of a specified joystick. * diff --git a/meta/win/include/SDL2/SDL_keyboard.h b/meta/win/include/SDL2/SDL_keyboard.h index e7663fb3..03c7b5a3 100644 --- a/meta/win/include/SDL2/SDL_keyboard.h +++ b/meta/win/include/SDL2/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -298,8 +298,10 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void); extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); /** - * Set the rectangle used to type Unicode text inputs. - * + * Set the rectangle used to type Unicode text inputs. Native input methods + * will place a window with word suggestions near it, without covering the + * text being inputted. + * * To start text input in a given location, this function is intended to be * called before SDL_StartTextInput, although some platforms support moving * the rectangle even while text input (and a composition) is active. diff --git a/meta/win/include/SDL2/SDL_keycode.h b/meta/win/include/SDL2/SDL_keycode.h index 65420f29..57a71bd7 100644 --- a/meta/win/include/SDL2/SDL_keycode.h +++ b/meta/win/include/SDL2/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ * an SDLK_* constant for those keys that do not generate characters. * * A special exception is the number keys at the top of the keyboard which - * always map to SDLK_0...SDLK_9, regardless of layout. + * map to SDLK_0...SDLK_9 on AZERTY layouts. */ typedef Sint32 SDL_Keycode; diff --git a/meta/win/include/SDL2/SDL_loadso.h b/meta/win/include/SDL2/SDL_loadso.h index 61857c81..4edc22e9 100644 --- a/meta/win/include/SDL2/SDL_loadso.h +++ b/meta/win/include/SDL2/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_locale.h b/meta/win/include/SDL2/SDL_locale.h index 75157799..0b6118f0 100644 --- a/meta/win/include/SDL2/SDL_locale.h +++ b/meta/win/include/SDL2/SDL_locale.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_log.h b/meta/win/include/SDL2/SDL_log.h index 1d8b20b6..bd030c6d 100644 --- a/meta/win/include/SDL2/SDL_log.h +++ b/meta/win/include/SDL2/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ extern "C" { * By default the application category is enabled at the INFO level, * the assert category is enabled at the WARN level, test is enabled * at the VERBOSE level and all other categories are enabled at the - * CRITICAL level. + * ERROR level. */ typedef enum { @@ -352,7 +352,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, */ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority priority, - const char *fmt, va_list ap); + SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); /** * The prototype for the log output callback function. diff --git a/meta/win/include/SDL2/SDL_main.h b/meta/win/include/SDL2/SDL_main.h index 8b267082..a66c84b4 100644 --- a/meta/win/include/SDL2/SDL_main.h +++ b/meta/win/include/SDL2/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,6 +108,15 @@ void reset_IOP(); \ void reset_IOP() {} +#elif defined(__3DS__) +/* + On N3DS, SDL provides a main function that sets up the screens + and storage. + + If you provide this yourself, you may define SDL_MAIN_HANDLED +*/ +#define SDL_MAIN_AVAILABLE + #endif #endif /* SDL_MAIN_HANDLED */ @@ -254,6 +263,13 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun */ extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved); +/** + * Callback from the application to let the suspend continue. + * + * \since This function is available since SDL 2.28.0. + */ +extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); + #endif /* __GDK__ */ #ifdef __cplusplus diff --git a/meta/win/include/SDL2/SDL_messagebox.h b/meta/win/include/SDL2/SDL_messagebox.h index d763534d..5ace6f2d 100644 --- a/meta/win/include/SDL2/SDL_messagebox.h +++ b/meta/win/include/SDL2/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_metal.h b/meta/win/include/SDL2/SDL_metal.h index eb308287..50f7b2ae 100644 --- a/meta/win/include/SDL2/SDL_metal.h +++ b/meta/win/include/SDL2/SDL_metal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,7 +82,7 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); * * \since This function is available since SDL 2.0.14. * - * \sa SDL_MetalCreateView + * \sa SDL_Metal_CreateView */ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); diff --git a/meta/win/include/SDL2/SDL_misc.h b/meta/win/include/SDL2/SDL_misc.h index 261b6b87..113ba7a1 100644 --- a/meta/win/include/SDL2/SDL_misc.h +++ b/meta/win/include/SDL2/SDL_misc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_mouse.h b/meta/win/include/SDL2/SDL_mouse.h index b318c703..687ff122 100644 --- a/meta/win/include/SDL2/SDL_mouse.h +++ b/meta/win/include/SDL2/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -198,13 +198,9 @@ extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y); /** * Set relative mouse mode. * - * While the mouse is in relative mode, the cursor is hidden, and the driver - * will try to report continuous motion in the current window. Only relative - * motion events will be delivered, the mouse position will not change. - * - * Note that this function will not be able to provide continuous relative - * motion when used over Microsoft Remote Desktop, instead motion is limited - * to the bounds of the screen. + * While the mouse is in relative mode, the cursor is hidden, the mouse + * position is constrained to the window, and SDL will report continuous + * relative mouse motion even if the mouse is at the edge of the window. * * This function will flush any pending mouse motion. * @@ -389,6 +385,9 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); /** * Get the default cursor. * + * You do not have to call SDL_FreeCursor() on the return value, but it is + * safe to do so. + * * \returns the default cursor on success or NULL on failure. * * \since This function is available since SDL 2.0.0. diff --git a/meta/win/include/SDL2/SDL_mutex.h b/meta/win/include/SDL2/SDL_mutex.h index 173468f6..eaa21f29 100644 --- a/meta/win/include/SDL2/SDL_mutex.h +++ b/meta/win/include/SDL2/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,80 @@ #include "SDL_stdinc.h" #include "SDL_error.h" +/******************************************************************************/ +/* Enable thread safety attributes only with clang. + * The attributes can be safely erased when compiling with other compilers. + */ +#if defined(SDL_THREAD_SAFETY_ANALYSIS) && \ + defined(__clang__) && (!defined(SWIG)) +#define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) +#else +#define SDL_THREAD_ANNOTATION_ATTRIBUTE__(x) /* no-op */ +#endif + +#define SDL_CAPABILITY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) + +#define SDL_SCOPED_CAPABILITY \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +#define SDL_GUARDED_BY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) + +#define SDL_PT_GUARDED_BY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) + +#define SDL_ACQUIRED_BEFORE(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(x)) + +#define SDL_ACQUIRED_AFTER(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(x)) + +#define SDL_REQUIRES(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(x)) + +#define SDL_REQUIRES_SHARED(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(x)) + +#define SDL_ACQUIRE(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(x)) + +#define SDL_ACQUIRE_SHARED(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(x)) + +#define SDL_RELEASE(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(x)) + +#define SDL_RELEASE_SHARED(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(x)) + +#define SDL_RELEASE_GENERIC(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(release_generic_capability(x)) + +#define SDL_TRY_ACQUIRE(x, y) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(x, y)) + +#define SDL_TRY_ACQUIRE_SHARED(x, y) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(x, y)) + +#define SDL_EXCLUDES(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(x)) + +#define SDL_ASSERT_CAPABILITY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) + +#define SDL_ASSERT_SHARED_CAPABILITY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) + +#define SDL_RETURN_CAPABILITY(x) \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#define SDL_NO_THREAD_SAFETY_ANALYSIS \ + SDL_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) + +/******************************************************************************/ + + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -96,7 +170,7 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); * * \since This function is available since SDL 2.0.0. */ -extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); +extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex); #define SDL_mutexP(m) SDL_LockMutex(m) /** @@ -119,7 +193,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); * \sa SDL_LockMutex * \sa SDL_UnlockMutex */ -extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); +extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex) SDL_TRY_ACQUIRE(0, mutex); /** * Unlock the mutex. @@ -138,7 +212,7 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); * * \since This function is available since SDL 2.0.0. */ -extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); +extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex); #define SDL_mutexV(m) SDL_UnlockMutex(m) /** @@ -276,7 +350,7 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); * successful it will atomically decrement the semaphore value. * * \param sem the semaphore to wait on - * \param ms the length of the timeout, in milliseconds + * \param timeout the length of the timeout, in milliseconds * \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not * succeed in the allotted time, or a negative error code on failure; * call SDL_GetError() for more information. @@ -290,7 +364,7 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); * \sa SDL_SemValue * \sa SDL_SemWait */ -extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout); /** * Atomically increment a semaphore's value and wake waiting threads. diff --git a/meta/win/include/SDL2/SDL_name.h b/meta/win/include/SDL2/SDL_name.h index 6ff35b46..71e93545 100644 --- a/meta/win/include/SDL2/SDL_name.h +++ b/meta/win/include/SDL2/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_opengl.h b/meta/win/include/SDL2/SDL_opengl.h index 9aed5035..2bb38c5c 100644 --- a/meta/win/include/SDL2/SDL_opengl.h +++ b/meta/win/include/SDL2/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -2107,57 +2107,6 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh -/* - * ???. GL_MESA_packed_depth_stencil - * XXX obsolete - */ -#ifndef GL_MESA_packed_depth_stencil -#define GL_MESA_packed_depth_stencil 1 - -#define GL_DEPTH_STENCIL_MESA 0x8750 -#define GL_UNSIGNED_INT_24_8_MESA 0x8751 -#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 -#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 -#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 - -#endif /* GL_MESA_packed_depth_stencil */ - - -#ifndef GL_ATI_blend_equation_separate -#define GL_ATI_blend_equation_separate 1 - -#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D - -GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA ); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA); - -#endif /* GL_ATI_blend_equation_separate */ - - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -#endif -typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - - -/** - ** NOTE!!!!! If you add new functions to this file, or update - ** glext.h be sure to regenerate the gl_mangle.h file. See comments - ** in that file for details. - **/ - - - /********************************************************************** * Begin system-specific stuff */ diff --git a/meta/win/include/SDL2/SDL_opengl_glext.h b/meta/win/include/SDL2/SDL_opengl_glext.h index 6a402b15..ff6ad12c 100644 --- a/meta/win/include/SDL2/SDL_opengl_glext.h +++ b/meta/win/include/SDL2/SDL_opengl_glext.h @@ -1,12 +1,49 @@ -#ifndef __glext_h_ +/* SDL modified the include guard to be compatible with Mesa and Apple include guards: + * - Mesa uses: __gl_glext_h_ + * - Apple uses: __glext_h_ */ +#if !defined(__glext_h_) && !defined(__gl_glext_h_) #define __glext_h_ 1 +#define __gl_glext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT +** +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +#define GL_GLEXT_VERSION 20220530 + +/*#include */ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2018 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -27,36 +64,292 @@ extern "C" { ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 26745 $ on $Date: 2014-05-21 03:12:26 -0700 (Wed, 21 May 2014) $ -*/ -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 +/* Khronos platform-specific types and definitions. + * + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 #endif -#ifndef NOMINMAX /* don't define min() and max(). */ -#define NOMINMAX + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL #endif -#include + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY #endif -#ifndef APIENTRY -#define APIENTRY +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES #endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T #endif -#ifndef GLAPI -#define GLAPI extern #endif -#define GL_GLEXT_VERSION 20140521 +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ /* Generated C header for: * API: gl @@ -358,15 +651,17 @@ GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); #define GL_TEXTURE_FILTER_CONTROL 0x8500 #define GL_DEPTH_TEXTURE_MODE 0x884B #define GL_COMPARE_R_TO_TEXTURE 0x884E -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_FUNC_SUBTRACT 0x800A +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); @@ -467,14 +762,8 @@ GLAPI void APIENTRY glBlendEquation (GLenum mode); #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 -#include -#ifdef __MACOSX__ -typedef long GLsizeiptr; -typedef long GLintptr; -#else -typedef ptrdiff_t GLsizeiptr; -typedef ptrdiff_t GLintptr; -#endif +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 @@ -887,7 +1176,7 @@ GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboole #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 1 -typedef unsigned short GLhalf; +typedef khronos_uint16_t GLhalf; #define GL_COMPARE_REF_TO_TEXTURE 0x884E #define GL_CLIP_DISTANCE0 0x3000 #define GL_CLIP_DISTANCE1 0x3001 @@ -1049,6 +1338,22 @@ typedef unsigned short GLhalf; #define GL_COLOR_ATTACHMENT13 0x8CED #define GL_COLOR_ATTACHMENT14 0x8CEE #define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_FRAMEBUFFER 0x8D40 @@ -1316,11 +1621,13 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 @@ -1339,6 +1646,7 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFFu typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); @@ -1372,45 +1680,8 @@ GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIn #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 1 typedef struct __GLsync *GLsync; -#ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include -#elif defined(__sun__) || defined(__digital__) -#include -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include -#elif defined(__SCO__) || defined(__USLC__) -#include -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include -#endif -#endif -typedef uint64_t GLuint64; -typedef int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef khronos_int64_t GLint64; #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_LINES_ADJACENCY 0x000A @@ -1486,7 +1757,7 @@ typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); -typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1506,7 +1777,7 @@ GLAPI void APIENTRY glDeleteSync (GLsync sync); GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); @@ -1762,8 +2033,8 @@ typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1809,8 +2080,8 @@ GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *pa GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); @@ -1868,7 +2139,7 @@ GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pna #define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F #define GL_UNDEFINED_VERTEX 0x8260 typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); -typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); @@ -1957,7 +2228,7 @@ typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfl typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glReleaseShaderCompiler (void); -GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); GLAPI void APIENTRY glClearDepthf (GLfloat d); @@ -2049,6 +2320,10 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) #ifndef GL_VERSION_4_2 #define GL_VERSION_4_2 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 #define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 #define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 #define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 @@ -2160,7 +2435,7 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); @@ -2173,7 +2448,7 @@ typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum m GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); -GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); @@ -2220,6 +2495,7 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED #define GL_DISPATCH_INDIRECT_BUFFER 0x90EE #define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 @@ -2453,7 +2729,7 @@ typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2465,7 +2741,7 @@ typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -2497,7 +2773,7 @@ GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params); GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); @@ -2509,7 +2785,7 @@ GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params); GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); @@ -2579,10 +2855,345 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #endif #endif /* GL_VERSION_4_4 */ +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_MINMAX 0x802E +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); +GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); +GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); +GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); +GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); +GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); +GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); +GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); +GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); +GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); +GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); +GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); +GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); +GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glTextureBarrier (void); +#endif +#endif /* GL_VERSION_4_5 */ + +#ifndef GL_VERSION_4_6 +#define GL_VERSION_4_6 1 +#define GL_SHADER_BINARY_FORMAT_SPIR_V 0x9551 +#define GL_SPIR_V_BINARY 0x9552 +#define GL_PARAMETER_BUFFER 0x80EE +#define GL_PARAMETER_BUFFER_BINDING 0x80EF +#define GL_CONTEXT_FLAG_NO_ERROR_BIT 0x00000008 +#define GL_VERTICES_SUBMITTED 0x82EE +#define GL_PRIMITIVES_SUBMITTED 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES 0x82F7 +#define GL_POLYGON_OFFSET_CLAMP 0x8E1B +#define GL_SPIR_V_EXTENSIONS 0x9553 +#define GL_NUM_SPIR_V_EXTENSIONS 0x9554 +#define GL_TEXTURE_MAX_ANISOTROPY 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY 0x84FF +#define GL_TRANSFORM_FEEDBACK_OVERFLOW 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW 0x82ED +typedef void (APIENTRYP PFNGLSPECIALIZESHADERPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpecializeShader (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue); +GLAPI void APIENTRY glMultiDrawArraysIndirectCount (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCount (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glPolygonOffsetClamp (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_VERSION_4_6 */ + #ifndef GL_ARB_ES2_compatibility #define GL_ARB_ES2_compatibility 1 #endif /* GL_ARB_ES2_compatibility */ +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 +#endif /* GL_ARB_ES3_1_compatibility */ + +#ifndef GL_ARB_ES3_2_compatibility +#define GL_ARB_ES3_2_compatibility 1 +#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE +#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 +#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 +typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_ARB_ES3_2_compatibility */ + #ifndef GL_ARB_ES3_compatibility #define GL_ARB_ES3_compatibility 1 #endif /* GL_ARB_ES3_compatibility */ @@ -2597,7 +3208,7 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #ifndef GL_ARB_bindless_texture #define GL_ARB_bindless_texture 1 -typedef uint64_t GLuint64EXT; +typedef khronos_uint64_t GLuint64EXT; #define GL_UNSIGNED_INT64_ARB 0x140F typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); @@ -2663,6 +3274,10 @@ GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, s #define GL_ARB_clear_texture 1 #endif /* GL_ARB_clear_texture */ +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 +#endif /* GL_ARB_clip_control */ + #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #define GL_RGBA_FLOAT_MODE_ARB 0x8820 @@ -2686,7 +3301,6 @@ GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); #ifndef GL_ARB_compute_shader #define GL_ARB_compute_shader 1 -#define GL_COMPUTE_SHADER_BIT 0x00000020 #endif /* GL_ARB_compute_shader */ #ifndef GL_ARB_compute_variable_group_size @@ -2701,20 +3315,26 @@ GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint n #endif #endif /* GL_ARB_compute_variable_group_size */ +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 +#endif /* GL_ARB_conditional_render_inverted */ + #ifndef GL_ARB_conservative_depth #define GL_ARB_conservative_depth 1 #endif /* GL_ARB_conservative_depth */ #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer 1 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 #endif /* GL_ARB_copy_buffer */ #ifndef GL_ARB_copy_image #define GL_ARB_copy_image 1 #endif /* GL_ARB_copy_image */ +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 +#endif /* GL_ARB_cull_distance */ + #ifndef GL_ARB_debug_output #define GL_ARB_debug_output 1 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); @@ -2769,6 +3389,14 @@ GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GL #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #endif /* GL_ARB_depth_texture */ +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 +#endif /* GL_ARB_derivative_control */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 +#endif /* GL_ARB_direct_state_access */ + #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 @@ -2979,6 +3607,10 @@ GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B #endif /* GL_ARB_fragment_shader */ +#ifndef GL_ARB_fragment_shader_interlock +#define GL_ARB_fragment_shader_interlock 1 +#endif /* GL_ARB_fragment_shader_interlock */ + #ifndef GL_ARB_framebuffer_no_attachments #define GL_ARB_framebuffer_no_attachments 1 #endif /* GL_ARB_framebuffer_no_attachments */ @@ -2991,11 +3623,6 @@ GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); #define GL_ARB_framebuffer_sRGB 1 #endif /* GL_ARB_framebuffer_sRGB */ -#ifndef GL_KHR_context_flush_control -#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB -#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC -#endif /* GL_KHR_context_flush_control */ - #ifndef GL_ARB_geometry_shader4 #define GL_ARB_geometry_shader4 1 #define GL_LINES_ADJACENCY_ARB 0x000A @@ -3032,6 +3659,20 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen #define GL_ARB_get_program_binary 1 #endif /* GL_ARB_get_program_binary */ +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 +#endif /* GL_ARB_get_texture_sub_image */ + +#ifndef GL_ARB_gl_spirv +#define GL_ARB_gl_spirv 1 +#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551 +#define GL_SPIR_V_BINARY_ARB 0x9552 +typedef void (APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpecializeShaderARB (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue); +#endif +#endif /* GL_ARB_gl_spirv */ + #ifndef GL_ARB_gpu_shader5 #define GL_ARB_gpu_shader5 1 #endif /* GL_ARB_gpu_shader5 */ @@ -3040,9 +3681,94 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen #define GL_ARB_gpu_shader_fp64 1 #endif /* GL_ARB_gpu_shader_fp64 */ +#ifndef GL_ARB_gpu_shader_int64 +#define GL_ARB_gpu_shader_int64 1 +#define GL_INT64_ARB 0x140E +#define GL_INT64_VEC2_ARB 0x8FE9 +#define GL_INT64_VEC3_ARB 0x8FEA +#define GL_INT64_VEC4_ARB 0x8FEB +#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 +typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x); +GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x); +GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params); +GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params); +GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x); +GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x); +GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#endif +#endif /* GL_ARB_gpu_shader_int64 */ + #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel 1 -typedef unsigned short GLhalfARB; +typedef khronos_uint16_t GLhalfARB; #define GL_HALF_FLOAT_ARB 0x140B #endif /* GL_ARB_half_float_pixel */ @@ -3052,11 +3778,6 @@ typedef unsigned short GLhalfARB; #ifndef GL_ARB_imaging #define GL_ARB_imaging 1 -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_EQUATION 0x8009 -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 @@ -3074,8 +3795,6 @@ typedef unsigned short GLhalfARB; #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 @@ -3084,7 +3803,6 @@ typedef unsigned short GLhalfARB; #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D -#define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 @@ -3099,12 +3817,6 @@ typedef unsigned short GLhalfARB; #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB -#define GL_COLOR_TABLE 0x80D0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 -#define GL_PROXY_COLOR_TABLE 0x80D3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 @@ -3190,11 +3902,11 @@ GLAPI void APIENTRY glResetMinmax (GLenum target); #define GL_ARB_indirect_parameters 1 #define GL_PARAMETER_BUFFER_ARB 0x80EE #define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); -GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); #endif #endif /* GL_ARB_indirect_parameters */ @@ -3214,6 +3926,25 @@ GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); #ifndef GL_ARB_internalformat_query2 #define GL_ARB_internalformat_query2 1 #define GL_SRGB_DECODE_ARB 0x8299 +#define GL_VIEW_CLASS_EAC_R11 0x9383 +#define GL_VIEW_CLASS_EAC_RG11 0x9384 +#define GL_VIEW_CLASS_ETC2_RGB 0x9385 +#define GL_VIEW_CLASS_ETC2_RGBA 0x9386 +#define GL_VIEW_CLASS_ETC2_EAC_RGBA 0x9387 +#define GL_VIEW_CLASS_ASTC_4x4_RGBA 0x9388 +#define GL_VIEW_CLASS_ASTC_5x4_RGBA 0x9389 +#define GL_VIEW_CLASS_ASTC_5x5_RGBA 0x938A +#define GL_VIEW_CLASS_ASTC_6x5_RGBA 0x938B +#define GL_VIEW_CLASS_ASTC_6x6_RGBA 0x938C +#define GL_VIEW_CLASS_ASTC_8x5_RGBA 0x938D +#define GL_VIEW_CLASS_ASTC_8x6_RGBA 0x938E +#define GL_VIEW_CLASS_ASTC_8x8_RGBA 0x938F +#define GL_VIEW_CLASS_ASTC_10x5_RGBA 0x9390 +#define GL_VIEW_CLASS_ASTC_10x6_RGBA 0x9391 +#define GL_VIEW_CLASS_ASTC_10x8_RGBA 0x9392 +#define GL_VIEW_CLASS_ASTC_10x10_RGBA 0x9393 +#define GL_VIEW_CLASS_ASTC_12x10_RGBA 0x9394 +#define GL_VIEW_CLASS_ASTC_12x12_RGBA 0x9395 #endif /* GL_ARB_internalformat_query2 */ #ifndef GL_ARB_invalidate_subdata @@ -3419,6 +4150,30 @@ GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *par #define GL_ARB_occlusion_query2 1 #endif /* GL_ARB_occlusion_query2 */ +#ifndef GL_ARB_parallel_shader_compile +#define GL_ARB_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 +#define GL_COMPLETION_STATUS_ARB 0x91B1 +typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count); +#endif +#endif /* GL_ARB_parallel_shader_compile */ + +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#endif /* GL_ARB_pipeline_statistics_query */ + #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB @@ -3447,6 +4202,14 @@ GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); #define GL_COORD_REPLACE_ARB 0x8862 #endif /* GL_ARB_point_sprite */ +#ifndef GL_ARB_polygon_offset_clamp +#define GL_ARB_polygon_offset_clamp 1 +#endif /* GL_ARB_polygon_offset_clamp */ + +#ifndef GL_ARB_post_depth_coverage +#define GL_ARB_post_depth_coverage 1 +#endif /* GL_ARB_post_depth_coverage */ + #ifndef GL_ARB_program_interface_query #define GL_ARB_program_interface_query 1 #endif /* GL_ARB_program_interface_query */ @@ -3520,6 +4283,26 @@ GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum form #define GL_ARB_robustness_isolation 1 #endif /* GL_ARB_robustness_isolation */ +#ifndef GL_ARB_sample_locations +#define GL_ARB_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 +#define GL_SAMPLE_LOCATION_ARB 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glEvaluateDepthValuesARB (void); +#endif +#endif /* GL_ARB_sample_locations */ + #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading 1 #define GL_SAMPLE_SHADING_ARB 0x8C36 @@ -3546,14 +4329,26 @@ GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); #define GL_ARB_separate_shader_objects 1 #endif /* GL_ARB_separate_shader_objects */ +#ifndef GL_ARB_shader_atomic_counter_ops +#define GL_ARB_shader_atomic_counter_ops 1 +#endif /* GL_ARB_shader_atomic_counter_ops */ + #ifndef GL_ARB_shader_atomic_counters #define GL_ARB_shader_atomic_counters 1 #endif /* GL_ARB_shader_atomic_counters */ +#ifndef GL_ARB_shader_ballot +#define GL_ARB_shader_ballot 1 +#endif /* GL_ARB_shader_ballot */ + #ifndef GL_ARB_shader_bit_encoding #define GL_ARB_shader_bit_encoding 1 #endif /* GL_ARB_shader_bit_encoding */ +#ifndef GL_ARB_shader_clock +#define GL_ARB_shader_clock 1 +#endif /* GL_ARB_shader_clock */ + #ifndef GL_ARB_shader_draw_parameters #define GL_ARB_shader_draw_parameters 1 #endif /* GL_ARB_shader_draw_parameters */ @@ -3710,10 +4505,18 @@ GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GL #define GL_ARB_shader_subroutine 1 #endif /* GL_ARB_shader_subroutine */ +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 +#endif /* GL_ARB_shader_texture_image_samples */ + #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod 1 #endif /* GL_ARB_shader_texture_lod */ +#ifndef GL_ARB_shader_viewport_layer_array +#define GL_ARB_shader_viewport_layer_array 1 +#endif /* GL_ARB_shader_viewport_layer_array */ + #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 1 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C @@ -3760,11 +4563,25 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif /* GL_ARB_shadow_ambient */ +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_buffer */ + #ifndef GL_ARB_sparse_texture #define GL_ARB_sparse_texture 1 #define GL_TEXTURE_SPARSE_ARB 0x91A6 #define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_MIN_SPARSE_LEVEL_ARB 0x919B +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA #define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 #define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 #define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 @@ -3773,12 +4590,24 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 #define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A #define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 -typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); #endif #endif /* GL_ARB_sparse_texture */ +#ifndef GL_ARB_sparse_texture2 +#define GL_ARB_sparse_texture2 1 +#endif /* GL_ARB_sparse_texture2 */ + +#ifndef GL_ARB_sparse_texture_clamp +#define GL_ARB_sparse_texture_clamp 1 +#endif /* GL_ARB_sparse_texture_clamp */ + +#ifndef GL_ARB_spirv_extensions +#define GL_ARB_spirv_extensions 1 +#endif /* GL_ARB_spirv_extensions */ + #ifndef GL_ARB_stencil_texturing #define GL_ARB_stencil_texturing 1 #endif /* GL_ARB_stencil_texturing */ @@ -3791,6 +4620,10 @@ GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xo #define GL_ARB_tessellation_shader 1 #endif /* GL_ARB_tessellation_shader */ +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 +#endif /* GL_ARB_texture_barrier */ + #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #define GL_CLAMP_TO_BORDER_ARB 0x812D @@ -3927,6 +4760,16 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #define GL_DOT3_RGBA_ARB 0x86AF #endif /* GL_ARB_texture_env_dot3 */ +#ifndef GL_ARB_texture_filter_anisotropic +#define GL_ARB_texture_filter_anisotropic 1 +#endif /* GL_ARB_texture_filter_anisotropic */ + +#ifndef GL_ARB_texture_filter_minmax +#define GL_ARB_texture_filter_minmax 1 +#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 +#define GL_WEIGHTED_AVERAGE_ARB 0x9367 +#endif /* GL_ARB_texture_filter_minmax */ + #ifndef GL_ARB_texture_float #define GL_ARB_texture_float 1 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 @@ -4025,8 +4868,6 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 1 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 #endif /* GL_ARB_transform_feedback2 */ #ifndef GL_ARB_transform_feedback3 @@ -4037,6 +4878,12 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #define GL_ARB_transform_feedback_instanced 1 #endif /* GL_ARB_transform_feedback_instanced */ +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED +#endif /* GL_ARB_transform_feedback_overflow_query */ + #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 @@ -4057,9 +4904,6 @@ GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #endif /* GL_ARB_uniform_buffer_object */ #ifndef GL_ARB_vertex_array_bgra @@ -4148,13 +4992,8 @@ GLAPI void APIENTRY glVertexBlendARB (GLint count); #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object 1 -#ifdef __MACOSX__ /* The OS X headers haven't caught up with Khronos yet */ -typedef long GLsizeiptrARB; -typedef long GLintptrARB; -#else -typedef ptrdiff_t GLsizeiptrARB; -typedef ptrdiff_t GLintptrARB; -#endif +typedef khronos_ssize_t GLsizeiptrARB; +typedef khronos_intptr_t GLintptrARB; #define GL_BUFFER_SIZE_ARB 0x8764 #define GL_BUFFER_USAGE_ARB 0x8765 #define GL_ARRAY_BUFFER_ARB 0x8892 @@ -4349,6 +5188,12 @@ GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcha #ifndef GL_ARB_viewport_array #define GL_ARB_viewport_array 1 +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYDVNVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDDNVPROC) (GLuint index, GLdouble n, GLdouble f); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangeArraydvNV (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexeddNV (GLuint index, GLdouble n, GLdouble f); +#endif #endif /* GL_ARB_viewport_array */ #ifndef GL_ARB_window_pos @@ -4389,10 +5234,82 @@ GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); #endif #endif /* GL_ARB_window_pos */ +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#endif /* GL_KHR_context_flush_control */ + #ifndef GL_KHR_debug #define GL_KHR_debug 1 #endif /* GL_KHR_debug */ +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_parallel_shader_compile +#define GL_KHR_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 +typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); +#endif +#endif /* GL_KHR_parallel_shader_compile */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#endif /* GL_KHR_shader_subgroup */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -4429,6 +5346,10 @@ GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); #define GL_KHR_texture_compression_astc_ldr 1 #endif /* GL_KHR_texture_compression_astc_ldr */ +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + #ifndef GL_OES_byte_coordinates #define GL_OES_byte_coordinates 1 typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); @@ -4447,11 +5368,11 @@ typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x); +typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y); typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z); typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w); typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); @@ -4470,11 +5391,11 @@ GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex2bOES (GLbyte x); +GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y); GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y); +GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z); GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w); GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); #endif #endif /* GL_OES_byte_coordinates */ @@ -4495,7 +5416,7 @@ GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); #ifndef GL_OES_fixed_point #define GL_OES_fixed_point 1 -typedef GLint GLfixed; +typedef khronos_int32_t GLfixed; #define GL_FIXED_OES 0x140C typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref); typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); @@ -4526,7 +5447,6 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfix typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert); typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); @@ -4631,7 +5551,6 @@ GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); GLAPI void APIENTRY glPointSizexOES (GLfixed size); GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glSampleCoverageOES (GLfixed value, GLboolean invert); GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); @@ -4793,12 +5712,12 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severi typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); -typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam); -GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); #endif #endif /* GL_AMD_debug_output */ @@ -4822,13 +5741,68 @@ GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRG #endif #endif /* GL_AMD_draw_buffers_blend */ +#ifndef GL_AMD_framebuffer_multisample_advanced +#define GL_AMD_framebuffer_multisample_advanced 1 +#define GL_RENDERBUFFER_STORAGE_SAMPLES_AMD 0x91B2 +#define GL_MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD 0x91B3 +#define GL_MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD 0x91B4 +#define GL_MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD 0x91B5 +#define GL_NUM_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B6 +#define GL_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B7 +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLenum target, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleAdvancedAMD (GLenum target, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleAdvancedAMD (GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_AMD_framebuffer_multisample_advanced */ + +#ifndef GL_AMD_framebuffer_sample_positions +#define GL_AMD_framebuffer_sample_positions 1 +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F +#define GL_PIXELS_PER_SAMPLE_PATTERN_X_AMD 0x91AE +#define GL_PIXELS_PER_SAMPLE_PATTERN_Y_AMD 0x91AF +#define GL_ALL_PIXELS_AMD 0xFFFFFFFF +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERFVAMDPROC) (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERFVAMDPROC) (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSamplePositionsfvAMD (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values); +GLAPI void APIENTRY glNamedFramebufferSamplePositionsfvAMD (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values); +GLAPI void APIENTRY glGetFramebufferParameterfvAMD (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values); +GLAPI void APIENTRY glGetNamedFramebufferParameterfvAMD (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values); +#endif +#endif /* GL_AMD_framebuffer_sample_positions */ + #ifndef GL_AMD_gcn_shader #define GL_AMD_gcn_shader 1 #endif /* GL_AMD_gcn_shader */ +#ifndef GL_AMD_gpu_shader_half_float +#define GL_AMD_gpu_shader_half_float 1 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +#define GL_FLOAT16_MAT2_AMD 0x91C5 +#define GL_FLOAT16_MAT3_AMD 0x91C6 +#define GL_FLOAT16_MAT4_AMD 0x91C7 +#define GL_FLOAT16_MAT2x3_AMD 0x91C8 +#define GL_FLOAT16_MAT2x4_AMD 0x91C9 +#define GL_FLOAT16_MAT3x2_AMD 0x91CA +#define GL_FLOAT16_MAT3x4_AMD 0x91CB +#define GL_FLOAT16_MAT4x2_AMD 0x91CC +#define GL_FLOAT16_MAT4x3_AMD 0x91CD +#endif /* GL_AMD_gpu_shader_half_float */ + +#ifndef GL_AMD_gpu_shader_int16 +#define GL_AMD_gpu_shader_int16 1 +#endif /* GL_AMD_gpu_shader_int16 */ + #ifndef GL_AMD_gpu_shader_int64 #define GL_AMD_gpu_shader_int64 1 -typedef int64_t GLint64EXT; +typedef khronos_int64_t GLint64EXT; #define GL_INT64_NV 0x140E #define GL_UNSIGNED_INT64_NV 0x140F #define GL_INT8_NV 0x8FE0 @@ -4853,10 +5827,6 @@ typedef int64_t GLint64EXT; #define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 #define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 #define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); @@ -5029,7 +5999,6 @@ GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname #ifndef GL_AMD_sample_positions #define GL_AMD_sample_positions 1 -#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val); @@ -5044,6 +6013,22 @@ GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLf #define GL_AMD_shader_atomic_counter_ops 1 #endif /* GL_AMD_shader_atomic_counter_ops */ +#ifndef GL_AMD_shader_ballot +#define GL_AMD_shader_ballot 1 +#endif /* GL_AMD_shader_ballot */ + +#ifndef GL_AMD_shader_explicit_vertex_parameter +#define GL_AMD_shader_explicit_vertex_parameter 1 +#endif /* GL_AMD_shader_explicit_vertex_parameter */ + +#ifndef GL_AMD_shader_gpu_shader_half_float_fetch +#define GL_AMD_shader_gpu_shader_half_float_fetch 1 +#endif /* GL_AMD_shader_gpu_shader_half_float_fetch */ + +#ifndef GL_AMD_shader_image_load_store_lod +#define GL_AMD_shader_image_load_store_lod 1 +#endif /* GL_AMD_shader_image_load_store_lod */ + #ifndef GL_AMD_shader_stencil_export #define GL_AMD_shader_stencil_export 1 #endif /* GL_AMD_shader_stencil_export */ @@ -5083,6 +6068,10 @@ GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); #endif #endif /* GL_AMD_stencil_operation_extended */ +#ifndef GL_AMD_texture_gather_bias_lod +#define GL_AMD_texture_gather_bias_lod 1 +#endif /* GL_AMD_texture_gather_bias_lod */ + #ifndef GL_AMD_texture_texture4 #define GL_AMD_texture_texture4 1 #endif /* GL_AMD_texture_texture4 */ @@ -5783,6 +6772,21 @@ GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); #define GL_422_REV_AVERAGE_EXT 0x80CF #endif /* GL_EXT_422_pixels */ +#ifndef GL_EXT_EGL_image_storage +#define GL_EXT_EGL_image_storage 1 +typedef void *GLeglImageOES; +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list); +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list); +GLAPI void APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list); +#endif +#endif /* GL_EXT_EGL_image_storage */ + +#ifndef GL_EXT_EGL_sync +#define GL_EXT_EGL_sync 1 +#endif /* GL_EXT_EGL_sync */ + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #define GL_ABGR_EXT 0x8000 @@ -6345,7 +7349,7 @@ typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaob typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); @@ -6601,7 +7605,7 @@ GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint at GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor); #endif #endif /* GL_EXT_direct_state_access */ @@ -6634,6 +7638,17 @@ GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint en #endif #endif /* GL_EXT_draw_range_elements */ +#ifndef GL_EXT_external_buffer +#define GL_EXT_external_buffer 1 +typedef void *GLeglClientBufferEXT; +typedef void (APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#endif +#endif /* GL_EXT_external_buffer */ + #ifndef GL_EXT_fog_coord #define GL_EXT_fog_coord 1 #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 @@ -6824,7 +7839,6 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, #ifndef GL_EXT_gpu_shader4 #define GL_EXT_gpu_shader4 1 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 #define GL_SAMPLER_BUFFER_EXT 0x8DC2 @@ -6852,6 +7866,7 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, #define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 #define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); @@ -6863,6 +7878,29 @@ typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); @@ -6875,6 +7913,29 @@ GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuin GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); #endif #endif /* GL_EXT_gpu_shader4 */ @@ -6977,6 +8038,89 @@ GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); #endif #endif /* GL_EXT_light_texture */ +#ifndef GL_EXT_memory_object +#define GL_EXT_memory_object 1 +#define GL_TEXTURE_TILING_EXT 0x9580 +#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581 +#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B +#define GL_NUM_TILING_TYPES_EXT 0x9582 +#define GL_TILING_TYPES_EXT 0x9583 +#define GL_OPTIMAL_TILING_EXT 0x9584 +#define GL_LINEAR_TILING_EXT 0x9585 +#define GL_NUM_DEVICE_UUIDS_EXT 0x9596 +#define GL_DEVICE_UUID_EXT 0x9597 +#define GL_DRIVER_UUID_EXT 0x9598 +#define GL_UUID_SIZE_EXT 16 +typedef void (APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data); +typedef void (APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data); +typedef void (APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects); +typedef GLboolean (APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject); +typedef void (APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects); +typedef void (APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXSTORAGEMEM1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM1DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data); +GLAPI void APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data); +GLAPI void APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects); +GLAPI GLboolean APIENTRY glIsMemoryObjectEXT (GLuint memoryObject); +GLAPI void APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects); +GLAPI void APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params); +GLAPI void APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTexStorageMem1DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureStorageMem1DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_EXT_memory_object */ + +#ifndef GL_EXT_memory_object_fd +#define GL_EXT_memory_object_fd 1 +#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586 +typedef void (APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_memory_object_fd */ + +#ifndef GL_EXT_memory_object_win32 +#define GL_EXT_memory_object_win32 1 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 +#define GL_DEVICE_LUID_EXT 0x9599 +#define GL_DEVICE_NODE_MASK_EXT 0x959A +#define GL_LUID_SIZE_EXT 8 +#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 +#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A +#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B +#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C +typedef void (APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +typedef void (APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +GLAPI void APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_memory_object_win32 */ + #ifndef GL_EXT_misc_attribute #define GL_EXT_misc_attribute 1 #endif /* GL_EXT_misc_attribute */ @@ -7018,6 +8162,18 @@ GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); #endif #endif /* GL_EXT_multisample */ +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 +#endif /* GL_EXT_multiview_texture_multisample */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 +#endif /* GL_EXT_multiview_timer_query */ + #ifndef GL_EXT_packed_depth_stencil #define GL_EXT_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_EXT 0x84F9 @@ -7127,6 +8283,19 @@ GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); #endif #endif /* GL_EXT_polygon_offset */ +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex 1 #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C @@ -7139,6 +8308,20 @@ GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); #endif #endif /* GL_EXT_provoking_vertex */ +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #define GL_RESCALE_NORMAL_EXT 0x803A @@ -7191,6 +8374,55 @@ GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei #endif #endif /* GL_EXT_secondary_color */ +#ifndef GL_EXT_semaphore +#define GL_EXT_semaphore 1 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 +#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530 +#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531 +typedef void (APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores); +typedef void (APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores); +typedef GLboolean (APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore); +typedef void (APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params); +typedef void (APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores); +GLAPI void APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores); +GLAPI GLboolean APIENTRY glIsSemaphoreEXT (GLuint semaphore); +GLAPI void APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params); +GLAPI void APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params); +GLAPI void APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +GLAPI void APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#endif +#endif /* GL_EXT_semaphore */ + +#ifndef GL_EXT_semaphore_fd +#define GL_EXT_semaphore_fd 1 +typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_semaphore_fd */ + +#ifndef GL_EXT_semaphore_win32 +#define GL_EXT_semaphore_win32 1 +#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 +#define GL_D3D12_FENCE_VALUE_EXT 0x9595 +typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle); +typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle); +GLAPI void APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_semaphore_win32 */ + #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 #define GL_ACTIVE_PROGRAM_EXT 0x8B8D @@ -7211,6 +8443,19 @@ GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *strin #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #endif /* GL_EXT_separate_specular_color */ +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_EXT_shader_framebuffer_fetch 1 +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif /* GL_EXT_shader_framebuffer_fetch */ + +#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent +#define GL_EXT_shader_framebuffer_fetch_non_coherent 1 +typedef void (APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferFetchBarrierEXT (void); +#endif +#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */ + #ifndef GL_EXT_shader_image_load_formatted #define GL_EXT_shader_image_load_formatted 1 #endif /* GL_EXT_shader_image_load_formatted */ @@ -7284,6 +8529,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); #define GL_EXT_shader_integer_mix 1 #endif /* GL_EXT_shader_integer_mix */ +#ifndef GL_EXT_shader_samples_identical +#define GL_EXT_shader_samples_identical 1 +#endif /* GL_EXT_shader_samples_identical */ + #ifndef GL_EXT_shadow_funcs #define GL_EXT_shadow_funcs 1 #endif /* GL_EXT_shadow_funcs */ @@ -7293,6 +8542,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif /* GL_EXT_shared_texture_palette */ +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag 1 #define GL_STENCIL_TAG_BITS_EXT 0x88F2 @@ -7405,6 +8658,10 @@ GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffse #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D #define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF #define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif #endif /* GL_EXT_texture_array */ #ifndef GL_EXT_texture_buffer_object @@ -7501,6 +8758,12 @@ GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif /* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366 +#define GL_WEIGHTED_AVERAGE_EXT 0x9367 +#endif /* GL_EXT_texture_filter_minmax */ + #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer 1 #define GL_RGBA32UI_EXT 0x8D70 @@ -7633,6 +8896,16 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F #endif /* GL_EXT_texture_sRGB */ +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_EXT_texture_sRGB_R8 1 +#define GL_SR8_EXT 0x8FBD +#endif /* GL_EXT_texture_sRGB_R8 */ + +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + #ifndef GL_EXT_texture_sRGB_decode #define GL_EXT_texture_sRGB_decode 1 #define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 @@ -7640,6 +8913,10 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_SKIP_DECODE_EXT 0x8A4A #endif /* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 +#endif /* GL_EXT_texture_shadow_lod */ + #ifndef GL_EXT_texture_shared_exponent #define GL_EXT_texture_shared_exponent 1 #define GL_RGB9_E5_EXT 0x8C3D @@ -7667,6 +8944,36 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); #define GL_RGBA_SNORM 0x8F93 #endif /* GL_EXT_texture_snorm */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +typedef void (APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + #ifndef GL_EXT_texture_swizzle #define GL_EXT_texture_swizzle 1 #define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 @@ -8045,6 +9352,30 @@ GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei s #endif #endif /* GL_EXT_vertex_weighting */ +#ifndef GL_EXT_win32_keyed_mutex +#define GL_EXT_win32_keyed_mutex 1 +typedef GLboolean (APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout); +typedef GLboolean (APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout); +GLAPI GLboolean APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key); +#endif +#endif /* GL_EXT_win32_keyed_mutex */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 +typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); +#endif +#endif /* GL_EXT_window_rectangles */ + #ifndef GL_EXT_x11_sync_object #define GL_EXT_x11_sync_object 1 #define GL_SYNC_X11_FENCE_EXT 0x90E1 @@ -8222,10 +9553,28 @@ GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRG #define GL_INTERLACE_READ_INGR 0x8568 #endif /* GL_INGR_interlace_read */ +#ifndef GL_INTEL_blackhole_render +#define GL_INTEL_blackhole_render 1 +#define GL_BLACKHOLE_RENDER_INTEL 0x83FC +#endif /* GL_INTEL_blackhole_render */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE +#endif /* GL_INTEL_conservative_rasterization */ + #ifndef GL_INTEL_fragment_shader_ordering #define GL_INTEL_fragment_shader_ordering 1 #endif /* GL_INTEL_fragment_shader_ordering */ +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + #ifndef GL_INTEL_map_texture #define GL_INTEL_map_texture 1 #define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF @@ -8290,7 +9639,7 @@ typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten); typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); #ifdef GL_GLEXT_PROTOTYPES @@ -8301,7 +9650,7 @@ GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten); GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); #endif @@ -8317,11 +9666,37 @@ GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLen #define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E #endif /* GL_MESAX_texture_stack */ +#ifndef GL_MESA_framebuffer_flip_x +#define GL_MESA_framebuffer_flip_x 1 +#define GL_FRAMEBUFFER_FLIP_X_MESA 0x8BBC +#endif /* GL_MESA_framebuffer_flip_x */ + +#ifndef GL_MESA_framebuffer_flip_y +#define GL_MESA_framebuffer_flip_y 1 +#define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferParameteriMESA (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_MESA_framebuffer_flip_y */ + +#ifndef GL_MESA_framebuffer_swap_xy +#define GL_MESA_framebuffer_swap_xy 1 +#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD +#endif /* GL_MESA_framebuffer_swap_xy */ + #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert 1 #define GL_PACK_INVERT_MESA 0x8758 #endif /* GL_MESA_pack_invert */ +#ifndef GL_MESA_program_binary_formats +#define GL_MESA_program_binary_formats 1 +#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F +#endif /* GL_MESA_program_binary_formats */ + #ifndef GL_MESA_resize_buffers #define GL_MESA_resize_buffers 1 typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); @@ -8330,6 +9705,17 @@ GLAPI void APIENTRY glResizeBuffersMESA (void); #endif #endif /* GL_MESA_resize_buffers */ +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 +#endif /* GL_MESA_shader_integer_functions */ + +#ifndef GL_MESA_tile_raster_order +#define GL_MESA_tile_raster_order 1 +#define GL_TILE_RASTER_ORDER_FIXED_MESA 0x8BB8 +#define GL_TILE_RASTER_ORDER_INCREASING_X_MESA 0x8BB9 +#define GL_TILE_RASTER_ORDER_INCREASING_Y_MESA 0x8BBA +#endif /* GL_MESA_tile_raster_order */ + #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); @@ -8391,6 +9777,10 @@ GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); #define GL_YCBCR_MESA 0x8757 #endif /* GL_MESA_ycbcr_texture */ +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + #ifndef GL_NVX_conditional_render #define GL_NVX_conditional_render 1 typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id); @@ -8410,6 +9800,65 @@ GLAPI void APIENTRY glEndConditionalRenderNVX (void); #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B #endif /* GL_NVX_gpu_memory_info */ +#ifndef GL_NVX_gpu_multicast2 +#define GL_NVX_gpu_multicast2 1 +#define GL_UPLOAD_GPU_MASK_NVX 0x954A +typedef void (APIENTRYP PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); +typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v); +typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUploadGpuMaskNVX (GLbitfield mask); +GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); +GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v); +GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); +#endif +#endif /* GL_NVX_gpu_multicast2 */ + +#ifndef GL_NVX_linked_gpu_multicast +#define GL_NVX_linked_gpu_multicast 1 +#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800 +#define GL_MAX_LGPU_GPUS_NVX 0x92BA +typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glLGPUInterlockNVX (void); +#endif +#endif /* GL_NVX_linked_gpu_multicast */ + +#ifndef GL_NVX_progress_fence +#define GL_NVX_progress_fence 1 +typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void); +typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void); +GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); +#endif +#endif /* GL_NVX_progress_fence */ + +#ifndef GL_NV_alpha_to_coverage_dither_control +#define GL_NV_alpha_to_coverage_dither_control 1 +#define GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV 0x934D +#define GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV 0x934E +#define GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV 0x934F +#define GL_ALPHA_TO_COVERAGE_DITHER_MODE_NV 0x92BF +typedef void (APIENTRYP PFNGLALPHATOCOVERAGEDITHERCONTROLNVPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAlphaToCoverageDitherControlNV (GLenum mode); +#endif +#endif /* GL_NV_alpha_to_coverage_dither_control */ + #ifndef GL_NV_bindless_multi_draw_indirect #define GL_NV_bindless_multi_draw_indirect 1 typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); @@ -8420,6 +9869,16 @@ GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum t #endif #endif /* GL_NV_bindless_multi_draw_indirect */ +#ifndef GL_NV_bindless_multi_draw_indirect_count +#define GL_NV_bindless_multi_draw_indirect_count 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + #ifndef GL_NV_bindless_texture #define GL_NV_bindless_texture 1 typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); @@ -8516,16 +9975,94 @@ GLAPI void APIENTRY glBlendBarrierNV (void); #define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 #endif /* GL_NV_blend_equation_advanced_coherent */ +#ifndef GL_NV_blend_minmax_factor +#define GL_NV_blend_minmax_factor 1 +#endif /* GL_NV_blend_minmax_factor */ + #ifndef GL_NV_blend_square #define GL_NV_blend_square 1 #endif /* GL_NV_blend_square */ +#ifndef GL_NV_clip_space_w_scaling +#define GL_NV_clip_space_w_scaling 1 +#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C +#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D +#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E +typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff); +#endif +#endif /* GL_NV_clip_space_w_scaling */ + +#ifndef GL_NV_command_list +#define GL_NV_command_list 1 +#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 +#define GL_NOP_COMMAND_NV 0x0001 +#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 +#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 +#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 +#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 +#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 +#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 +#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 +#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 +#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A +#define GL_BLEND_COLOR_COMMAND_NV 0x000B +#define GL_STENCIL_REF_COMMAND_NV 0x000C +#define GL_LINE_WIDTH_COMMAND_NV 0x000D +#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E +#define GL_ALPHA_REF_COMMAND_NV 0x000F +#define GL_VIEWPORT_COMMAND_NV 0x0010 +#define GL_SCISSOR_COMMAND_NV 0x0011 +#define GL_FRONT_FACE_COMMAND_NV 0x0012 +typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states); +typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states); +typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state); +typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); +typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size); +typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists); +typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists); +typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments); +typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states); +GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states); +GLAPI GLboolean APIENTRY glIsStateNV (GLuint state); +GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode); +GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size); +GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype); +GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists); +GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists); +GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list); +GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments); +GLAPI void APIENTRY glCompileCommandListNV (GLuint list); +GLAPI void APIENTRY glCallCommandListNV (GLuint list); +#endif +#endif /* GL_NV_command_list */ + #ifndef GL_NV_compute_program5 #define GL_NV_compute_program5 1 #define GL_COMPUTE_PROGRAM_NV 0x90FB #define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC #endif /* GL_NV_compute_program5 */ +#ifndef GL_NV_compute_shader_derivatives +#define GL_NV_compute_shader_derivatives 1 +#endif /* GL_NV_compute_shader_derivatives */ + #ifndef GL_NV_conditional_render #define GL_NV_conditional_render 1 #define GL_QUERY_WAIT_NV 0x8E13 @@ -8540,6 +10077,49 @@ GLAPI void APIENTRY glEndConditionalRenderNV (void); #endif #endif /* GL_NV_conditional_render */ +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_dilate +#define GL_NV_conservative_raster_dilate 1 +#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 +#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A +#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B +typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value); +#endif +#endif /* GL_NV_conservative_raster_dilate */ + +#ifndef GL_NV_conservative_raster_pre_snap +#define GL_NV_conservative_raster_pre_snap 1 +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550 +#endif /* GL_NV_conservative_raster_pre_snap */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F +typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); +#endif +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + +#ifndef GL_NV_conservative_raster_underestimation +#define GL_NV_conservative_raster_underestimation 1 +#endif /* GL_NV_conservative_raster_underestimation */ + #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E @@ -8589,6 +10169,23 @@ GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, #endif #endif /* GL_NV_draw_texture */ +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 +typedef void (APIENTRY *GLVULKANPROCNV)(void); +typedef void (APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name); +typedef void (APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +GLAPI GLVULKANPROCNV APIENTRY glGetVkProcAddrNV (const GLchar *name); +GLAPI void APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore); +GLAPI void APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore); +GLAPI void APIENTRY glSignalVkFenceNV (GLuint64 vkFence); +#endif +#endif /* GL_NV_draw_vulkan_image */ + #ifndef GL_NV_evaluators #define GL_NV_evaluators 1 #define GL_EVAL_2D_NV 0x86C0 @@ -8682,6 +10279,11 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif #endif /* GL_NV_fence */ +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #define GL_FLOAT_R_NV 0x8880 @@ -8708,6 +10310,16 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif /* GL_NV_fog_distance */ +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 @@ -8749,6 +10361,34 @@ GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, cons #define GL_NV_fragment_program_option 1 #endif /* GL_NV_fragment_program_option */ +#ifndef GL_NV_fragment_shader_barycentric +#define GL_NV_fragment_shader_barycentric 1 +#endif /* GL_NV_fragment_shader_barycentric */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage 1 #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB @@ -8768,12 +10408,10 @@ GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, G #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #endif #endif /* GL_NV_geometry_program4 */ @@ -8782,6 +10420,45 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen #define GL_NV_geometry_shader4 1 #endif /* GL_NV_geometry_shader4 */ +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_multicast +#define GL_NV_gpu_multicast 1 +#define GL_PER_GPU_STORAGE_BIT_NV 0x0800 +#define GL_MULTICAST_GPUS_NV 0x92BA +#define GL_RENDER_GPU_MASK_NV 0x9558 +#define GL_PER_GPU_STORAGE_NV 0x9548 +#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549 +typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void); +typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask); +typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask); +GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glMulticastBarrierNV (void); +GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask); +GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glMulticastGetQueryObjectui64vNV (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_NV_gpu_multicast */ + #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 1 #define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 @@ -8954,15 +10631,130 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #endif #endif /* GL_NV_half_float */ +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #define GL_MAX_SHININESS_NV 0x8504 #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #endif /* GL_NV_light_max_exponent */ +#ifndef GL_NV_memory_attachment +#define GL_NV_memory_attachment 1 +#define GL_ATTACHED_MEMORY_OBJECT_NV 0x95A4 +#define GL_ATTACHED_MEMORY_OFFSET_NV 0x95A5 +#define GL_MEMORY_ATTACHABLE_ALIGNMENT_NV 0x95A6 +#define GL_MEMORY_ATTACHABLE_SIZE_NV 0x95A7 +#define GL_MEMORY_ATTACHABLE_NV 0x95A8 +#define GL_DETACHED_MEMORY_INCARNATION_NV 0x95A9 +#define GL_DETACHED_TEXTURES_NV 0x95AA +#define GL_DETACHED_BUFFERS_NV 0x95AB +#define GL_MAX_DETACHED_TEXTURES_NV 0x95AC +#define GL_MAX_DETACHED_BUFFERS_NV 0x95AD +typedef void (APIENTRYP PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC) (GLuint memory, GLenum pname, GLint first, GLsizei count, GLuint *params); +typedef void (APIENTRYP PFNGLRESETMEMORYOBJECTPARAMETERNVPROC) (GLuint memory, GLenum pname); +typedef void (APIENTRYP PFNGLTEXATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLBUFFERATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLTEXTUREATTACHMEMORYNVPROC) (GLuint texture, GLuint memory, GLuint64 offset); +typedef void (APIENTRYP PFNGLNAMEDBUFFERATTACHMEMORYNVPROC) (GLuint buffer, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetMemoryObjectDetachedResourcesuivNV (GLuint memory, GLenum pname, GLint first, GLsizei count, GLuint *params); +GLAPI void APIENTRY glResetMemoryObjectParameterNV (GLuint memory, GLenum pname); +GLAPI void APIENTRY glTexAttachMemoryNV (GLenum target, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glBufferAttachMemoryNV (GLenum target, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glTextureAttachMemoryNV (GLuint texture, GLuint memory, GLuint64 offset); +GLAPI void APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_NV_memory_attachment */ + +#ifndef GL_NV_memory_object_sparse +#define GL_NV_memory_object_sparse 1 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTMEMNVPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTMEMNVPROC) (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC) (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentMemNV (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexPageCommitmentMemNV (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentMemNV (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GLAPI void APIENTRY glTexturePageCommitmentMemNV (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#endif +#endif /* GL_NV_memory_object_sparse */ + +#ifndef GL_NV_mesh_shader +#define GL_NV_mesh_shader 1 +#define GL_MESH_SHADER_NV 0x9559 +#define GL_TASK_SHADER_NV 0x955A +#define GL_MAX_MESH_UNIFORM_BLOCKS_NV 0x8E60 +#define GL_MAX_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 +#define GL_MAX_MESH_IMAGE_UNIFORMS_NV 0x8E62 +#define GL_MAX_MESH_UNIFORM_COMPONENTS_NV 0x8E63 +#define GL_MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 +#define GL_MAX_MESH_ATOMIC_COUNTERS_NV 0x8E65 +#define GL_MAX_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 +#define GL_MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 +#define GL_MAX_TASK_UNIFORM_BLOCKS_NV 0x8E68 +#define GL_MAX_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 +#define GL_MAX_TASK_IMAGE_UNIFORMS_NV 0x8E6A +#define GL_MAX_TASK_UNIFORM_COMPONENTS_NV 0x8E6B +#define GL_MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C +#define GL_MAX_TASK_ATOMIC_COUNTERS_NV 0x8E6D +#define GL_MAX_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E +#define GL_MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F +#define GL_MAX_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 +#define GL_MAX_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 +#define GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 +#define GL_MAX_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 +#define GL_MAX_MESH_OUTPUT_VERTICES_NV 0x9538 +#define GL_MAX_MESH_OUTPUT_PRIMITIVES_NV 0x9539 +#define GL_MAX_TASK_OUTPUT_COUNT_NV 0x953A +#define GL_MAX_DRAW_MESH_TASKS_COUNT_NV 0x953D +#define GL_MAX_MESH_VIEWS_NV 0x9557 +#define GL_MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF +#define GL_MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 +#define GL_MAX_MESH_WORK_GROUP_SIZE_NV 0x953B +#define GL_MAX_TASK_WORK_GROUP_SIZE_NV 0x953C +#define GL_MESH_WORK_GROUP_SIZE_NV 0x953E +#define GL_TASK_WORK_GROUP_SIZE_NV 0x953F +#define GL_MESH_VERTICES_OUT_NV 0x9579 +#define GL_MESH_PRIMITIVES_OUT_NV 0x957A +#define GL_MESH_OUTPUT_TYPE_NV 0x957B +#define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D +#define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 +#define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_MESH_SUBROUTINE_NV 0x957C +#define GL_TASK_SUBROUTINE_NV 0x957D +#define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E +#define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F +typedef void (APIENTRYP PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); +typedef void (APIENTRYP PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); +typedef void (APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC) (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshTasksNV (GLuint first, GLuint count); +GLAPI void APIENTRY glDrawMeshTasksIndirectNV (GLintptr indirect); +GLAPI void APIENTRY glMultiDrawMeshTasksIndirectNV (GLintptr indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawMeshTasksIndirectCountNV (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_NV_mesh_shader */ + #ifndef GL_NV_multisample_coverage #define GL_NV_multisample_coverage 1 -#define GL_COLOR_SAMPLES_NV 0x8E20 #endif /* GL_NV_multisample_coverage */ #ifndef GL_NV_multisample_filter_hint @@ -9075,13 +10867,11 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_SKIP_MISSING_GLYPH_NV 0x90A9 #define GL_USE_MISSING_GLYPH_NV 0x90AA #define GL_PATH_ERROR_POSITION_NV 0x90AB -#define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD #define GL_ADJACENT_PAIRS_NV 0x90AE #define GL_FIRST_TO_REST_NV 0x90AF #define GL_PATH_GEN_MODE_NV 0x90B0 #define GL_PATH_GEN_COEFF_NV 0x90B1 -#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 #define GL_PATH_GEN_COMPONENTS_NV 0x90B3 #define GL_PATH_STENCIL_FUNC_NV 0x90B7 #define GL_PATH_STENCIL_REF_NV 0x90B8 @@ -9150,8 +10940,44 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 #define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 #define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_2_BYTES_NV 0x1407 +#define GL_3_BYTES_NV 0x1408 +#define GL_4_BYTES_NV 0x1409 +#define GL_EYE_LINEAR_NV 0x2400 +#define GL_OBJECT_LINEAR_NV 0x2401 +#define GL_CONSTANT_NV 0x8576 +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); @@ -9178,9 +11004,6 @@ typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint refere typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); -typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9193,14 +11016,32 @@ typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dash typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); @@ -9228,9 +11069,6 @@ GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); -GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9243,17 +11081,40 @@ GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); -GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); +GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); #endif #endif /* GL_NV_path_rendering */ +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 @@ -9319,6 +11180,38 @@ GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); #endif #endif /* GL_NV_primitive_restart */ +#ifndef GL_NV_primitive_shading_rate +#define GL_NV_primitive_shading_rate 1 +#define GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV 0x95B1 +#define GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV 0x95B2 +#endif /* GL_NV_primitive_shading_rate */ + +#ifndef GL_NV_query_resource +#define GL_NV_query_resource 1 +#define GL_QUERY_RESOURCE_TYPE_VIDMEM_ALLOC_NV 0x9540 +#define GL_QUERY_RESOURCE_MEMTYPE_VIDMEM_NV 0x9542 +#define GL_QUERY_RESOURCE_SYS_RESERVED_NV 0x9544 +#define GL_QUERY_RESOURCE_TEXTURE_NV 0x9545 +#define GL_QUERY_RESOURCE_RENDERBUFFER_NV 0x9546 +#define GL_QUERY_RESOURCE_BUFFEROBJECT_NV 0x9547 +typedef GLint (APIENTRYP PFNGLQUERYRESOURCENVPROC) (GLenum queryType, GLint tagId, GLuint count, GLint *buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glQueryResourceNV (GLenum queryType, GLint tagId, GLuint count, GLint *buffer); +#endif +#endif /* GL_NV_query_resource */ + +#ifndef GL_NV_query_resource_tag +#define GL_NV_query_resource_tag 1 +typedef void (APIENTRYP PFNGLGENQUERYRESOURCETAGNVPROC) (GLsizei n, GLint *tagIds); +typedef void (APIENTRYP PFNGLDELETEQUERYRESOURCETAGNVPROC) (GLsizei n, const GLint *tagIds); +typedef void (APIENTRYP PFNGLQUERYRESOURCETAGNVPROC) (GLint tagId, const GLchar *tagString); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueryResourceTagNV (GLsizei n, GLint *tagIds); +GLAPI void APIENTRY glDeleteQueryResourceTagNV (GLsizei n, const GLint *tagIds); +GLAPI void APIENTRY glQueryResourceTagNV (GLint tagId, const GLchar *tagString); +#endif +#endif /* GL_NV_query_resource_tag */ + #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 #define GL_REGISTER_COMBINERS_NV 0x8522 @@ -9411,6 +11304,52 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #endif #endif /* GL_NV_register_combiners2 */ +#ifndef GL_NV_representative_fragment_test +#define GL_NV_representative_fragment_test 1 +#define GL_REPRESENTATIVE_FRAGMENT_TEST_NV 0x937F +#endif /* GL_NV_representative_fragment_test */ + +#ifndef GL_NV_robustness_video_memory_purge +#define GL_NV_robustness_video_memory_purge 1 +#define GL_PURGED_CONTEXT_RESET_NV 0x92BB +#endif /* GL_NV_robustness_video_memory_purge */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_scissor_exclusive +#define GL_NV_scissor_exclusive 1 +#define GL_SCISSOR_TEST_EXCLUSIVE_NV 0x9555 +#define GL_SCISSOR_BOX_EXCLUSIVE_NV 0x9556 +typedef void (APIENTRYP PFNGLSCISSOREXCLUSIVENVPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSOREXCLUSIVEARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glScissorExclusiveNV (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorExclusiveArrayvNV (GLuint first, GLsizei count, const GLint *v); +#endif +#endif /* GL_NV_scissor_exclusive */ + #ifndef GL_NV_shader_atomic_counters #define GL_NV_shader_atomic_counters 1 #endif /* GL_NV_shader_atomic_counters */ @@ -9419,6 +11358,18 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #define GL_NV_shader_atomic_float 1 #endif /* GL_NV_shader_atomic_float */ +#ifndef GL_NV_shader_atomic_float64 +#define GL_NV_shader_atomic_float64 1 +#endif /* GL_NV_shader_atomic_float64 */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_atomic_int64 +#define GL_NV_shader_atomic_int64 1 +#endif /* GL_NV_shader_atomic_int64 */ + #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load 1 #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D @@ -9463,6 +11414,15 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs #define GL_NV_shader_storage_buffer_object 1 #endif /* GL_NV_shader_storage_buffer_object */ +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 +#endif /* GL_NV_shader_subgroup_partitioned */ + +#ifndef GL_NV_shader_texture_footprint +#define GL_NV_shader_texture_footprint 1 +#endif /* GL_NV_shader_texture_footprint */ + #ifndef GL_NV_shader_thread_group #define GL_NV_shader_thread_group 1 #define GL_WARP_SIZE_NV 0x9339 @@ -9474,6 +11434,51 @@ GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLs #define GL_NV_shader_thread_shuffle 1 #endif /* GL_NV_shader_thread_shuffle */ +#ifndef GL_NV_shading_rate_image +#define GL_NV_shading_rate_image 1 +#define GL_SHADING_RATE_IMAGE_NV 0x9563 +#define GL_SHADING_RATE_NO_INVOCATIONS_NV 0x9564 +#define GL_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV 0x9565 +#define GL_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV 0x9566 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV 0x9567 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV 0x9568 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV 0x9569 +#define GL_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV 0x956A +#define GL_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV 0x956B +#define GL_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV 0x956C +#define GL_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV 0x956D +#define GL_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV 0x956E +#define GL_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV 0x956F +#define GL_SHADING_RATE_IMAGE_BINDING_NV 0x955B +#define GL_SHADING_RATE_IMAGE_TEXEL_WIDTH_NV 0x955C +#define GL_SHADING_RATE_IMAGE_TEXEL_HEIGHT_NV 0x955D +#define GL_SHADING_RATE_IMAGE_PALETTE_SIZE_NV 0x955E +#define GL_MAX_COARSE_FRAGMENT_SAMPLES_NV 0x955F +#define GL_SHADING_RATE_SAMPLE_ORDER_DEFAULT_NV 0x95AE +#define GL_SHADING_RATE_SAMPLE_ORDER_PIXEL_MAJOR_NV 0x95AF +#define GL_SHADING_RATE_SAMPLE_ORDER_SAMPLE_MAJOR_NV 0x95B0 +typedef void (APIENTRYP PFNGLBINDSHADINGRATEIMAGENVPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLGETSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint entry, GLenum *rate); +typedef void (APIENTRYP PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC) (GLenum rate, GLuint samples, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLSHADINGRATEIMAGEBARRIERNVPROC) (GLboolean synchronize); +typedef void (APIENTRYP PFNGLSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +typedef void (APIENTRYP PFNGLSHADINGRATESAMPLEORDERNVPROC) (GLenum order); +typedef void (APIENTRYP PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC) (GLenum rate, GLuint samples, const GLint *locations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindShadingRateImageNV (GLuint texture); +GLAPI void APIENTRY glGetShadingRateImagePaletteNV (GLuint viewport, GLuint entry, GLenum *rate); +GLAPI void APIENTRY glGetShadingRateSampleLocationivNV (GLenum rate, GLuint samples, GLuint index, GLint *location); +GLAPI void APIENTRY glShadingRateImageBarrierNV (GLboolean synchronize); +GLAPI void APIENTRY glShadingRateImagePaletteNV (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +GLAPI void APIENTRY glShadingRateSampleOrderNV (GLenum order); +GLAPI void APIENTRY glShadingRateSampleOrderCustomNV (GLenum rate, GLuint samples, const GLint *locations); +#endif +#endif /* GL_NV_shading_rate_image */ + +#ifndef GL_NV_stereo_view_rendering +#define GL_NV_stereo_view_rendering 1 +#endif /* GL_NV_stereo_view_rendering */ + #ifndef GL_NV_tessellation_program5 #define GL_NV_tessellation_program5 1 #define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 @@ -9550,6 +11555,10 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 #endif /* GL_NV_texture_rectangle */ +#ifndef GL_NV_texture_rectangle_compressed +#define GL_NV_texture_rectangle_compressed 1 +#endif /* GL_NV_texture_rectangle_compressed */ + #ifndef GL_NV_texture_shader #define GL_NV_texture_shader 1 #define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C @@ -9653,6 +11662,23 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #endif /* GL_NV_texture_shader3 */ +#ifndef GL_NV_timeline_semaphore +#define GL_NV_timeline_semaphore 1 +#define GL_TIMELINE_SEMAPHORE_VALUE_NV 0x9595 +#define GL_SEMAPHORE_TYPE_NV 0x95B3 +#define GL_SEMAPHORE_TYPE_BINARY_NV 0x95B4 +#define GL_SEMAPHORE_TYPE_TIMELINE_NV 0x95B5 +#define GL_MAX_TIMELINE_SEMAPHORE_VALUE_DIFFERENCE_NV 0x95B6 +typedef void (APIENTRYP PFNGLCREATESEMAPHORESNVPROC) (GLsizei n, GLuint *semaphores); +typedef void (APIENTRYP PFNGLSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCreateSemaphoresNV (GLsizei n, GLuint *semaphores); +GLAPI void APIENTRY glSemaphoreParameterivNV (GLuint semaphore, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetSemaphoreParameterivNV (GLuint semaphore, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_timeline_semaphore */ + #ifndef GL_NV_transform_feedback #define GL_NV_transform_feedback 1 #define GL_BACK_PRIMARY_COLOR_NV 0x8C77 @@ -9688,7 +11714,7 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_SKIP_COMPONENTS1_NV -6 typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode); typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); @@ -9701,7 +11727,7 @@ typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei coun #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode); GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); @@ -9738,6 +11764,13 @@ GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); #endif #endif /* GL_NV_transform_feedback2 */ +#ifndef GL_NV_uniform_buffer_unified_memory +#define GL_NV_uniform_buffer_unified_memory 1 +#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E +#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F +#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 +#endif /* GL_NV_uniform_buffer_unified_memory */ + #ifndef GL_NV_vdpau_interop #define GL_NV_vdpau_interop 1 typedef GLintptr GLvdpauSurfaceNV; @@ -9751,7 +11784,7 @@ typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); -typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei count, GLsizei *length, GLint *values); typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); @@ -9762,13 +11795,21 @@ GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSu GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); -GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei count, GLsizei *length, GLint *values); GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); #endif #endif /* GL_NV_vdpau_interop */ +#ifndef GL_NV_vdpau_interop2 +#define GL_NV_vdpau_interop2 1 +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACEWITHPICTURESTRUCTURENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames, GLboolean isFrameStructure); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceWithPictureStructureNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames, GLboolean isFrameStructure); +#endif +#endif /* GL_NV_vdpau_interop2 */ + #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 #define GL_VERTEX_ARRAY_RANGE_NV 0x851D @@ -10124,54 +12165,6 @@ GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GL #ifndef GL_NV_vertex_program4 #define GL_NV_vertex_program4 1 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); -GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); -GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); -GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); -GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); -GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); -GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); -GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); -GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); -GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); -GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); -GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); -GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); -#endif #endif /* GL_NV_vertex_program4 */ #ifndef GL_NV_video_capture @@ -10233,6 +12226,30 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot #endif #endif /* GL_NV_video_capture */ +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B +typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#endif +#endif /* GL_NV_viewport_swizzle */ + #ifndef GL_OML_interlace #define GL_OML_interlace 1 #define GL_INTERLACE_OML 0x8980 @@ -10255,6 +12272,22 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #endif /* GL_OML_subsample */ +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints 1 #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 @@ -10811,10 +12844,10 @@ GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); #ifndef GL_SGIX_resample #define GL_SGIX_resample 1 -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 #define GL_RESAMPLE_DECIMATE_SGIX 0x8430 #endif /* GL_SGIX_resample */ diff --git a/meta/win/include/SDL2/SDL_opengles.h b/meta/win/include/SDL2/SDL_opengles.h index 8511b960..7e9a1ab8 100644 --- a/meta/win/include/SDL2/SDL_opengles.h +++ b/meta/win/include/SDL2/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_opengles2.h b/meta/win/include/SDL2/SDL_opengles2.h index 172fcb3f..96971344 100644 --- a/meta/win/include/SDL2/SDL_opengles2.h +++ b/meta/win/include/SDL2/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_opengles2_gl2.h b/meta/win/include/SDL2/SDL_opengles2_gl2.h index c62fb0a5..d13622aa 100644 --- a/meta/win/include/SDL2/SDL_opengles2_gl2.h +++ b/meta/win/include/SDL2/SDL_opengles2_gl2.h @@ -1,56 +1,70 @@ -#ifndef __gl2_h_ -#define __gl2_h_ - -/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */ - -/*#include */ +#ifndef __gles2_gl2_h_ +#define __gles2_gl2_h_ 1 #ifdef __cplusplus extern "C" { #endif /* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT +** +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ -/*------------------------------------------------------------------------- - * Data type definitions - *-----------------------------------------------------------------------*/ +/*#include */ -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif -/* GL types for handling large vertex buffer objects */ -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; +#ifndef GL_GLES_PROTOTYPES +#define GL_GLES_PROTOTYPES 1 +#endif -/* OpenGL ES core versions */ -#define GL_ES_VERSION_2_0 1 +/* Generated on date 20220530 */ -/* ClearBufferMask */ +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 +/*#include */ +typedef khronos_int8_t GLbyte; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; +typedef void GLvoid; +typedef struct __GLsync *GLsync; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef unsigned int GLenum; +typedef unsigned int GLuint; +typedef char GLchar; +typedef khronos_float_t GLfloat; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; +typedef unsigned int GLbitfield; +typedef int GLint; +typedef unsigned char GLboolean; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 - -/* Boolean */ #define GL_FALSE 0 #define GL_TRUE 1 - -/* BeginMode */ #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 @@ -58,18 +72,6 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 - -/* AlphaFunction (not supported in ES20) */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* BlendingFactorDest */ #define GL_ZERO 0 #define GL_ONE 1 #define GL_SRC_COLOR 0x0300 @@ -78,29 +80,15 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* BlendEquationSeparate */ #define GL_FUNC_ADD 0x8006 #define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_RGB 0x8009 #define GL_BLEND_EQUATION_ALPHA 0x883D - -/* BlendSubtract */ #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* Separate Blend Functions */ #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA @@ -110,38 +98,19 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 - -/* Buffer Objects */ #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 - #define GL_STREAM_DRAW 0x88E0 #define GL_STATIC_DRAW 0x88E4 #define GL_DYNAMIC_DRAW 0x88E8 - #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 - #define GL_CURRENT_VERTEX_ATTRIB 0x8626 - -/* CullFaceMode */ #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_FRONT_AND_BACK 0x0408 - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* EnableCap */ #define GL_TEXTURE_2D 0x0DE1 #define GL_CULL_FACE 0x0B44 #define GL_BLEND 0x0BE2 @@ -152,19 +121,13 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_POLYGON_OFFSET_FILL 0x8037 #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_COVERAGE 0x80A0 - -/* ErrorCode */ #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_OUT_OF_MEMORY 0x0505 - -/* FrontFaceDirection */ #define GL_CW 0x0900 #define GL_CCW 0x0901 - -/* GetPName */ #define GL_LINE_WIDTH 0x0B21 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E @@ -191,7 +154,6 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #define GL_VIEWPORT 0x0BA2 #define GL_SCISSOR_BOX 0x0C10 -/* GL_SCISSOR_TEST */ #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_UNPACK_ALIGNMENT 0x0CF5 @@ -206,32 +168,18 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_DEPTH_BITS 0x0D56 #define GL_STENCIL_BITS 0x0D57 #define GL_POLYGON_OFFSET_UNITS 0x2A00 -/* GL_POLYGON_OFFSET_FILL */ #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ - #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 - -/* HintMode */ #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 - -/* HintTarget */ -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* DataType */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 @@ -240,44 +188,35 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_FIXED 0x140C - -/* PixelFormat */ #define GL_DEPTH_COMPONENT 0x1902 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 #define GL_LUMINANCE 0x1909 #define GL_LUMINANCE_ALPHA 0x190A - -/* PixelType */ -/* GL_UNSIGNED_BYTE */ #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 - -/* Shaders */ -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D - -/* StencilFunction */ +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 @@ -286,9 +225,6 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 - -/* StencilOp */ -/* GL_ZERO */ #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 @@ -296,35 +232,21 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_INVERT 0x150A #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 - -/* StringName */ #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 - -/* TextureMagFilter */ #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ #define GL_TEXTURE 0x1702 - #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 @@ -334,8 +256,6 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C - -/* TextureUnit */ #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 @@ -369,13 +289,9 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 - -/* TextureWrapMode */ #define GL_REPEAT 0x2901 #define GL_CLAMP_TO_EDGE 0x812F #define GL_MIRRORED_REPEAT 0x8370 - -/* Uniform Types */ #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 @@ -391,48 +307,34 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_CUBE 0x8B60 - -/* Vertex Arrays */ -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F - -/* Read Format */ -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B - -/* Shader Source */ #define GL_COMPILE_STATUS 0x8B81 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_SHADER_COMPILER 0x8DFA - -/* Shader Binary */ #define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - -/* Shader Precision-Specified Types */ #define GL_LOW_FLOAT 0x8DF0 #define GL_MEDIUM_FLOAT 0x8DF1 #define GL_HIGH_FLOAT 0x8DF2 #define GL_LOW_INT 0x8DF3 #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 - -/* Framebuffer Object. */ #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 - #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGB565 0x8D62 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_STENCIL_INDEX8 0x8D48 - #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 @@ -442,180 +344,313 @@ typedef khronos_ssize_t GLsizeiptr; #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 - -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 - #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 - #define GL_NONE 0 - -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD - +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 - #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 - -/*------------------------------------------------------------------------- - * GL core functions. - *-----------------------------------------------------------------------*/ - -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); -GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#if GL_GLES_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_ES_VERSION_2_0 */ #ifdef __cplusplus } #endif -#endif /* __gl2_h_ */ - +#endif diff --git a/meta/win/include/SDL2/SDL_opengles2_gl2ext.h b/meta/win/include/SDL2/SDL_opengles2_gl2ext.h index e8ca8b13..9448ce09 100644 --- a/meta/win/include/SDL2/SDL_opengles2_gl2ext.h +++ b/meta/win/include/SDL2/SDL_opengles2_gl2ext.h @@ -1,1395 +1,1013 @@ -#ifndef __gl2ext_h_ -#define __gl2ext_h_ - -/* $Revision: 22801 $ on $Date:: 2013-08-21 03:20:48 -0700 #$ */ +#ifndef __gles2_gl2ext_h_ +#define __gles2_gl2ext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ +** Copyright 2013-2020 The Khronos Group Inc. +** SPDX-License-Identifier: MIT +** +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ #ifndef GL_APIENTRYP -# define GL_APIENTRYP GL_APIENTRY* +#define GL_APIENTRYP GL_APIENTRY* #endif -/* New types shared by several extensions */ +/* Generated on date 20220530 */ -#ifndef __gl3_h_ -/* These are defined with respect to in the - * Apple extension spec, but they are also used by non-APPLE - * extensions, and in the Khronos header we use the Khronos - * portable types in khrplatform.h, which must be defined. +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: _nomatch_^ + * Default extensions included: gles2 + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ */ -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef struct __GLsync *GLsync; -#endif - - -/*------------------------------------------------------------------------* - * OES extension tokens - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_ETC1_RGB8_OES 0x8D64 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_DEPTH_COMPONENT24_OES 0x81A6 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#endif - -/* GL_OES_depth_texture */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -/* GLeglImageOES defined in GL_OES_EGL_image already. */ -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_UNSIGNED_INT 0x1405 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_ALPHA8_OES 0x803C -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -/* reuse GL_DEPTH_COMPONENT24_OES */ -/* reuse GL_DEPTH24_STENCIL8_OES */ -/* reuse GL_DEPTH_COMPONENT32_OES */ -#define GL_LUMINANCE4_ALPHA4_OES 0x8043 -#define GL_LUMINANCE8_ALPHA8_OES 0x8045 -#define GL_LUMINANCE8_OES 0x8040 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -/* reuse GL_RGB8_OES */ -/* reuse GL_RGBA8_OES */ -/* reuse GL_RGB10_EXT */ -/* reuse GL_RGB10_A2_EXT */ -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_STENCIL_INDEX1_OES 0x8D46 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_STENCIL_INDEX4_OES 0x8D47 -#endif - -#ifndef GL_OES_surfaceless_context -#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -#endif - -/* GL_OES_texture_float */ -/* No new tokens introduced by this extension. */ -/* GL_OES_texture_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_HALF_FLOAT_OES 0x8D61 -#endif - -/* GL_OES_texture_half_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_npot */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); #endif +#endif /* GL_KHR_blend_equation_advanced */ -/* GL_OES_vertex_half_float */ -/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 -#endif +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ -/*------------------------------------------------------------------------* - * KHR extension tokens - *------------------------------------------------------------------------*/ +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC +#endif /* GL_KHR_context_flush_control */ #ifndef GL_KHR_debug -typedef void (GL_APIENTRYP GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 -#define GL_DEBUG_SOURCE_API_KHR 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A -#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B -#define GL_DEBUG_TYPE_ERROR_KHR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 -#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 -#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D -#define GL_BUFFER_KHR 0x82E0 -#define GL_SHADER_KHR 0x82E1 -#define GL_PROGRAM_KHR 0x82E2 -#define GL_QUERY_KHR 0x82E3 -/* PROGRAM_PIPELINE only in GL */ -#define GL_SAMPLER_KHR 0x82E6 -/* DISPLAY_LIST only in GL */ -#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 -#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 -#define GL_DEBUG_OUTPUT_KHR 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 -#define GL_STACK_OVERFLOW_KHR 0x0503 -#define GL_STACK_UNDERFLOW_KHR 0x0504 -#endif - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif - -/*------------------------------------------------------------------------* - * AMD extension tokens - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#endif - -/* GL_AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_Z400_BINARY_AMD 0x8740 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_depth_texture */ -#ifndef GL_ANGLE_depth_texture -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_UNSIGNED_INT 0x1405 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -#endif - -/* GL_ANGLE_instanced_arrays */ -#ifndef GL_ANGLE_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 -#endif - -/* GL_ANGLE_program_binary */ -#ifndef GL_ANGLE_program_binary -#define GL_PROGRAM_BINARY_ANGLE 0x93A6 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 -#endif - -/* GL_ANGLE_translated_shader_source */ -#ifndef GL_ANGLE_translated_shader_source -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -#endif - -/*------------------------------------------------------------------------* - * APPLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_APPLE_copy_texture_levels */ -/* No new tokens introduced by this extension. */ - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -#endif - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync - -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D -#endif - -/*------------------------------------------------------------------------* - * ARM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_program_binary */ -#ifndef GL_ARM_mali_program_binary -#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 -#endif - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 -#endif - -/* GL_ARM_rgba8 */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * EXT extension tokens - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -#endif - -/* GL_EXT_debug_marker */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -#endif - -#ifndef GL_EXT_disjoint_timer_query -#define GL_QUERY_COUNTER_BITS_EXT 0x8864 -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#define GL_TIME_ELAPSED_EXT 0x88BF -#define GL_TIMESTAMP_EXT 0x8E28 -#define GL_GPU_DISJOINT_EXT 0x8FBB -#endif - -#ifndef GL_EXT_draw_buffers -#define GL_EXT_draw_buffers 1 -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 -#define GL_DRAW_BUFFER0_EXT 0x8825 -#define GL_DRAW_BUFFER1_EXT 0x8826 -#define GL_DRAW_BUFFER2_EXT 0x8827 -#define GL_DRAW_BUFFER3_EXT 0x8828 -#define GL_DRAW_BUFFER4_EXT 0x8829 -#define GL_DRAW_BUFFER5_EXT 0x882A -#define GL_DRAW_BUFFER6_EXT 0x882B -#define GL_DRAW_BUFFER7_EXT 0x882C -#define GL_DRAW_BUFFER8_EXT 0x882D -#define GL_DRAW_BUFFER9_EXT 0x882E -#define GL_DRAW_BUFFER10_EXT 0x882F -#define GL_DRAW_BUFFER11_EXT 0x8830 -#define GL_DRAW_BUFFER12_EXT 0x8831 -#define GL_DRAW_BUFFER13_EXT 0x8832 -#define GL_DRAW_BUFFER14_EXT 0x8833 -#define GL_DRAW_BUFFER15_EXT 0x8834 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -#endif - -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -#endif - -/* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multiview_draw_buffers -#define GL_COLOR_ATTACHMENT_EXT 0x90F0 -#define GL_MULTIVIEW_EXT 0x90F1 -#define GL_DRAW_BUFFER_EXT 0x0C01 -#define GL_READ_BUFFER_EXT 0x0C02 -#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 -#endif - -/* GL_EXT_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_BGRA_EXT 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -/* reuse GL_NO_ERROR */ -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_ACTIVE_PROGRAM_EXT 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -#endif - -/* GL_EXT_shader_framebuffer_fetch */ -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 -#endif - -/* GL_EXT_shader_texture_lod */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 -#endif - -/* GL_EXT_sRGB_write_control */ -#ifndef GL_EXT_sRGB_write_control -#define GL_EXT_sRGB_write_control 1 -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#endif - -/* GL_EXT_texture_sRGB_decode */ -#ifndef GL_EXT_texture_sRGB_decode -#define GL_EXT_texture_sRGB_decode 1 -#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 -#define GL_DECODE_EXT 0x8A49 -#define GL_SKIP_DECODE_EXT 0x8A4A -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -/* reuse GL_RGBA16F_EXT */ -/* reuse GL_RGB16F_EXT */ -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGB10_EXT 0x8052 -#define GL_BGRA8_EXT 0x93A1 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -#define GL_R16F_EXT 0x822D -#define GL_RG16F_EXT 0x822F -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 -#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 -#endif - -/*------------------------------------------------------------------------* - * DMP extension tokens - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_SHADER_BINARY_DMP 0x9250 -#endif - -/*------------------------------------------------------------------------* - * FJ extension tokens - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ -#ifndef GL_FJ_shader_binary_GCCSO -#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 -#endif - -/*------------------------------------------------------------------------* - * IMG extension tokens - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_SGX_BINARY_IMG 0x8C0A -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#endif - -/* GL_IMG_texture_compression_pvrtc2 */ -#ifndef GL_IMG_texture_compression_pvrtc2 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -#endif - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -#endif - -/* GL_NV_draw_instanced */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF -/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -/* GL_NV_framebuffer_blit */ -#ifndef GL_NV_framebuffer_blit -#define GL_READ_FRAMEBUFFER_NV 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA -#endif - -/* GL_NV_framebuffer_multisample */ -#ifndef GL_NV_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 -#define GL_MAX_SAMPLES_NV 0x8D57 -#endif - -/* GL_NV_generate_mipmap_sRGB */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_instanced_arrays */ -#ifndef GL_NV_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_READ_BUFFER_NV 0x0C02 -#endif - -/* GL_NV_read_buffer_front */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_shadow_samplers_array */ -#ifndef GL_NV_shadow_samplers_array -#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 -#endif - -/* GL_NV_shadow_samplers_cube */ -#ifndef GL_NV_shadow_samplers_cube -#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 -#endif - -/* GL_NV_sRGB_formats */ -#ifndef GL_NV_sRGB_formats -#define GL_SLUMINANCE_NV 0x8C46 -#define GL_SLUMINANCE_ALPHA_NV 0x8C44 -#define GL_SRGB8_NV 0x8C41 -#define GL_SLUMINANCE8_NV 0x8C47 -#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 -#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F -#define GL_ETC1_SRGB8_NV 0x88EE -#endif - -/* GL_NV_texture_border_clamp */ -#ifndef GL_NV_texture_border_clamp -#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 -#define GL_CLAMP_TO_BORDER_NV 0x812D +#define GL_KHR_debug 1 +typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_SAMPLER 0x82E6 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_VERTEX_ARRAY_KHR 0x8074 +#define GL_QUERY_KHR 0x82E3 +#define GL_PROGRAM_PIPELINE_KHR 0x82E4 +#define GL_SAMPLER_KHR 0x82E6 +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); +GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); +GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); #endif +#endif /* GL_KHR_debug */ -/* GL_NV_texture_compression_s3tc_update */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_npot_2D_mipmap */ -/* No new tokens introduced by this extension. */ +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -#endif +#ifndef GL_KHR_parallel_shader_compile +#define GL_KHR_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 +typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); +#endif +#endif /* GL_KHR_parallel_shader_compile */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 +#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 +#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 +#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 +#define GL_CONTEXT_LOST_KHR 0x0507 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void); +GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#endif +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_shader_subgroup +#define GL_KHR_shader_subgroup 1 +#define GL_SUBGROUP_SIZE_KHR 0x9532 +#define GL_SUBGROUP_SUPPORTED_STAGES_KHR 0x9533 +#define GL_SUBGROUP_SUPPORTED_FEATURES_KHR 0x9534 +#define GL_SUBGROUP_QUAD_ALL_STAGES_KHR 0x9535 +#define GL_SUBGROUP_FEATURE_BASIC_BIT_KHR 0x00000001 +#define GL_SUBGROUP_FEATURE_VOTE_BIT_KHR 0x00000002 +#define GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR 0x00000004 +#define GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR 0x00000008 +#define GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR 0x00000010 +#define GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR 0x00000020 +#define GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR 0x00000040 +#define GL_SUBGROUP_FEATURE_QUAD_BIT_KHR 0x00000080 +#endif /* GL_KHR_shader_subgroup */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ -/* GL_QCOM_binning_control */ -#ifndef GL_QCOM_binning_control -#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 -#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 -#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 -#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 -#endif +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ -/* GL_QCOM_driver_control */ -/* No new tokens introduced by this extension. */ +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -#endif - -/* GL_QCOM_extended_get2 */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +typedef void *GLeglImageOES; +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); #endif +#endif /* GL_OES_EGL_image */ -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_SHADER_BINARY_VIV 0x8FC4 -#endif +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#endif /* GL_OES_EGL_image_external */ -/*------------------------------------------------------------------------* - * End of extension tokens, start of corresponding extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_OES_EGL_image_external_essl3 +#define GL_OES_EGL_image_external_essl3 1 +#endif /* GL_OES_EGL_image_external_essl3 */ -/*------------------------------------------------------------------------* - * OES extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture +#define GL_OES_compressed_ETC1_RGB8_sub_texture 1 +#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */ -/* GL_OES_compressed_ETC1_RGB8_texture */ #ifndef GL_OES_compressed_ETC1_RGB8_texture #define GL_OES_compressed_ETC1_RGB8_texture 1 -#endif +#define GL_ETC1_RGB8_OES 0x8D64 +#endif /* GL_OES_compressed_ETC1_RGB8_texture */ -/* GL_OES_compressed_paletted_texture */ #ifndef GL_OES_compressed_paletted_texture #define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_copy_image +#define GL_OES_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); #endif +#endif /* GL_OES_copy_image */ -/* GL_OES_depth24 */ #ifndef GL_OES_depth24 #define GL_OES_depth24 1 -#endif +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif /* GL_OES_depth24 */ -/* GL_OES_depth32 */ #ifndef GL_OES_depth32 #define GL_OES_depth32 1 -#endif +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif /* GL_OES_depth32 */ -/* GL_OES_depth_texture */ #ifndef GL_OES_depth_texture #define GL_OES_depth_texture 1 -#endif - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 +#endif /* GL_OES_depth_texture */ + +#ifndef GL_OES_draw_buffers_indexed +#define GL_OES_draw_buffers_indexed 1 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -#endif -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index); +#endif +#endif /* GL_OES_draw_buffers_indexed */ + +#ifndef GL_OES_draw_elements_base_vertex +#define GL_OES_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); #endif +#endif /* GL_OES_draw_elements_base_vertex */ -/* GL_OES_element_index_uint */ #ifndef GL_OES_element_index_uint #define GL_OES_element_index_uint 1 -#endif +#endif /* GL_OES_element_index_uint */ -/* GL_OES_fbo_render_mipmap */ #ifndef GL_OES_fbo_render_mipmap #define GL_OES_fbo_render_mipmap 1 -#endif +#endif /* GL_OES_fbo_render_mipmap */ -/* GL_OES_fragment_precision_high */ #ifndef GL_OES_fragment_precision_high #define GL_OES_fragment_precision_high 1 +#endif /* GL_OES_fragment_precision_high */ + +#ifndef GL_OES_geometry_point_size +#define GL_OES_geometry_point_size 1 +#endif /* GL_OES_geometry_point_size */ + +#ifndef GL_OES_geometry_shader +#define GL_OES_geometry_shader 1 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_LINES_ADJACENCY_OES 0x000A +#define GL_LINE_STRIP_ADJACENCY_OES 0x000B +#define GL_TRIANGLES_ADJACENCY_OES 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level); #endif +#endif /* GL_OES_geometry_shader */ -/* GL_OES_get_program_binary */ #ifndef GL_OES_get_program_binary #define GL_OES_get_program_binary 1 +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); #endif +#endif /* GL_OES_get_program_binary */ + +#ifndef GL_OES_gpu_shader5 +#define GL_OES_gpu_shader5 1 +#endif /* GL_OES_gpu_shader5 */ -/* GL_OES_mapbuffer */ #ifndef GL_OES_mapbuffer #define GL_OES_mapbuffer 1 +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid **params); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); -typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid **params); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params); #endif +#endif /* GL_OES_mapbuffer */ -/* GL_OES_packed_depth_stencil */ #ifndef GL_OES_packed_depth_stencil #define GL_OES_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif /* GL_OES_packed_depth_stencil */ + +#ifndef GL_OES_primitive_bounding_box +#define GL_OES_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); #endif +#endif /* GL_OES_primitive_bounding_box */ -/* GL_OES_required_internalformat */ #ifndef GL_OES_required_internalformat #define GL_OES_required_internalformat 1 -#endif +#define GL_ALPHA8_OES 0x803C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_LUMINANCE8_OES 0x8040 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB10_A2_EXT 0x8059 +#endif /* GL_OES_required_internalformat */ -/* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_OES_rgb8_rgba8 1 +#endif /* GL_OES_rgb8_rgba8 */ + +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 +typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); #endif +#endif /* GL_OES_sample_shading */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 +#endif /* GL_OES_sample_variables */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 +#endif /* GL_OES_shader_image_atomic */ + +#ifndef GL_OES_shader_io_blocks +#define GL_OES_shader_io_blocks 1 +#endif /* GL_OES_shader_io_blocks */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D +#endif /* GL_OES_shader_multisample_interpolation */ -/* GL_OES_standard_derivatives */ #ifndef GL_OES_standard_derivatives #define GL_OES_standard_derivatives 1 -#endif +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif /* GL_OES_standard_derivatives */ -/* GL_OES_stencil1 */ #ifndef GL_OES_stencil1 #define GL_OES_stencil1 1 -#endif +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif /* GL_OES_stencil1 */ -/* GL_OES_stencil4 */ #ifndef GL_OES_stencil4 #define GL_OES_stencil4 1 -#endif +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif /* GL_OES_stencil4 */ #ifndef GL_OES_surfaceless_context #define GL_OES_surfaceless_context 1 +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#endif /* GL_OES_surfaceless_context */ + +#ifndef GL_OES_tessellation_point_size +#define GL_OES_tessellation_point_size 1 +#endif /* GL_OES_tessellation_point_size */ + +#ifndef GL_OES_tessellation_shader +#define GL_OES_tessellation_shader 1 +#define GL_PATCHES_OES 0x000E +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_QUADS_OES 0x0007 +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value); #endif +#endif /* GL_OES_tessellation_shader */ -/* GL_OES_texture_3D */ #ifndef GL_OES_texture_3D #define GL_OES_texture_3D 1 +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); #endif -typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif +#endif /* GL_OES_texture_3D */ + +#ifndef GL_OES_texture_border_clamp +#define GL_OES_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 +#define GL_CLAMP_TO_BORDER_OES 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_OES_texture_border_clamp */ + +#ifndef GL_OES_texture_buffer +#define GL_OES_texture_buffer 1 +#define GL_TEXTURE_BUFFER_OES 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F +#define GL_SAMPLER_BUFFER_OES 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 +#define GL_IMAGE_BUFFER_OES 0x9051 +#define GL_INT_IMAGE_BUFFER_OES 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D +#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_OES_texture_buffer */ + +#ifndef GL_OES_texture_compression_astc +#define GL_OES_texture_compression_astc 1 +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 +#endif /* GL_OES_texture_compression_astc */ + +#ifndef GL_OES_texture_cube_map_array +#define GL_OES_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A +#endif /* GL_OES_texture_cube_map_array */ -/* GL_OES_texture_float */ #ifndef GL_OES_texture_float #define GL_OES_texture_float 1 -#endif +#endif /* GL_OES_texture_float */ -/* GL_OES_texture_float_linear */ #ifndef GL_OES_texture_float_linear -#define GL_OES_texture_float_linear 1 -#endif - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_OES_texture_half_float 1 -#endif - -/* GL_OES_texture_half_float_linear */ -#ifndef GL_OES_texture_half_float_linear -#define GL_OES_texture_half_float_linear 1 -#endif - -/* GL_OES_texture_npot */ -#ifndef GL_OES_texture_npot -#define GL_OES_texture_npot 1 -#endif - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_OES_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); -#endif -typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); -typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); -typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); -#endif - -/* GL_OES_vertex_half_float */ -#ifndef GL_OES_vertex_half_float -#define GL_OES_vertex_half_float 1 -#endif - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_OES_vertex_type_10_10_10_2 1 -#endif - -/*------------------------------------------------------------------------* - * KHR extension functions - *------------------------------------------------------------------------*/ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); -GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); -GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, GLvoid **params); -#endif -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); -typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); -typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, GLvoid **params); +#define GL_OES_texture_float_linear 1 +#endif /* GL_OES_texture_float_linear */ + +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#define GL_HALF_FLOAT_OES 0x8D61 +#endif /* GL_OES_texture_half_float */ + +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif /* GL_OES_texture_half_float_linear */ + +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif /* GL_OES_texture_npot */ + +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 +#define GL_STENCIL_INDEX_OES 0x1901 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif /* GL_OES_texture_stencil8 */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif +#endif /* GL_OES_texture_storage_multisample_2d_array */ + +#ifndef GL_OES_texture_view +#define GL_OES_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); #endif +#endif /* GL_OES_texture_view */ -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); #endif +#endif /* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif /* GL_OES_vertex_half_float */ -/*------------------------------------------------------------------------* - * AMD extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif /* GL_OES_vertex_type_10_10_10_2 */ + +#ifndef GL_OES_viewport_array +#define GL_OES_viewport_array 1 +#define GL_MAX_VIEWPORTS_OES 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data); +#endif +#endif /* GL_OES_viewport_array */ -/* GL_AMD_compressed_3DC_texture */ #ifndef GL_AMD_compressed_3DC_texture #define GL_AMD_compressed_3DC_texture 1 -#endif +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif /* GL_AMD_compressed_3DC_texture */ -/* GL_AMD_compressed_ATC_texture */ #ifndef GL_AMD_compressed_ATC_texture #define GL_AMD_compressed_ATC_texture 1 +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif /* GL_AMD_compressed_ATC_texture */ + +#ifndef GL_AMD_framebuffer_multisample_advanced +#define GL_AMD_framebuffer_multisample_advanced 1 +#define GL_RENDERBUFFER_STORAGE_SAMPLES_AMD 0x91B2 +#define GL_MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD 0x91B3 +#define GL_MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD 0x91B4 +#define GL_MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD 0x91B5 +#define GL_NUM_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B6 +#define GL_SUPPORTED_MULTISAMPLE_MODES_AMD 0x91B7 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLenum target, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMDPROC) (GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAdvancedAMD (GLenum target, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glNamedRenderbufferStorageMultisampleAdvancedAMD (GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, GLenum internalformat, GLsizei width, GLsizei height); #endif +#endif /* GL_AMD_framebuffer_multisample_advanced */ -/* AMD_performance_monitor */ #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); #endif -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif +#endif /* GL_AMD_performance_monitor */ -/* GL_AMD_program_binary_Z400 */ #ifndef GL_AMD_program_binary_Z400 #define GL_AMD_program_binary_Z400 1 -#endif +#define GL_Z400_BINARY_AMD 0x8740 +#endif /* GL_AMD_program_binary_Z400 */ -/*------------------------------------------------------------------------* - * ANGLE extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_ANDROID_extension_pack_es31a +#define GL_ANDROID_extension_pack_es31a 1 +#endif /* GL_ANDROID_extension_pack_es31a */ -/* GL_ANGLE_depth_texture */ #ifndef GL_ANGLE_depth_texture #define GL_ANGLE_depth_texture 1 -#endif +#endif /* GL_ANGLE_depth_texture */ -/* GL_ANGLE_framebuffer_blit */ #ifndef GL_ANGLE_framebuffer_blit #define GL_ANGLE_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #endif -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif +#endif /* GL_ANGLE_framebuffer_blit */ -/* GL_ANGLE_framebuffer_multisample */ #ifndef GL_ANGLE_framebuffer_multisample #define GL_ANGLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif +#endif /* GL_ANGLE_framebuffer_multisample */ #ifndef GL_ANGLE_instanced_arrays #define GL_ANGLE_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); #endif -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); -#endif +#endif /* GL_ANGLE_instanced_arrays */ -/* GL_ANGLE_pack_reverse_row_order */ #ifndef GL_ANGLE_pack_reverse_row_order #define GL_ANGLE_pack_reverse_row_order 1 -#endif +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif /* GL_ANGLE_pack_reverse_row_order */ -/* GL_ANGLE_program_binary */ #ifndef GL_ANGLE_program_binary #define GL_ANGLE_program_binary 1 -#endif +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif /* GL_ANGLE_program_binary */ -/* GL_ANGLE_texture_compression_dxt3 */ #ifndef GL_ANGLE_texture_compression_dxt3 #define GL_ANGLE_texture_compression_dxt3 1 -#endif +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif /* GL_ANGLE_texture_compression_dxt3 */ -/* GL_ANGLE_texture_compression_dxt5 */ #ifndef GL_ANGLE_texture_compression_dxt5 #define GL_ANGLE_texture_compression_dxt5 1 -#endif +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif /* GL_ANGLE_texture_compression_dxt5 */ -/* GL_ANGLE_texture_usage */ #ifndef GL_ANGLE_texture_usage #define GL_ANGLE_texture_usage 1 -#endif +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif /* GL_ANGLE_texture_usage */ #ifndef GL_ANGLE_translated_shader_source #define GL_ANGLE_translated_shader_source 1 +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif -typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif - -/*------------------------------------------------------------------------* - * APPLE extension functions - *------------------------------------------------------------------------*/ +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +#endif +#endif /* GL_ANGLE_translated_shader_source */ + +#ifndef GL_APPLE_clip_distance +#define GL_APPLE_clip_distance 1 +#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 +#define GL_CLIP_DISTANCE0_APPLE 0x3000 +#define GL_CLIP_DISTANCE1_APPLE 0x3001 +#define GL_CLIP_DISTANCE2_APPLE 0x3002 +#define GL_CLIP_DISTANCE3_APPLE 0x3003 +#define GL_CLIP_DISTANCE4_APPLE 0x3004 +#define GL_CLIP_DISTANCE5_APPLE 0x3005 +#define GL_CLIP_DISTANCE6_APPLE 0x3006 +#define GL_CLIP_DISTANCE7_APPLE 0x3007 +#endif /* GL_APPLE_clip_distance */ + +#ifndef GL_APPLE_color_buffer_packed_float +#define GL_APPLE_color_buffer_packed_float 1 +#endif /* GL_APPLE_color_buffer_packed_float */ -/* GL_APPLE_copy_texture_levels */ #ifndef GL_APPLE_copy_texture_levels #define GL_APPLE_copy_texture_levels 1 +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); #endif -typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif +#endif /* GL_APPLE_copy_texture_levels */ -/* GL_APPLE_framebuffer_multisample */ #ifndef GL_APPLE_framebuffer_multisample #define GL_APPLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #endif +#endif /* GL_APPLE_framebuffer_multisample */ -/* GL_APPLE_rgb_422 */ #ifndef GL_APPLE_rgb_422 #define GL_APPLE_rgb_422 1 -#endif +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ -/* GL_APPLE_sync */ #ifndef GL_APPLE_sync #define GL_APPLE_sync 1 +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); @@ -1397,95 +1015,283 @@ GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif -typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); -typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); -typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); #endif +#endif /* GL_APPLE_sync */ -/* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_APPLE_texture_format_BGRA8888 1 -#endif +#define GL_BGRA_EXT 0x80E1 +#define GL_BGRA8_EXT 0x93A1 +#endif /* GL_APPLE_texture_format_BGRA8888 */ -/* GL_APPLE_texture_max_level */ #ifndef GL_APPLE_texture_max_level #define GL_APPLE_texture_max_level 1 -#endif +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif /* GL_APPLE_texture_max_level */ -/*------------------------------------------------------------------------* - * ARM extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_APPLE_texture_packed_float +#define GL_APPLE_texture_packed_float 1 +#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B +#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E +#define GL_R11F_G11F_B10F_APPLE 0x8C3A +#define GL_RGB9_E5_APPLE 0x8C3D +#endif /* GL_APPLE_texture_packed_float */ -/* GL_ARM_mali_program_binary */ #ifndef GL_ARM_mali_program_binary #define GL_ARM_mali_program_binary 1 -#endif +#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 +#endif /* GL_ARM_mali_program_binary */ -/* GL_ARM_mali_shader_binary */ #ifndef GL_ARM_mali_shader_binary #define GL_ARM_mali_shader_binary 1 -#endif +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif /* GL_ARM_mali_shader_binary */ -/* GL_ARM_rgba8 */ #ifndef GL_ARM_rgba8 #define GL_ARM_rgba8 1 -#endif +#endif /* GL_ARM_rgba8 */ + +#ifndef GL_ARM_shader_framebuffer_fetch +#define GL_ARM_shader_framebuffer_fetch 1 +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 +#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 +#endif /* GL_ARM_shader_framebuffer_fetch */ + +#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil +#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 +#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ + +#ifndef GL_ARM_texture_unnormalized_coordinates +#define GL_ARM_texture_unnormalized_coordinates 1 +#define GL_TEXTURE_UNNORMALIZED_COORDINATES_ARM 0x8F6A +#endif /* GL_ARM_texture_unnormalized_coordinates */ + +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 +#endif /* GL_DMP_program_binary */ + +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#define GL_SHADER_BINARY_DMP 0x9250 +#endif /* GL_DMP_shader_binary */ + +#ifndef GL_EXT_EGL_image_array +#define GL_EXT_EGL_image_array 1 +#endif /* GL_EXT_EGL_image_array */ -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_EXT_EGL_image_storage +#define GL_EXT_EGL_image_storage 1 +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list); +GL_APICALL void GL_APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list); +#endif +#endif /* GL_EXT_EGL_image_storage */ + +#ifndef GL_EXT_EGL_image_storage_compression +#define GL_EXT_EGL_image_storage_compression 1 +#define GL_SURFACE_COMPRESSION_EXT 0x96C0 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT 0x96C1 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT 0x96C2 +#endif /* GL_EXT_EGL_image_storage_compression */ + +#ifndef GL_EXT_YUV_target +#define GL_EXT_YUV_target 1 +#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 +#endif /* GL_EXT_YUV_target */ + +#ifndef GL_EXT_base_instance +#define GL_EXT_base_instance 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#endif +#endif /* GL_EXT_base_instance */ + +#ifndef GL_EXT_blend_func_extended +#define GL_EXT_blend_func_extended 1 +#define GL_SRC1_COLOR_EXT 0x88F9 +#define GL_SRC1_ALPHA_EXT 0x8589 +#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB +#define GL_SRC_ALPHA_SATURATE_EXT 0x0308 +#define GL_LOCATION_INDEX_EXT 0x930F +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name); +#endif +#endif /* GL_EXT_blend_func_extended */ -/* GL_EXT_blend_minmax */ #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_buffer_storage +#define GL_EXT_buffer_storage 1 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT_EXT 0x0040 +#define GL_MAP_COHERENT_BIT_EXT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100 +#define GL_CLIENT_STORAGE_BIT_EXT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F +#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220 +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); #endif +#endif /* GL_EXT_buffer_storage */ + +#ifndef GL_EXT_clear_texture +#define GL_EXT_clear_texture 1 +typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#endif +#endif /* GL_EXT_clear_texture */ + +#ifndef GL_EXT_clip_control +#define GL_EXT_clip_control 1 +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D +typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth); +#endif +#endif /* GL_EXT_clip_control */ + +#ifndef GL_EXT_clip_cull_distance +#define GL_EXT_clip_cull_distance 1 +#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32 +#define GL_MAX_CULL_DISTANCES_EXT 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA +#define GL_CLIP_DISTANCE0_EXT 0x3000 +#define GL_CLIP_DISTANCE1_EXT 0x3001 +#define GL_CLIP_DISTANCE2_EXT 0x3002 +#define GL_CLIP_DISTANCE3_EXT 0x3003 +#define GL_CLIP_DISTANCE4_EXT 0x3004 +#define GL_CLIP_DISTANCE5_EXT 0x3005 +#define GL_CLIP_DISTANCE6_EXT 0x3006 +#define GL_CLIP_DISTANCE7_EXT 0x3007 +#endif /* GL_EXT_clip_cull_distance */ + +#ifndef GL_EXT_color_buffer_float +#define GL_EXT_color_buffer_float 1 +#endif /* GL_EXT_color_buffer_float */ -/* GL_EXT_color_buffer_half_float */ #ifndef GL_EXT_color_buffer_half_float #define GL_EXT_color_buffer_half_float 1 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif /* GL_EXT_color_buffer_half_float */ + +#ifndef GL_EXT_conservative_depth +#define GL_EXT_conservative_depth 1 +#endif /* GL_EXT_conservative_depth */ + +#ifndef GL_EXT_copy_image +#define GL_EXT_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); #endif +#endif /* GL_EXT_copy_image */ -/* GL_EXT_debug_label */ #ifndef GL_EXT_debug_label #define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); #endif -typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif +#endif /* GL_EXT_debug_label */ -/* GL_EXT_debug_marker */ #ifndef GL_EXT_debug_marker #define GL_EXT_debug_marker 1 +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); #endif -typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_depth_clamp +#define GL_EXT_depth_clamp 1 +#define GL_DEPTH_CLAMP_EXT 0x864F +#endif /* GL_EXT_depth_clamp */ -/* GL_EXT_discard_framebuffer */ #ifndef GL_EXT_discard_framebuffer #define GL_EXT_discard_framebuffer 1 +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); #endif -typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif +#endif /* GL_EXT_discard_framebuffer */ #ifndef GL_EXT_disjoint_timer_query #define GL_EXT_disjoint_timer_query 1 +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VEXTPROC) (GLenum pname, GLint64 *data); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); @@ -1498,209 +1304,991 @@ GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLin GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetInteger64vEXT (GLenum pname, GLint64 *data); #endif -typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); -typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); -typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); -typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); -typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); #endif /* GL_EXT_disjoint_timer_query */ #ifndef GL_EXT_draw_buffers #define GL_EXT_draw_buffers 1 +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 +#define GL_DRAW_BUFFER0_EXT 0x8825 +#define GL_DRAW_BUFFER1_EXT 0x8826 +#define GL_DRAW_BUFFER2_EXT 0x8827 +#define GL_DRAW_BUFFER3_EXT 0x8828 +#define GL_DRAW_BUFFER4_EXT 0x8829 +#define GL_DRAW_BUFFER5_EXT 0x882A +#define GL_DRAW_BUFFER6_EXT 0x882B +#define GL_DRAW_BUFFER7_EXT 0x882C +#define GL_DRAW_BUFFER8_EXT 0x882D +#define GL_DRAW_BUFFER9_EXT 0x882E +#define GL_DRAW_BUFFER10_EXT 0x882F +#define GL_DRAW_BUFFER11_EXT 0x8830 +#define GL_DRAW_BUFFER12_EXT 0x8831 +#define GL_DRAW_BUFFER13_EXT 0x8832 +#define GL_DRAW_BUFFER14_EXT 0x8833 +#define GL_DRAW_BUFFER15_EXT 0x8834 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); #endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); #endif /* GL_EXT_draw_buffers */ -/* GL_EXT_map_buffer_range */ +#ifndef GL_EXT_draw_buffers_indexed +#define GL_EXT_draw_buffers_indexed 1 +typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); +#endif +#endif /* GL_EXT_draw_buffers_indexed */ + +#ifndef GL_EXT_draw_elements_base_vertex +#define GL_EXT_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#endif +#endif /* GL_EXT_draw_elements_base_vertex */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_transform_feedback +#define GL_EXT_draw_transform_feedback 1 +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id); +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id); +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount); +#endif +#endif /* GL_EXT_draw_transform_feedback */ + +#ifndef GL_EXT_external_buffer +#define GL_EXT_external_buffer 1 +typedef void *GLeglClientBufferEXT; +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#endif +#endif /* GL_EXT_external_buffer */ + +#ifndef GL_EXT_float_blend +#define GL_EXT_float_blend 1 +#endif /* GL_EXT_float_blend */ + +#ifndef GL_EXT_fragment_shading_rate +#define GL_EXT_fragment_shading_rate 1 +#define GL_SHADING_RATE_1X1_PIXELS_EXT 0x96A6 +#define GL_SHADING_RATE_1X2_PIXELS_EXT 0x96A7 +#define GL_SHADING_RATE_2X1_PIXELS_EXT 0x96A8 +#define GL_SHADING_RATE_2X2_PIXELS_EXT 0x96A9 +#define GL_SHADING_RATE_1X4_PIXELS_EXT 0x96AA +#define GL_SHADING_RATE_4X1_PIXELS_EXT 0x96AB +#define GL_SHADING_RATE_4X2_PIXELS_EXT 0x96AC +#define GL_SHADING_RATE_2X4_PIXELS_EXT 0x96AD +#define GL_SHADING_RATE_4X4_PIXELS_EXT 0x96AE +#define GL_SHADING_RATE_EXT 0x96D0 +#define GL_SHADING_RATE_ATTACHMENT_EXT 0x96D1 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_EXT 0x96D2 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_EXT 0x96D3 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_EXT 0x96D4 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_EXT 0x96D5 +#define GL_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_EXT 0x96D6 +#define GL_MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH_EXT 0x96D7 +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH_EXT 0x96D8 +#define GL_MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT_EXT 0x96D9 +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT_EXT 0x96DA +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_ASPECT_RATIO_EXT 0x96DB +#define GL_MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_LAYERS_EXT 0x96DC +#define GL_FRAGMENT_SHADING_RATE_WITH_SHADER_DEPTH_STENCIL_WRITES_SUPPORTED_EXT 0x96DD +#define GL_FRAGMENT_SHADING_RATE_WITH_SAMPLE_MASK_SUPPORTED_EXT 0x96DE +#define GL_FRAGMENT_SHADING_RATE_ATTACHMENT_WITH_DEFAULT_FRAMEBUFFER_SUPPORTED_EXT 0x96DF +#define GL_FRAGMENT_SHADING_RATE_NON_TRIVIAL_COMBINERS_SUPPORTED_EXT 0x8F6F +typedef void (GL_APIENTRYP PFNGLGETFRAGMENTSHADINGRATESEXTPROC) (GLsizei samples, GLsizei maxCount, GLsizei *count, GLenum *shadingRates); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEEXTPROC) (GLenum rate); +typedef void (GL_APIENTRYP PFNGLSHADINGRATECOMBINEROPSEXTPROC) (GLenum combinerOp0, GLenum combinerOp1); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSHADINGRATEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint baseLayer, GLsizei numLayers, GLsizei texelWidth, GLsizei texelHeight); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetFragmentShadingRatesEXT (GLsizei samples, GLsizei maxCount, GLsizei *count, GLenum *shadingRates); +GL_APICALL void GL_APIENTRY glShadingRateEXT (GLenum rate); +GL_APICALL void GL_APIENTRY glShadingRateCombinerOpsEXT (GLenum combinerOp0, GLenum combinerOp1); +GL_APICALL void GL_APIENTRY glFramebufferShadingRateEXT (GLenum target, GLenum attachment, GLuint texture, GLint baseLayer, GLsizei numLayers, GLsizei texelWidth, GLsizei texelHeight); +#endif +#endif /* GL_EXT_fragment_shading_rate */ + +#ifndef GL_EXT_geometry_point_size +#define GL_EXT_geometry_point_size 1 +#endif /* GL_EXT_geometry_point_size */ + +#ifndef GL_EXT_geometry_shader +#define GL_EXT_geometry_shader 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F +#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_UNDEFINED_VERTEX_EXT 0x8260 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_EXT_geometry_shader */ + +#ifndef GL_EXT_gpu_shader5 +#define GL_EXT_gpu_shader5 1 +#endif /* GL_EXT_gpu_shader5 */ + +#ifndef GL_EXT_instanced_arrays +#define GL_EXT_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_instanced_arrays */ + #ifndef GL_EXT_map_buffer_range #define GL_EXT_map_buffer_range 1 +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); #endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#endif /* GL_EXT_map_buffer_range */ + +#ifndef GL_EXT_memory_object +#define GL_EXT_memory_object 1 +#define GL_TEXTURE_TILING_EXT 0x9580 +#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581 +#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B +#define GL_NUM_TILING_TYPES_EXT 0x9582 +#define GL_TILING_TYPES_EXT 0x9583 +#define GL_OPTIMAL_TILING_EXT 0x9584 +#define GL_LINEAR_TILING_EXT 0x9585 +#define GL_NUM_DEVICE_UUIDS_EXT 0x9596 +#define GL_DEVICE_UUID_EXT 0x9597 +#define GL_DRIVER_UUID_EXT 0x9598 +#define GL_UUID_SIZE_EXT 16 +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects); +typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject); +typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects); +typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data); +GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data); +GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects); +GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject); +GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects); +GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_EXT_memory_object */ + +#ifndef GL_EXT_memory_object_fd +#define GL_EXT_memory_object_fd 1 +#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586 +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_memory_object_fd */ + +#ifndef GL_EXT_memory_object_win32 +#define GL_EXT_memory_object_win32 1 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 +#define GL_DEVICE_LUID_EXT 0x9599 +#define GL_DEVICE_NODE_MASK_EXT 0x959A +#define GL_LUID_SIZE_EXT 8 +#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 +#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A +#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B +#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name); #endif +#endif /* GL_EXT_memory_object_win32 */ -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_EXT_multisampled_render_to_texture 1 +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); #endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multi_draw_indirect +#define GL_EXT_multi_draw_indirect 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif +#endif /* GL_EXT_multi_draw_indirect */ + +#ifndef GL_EXT_multisampled_compatibility +#define GL_EXT_multisampled_compatibility 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#endif /* GL_EXT_multisampled_compatibility */ + +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif +#endif /* GL_EXT_multisampled_render_to_texture */ + +#ifndef GL_EXT_multisampled_render_to_texture2 +#define GL_EXT_multisampled_render_to_texture2 1 +#endif /* GL_EXT_multisampled_render_to_texture2 */ -/* GL_EXT_multiview_draw_buffers */ #ifndef GL_EXT_multiview_draw_buffers #define GL_EXT_multiview_draw_buffers 1 +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); +typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); #endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); -typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); -#endif +#endif /* GL_EXT_multiview_draw_buffers */ -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); -#endif +#ifndef GL_EXT_multiview_tessellation_geometry_shader +#define GL_EXT_multiview_tessellation_geometry_shader 1 +#endif /* GL_EXT_multiview_tessellation_geometry_shader */ + +#ifndef GL_EXT_multiview_texture_multisample +#define GL_EXT_multiview_texture_multisample 1 +#endif /* GL_EXT_multiview_texture_multisample */ + +#ifndef GL_EXT_multiview_timer_query +#define GL_EXT_multiview_timer_query 1 +#endif /* GL_EXT_multiview_timer_query */ -/* GL_EXT_occlusion_query_boolean */ #ifndef GL_EXT_occlusion_query_boolean #define GL_EXT_occlusion_query_boolean 1 -/* All entry points also exist in GL_EXT_disjoint_timer_query */ +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#endif /* GL_EXT_occlusion_query_boolean */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_EXT_primitive_bounding_box */ + +#ifndef GL_EXT_protected_textures +#define GL_EXT_protected_textures 1 +#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010 +#define GL_TEXTURE_PROTECTED_EXT 0x8BFA +#endif /* GL_EXT_protected_textures */ + +#ifndef GL_EXT_pvrtc_sRGB +#define GL_EXT_pvrtc_sRGB 1 +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 +#endif /* GL_EXT_pvrtc_sRGB */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); #endif +#endif /* GL_EXT_raster_multisample */ -/* GL_EXT_read_format_bgra */ #ifndef GL_EXT_read_format_bgra #define GL_EXT_read_format_bgra 1 -#endif +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif /* GL_EXT_read_format_bgra */ + +#ifndef GL_EXT_render_snorm +#define GL_EXT_render_snorm 1 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM_EXT 0x8F98 +#define GL_RG16_SNORM_EXT 0x8F99 +#define GL_RGBA16_SNORM_EXT 0x8F9B +#endif /* GL_EXT_render_snorm */ -/* GL_EXT_robustness */ #ifndef GL_EXT_robustness #define GL_EXT_robustness 1 +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); -GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); #endif -typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); -typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif /* GL_EXT_robustness */ + +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif /* GL_EXT_sRGB */ + +#ifndef GL_EXT_sRGB_write_control +#define GL_EXT_sRGB_write_control 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif /* GL_EXT_sRGB_write_control */ + +#ifndef GL_EXT_semaphore +#define GL_EXT_semaphore 1 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 +#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530 +#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531 +typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores); +typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores); +GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore); +GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#endif +#endif /* GL_EXT_semaphore */ + +#ifndef GL_EXT_semaphore_fd +#define GL_EXT_semaphore_fd 1 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_semaphore_fd */ + +#ifndef GL_EXT_semaphore_win32 +#define GL_EXT_semaphore_win32 1 +#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 +#define GL_D3D12_FENCE_VALUE_EXT 0x9595 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name); #endif +#endif /* GL_EXT_semaphore_win32 */ + +#ifndef GL_EXT_separate_depth_stencil +#define GL_EXT_separate_depth_stencil 1 +#endif /* GL_EXT_separate_depth_stencil */ -/* GL_EXT_separate_shader_objects */ #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); -GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif -typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); -typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif +GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_EXT_separate_shader_objects */ -/* GL_EXT_shader_framebuffer_fetch */ #ifndef GL_EXT_shader_framebuffer_fetch #define GL_EXT_shader_framebuffer_fetch 1 +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif /* GL_EXT_shader_framebuffer_fetch */ + +#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent +#define GL_EXT_shader_framebuffer_fetch_non_coherent 1 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierEXT (void); +#endif +#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */ + +#ifndef GL_EXT_shader_group_vote +#define GL_EXT_shader_group_vote 1 +#endif /* GL_EXT_shader_group_vote */ + +#ifndef GL_EXT_shader_implicit_conversions +#define GL_EXT_shader_implicit_conversions 1 +#endif /* GL_EXT_shader_implicit_conversions */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shader_io_blocks +#define GL_EXT_shader_io_blocks 1 +#endif /* GL_EXT_shader_io_blocks */ + +#ifndef GL_EXT_shader_non_constant_global_initializers +#define GL_EXT_shader_non_constant_global_initializers 1 +#endif /* GL_EXT_shader_non_constant_global_initializers */ + +#ifndef GL_EXT_shader_pixel_local_storage +#define GL_EXT_shader_pixel_local_storage 1 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 +#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 +#endif /* GL_EXT_shader_pixel_local_storage */ + +#ifndef GL_EXT_shader_pixel_local_storage2 +#define GL_EXT_shader_pixel_local_storage2 1 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651 +#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size); +typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target); +typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size); +GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target); +GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values); #endif +#endif /* GL_EXT_shader_pixel_local_storage2 */ + +#ifndef GL_EXT_shader_samples_identical +#define GL_EXT_shader_samples_identical 1 +#endif /* GL_EXT_shader_samples_identical */ -/* GL_EXT_shader_texture_lod */ #ifndef GL_EXT_shader_texture_lod #define GL_EXT_shader_texture_lod 1 -#endif +#endif /* GL_EXT_shader_texture_lod */ -/* GL_EXT_shadow_samplers */ #ifndef GL_EXT_shadow_samplers #define GL_EXT_shadow_samplers 1 +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif /* GL_EXT_shadow_samplers */ + +#ifndef GL_EXT_sparse_texture +#define GL_EXT_sparse_texture 1 +#define GL_TEXTURE_SPARSE_EXT 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7 +#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_3D 0x806F +#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9 +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_EXT_sparse_texture */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 +#endif /* GL_EXT_tessellation_point_size */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 +#define GL_PATCHES_EXT 0x000E +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_QUADS_EXT 0x0007 +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); +#endif +#endif /* GL_EXT_tessellation_shader */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_EXT_texture_border_clamp */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); #endif +#endif /* GL_EXT_texture_buffer */ -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_EXT_sRGB 1 -#endif +#ifndef GL_EXT_texture_compression_astc_decode_mode +#define GL_EXT_texture_compression_astc_decode_mode 1 +#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69 +#endif /* GL_EXT_texture_compression_astc_decode_mode */ + +#ifndef GL_EXT_texture_compression_bptc +#define GL_EXT_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F +#endif /* GL_EXT_texture_compression_bptc */ -/* GL_EXT_texture_compression_dxt1 */ #ifndef GL_EXT_texture_compression_dxt1 #define GL_EXT_texture_compression_dxt1 1 -#endif +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif /* GL_EXT_texture_compression_dxt1 */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_compression_s3tc_srgb +#define GL_EXT_texture_compression_s3tc_srgb 1 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_compression_s3tc_srgb */ + +#ifndef GL_EXT_texture_cube_map_array +#define GL_EXT_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#endif /* GL_EXT_texture_cube_map_array */ -/* GL_EXT_texture_filter_anisotropic */ #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 -#endif +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366 +#define GL_WEIGHTED_AVERAGE_EXT 0x9367 +#endif /* GL_EXT_texture_filter_minmax */ -/* GL_EXT_texture_format_BGRA8888 */ #ifndef GL_EXT_texture_format_BGRA8888 #define GL_EXT_texture_format_BGRA8888 1 -#endif +#endif /* GL_EXT_texture_format_BGRA8888 */ + +#ifndef GL_EXT_texture_format_sRGB_override +#define GL_EXT_texture_format_sRGB_override 1 +#define GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT 0x8FBF +#endif /* GL_EXT_texture_format_sRGB_override */ + +#ifndef GL_EXT_texture_mirror_clamp_to_edge +#define GL_EXT_texture_mirror_clamp_to_edge 1 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#endif /* GL_EXT_texture_mirror_clamp_to_edge */ + +#ifndef GL_EXT_texture_norm16 +#define GL_EXT_texture_norm16 1 +#define GL_R16_EXT 0x822A +#define GL_RG16_EXT 0x822C +#define GL_RGBA16_EXT 0x805B +#define GL_RGB16_EXT 0x8054 +#define GL_RGB16_SNORM_EXT 0x8F9A +#endif /* GL_EXT_texture_norm16 */ + +#ifndef GL_EXT_texture_query_lod +#define GL_EXT_texture_query_lod 1 +#endif /* GL_EXT_texture_query_lod */ -/* GL_EXT_texture_rg */ #ifndef GL_EXT_texture_rg #define GL_EXT_texture_rg 1 -#endif +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif /* GL_EXT_texture_rg */ + +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_EXT_texture_sRGB_R8 1 +#define GL_SR8_EXT 0x8FBD +#endif /* GL_EXT_texture_sRGB_R8 */ + +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_shadow_lod +#define GL_EXT_texture_shadow_lod 1 +#endif /* GL_EXT_texture_shadow_lod */ -/* GL_EXT_texture_storage */ #ifndef GL_EXT_texture_storage #define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); @@ -1709,130 +2297,552 @@ GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #endif -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif /* GL_EXT_texture_storage */ + +#ifndef GL_EXT_texture_storage_compression +#define GL_EXT_texture_storage_compression 1 +#define GL_NUM_SURFACE_COMPRESSION_FIXED_RATES_EXT 0x8F6E +#define GL_SURFACE_COMPRESSION_FIXED_RATE_1BPC_EXT 0x96C4 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_2BPC_EXT 0x96C5 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_3BPC_EXT 0x96C6 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_4BPC_EXT 0x96C7 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_5BPC_EXT 0x96C8 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_6BPC_EXT 0x96C9 +#define GL_SURFACE_COMPRESSION_FIXED_RATE_7BPC_EXT 0x96CA +#define GL_SURFACE_COMPRESSION_FIXED_RATE_8BPC_EXT 0x96CB +#define GL_SURFACE_COMPRESSION_FIXED_RATE_9BPC_EXT 0x96CC +#define GL_SURFACE_COMPRESSION_FIXED_RATE_10BPC_EXT 0x96CD +#define GL_SURFACE_COMPRESSION_FIXED_RATE_11BPC_EXT 0x96CE +#define GL_SURFACE_COMPRESSION_FIXED_RATE_12BPC_EXT 0x96CF +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEATTRIBS2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, const GLint* attrib_list); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEATTRIBS3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, const GLint* attrib_list); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorageAttribs2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, const GLint* attrib_list); +GL_APICALL void GL_APIENTRY glTexStorageAttribs3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, const GLint* attrib_list); #endif +#endif /* GL_EXT_texture_storage_compression */ -/* GL_EXT_texture_type_2_10_10_10_REV */ #ifndef GL_EXT_texture_type_2_10_10_10_REV #define GL_EXT_texture_type_2_10_10_10_REV 1 +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif /* GL_EXT_texture_type_2_10_10_10_REV */ + +#ifndef GL_EXT_texture_view +#define GL_EXT_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); #endif +#endif /* GL_EXT_texture_view */ -/* GL_EXT_unpack_subimage */ #ifndef GL_EXT_unpack_subimage #define GL_EXT_unpack_subimage 1 +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 +#endif /* GL_EXT_unpack_subimage */ + +#ifndef GL_EXT_win32_keyed_mutex +#define GL_EXT_win32_keyed_mutex 1 +typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout); +typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout); +GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key); +#endif +#endif /* GL_EXT_win32_keyed_mutex */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 +typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); #endif +#endif /* GL_EXT_window_rectangles */ -/*------------------------------------------------------------------------* - * DMP extension functions - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_DMP_shader_binary 1 -#endif - -/*------------------------------------------------------------------------* - * FJ extension functions - *------------------------------------------------------------------------*/ - -/* GL_FJ_shader_binary_GCCSO */ #ifndef GL_FJ_shader_binary_GCCSO #define GL_FJ_shader_binary_GCCSO 1 +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#endif /* GL_FJ_shader_binary_GCCSO */ + +#ifndef GL_IMG_bindless_texture +#define GL_IMG_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#endif +#endif /* GL_IMG_bindless_texture */ + +#ifndef GL_IMG_framebuffer_downsample +#define GL_IMG_framebuffer_downsample 1 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C +#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D +#define GL_DOWNSAMPLE_SCALES_IMG 0x913E +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); #endif +#endif /* GL_IMG_framebuffer_downsample */ -/*------------------------------------------------------------------------* - * IMG extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_IMG_multisampled_render_to_texture */ -/* GL_IMG_program_binary */ #ifndef GL_IMG_program_binary #define GL_IMG_program_binary 1 -#endif +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif /* GL_IMG_program_binary */ -/* GL_IMG_read_format */ #ifndef GL_IMG_read_format #define GL_IMG_read_format 1 -#endif +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif /* GL_IMG_read_format */ -/* GL_IMG_shader_binary */ #ifndef GL_IMG_shader_binary #define GL_IMG_shader_binary 1 -#endif +#define GL_SGX_BINARY_IMG 0x8C0A +#endif /* GL_IMG_shader_binary */ -/* GL_IMG_texture_compression_pvrtc */ #ifndef GL_IMG_texture_compression_pvrtc #define GL_IMG_texture_compression_pvrtc 1 -#endif +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif /* GL_IMG_texture_compression_pvrtc */ -/* GL_IMG_texture_compression_pvrtc2 */ #ifndef GL_IMG_texture_compression_pvrtc2 #define GL_IMG_texture_compression_pvrtc2 1 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif /* GL_IMG_texture_compression_pvrtc2 */ + +#ifndef GL_IMG_texture_filter_cubic +#define GL_IMG_texture_filter_cubic 1 +#define GL_CUBIC_IMG 0x9139 +#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A +#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B +#endif /* GL_IMG_texture_filter_cubic */ + +#ifndef GL_INTEL_blackhole_render +#define GL_INTEL_blackhole_render 1 +#define GL_BLACKHOLE_RENDER_INTEL 0x83FC +#endif /* GL_INTEL_blackhole_render */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE +#endif /* GL_INTEL_conservative_rasterization */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten); +GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESA_bgra +#define GL_MESA_bgra 1 +#define GL_BGR_EXT 0x80E0 +#endif /* GL_MESA_bgra */ + +#ifndef GL_MESA_framebuffer_flip_x +#define GL_MESA_framebuffer_flip_x 1 +#define GL_FRAMEBUFFER_FLIP_X_MESA 0x8BBC +#endif /* GL_MESA_framebuffer_flip_x */ + +#ifndef GL_MESA_framebuffer_flip_y +#define GL_MESA_framebuffer_flip_y 1 +#define GL_FRAMEBUFFER_FLIP_Y_MESA 0x8BBB +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERIMESAPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVMESAPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferParameteriMESA (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_MESA_framebuffer_flip_y */ + +#ifndef GL_MESA_framebuffer_swap_xy +#define GL_MESA_framebuffer_swap_xy 1 +#define GL_FRAMEBUFFER_SWAP_XY_MESA 0x8BBD +#endif /* GL_MESA_framebuffer_swap_xy */ + +#ifndef GL_MESA_program_binary_formats +#define GL_MESA_program_binary_formats 1 +#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F +#endif /* GL_MESA_program_binary_formats */ + +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 +#endif /* GL_MESA_shader_integer_functions */ + +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_minmax_factor +#define GL_NV_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_NV_blend_minmax_factor */ + +#ifndef GL_NV_clip_space_w_scaling +#define GL_NV_clip_space_w_scaling 1 +#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C +#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D +#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E +typedef void (GL_APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff); +#endif +#endif /* GL_NV_clip_space_w_scaling */ + +#ifndef GL_NV_compute_shader_derivatives +#define GL_NV_compute_shader_derivatives 1 +#endif /* GL_NV_compute_shader_derivatives */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); #endif +#endif /* GL_NV_conservative_raster */ -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_IMG_multisampled_render_to_texture 1 +#ifndef GL_NV_conservative_raster_pre_snap +#define GL_NV_conservative_raster_pre_snap 1 +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550 +#endif /* GL_NV_conservative_raster_pre_snap */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F +typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); #endif +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_NV_copy_buffer +#define GL_NV_copy_buffer 1 +#define GL_COPY_READ_BUFFER_NV 0x8F36 +#define GL_COPY_WRITE_BUFFER_NV 0x8F37 +typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GL_NV_copy_buffer */ -/* GL_NV_coverage_sample */ #ifndef GL_NV_coverage_sample #define GL_NV_coverage_sample 1 +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); #endif -typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); -typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); -#endif +#endif /* GL_NV_coverage_sample */ -/* GL_NV_depth_nonlinear */ #ifndef GL_NV_depth_nonlinear #define GL_NV_depth_nonlinear 1 -#endif +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif /* GL_NV_depth_nonlinear */ -/* GL_NV_draw_buffers */ #ifndef GL_NV_draw_buffers #define GL_NV_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); #endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); -#endif +#endif /* GL_NV_draw_buffers */ -/* GL_NV_draw_instanced */ #ifndef GL_NV_draw_instanced #define GL_NV_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_NV_draw_instanced */ + +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 +typedef void (GL_APIENTRY *GLVULKANPROCNV)(void); +typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name); +typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name); +GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence); #endif +#endif /* GL_NV_draw_vulkan_image */ + +#ifndef GL_NV_explicit_attrib_location +#define GL_NV_explicit_attrib_location 1 +#endif /* GL_NV_explicit_attrib_location */ -/* GL_NV_fbo_color_attachments */ #ifndef GL_NV_fbo_color_attachments #define GL_NV_fbo_color_attachments 1 -#endif +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +#endif /* GL_NV_fbo_color_attachments */ -/* GL_NV_fence */ #ifndef GL_NV_fence #define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); @@ -1842,142 +2852,1008 @@ GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *p GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif -typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif /* GL_NV_fence */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color); #endif +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifndef GL_NV_fragment_shader_barycentric +#define GL_NV_fragment_shader_barycentric 1 +#endif /* GL_NV_fragment_shader_barycentric */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ -/* GL_NV_framebuffer_blit */ #ifndef GL_NV_framebuffer_blit #define GL_NV_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #endif -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif /* GL_NV_framebuffer_blit */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufSize, GLfloat *v); +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufSize, GLfloat *v); +GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components); #endif +#endif /* GL_NV_framebuffer_mixed_samples */ -/* GL_NV_framebuffer_multisample */ #ifndef GL_NV_framebuffer_multisample #define GL_NV_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #endif +#endif /* GL_NV_framebuffer_multisample */ -/* GL_NV_generate_mipmap_sRGB */ #ifndef GL_NV_generate_mipmap_sRGB #define GL_NV_generate_mipmap_sRGB 1 -#endif +#endif /* GL_NV_generate_mipmap_sRGB */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +#define GL_PATCHES 0x000E +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_image_formats +#define GL_NV_image_formats 1 +#endif /* GL_NV_image_formats */ -/* GL_NV_instanced_arrays */ #ifndef GL_NV_instanced_arrays #define GL_NV_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); #endif -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#endif /* GL_NV_instanced_arrays */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei count, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + +#ifndef GL_NV_memory_attachment +#define GL_NV_memory_attachment 1 +#define GL_ATTACHED_MEMORY_OBJECT_NV 0x95A4 +#define GL_ATTACHED_MEMORY_OFFSET_NV 0x95A5 +#define GL_MEMORY_ATTACHABLE_ALIGNMENT_NV 0x95A6 +#define GL_MEMORY_ATTACHABLE_SIZE_NV 0x95A7 +#define GL_MEMORY_ATTACHABLE_NV 0x95A8 +#define GL_DETACHED_MEMORY_INCARNATION_NV 0x95A9 +#define GL_DETACHED_TEXTURES_NV 0x95AA +#define GL_DETACHED_BUFFERS_NV 0x95AB +#define GL_MAX_DETACHED_TEXTURES_NV 0x95AC +#define GL_MAX_DETACHED_BUFFERS_NV 0x95AD +typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTDETACHEDRESOURCESUIVNVPROC) (GLuint memory, GLenum pname, GLint first, GLsizei count, GLuint *params); +typedef void (GL_APIENTRYP PFNGLRESETMEMORYOBJECTPARAMETERNVPROC) (GLuint memory, GLenum pname); +typedef void (GL_APIENTRYP PFNGLTEXATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLBUFFERATTACHMEMORYNVPROC) (GLenum target, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTUREATTACHMEMORYNVPROC) (GLuint texture, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERATTACHMEMORYNVPROC) (GLuint buffer, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetMemoryObjectDetachedResourcesuivNV (GLuint memory, GLenum pname, GLint first, GLsizei count, GLuint *params); +GL_APICALL void GL_APIENTRY glResetMemoryObjectParameterNV (GLuint memory, GLenum pname); +GL_APICALL void GL_APIENTRY glTexAttachMemoryNV (GLenum target, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glBufferAttachMemoryNV (GLenum target, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureAttachMemoryNV (GLuint texture, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glNamedBufferAttachMemoryNV (GLuint buffer, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_NV_memory_attachment */ + +#ifndef GL_NV_memory_object_sparse +#define GL_NV_memory_object_sparse 1 +typedef void (GL_APIENTRYP PFNGLBUFFERPAGECOMMITMENTMEMNVPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTMEMNVPROC) (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTMEMNVPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +typedef void (GL_APIENTRYP PFNGLTEXTUREPAGECOMMITMENTMEMNVPROC) (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferPageCommitmentMemNV (GLenum target, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GL_APICALL void GL_APIENTRY glTexPageCommitmentMemNV (GLenum target, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +GL_APICALL void GL_APIENTRY glNamedBufferPageCommitmentMemNV (GLuint buffer, GLintptr offset, GLsizeiptr size, GLuint memory, GLuint64 memOffset, GLboolean commit); +GL_APICALL void GL_APIENTRY glTexturePageCommitmentMemNV (GLuint texture, GLint layer, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLboolean commit); +#endif +#endif /* GL_NV_memory_object_sparse */ + +#ifndef GL_NV_mesh_shader +#define GL_NV_mesh_shader 1 +#define GL_MESH_SHADER_NV 0x9559 +#define GL_TASK_SHADER_NV 0x955A +#define GL_MAX_MESH_UNIFORM_BLOCKS_NV 0x8E60 +#define GL_MAX_MESH_TEXTURE_IMAGE_UNITS_NV 0x8E61 +#define GL_MAX_MESH_IMAGE_UNIFORMS_NV 0x8E62 +#define GL_MAX_MESH_UNIFORM_COMPONENTS_NV 0x8E63 +#define GL_MAX_MESH_ATOMIC_COUNTER_BUFFERS_NV 0x8E64 +#define GL_MAX_MESH_ATOMIC_COUNTERS_NV 0x8E65 +#define GL_MAX_MESH_SHADER_STORAGE_BLOCKS_NV 0x8E66 +#define GL_MAX_COMBINED_MESH_UNIFORM_COMPONENTS_NV 0x8E67 +#define GL_MAX_TASK_UNIFORM_BLOCKS_NV 0x8E68 +#define GL_MAX_TASK_TEXTURE_IMAGE_UNITS_NV 0x8E69 +#define GL_MAX_TASK_IMAGE_UNIFORMS_NV 0x8E6A +#define GL_MAX_TASK_UNIFORM_COMPONENTS_NV 0x8E6B +#define GL_MAX_TASK_ATOMIC_COUNTER_BUFFERS_NV 0x8E6C +#define GL_MAX_TASK_ATOMIC_COUNTERS_NV 0x8E6D +#define GL_MAX_TASK_SHADER_STORAGE_BLOCKS_NV 0x8E6E +#define GL_MAX_COMBINED_TASK_UNIFORM_COMPONENTS_NV 0x8E6F +#define GL_MAX_MESH_WORK_GROUP_INVOCATIONS_NV 0x95A2 +#define GL_MAX_TASK_WORK_GROUP_INVOCATIONS_NV 0x95A3 +#define GL_MAX_MESH_TOTAL_MEMORY_SIZE_NV 0x9536 +#define GL_MAX_TASK_TOTAL_MEMORY_SIZE_NV 0x9537 +#define GL_MAX_MESH_OUTPUT_VERTICES_NV 0x9538 +#define GL_MAX_MESH_OUTPUT_PRIMITIVES_NV 0x9539 +#define GL_MAX_TASK_OUTPUT_COUNT_NV 0x953A +#define GL_MAX_DRAW_MESH_TASKS_COUNT_NV 0x953D +#define GL_MAX_MESH_VIEWS_NV 0x9557 +#define GL_MESH_OUTPUT_PER_VERTEX_GRANULARITY_NV 0x92DF +#define GL_MESH_OUTPUT_PER_PRIMITIVE_GRANULARITY_NV 0x9543 +#define GL_MAX_MESH_WORK_GROUP_SIZE_NV 0x953B +#define GL_MAX_TASK_WORK_GROUP_SIZE_NV 0x953C +#define GL_MESH_WORK_GROUP_SIZE_NV 0x953E +#define GL_TASK_WORK_GROUP_SIZE_NV 0x953F +#define GL_MESH_VERTICES_OUT_NV 0x9579 +#define GL_MESH_PRIMITIVES_OUT_NV 0x957A +#define GL_MESH_OUTPUT_TYPE_NV 0x957B +#define GL_UNIFORM_BLOCK_REFERENCED_BY_MESH_SHADER_NV 0x959C +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TASK_SHADER_NV 0x959D +#define GL_REFERENCED_BY_MESH_SHADER_NV 0x95A0 +#define GL_REFERENCED_BY_TASK_SHADER_NV 0x95A1 +#define GL_MESH_SHADER_BIT_NV 0x00000040 +#define GL_TASK_SHADER_BIT_NV 0x00000080 +#define GL_MESH_SUBROUTINE_NV 0x957C +#define GL_TASK_SUBROUTINE_NV 0x957D +#define GL_MESH_SUBROUTINE_UNIFORM_NV 0x957E +#define GL_TASK_SUBROUTINE_UNIFORM_NV 0x957F +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_MESH_SHADER_NV 0x959E +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TASK_SHADER_NV 0x959F +typedef void (GL_APIENTRYP PFNGLDRAWMESHTASKSNVPROC) (GLuint first, GLuint count); +typedef void (GL_APIENTRYP PFNGLDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTNVPROC) (GLintptr indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWMESHTASKSINDIRECTCOUNTNVPROC) (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawMeshTasksNV (GLuint first, GLuint count); +GL_APICALL void GL_APIENTRY glDrawMeshTasksIndirectNV (GLintptr indirect); +GL_APICALL void GL_APIENTRY glMultiDrawMeshTasksIndirectNV (GLintptr indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawMeshTasksIndirectCountNV (GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_NV_mesh_shader */ + +#ifndef GL_NV_non_square_matrices +#define GL_NV_non_square_matrices 1 +#define GL_FLOAT_MAT2x3_NV 0x8B65 +#define GL_FLOAT_MAT2x4_NV 0x8B66 +#define GL_FLOAT_MAT3x2_NV 0x8B67 +#define GL_FLOAT_MAT3x4_NV 0x8B68 +#define GL_FLOAT_MAT4x2_NV 0x8B69 +#define GL_FLOAT_MAT4x3_NV 0x8B6A +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_NV_non_square_matrices */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +typedef double GLdouble; +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D +typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (GL_APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (GL_APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (GL_APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range); +GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path); +GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func); +GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLfloat *params); +GL_APICALL void GL_APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT (GLenum mode); +GL_APICALL void GL_APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); +GL_APICALL void GL_APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); +GL_APICALL void GL_APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); +GL_APICALL void GL_APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); +GL_APICALL void GL_APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GL_APICALL void GL_APIENTRY glMatrixPopEXT (GLenum mode); +GL_APICALL void GL_APIENTRY glMatrixPushEXT (GLenum mode); +GL_APICALL void GL_APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GL_APICALL void GL_APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GL_APICALL void GL_APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + +#ifndef GL_NV_pixel_buffer_object +#define GL_NV_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_NV 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF +#endif /* GL_NV_pixel_buffer_object */ + +#ifndef GL_NV_polygon_mode +#define GL_NV_polygon_mode 1 +#define GL_POLYGON_MODE_NV 0x0B40 +#define GL_POLYGON_OFFSET_POINT_NV 0x2A01 +#define GL_POLYGON_OFFSET_LINE_NV 0x2A02 +#define GL_POINT_NV 0x1B00 +#define GL_LINE_NV 0x1B01 +#define GL_FILL_NV 0x1B02 +typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode); #endif +#endif /* GL_NV_polygon_mode */ + +#ifndef GL_NV_primitive_shading_rate +#define GL_NV_primitive_shading_rate 1 +#define GL_SHADING_RATE_IMAGE_PER_PRIMITIVE_NV 0x95B1 +#define GL_SHADING_RATE_IMAGE_PALETTE_COUNT_NV 0x95B2 +#endif /* GL_NV_primitive_shading_rate */ -/* GL_NV_read_buffer */ #ifndef GL_NV_read_buffer #define GL_NV_read_buffer 1 +#define GL_READ_BUFFER_NV 0x0C02 +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); #endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); -#endif +#endif /* GL_NV_read_buffer */ -/* GL_NV_read_buffer_front */ #ifndef GL_NV_read_buffer_front #define GL_NV_read_buffer_front 1 -#endif +#endif /* GL_NV_read_buffer_front */ -/* GL_NV_read_depth */ #ifndef GL_NV_read_depth #define GL_NV_read_depth 1 -#endif +#endif /* GL_NV_read_depth */ -/* GL_NV_read_depth_stencil */ #ifndef GL_NV_read_depth_stencil #define GL_NV_read_depth_stencil 1 -#endif +#endif /* GL_NV_read_depth_stencil */ -/* GL_NV_read_stencil */ #ifndef GL_NV_read_stencil #define GL_NV_read_stencil 1 +#endif /* GL_NV_read_stencil */ + +#ifndef GL_NV_representative_fragment_test +#define GL_NV_representative_fragment_test 1 +#define GL_REPRESENTATIVE_FRAGMENT_TEST_NV 0x937F +#endif /* GL_NV_representative_fragment_test */ + +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif /* GL_NV_sRGB_formats */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_scissor_exclusive +#define GL_NV_scissor_exclusive 1 +#define GL_SCISSOR_TEST_EXCLUSIVE_NV 0x9555 +#define GL_SCISSOR_BOX_EXCLUSIVE_NV 0x9556 +typedef void (GL_APIENTRYP PFNGLSCISSOREXCLUSIVENVPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSOREXCLUSIVEARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glScissorExclusiveNV (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorExclusiveArrayvNV (GLuint first, GLsizei count, const GLint *v); +#endif +#endif /* GL_NV_scissor_exclusive */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_noperspective_interpolation +#define GL_NV_shader_noperspective_interpolation 1 +#endif /* GL_NV_shader_noperspective_interpolation */ + +#ifndef GL_NV_shader_subgroup_partitioned +#define GL_NV_shader_subgroup_partitioned 1 +#define GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV 0x00000100 +#endif /* GL_NV_shader_subgroup_partitioned */ + +#ifndef GL_NV_shader_texture_footprint +#define GL_NV_shader_texture_footprint 1 +#endif /* GL_NV_shader_texture_footprint */ + +#ifndef GL_NV_shading_rate_image +#define GL_NV_shading_rate_image 1 +#define GL_SHADING_RATE_IMAGE_NV 0x9563 +#define GL_SHADING_RATE_NO_INVOCATIONS_NV 0x9564 +#define GL_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV 0x9565 +#define GL_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV 0x9566 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV 0x9567 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV 0x9568 +#define GL_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV 0x9569 +#define GL_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV 0x956A +#define GL_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV 0x956B +#define GL_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV 0x956C +#define GL_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV 0x956D +#define GL_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV 0x956E +#define GL_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV 0x956F +#define GL_SHADING_RATE_IMAGE_BINDING_NV 0x955B +#define GL_SHADING_RATE_IMAGE_TEXEL_WIDTH_NV 0x955C +#define GL_SHADING_RATE_IMAGE_TEXEL_HEIGHT_NV 0x955D +#define GL_SHADING_RATE_IMAGE_PALETTE_SIZE_NV 0x955E +#define GL_MAX_COARSE_FRAGMENT_SAMPLES_NV 0x955F +#define GL_SHADING_RATE_SAMPLE_ORDER_DEFAULT_NV 0x95AE +#define GL_SHADING_RATE_SAMPLE_ORDER_PIXEL_MAJOR_NV 0x95AF +#define GL_SHADING_RATE_SAMPLE_ORDER_SAMPLE_MAJOR_NV 0x95B0 +typedef void (GL_APIENTRYP PFNGLBINDSHADINGRATEIMAGENVPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLGETSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint entry, GLenum *rate); +typedef void (GL_APIENTRYP PFNGLGETSHADINGRATESAMPLELOCATIONIVNVPROC) (GLenum rate, GLuint samples, GLuint index, GLint *location); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEIMAGEBARRIERNVPROC) (GLboolean synchronize); +typedef void (GL_APIENTRYP PFNGLSHADINGRATEIMAGEPALETTENVPROC) (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +typedef void (GL_APIENTRYP PFNGLSHADINGRATESAMPLEORDERNVPROC) (GLenum order); +typedef void (GL_APIENTRYP PFNGLSHADINGRATESAMPLEORDERCUSTOMNVPROC) (GLenum rate, GLuint samples, const GLint *locations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindShadingRateImageNV (GLuint texture); +GL_APICALL void GL_APIENTRY glGetShadingRateImagePaletteNV (GLuint viewport, GLuint entry, GLenum *rate); +GL_APICALL void GL_APIENTRY glGetShadingRateSampleLocationivNV (GLenum rate, GLuint samples, GLuint index, GLint *location); +GL_APICALL void GL_APIENTRY glShadingRateImageBarrierNV (GLboolean synchronize); +GL_APICALL void GL_APIENTRY glShadingRateImagePaletteNV (GLuint viewport, GLuint first, GLsizei count, const GLenum *rates); +GL_APICALL void GL_APIENTRY glShadingRateSampleOrderNV (GLenum order); +GL_APICALL void GL_APIENTRY glShadingRateSampleOrderCustomNV (GLenum rate, GLuint samples, const GLint *locations); #endif +#endif /* GL_NV_shading_rate_image */ -/* GL_NV_shadow_samplers_array */ #ifndef GL_NV_shadow_samplers_array #define GL_NV_shadow_samplers_array 1 -#endif +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif /* GL_NV_shadow_samplers_array */ -/* GL_NV_shadow_samplers_cube */ #ifndef GL_NV_shadow_samplers_cube #define GL_NV_shadow_samplers_cube 1 -#endif +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif /* GL_NV_shadow_samplers_cube */ -/* GL_NV_sRGB_formats */ -#ifndef GL_NV_sRGB_formats -#define GL_NV_sRGB_formats 1 -#endif +#ifndef GL_NV_stereo_view_rendering +#define GL_NV_stereo_view_rendering 1 +#endif /* GL_NV_stereo_view_rendering */ -/* GL_NV_texture_border_clamp */ #ifndef GL_NV_texture_border_clamp #define GL_NV_texture_border_clamp 1 -#endif +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif /* GL_NV_texture_border_clamp */ -/* GL_NV_texture_compression_s3tc_update */ #ifndef GL_NV_texture_compression_s3tc_update #define GL_NV_texture_compression_s3tc_update 1 -#endif +#endif /* GL_NV_texture_compression_s3tc_update */ -/* GL_NV_texture_npot_2D_mipmap */ #ifndef GL_NV_texture_npot_2D_mipmap #define GL_NV_texture_npot_2D_mipmap 1 +#endif /* GL_NV_texture_npot_2D_mipmap */ + +#ifndef GL_NV_timeline_semaphore +#define GL_NV_timeline_semaphore 1 +#define GL_TIMELINE_SEMAPHORE_VALUE_NV 0x9595 +#define GL_SEMAPHORE_TYPE_NV 0x95B3 +#define GL_SEMAPHORE_TYPE_BINARY_NV 0x95B4 +#define GL_SEMAPHORE_TYPE_TIMELINE_NV 0x95B5 +#define GL_MAX_TIMELINE_SEMAPHORE_VALUE_DIFFERENCE_NV 0x95B6 +typedef void (GL_APIENTRYP PFNGLCREATESEMAPHORESNVPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERIVNVPROC) (GLuint semaphore, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCreateSemaphoresNV (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glSemaphoreParameterivNV (GLuint semaphore, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterivNV (GLuint semaphore, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_timeline_semaphore */ + +#ifndef GL_NV_viewport_array +#define GL_NV_viewport_array 1 +#define GL_MAX_VIEWPORTS_NV 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data); +GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index); +#endif +#endif /* GL_NV_viewport_array */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B +typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#endif +#endif /* GL_NV_viewport_swizzle */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); #endif +#endif /* GL_OVR_multiview */ -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + +#ifndef GL_OVR_multiview_multisampled_render_to_texture +#define GL_OVR_multiview_multisampled_render_to_texture 1 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview_multisampled_render_to_texture */ + +#ifndef GL_QCOM_YUV_texture_gather +#define GL_QCOM_YUV_texture_gather 1 +#endif /* GL_QCOM_YUV_texture_gather */ -/* GL_QCOM_alpha_test */ #ifndef GL_QCOM_alpha_test #define GL_QCOM_alpha_test 1 +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); #endif -typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); -#endif +#endif /* GL_QCOM_alpha_test */ -/* GL_QCOM_binning_control */ #ifndef GL_QCOM_binning_control #define GL_QCOM_binning_control 1 -#endif +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#endif /* GL_QCOM_binning_control */ -/* GL_QCOM_driver_control */ #ifndef GL_QCOM_driver_control #define GL_QCOM_driver_control 1 +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); #endif -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -#endif +#endif /* GL_QCOM_driver_control */ -/* GL_QCOM_extended_get */ #ifndef GL_QCOM_extended_get #define GL_QCOM_extended_get 1 +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); @@ -1985,66 +3861,173 @@ GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GL GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params); #endif +#endif /* GL_QCOM_extended_get */ -/* GL_QCOM_extended_get2 */ #ifndef GL_QCOM_extended_get2 #define GL_QCOM_extended_get2 1 +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); #endif -typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif /* GL_QCOM_extended_get2 */ + +#ifndef GL_QCOM_frame_extrapolation +#define GL_QCOM_frame_extrapolation 1 +typedef void (GL_APIENTRYP PFNGLEXTRAPOLATETEX2DQCOMPROC) (GLuint src1, GLuint src2, GLuint output, GLfloat scaleFactor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtrapolateTex2DQCOM (GLuint src1, GLuint src2, GLuint output, GLfloat scaleFactor); #endif +#endif /* GL_QCOM_frame_extrapolation */ + +#ifndef GL_QCOM_framebuffer_foveated +#define GL_QCOM_framebuffer_foveated 1 +#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001 +#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#endif +#endif /* GL_QCOM_framebuffer_foveated */ + +#ifndef GL_QCOM_motion_estimation +#define GL_QCOM_motion_estimation 1 +#define GL_MOTION_ESTIMATION_SEARCH_BLOCK_X_QCOM 0x8C90 +#define GL_MOTION_ESTIMATION_SEARCH_BLOCK_Y_QCOM 0x8C91 +typedef void (GL_APIENTRYP PFNGLTEXESTIMATEMOTIONQCOMPROC) (GLuint ref, GLuint target, GLuint output); +typedef void (GL_APIENTRYP PFNGLTEXESTIMATEMOTIONREGIONSQCOMPROC) (GLuint ref, GLuint target, GLuint output, GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexEstimateMotionQCOM (GLuint ref, GLuint target, GLuint output); +GL_APICALL void GL_APIENTRY glTexEstimateMotionRegionsQCOM (GLuint ref, GLuint target, GLuint output, GLuint mask); +#endif +#endif /* GL_QCOM_motion_estimation */ -/* GL_QCOM_perfmon_global_mode */ #ifndef GL_QCOM_perfmon_global_mode #define GL_QCOM_perfmon_global_mode 1 -#endif +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif /* GL_QCOM_perfmon_global_mode */ -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_QCOM_writeonly_rendering 1 +#ifndef GL_QCOM_render_shared_exponent +#define GL_QCOM_render_shared_exponent 1 +#endif /* GL_QCOM_render_shared_exponent */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent +#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1 +#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void); +#endif +#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_rate +#define GL_QCOM_shader_framebuffer_fetch_rate 1 +#endif /* GL_QCOM_shader_framebuffer_fetch_rate */ + +#ifndef GL_QCOM_shading_rate +#define GL_QCOM_shading_rate 1 +#define GL_SHADING_RATE_QCOM 0x96A4 +#define GL_SHADING_RATE_PRESERVE_ASPECT_RATIO_QCOM 0x96A5 +#define GL_SHADING_RATE_1X1_PIXELS_QCOM 0x96A6 +#define GL_SHADING_RATE_1X2_PIXELS_QCOM 0x96A7 +#define GL_SHADING_RATE_2X1_PIXELS_QCOM 0x96A8 +#define GL_SHADING_RATE_2X2_PIXELS_QCOM 0x96A9 +#define GL_SHADING_RATE_4X2_PIXELS_QCOM 0x96AC +#define GL_SHADING_RATE_4X4_PIXELS_QCOM 0x96AE +typedef void (GL_APIENTRYP PFNGLSHADINGRATEQCOMPROC) (GLenum rate); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glShadingRateQCOM (GLenum rate); +#endif +#endif /* GL_QCOM_shading_rate */ + +#ifndef GL_QCOM_texture_foveated +#define GL_QCOM_texture_foveated 1 +#define GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB +#define GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM 0x8BFC +#define GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 0x8BFD +#define GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 0x8BFE +#define GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM 0x8BFF +typedef void (GL_APIENTRYP PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC) (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureFoveationParametersQCOM (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); #endif +#endif /* GL_QCOM_texture_foveated */ + +#ifndef GL_QCOM_texture_foveated2 +#define GL_QCOM_texture_foveated2 1 +#define GL_TEXTURE_FOVEATED_CUTOFF_DENSITY_QCOM 0x96A0 +#endif /* GL_QCOM_texture_foveated2 */ + +#ifndef GL_QCOM_texture_foveated_subsampled_layout +#define GL_QCOM_texture_foveated_subsampled_layout 1 +#define GL_FOVEATION_SUBSAMPLED_LAYOUT_METHOD_BIT_QCOM 0x00000004 +#define GL_MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM 0x8FA1 +#endif /* GL_QCOM_texture_foveated_subsampled_layout */ -/* GL_QCOM_tiled_rendering */ #ifndef GL_QCOM_tiled_rendering #define GL_QCOM_tiled_rendering 1 +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); #endif -typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); -#endif +#endif /* GL_QCOM_tiled_rendering */ -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif /* GL_QCOM_writeonly_rendering */ -/* GL_VIV_shader_binary */ #ifndef GL_VIV_shader_binary #define GL_VIV_shader_binary 1 -#endif +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif /* GL_VIV_shader_binary */ #ifdef __cplusplus } #endif -#endif /* __gl2ext_h_ */ +#endif diff --git a/meta/win/include/SDL2/SDL_opengles2_gl2platform.h b/meta/win/include/SDL2/SDL_opengles2_gl2platform.h index c325686f..426796ef 100644 --- a/meta/win/include/SDL2/SDL_opengles2_gl2platform.h +++ b/meta/win/include/SDL2/SDL_opengles2_gl2platform.h @@ -1,20 +1,17 @@ #ifndef __gl2platform_h_ #define __gl2platform_h_ -/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ - /* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ +** Copyright 2017-2020 The Khronos Group Inc. +** SPDX-License-Identifier: Apache-2.0 +*/ /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h * * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". + * Please contribute modifications back to Khronos as pull requests on the + * public github repository: + * https://github.com/KhronosGroup/OpenGL-Registry */ /*#include */ diff --git a/meta/win/include/SDL2/SDL_opengles2_khrplatform.h b/meta/win/include/SDL2/SDL_opengles2_khrplatform.h index c9e6f17d..01646449 100644 --- a/meta/win/include/SDL2/SDL_opengles2_khrplatform.h +++ b/meta/win/include/SDL2/SDL_opengles2_khrplatform.h @@ -2,7 +2,7 @@ #define __khrplatform_h_ /* -** Copyright (c) 2008-2009 The Khronos Group Inc. +** Copyright (c) 2008-2018 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -26,18 +26,16 @@ /* Khronos platform-specific types and definitions. * - * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. - * Please submit changes by sending them to the public Khronos Bugzilla - * (http://khronos.org/bugzilla) by filing a bug against product - * "Khronos (general)" component "Registry". - * - * A predefined template which fills in some of the bug fields can be - * reached using http://tinyurl.com/khrplatform-h-bugreport, but you - * must create a Bugzilla login first. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. * * * See the Implementer's Guidelines for information about where this file @@ -92,15 +90,25 @@ * int arg2) KHRONOS_APIATTRIBUTES; */ +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) #else # define KHRONOS_APICALL #endif @@ -145,6 +153,20 @@ typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 +/* + * To support platform where unsigned long cannot be used interchangeably with + * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t. + * Ideally, we could just use (u)intptr_t everywhere, but this could result in + * ABI breakage if khronos_uintptr_t is changed from unsigned long to + * unsigned long long or similar (this results in different C++ name mangling). + * To avoid changes for existing platforms, we restrict usage of intptr_t to + * platforms where the size of a pointer is larger than the size of long. + */ +#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__) +#if __SIZEOF_POINTER__ > __SIZEOF_LONG__ +#define KHRONOS_USE_INTPTR_T +#endif +#endif #elif defined(__VMS ) || defined(__sgi) @@ -223,18 +245,25 @@ typedef signed short int khronos_int16_t; typedef unsigned short int khronos_uint16_t; /* - * Types that differ between LLP64 and LP64 architectures - in LLP64, + * Types that differ between LLP64 and LP64 architectures - in LLP64, * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ -#ifdef _WIN64 +#ifdef KHRONOS_USE_INTPTR_T +typedef intptr_t khronos_intptr_t; +typedef uintptr_t khronos_uintptr_t; +#elif defined(_WIN64) typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; -typedef signed long long int khronos_ssize_t; -typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; +#endif + +#if defined(_WIN64) +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif diff --git a/meta/win/include/SDL2/SDL_pixels.h b/meta/win/include/SDL2/SDL_pixels.h index 5d2c0c89..44757cdc 100644 --- a/meta/win/include/SDL2/SDL_pixels.h +++ b/meta/win/include/SDL2/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,10 @@ typedef enum SDL_PIXELTYPE_ARRAYU16, SDL_PIXELTYPE_ARRAYU32, SDL_PIXELTYPE_ARRAYF16, - SDL_PIXELTYPE_ARRAYF32 + SDL_PIXELTYPE_ARRAYF32, + + /* This must be at the end of the list to avoid breaking the existing ABI */ + SDL_PIXELTYPE_INDEX2 } SDL_PixelType; /** Bitmap pixel order, high bit -> low bit. */ @@ -134,6 +137,7 @@ typedef enum #define SDL_ISPIXELFORMAT_INDEXED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) @@ -177,6 +181,12 @@ typedef enum SDL_PIXELFORMAT_INDEX1MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0), + SDL_PIXELFORMAT_INDEX2LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0, + 2, 0), + SDL_PIXELFORMAT_INDEX2MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0, + 2, 0), SDL_PIXELFORMAT_INDEX4LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0), @@ -276,11 +286,19 @@ typedef enum SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888, + SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888, + SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888, #else SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888, + SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888, + SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888, #endif SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ diff --git a/meta/win/include/SDL2/SDL_platform.h b/meta/win/include/SDL2/SDL_platform.h index f1f6f8b0..6e67b457 100644 --- a/meta/win/include/SDL2/SDL_platform.h +++ b/meta/win/include/SDL2/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -166,6 +166,12 @@ #define WINAPI_FAMILY_WINRT 0 #endif /* HAVE_WINAPIFAMILY_H */ +#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) +#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#else +#define SDL_WINAPI_FAMILY_PHONE 0 +#endif + #if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 @@ -221,6 +227,11 @@ #define __VITA__ 1 #endif +#if defined(__3DS__) +#undef __3DS__ +#define __3DS__ 1 +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus diff --git a/meta/win/include/SDL2/SDL_power.h b/meta/win/include/SDL2/SDL_power.h index ecb3f4b0..0520065c 100644 --- a/meta/win/include/SDL2/SDL_power.h +++ b/meta/win/include/SDL2/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,7 +48,6 @@ typedef enum SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ } SDL_PowerState; - /** * Get the current power supply details. * @@ -65,17 +64,17 @@ typedef enum * It's possible a platform can only report battery percentage or time left * but not both. * - * \param secs seconds of battery life left, you can pass a NULL here if you - * don't care, will return -1 if we can't determine a value, or - * we're not running on a battery - * \param pct percentage of battery life left, between 0 and 100, you can pass - * a NULL here if you don't care, will return -1 if we can't - * determine a value, or we're not running on a battery + * \param seconds seconds of battery life left, you can pass a NULL here if + * you don't care, will return -1 if we can't determine a + * value, or we're not running on a battery + * \param percent percentage of battery life left, between 0 and 100, you can + * pass a NULL here if you don't care, will return -1 if we + * can't determine a value, or we're not running on a battery * \returns an SDL_PowerState enum representing the current battery state. * * \since This function is available since SDL 2.0.0. */ -extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); +extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *seconds, int *percent); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/meta/win/include/SDL2/SDL_quit.h b/meta/win/include/SDL2/SDL_quit.h index 4090f7f1..3f69dc9f 100644 --- a/meta/win/include/SDL2/SDL_quit.h +++ b/meta/win/include/SDL2/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_rect.h b/meta/win/include/SDL2/SDL_rect.h index 6c641c58..5ce1f0b4 100644 --- a/meta/win/include/SDL2/SDL_rect.h +++ b/meta/win/include/SDL2/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_render.h b/meta/win/include/SDL2/SDL_render.h index 30ef3d63..b7135bb9 100644 --- a/meta/win/include/SDL2/SDL_render.h +++ b/meta/win/include/SDL2/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ * of the many good 3D engines. * * These functions must be called from the main thread. - * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 + * See this bug for details: https://github.com/libsdl-org/SDL/issues/986 */ #ifndef SDL_render_h_ @@ -1731,6 +1731,11 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, * * \param renderer the rendering context * + * \threadsafety You may only call this function on the main thread. If this + * happens to work on a background thread on any given platform + * or backend, it's purely by luck and you should not rely on it + * to work next time. + * * \since This function is available since SDL 2.0.0. * * \sa SDL_RenderClear @@ -1765,6 +1770,9 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); /** * Destroy the rendering context for a window and free associated textures. * + * If `renderer` is NULL, this function will return immediately after setting + * the SDL error message to "Invalid renderer". See SDL_GetError(). + * * \param renderer the rendering context * * \since This function is available since SDL 2.0.0. @@ -1882,7 +1890,7 @@ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give * SDL a drawable to render to, which might happen if the window is * hidden/minimized/offscreen. This doesn't apply to command encoders for - * render targets, just the window's backbacker. Check your return values! + * render targets, just the window's backbuffer. Check your return values! * * \param renderer The renderer to query * \returns an `id` on success, or NULL if the diff --git a/meta/win/include/SDL2/SDL_revision.h b/meta/win/include/SDL2/SDL_revision.h index f285b72b..30d7e9b4 100644 --- a/meta/win/include/SDL2/SDL_revision.h +++ b/meta/win/include/SDL2/SDL_revision.h @@ -1,2 +1,7 @@ -#define SDL_REVISION "https://github.com/libsdl-org/SDL.git@8c9beb0c873f6ca5efbd88f1ad2648bfc793b2ac" +/* Generated by updaterev.sh, do not edit */ +#ifdef SDL_VENDOR_INFO +#define SDL_REVISION "SDL-release-2.30.1-0-g5adbf3765 (" SDL_VENDOR_INFO ")" +#else +#define SDL_REVISION "SDL-release-2.30.1-0-g5adbf3765" +#endif #define SDL_REVISION_NUMBER 0 diff --git a/meta/win/include/SDL2/SDL_revision.h.cmake b/meta/win/include/SDL2/SDL_revision.h.cmake deleted file mode 100644 index b27ec11b..00000000 --- a/meta/win/include/SDL2/SDL_revision.h.cmake +++ /dev/null @@ -1,6 +0,0 @@ -#cmakedefine SDL_REVISION "@SDL_REVISION@" -#define SDL_REVISION_NUMBER 0 - -#ifndef SDL_REVISION -#define SDL_REVISION "" -#endif diff --git a/meta/win/include/SDL2/SDL_rwops.h b/meta/win/include/SDL2/SDL_rwops.h index 3960f567..9dd99f92 100644 --- a/meta/win/include/SDL2/SDL_rwops.h +++ b/meta/win/include/SDL2/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_scancode.h b/meta/win/include/SDL2/SDL_scancode.h index aaa782f8..fe13d5b7 100644 --- a/meta/win/include/SDL2/SDL_scancode.h +++ b/meta/win/include/SDL2/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -225,16 +225,16 @@ typedef enum SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116, - SDL_SCANCODE_HELP = 117, - SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */ + SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */ SDL_SCANCODE_SELECT = 119, - SDL_SCANCODE_STOP = 120, - SDL_SCANCODE_AGAIN = 121, /**< redo */ - SDL_SCANCODE_UNDO = 122, - SDL_SCANCODE_CUT = 123, - SDL_SCANCODE_COPY = 124, - SDL_SCANCODE_PASTE = 125, - SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_STOP = 120, /**< AC Stop */ + SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */ + SDL_SCANCODE_UNDO = 122, /**< AC Undo */ + SDL_SCANCODE_CUT = 123, /**< AC Cut */ + SDL_SCANCODE_COPY = 124, /**< AC Copy */ + SDL_SCANCODE_PASTE = 125, /**< AC Paste */ + SDL_SCANCODE_FIND = 126, /**< AC Find */ SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128, SDL_SCANCODE_VOLUMEDOWN = 129, @@ -265,9 +265,9 @@ typedef enum SDL_SCANCODE_LANG8 = 151, /**< reserved */ SDL_SCANCODE_LANG9 = 152, /**< reserved */ - SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ SDL_SCANCODE_SYSREQ = 154, - SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */ SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158, @@ -345,6 +345,11 @@ typedef enum * \name Usage page 0x0C * * These values are mapped from usage page 0x0C (USB consumer page). + * See https://usb.org/sites/default/files/hut1_2.pdf + * + * There are way more keys in the spec than we can represent in the + * current scancode range, so pick the ones that commonly come up in + * real world usage. */ /* @{ */ @@ -354,17 +359,17 @@ typedef enum SDL_SCANCODE_AUDIOPLAY = 261, SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263, - SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */ SDL_SCANCODE_MAIL = 265, - SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */ SDL_SCANCODE_COMPUTER = 267, - SDL_SCANCODE_AC_SEARCH = 268, - SDL_SCANCODE_AC_HOME = 269, - SDL_SCANCODE_AC_BACK = 270, - SDL_SCANCODE_AC_FORWARD = 271, - SDL_SCANCODE_AC_STOP = 272, - SDL_SCANCODE_AC_REFRESH = 273, - SDL_SCANCODE_AC_BOOKMARKS = 274, + SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */ + SDL_SCANCODE_AC_HOME = 269, /**< AC Home */ + SDL_SCANCODE_AC_BACK = 270, /**< AC Back */ + SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */ + SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */ + SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */ + SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */ /* @} *//* Usage page 0x0C */ @@ -383,7 +388,7 @@ typedef enum SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, - SDL_SCANCODE_SLEEP = 282, + SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */ SDL_SCANCODE_APP1 = 283, SDL_SCANCODE_APP2 = 284, diff --git a/meta/win/include/SDL2/SDL_sensor.h b/meta/win/include/SDL2/SDL_sensor.h index a2f30e0f..8b89ef6a 100644 --- a/meta/win/include/SDL2/SDL_sensor.h +++ b/meta/win/include/SDL2/SDL_sensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,7 +71,11 @@ typedef enum SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ SDL_SENSOR_ACCEL, /**< Accelerometer */ - SDL_SENSOR_GYRO /**< Gyroscope */ + SDL_SENSOR_GYRO, /**< Gyroscope */ + SDL_SENSOR_ACCEL_L, /**< Accelerometer for left Joy-Con controller and Wii nunchuk */ + SDL_SENSOR_GYRO_L, /**< Gyroscope for left Joy-Con controller */ + SDL_SENSOR_ACCEL_R, /**< Accelerometer for right Joy-Con controller */ + SDL_SENSOR_GYRO_R /**< Gyroscope for right Joy-Con controller */ } SDL_SensorType; /** @@ -80,7 +84,7 @@ typedef enum * The accelerometer returns the current acceleration in SI meters per * second squared. This measurement includes the force of gravity, so * a device at rest will have an value of SDL_STANDARD_GRAVITY away - * from the center of the earth. + * from the center of the earth, which is a positive Y value. * * values[0]: Acceleration on the x axis * values[1]: Acceleration on the y axis @@ -263,7 +267,24 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor) * * \since This function is available since SDL 2.0.9. */ -extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values); + +/** + * Get the current state of an opened sensor with the timestamp of the last + * update. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The SDL_Sensor object to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \returns 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values); /** * Close a sensor previously opened with SDL_SensorOpen(). @@ -272,7 +293,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, * * \since This function is available since SDL 2.0.9. */ -extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor); /** * Update the current state of the open sensors. diff --git a/meta/win/include/SDL2/SDL_shape.h b/meta/win/include/SDL2/SDL_shape.h index 1bca9270..4783cf29 100644 --- a/meta/win/include/SDL2/SDL_shape.h +++ b/meta/win/include/SDL2/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_stdinc.h b/meta/win/include/SDL2/SDL_stdinc.h index 5f79c95b..0035a357 100644 --- a/meta/win/include/SDL2/SDL_stdinc.h +++ b/meta/win/include/SDL2/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,12 +30,6 @@ #include "SDL_config.h" -#ifdef __APPLE__ -#ifndef _DARWIN_C_SOURCE -#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */ -#endif -#endif - #ifdef HAVE_SYS_TYPES_H #include #endif @@ -80,12 +74,14 @@ # include #endif #ifdef HAVE_MATH_H -# if defined(__WINRT__) +# if defined(_MSC_VER) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on - WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx + Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. */ -# define _USE_MATH_DEFINES +# ifndef _USE_MATH_DEFINES +# define _USE_MATH_DEFINES +# endif # endif # include #endif @@ -261,7 +257,7 @@ typedef uint64_t Uint64; #define SDL_PRIs64 PRIs64 #elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIs64 "I64d" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIs64 "ld" #else #define SDL_PRIs64 "lld" @@ -272,7 +268,7 @@ typedef uint64_t Uint64; #define SDL_PRIu64 PRIu64 #elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIu64 "I64u" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIu64 "lu" #else #define SDL_PRIu64 "llu" @@ -283,7 +279,7 @@ typedef uint64_t Uint64; #define SDL_PRIx64 PRIx64 #elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIx64 "I64x" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIx64 "lx" #else #define SDL_PRIx64 "llx" @@ -294,7 +290,7 @@ typedef uint64_t Uint64; #define SDL_PRIX64 PRIX64 #elif defined(__WIN32__) || defined(__GDK__) #define SDL_PRIX64 "I64X" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIX64 "lX" #else #define SDL_PRIX64 "llX" @@ -340,7 +336,9 @@ typedef uint64_t Uint64; #define SDL_PRINTF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) #else #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #include @@ -366,10 +364,14 @@ typedef uint64_t Uint64; #endif #if defined(__GNUC__) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __printf__, fmtargnumber, 0 ))) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 ))) #else #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ @@ -410,7 +412,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS -#if !defined(__ANDROID__) && !defined(__VITA__) +#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { @@ -528,9 +530,7 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) { -#ifdef __APPLE__ - memset_pattern4(dst, &val, dwords * 4); -#elif defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && defined(__i386__) int u0, u1, u2; __asm__ __volatile__ ( "cld \n\t" @@ -583,6 +583,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes); @@ -608,11 +609,11 @@ extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); -extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2); extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3); -extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); #ifndef HAVE_M_PI #ifndef M_PI @@ -693,8 +694,8 @@ extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * outbytesleft); /** - * This function converts a string between encodings in one pass, returning a - * string that must be freed with SDL_free() or NULL on error. + * This function converts a buffer or string between encodings in one pass, + * returning a string that must be freed with SDL_free() or NULL on error. * * \since This function is available since SDL 2.0.0. */ @@ -703,8 +704,8 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *inbuf, size_t inbytesleft); #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t)) /* force builds using Clang's static analysis tools to use literal C runtime @@ -721,6 +722,20 @@ size_t strlcpy(char* dst, const char* src, size_t size); size_t strlcat(char* dst, const char* src, size_t size); #endif +#ifndef HAVE_WCSLCPY +size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size); +#endif + +#ifndef HAVE_WCSLCAT +size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); +#endif + +/* Starting LLVM 16, the analyser errors out if these functions do not have + their prototype defined (clang-diagnostic-implicit-function-declaration) */ +#include +#include +#include + #define SDL_malloc malloc #define SDL_calloc calloc #define SDL_realloc realloc diff --git a/meta/win/include/SDL2/SDL_surface.h b/meta/win/include/SDL2/SDL_surface.h index 838de654..ceeb86bd 100644 --- a/meta/win/include/SDL2/SDL_surface.h +++ b/meta/win/include/SDL2/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_system.h b/meta/win/include/SDL2/SDL_system.h index 0edca635..ddae4f8c 100644 --- a/meta/win/include/SDL2/SDL_system.h +++ b/meta/win/include/SDL2/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -593,7 +593,8 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void /* Functions used only by GDK */ #if defined(__GDK__) -typedef struct XTaskQueueObject * XTaskQueueHandle; +typedef struct XTaskQueueObject *XTaskQueueHandle; +typedef struct XUser *XUserHandle; /** * Gets a reference to the global async task queue handle for GDK, @@ -610,6 +611,20 @@ typedef struct XTaskQueueObject * XTaskQueueHandle; */ extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue); +/** + * Gets a reference to the default user handle for GDK. + * + * This is effectively a synchronous version of XUserAddAsync, which always + * prefers the default user and allows a sign-in UI. + * + * \param outUserHandle a pointer to be filled in with the default user + * handle. + * \returns 0 if success, -1 if any error occurs. + * + * \since This function is available since SDL 2.28.0. + */ +extern DECLSPEC int SDLCALL SDL_GDKGetDefaultUser(XUserHandle * outUserHandle); + #endif /* Ends C function definitions when using C++ */ diff --git a/meta/win/include/SDL2/SDL_syswm.h b/meta/win/include/SDL2/SDL_syswm.h index 45f8e754..7b8bd6ef 100644 --- a/meta/win/include/SDL2/SDL_syswm.h +++ b/meta/win/include/SDL2/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test.h b/meta/win/include/SDL2/SDL_test.h index 8cc9d616..e5acbee4 100644 --- a/meta/win/include/SDL2/SDL_test.h +++ b/meta/win/include/SDL2/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_assert.h b/meta/win/include/SDL2/SDL_test_assert.h index 73423052..4f983350 100644 --- a/meta/win/include/SDL2/SDL_test_assert.h +++ b/meta/win/include/SDL2/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_common.h b/meta/win/include/SDL2/SDL_test_common.h index b86520d3..d977e463 100644 --- a/meta/win/include/SDL2/SDL_test_common.h +++ b/meta/win/include/SDL2/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_compare.h b/meta/win/include/SDL2/SDL_test_compare.h index 8a7a0700..61a38d09 100644 --- a/meta/win/include/SDL2/SDL_test_compare.h +++ b/meta/win/include/SDL2/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_crc32.h b/meta/win/include/SDL2/SDL_test_crc32.h index 049da740..e3478318 100644 --- a/meta/win/include/SDL2/SDL_test_crc32.h +++ b/meta/win/include/SDL2/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_font.h b/meta/win/include/SDL2/SDL_test_font.h index 6e7247dd..620c8211 100644 --- a/meta/win/include/SDL2/SDL_test_font.h +++ b/meta/win/include/SDL2/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_fuzzer.h b/meta/win/include/SDL2/SDL_test_fuzzer.h index bbe8eb87..a847ccb0 100644 --- a/meta/win/include/SDL2/SDL_test_fuzzer.h +++ b/meta/win/include/SDL2/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_harness.h b/meta/win/include/SDL2/SDL_test_harness.h index 1fd4236b..bd9e4f8d 100644 --- a/meta/win/include/SDL2/SDL_test_harness.h +++ b/meta/win/include/SDL2/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_images.h b/meta/win/include/SDL2/SDL_test_images.h index e2bfc360..b5bcb0a0 100644 --- a/meta/win/include/SDL2/SDL_test_images.h +++ b/meta/win/include/SDL2/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_log.h b/meta/win/include/SDL2/SDL_test_log.h index e3d39ad2..ea9ae5e1 100644 --- a/meta/win/include/SDL2/SDL_test_log.h +++ b/meta/win/include/SDL2/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_md5.h b/meta/win/include/SDL2/SDL_test_md5.h index 17b1d2be..3764b042 100644 --- a/meta/win/include/SDL2/SDL_test_md5.h +++ b/meta/win/include/SDL2/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_memory.h b/meta/win/include/SDL2/SDL_test_memory.h index cc2edc1b..9bd14325 100644 --- a/meta/win/include/SDL2/SDL_test_memory.h +++ b/meta/win/include/SDL2/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_test_random.h b/meta/win/include/SDL2/SDL_test_random.h index b1d6060c..344646aa 100644 --- a/meta/win/include/SDL2/SDL_test_random.h +++ b/meta/win/include/SDL2/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_thread.h b/meta/win/include/SDL2/SDL_thread.h index 7364f813..dc7f5363 100644 --- a/meta/win/include/SDL2/SDL_thread.h +++ b/meta/win/include/SDL2/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ #include "SDL_atomic.h" #include "SDL_mutex.h" -#if defined(__WIN32__) || defined(__GDK__) +#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__) #include /* _beginthreadex() and _endthreadex() */ #endif #if defined(__OS2__) /* for _beginthread() and _endthread() */ @@ -88,7 +88,7 @@ typedef enum { typedef int (SDLCALL * SDL_ThreadFunction) (void *data); -#if defined(__WIN32__) || defined(__GDK__) +#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__) /** * \file SDL_thread.h * @@ -142,7 +142,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) #endif #elif defined(__OS2__) @@ -175,7 +175,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) #undef SDL_CreateThreadWithStackSize -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) diff --git a/meta/win/include/SDL2/SDL_timer.h b/meta/win/include/SDL2/SDL_timer.h index 62f81d42..8123e432 100644 --- a/meta/win/include/SDL2/SDL_timer.h +++ b/meta/win/include/SDL2/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_touch.h b/meta/win/include/SDL2/SDL_touch.h index 95924135..f6a5db41 100644 --- a/meta/win/include/SDL2/SDL_touch.h +++ b/meta/win/include/SDL2/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_types.h b/meta/win/include/SDL2/SDL_types.h index 355fb501..e8d33c65 100644 --- a/meta/win/include/SDL2/SDL_types.h +++ b/meta/win/include/SDL2/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/meta/win/include/SDL2/SDL_version.h b/meta/win/include/SDL2/SDL_version.h index fbe09db8..6b66df90 100644 --- a/meta/win/include/SDL2/SDL_version.h +++ b/meta/win/include/SDL2/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,8 +58,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 24 -#define SDL_PATCHLEVEL 0 +#define SDL_MINOR_VERSION 30 +#define SDL_PATCHLEVEL 1 /** * Macro to determine SDL version program was compiled against. diff --git a/meta/win/include/SDL2/SDL_video.h b/meta/win/include/SDL2/SDL_video.h index 0b1065db..fa47d309 100644 --- a/meta/win/include/SDL2/SDL_video.h +++ b/meta/win/include/SDL2/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -187,7 +187,8 @@ typedef enum SDL_DISPLAYEVENT_NONE, /**< Never used */ SDL_DISPLAYEVENT_ORIENTATION, /**< Display orientation has changed to data1 */ SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */ - SDL_DISPLAYEVENT_DISCONNECTED /**< Display has been removed from the system */ + SDL_DISPLAYEVENT_DISCONNECTED, /**< Display has been removed from the system */ + SDL_DISPLAYEVENT_MOVED /**< Display has changed position */ } SDL_DisplayEventID; /** @@ -1046,6 +1047,27 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right); +/** + * Get the size of a window in pixels. + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a + * platform with high-DPI support (Apple calls this "Retina"), and not + * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. + * + * \param window the window from which the drawable size should be queried + * \param w a pointer to variable for storing the width in pixels, may be NULL + * \param h a pointer to variable for storing the height in pixels, may be + * NULL + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_CreateWindow + * \sa SDL_GetWindowSize + */ +extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, + int *w, int *h); + /** * Set the minimum size of a window's client area. * @@ -1253,6 +1275,18 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags); +/** + * Return whether the window has a surface associated with it. + * + * \returns SDL_TRUE if there is a surface associated with the window, or + * SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasWindowSurface(SDL_Window *window); + /** * Get the SDL surface associated with the window. * @@ -1273,6 +1307,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, * * \since This function is available since SDL 2.0.0. * + * \sa SDL_DestroyWindowSurface + * \sa SDL_HasWindowSurface * \sa SDL_UpdateWindowSurface * \sa SDL_UpdateWindowSurfaceRects */ @@ -1305,9 +1341,14 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * * This function is equivalent to the SDL 1.2 API SDL_UpdateRects(). * + * Note that this function will update _at least_ the rectangles specified, + * but this is only intended as an optimization; in practice, this might + * update more of the screen (or all of the screen!), depending on what + * method SDL uses to send pixels to the system. + * * \param window the window to update * \param rects an array of SDL_Rect structures representing areas of the - * surface to copy + * surface to copy, in pixels * \param numrects the number of rectangles * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. @@ -1321,6 +1362,20 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, int numrects); +/** + * Destroy the surface associated with the window. + * + * \param window the window to update + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + * \sa SDL_HasWindowSurface + */ +extern DECLSPEC int SDLCALL SDL_DestroyWindowSurface(SDL_Window *window); + /** * Set a window's input grab mode. * @@ -1790,6 +1845,9 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); * If you disable the screensaver, it is automatically re-enabled when SDL * quits. * + * The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2 + * the screensaver was enabled by default. + * * \since This function is available since SDL 2.0.0. * * \sa SDL_EnableScreenSaver diff --git a/meta/win/include/SDL2/begin_code.h b/meta/win/include/SDL2/begin_code.h index b3e69e85..a47a7d2b 100644 --- a/meta/win/include/SDL2/begin_code.h +++ b/meta/win/include/SDL2/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,14 +28,16 @@ */ /* This shouldn't be nested -- included it around code only. */ -#ifdef _begin_code_h +#ifdef SDL_begin_code_h #error Nested inclusion of begin_code.h #endif -#define _begin_code_h +#define SDL_begin_code_h #ifndef SDL_DEPRECATED # if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) +# elif defined(_MSC_VER) +# define SDL_DEPRECATED __declspec(deprecated) # else # define SDL_DEPRECATED # endif @@ -171,17 +173,17 @@ #define SDL_FALLTHROUGH [[fallthrough]] #else #if defined(__has_attribute) -#define _HAS_FALLTHROUGH __has_attribute(__fallthrough__) +#define SDL_HAS_FALLTHROUGH __has_attribute(__fallthrough__) #else -#define _HAS_FALLTHROUGH 0 +#define SDL_HAS_FALLTHROUGH 0 #endif /* __has_attribute */ -#if _HAS_FALLTHROUGH && \ +#if SDL_HAS_FALLTHROUGH && \ ((defined(__GNUC__) && __GNUC__ >= 7) || \ (defined(__clang_major__) && __clang_major__ >= 10)) #define SDL_FALLTHROUGH __attribute__((__fallthrough__)) #else #define SDL_FALLTHROUGH do {} while (0) /* fallthrough */ -#endif /* _HAS_FALLTHROUGH */ -#undef _HAS_FALLTHROUGH +#endif /* SDL_HAS_FALLTHROUGH */ +#undef SDL_HAS_FALLTHROUGH #endif /* C++17 or C2x */ #endif /* SDL_FALLTHROUGH not defined */ diff --git a/meta/win/include/SDL2/close_code.h b/meta/win/include/SDL2/close_code.h index dc73432f..50a0e6f3 100644 --- a/meta/win/include/SDL2/close_code.h +++ b/meta/win/include/SDL2/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,10 +26,10 @@ * after you finish any function and structure declarations in your headers */ -#ifndef _begin_code_h +#ifndef SDL_begin_code_h #error close_code.h included without matching begin_code.h #endif -#undef _begin_code_h +#undef SDL_begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) diff --git a/meta/win/lib/SDL2.lib b/meta/win/lib/SDL2.lib deleted file mode 100644 index b2868855..00000000 Binary files a/meta/win/lib/SDL2.lib and /dev/null differ diff --git a/meta/win/lib/glew32s.lib b/meta/win/lib/glew32s.lib deleted file mode 100644 index 2e46b7bf..00000000 Binary files a/meta/win/lib/glew32s.lib and /dev/null differ diff --git a/meta/win/lib/msvc/x64/SDL2.lib b/meta/win/lib/msvc/x64/SDL2.lib new file mode 100644 index 00000000..7257de63 Binary files /dev/null and b/meta/win/lib/msvc/x64/SDL2.lib differ diff --git a/meta/win/lib/msvc/x64/glew32s.lib b/meta/win/lib/msvc/x64/glew32s.lib new file mode 100644 index 00000000..1130f846 Binary files /dev/null and b/meta/win/lib/msvc/x64/glew32s.lib differ diff --git a/meta/win/lib/msvc/x86/SDL2.lib b/meta/win/lib/msvc/x86/SDL2.lib new file mode 100644 index 00000000..0ac84d29 Binary files /dev/null and b/meta/win/lib/msvc/x86/SDL2.lib differ diff --git a/meta/win/lib/SDL2main.lib b/meta/win/lib/msvc/x86/SDL2main.lib similarity index 100% rename from meta/win/lib/SDL2main.lib rename to meta/win/lib/msvc/x86/SDL2main.lib diff --git a/meta/win/lib/avcodec.lib b/meta/win/lib/msvc/x86/avcodec.lib similarity index 100% rename from meta/win/lib/avcodec.lib rename to meta/win/lib/msvc/x86/avcodec.lib diff --git a/meta/win/lib/avformat.lib b/meta/win/lib/msvc/x86/avformat.lib similarity index 100% rename from meta/win/lib/avformat.lib rename to meta/win/lib/msvc/x86/avformat.lib diff --git a/meta/win/lib/avutil.lib b/meta/win/lib/msvc/x86/avutil.lib similarity index 100% rename from meta/win/lib/avutil.lib rename to meta/win/lib/msvc/x86/avutil.lib diff --git a/meta/win/lib/freetype.lib b/meta/win/lib/msvc/x86/freetype.lib similarity index 100% rename from meta/win/lib/freetype.lib rename to meta/win/lib/msvc/x86/freetype.lib diff --git a/meta/win/lib/msvc/x86/glew32s.lib b/meta/win/lib/msvc/x86/glew32s.lib new file mode 100644 index 00000000..645cb4b6 Binary files /dev/null and b/meta/win/lib/msvc/x86/glew32s.lib differ diff --git a/meta/win/lib/libcurl.lib b/meta/win/lib/msvc/x86/libcurl.lib similarity index 100% rename from meta/win/lib/libcurl.lib rename to meta/win/lib/msvc/x86/libcurl.lib diff --git a/meta/win/lib/libcurl_a.lib b/meta/win/lib/msvc/x86/libcurl_a.lib similarity index 100% rename from meta/win/lib/libcurl_a.lib rename to meta/win/lib/msvc/x86/libcurl_a.lib diff --git a/meta/win/lib/libcurl_a_debug.lib b/meta/win/lib/msvc/x86/libcurl_a_debug.lib similarity index 100% rename from meta/win/lib/libcurl_a_debug.lib rename to meta/win/lib/msvc/x86/libcurl_a_debug.lib diff --git a/meta/win/lib/libjpeg.lib b/meta/win/lib/msvc/x86/libjpeg.lib similarity index 100% rename from meta/win/lib/libjpeg.lib rename to meta/win/lib/msvc/x86/libjpeg.lib diff --git a/meta/win/lib/libogg_static.lib b/meta/win/lib/msvc/x86/libogg_static.lib similarity index 100% rename from meta/win/lib/libogg_static.lib rename to meta/win/lib/msvc/x86/libogg_static.lib diff --git a/meta/win/lib/libpng16.lib b/meta/win/lib/msvc/x86/libpng16.lib similarity index 100% rename from meta/win/lib/libpng16.lib rename to meta/win/lib/msvc/x86/libpng16.lib diff --git a/meta/win/lib/libvorbis_static.lib b/meta/win/lib/msvc/x86/libvorbis_static.lib similarity index 100% rename from meta/win/lib/libvorbis_static.lib rename to meta/win/lib/msvc/x86/libvorbis_static.lib diff --git a/meta/win/lib/libvorbisfile_static.lib b/meta/win/lib/msvc/x86/libvorbisfile_static.lib similarity index 100% rename from meta/win/lib/libvorbisfile_static.lib rename to meta/win/lib/msvc/x86/libvorbisfile_static.lib diff --git a/meta/win/lib/swresample.lib b/meta/win/lib/msvc/x86/swresample.lib similarity index 100% rename from meta/win/lib/swresample.lib rename to meta/win/lib/msvc/x86/swresample.lib diff --git a/meta/win/lib/swscale.lib b/meta/win/lib/msvc/x86/swscale.lib similarity index 100% rename from meta/win/lib/swscale.lib rename to meta/win/lib/msvc/x86/swscale.lib diff --git a/meta/win/lib/zlib.lib b/meta/win/lib/msvc/x86/zlib.lib similarity index 100% rename from meta/win/lib/zlib.lib rename to meta/win/lib/msvc/x86/zlib.lib diff --git a/meta/win/lib/zlibstat.lib b/meta/win/lib/msvc/x86/zlibstat.lib similarity index 100% rename from meta/win/lib/zlibstat.lib rename to meta/win/lib/msvc/x86/zlibstat.lib diff --git a/source/Engine/Application.cpp b/source/Engine/Application.cpp index 408e4072..d1649ea0 100644 --- a/source/Engine/Application.cpp +++ b/source/Engine/Application.cpp @@ -15,7 +15,6 @@ class Application { static char SettingsFile[4096]; static XMLNode* GameConfig; - static XMLNode* SceneConfig; static float FPS; static bool Running; @@ -62,6 +61,7 @@ class Application { #include #include #include +#include #include #include #include @@ -76,6 +76,10 @@ extern "C" { #endif #ifdef MSYS + #if !defined(_CRT_SECURE_NO_WARNINGS) + #define _CRT_SECURE_NO_WARNINGS + #endif + #include #endif @@ -103,7 +107,6 @@ INI* Application::Settings = NULL; char Application::SettingsFile[4096]; XMLNode* Application::GameConfig = NULL; -XMLNode* Application::SceneConfig = NULL; float Application::FPS = 60.f; int TargetFPS = 60; @@ -171,7 +174,12 @@ PUBLIC STATIC void Application::Init(int argc, char* args[]) { Application::MakeEngineVersion(); Log::Init(); + +#ifdef GIT_COMMIT_HASH + Log::Print(Log::LOG_INFO, "Hatch Game Engine %s (commit " GIT_COMMIT_HASH ")", Application::EngineVersion); +#else Log::Print(Log::LOG_INFO, "Hatch Game Engine %s", Application::EngineVersion); +#endif MemoryPools::Init(); @@ -335,7 +343,6 @@ PUBLIC STATIC void Application::GetPerformanceSnapshot() { MetricUpdateTime, MetricClearTime, MetricRenderTime, - // MetricFPSCounterTime, MetricPresentTime, 0.0, MetricFrameTime, @@ -348,7 +355,6 @@ PUBLIC STATIC void Application::GetPerformanceSnapshot() { "Entity Update: %8.3f ms", "Clear Time: %8.3f ms", "World Render Commands: %8.3f ms", - // "FPS Counter Time: %8.3f ms", "Frame Present Time: %8.3f ms", "==================================", "Frame Total Time: %8.3f ms", @@ -357,14 +363,18 @@ PUBLIC STATIC void Application::GetPerformanceSnapshot() { ListList.clear(); Scene::ObjectLists->WithAll([](Uint32, ObjectList* list) -> void { - if ((list->AverageUpdateTime > 0.0 && list->AverageUpdateItemCount > 0) || - (list->AverageRenderTime > 0.0 && list->AverageRenderItemCount > 0)) + if ((list->Performance.Update.AverageTime > 0.0 && list->Performance.Update.AverageItemCount > 0) || + (list->Performance.Render.AverageTime > 0.0 && list->Performance.Render.AverageItemCount > 0)) ListList.push_back(list); }); std::sort(ListList.begin(), ListList.end(), [](ObjectList* a, ObjectList* b) -> bool { + ObjectListPerformanceStats& updatePerfA = a->Performance.Update; + ObjectListPerformanceStats& updatePerfB = b->Performance.Update; + ObjectListPerformanceStats& renderPerfA = a->Performance.Render; + ObjectListPerformanceStats& renderPerfB = b->Performance.Render; return - a->AverageUpdateTime * a->AverageUpdateItemCount + a->AverageRenderTime * a->AverageRenderItemCount > - b->AverageUpdateTime * b->AverageUpdateItemCount + b->AverageRenderTime * b->AverageRenderItemCount; + updatePerfA.AverageTime * updatePerfA.AverageItemCount + renderPerfA.AverageTime * renderPerfA.AverageItemCount > + updatePerfB.AverageTime * updatePerfB.AverageItemCount + renderPerfB.AverageTime * renderPerfB.AverageItemCount; }); Log::Print(Log::LOG_IMPORTANT, "General Performance Snapshot:"); @@ -407,15 +417,6 @@ PUBLIC STATIC void Application::GetPerformanceSnapshot() { Scene::PERF_ViewRender[i].RenderFinishTime, Scene::PERF_ViewRender[i].RenderTime); } - // double RenderSetupTime; - // bool RecreatedDrawTarget; - // double ProjectionSetupTime; - // double ObjectRenderEarlyTime; - // double ObjectRenderTime; - // double ObjectRenderLateTime; - // double LayerTileRenderTime[32]; // MAX_LAYERS - // double RenderFinishTime; - // double RenderTime; } // Object Performance Snapshot @@ -426,20 +427,21 @@ PUBLIC STATIC void Application::GetPerformanceSnapshot() { Log::Print(Log::LOG_IMPORTANT, "Object Performance Snapshot:"); for (size_t i = 0; i < ListList.size(); i++) { ObjectList* list = ListList[i]; + ObjectListPerformance& perf = list->Performance; Log::Print(Log::LOG_INFO, "Object \"%s\":\n" " - Avg Update Early %6.1f mcs (Total %6.1f mcs, Count %d)\n" " - Avg Update %6.1f mcs (Total %6.1f mcs, Count %d)\n" " - Avg Update Late %6.1f mcs (Total %6.1f mcs, Count %d)\n" " - Avg Render %6.1f mcs (Total %6.1f mcs, Count %d)", list->ObjectName, - list->AverageUpdateEarlyTime * 1000.0, list->AverageUpdateEarlyTime * list->AverageUpdateEarlyItemCount * 1000.0, (int)list->AverageUpdateEarlyItemCount, - list->AverageUpdateTime * 1000.0, list->AverageUpdateTime * list->AverageUpdateItemCount * 1000.0, (int)list->AverageUpdateItemCount, - list->AverageUpdateLateTime * 1000.0, list->AverageUpdateLateTime * list->AverageUpdateLateItemCount * 1000.0, (int)list->AverageUpdateLateItemCount, - list->AverageRenderTime * 1000.0, list->AverageRenderTime * list->AverageRenderItemCount * 1000.0, (int)list->AverageRenderItemCount); - - totalUpdateEarly += list->AverageUpdateEarlyTime * list->AverageUpdateEarlyItemCount * 1000.0; - totalUpdate += list->AverageUpdateTime * list->AverageUpdateItemCount * 1000.0; - totalUpdateLate += list->AverageUpdateLateTime * list->AverageUpdateLateItemCount * 1000.0; - totalRender += list->AverageRenderTime * list->AverageRenderItemCount * 1000.0; + perf.EarlyUpdate.GetAverageTime(), perf.EarlyUpdate.GetTotalAverageTime(), (int)perf.EarlyUpdate.AverageItemCount, + perf.Update.GetAverageTime(), perf.Update.GetTotalAverageTime(), (int)perf.Update.AverageItemCount, + perf.LateUpdate.GetAverageTime(), perf.LateUpdate.GetTotalAverageTime(), (int)perf.LateUpdate.AverageItemCount, + perf.Render.GetAverageTime(), perf.Render.GetTotalAverageTime(), (int)perf.Render.AverageItemCount); + + totalUpdateEarly += perf.EarlyUpdate.GetTotalAverageTime(); + totalUpdate += perf.Update.GetTotalAverageTime(); + totalUpdateLate += perf.LateUpdate.GetTotalAverageTime(); + totalRender += perf.Render.GetTotalAverageTime(); } Log::Print(Log::LOG_WARN, "Total Update Early: %8.3f mcs / %1.3f ms", totalUpdateEarly, totalUpdateEarly / 1000.0); Log::Print(Log::LOG_WARN, "Total Update: %8.3f mcs / %1.3f ms", totalUpdate, totalUpdate / 1000.0); @@ -458,18 +460,17 @@ PUBLIC STATIC void Application::SetWindowTitle(const char* title) { } PUBLIC STATIC void Application::UpdateWindowTitle() { - char full[512]; - snprintf(full, sizeof(full), "%s", Application::WindowTitle); + std::string titleText = std::string(Application::WindowTitle); bool paren = false; #define ADD_TEXT(text) \ if (!paren) { \ paren = true; \ - StringUtils::Concat(full, " (", sizeof(full)); \ + titleText += " ("; \ } \ - else StringUtils::Concat(full, ", ", sizeof(full)); \ - StringUtils::Concat(full, text, sizeof(full)) + else titleText += ", "; \ + titleText += text if (DevMenu) { if (ResourceManager::UsingDataFolder) { @@ -499,9 +500,9 @@ PUBLIC STATIC void Application::UpdateWindowTitle() { #undef ADD_TEXT if (paren) - strcat(full, ")"); + titleText += ")"; - SDL_SetWindowTitle(Application::Window, full); + SDL_SetWindowTitle(Application::Window, titleText.c_str()); } PRIVATE STATIC void Application::Restart() { @@ -511,6 +512,7 @@ PRIVATE STATIC void Application::Restart() { InputManager::ControllerStopRumble(); Scene::Dispose(); + SceneInfo::Dispose(); Graphics::SpriteSheetTextureMap->WithAll([](Uint32, Texture* tex) -> void { Graphics::DisposeTexture(tex); }); @@ -971,7 +973,7 @@ PRIVATE STATIC void Application::RunFrame(void* p) { if (Application::Platform == Platforms::Android || true) { // Draw bar - float total = 0.0001; + double total = 0.0001; for (int i = 0; i < typeCount; i++) { if (types[i] < 0.0) types[i] = 0.0; @@ -984,7 +986,7 @@ PRIVATE STATIC void Application::RunFrame(void* p) { Graphics::FillRectangle(0.0, 0.0f, infoW - infoPadding * 2, 30.0); Graphics::Restore(); - float rectx = 0.0; + double rectx = 0.0; for (int i = 0; i < typeCount; i++) { Graphics::Save(); Graphics::Translate(infoPadding, 50.0, 0.0); @@ -1000,7 +1002,7 @@ PRIVATE STATIC void Application::RunFrame(void* p) { // Draw list float listY = 90.0; - float totalFrameCount = 0.0f; + double totalFrameCount = 0.0f; infoPadding += infoPadding; for (int i = 0; i < typeCount; i++) { Graphics::Save(); @@ -1069,12 +1071,11 @@ PRIVATE STATIC void Application::RunFrame(void* p) { if (Scene::ObjectLists && Application::Platform != Platforms::Android) { Scene::ObjectLists->WithAll([infoPadding, listYPtr](Uint32, ObjectList* list) -> void { char textBufferXXX[1024]; - if (list->AverageUpdateItemCount > 0.0) { + if (list->Performance.Update.AverageItemCount > 0.0) { Graphics::Save(); Graphics::Translate(infoPadding / 2.0, *listYPtr, 0.0); Graphics::Scale(0.6, 0.6, 1.0); - // snprintf(textBufferXXX, 1024, "Object \"%s\": Avg Update %.1f mcs (Total %.1f mcs, Count %d)", list->ObjectName, list->AverageUpdateTime * 1000.0, list->AverageUpdateTime * list->AverageUpdateItemCount * 1000.0, (int)list->AverageUpdateItemCount); - snprintf(textBufferXXX, 1024, "Object \"%s\": Avg Render %.1f mcs (Total %.1f mcs, Count %d)", list->ObjectName, list->AverageRenderTime * 1000.0, list->AverageRenderTime * list->AverageRenderItemCount * 1000.0, (int)list->AverageRenderItemCount); + snprintf(textBufferXXX, 1024, "Object \"%s\": Avg Render %.1f mcs (Total %.1f mcs, Count %d)", list->ObjectName, list->Performance.Render.GetAverageTime(), list->Performance.Render.GetTotalAverageTime(), (int)list->Performance.Render.AverageItemCount); DEBUG_DrawText(textBufferXXX, 0.0, 0.0); Graphics::Restore(); @@ -1313,35 +1314,35 @@ PRIVATE STATIC void Application::DisposeGameConfig() { PRIVATE STATIC string Application::ParseGameVersion(XMLNode* versionNode) { if (versionNode->children.size() == 1) - return XMLParser::TokenToStdString(versionNode->children[0]->name); + return versionNode->children[0]->name.ToString(); std::string versionText = ""; // major XMLNode* node = XMLParser::SearchNode(versionNode, "major"); if (node) - versionText += XMLParser::TokenToStdString(node->children[0]->name); + versionText += node->children[0]->name.ToString(); else return versionText; // minor node = XMLParser::SearchNode(versionNode, "minor"); if (node) - versionText += "." + XMLParser::TokenToStdString(node->children[0]->name); + versionText += "." + node->children[0]->name.ToString(); else return versionText; // patch node = XMLParser::SearchNode(versionNode, "patch"); if (node) - versionText += "." + XMLParser::TokenToStdString(node->children[0]->name); + versionText += "." + node->children[0]->name.ToString(); else return versionText; // pre-release node = XMLParser::SearchNode(versionNode, "prerelease"); if (node) - versionText += "-" + XMLParser::TokenToStdString(node->children[0]->name); + versionText += "-" + node->children[0]->name.ToString(); return versionText; } @@ -1381,120 +1382,43 @@ PRIVATE STATIC void Application::LoadGameInfo() { } PUBLIC STATIC void Application::LoadSceneInfo() { - if (Application::GameConfig && ResourceManager::ResourceExists("Game/SceneConfig.xml")) { + if (ResourceManager::ResourceExists("Game/SceneConfig.xml")) { XMLNode* node; // Read category and starting scene number to be used by the SceneConfig - node = Application::GameConfig->children[0]; - if (node) { - ParseGameConfigInt(node, "activeCategory", Scene::ActiveCategory); - ParseGameConfigInt(node, "startSceneNum", Application::StartSceneNum); - } - else { - Scene::ActiveCategory = 0; - Application::StartSceneNum = 0; + if (Application::GameConfig) { + node = Application::GameConfig->children[0]; + if (node) { + ParseGameConfigInt(node, "activeCategory", Scene::ActiveCategory); + ParseGameConfigInt(node, "startSceneNum", Application::StartSceneNum); + } } // Open and read SceneConfig - Application::SceneConfig = XMLParser::ParseFromResource("Game/SceneConfig.xml"); - if (!Application::SceneConfig) + XMLNode* sceneConfig = XMLParser::ParseFromResource("Game/SceneConfig.xml"); + if (!sceneConfig) return; - node = Application::SceneConfig->children[0]; - // TODO: Check existing scene folder and id here to reset them upon reload - - Scene::CategoryCount = 0; - Scene::StageCount = 0; - Scene::ListPos = 0; - - Scene::ListCategory.clear(); - Scene::ListCategory.shrink_to_fit(); - - Scene::ListData.clear(); - Scene::ListData.shrink_to_fit(); + Scene::ActiveCategory = 0; + Application::StartSceneNum = 0; // Parse Scene List - for (size_t i = 0; i < node->children.size(); ++i) { - XMLNode* listElement = node->children[i]; - if (XMLParser::MatchToken(listElement->name, "category")) { - SceneListInfo category; - if (listElement->attributes.Exists("name")) - XMLParser::CopyTokenToString(listElement->attributes.Get("name"), category.name, sizeof(category.name)); - else - snprintf(category.name, sizeof(category.name), "unknown list"); - - category.sceneOffsetStart = Scene::ListData.size(); - category.sceneCount = 0; - - for (size_t s = 0; s < listElement->children.size(); ++s) { - XMLNode* stgElement = listElement->children[s]; - if (XMLParser::MatchToken(stgElement->name, "stage")) { - SceneListEntry scene; - if (stgElement->attributes.Exists("name")) - XMLParser::CopyTokenToString(stgElement->attributes.Get("name"), scene.name, sizeof(scene.name)); - else - snprintf(scene.name, sizeof(scene.name), "unknownStage"); - - if (stgElement->attributes.Exists("folder")) - XMLParser::CopyTokenToString(stgElement->attributes.Get("folder"), scene.folder, sizeof(scene.folder)); - else - // Accounts for scenes placed in the root of the Scenes folder - scene.folder[0] = '\0'; - - if (stgElement->attributes.Exists("id")) - XMLParser::CopyTokenToString(stgElement->attributes.Get("id"), scene.id, sizeof(scene.id)); - else - snprintf(scene.id, sizeof(scene.id), "unknownID"); - - if (stgElement->attributes.Exists("spriteFolder")) - XMLParser::CopyTokenToString(stgElement->attributes.Get("spriteFolder"), scene.spriteFolder, sizeof(scene.spriteFolder)); - else - snprintf(scene.spriteFolder, sizeof(scene.spriteFolder), "unknownSprFldr"); - - if (stgElement->attributes.Exists("type")) - XMLParser::CopyTokenToString(stgElement->attributes.Get("type"), scene.fileType, sizeof(scene.fileType)); - else - snprintf(scene.fileType, sizeof(scene.fileType), "bin"); - - if (stgElement->attributes.Exists("filter")) - Scene::Filter = XMLParser::TokenToNumber(stgElement->attributes.Get("filter")); - else - Scene::Filter = 0xFF; - if (Scene::Filter == 0x00) - Scene::Filter = 0xFF; - - Scene::ListData.push_back(scene); - category.sceneCount++; - Scene::StageCount++; - } - - category.sceneOffsetEnd = category.sceneOffsetStart + category.sceneCount; + if (SceneInfo::Load(sceneConfig->children[0])) { + if (SceneInfo::IsCategoryValid(Scene::ActiveCategory)) { + SceneListCategory& category = SceneInfo::Categories[Scene::ActiveCategory]; + size_t listPos = category.OffsetStart + Application::StartSceneNum; + if (listPos < category.OffsetEnd) { + Scene::CurrentSceneInList = listPos; + Scene::SetInfoFromCurrentID(); } - - Scene::ListCategory.push_back(category); - Scene::CategoryCount++; } - } - Scene::ListPos = Scene::ListCategory[Scene::ActiveCategory].sceneOffsetStart + Application::StartSceneNum; - SceneListEntry scene = Scene::ListData[Scene::ListPos]; - strcpy(Scene::CurrentFolder, scene.folder); - strcpy(Scene::CurrentID, scene.id); - strcpy(Scene::CurrentSpriteFolder, scene.spriteFolder); - char filePath[4096]; - if (!strcmp(scene.fileType, "bin")) { - snprintf(filePath, sizeof(filePath), "Stages/%s/Scene%s.%s", scene.folder, scene.id, scene.fileType); - } - else { - if (scene.folder[0] == '\0') - snprintf(filePath, sizeof(filePath), "Scenes/%s.%s", scene.id, scene.fileType); - else - snprintf(filePath, sizeof(filePath), "Scenes/%s/%s.%s", scene.folder, scene.id, scene.fileType); + Log::Print(Log::LOG_VERBOSE, "Loaded scene list (%d categories, %d scenes)", + SceneInfo::Categories.size(), SceneInfo::Entries.size()); } - StringUtils::Copy(StartingScene, filePath, sizeof(StartingScene)); - Log::Print(Log::LOG_VERBOSE, "Successfully read SceneConfig.xml file."); - XMLParser::Free(Application::SceneConfig); + + XMLParser::Free(sceneConfig); } } diff --git a/source/Engine/Audio/AudioManager.cpp b/source/Engine/Audio/AudioManager.cpp index f881bfe1..cca12469 100644 --- a/source/Engine/Audio/AudioManager.cpp +++ b/source/Engine/Audio/AudioManager.cpp @@ -610,10 +610,10 @@ PUBLIC STATIC bool AudioManager::AudioPlayMix(AudioChannel* audio, Uint8* stre int bytesPerSample = BytesPerSample; int bytes = playback->BufferedSamples * bytesPerSample; - int advanceAccumulator = 0; - int advanceReadIndex = 0; - int advance = 0; - int speed = audio->Speed; + unsigned advanceAccumulator = 0; + unsigned advanceReadIndex = 0; + unsigned advance = 0; + unsigned speed = audio->Speed; // Read more bytes if (bytes == 0) { @@ -657,7 +657,7 @@ PUBLIC STATIC bool AudioManager::AudioPlayMix(AudioChannel* audio, Uint8* stre SDL_MixAudioFormat(stream, playback->Buffer, DeviceFormat.format, (Uint32)bytes, mixVolume); else { Uint32 mixAdvance = MixBufferSize * bytesPerSample; - for (Uint32 o = 0; o < len; o += mixAdvance) { + for (Uint32 o = 0; o < (unsigned)len; o += mixAdvance) { AudioManager::MixAudioLR(MixBuffer, playback->Buffer + advanceReadIndex, MixBufferSize, volumeL, volumeR); SDL_MixAudioFormat(stream + o, MixBuffer, DeviceFormat.format, mixAdvance, mixVolume); advanceReadIndex += mixAdvance; @@ -666,7 +666,7 @@ PUBLIC STATIC bool AudioManager::AudioPlayMix(AudioChannel* audio, Uint8* stre playback->BufferedSamples -= bytes / bytesPerSample; } - else for (Uint32 o = 0; o < len; o += bytesPerSample) { + else for (Uint32 o = 0; o < (unsigned)len; o += bytesPerSample) { advanceAccumulator += speed; advance = advanceAccumulator >> 16; advanceAccumulator &= 0xFFFF; diff --git a/source/Engine/Bytecode/Bytecode.cpp b/source/Engine/Bytecode/Bytecode.cpp index 4b44d4aa..aadfcb44 100644 --- a/source/Engine/Bytecode/Bytecode.cpp +++ b/source/Engine/Bytecode/Bytecode.cpp @@ -20,8 +20,10 @@ class Bytecode { #include #include +#define BYTECODE_VERSION 0x0002 + const char* Bytecode::Magic = "HTVM"; -Uint32 Bytecode::LatestVersion = 0; +Uint32 Bytecode::LatestVersion = BYTECODE_VERSION; vector Bytecode::FunctionNames{ "", "main" }; PUBLIC Bytecode::Bytecode() { @@ -46,6 +48,12 @@ PUBLIC bool Bytecode::Read(BytecodeContainer bytecode, HashMap* to } Version = stream->ReadByte(); + + if (Version > BYTECODE_VERSION) { + Log::Print(Log::LOG_ERROR, "Unsupported bytecode version 0x%02X!", Version); + return false; + } + Uint8 opts = stream->ReadByte(); stream->Skip(1); stream->Skip(1); @@ -58,11 +66,22 @@ PUBLIC bool Bytecode::Read(BytecodeContainer bytecode, HashMap* to for (int i = 0; i < chunkCount; i++) { int length = stream->ReadInt32(); - int arity = stream->ReadInt32(); + int arity, minArity; + + if (Version < 0x0001) { + arity = stream->ReadInt32(); + minArity = arity; + } + else { + arity = stream->ReadByte(); + minArity = stream->ReadByte(); + } + Uint32 hash = stream->ReadUInt32(); ObjFunction* function = NewFunction(); function->Arity = arity; + function->MinArity = minArity; function->NameHash = hash; function->Chunk.Count = length; function->Chunk.OwnsMemory = false; @@ -118,23 +137,19 @@ PUBLIC bool Bytecode::Read(BytecodeContainer bytecode, HashMap* to } bool hasSourceFilename = opts & 2; - if (hasSourceFilename) { + if (hasSourceFilename) SourceFilename = stream->ReadString(); - ObjString* srcFilename = CopyString(SourceFilename); - for (ObjFunction* function : Functions) - function->SourceFilename = srcFilename; - } - return true; } PUBLIC void Bytecode::Write(Stream* stream, const char* sourceFilename, HashMap* tokenMap) { - bool hasSourceFilename = sourceFilename != nullptr; + int hasSourceFilename = (sourceFilename != nullptr) ? 1 : 0; + int hasDebugInfo = HasDebugInfo ? 1 : 0; stream->WriteBytes((char*)Bytecode::Magic, 4); stream->WriteByte(Version); - stream->WriteByte((hasSourceFilename << 1) | HasDebugInfo); + stream->WriteByte((hasSourceFilename << 1) | hasDebugInfo); stream->WriteByte(0x00); stream->WriteByte(0x00); @@ -142,11 +157,16 @@ PUBLIC void Bytecode::Write(Stream* stream, const char* sourceFilename, H stream->WriteUInt32(chunkCount); for (int c = 0; c < chunkCount; c++) { - int arity = Functions[c]->Arity; Chunk* chunk = &Functions[c]->Chunk; stream->WriteUInt32(chunk->Count); - stream->WriteUInt32(arity); + if (Version >= 0x0001) { + stream->WriteByte(Functions[c]->Arity); + stream->WriteByte(Functions[c]->MinArity); + } + else { + stream->WriteUInt32(Functions[c]->Arity); + } stream->WriteUInt32(Murmur::EncryptString(Functions[c]->Name->Chars)); stream->WriteBytes(chunk->Code, chunk->Count); diff --git a/source/Engine/Bytecode/Compiler.cpp b/source/Engine/Bytecode/Compiler.cpp index 56f6061f..af640d83 100644 --- a/source/Engine/Bytecode/Compiler.cpp +++ b/source/Engine/Bytecode/Compiler.cpp @@ -8,6 +8,7 @@ class Compiler { static Scanner scanner; static ParseRule* Rules; static vector Functions; + static vector ModuleLocals; static HashMap* TokenMap; static bool ShowWarnings; static bool WriteDebugInfo; @@ -45,6 +46,7 @@ Parser Compiler::parser; Scanner Compiler::scanner; ParseRule* Compiler::Rules = NULL; vector Compiler::Functions; +vector Compiler::ModuleLocals; HashMap* Compiler::TokenMap = NULL; bool Compiler::ShowWarnings = false; @@ -129,6 +131,7 @@ enum TokenTYPE { TOKEN_EVENT, TOKEN_VAR, TOKEN_STATIC, + TOKEN_LOCAL, // Keywords. TOKEN_DO, @@ -155,6 +158,8 @@ enum TokenTYPE { TOKEN_AS, TOKEN_IN, TOKEN_FROM, + TOKEN_USING, + TOKEN_NAMESPACE, TOKEN_PRINT, @@ -374,9 +379,12 @@ PUBLIC VIRTUAL int Compiler::GetKeywordType() { } } break; + case 'l': + return CheckKeyword(1, 4, "ocal", TOKEN_LOCAL); case 'n': if (scanner.Current - scanner.Start > 1) { switch (*(scanner.Start + 1)) { + case 'a': return CheckKeyword(2, 7, "mespace", TOKEN_NAMESPACE); case 'u': return CheckKeyword(2, 2, "ll", TOKEN_NULL); case 'e': return CheckKeyword(2, 1, "w", TOKEN_NEW); } @@ -434,6 +442,8 @@ PUBLIC VIRTUAL int Compiler::GetKeywordType() { } } break; + case 'u': + return CheckKeyword(1, 4, "sing", TOKEN_USING); case 'v': return CheckKeyword(1, 2, "ar", TOKEN_VAR); case 'w': @@ -670,7 +680,7 @@ PUBLIC bool Compiler::ReportError(int line, bool fatal, const char* str va_list args; va_start(args, string); - vsprintf(message, string, args); + vsnprintf(message, sizeof message, string, args); va_end(args); Log::Print(fatal ? Log::LOG_ERROR : Log::LOG_WARN, "in file '%s' on line %d:\n %s\n\n", scanner.SourceFilename, line, message); @@ -689,7 +699,7 @@ PUBLIC bool Compiler::ReportErrorPos(int line, int pos, bool fatal, con va_list args; va_start(args, string); - vsprintf(message, string, args); + vsnprintf(message, sizeof message, string, args); va_end(args); char* textBuffer = (char*)malloc(512); @@ -767,7 +777,7 @@ PUBLIC void Compiler::WarningInFunction(const char* format, ...) { va_list args; va_start(args, format); - vsprintf(message, format, args); + vsnprintf(message, sizeof message, format, args); va_end(args); char* textBuffer = (char*)malloc(512); @@ -795,9 +805,7 @@ PUBLIC void Compiler::WarningInFunction(const char* format, ...) { PUBLIC void Compiler::ParseVariable(const char* errorMessage) { ConsumeToken(TOKEN_IDENTIFIER, errorMessage); - DeclareVariable(&parser.Previous); - if (ScopeDepth > 0) return; } PUBLIC bool Compiler::IdentifiersEqual(Token* a, Token* b) { if (a->Length != b->Length) return false; @@ -830,6 +838,24 @@ PUBLIC void Compiler::DeclareVariable(Token* name) { AddLocal(*name); } +PUBLIC int Compiler::ParseModuleVariable(const char* errorMessage) { + ConsumeToken(TOKEN_IDENTIFIER, errorMessage); + return DeclareModuleVariable(&parser.Previous); +} +PUBLIC void Compiler::DefineModuleVariable(int local) { + EmitByte(OP_DEFINE_MODULE_LOCAL); + Compiler::ModuleLocals[local].Depth = 0; +} +PUBLIC int Compiler::DeclareModuleVariable(Token* name) { + for (int i = Compiler::ModuleLocals.size() - 1; i >= 0; i--) { + Local& local = Compiler::ModuleLocals[i]; + + if (IdentifiersEqual(name, &local.Name)) + Error("Local with this name already declared in this module."); + } + + return AddModuleLocal(*name); +} PRIVATE void Compiler::WarnVariablesUnused() { if (!Compiler::ShowWarnings) return; @@ -843,7 +869,7 @@ PRIVATE void Compiler::WarnVariablesUnused() { for (int i = numUnused - 1; i >= 0; i--) { Local& local = (*UnusedVariables)[i]; - snprintf(temp, sizeof(temp), "Variable '%.*s' is unused. (Declared on line %d)", local.Name.Length, local.Name.Start, local.Name.Line); + snprintf(temp, sizeof(temp), "Variable '%.*s' is unused. (Declared on line %d)", (int)local.Name.Length, local.Name.Start, local.Name.Line); message += std::string(temp); if (i != 0) message += "\n "; @@ -865,6 +891,10 @@ PUBLIC void Compiler::EmitSetOperation(Uint8 setOp, int arg, Token name) { case OP_SET_ELEMENT: EmitByte(setOp); break; + case OP_SET_MODULE_LOCAL: + EmitByte(setOp); + EmitUint16((Uint16)arg); + break; default: break; } @@ -882,6 +912,9 @@ PUBLIC void Compiler::EmitGetOperation(Uint8 getOp, int arg, Token name) { case OP_GET_ELEMENT: EmitByte(getOp); break; + case OP_GET_MODULE_LOCAL: + EmitByte(getOp); + EmitUint16((Uint16)arg); default: break; } @@ -955,8 +988,15 @@ PUBLIC void Compiler::NamedVariable(Token name, bool canAssign) { setOp = OP_SET_LOCAL; } else { - getOp = OP_GET_GLOBAL; - setOp = OP_SET_GLOBAL; + arg = ResolveModuleLocal(&name); + if (arg != -1) { + getOp = OP_GET_MODULE_LOCAL; + setOp = OP_SET_MODULE_LOCAL; + } + else { + getOp = OP_GET_GLOBAL; + setOp = OP_SET_GLOBAL; + } } if (canAssign && MatchAssignmentToken()) { @@ -1082,6 +1122,31 @@ PUBLIC int Compiler::ResolveLocal(Token* name) { } return -1; } +PUBLIC int Compiler::AddModuleLocal(Token name) { + if (Compiler::ModuleLocals.size() == 0xFFFF) { + Error("Too many locals in module."); + return -1; + } + Local local; + local.Name = name; + local.Depth = -1; + local.Resolved = false; + Compiler::ModuleLocals.push_back(local); + return ((int)Compiler::ModuleLocals.size()) - 1; +} +PUBLIC int Compiler::ResolveModuleLocal(Token* name) { + for (int i = Compiler::ModuleLocals.size() - 1; i >= 0; i--) { + Local& local = Compiler::ModuleLocals[i]; + if (IdentifiersEqual(name, &local.Name)) { + if (local.Depth == -1) { + Error("Cannot read local variable in its own initializer."); + } + local.Resolved = true; + return i; + } + } + return -1; +} PUBLIC Uint8 Compiler::GetArgumentList() { Uint8 argumentCount = 0; if (!CheckToken(TOKEN_RIGHT_PAREN)) { @@ -1102,25 +1167,25 @@ PUBLIC Uint8 Compiler::GetArgumentList() { Token InstanceToken = Token { 0, NULL, 0, 0, 0 }; PUBLIC void Compiler::GetThis(bool canAssign) { InstanceToken = parser.Previous; - // if (currentClass == NULL) { - // Error("Cannot use 'this' outside of a class."); - // } - // else { - GetVariable(false); - // } + GetVariable(false); } PUBLIC void Compiler::GetSuper(bool canAssign) { InstanceToken = parser.Previous; + if (!CheckToken(TOKEN_DOT)) + Error("Expect '.' after 'super'."); EmitBytes(OP_GET_LOCAL, 0); } PUBLIC void Compiler::GetDot(bool canAssign) { - Token instanceToken = InstanceToken; + bool isSuper = InstanceToken.Type == TOKEN_SUPER; InstanceToken.Type = -1; ConsumeToken(TOKEN_IDENTIFIER, "Expect property name after '.'."); Token nameToken = parser.Previous; if (canAssign && MatchAssignmentToken()) { + if (isSuper) + EmitByte(OP_GET_SUPERCLASS); + Token assignmentToken = parser.Previous; if (assignmentToken.Type == TOKEN_INCREMENT || assignmentToken.Type == TOKEN_DECREMENT) { @@ -1153,9 +1218,12 @@ PUBLIC void Compiler::GetDot(bool canAssign) { else if (MatchToken(TOKEN_LEFT_PAREN)) { uint8_t argCount = GetArgumentList(); - EmitCall(nameToken, argCount, instanceToken.Type == TOKEN_SUPER); + EmitCall(nameToken, argCount, isSuper); } else { + if (isSuper) + EmitByte(OP_GET_SUPERCLASS); + EmitGetOperation(OP_GET_PROPERTY, -1, nameToken); } } @@ -1196,9 +1264,6 @@ PUBLIC void Compiler::GetElement(bool canAssign) { EmitSetOperation(OP_SET_ELEMENT, -1, blank); } } - else if (MatchToken(TOKEN_LEFT_PAREN)) { - EmitGetOperation(OP_GET_ELEMENT, -1, blank); - } else { EmitGetOperation(OP_GET_ELEMENT, -1, blank); } @@ -1673,7 +1738,7 @@ PUBLIC void Compiler::GetSwitchStatement() { EmitCopy(1); - for (int i = 0; i < case_info.CodeLength; i++) + for (Uint32 i = 0; i < case_info.CodeLength; i++) chunk->Write(case_info.CodeBlock[i], case_info.LineBlock[i]); EmitByte(OP_EQUAL); @@ -1830,7 +1895,6 @@ PUBLIC void Compiler::GetBreakStatement() { ConsumeToken(TOKEN_SEMICOLON, "Expect ';' after break."); } PUBLIC void Compiler::GetBlockStatement() { - // printf("GetBlockStatement()\n"); while (!CheckToken(TOKEN_RIGHT_BRACE) && !CheckToken(TOKEN_EOF)) { GetDeclaration(); } @@ -2188,8 +2252,13 @@ PUBLIC int Compiler::GetFunction(int type, string className) { // Compile the parameter list. compiler->ConsumeToken(TOKEN_LEFT_PAREN, "Expect '(' after function name."); + bool isOptional = false; + if (!compiler->CheckToken(TOKEN_RIGHT_PAREN)) { do { + if (!isOptional && compiler->MatchToken(TOKEN_LEFT_SQUARE_BRACE)) + isOptional = true; + compiler->ParseVariable("Expect parameter name."); compiler->DefineVariableToken(parser.Previous); @@ -2197,6 +2266,11 @@ PUBLIC int Compiler::GetFunction(int type, string className) { if (compiler->Function->Arity > 255) { compiler->Error("Cannot have more than 255 parameters."); } + + if (!isOptional) + compiler->Function->MinArity++; + else if (compiler->MatchToken(TOKEN_RIGHT_SQUARE_BRACE)) + break; } while (compiler->MatchToken(TOKEN_COMMA)); } @@ -2225,7 +2299,7 @@ PUBLIC void Compiler::GetMethod(Token className) { if (IdentifiersEqual(&className, &parser.Previous)) type = TYPE_CONSTRUCTOR; - int index = GetFunction(type, std::string(className.Start, className.Length)); + int index = GetFunction(type, className.ToString()); EmitByte(OP_METHOD); EmitByte(index); @@ -2255,6 +2329,29 @@ PUBLIC void Compiler::GetVariableDeclaration() { ConsumeToken(TOKEN_SEMICOLON, "Expected \";\" after variable declaration."); } +PUBLIC void Compiler::GetModuleVariableDeclaration() { + ConsumeToken(TOKEN_VAR, "Expected \"var\" after \"local\" declaration."); + + if (ScopeDepth > 0) { + Error("Cannot use local declaration outside of top-level code."); + } + + do { + int local = ParseModuleVariable("Expected variable name."); + + if (MatchToken(TOKEN_ASSIGNMENT)) { + GetExpression(); + } + else { + EmitByte(OP_NULL); + } + + DefineModuleVariable(local); + } + while (MatchToken(TOKEN_COMMA)); + + ConsumeToken(TOKEN_SEMICOLON, "Expected \";\" after variable declaration."); +} PUBLIC void Compiler::GetPropertyDeclaration(Token propertyName) { do { ParseVariable("Expected property name."); @@ -2404,7 +2501,24 @@ PUBLIC void Compiler::GetImportDeclaration() { } while (MatchToken(TOKEN_COMMA)); - ConsumeToken(TOKEN_SEMICOLON, "Expected \";\" after import declaration."); + ConsumeToken(TOKEN_SEMICOLON, "Expected \";\" after \"import\" declaration."); +} +PUBLIC void Compiler::GetUsingDeclaration() { + ConsumeToken(TOKEN_NAMESPACE, "Expected \"namespace\" after \"using\" declaration."); + + if (ScopeDepth > 0) { + Error("Cannot use namespaces outside of top-level code."); + } + + do { + ConsumeToken(TOKEN_IDENTIFIER, "Expected namespace name."); + Token nsName = parser.Previous; + EmitByte(OP_USE_NAMESPACE); + EmitStringHash(nsName); + } + while (MatchToken(TOKEN_COMMA)); + + ConsumeToken(TOKEN_SEMICOLON, "Expected \";\" after \"using\" declaration."); } PUBLIC void Compiler::GetEventDeclaration() { ConsumeToken(TOKEN_IDENTIFIER, "Expected event name."); @@ -2437,6 +2551,10 @@ PUBLIC void Compiler::GetDeclaration() { GetImportDeclaration(); else if (MatchToken(TOKEN_VAR)) GetVariableDeclaration(); + else if (MatchToken(TOKEN_LOCAL)) + GetModuleVariableDeclaration(); + else if (MatchToken(TOKEN_USING)) + GetUsingDeclaration(); else if (MatchToken(TOKEN_EVENT)) GetEventDeclaration(); else @@ -2745,9 +2863,8 @@ PUBLIC STATIC int Compiler::SimpleInstruction(const char* name, int offset) { return offset + 1; } PUBLIC STATIC int Compiler::ByteInstruction(const char* name, Chunk* chunk, int offset) { - uint8_t slot = chunk->Code[offset + 1]; - printf("%-16s %9d\n", name, slot); - return offset + 2; // [debug] + printf("%-16s %9d\n", name, chunk->Code[offset + 1]); + return offset + 2; } PUBLIC STATIC int Compiler::LocalInstruction(const char* name, Chunk* chunk, int offset) { uint8_t slot = chunk->Code[offset + 1]; @@ -2755,7 +2872,7 @@ PUBLIC STATIC int Compiler::LocalInstruction(const char* name, Chunk* chunk, printf("%-16s %9d\n", name, slot); else printf("%-16s %9d 'this'\n", name, slot); - return offset + 2; // [debug] + return offset + 2; } PUBLIC STATIC int Compiler::MethodInstruction(const char* name, Chunk* chunk, int offset) { uint8_t slot = chunk->Code[offset + 1]; @@ -2768,7 +2885,7 @@ PUBLIC STATIC int Compiler::MethodInstruction(const char* name, Chunk* chunk, printf(" (%.*s)", (int)t.Length, t.Start); } printf("\n"); - return offset + 6; // [debug] + return offset + 6; } PUBLIC STATIC int Compiler::InvokeInstruction(const char* name, Chunk* chunk, int offset) { return Compiler::MethodInstruction(name, chunk, offset) + 1; @@ -2782,16 +2899,19 @@ PUBLIC STATIC int Compiler::JumpInstruction(const char* name, int sign, Chunk PUBLIC STATIC int Compiler::ClassInstruction(const char* name, Chunk* chunk, int offset) { return Compiler::HashInstruction(name, chunk, offset) + 1; } +PUBLIC STATIC int Compiler::EnumInstruction(const char* name, Chunk* chunk, int offset) { + return Compiler::HashInstruction(name, chunk, offset); +} PUBLIC STATIC int Compiler::WithInstruction(const char* name, Chunk* chunk, int offset) { uint8_t slot = chunk->Code[offset + 1]; if (slot == 0) { printf("%-16s %9d\n", name, slot); - return offset + 2; // [debug] + return offset + 2; } uint16_t jump = (uint16_t)(chunk->Code[offset + 2]); jump |= chunk->Code[offset + 3] << 8; printf("%-16s %9d -> %d\n", name, slot, jump); - return offset + 4; // [debug] + return offset + 4; } PUBLIC STATIC int Compiler::DebugInstruction(Chunk* chunk, int offset) { printf("%04d ", offset); @@ -2815,7 +2935,7 @@ PUBLIC STATIC int Compiler::DebugInstruction(Chunk* chunk, int offset) { case OP_POP: return SimpleInstruction("OP_POP", offset); case OP_COPY: - return SimpleInstruction("OP_COPY", offset); + return ByteInstruction("OP_COPY", chunk, offset); case OP_GET_LOCAL: return LocalInstruction("OP_GET_LOCAL", chunk, offset); case OP_SET_LOCAL: @@ -2912,6 +3032,8 @@ PUBLIC STATIC int Compiler::DebugInstruction(Chunk* chunk, int offset) { return InvokeInstruction("OP_INVOKE", chunk, offset); case OP_IMPORT: return ConstantInstruction("OP_IMPORT", chunk, offset); + case OP_IMPORT_MODULE: + return ConstantInstruction("OP_IMPORT_MODULE", chunk, offset); case OP_PRINT_STACK: { offset++; @@ -2937,18 +3059,22 @@ PUBLIC STATIC int Compiler::DebugInstruction(Chunk* chunk, int offset) { case OP_CLASS: return ClassInstruction("OP_CLASS", chunk, offset); case OP_NEW_ENUM: - return ClassInstruction("OP_NEW_ENUM", chunk, offset); + return EnumInstruction("OP_NEW_ENUM", chunk, offset); case OP_INHERIT: return SimpleInstruction("OP_INHERIT", offset); case OP_METHOD: return MethodInstruction("OP_METHOD", chunk, offset); default: printf("\x1b[1;93mUnknown opcode %d\x1b[m\n", instruction); - return offset + 1; + return chunk->Count + 1; } } -PUBLIC STATIC void Compiler::DebugChunk(Chunk* chunk, const char* name, int arity) { - printf("== %s (argCount: %d) ==\n", name, arity); +PUBLIC STATIC void Compiler::DebugChunk(Chunk* chunk, const char* name, int minArity, int maxArity) { + int optArgCount = maxArity - minArity; + if (optArgCount) + printf("== %s (argCount: %d, optArgCount: %d) ==\n", name, maxArity, optArgCount); + else + printf("== %s (argCount: %d) ==\n", name, maxArity); printf("byte ln\n"); for (int offset = 0; offset < chunk->Count;) { offset = DebugInstruction(chunk, offset); @@ -3040,6 +3166,14 @@ PUBLIC bool Compiler::Compile(const char* filename, const char* source, } ConsumeToken(TOKEN_EOF, "Expected end of file."); + + if (UnusedVariables) { + for (size_t i = 0; i < Compiler::ModuleLocals.size(); i++) { + if (!Compiler::ModuleLocals[i].Resolved) + UnusedVariables->insert(UnusedVariables->begin(), Compiler::ModuleLocals[i]); + } + } + Finish(); bool debugCompiler = false; @@ -3047,7 +3181,7 @@ PUBLIC bool Compiler::Compile(const char* filename, const char* source, if (debugCompiler) { for (size_t c = 0; c < Compiler::Functions.size(); c++) { Chunk* chunk = &Compiler::Functions[c]->Chunk; - DebugChunk(chunk, Compiler::Functions[c]->Name->Chars, Compiler::Functions[c]->Arity); + DebugChunk(chunk, Compiler::Functions[c]->Name->Chars, Compiler::Functions[c]->MinArity, Compiler::Functions[c]->Arity); printf("\n"); } } @@ -3075,6 +3209,7 @@ PUBLIC VIRTUAL Compiler::~Compiler() { } PUBLIC STATIC void Compiler::FinishCompiling() { Compiler::Functions.clear(); + Compiler::ModuleLocals.clear(); if (TokenMap) { delete TokenMap; diff --git a/source/Engine/Bytecode/CompilerEnums.h b/source/Engine/Bytecode/CompilerEnums.h index a48281b8..23462c29 100644 --- a/source/Engine/Bytecode/CompilerEnums.h +++ b/source/Engine/Bytecode/CompilerEnums.h @@ -1,13 +1,7 @@ #ifndef ENGINE_COMPILER_ENUMS #define ENGINE_COMPILER_ENUMS -struct Token { - int Type; - char* Start; - size_t Length; - int Line; - size_t Pos; -}; +#include class Parser { public: diff --git a/source/Engine/Bytecode/GarbageCollector.cpp b/source/Engine/Bytecode/GarbageCollector.cpp index 5a2c01a5..7dd5f01c 100644 --- a/source/Engine/Bytecode/GarbageCollector.cpp +++ b/source/Engine/Bytecode/GarbageCollector.cpp @@ -56,9 +56,9 @@ PUBLIC STATIC void GarbageCollector::Collect() { for (VMValue* slot = thread->Stack; slot < thread->StackTop; slot++) { GrayValue(*slot); } - // Mark frame functions + // Mark frame modules for (Uint32 i = 0; i < thread->FrameCount; i++) { - GrayObject(thread->Frames[i].Function); + GrayObject(thread->Frames[i].Module); } } @@ -95,9 +95,9 @@ PUBLIC STATIC void GarbageCollector::Collect() { GrayHashMap(Scene::Layers[i].Properties); } - // Mark functions - for (size_t i = 0; i < ScriptManager::AllFunctionList.size(); i++) { - GrayObject(ScriptManager::AllFunctionList[i]); + // Mark modules + for (size_t i = 0; i < ScriptManager::ModuleList.size(); i++) { + GrayObject(ScriptManager::ModuleList[i]); } // Mark classes @@ -150,24 +150,10 @@ PUBLIC STATIC void GarbageCollector::Collect() { Log::Print(Log::LOG_VERBOSE, "Sweep: Blackening took %.1f ms", blackenElapsed); Log::Print(Log::LOG_VERBOSE, "Sweep: Freeing took %.1f ms", freeElapsed); -#define LOG_ME(type) \ - if (objectTypeCounts[type]) \ - Log::Print(Log::LOG_VERBOSE, "Freed %d " #type " objects out of %d.", objectTypeFreed[type], objectTypeCounts[type]) - - LOG_ME(OBJ_BOUND_METHOD); - LOG_ME(OBJ_CLASS); - LOG_ME(OBJ_FUNCTION); - LOG_ME(OBJ_INSTANCE); - LOG_ME(OBJ_ARRAY); - LOG_ME(OBJ_MAP); - LOG_ME(OBJ_NATIVE); - LOG_ME(OBJ_STRING); - LOG_ME(OBJ_UPVALUE); - LOG_ME(OBJ_STREAM); - LOG_ME(OBJ_NAMESPACE); - LOG_ME(OBJ_ENUM); - -#undef LOG_ME + for (size_t i = 0; i < MAX_OBJ_TYPE; i++) { + if (objectTypeCounts[i]) + Log::Print(Log::LOG_VERBOSE, "Freed %d %s objects out of %d.", objectTypeFreed[i], GetObjectTypeString(i), objectTypeCounts[i]); + } GarbageCollector::NextGC = GarbageCollector::GarbageSize + (1024 * 1024); } @@ -241,12 +227,20 @@ PRIVATE STATIC void GarbageCollector::BlackenObject(Obj* object) { ObjFunction* function = (ObjFunction*)object; GrayObject(function->Name); GrayObject(function->ClassName); - GrayObject(function->SourceFilename); for (size_t i = 0; i < function->Chunk.Constants->size(); i++) { GrayValue((*function->Chunk.Constants)[i]); } break; } + case OBJ_MODULE: { + ObjModule* module = (ObjModule*)object; + GrayObject(module->SourceFilename); + for (size_t i = 0; i < module->Locals->size(); i++) + GrayValue((*module->Locals)[i]); + for (size_t fn = 0; fn < module->Functions->size(); fn++) + GrayObject((*module->Functions)[fn]); + break; + } case OBJ_INSTANCE: { ObjInstance* instance = (ObjInstance*)object; GrayHashMap(instance->Fields); @@ -266,19 +260,8 @@ PRIVATE STATIC void GarbageCollector::BlackenObject(Obj* object) { }); break; } - // case OBJ_NATIVE: - // case OBJ_STRING: default: // No references break; } } - -PRIVATE STATIC void GarbageCollector::RemoveWhiteHashMapItem(Uint32, VMValue value) { - // seems in the craftinginterpreters book this removes the ObjString used - // for hashing, but we don't use that, so... -} -PRIVATE STATIC void GarbageCollector::RemoveWhiteHashMap(void* pointer) { - if (!pointer) return; - ((HashMap*)pointer)->ForAll(RemoveWhiteHashMapItem); -} diff --git a/source/Engine/Bytecode/ScriptEntity.cpp b/source/Engine/Bytecode/ScriptEntity.cpp index 48797d53..8718ae6a 100644 --- a/source/Engine/Bytecode/ScriptEntity.cpp +++ b/source/Engine/Bytecode/ScriptEntity.cpp @@ -36,6 +36,10 @@ Uint32 Hash_OnSceneLoad = 0; Uint32 Hash_OnSceneRestart = 0; Uint32 Hash_GameStart = 0; Uint32 Hash_Dispose = 0; +Uint32 Hash_HitboxLeft = 0; +Uint32 Hash_HitboxTop = 0; +Uint32 Hash_HitboxRight = 0; +Uint32 Hash_HitboxBottom = 0; PUBLIC void ScriptEntity::Link(ObjInstance* instance) { Instance = instance; @@ -56,10 +60,17 @@ PUBLIC void ScriptEntity::Link(ObjInstance* instance) { Hash_OnSceneRestart = Murmur::EncryptString("OnSceneRestart"); Hash_GameStart = Murmur::EncryptString("GameStart"); Hash_Dispose = Murmur::EncryptString("Dispose"); + Hash_HitboxLeft = Murmur::EncryptString("HitboxLeft"); + Hash_HitboxTop = Murmur::EncryptString("HitboxTop"); + Hash_HitboxRight = Murmur::EncryptString("HitboxRight"); + Hash_HitboxBottom = Murmur::EncryptString("HitboxBottom"); SavedHashes = true; } + instance->PropertyGet = VM_Getter; + instance->PropertySet = VM_Setter; + LinkFields(); } @@ -441,7 +452,7 @@ PUBLIC void ScriptEntity::LinkFields() { * \ns Instance * \desc The width of the hitbox. */ - LINK_DEC(HitboxW); + Instance->Fields->Put("HitboxW", DECIMAL_LINK_VAL(&Hitbox.Width)); /*** * \field HitboxH * \type Decimal @@ -449,7 +460,7 @@ PUBLIC void ScriptEntity::LinkFields() { * \ns Instance * \desc The height of the hitbox. */ - LINK_DEC(HitboxH); + Instance->Fields->Put("HitboxH", DECIMAL_LINK_VAL(&Hitbox.Height)); /*** * \field HitboxOffX * \type Decimal @@ -457,7 +468,7 @@ PUBLIC void ScriptEntity::LinkFields() { * \ns Instance * \desc The horizontal offset of the hitbox. */ - LINK_DEC(HitboxOffX); + Instance->Fields->Put("HitboxOffX", DECIMAL_LINK_VAL(&Hitbox.OffsetX)); /*** * \field HitboxOffY * \type Decimal @@ -465,7 +476,41 @@ PUBLIC void ScriptEntity::LinkFields() { * \ns Instance * \desc The vertical offset of the hitbox. */ - LINK_DEC(HitboxOffY); + Instance->Fields->Put("HitboxOffY", DECIMAL_LINK_VAL(&Hitbox.OffsetY)); + + /*** + * \field HitboxLeft + * \type Decimal + * \default 0.0 + * \ns Instance + * \desc The left extent of the hitbox. + */ + // See ScriptEntity::VM_Getter and ScriptEntity::VM_Setter + /*** + * \field HitboxTop + * \type Decimal + * \default 0.0 + * \ns Instance + * \desc The top extent of the hitbox. + */ + // See ScriptEntity::VM_Getter and ScriptEntity::VM_Setter + /*** + * \field HitboxRight + * \type Decimal + * \default 0.0 + * \ns Instance + * \desc The right extent of the hitbox. + */ + // See ScriptEntity::VM_Getter and ScriptEntity::VM_Setter + /*** + * \field HitboxBottom + * \type Decimal + * \default 0.0 + * \ns Instance + * \desc The bottom extent of the hitbox. + */ + // See ScriptEntity::VM_Getter and ScriptEntity::VM_Setter + /*** * \field FlipFlag * \type Integer @@ -721,14 +766,14 @@ PUBLIC bool ScriptEntity::RunCreateFunction(VMValue flag) { VMValue* stackTop = thread->StackTop; - if (func->Arity == 1) { - thread->Push(OBJECT_VAL(Instance)); - thread->Push(flag); - thread->RunEntityFunction(func, 1); + thread->Push(OBJECT_VAL(Instance)); + + if (func->Arity == 0) { + thread->RunEntityFunction(func, 0); } else { - thread->Push(OBJECT_VAL(Instance)); - thread->RunEntityFunction(func, 0); + thread->Push(flag); + thread->RunEntityFunction(func, 1); } thread->StackTop = stackTop; @@ -752,11 +797,39 @@ PUBLIC bool ScriptEntity::RunInitializer() { return true; } -PUBLIC void ScriptEntity::Copy(ScriptEntity* other, bool copyClass, bool destroySrc) { +PUBLIC bool ScriptEntity::ChangeClass(const char* className) { + if (!ScriptManager::ClassExists(className)) + return false; + + if (!ScriptManager::Classes->Exists(className) && !ScriptManager::LoadObjectClass(className, true)) + return false; + + ObjClass* newClass = ScriptManager::GetObjectClass(className); + if (!newClass) + return false; + + ObjectList* objectList = Scene::GetObjectList(className); + if (!objectList) + return false; + + // Remove from the old list + List->Remove(this); + + // Add to the new list + List = objectList; + List->Add(this); + + // Change the script-side class proper + Instance->Object.Class = newClass; + + return true; +} + +PUBLIC void ScriptEntity::Copy(ScriptEntity* other, bool copyClass) { CopyFields(other); if (copyClass) - other->Instance->Object.Class = Instance->Object.Class; + other->ChangeClass(List->ObjectName); // Copy properties HashMap* srcProperties = Properties; @@ -767,12 +840,8 @@ PUBLIC void ScriptEntity::Copy(ScriptEntity* other, bool copyClass, bool destroy srcProperties->WithAll([destProperties](Uint32 key, VMValue value) -> void { destProperties->Put(key, value); }); - - if (destroySrc) - other->Active = false; } - PUBLIC void ScriptEntity::CopyFields(ScriptEntity* other) { Entity::CopyFields(other); @@ -849,10 +918,7 @@ PUBLIC void ScriptEntity::Initialize() { AnimationFrameDuration = 0; AnimationLoopIndex = 0; - HitboxW = 0.0f; - HitboxH = 0.0f; - HitboxOffX = 0.0f; - HitboxOffY = 0.0f; + Hitbox.Clear(); FlipFlag = 0; VelocityX = 0.0f; @@ -962,25 +1028,75 @@ PUBLIC void ScriptEntity::Dispose() { // Events/methods called from VM #define GET_ARG(argIndex, argFunction) (StandardLibrary::argFunction(args, argIndex, threadID)) #define GET_ARG_OPT(argIndex, argFunction, argDefault) (argIndex < argCount ? GET_ARG(argIndex, StandardLibrary::argFunction) : argDefault) -#define GET_ENTITY(argIndex) (GetEntity(args, argIndex, threadID)) -ScriptEntity* GetEntity(VMValue* args, int index, Uint32 threadID) { +#define GET_ENTITY(argIndex) (GetScriptEntity(args, argIndex, threadID)) +ScriptEntity* GetScriptEntity(Obj* object) { + ObjInstance* entity = (ObjInstance*)object; + if (!entity->EntityPtr) + return nullptr; + return (ScriptEntity*)entity->EntityPtr; +} +ScriptEntity* GetScriptEntity(VMValue* args, int index, Uint32 threadID) { ObjInstance* entity = GET_ARG(index, GetInstance); if (!entity->EntityPtr) return nullptr; return (ScriptEntity*)entity->EntityPtr; } bool TestEntityCollision(ScriptEntity* other, ScriptEntity* self) { - if (!other->Active || other->Removed) return false; - // if (!other->Instance) return false; - if (other->HitboxW == 0.0f || - other->HitboxH == 0.0f) return false; - - if (other->X + other->HitboxW / 2.0f >= self->X - self->HitboxW / 2.0f && - other->Y + other->HitboxH / 2.0f >= self->Y - self->HitboxH / 2.0f && - other->X - other->HitboxW / 2.0f < self->X + self->HitboxW / 2.0f && - other->Y - other->HitboxH / 2.0f < self->Y + self->HitboxH / 2.0f) { + if (!other->Active || other->Removed) + return false; + + return self->CollideWithObject(other); +} +PUBLIC STATIC bool ScriptEntity::VM_Getter(Obj* object, Uint32 hash, VMValue* result, Uint32 threadID) { + Entity* self = GetScriptEntity(object); + + if (hash == Hash_HitboxLeft) { + if (result) + *result = DECIMAL_VAL(self->Hitbox.GetLeft()); + return true; + } + else if (hash == Hash_HitboxTop) { + if (result) + *result = DECIMAL_VAL(self->Hitbox.GetTop()); + return true; + } + else if (hash == Hash_HitboxRight) { + if (result) + *result = DECIMAL_VAL(self->Hitbox.GetRight()); + return true; + } + else if (hash == Hash_HitboxBottom) { + if (result) + *result = DECIMAL_VAL(self->Hitbox.GetBottom()); + return true; + } + + return false; +} +PUBLIC STATIC bool ScriptEntity::VM_Setter(Obj* object, Uint32 hash, VMValue value, Uint32 threadID) { + Entity* self = GetScriptEntity(object); + + if (hash == Hash_HitboxLeft) { + if (ScriptManager::DoDecimalConversion(value, threadID)) + self->Hitbox.SetLeft(AS_DECIMAL(value)); + return true; + } + else if (hash == Hash_HitboxTop) { + if (ScriptManager::DoDecimalConversion(value, threadID)) + self->Hitbox.SetTop(AS_DECIMAL(value)); + return true; + } + else if (hash == Hash_HitboxRight) { + if (ScriptManager::DoDecimalConversion(value, threadID)) + self->Hitbox.SetRight(AS_DECIMAL(value)); + return true; + } + else if (hash == Hash_HitboxBottom) { + if (ScriptManager::DoDecimalConversion(value, threadID)) + self->Hitbox.SetBottom(AS_DECIMAL(value)); return true; } + return false; } /*** @@ -999,12 +1115,12 @@ PUBLIC STATIC VMValue ScriptEntity::VM_SetAnimation(int argCount, VMValue* args, if (!self) return NULL_VAL; - if (self->Sprite < 0) { - ScriptManager::Threads[threadID].ThrowRuntimeError(false, "this.Sprite is not set!", animation); + ISprite* sprite = Scene::GetSpriteResource(self->Sprite); + if (!sprite) { + ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Sprite is not set!", animation); return NULL_VAL; } - ISprite* sprite = Scene::SpriteList[self->Sprite]->AsSprite; if (!(animation >= 0 && (size_t)animation < sprite->Animations.size())) { ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Animation %d is not in bounds of sprite.", animation); return NULL_VAL; @@ -1034,12 +1150,12 @@ PUBLIC STATIC VMValue ScriptEntity::VM_ResetAnimation(int argCount, VMValue* arg return NULL_VAL; int spriteIns = self->Sprite; - if (!(spriteIns > -1 && (size_t)spriteIns < Scene::SpriteList.size())) { + ISprite* sprite = Scene::GetSpriteResource(spriteIns); + if (!sprite) { ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Sprite %d does not exist!", spriteIns); return NULL_VAL; } - ISprite* sprite = Scene::SpriteList[self->Sprite]->AsSprite; if (!(animation >= 0 && (Uint32)animation < sprite->Animations.size())) { ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Animation %d is not in bounds of sprite.", animation); return NULL_VAL; @@ -1064,6 +1180,33 @@ PUBLIC STATIC VMValue ScriptEntity::VM_Animate(int argCount, VMValue* args, Uint self->Animate(); return NULL_VAL; } + +/*** + * \method GetIDWithinClass + * \desc Gets the ordered ID of the entity amongst other entities of the same type. + * \return Returns an Integer value. + * \ns Instance + */ +PUBLIC STATIC VMValue ScriptEntity::VM_GetIDWithinClass(int argCount, VMValue* args, Uint32 threadID) { + StandardLibrary::CheckArgCount(argCount, 1); + Entity* self = GET_ENTITY(0); + if (!self || !self->List) + return NULL_VAL; + + Entity* other = self->List->EntityFirst; + int num = 0; + + while (other) { + if (self == other) + break; + + num++; + other = other->NextEntityInList; + } + + return INTEGER_VAL(num); +} + /*** * \method AddToRegistry * \desc Adds the entity to a registry. @@ -1118,7 +1261,6 @@ PUBLIC STATIC VMValue ScriptEntity::VM_RemoveFromRegistry(int argCount, VMValue* /*** * \method ApplyMotion * \desc Applies gravity and velocities to the entity. - * \return * \ns Instance */ PUBLIC STATIC VMValue ScriptEntity::VM_ApplyMotion(int argCount, VMValue* args, Uint32 threadID) { @@ -1188,8 +1330,8 @@ PUBLIC STATIC VMValue ScriptEntity::VM_CollidedWithObject(int argCount, VMValue* return NULL_VAL; } - if (self->HitboxW == 0.0f || - self->HitboxH == 0.0f) return NULL_VAL; + if (self->Hitbox.Width == 0.0f || self->Hitbox.Height == 0.0f) + return NULL_VAL; ScriptEntity* other = NULL; ObjectList* objectList = Scene::ObjectLists->Get(object); @@ -1220,7 +1362,7 @@ PUBLIC STATIC VMValue ScriptEntity::VM_GetHitboxFromSprite(int argCount, VMValue int frame = GET_ARG(3, GetInteger); int hitbox = GET_ARG(4, GetInteger); - if (!self) + if (!self || !sprite) return NULL_VAL; if (!(animation > -1 && (size_t)animation < sprite->Animations.size())) { @@ -1236,23 +1378,16 @@ PUBLIC STATIC VMValue ScriptEntity::VM_GetHitboxFromSprite(int argCount, VMValue if (!(hitbox > -1 && hitbox < frameO.BoxCount)) { // ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Hitbox %d is not in bounds of frame %d.", hitbox, frame); - self->HitboxW = 0; - self->HitboxH = 0; - self->HitboxOffX = 0; - self->HitboxOffY = 0; - return NULL_VAL; + self->Hitbox.Clear(); + } + else { + self->Hitbox.Set(frameO.Boxes[hitbox]); } - - CollisionBox box = frameO.Boxes[hitbox]; - self->HitboxW = box.Right - box.Left; - self->HitboxH = box.Bottom - box.Top; - self->HitboxOffX = box.Left + self->HitboxW * 0.5f; - self->HitboxOffY = box.Top + self->HitboxH * 0.5f; return NULL_VAL; } /*** - * \method GetHitboxFromSprite + * \method ReturnHitboxFromSprite * \desc Gets the hitbox in the specified sprite's animation, frame and hitbox ID. * \param sprite (Sprite): The sprite. * \param animation (Integer): The animation index. @@ -1269,7 +1404,7 @@ PUBLIC STATIC VMValue ScriptEntity::VM_ReturnHitboxFromSprite(int argCount, VMVa int frame = GET_ARG(3, GetInteger); int hitbox = GET_ARG(4, GetInteger); - if (!self) + if (!self || !sprite) return NULL_VAL; if (!(animation > -1 && (size_t)animation < sprite->Animations.size())) { diff --git a/source/Engine/Bytecode/ScriptManager.cpp b/source/Engine/Bytecode/ScriptManager.cpp index efd8da0a..5d079b16 100644 --- a/source/Engine/Bytecode/ScriptManager.cpp +++ b/source/Engine/Bytecode/ScriptManager.cpp @@ -23,11 +23,12 @@ class ScriptManager { static VMThread Threads[8]; static Uint32 ThreadCount; - static vector AllFunctionList; + static vector ModuleList; static HashMap* Sources; static HashMap* Classes; static HashMap* Tokens; + static vector AllNamespaces; static vector ClassImplList; static SDL_mutex* GlobalLock; @@ -44,6 +45,7 @@ class ScriptManager { #include #include #include +#include #include #include #include @@ -63,11 +65,12 @@ HashMap* ScriptManager::Constants = NULL; std::set ScriptManager::FreedGlobals; -vector ScriptManager::AllFunctionList; +vector ScriptManager::ModuleList; HashMap* ScriptManager::Sources = NULL; HashMap* ScriptManager::Classes = NULL; HashMap* ScriptManager::Tokens = NULL; +vector ScriptManager::AllNamespaces; vector ScriptManager::ClassImplList; SDL_mutex* ScriptManager::GlobalLock = NULL; @@ -120,6 +123,7 @@ PUBLIC STATIC void ScriptManager::Init() { ArrayImpl::Init(); MapImpl::Init(); FunctionImpl::Init(); + StringImpl::Init(); memset(VMThread::InstructionIgnoreMap, 0, sizeof(VMThread::InstructionIgnoreMap)); @@ -153,6 +157,7 @@ PUBLIC STATIC void ScriptManager::Dispose() { Constants->ForAll(RemoveNonGlobalableValue); ClassImplList.clear(); + AllNamespaces.clear(); Threads[0].FrameCount = 0; Threads[0].ResetStack(); @@ -174,7 +179,7 @@ PUBLIC STATIC void ScriptManager::Dispose() { Constants = NULL; } - FreeFunctions(); + FreeModules(); if (Sources) { Sources->WithAll([](Uint32 hash, BytecodeContainer bytecode) -> void { @@ -198,8 +203,6 @@ PUBLIC STATIC void ScriptManager::Dispose() { Tokens = NULL; } - ClassImplList.clear(); - SDL_DestroyMutex(GlobalLock); } PRIVATE STATIC void ScriptManager::RemoveNonGlobalableValue(Uint32 hash, VMValue value) { @@ -210,6 +213,7 @@ PRIVATE STATIC void ScriptManager::RemoveNonGlobalableValue(Uint32 hash, VMVa case OBJ_FUNCTION: case OBJ_NATIVE: case OBJ_NAMESPACE: + case OBJ_MODULE: break; default: if (hash) @@ -239,6 +243,8 @@ PRIVATE STATIC void ScriptManager::FreeFunction(ObjFunction* function) { //*/ if (function->Name != NULL) FreeValue(OBJECT_VAL(function->Name)); + if (function->ClassName != NULL) + FreeValue(OBJECT_VAL(function->ClassName)); for (size_t i = 0; i < function->Chunk.Constants->size(); i++) FreeValue((*function->Chunk.Constants)[i]); @@ -247,8 +253,23 @@ PRIVATE STATIC void ScriptManager::FreeFunction(ObjFunction* function) { FREE_OBJ(function, ObjFunction); } +PRIVATE STATIC void ScriptManager::FreeModule(ObjModule* module) { + if (module->SourceFilename != NULL) + FreeValue(OBJECT_VAL(module->SourceFilename)); + + for (size_t i = 0; i < module->Functions->size(); i++) + FreeFunction((*module->Functions)[i]); + + for (size_t i = 0; i < module->Locals->size(); i++) + FreeValue((*module->Locals)[i]); + + delete module->Functions; + delete module->Locals; + + FREE_OBJ(module, ObjModule); +} PRIVATE STATIC void ScriptManager::FreeClass(ObjClass* klass) { - // Subfunctions are already freed as a byproduct of the AllFunctionList, + // Subfunctions are already freed as a byproduct of the ModuleList, // so just do natives. klass->Methods->ForAll(FreeNativeValue); delete klass->Methods; @@ -331,62 +352,14 @@ PUBLIC STATIC void ScriptManager::FreeGlobalValue(Uint32 hash, VMValue value) } } } -PRIVATE STATIC void ScriptManager::FreeFunctions() { - Log::Print(Log::LOG_VERBOSE, "Freeing %d functions...", AllFunctionList.size()); - for (size_t i = 0; i < AllFunctionList.size(); i++) { - FreeFunction(AllFunctionList[i]); +PRIVATE STATIC void ScriptManager::FreeModules() { + Log::Print(Log::LOG_VERBOSE, "Freeing %d modules...", ModuleList.size()); + for (size_t i = 0; i < ModuleList.size(); i++) { + FreeModule(ModuleList[i]); } - AllFunctionList.clear(); + ModuleList.clear(); Log::Print(Log::LOG_VERBOSE, "Done!"); } -PUBLIC STATIC void ScriptManager::PrintHashTableValues(Uint32 hash, VMValue value) { - if (IS_OBJECT(value)) { - switch (OBJECT_TYPE(value)) { - case OBJ_CLASS: { - printf("OBJ_CLASS: %p (%s)\n", AS_OBJECT(value), Memory::GetName(AS_OBJECT(value))); - break; - } - case OBJ_ENUM: { - printf("OBJ_ENUM: %p (%s)\n", AS_OBJECT(value), Memory::GetName(AS_OBJECT(value))); - break; - } - case OBJ_FUNCTION: { - printf("OBJ_FUNCTION: %p (%s)\n", AS_OBJECT(value), Memory::GetName(AS_OBJECT(value))); - break; - } - case OBJ_NATIVE: { - printf("OBJ_NATIVE: %p (%s)\n", AS_OBJECT(value), Memory::GetName(AS_OBJECT(value))); - break; - } - case OBJ_BOUND_METHOD: { - printf("OBJ_BOUND_METHOD: %p\n", AS_OBJECT(value)); - break; - } - case OBJ_CLOSURE: { - printf("OBJ_CLOSURE: %p\n", AS_OBJECT(value)); - break; - } - case OBJ_INSTANCE: { - printf("OBJ_INSTANCE: %p\n", AS_OBJECT(value)); - break; - } - case OBJ_STRING: { - printf("OBJ_STRING: %p\n", AS_OBJECT(value)); - break; - } - case OBJ_ARRAY: { - printf("OBJ_ARRAY: %p\n", AS_OBJECT(value)); - break; - } - case OBJ_UPVALUE: { - printf("OBJ_UPVALUE: %p\n", AS_OBJECT(value)); - break; - } - default: - break; - } - } -} // #endregion // #region ValueFuncs @@ -521,6 +494,27 @@ PUBLIC STATIC VMValue ScriptManager::DelinkValue(VMValue val) { return val; } +PUBLIC STATIC bool ScriptManager::DoIntegerConversion(VMValue& value, Uint32 threadID) { + VMValue result = ScriptManager::CastValueAsInteger(value); + if (IS_NULL(result)) { + // Conversion failed + ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Expected value to be of type %s; value was of type %s.", GetTypeString(VAL_INTEGER), GetValueTypeString(value)); + return false; + } + value = result; + return true; +} +PUBLIC STATIC bool ScriptManager::DoDecimalConversion(VMValue& value, Uint32 threadID) { + VMValue result = ScriptManager::CastValueAsDecimal(value); + if (IS_NULL(result)) { + // Conversion failed + ScriptManager::Threads[threadID].ThrowRuntimeError(false, "Expected value to be of type %s; value was of type %s.", GetTypeString(VAL_DECIMAL), GetValueTypeString(value)); + return false; + } + value = result; + return true; +} + PUBLIC STATIC void ScriptManager::FreeValue(VMValue value) { if (IS_OBJECT(value)) { Obj* objectPointer = AS_OBJECT(value); @@ -596,11 +590,7 @@ PUBLIC STATIC void ScriptManager::Unlock() { SDL_UnlockMutex(GlobalLock); } -PUBLIC STATIC void ScriptManager::DefineMethod(VMThread* thread, int index, Uint32 hash) { - if ((unsigned)index >= AllFunctionList.size()) - return; - - ObjFunction* function = AllFunctionList[index]; +PUBLIC STATIC void ScriptManager::DefineMethod(VMThread* thread, ObjFunction* function, Uint32 hash) { VMValue methodValue = OBJECT_VAL(function); ObjClass* klass = AS_CLASS(thread->Peek(0)); @@ -609,7 +599,7 @@ PUBLIC STATIC void ScriptManager::DefineMethod(VMThread* thread, int index, U if (hash == klass->Hash) klass->Initializer = methodValue; - function->ClassName = klass->Name; + function->ClassName = CopyString(klass->Name); thread->Pop(); } @@ -702,26 +692,30 @@ PUBLIC STATIC bool ScriptManager::RunBytecode(BytecodeContainer bytecodeConta return false; } - size_t functionListOffset = AllFunctionList.size(); + ObjModule* module = NewModule(); for (size_t i = 0; i < bytecode->Functions.size(); i++) { ObjFunction* function = bytecode->Functions[i]; - function->FunctionListOffset = functionListOffset; - AllFunctionList.push_back(function); + + module->Functions->push_back(function); + + function->Module = module; } - if (!bytecode->SourceFilename) { + if (bytecode->SourceFilename) + module->SourceFilename = CopyString(bytecode->SourceFilename); + else { char fnHash[256]; snprintf(fnHash, sizeof(fnHash), "%08X", filenameHash); - ObjString* srcFilename = CopyString(fnHash); - for (ObjFunction* function : bytecode->Functions) - function->SourceFilename = srcFilename; + module->SourceFilename = CopyString(fnHash); } - Threads[0].RunFunction(bytecode->Functions[0], 0); + ModuleList.push_back(module); delete bytecode; + Threads[0].RunFunction((*module->Functions)[0], 0); + return true; } PUBLIC STATIC bool ScriptManager::CallFunction(char* functionName) { @@ -733,22 +727,19 @@ PUBLIC STATIC bool ScriptManager::CallFunction(char* functionName) { return false; ObjFunction* function = AS_FUNCTION(functionValue); - if (!function) // Does this need to be checked? - return false; - Threads[0].RunEntityFunction(function, 0); return true; } PUBLIC STATIC Entity* ScriptManager::SpawnObject(const char* objectName) { - VMValue val = Globals->Get(Globals->HashFunction(objectName, strlen(objectName))); - if (!IS_CLASS(val)) { - Log::Print(Log::LOG_ERROR, "Can't find class of \"%s\"!", objectName); + ObjClass* klass = GetObjectClass(objectName); + if (!klass) { + Log::Print(Log::LOG_ERROR, "Could not find class of %s!", objectName); return nullptr; } ScriptEntity* object = new ScriptEntity; - ObjInstance* instance = NewInstance(AS_CLASS(val)); + ObjInstance* instance = NewInstance(klass); object->Link(instance); return object; @@ -849,7 +840,7 @@ PUBLIC STATIC bool ScriptManager::LoadObjectClass(const char* objectName, boo // Set native functions for that new object class if (!Classes->Exists(objectName)) { // Log::Print(Log::LOG_VERBOSE, "Setting native functions for class %s...", objectName); - ObjClass* klass = AS_CLASS(Globals->Get(objectName)); + ObjClass* klass = GetObjectClass(objectName); if (!klass) { Log::Print(Log::LOG_ERROR, "Could not find class of %s!", objectName); return false; @@ -885,14 +876,23 @@ PUBLIC STATIC void ScriptManager::AddNativeObjectFunctions(ObjClass* klass) { DEF_NATIVE(AddToDrawGroup); DEF_NATIVE(IsInDrawGroup); DEF_NATIVE(RemoveFromDrawGroup); + DEF_NATIVE(GetIDWithinClass); DEF_NATIVE(PlaySound); DEF_NATIVE(LoopSound); DEF_NATIVE(StopSound); DEF_NATIVE(StopAllSounds); #undef DEF_NATIVE } -PUBLIC STATIC Entity* ScriptManager::ObjectSpawnFunction(const char* objectName) { - return ScriptManager::SpawnObject(objectName); +PUBLIC STATIC ObjClass* ScriptManager::GetObjectClass(const char* className) { + VMValue value = Globals->Get(className); + + if (IS_CLASS(value)) + return AS_CLASS(value); + + return nullptr; +} +PUBLIC STATIC Entity* ScriptManager::ObjectSpawnFunction(ObjectList* list) { + return ScriptManager::SpawnObject(list->ObjectName); } PUBLIC STATIC void ScriptManager::LoadClasses() { SourceFileMap::ClassMap->ForAll([](Uint32, vector* filenameHashList) -> void { diff --git a/source/Engine/Bytecode/SourceFileMap.cpp b/source/Engine/Bytecode/SourceFileMap.cpp index 29fb8a17..68d4e8ab 100644 --- a/source/Engine/Bytecode/SourceFileMap.cpp +++ b/source/Engine/Bytecode/SourceFileMap.cpp @@ -149,7 +149,8 @@ PUBLIC STATIC void SourceFileMap::CheckForUpdate() { SourceFileMap::ClassMap->Clear(); } - const char* scriptFolderPath = (std::string(scriptFolder) + "/").c_str(); + std::string scriptFolderPathStr = std::string(scriptFolder) + "/"; + const char* scriptFolderPath = scriptFolderPathStr.c_str(); size_t scriptFolderPathLen = strlen(scriptFolderPath); for (size_t i = 0; i < list.size(); i++) { diff --git a/source/Engine/Bytecode/StandardLibrary.cpp b/source/Engine/Bytecode/StandardLibrary.cpp index 24f83a3c..18abff2c 100644 --- a/source/Engine/Bytecode/StandardLibrary.cpp +++ b/source/Engine/Bytecode/StandardLibrary.cpp @@ -25,6 +25,7 @@ class StandardLibrary { #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ class StandardLibrary { #include #include #include +#include #include #include #include @@ -42,6 +44,8 @@ class StandardLibrary { #include #include #include +#include +#include #include #include #include @@ -236,32 +240,31 @@ namespace LOCAL { return value; } - inline ISprite* GetSprite(VMValue* args, int index, Uint32 threadID) { - int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::SpriteList.size()) { + inline ISprite* GetSpriteIndex(int where, Uint32 threadID) { + if (where < 0 || where >= (int)Scene::SpriteList.size()) { if (THROW_ERROR( "Sprite index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::SpriteList[where]) return NULL; return Scene::SpriteList[where]->AsSprite; } - inline ISprite* GetSpriteIndex(int index) { - if (index < 0 || index > (int)Scene::SpriteList.size() || !Scene::SpriteList[index]) - return NULL; - - if (!Scene::SpriteList[index]) return NULL; - - return Scene::SpriteList[index]->AsSprite; + inline ISprite* GetSprite(VMValue* args, int index, Uint32 threadID) { + int where = GetInteger(args, index, threadID); + return GetSpriteIndex(where, threadID); } inline Image* GetImage(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::ImageList.size()) { + if (where < 0 || where >= (int)Scene::ImageList.size()) { if (THROW_ERROR( "Image index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::ImageList[where]) return NULL; @@ -270,10 +273,12 @@ namespace LOCAL { } inline GameTexture* GetTexture(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::TextureList.size()) { + if (where < 0 || where >= (int)Scene::TextureList.size()) { if (THROW_ERROR( "Texture index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::TextureList[where]) return NULL; @@ -282,10 +287,12 @@ namespace LOCAL { } inline ISound* GetSound(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::SoundList.size()) { + if (where < 0 || where >= (int)Scene::SoundList.size()) { if (THROW_ERROR( "Sound index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::SoundList[where]) return NULL; @@ -294,10 +301,12 @@ namespace LOCAL { } inline ISound* GetMusic(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where >(int)Scene::MusicList.size()) { + if (where < 0 || where >= (int)Scene::MusicList.size()) { if (THROW_ERROR( "Music index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::MusicList[where]) return NULL; @@ -306,10 +315,12 @@ namespace LOCAL { } inline IModel* GetModel(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::ModelList.size()) { + if (where < 0 || where >= (int)Scene::ModelList.size()) { if (THROW_ERROR( "Model index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::ModelList[where]) return NULL; @@ -318,10 +329,12 @@ namespace LOCAL { } inline MediaBag* GetVideo(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::MediaList.size()) { + if (where < 0 || where >= (int)Scene::MediaList.size()) { if (THROW_ERROR( "Video index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) ScriptManager::Threads[threadID].ReturnFromNative(); + + return NULL; } if (!Scene::MediaList[where]) return NULL; @@ -330,8 +343,13 @@ namespace LOCAL { } inline Animator* GetAnimator(VMValue* args, int index, Uint32 threadID) { int where = GetInteger(args, index, threadID); - if (where < 0 || where > (int)Scene::AnimatorList.size()) + if (where < 0 || where >= (int)Scene::AnimatorList.size()) { + if (THROW_ERROR( + "Animator index \"%d\" outside bounds of list.", where) == ERROR_RES_CONTINUE) + ScriptManager::Threads[threadID].ReturnFromNative(); + return NULL; + } if (!Scene::AnimatorList[where]) return NULL; @@ -519,7 +537,7 @@ VMValue Animator_SetAnimation(int argCount, VMValue* args, Uint32 threadID) { } ISprite* sprite = Scene::SpriteList[spriteIndex]->AsSprite; - if (animationID < 0 || animationID >= (int)sprite->Animations.size()) { + if (!sprite || animationID < 0 || animationID >= (int)sprite->Animations.size()) { animator->CurrentAnimation = -1; return NULL_VAL; } @@ -562,10 +580,10 @@ VMValue Animator_Animate(int argCount, VMValue* args, Uint32 threadID) { if (!animator || !animator->Frames.size()) return NULL_VAL; - if (animator->Sprite < 0 || animator->Sprite >= (int)Scene::SpriteList.size()) + ISprite* sprite = Scene::GetSpriteResource(animator->Sprite); + if (!sprite) return NULL_VAL; - ISprite* sprite = Scene::SpriteList[animator->Sprite]->AsSprite; if (animator->CurrentAnimation < 0 || animator->CurrentAnimation >= (int)sprite->Animations.size() || animator->CurrentFrame < 0 || animator->CurrentFrame >= (int)sprite->Animations[animator->CurrentAnimation].Frames.size()) { return NULL_VAL; @@ -1310,19 +1328,19 @@ VMValue Array_Shift(int argCount, VMValue* args, Uint32 threadID) { ObjArray* array = GET_ARG(0, GetArray); int toright = GET_ARG(1, GetInteger); - if (array->Values->size() > 1) { - if (toright) { - size_t lastIndex = array->Values->size() - 1; - VMValue temp = (*array->Values)[lastIndex]; - array->Values->erase(array->Values->begin() + lastIndex); - array->Values->insert(array->Values->begin(), temp); - } - else { - VMValue temp = (*array->Values)[0]; - array->Values->erase(array->Values->begin() + 0); - array->Values->push_back(temp); - } - } + if (array->Values->size() > 1) { + if (toright) { + size_t lastIndex = array->Values->size() - 1; + VMValue temp = (*array->Values)[lastIndex]; + array->Values->erase(array->Values->begin() + lastIndex); + array->Values->insert(array->Values->begin(), temp); + } + else { + VMValue temp = (*array->Values)[0]; + array->Values->erase(array->Values->begin() + 0); + array->Values->push_back(temp); + } + } ScriptManager::Unlock(); } @@ -1341,11 +1359,11 @@ VMValue Array_SetAll(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(4); if (ScriptManager::Lock()) { ObjArray* array = GET_ARG(0, GetArray); - size_t startIndex = GET_ARG(1, GetInteger); - size_t endIndex = GET_ARG(2, GetInteger); + size_t startIndex = GET_ARG(1, GetInteger); + size_t endIndex = GET_ARG(2, GetInteger); VMValue value = args[3]; - size_t arraySize = array->Values->size(); + size_t arraySize = array->Values->size(); if (arraySize > 0) { if (startIndex < 0) startIndex = 0; @@ -1366,6 +1384,83 @@ VMValue Array_SetAll(int argCount, VMValue* args, Uint32 threadID) { } return NULL_VAL; } +/*** + * Array.Reverse + * \desc Reverses the elements of an array through the specified range, exclusive. The array is reversed from startIndex to, but not including, endIndex. + * \param array (Array): Array to reverse. + * \paramOpt startIndex (Integer): Start range. Default is zero. + * \paramOpt endIndex (Integer): End range. Default is size of array. + * \ns Array + */ +VMValue Array_Reverse(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + if (ScriptManager::Lock()) { + ObjArray* array = GET_ARG(0, GetArray); + int startIndex = GET_ARG_OPT(1, GetInteger, 0); + int endIndex = GET_ARG_OPT(2, GetInteger, array->Values->size()); + + if (startIndex < 0 || startIndex >= (int)array->Values->size() || startIndex >= endIndex) { + THROW_ERROR("Start index out of range."); + return NULL_VAL; + } + if (endIndex <= 0 || endIndex > (int)array->Values->size() || endIndex <= startIndex) { + THROW_ERROR("End index out of range."); + return NULL_VAL; + } + + std::reverse(array->Values->begin() + startIndex, array->Values->begin() + endIndex); + + ScriptManager::Unlock(); + } + return NULL_VAL; +} +/*** + * Array.Sort + * \desc Sorts the entries of the given array. + * \param array (Array): Array to sort. + * \paramOpt compFunction (Function): Comparison function. If not given, a default comparison function is used; the entries of the array are sorted in ascending order, and non-numeric values do not participate in the comparison. + * \ns Array + */ +VMValue Array_Sort(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + if (ScriptManager::Lock()) { + ObjArray* array = GET_ARG(0, GetArray); + ObjFunction* function = GET_ARG_OPT(1, GetFunction, nullptr); + + if (function) { + VMThread* thread = &ScriptManager::Threads[threadID]; + + std::stable_sort(array->Values->begin(), array->Values->end(), [array, thread, function](const VMValue& a, const VMValue& b) { + thread->Push(a); + thread->Push(b); + + VMValue result = thread->RunEntityFunction(function, 2); + + thread->Pop(2); + + if (IS_INTEGER(result)) + return AS_INTEGER(result) == 1; + + return false; + }); + } else { + std::stable_sort(array->Values->begin(), array->Values->end(), [array](const VMValue& a, const VMValue& b) { + if (IS_NOT_NUMBER(a) || IS_NOT_NUMBER(b)) { + return false; + } + else if (IS_DECIMAL(a) || IS_DECIMAL(b)) { + return AS_DECIMAL(ScriptManager::CastValueAsDecimal(a)) < AS_DECIMAL(ScriptManager::CastValueAsDecimal(b)); + } + else { + return AS_INTEGER(a) < AS_INTEGER(b); + } + }); + } + + ScriptManager::Unlock(); + } + return NULL_VAL; +} // #endregion // #region Controller @@ -1467,14 +1562,33 @@ CONTROLLER_GET_BOOL(HasMicrophoneButton) */ CONTROLLER_GET_BOOL(HasPaddles) /*** - * Controller.GetButton - * \desc Gets the button value from the controller at the index. + * Controller.IsButtonHeld + * \desc Checks if a button is held. * \param controllerIndex (Integer): Index of the controller to check. * \param buttonIndex (Enum): Index of the button to check. - * \return Returns the button value from the controller at the index. + * \return Returns a Boolean value. * \ns Controller */ -VMValue Controller_GetButton(int argCount, VMValue* args, Uint32 threadID) { +VMValue Controller_IsButtonHeld(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int index = GET_ARG(0, GetInteger); + int button = GET_ARG(1, GetInteger); + CHECK_CONTROLLER_INDEX(index); + if (button < 0 || button >= (int)ControllerButton::Max) { + THROW_ERROR("Controller button %d out of range.", button); + return NULL_VAL; + } + return INTEGER_VAL(InputManager::ControllerIsButtonHeld(index, button)); +} +/*** + * Controller.IsButtonPressed + * \desc Checks if a button is pressed. + * \param controllerIndex (Integer): Index of the controller to check. + * \param buttonIndex (Enum): Index of the button to check. + * \return Returns a Boolean value. + * \ns Controller + */ +VMValue Controller_IsButtonPressed(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); int index = GET_ARG(0, GetInteger); int button = GET_ARG(1, GetInteger); @@ -1483,7 +1597,18 @@ VMValue Controller_GetButton(int argCount, VMValue* args, Uint32 threadID) { THROW_ERROR("Controller button %d out of range.", button); return NULL_VAL; } - return INTEGER_VAL(InputManager::ControllerGetButton(index, button)); + return INTEGER_VAL(InputManager::ControllerIsButtonPressed(index, button)); +} +/*** + * Controller.GetButton + * \desc Gets the button value from the controller at the index. (Deprecated; use instead.) + * \param controllerIndex (Integer): Index of the controller to check. + * \param buttonIndex (Enum): Index of the button to check. + * \return Returns the button value from the controller at the index. + * \ns Controller + */ +VMValue Controller_GetButton(int argCount, VMValue* args, Uint32 threadID) { + return Controller_IsButtonHeld(argCount, args, threadID); } /*** * Controller.GetAxis @@ -1562,8 +1687,7 @@ CONTROLLER_GET_BOOL(IsRumbleActive) * Controller.Rumble * \desc Rumbles a controller. * \param controllerIndex (Integer): Index of the controller to rumble. - * \param largeMotorFrequency (Number): Frequency of the large motor. (0.0 - 1.0) - * \param smallMotorFrequency (Number): Frequency of the small motor. (0.0 - 1.0) + * \param strength (Number): Rumble strength. (0.0 - 1.0) * \param duration (Integer): Duration in milliseconds. Use 0 for infinite duration. * \ns Controller */ @@ -1644,7 +1768,7 @@ VMValue Controller_SetRumblePaused(int argCount, VMValue* args, Uint32 threadID) } /*** * Controller.SetLargeMotorFrequency - * \desc Sets the frequency of a controller's large motor. + * \desc Sets the frequency of a controller's large motor. (Deprecated) * \param controllerIndex (Integer): Index of the controller. * \param frequency (Number): Frequency of the large motor. * \ns Controller @@ -1663,7 +1787,7 @@ VMValue Controller_SetLargeMotorFrequency(int argCount, VMValue* args, Uint32 th } /*** * Controller.SetSmallMotorFrequency - * \desc Sets the frequency of a controller's small motor. + * \desc Sets the frequency of a controller's small motor. (Deprecated) * \param controllerIndex (Integer): Index of the controller. * \param frequency (Number): Frequency of the small motor. * \ns Controller @@ -1746,13 +1870,13 @@ VMValue Date_GetTimeOfDay(int argCount, VMValue* args, Uint32 threadID) { int hour = ((int)time(NULL) / 3600) % 24; if (hour >= 5 && hour <= 11) - return INTEGER_VAL(MORNING); + return INTEGER_VAL((int)TimeOfDay::MORNING); else if (hour >= 12 && hour <= 16) - return INTEGER_VAL(MIDDAY); + return INTEGER_VAL((int)TimeOfDay::MIDDAY); else if (hour >= 17 && hour <= 20) - return INTEGER_VAL(EVENING); + return INTEGER_VAL((int)TimeOfDay::EVENING); else - return INTEGER_VAL(NIGHT); + return INTEGER_VAL((int)TimeOfDay::NIGHT); } /*** * Date.GetTicks @@ -1932,8 +2056,9 @@ VMValue Display_GetHeight(int argCount, VMValue* args, Uint32 threadID) { * \param flipY (Integer): Whether or not to flip the sprite vertically. * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. - * \paramOpt rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true - * \paramOpt useInteger (Number): Whether or not the rotation argument is already in radians + * \paramOpt rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true. + * \paramOpt useInteger (Number): Whether or not the rotation argument is already in radians. + * \paramOpt paletteID (Integer): Which palette index to use. * \ns Draw */ VMValue Draw_Sprite(int argCount, VMValue* args, Uint32 threadID) { @@ -1946,18 +2071,11 @@ VMValue Draw_Sprite(int argCount, VMValue* args, Uint32 threadID) { int y = (int)GET_ARG(4, GetDecimal); int flipX = GET_ARG(5, GetInteger); int flipY = GET_ARG(6, GetInteger); - float scaleX = 1.0f; - float scaleY = 1.0f; - float rotation = 0.0f; - bool useInteger = false; - if (argCount > 7) - scaleX = GET_ARG(7, GetDecimal); - if (argCount > 8) - scaleY = GET_ARG(8, GetDecimal); - if (argCount > 9) - rotation = GET_ARG(9, GetDecimal); - if (argCount > 10) - useInteger = GET_ARG(10, GetInteger); + float scaleX = GET_ARG_OPT(7, GetDecimal, 1.0f); + float scaleY = GET_ARG_OPT(8, GetDecimal, 1.0f); + float rotation = GET_ARG_OPT(9, GetDecimal, 0.0f); + bool useInteger = GET_ARG_OPT(10, GetInteger, false); + unsigned paletteID = GET_ARG_OPT(11, GetInteger, 0); if (sprite && animation >= 0 && frame >= 0) { if (useInteger) { @@ -1974,7 +2092,7 @@ VMValue Draw_Sprite(int argCount, VMValue* args, Uint32 threadID) { rotation = rot * M_PI / 256.0; } - Graphics::DrawSprite(sprite, animation, frame, x, y, flipX, flipY, scaleX, scaleY, rotation); + Graphics::DrawSprite(sprite, animation, frame, x, y, flipX, flipY, scaleX, scaleY, rotation, paletteID); } return NULL_VAL; } @@ -1990,7 +2108,7 @@ VMValue Draw_SpriteBasic(int argCount, VMValue* args, Uint32 threadID) { ObjInstance* instance = GET_ARG(0, GetInstance); Entity* entity = (Entity*)instance->EntityPtr; - ISprite* sprite = GET_ARG_OPT(1, GetSprite, GetSpriteIndex(entity->Sprite)); + ISprite* sprite = GET_ARG_OPT(1, GetSprite, GetSpriteIndex(entity->Sprite, threadID)); float rotation = 0.0f; if (entity && sprite && entity->CurrentAnimation >= 0 && entity->CurrentFrame >= 0) { @@ -2039,7 +2157,7 @@ VMValue Draw_Animator(int argCount, VMValue* args, Uint32 threadID) { return NULL_VAL; if (animator->Sprite >= 0 && animator->CurrentAnimation >= 0 && animator->CurrentFrame >= 0) { - ISprite* sprite = GetSpriteIndex(animator->Sprite); + ISprite* sprite = GetSpriteIndex(animator->Sprite, threadID); if (!sprite) return NULL_VAL; @@ -2073,14 +2191,17 @@ VMValue Draw_AnimatorBasic(int argCount, VMValue* args, Uint32 threadID) { Animator* animator = GET_ARG(0, GetAnimator); ObjInstance* instance = GET_ARG(1, GetInstance); Entity* entity = (Entity*)instance->EntityPtr; - ISprite* sprite = (argCount > 2) ? GetSpriteIndex(GET_ARG(2, GetInteger)) : GetSpriteIndex(animator->Sprite); + ISprite* sprite = (argCount > 2) ? GET_ARG(2, GetSprite) : GetSpriteIndex(animator->Sprite, threadID); float rotation = 0.0f; if (!animator || !animator->Frames.size()) return NULL_VAL; if (entity && animator->Sprite >= 0 && animator->CurrentAnimation >= 0 && animator->CurrentFrame >= 0) { - ISprite* sprite = GetSpriteIndex(animator->Sprite); + ISprite* animatorSprite = GetSpriteIndex(animator->Sprite, threadID); + if (animatorSprite) + sprite = animatorSprite; + if (!sprite) return NULL_VAL; @@ -2116,8 +2237,9 @@ VMValue Draw_AnimatorBasic(int argCount, VMValue* args, Uint32 threadID) { * \param flipY (Integer): Whether or not to flip the sprite vertically. * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. - * \paramOpt rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true - * \paramOpt useInteger (Number): Whether or not the rotation argument is already in radians + * \paramOpt rotation (Number): Rotation of the drawn sprite in radians, or in integer if useInteger is true. + * \paramOpt useInteger (Number): Whether or not the rotation argument is already in radians. + * \paramOpt paletteID (Integer): Which palette index to use. * \ns Draw */ VMValue Draw_SpritePart(int argCount, VMValue* args, Uint32 threadID) { @@ -2134,18 +2256,11 @@ VMValue Draw_SpritePart(int argCount, VMValue* args, Uint32 threadID) { int sh = (int)GET_ARG(8, GetDecimal); int flipX = GET_ARG(9, GetInteger); int flipY = GET_ARG(10, GetInteger); - float scaleX = 1.0f; - float scaleY = 1.0f; - float rotation = 0.0f; - bool useInteger = false; - if (argCount > 11) - scaleX = GET_ARG(11, GetDecimal); - if (argCount > 12) - scaleY = GET_ARG(12, GetDecimal); - if (argCount > 13) - rotation = GET_ARG(13, GetDecimal); - if (argCount > 14) - useInteger = GET_ARG(14, GetInteger); + float scaleX = GET_ARG_OPT(11, GetDecimal, 1.0f); + float scaleY = GET_ARG_OPT(12, GetDecimal, 1.0f); + float rotation = GET_ARG_OPT(13, GetDecimal, 0.0f); + bool useInteger = GET_ARG_OPT(14, GetInteger, false); + unsigned paletteID = GET_ARG_OPT(15, GetInteger, 0); if (sprite && animation >= 0 && frame >= 0) { if (useInteger) { @@ -2162,7 +2277,7 @@ VMValue Draw_SpritePart(int argCount, VMValue* args, Uint32 threadID) { rotation = rot * M_PI / 256.0; } - Graphics::DrawSpritePart(sprite, animation, frame, sx, sy, sw, sh, x, y, flipX, flipY, scaleX, scaleY, rotation); + Graphics::DrawSpritePart(sprite, animation, frame, sx, sy, sw, sh, x, y, flipX, flipY, scaleX, scaleY, rotation, paletteID); } return NULL_VAL; } @@ -2181,7 +2296,8 @@ VMValue Draw_Image(int argCount, VMValue* args, Uint32 threadID) { float x = GET_ARG(1, GetDecimal); float y = GET_ARG(2, GetDecimal); - Graphics::DrawTexture(image->TexturePtr, 0, 0, image->TexturePtr->Width, image->TexturePtr->Height, x, y, image->TexturePtr->Width, image->TexturePtr->Height); + if (image) + Graphics::DrawTexture(image->TexturePtr, 0, 0, image->TexturePtr->Width, image->TexturePtr->Height, x, y, image->TexturePtr->Width, image->TexturePtr->Height); return NULL_VAL; } /*** @@ -2207,7 +2323,8 @@ VMValue Draw_ImagePart(int argCount, VMValue* args, Uint32 threadID) { float x = GET_ARG(5, GetDecimal); float y = GET_ARG(6, GetDecimal); - Graphics::DrawTexture(image->TexturePtr, sx, sy, sw, sh, x, y, sw, sh); + if (image) + Graphics::DrawTexture(image->TexturePtr, sx, sy, sw, sh, x, y, sw, sh); return NULL_VAL; } /*** @@ -2229,7 +2346,8 @@ VMValue Draw_ImageSized(int argCount, VMValue* args, Uint32 threadID) { float w = GET_ARG(3, GetDecimal); float h = GET_ARG(4, GetDecimal); - Graphics::DrawTexture(image->TexturePtr, 0, 0, image->TexturePtr->Width, image->TexturePtr->Height, x, y, w, h); + if (image) + Graphics::DrawTexture(image->TexturePtr, 0, 0, image->TexturePtr->Width, image->TexturePtr->Height, x, y, w, h); return NULL_VAL; } /*** @@ -2259,7 +2377,8 @@ VMValue Draw_ImagePartSized(int argCount, VMValue* args, Uint32 threadID) { float w = GET_ARG(7, GetDecimal); float h = GET_ARG(8, GetDecimal); - Graphics::DrawTexture(image->TexturePtr, sx, sy, sw, sh, x, y, w, h); + if (image) + Graphics::DrawTexture(image->TexturePtr, sx, sy, sw, sh, x, y, w, h); return NULL_VAL; } /*** @@ -2414,2465 +2533,2337 @@ VMValue Draw_ViewPartSized(int argCount, VMValue* args, Uint32 threadID) { return NULL_VAL; } /*** - * Draw.BindVertexBuffer - * \desc Binds a vertex buffer. - * \param vertexBufferIndex (Integer): Sets the vertex buffer to bind. + * Draw.Video + * \desc * \return * \ns Draw */ -VMValue Draw_BindVertexBuffer(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Uint32 vertexBufferIndex = GET_ARG(0, GetInteger); - if (vertexBufferIndex < 0 || vertexBufferIndex >= MAX_VERTEX_BUFFERS) { - OUT_OF_RANGE_ERROR("Vertex index", vertexBufferIndex, 0, MAX_VERTEX_BUFFERS); - return NULL_VAL; - } +VMValue Draw_Video(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); - Graphics::BindVertexBuffer(vertexBufferIndex); + MediaBag* video = GET_ARG(0, GetVideo); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + + Graphics::DrawTexture(video->VideoTexture, 0, 0, video->VideoTexture->Width, video->VideoTexture->Height, x, y, video->VideoTexture->Width, video->VideoTexture->Height); return NULL_VAL; } /*** - * Draw.UnbindVertexBuffer - * \desc Unbinds the currently bound vertex buffer. + * Draw.VideoPart + * \desc * \return * \ns Draw */ -VMValue Draw_UnbindVertexBuffer(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::UnbindVertexBuffer(); +VMValue Draw_VideoPart(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(7); + + MediaBag* video = GET_ARG(0, GetVideo); + float sx = GET_ARG(1, GetDecimal); + float sy = GET_ARG(2, GetDecimal); + float sw = GET_ARG(3, GetDecimal); + float sh = GET_ARG(4, GetDecimal); + float x = GET_ARG(5, GetDecimal); + float y = GET_ARG(6, GetDecimal); + + Graphics::DrawTexture(video->VideoTexture, sx, sy, sw, sh, x, y, sw, sh); return NULL_VAL; } -#define GET_SCENE_3D() \ - if (scene3DIndex < 0 || scene3DIndex >= MAX_3D_SCENES) { \ - OUT_OF_RANGE_ERROR("Scene3D", scene3DIndex, 0, MAX_3D_SCENES - 1); \ - return NULL_VAL; \ - } \ - Scene3D* scene3D = &Graphics::Scene3Ds[scene3DIndex] /*** - * Draw.InitArrayBuffer - * \desc Initializes an array buffer. There are 32 array buffers. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The array buffer at the index to use. (Maximum index: 31) - * \param numVertices (Integer): The initial capacity of this array buffer. + * Draw.VideoSized + * \desc * \return * \ns Draw */ -VMValue Draw_InitArrayBuffer(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - Uint32 numVertices = GET_ARG(1, GetInteger); - GET_SCENE_3D(); +VMValue Draw_VideoSized(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); + + MediaBag* video = GET_ARG(0, GetVideo); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + float w = GET_ARG(3, GetDecimal); + float h = GET_ARG(4, GetDecimal); - Graphics::InitScene3D(scene3DIndex, numVertices); + #ifdef USING_FFMPEG + video->Player->GetVideoData(video->VideoTexture); + #endif + Graphics::DrawTexture(video->VideoTexture, 0, 0, video->VideoTexture->Width, video->VideoTexture->Height, x, y, w, h); return NULL_VAL; } /*** - * Draw.SetArrayBufferDrawMode - * \desc Sets the draw mode of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param drawMode (Integer): The type of drawing to use for the vertices in the array buffer. + * Draw.VideoPartSized + * \desc * \return * \ns Draw */ -VMValue Draw_SetArrayBufferDrawMode(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - Uint32 drawMode = GET_ARG(1, GetInteger); - GET_SCENE_3D(); - scene3D->DrawMode = drawMode; +VMValue Draw_VideoPartSized(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(9); + + MediaBag* video = GET_ARG(0, GetVideo); + float sx = GET_ARG(1, GetDecimal); + float sy = GET_ARG(2, GetDecimal); + float sw = GET_ARG(3, GetDecimal); + float sh = GET_ARG(4, GetDecimal); + float x = GET_ARG(5, GetDecimal); + float y = GET_ARG(6, GetDecimal); + float w = GET_ARG(7, GetDecimal); + float h = GET_ARG(8, GetDecimal); + + Graphics::DrawTexture(video->VideoTexture, sx, sy, sw, sh, x, y, w, h); return NULL_VAL; } /*** - * Draw.SetProjectionMatrix - * \desc Sets the projection matrix. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param projMatrix (Matrix): The projection matrix. - * \return + * Draw.Tile + * \desc Draws a tile. + * \param ID (Integer): ID of the tile to draw. + * \param x (Number): X position of where to draw the tile. + * \param y (Number): Y position of where to draw the tile. + * \param flipX (Integer): Whether or not to flip the tile horizontally. + * \param flipY (Integer): Whether or not to flip the tile vertically. * \ns Draw */ -VMValue Draw_SetProjectionMatrix(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - ObjArray* projMatrix = GET_ARG(1, GetArray); - - Matrix4x4 matrix4x4; - int arrSize = (int)projMatrix->Values->size(); - if (arrSize != 16) { - THROW_ERROR("Matrix has unexpected size (expected 16 elements, but has %d)", arrSize); - return NULL_VAL; - } +VMValue Draw_Tile(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); - // Yeah just copy it directly - for (int i = 0; i < 16; i++) - matrix4x4.Values[i] = AS_DECIMAL((*projMatrix->Values)[i]); + Uint32 id = GET_ARG(0, GetInteger); + int x = (int)GET_ARG(1, GetDecimal) + 8; + int y = (int)GET_ARG(2, GetDecimal) + 8; + int flipX = GET_ARG(3, GetInteger); + int flipY = GET_ARG(4, GetInteger); - GET_SCENE_3D(); - scene3D->SetProjectionMatrix(&matrix4x4); - scene3D->SetClippingPlanes(); + TileSpriteInfo info; + if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) { + Graphics::DrawSprite(info.Sprite, info.AnimationIndex, info.FrameIndex, x, y, flipX, flipY, 1.0f, 1.0f, 0.0f); + } return NULL_VAL; } /*** - * Draw.SetViewMatrix - * \desc Sets the view matrix. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param viewMatrix (Matrix): The view matrix. - * \return + * Draw.Texture + * \desc Draws a texture. + * \param texture (Integer): Texture index. + * \param x (Number): X position of where to draw the texture. + * \param y (Number): Y position of where to draw the texture. * \ns Draw */ -VMValue Draw_SetViewMatrix(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - ObjArray* viewMatrix = GET_ARG(1, GetArray); +VMValue Draw_Texture(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); - Matrix4x4 matrix4x4; + GameTexture* gameTexture = GET_ARG(0, GetTexture); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); - for (int i = 0; i < 16; i++) - matrix4x4.Values[i] = AS_DECIMAL((*viewMatrix->Values)[i]); + if (!gameTexture) + return NULL_VAL; - GET_SCENE_3D(); - scene3D->SetViewMatrix(&matrix4x4); + Texture* texture = gameTexture->GetTexture(); + if (texture) + Graphics::DrawTexture(texture, 0, 0, texture->Width, texture->Height, x, y, texture->Width, texture->Height); return NULL_VAL; } /*** - * Draw.SetAmbientLighting - * \desc Sets the ambient lighting of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param red (Number): The red color value, bounded by 0.0 - 1.0. - * \param green (Number): The green color value, bounded by 0.0 - 1.0. - * \param blue (Number): The blue color value, bounded by 0.0 - 1.0. - * \return + * Draw.TextureSized + * \desc Draws a texture, but sized. + * \param texture (Integer): Texture index. + * \param x (Number): X position of where to draw the texture. + * \param y (Number): Y position of where to draw the texture. + * \param width (Number): Width to draw the texture. + * \param height (Number): Height to draw the texture. * \ns Draw */ -VMValue Draw_SetAmbientLighting(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - float r = Math::Clamp(GET_ARG(1, GetDecimal), 0.0f, 1.0f); - float g = Math::Clamp(GET_ARG(2, GetDecimal), 0.0f, 1.0f); - float b = Math::Clamp(GET_ARG(3, GetDecimal), 0.0f, 1.0f); - GET_SCENE_3D(); - scene3D->SetAmbientLighting(r, g, b); +VMValue Draw_TextureSized(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); + + GameTexture* gameTexture = GET_ARG(0, GetTexture); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + float w = GET_ARG(3, GetDecimal); + float h = GET_ARG(4, GetDecimal); + + if (!gameTexture) + return NULL_VAL; + + Texture* texture = gameTexture->GetTexture(); + if (texture) + Graphics::DrawTexture(texture, 0, 0, texture->Width, texture->Height, x, y, w, h); return NULL_VAL; } /*** - * Draw.SetDiffuseLighting - * \desc Sets the diffuse lighting of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param red (Number): The red color value, bounded by 0.0 - 1.0. - * \param green (Number): The green color value, bounded by 0.0 - 1.0. - * \param blue (Number): The blue color value, bounded by 0.0 - 1.0. - * \return + * Draw.TexturePart + * \desc Draws part of a texture. + * \param texture (Integer): Texture index. + * \param partX (Integer): X coordinate of part of texture to draw. + * \param partY (Integer): Y coordinate of part of texture to draw. + * \param partW (Integer): Width of part of texture to draw. + * \param partH (Integer): Height of part of texture to draw. + * \param x (Number): X position of where to draw the texture. + * \param y (Number): Y position of where to draw the texture. * \ns Draw */ -VMValue Draw_SetDiffuseLighting(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - float r = Math::Clamp(GET_ARG(1, GetDecimal), 0.0f, 1.0f); - float g = Math::Clamp(GET_ARG(2, GetDecimal), 0.0f, 1.0f); - float b = Math::Clamp(GET_ARG(3, GetDecimal), 0.0f, 1.0f); - GET_SCENE_3D(); - scene3D->SetDiffuseLighting(r, g, b); +VMValue Draw_TexturePart(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(7); + + GameTexture* gameTexture = GET_ARG(0, GetTexture); + float sx = GET_ARG(1, GetDecimal); + float sy = GET_ARG(2, GetDecimal); + float sw = GET_ARG(3, GetDecimal); + float sh = GET_ARG(4, GetDecimal); + float x = GET_ARG(5, GetDecimal); + float y = GET_ARG(6, GetDecimal); + + if (!gameTexture) + return NULL_VAL; + + Texture* texture = gameTexture->GetTexture(); + if (texture) + Graphics::DrawTexture(texture, sx, sy, sw, sh, x, y, sw, sh); return NULL_VAL; } -/*** - * Draw.SetSpecularLighting - * \desc Sets the specular lighting of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param red (Number): The red color value, bounded by 0.0 - 1.0. - * \param green (Number): The green color value, bounded by 0.0 - 1.0. - * \param blue (Number): The blue color value, bounded by 0.0 - 1.0. - * \return - * \ns Draw - */ -VMValue Draw_SetSpecularLighting(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - float r = Math::Clamp(GET_ARG(1, GetDecimal), 0.0f, 1.0f); - float g = Math::Clamp(GET_ARG(2, GetDecimal), 0.0f, 1.0f); - float b = Math::Clamp(GET_ARG(3, GetDecimal), 0.0f, 1.0f); - GET_SCENE_3D(); - scene3D->SetSpecularLighting(r, g, b); - return NULL_VAL; + +float textAlign = 0.0f; +float textBaseline = 0.0f; +float textAscent = 1.25f; +float textAdvance = 1.0f; +int _Text_GetLetter(int l) { + if (l < 0) + return ' '; + return l; } /*** - * Draw.SetFogDensity - * \desc Sets the density of the array buffer's fog. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param density (Number): The fog density. + * Draw.SetFont + * \desc * \return * \ns Draw */ -VMValue Draw_SetFogDensity(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - - GET_SCENE_3D(); - scene3D->SetFogDensity(GET_ARG(1, GetDecimal)); +VMValue Draw_SetFont(int argCount, VMValue* args, Uint32 threadID) { return NULL_VAL; } /*** - * Draw.SetFogColor - * \desc Sets the fog color of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param red (Number): The red color value, bounded by 0.0 - 1.0. - * \param green (Number): The green color value, bounded by 0.0 - 1.0. - * \param blue (Number): The blue color value, bounded by 0.0 - 1.0. - * \return + * Draw.SetTextAlign + * \desc Sets the text drawing horizontal alignment. (default: left) + * \param baseline (Integer): 0 for left, 1 for center, 2 for right. * \ns Draw */ -VMValue Draw_SetFogColor(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - float r = Math::Clamp(GET_ARG(1, GetDecimal), 0.0f, 1.0f); - float g = Math::Clamp(GET_ARG(2, GetDecimal), 0.0f, 1.0f); - float b = Math::Clamp(GET_ARG(3, GetDecimal), 0.0f, 1.0f); - GET_SCENE_3D(); - scene3D->SetFogColor(r, g, b); +VMValue Draw_SetTextAlign(int argCount, VMValue* args, Uint32 threadID) { + textAlign = GET_ARG(0, GetInteger) / 2.0f; return NULL_VAL; } /*** - * Draw.SetClipPolygons - * \desc Enables or disables polygon clipping by the view frustum of the array buffer. (Deprecated; software-renderer only.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param clipPolygons (Boolean): Whether or not to clip polygons. - * \return + * Draw.SetTextBaseline + * \desc Sets the text drawing vertical alignment. (default: top) + * \param baseline (Integer): 0 for top, 1 for baseline, 2 for bottom. * \ns Draw */ -VMValue Draw_SetClipPolygons(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - bool clipPolygons = !!GET_ARG(1, GetInteger); - GET_SCENE_3D(); - scene3D->SetClipPolygons(clipPolygons); +VMValue Draw_SetTextBaseline(int argCount, VMValue* args, Uint32 threadID) { + textBaseline = GET_ARG(0, GetInteger) / 2.0f; return NULL_VAL; } /*** - * Draw.SetPointSize - * \desc Sets the point size of the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The index of the array buffer. - * \param pointSize (Decimal): The point size. - * \return + * Draw.SetTextAdvance + * \desc Sets the character spacing multiplier. (default: 1.0) + * \param ascent (Number): Multiplier for character spacing. * \ns Draw */ -VMValue Draw_SetPointSize(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - float pointSize = !!GET_ARG(1, GetDecimal); - GET_SCENE_3D(); - scene3D->PointSize = pointSize; +VMValue Draw_SetTextAdvance(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + textAdvance = GET_ARG(0, GetDecimal); return NULL_VAL; } /*** - * Draw.BindArrayBuffer - * \desc Binds an array buffer for drawing polygons in 3D space. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): Sets the array buffer to bind. - * \return + * Draw.SetTextLineAscent + * \desc Sets the line height multiplier. (default: 1.25) + * \param ascent (Number): Multiplier for line height. * \ns Draw */ -VMValue Draw_BindArrayBuffer(int argCount, VMValue* args, Uint32 threadID) { +VMValue Draw_SetTextLineAscent(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - if (scene3DIndex < 0 || scene3DIndex >= MAX_3D_SCENES) { - OUT_OF_RANGE_ERROR("Scene3D", scene3DIndex, 0, MAX_3D_SCENES - 1); - return NULL_VAL; - } - - Graphics::ClearScene3D(scene3DIndex); - Graphics::BindScene3D(scene3DIndex); - + textAscent = GET_ARG(0, GetDecimal); return NULL_VAL; } /*** - * Draw.BindScene3D - * \desc Binds a 3D scene for drawing polygons in 3D space. - * \param scene3DIndex (Integer): Sets the 3D scene to bind. - * \return + * Draw.MeasureText + * \desc Measures Extended UTF8 text using a sprite or font and stores max width and max height into the array. + * \param outArray (Array): Array to output size values to. + * \param sprite (Integer): Index of the loaded sprite to be used as text. + * \param text (String): Text to measure. + * \return Returns the array inputted into the function. * \ns Draw */ -VMValue Draw_BindScene3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - if (scene3DIndex < 0 || scene3DIndex >= MAX_3D_SCENES) { - OUT_OF_RANGE_ERROR("Scene3D", scene3DIndex, 0, MAX_3D_SCENES - 1); +VMValue Draw_MeasureText(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); + + ObjArray* array = GET_ARG(0, GetArray); + ISprite* sprite = GET_ARG(1, GetSprite); + char* text = GET_ARG(2, GetString); + + if (!sprite) return NULL_VAL; - } - Graphics::BindScene3D(scene3DIndex); - return NULL_VAL; -} -static void PrepareMatrix(Matrix4x4 *output, ObjArray* input) { - MatrixHelper helper; - MatrixHelper_CopyFrom(&helper, input); + float x = 0.0, y = 0.0; + float maxW = 0.0, maxH = 0.0; + float lineHeight = sprite->Animations[0].FrameToLoop; + for (char* i = text; *i; i++) { + if (*i == '\n') { + x = 0.0; + y += lineHeight * textAscent; + goto __MEASURE_Y; + } - for (int i = 0; i < 16; i++) { - int x = i >> 2; - int y = i & 3; - output->Values[i] = helper[x][y]; - } -} -/*** - * Draw.Model - * \desc Draws a model. - * \param modelIndex (Integer): Index of loaded model. - * \param animation (Integer): Animation of model to draw. - * \param frame (Decimal): Frame of model to draw. - * \paramOpt matrixModel (Matrix): Matrix for transforming model coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming model normals. - * \return - * \ns Draw - */ -VMValue Draw_Model(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(5); + x += sprite->Animations[0].Frames[*i].Advance * textAdvance; - IModel* model = GET_ARG(0, GetModel); - int animation = GET_ARG(1, GetInteger); - int frame = GET_ARG(2, GetDecimal) * 0x100; + if (maxW < x) + maxW = x; - ObjArray* matrixModelArr = NULL; - Matrix4x4 matrixModel; - if (!IS_NULL(args[3])) { - matrixModelArr = GET_ARG(3, GetArray); - PrepareMatrix(&matrixModel, matrixModelArr); + __MEASURE_Y: + if (maxH < y + (sprite->Animations[0].Frames[*i].Height - sprite->Animations[0].Frames[*i].OffsetY)) + maxH = y + (sprite->Animations[0].Frames[*i].Height - sprite->Animations[0].Frames[*i].OffsetY); } - ObjArray* matrixNormalArr = NULL; - Matrix4x4 matrixNormal; - if (!IS_NULL(args[4])) { - matrixNormalArr = GET_ARG(4, GetArray); - PrepareMatrix(&matrixNormal, matrixNormalArr); + if (ScriptManager::Lock()) { + array->Values->clear(); + array->Values->push_back(DECIMAL_VAL(maxW)); + array->Values->push_back(DECIMAL_VAL(maxH)); + ScriptManager::Unlock(); + return OBJECT_VAL(array); } - - Graphics::DrawModel(model, animation, frame, matrixModelArr ? &matrixModel : NULL, matrixNormalArr ? &matrixNormal : NULL); - return NULL_VAL; } /*** - * Draw.ModelSkinned - * \desc Draws a skinned model. - * \param modelIndex (Integer): Index of loaded model. - * \param skeleton (Integer): Skeleton of model to skin the model. - * \paramOpt matrixModel (Matrix): Matrix for transforming model coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming model normals. - * \return + * Draw.MeasureTextWrapped + * \desc Measures wrapped Extended UTF8 text using a sprite or font and stores max width and max height into the array. + * \param outArray (Array): Array to output size values to. + * \param sprite (Integer): Index of the loaded sprite to be used as text. + * \param text (String): Text to measure. + * \param maxWidth (Number): Max width that a line can be. + * \paramOpt maxLines (Integer): Max number of lines to measure. + * \return Returns the array inputted into the function. * \ns Draw */ -VMValue Draw_ModelSkinned(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); +VMValue Draw_MeasureTextWrapped(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(4); - IModel* model = GET_ARG(0, GetModel); - int armature = GET_ARG(1, GetInteger); + ObjArray* array = GET_ARG(0, GetArray); + ISprite* sprite = GET_ARG(1, GetSprite); + char* text = GET_ARG(2, GetString); + float max_w = GET_ARG(3, GetDecimal); + int maxLines = 0x7FFFFFFF; + if (argCount > 4) + maxLines = GET_ARG(4, GetInteger); - ObjArray* matrixModelArr = NULL; - Matrix4x4 matrixModel; - if (!IS_NULL(args[2])) { - matrixModelArr = GET_ARG(2, GetArray); - PrepareMatrix(&matrixModel, matrixModelArr); - } + if (!sprite) + return NULL_VAL; - ObjArray* matrixNormalArr = NULL; - Matrix4x4 matrixNormal; - if (!IS_NULL(args[3])) { - matrixNormalArr = GET_ARG(3, GetArray); - PrepareMatrix(&matrixNormal, matrixNormalArr); + int word = 0; + char* linestart = text; + char* wordstart = text; + + float x = 0.0, y = 0.0; + float maxW = 0.0, maxH = 0.0; + float lineHeight = sprite->Animations[0].FrameToLoop; + + int lineNo = 1; + for (char* i = text; ; i++) { + if (((*i == ' ' || *i == 0) && i != wordstart) || *i == '\n') { + float testWidth = 0.0f; + for (char* o = linestart; o < i; o++) { + testWidth += sprite->Animations[0].Frames[*o].Advance * textAdvance; + } + if ((testWidth > max_w && word > 0) || *i == '\n') { + x = 0.0f; + for (char* o = linestart; o < wordstart - 1; o++) { + x += sprite->Animations[0].Frames[*o].Advance * textAdvance; + + if (maxW < x) + maxW = x; + if (maxH < y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY)) + maxH = y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY); + } + + if (lineNo == maxLines) + goto FINISH; + lineNo++; + + linestart = wordstart; + y += lineHeight * textAscent; + } + + wordstart = i + 1; + word++; + } + + if (!*i) + break; } - Graphics::DrawModelSkinned(model, armature, matrixModelArr ? &matrixModel : NULL, matrixNormalArr ? &matrixNormal : NULL); + x = 0.0f; + for (char* o = linestart; *o; o++) { + x += sprite->Animations[0].Frames[*o].Advance * textAdvance; + if (maxW < x) + maxW = x; + if (maxH < y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY)) + maxH = y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY); + } + FINISH: + if (ScriptManager::Lock()) { + array->Values->clear(); + array->Values->push_back(DECIMAL_VAL(maxW)); + array->Values->push_back(DECIMAL_VAL(maxH)); + ScriptManager::Unlock(); + return OBJECT_VAL(array); + } return NULL_VAL; } /*** - * Draw.ModelSimple - * \desc Draws a model without using matrices. - * \param modelIndex (Integer): Index of loaded model. - * \param animation (Integer): Animation of model to draw. - * \param frame (Integer): Frame of model to draw. - * \param x (Number): X position - * \param y (Number): Y position - * \param scale (Number): Model scale - * \param rx (Number): X rotation in radians - * \param ry (Number): Y rotation in radians - * \param rz (Number): Z rotation in radians - * \return + * Draw.Text + * \desc Draws Extended UTF8 text using a sprite or font. + * \param sprite (Integer): Index of the loaded sprite to be used as text. + * \param text (String): Text to draw. + * \param x (Number): X position of where to draw the text. + * \param y (Number): Y position of where to draw the text. * \ns Draw */ -VMValue Draw_ModelSimple(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(9); - - IModel* model = GET_ARG(0, GetModel); - int animation = GET_ARG(1, GetInteger); - int frame = GET_ARG(2, GetDecimal) * 0x100; - float x = GET_ARG(3, GetDecimal); - float y = GET_ARG(4, GetDecimal); - float scale = GET_ARG(5, GetDecimal); - float rx = GET_ARG(6, GetDecimal); - float ry = GET_ARG(7, GetDecimal); - float rz = GET_ARG(8, GetDecimal); - - Matrix4x4 matrixScaleTranslate; - Matrix4x4::IdentityScale(&matrixScaleTranslate, scale, scale, scale); - Matrix4x4::Translate(&matrixScaleTranslate, &matrixScaleTranslate, x, y, 0); +VMValue Draw_Text(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); - Matrix4x4 matrixModel; - Matrix4x4::IdentityRotationXYZ(&matrixModel, 0, ry, rz); - Matrix4x4::Multiply(&matrixModel, &matrixModel, &matrixScaleTranslate); + ISprite* sprite = GET_ARG(0, GetSprite); + char* text = GET_ARG(1, GetString); + float basex = GET_ARG(2, GetDecimal); + float basey = GET_ARG(3, GetDecimal); - Matrix4x4 matrixRotationX; - Matrix4x4::IdentityRotationX(&matrixRotationX, rx); - Matrix4x4 matrixNormal; - Matrix4x4::IdentityRotationXYZ(&matrixNormal, 0, ry, rz); - Matrix4x4::Multiply(&matrixNormal, &matrixNormal, &matrixRotationX); + float x = basex; + float y = basey; + float* lineWidths; + int line = 0; - Graphics::DrawModel(model, animation, frame, &matrixModel, &matrixNormal); - return NULL_VAL; -} + if (!sprite) + return NULL_VAL; -#define PREPARE_MATRICES(matrixModelArr, matrixNormalArr) \ - Matrix4x4* matrixModel = NULL; \ - Matrix4x4* matrixNormal = NULL; \ - Matrix4x4 sMatrixModel, sMatrixNormal; \ - if (matrixModelArr) { \ - matrixModel = &sMatrixModel; \ - PrepareMatrix(matrixModel, matrixModelArr); \ - } \ - if (matrixNormalArr) { \ - matrixNormal = &sMatrixNormal; \ - PrepareMatrix(matrixNormal, matrixNormalArr); \ + // Count lines + for (char* i = text; *i; i++) { + if (*i == '\n') { + line++; + continue; + } } + line++; + lineWidths = (float*)malloc(line * sizeof(float)); + if (!lineWidths) + return NULL_VAL; -static void DrawPolygon3D(VertexAttribute *data, int vertexCount, int vertexFlag, Texture* texture, ObjArray* matrixModelArr, ObjArray* matrixNormalArr) { - PREPARE_MATRICES(matrixModelArr, matrixNormalArr); - Graphics::DrawPolygon3D(data, vertexCount, vertexFlag, texture, matrixModel, matrixNormal); -} - -#define VERTEX_ARGS(num, offset) \ - int argOffset = offset; \ - for (int i = 0; i < num; i++) { \ - data[i].Position.X = FP16_TO(GET_ARG(i * 3 + argOffset, GetDecimal)); \ - data[i].Position.Y = FP16_TO(GET_ARG(i * 3 + argOffset + 1, GetDecimal)); \ - data[i].Position.Z = FP16_TO(GET_ARG(i * 3 + argOffset + 2, GetDecimal)); \ - data[i].Normal.X = data[i].Normal.Y = data[i].Normal.Z = data[i].Normal.W = 0; \ - data[i].UV.X = data[i].UV.Y = 0; \ - } \ - argOffset += 3 * num + // Get line widths + line = 0; + x = 0.0f; + for (char* i = text, l; *i; i++) { + l = _Text_GetLetter((Uint8)*i); + if (l == '\n') { + lineWidths[line++] = x; + x = 0.0f; + continue; + } + x += sprite->Animations[0].Frames[l].Advance * textAdvance; + } + lineWidths[line++] = x; -#define VERTEX_COLOR_ARGS(num) \ - for (int i = 0; i < num; i++) { \ - if (argCount <= i + argOffset) \ - break; \ - if (!IS_NULL(args[i + argOffset])) \ - data[i].Color = GET_ARG(i + argOffset, GetInteger); \ - else \ - data[i].Color = 0xFFFFFF; \ - } \ - argOffset += num + // Draw text + line = 0; + x = basex; + bool lineBack = true; + for (char* i = text, l; *i; i++) { + l = _Text_GetLetter((Uint8)*i); + if (lineBack) { + x -= sprite->Animations[0].Frames[l].OffsetX; + lineBack = false; + } -#define VERTEX_UV_ARGS(num) \ - for (int i = 0; i < num; i++) { \ - if (argCount <= (i * 2) + argOffset) \ - break; \ - if (!IS_NULL(args[(i * 2) + argOffset])) \ - data[i].UV.X = FP16_TO(GET_ARG((i * 2) + argOffset, GetDecimal)); \ - if (!IS_NULL(args[(i * 2) + 1 + argOffset])) \ - data[i].UV.Y = FP16_TO(GET_ARG((i * 2) + 1 + argOffset, GetDecimal)); \ - } \ - argOffset += num * 2 + if (l == '\n') { + x = basex; + y += sprite->Animations[0].FrameToLoop * textAscent; + lineBack = true; + line++; + continue; + } -#define GET_MATRICES(offset) \ - ObjArray* matrixModelArr = NULL; \ - if (argCount > offset && !IS_NULL(args[offset])) \ - matrixModelArr = GET_ARG(offset, GetArray); \ - ObjArray* matrixNormalArr = NULL; \ - if (argCount > offset + 1 && !IS_NULL(args[offset + 1])) \ - matrixNormalArr = GET_ARG(offset + 1, GetArray) + Graphics::DrawSprite(sprite, 0, l, x - lineWidths[line] * textAlign, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames[l].Advance * textAdvance; + } + free(lineWidths); + return NULL_VAL; +} /*** - * Draw.Triangle3D - * \desc Draws a triangle in 3D space. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.TextWrapped + * \desc Draws wrapped Extended UTF8 text using a sprite or font. + * \param sprite (Integer): Index of the loaded sprite to be used as text. + * \param text (String): Text to draw. + * \param x (Number): X position of where to draw the tile. + * \param y (Number): Y position of where to draw the tile. + * \param maxWidth (Number): Max width the text can draw in. + * \param maxLines (Integer): Max lines the text can draw. * \ns Draw */ -VMValue Draw_Triangle3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(9); +VMValue Draw_TextWrapped(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(5); - VertexAttribute data[3]; + ISprite* sprite = GET_ARG(0, GetSprite); + char* text = GET_ARG(1, GetString); + float basex = GET_ARG(2, GetDecimal); + float basey = GET_ARG(3, GetDecimal); + float max_w = GET_ARG(4, GetDecimal); + int maxLines = 0x7FFFFFFF; + if (argCount > 5) + maxLines = GET_ARG(5, GetInteger); - VERTEX_ARGS(3, 0); - VERTEX_COLOR_ARGS(3); - GET_MATRICES(argOffset); + if (!sprite) + return NULL_VAL; - DrawPolygon3D(data, 3, VertexType_Position | VertexType_Color, NULL, matrixModelArr, matrixNormalArr); - return NULL_VAL; -} -/*** - * Draw.Quad3D - * \desc Draws a quadrilateral in 3D space. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \param x4 (Number): X position of the fourth vertex. - * \param y4 (Number): Y position of the fourth vertex. - * \param z4 (Number): Z position of the fourth vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt color4 (Integer): Color of the fourth vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return - * \ns Draw - */ -VMValue Draw_Quad3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(12); + float x = basex; + float y = basey; - VertexAttribute data[4]; + // Draw text + int word = 0; + char* linestart = text; + char* wordstart = text; + bool lineBack = true; + int lineNo = 1; + for (char* i = text, l; ; i++) { + l = _Text_GetLetter((Uint8)*i); + if (((l == ' ' || l == 0) && i != wordstart) || l == '\n') { + float testWidth = 0.0f; + for (char* o = linestart, lm; o < i; o++) { + lm = _Text_GetLetter((Uint8)*o); + testWidth += sprite->Animations[0].Frames[lm].Advance * textAdvance; + } - VERTEX_ARGS(4, 0); - VERTEX_COLOR_ARGS(4); - GET_MATRICES(argOffset); + if ((testWidth > max_w && word > 0) || l == '\n') { + float lineWidth = 0.0f; + for (char* o = linestart, lm; o < wordstart - 1; o++) { + lm = _Text_GetLetter((Uint8)*o); + if (lineBack) { + lineWidth -= sprite->Animations[0].Frames[lm].OffsetX; + lineBack = false; + } + lineWidth += sprite->Animations[0].Frames[lm].Advance * textAdvance; + } + lineBack = true; - DrawPolygon3D(data, 4, VertexType_Position | VertexType_Color, NULL, matrixModelArr, matrixNormalArr); - return NULL_VAL; -} + x = basex - lineWidth * textAlign; + for (char* o = linestart, lm; o < wordstart - 1; o++) { + lm = _Text_GetLetter((Uint8)*o); + if (lineBack) { + x -= sprite->Animations[0].Frames[lm].OffsetX; + lineBack = false; + } + Graphics::DrawSprite(sprite, 0, lm, x, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames[lm].Advance * textAdvance; + } -/*** - * Draw.Sprite3D - * \desc Draws a sprite in 3D space. - * \param sprite (Integer): Index of the loaded sprite. - * \param animation (Integer): Index of the animation entry. - * \param frame (Integer): Index of the frame in the animation entry. - * \param x (Number): X position of where to draw the sprite. - * \param y (Number): Y position of where to draw the sprite. - * \param z (Number): Z position of where to draw the sprite. - * \param flipX (Integer): Whether or not to flip the sprite horizontally. - * \param flipY (Integer): Whether or not to flip the sprite vertically. - * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. - * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return - * \ns Draw - */ -VMValue Draw_Sprite3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(7); + if (lineNo == maxLines) + return NULL_VAL; - ISprite* sprite = GET_ARG(0, GetSprite); - int animation = GET_ARG(1, GetInteger); - int frame = GET_ARG(2, GetInteger); - float x = GET_ARG(3, GetDecimal); - float y = GET_ARG(4, GetDecimal); - float z = GET_ARG(5, GetDecimal); - int flipX = GET_ARG(6, GetInteger); - int flipY = GET_ARG(7, GetInteger); - float scaleX = 1.0f; - float scaleY = 1.0f; - if (argCount > 8) - scaleX = GET_ARG(8, GetDecimal); - if (argCount > 9) - scaleY = GET_ARG(9, GetDecimal); + lineNo++; - GET_MATRICES(10); + linestart = wordstart; + y += sprite->Animations[0].FrameToLoop * textAscent; + lineBack = true; + } - if (Graphics::SpriteRangeCheck(sprite, animation, frame)) - return NULL_VAL; + wordstart = i + 1; + word++; + } + if (!l) + break; + } - AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; - Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + float lineWidth = 0.0f; + for (char* o = linestart, l; *o; o++) { + l = _Text_GetLetter((Uint8)*o); + if (lineBack) { + lineWidth -= sprite->Animations[0].Frames[l].OffsetX; + lineBack = false; + } + lineWidth += sprite->Animations[0].Frames[l].Advance * textAdvance; + } + lineBack = true; - VertexAttribute data[4]; + x = basex - lineWidth * textAlign; + for (char* o = linestart, l; *o; o++) { + l = _Text_GetLetter((Uint8)*o); + if (lineBack) { + x -= sprite->Animations[0].Frames[l].OffsetX; + lineBack = false; + } + Graphics::DrawSprite(sprite, 0, l, x, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames[l].Advance * textAdvance; + } - x += frameStr.OffsetX * scaleX; - y -= frameStr.OffsetY * scaleY; + // FINISH: - Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, scaleX, scaleY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.SpritePart3D - * \desc Draws part of a sprite in 3D space. - * \param sprite (Integer): Index of the loaded sprite. - * \param animation (Integer): Index of the animation entry. - * \param frame (Integer): Index of the frame in the animation entry. - * \param x (Number): X position of where to draw the sprite. - * \param y (Number): Y position of where to draw the sprite. - * \param z (Number): Z position of where to draw the sprite. - * \param partX (Integer): X coordinate of part of frame to draw. - * \param partY (Integer): Y coordinate of part of frame to draw. - * \param partW (Integer): Width of part of frame to draw. - * \param partH (Integer): Height of part of frame to draw. - * \param flipX (Integer): Whether or not to flip the sprite horizontally. - * \param flipY (Integer): Whether or not to flip the sprite vertically. - * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. - * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * Draw.TextEllipsis + * \desc * \return * \ns Draw */ -VMValue Draw_SpritePart3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(11); +VMValue Draw_TextEllipsis(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); ISprite* sprite = GET_ARG(0, GetSprite); - int animation = GET_ARG(1, GetInteger); - int frame = GET_ARG(2, GetInteger); - float x = GET_ARG(3, GetDecimal); - float y = GET_ARG(4, GetDecimal); - float z = GET_ARG(5, GetDecimal); - int sx = (int)GET_ARG(6, GetDecimal); - int sy = (int)GET_ARG(7, GetDecimal); - int sw = (int)GET_ARG(8, GetDecimal); - int sh = (int)GET_ARG(9, GetDecimal); - int flipX = GET_ARG(10, GetInteger); - int flipY = GET_ARG(11, GetInteger); - float scaleX = 1.0f; - float scaleY = 1.0f; - if (argCount > 12) - scaleX = GET_ARG(12, GetDecimal); - if (argCount > 13) - scaleY = GET_ARG(13, GetDecimal); - - GET_MATRICES(14); - - if (Graphics::SpriteRangeCheck(sprite, animation, frame)) - return NULL_VAL; + char* text = GET_ARG(1, GetString); + float x = GET_ARG(2, GetDecimal); + float y = GET_ARG(3, GetDecimal); + float maxwidth = GET_ARG(4, GetDecimal); - if (sw < 1 || sh < 1) + if (!sprite) return NULL_VAL; - AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; - Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; - - VertexAttribute data[4]; - - x += frameStr.OffsetX * scaleX; - y -= frameStr.OffsetY * scaleY; + float elpisswidth = sprite->Animations[0].Frames['.'].Advance * 3; - Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, scaleX, scaleY, texture, sx, sy, sw, sh); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); + int t; + size_t textlen = strlen(text); + float textwidth = 0.0f; + for (size_t i = 0; i < textlen; i++) { + t = (int)text[i]; + textwidth += sprite->Animations[0].Frames[t].Advance; + } + // If smaller than or equal to maxwidth, just draw normally. + if (textwidth <= maxwidth) { + for (size_t i = 0; i < textlen; i++) { + t = (int)text[i]; + Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames[t].Advance; + } + } + else { + for (size_t i = 0; i < textlen; i++) { + t = (int)text[i]; + if (x + sprite->Animations[0].Frames[t].Advance + elpisswidth > maxwidth) { + Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames['.'].Advance; + Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames['.'].Advance; + Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames['.'].Advance; + break; + } + Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); + x += sprite->Animations[0].Frames[t].Advance; + } + } + // Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); return NULL_VAL; } + /*** - * Draw.Image3D - * \desc Draws an image in 3D space. - * \param image (Integer): Index of the loaded image. - * \param x (Number): X position of where to draw the image. - * \param y (Number): Y position of where to draw the image. - * \param z (Number): Z position of where to draw the image. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.SetBlendColor + * \desc Sets the color to be used for drawing and blending. + * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) + * \param alpha (Number): Opacity to use for drawing, 0.0 to 1.0. * \ns Draw */ -VMValue Draw_Image3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(4); - - Image* image = GET_ARG(0, GetImage); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - float z = GET_ARG(3, GetDecimal); - - GET_MATRICES(4); - - Texture* texture = image->TexturePtr; - VertexAttribute data[4]; - - Graphics::MakeSpritePolygon(data, x, y, z, 0, 0, 1.0f, 1.0f, texture, 0, 0, texture->Width, texture->Height); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_Normal | VertexType_UV, texture, matrixModelArr, matrixNormalArr); +VMValue Draw_SetBlendColor(int argCount, VMValue* args, Uint32 threadID) { + if (argCount <= 2) { + CHECK_ARGCOUNT(2); + int hex = GET_ARG(0, GetInteger); + float alpha = GET_ARG(1, GetDecimal); + Graphics::SetBlendColor( + (hex >> 16 & 0xFF) / 255.f, + (hex >> 8 & 0xFF) / 255.f, + (hex & 0xFF) / 255.f, alpha); + return NULL_VAL; + } + CHECK_ARGCOUNT(4); + Graphics::SetBlendColor(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.ImagePart3D - * \desc Draws part of an image in 3D space. - * \param image (Integer): Index of the loaded image. - * \param x (Number): X position of where to draw the image. - * \param y (Number): Y position of where to draw the image. - * \param z (Number): Z position of where to draw the image. - * \param partX (Integer): X coordinate of part of image to draw. - * \param partY (Integer): Y coordinate of part of image to draw. - * \param partW (Integer): Width of part of image to draw. - * \param partH (Integer): Height of part of image to draw. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.SetTextureBlend + * \desc Sets whether or not to use color and alpha blending on sprites, images, and textures. + * \param doBlend (Boolean): Whether or not to use blending. * \ns Draw */ -VMValue Draw_ImagePart3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(8); - - Image* image = GET_ARG(0, GetImage); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - float z = GET_ARG(3, GetDecimal); - int sx = (int)GET_ARG(4, GetDecimal); - int sy = (int)GET_ARG(5, GetDecimal); - int sw = (int)GET_ARG(6, GetDecimal); - int sh = (int)GET_ARG(7, GetDecimal); - - GET_MATRICES(8); - - Texture* texture = image->TexturePtr; - VertexAttribute data[4]; - - Graphics::MakeSpritePolygon(data, x, y, z, 0, 0, 1.0f, 1.0f, texture, sx, sy, sw, sh); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_Normal | VertexType_UV, texture, matrixModelArr, matrixNormalArr); +VMValue Draw_SetTextureBlend(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Graphics::TextureBlend = !!GET_ARG(0, GetInteger); return NULL_VAL; } /*** - * Draw.Tile3D - * \desc Draws a tile in 3D space. - * \param ID (Integer): ID of the tile to draw. - * \param x (Number): X position of where to draw the tile. - * \param y (Number): Y position of where to draw the tile. - * \param z (Number): Z position of where to draw the tile. - * \param flipX (Integer): Whether or not to flip the tile horizontally. - * \param flipY (Integer): Whether or not to flip the tile vertically. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * Draw.SetBlendMode + * \desc Sets the blend mode used for drawing. + * \param blendMode (Enum): The desired blend mode. * \return * \ns Draw */ -VMValue Draw_Tile3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(6); - - Uint32 id = GET_ARG(0, GetInteger); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - float z = GET_ARG(3, GetDecimal); - int flipX = GET_ARG(4, GetInteger); - int flipY = GET_ARG(5, GetInteger); - - GET_MATRICES(6); - - TileSpriteInfo info; - ISprite* sprite; - if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) - sprite = info.Sprite; - else +VMValue Draw_SetBlendMode(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int blendMode = GET_ARG(0, GetInteger); + if (blendMode < 0 || blendMode > BlendMode_MATCH_NOT_EQUAL) { + OUT_OF_RANGE_ERROR("Blend mode", blendMode, 0, BlendMode_MATCH_NOT_EQUAL); return NULL_VAL; - - AnimFrame frameStr = sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; - Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; - - VertexAttribute data[4]; - - Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, 1.0f, 1.0f, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); + } + Graphics::SetBlendMode(blendMode); return NULL_VAL; } /*** - * Draw.TriangleTextured - * \desc Draws a textured triangle in 3D space. The texture source should be an image. - * \param image (Integer): Index of the loaded image. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt u1 (Number): Texture U of the first vertex. - * \paramOpt v1 (Number): Texture V of the first vertex. - * \paramOpt u2 (Number): Texture U of the second vertex. - * \paramOpt v2 (Number): Texture V of the second vertex. - * \paramOpt u3 (Number): Texture U of the third vertex. - * \paramOpt v3 (Number): Texture V of the third vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * Draw.SetBlendFactor + * \desc Sets the blend factors used for drawing. (Only for hardware-rendering) + * \param sourceFactor (Enum): Source factor for blending. + * \param destinationFactor (Enum): Destination factor for blending. * \return * \ns Draw */ -VMValue Draw_TriangleTextured(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(7); - - VertexAttribute data[3]; - - Image* image = GET_ARG(0, GetImage); - Texture* texture = image->TexturePtr; - - VERTEX_ARGS(3, 1); - VERTEX_COLOR_ARGS(3); - - // 0 - // | \ - // 1--2 - - data[1].UV.X = FP16_TO(1.0f); - - data[2].UV.X = FP16_TO(1.0f); - data[2].UV.Y = FP16_TO(1.0f); - - VERTEX_UV_ARGS(3); - - GET_MATRICES(argOffset); - - DrawPolygon3D(data, 3, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); +VMValue Draw_SetBlendFactor(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int src = GET_ARG(0, GetInteger); + int dst = GET_ARG(1, GetInteger); + Graphics::SetBlendMode(src, dst, src, dst); return NULL_VAL; } /*** - * Draw.QuadTextured - * \desc Draws a textured quad in 3D space. The texture source should be an image. - * \param image (Integer): Index of the loaded image. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \param x4 (Number): X position of the fourth vertex. - * \param y4 (Number): Y position of the fourth vertex. - * \param z4 (Number): Z position of the fourth vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt color4 (Integer): Color of the fourth vertex. - * \paramOpt u1 (Number): Texture U of the first vertex. - * \paramOpt v1 (Number): Texture V of the first vertex. - * \paramOpt u2 (Number): Texture U of the second vertex. - * \paramOpt v2 (Number): Texture V of the second vertex. - * \paramOpt u3 (Number): Texture U of the third vertex. - * \paramOpt v3 (Number): Texture V of the third vertex. - * \paramOpt u4 (Number): Texture U of the fourth vertex. - * \paramOpt v4 (Number): Texture V of the fourth vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * Draw.SetBlendFactorExtended + * \desc Sets all the blend factors used for drawing. (Only for hardware-rendering) + * \param sourceColorFactor (Enum): Source factor for blending color. + * \param destinationColorFactor (Enum): Destination factor for blending color. + * \param sourceAlphaFactor (Enum): Source factor for blending alpha. + * \param destinationAlphaFactor (Enum): Destination factor for blending alpha. * \return * \ns Draw */ -VMValue Draw_QuadTextured(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(13); - - VertexAttribute data[4]; - - Image* image = GET_ARG(0, GetImage); - Texture* texture = image->TexturePtr; - - VERTEX_ARGS(4, 1); - VERTEX_COLOR_ARGS(4); - - // 0--1 - // | | - // 3--2 - - data[1].UV.X = FP16_TO(1.0f); - - data[2].UV.X = FP16_TO(1.0f); - data[2].UV.Y = FP16_TO(1.0f); - - data[3].UV.Y = FP16_TO(1.0f); - - VERTEX_UV_ARGS(4); - - GET_MATRICES(argOffset); - - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); +VMValue Draw_SetBlendFactorExtended(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + int srcC = GET_ARG(0, GetInteger); + int dstC = GET_ARG(1, GetInteger); + int srcA = GET_ARG(2, GetInteger); + int dstA = GET_ARG(3, GetInteger); + Graphics::SetBlendMode(srcC, dstC, srcA, dstA); return NULL_VAL; } /*** - * Draw.SpritePoints - * \desc Draws a textured rectangle in 3D space. The texture source should be a sprite. - * \param sprite (Integer): Index of the loaded sprite. - * \param animation (Integer): Index of the animation entry. - * \param frame (Integer): Index of the frame in the animation entry. - * \param flipX (Integer): Whether or not to flip the sprite horizontally. - * \param flipY (Integer): Whether or not to flip the sprite vertically. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \param x4 (Number): X position of the fourth vertex. - * \param y4 (Number): Y position of the fourth vertex. - * \param z4 (Number): Z position of the fourth vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt color4 (Integer): Color of the fourth vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.SetCompareColor + * \desc Sets the Comparison Color to draw over for Comparison Drawing. + * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) * \ns Draw */ -VMValue Draw_SpritePoints(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(16); - - VertexAttribute data[4]; - - ISprite* sprite = GET_ARG(0, GetSprite); - int animation = GET_ARG(1, GetInteger); - int frame = GET_ARG(2, GetInteger); - int flipX = GET_ARG(3, GetInteger); - int flipY = GET_ARG(4, GetInteger); - - if (Graphics::SpriteRangeCheck(sprite, animation, frame)) - return NULL_VAL; - - AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; - Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; - - VERTEX_ARGS(4, 5); - VERTEX_COLOR_ARGS(4); - GET_MATRICES(argOffset); - - Graphics::MakeSpritePolygonUVs(data, flipX, flipY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); +VMValue Draw_SetCompareColor(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int hex = GET_ARG(0, GetInteger); + // SoftwareRenderer::CompareColor = 0xFF000000U | (hex & 0xF8F8F8); + SoftwareRenderer::CompareColor = 0xFF000000U | (hex & 0xFFFFFF); return NULL_VAL; } /*** - * Draw.TilePoints - * \desc Draws a textured rectangle in 3D space. The texture source should be a tile. - * \param ID (Integer): ID of the tile to draw. - * \param flipX (Integer): Whether or not to flip the tile horizontally. - * \param flipY (Integer): Whether or not to flip the tile vertically. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param z1 (Number): Z position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param z2 (Number): Z position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param z3 (Number): Z position of the third vertex. - * \param x4 (Number): X position of the fourth vertex. - * \param y4 (Number): Y position of the fourth vertex. - * \param z4 (Number): Z position of the fourth vertex. - * \paramOpt color1 (Integer): Color of the first vertex. - * \paramOpt color2 (Integer): Color of the second vertex. - * \paramOpt color3 (Integer): Color of the third vertex. - * \paramOpt color4 (Integer): Color of the fourth vertex. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.SetTintColor + * \desc Sets the color to be used for tinting. + * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) + * \param amount (Number): Tint amount, from 0.0 to 1.0. * \ns Draw */ -VMValue Draw_TilePoints(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(15); - - VertexAttribute data[4]; - TileSpriteInfo info; - ISprite* sprite; - - Uint32 id = GET_ARG(0, GetInteger); - int flipX = GET_ARG(1, GetInteger); - int flipY = GET_ARG(2, GetInteger); - if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) - sprite = info.Sprite; - else +VMValue Draw_SetTintColor(int argCount, VMValue* args, Uint32 threadID) { + if (argCount <= 2) { + CHECK_ARGCOUNT(2); + int hex = GET_ARG(0, GetInteger); + float alpha = GET_ARG(1, GetDecimal); + Graphics::SetTintColor( + (hex >> 16 & 0xFF) / 255.f, + (hex >> 8 & 0xFF) / 255.f, + (hex & 0xFF) / 255.f, alpha); return NULL_VAL; - - AnimFrame frameStr = sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; - Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; - - VERTEX_ARGS(4, 3); - VERTEX_COLOR_ARGS(4); - GET_MATRICES(argOffset); - - Graphics::MakeSpritePolygonUVs(data, flipX, flipY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); - DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); + } + CHECK_ARGCOUNT(4); + Graphics::SetTintColor(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SceneLayer3D - * \desc Draws a scene layer in 3D space. - * \param layer (Integer): Index of the layer. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * Draw.SetTintMode + * \desc Sets the tint mode used for drawing. + * \param tintMode (Enum): The desired tint mode. * \return * \ns Draw */ -VMValue Draw_SceneLayer3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - int layerID = GET_ARG(0, GetInteger); - - GET_MATRICES(1); - PREPARE_MATRICES(matrixModelArr, matrixNormalArr); - - SceneLayer* layer = &Scene::Layers[layerID]; - Graphics::DrawSceneLayer3D(layer, 0, 0, layer->Width, layer->Height, matrixModel, matrixNormal); +VMValue Draw_SetTintMode(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int tintMode = GET_ARG(0, GetInteger); + if (tintMode < 0 || tintMode > TintMode_DST_BLEND) { + OUT_OF_RANGE_ERROR("Tint mode", tintMode, 0, TintMode_DST_BLEND); + return NULL_VAL; + } + Graphics::SetTintMode(tintMode); return NULL_VAL; } /*** - * Draw.SceneLayerPart3D - * \desc Draws part of a scene layer in 3D space. - * \param layer (Integer): Index of the layer. - * \param partX (Integer): X coordinate (in tiles) of part of layer to draw. - * \param partY (Integer): Y coordinate (in tiles) of part of layer to draw. - * \param partW (Integer): Width (in tiles) of part of layer to draw. - * \param partH (Integer): Height (in tiles) of part of layer to draw. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.UseTinting + * \desc Sets whether or not to use color tinting when drawing. + * \param useTinting (Boolean): Whether or not to use color tinting when drawing. * \ns Draw */ -VMValue Draw_SceneLayerPart3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(5); - int layerID = GET_ARG(0, GetInteger); - int sx = (int)GET_ARG(1, GetDecimal); - int sy = (int)GET_ARG(2, GetDecimal); - int sw = (int)GET_ARG(3, GetDecimal); - int sh = (int)GET_ARG(4, GetDecimal); - - GET_MATRICES(5); - PREPARE_MATRICES(matrixModelArr, matrixNormalArr); - - SceneLayer* layer = &Scene::Layers[layerID]; - if (sx < 0) - sx = 0; - if (sy < 0) - sy = 0; - if (sw <= 0 || sh <= 0) - return NULL_VAL; - if (sw > layer->Width) - sw = layer->Width; - if (sh > layer->Height) - sh = layer->Height; - if (sx >= sw || sy >= sh) - return NULL_VAL; - - Graphics::DrawSceneLayer3D(layer, sx, sy, sw, sh, matrixModel, matrixNormal); +VMValue Draw_UseTinting(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int useTinting = GET_ARG(0, GetInteger); + Graphics::SetTintEnabled(useTinting); return NULL_VAL; } /*** - * Draw.VertexBuffer - * \desc Draws a vertex buffer. - * \param vertexBufferIndex (Integer): The vertex buffer to draw. - * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. - * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. - * \return + * Draw.SetFilter + * \desc Sets a filter type. + * \param filterType (Enum): The filter type. * \ns Draw */ -VMValue Draw_VertexBuffer(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - Uint32 vertexBufferIndex = GET_ARG(0, GetInteger); - if (vertexBufferIndex < 0 || vertexBufferIndex >= MAX_VERTEX_BUFFERS) +VMValue Draw_SetFilter(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int filterType = GET_ARG(0, GetInteger); + if (filterType < 0 || filterType > Filter_INVERT) { + OUT_OF_RANGE_ERROR("Filter", filterType, 0, Filter_INVERT); return NULL_VAL; - - GET_MATRICES(1); - PREPARE_MATRICES(matrixModelArr, matrixNormalArr); - - Graphics::DrawVertexBuffer(vertexBufferIndex, matrixModel, matrixNormal); + } + SoftwareRenderer::SetFilter(filterType); return NULL_VAL; } -#undef PREPARE_MATRICES /*** - * Draw.RenderArrayBuffer - * \desc Draws everything in the array buffer. (Deprecated; use instead.) - * \param arrayBufferIndex (Integer): The array buffer at the index to draw. - * \paramOpt drawMode (Integer): The type of drawing to use for the vertices in the array buffer. - * \return + * Draw.UseStencil + * \desc Enables or disables stencil operations. + * \param enabled (Boolean): Whether to enable or disable stencil operations. * \ns Draw */ -VMValue Draw_RenderArrayBuffer(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - Uint32 drawMode = GET_ARG_OPT(1, GetInteger, 0); - GET_SCENE_3D(); - Graphics::DrawScene3D(scene3DIndex, drawMode); +VMValue Draw_UseStencil(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Graphics::SetStencilEnabled(!!GET_ARG(0, GetInteger)); return NULL_VAL; } /*** - * Draw.RenderScene3D - * \desc Draws everything in the 3D scene. - * \param scene3DIndex (Integer): The 3D scene at the index to draw. - * \paramOpt drawMode (Integer): The type of drawing to use for the vertices in the 3D scene. - * \return + * Draw.SetStencilTestFunction + * \desc Sets a stencil test function. + * \param stencilTest (Enum): One of the stencil test functions. * \ns Draw */ -VMValue Draw_RenderScene3D(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - Uint32 scene3DIndex = GET_ARG(0, GetInteger); - Uint32 drawMode = GET_ARG_OPT(1, GetInteger, 0); - GET_SCENE_3D(); - Graphics::DrawScene3D(scene3DIndex, drawMode); +VMValue Draw_SetStencilTestFunction(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int stencilTest = GET_ARG(0, GetInteger); + if (stencilTest < StencilTest_Never || stencilTest > StencilTest_GEqual) { + OUT_OF_RANGE_ERROR("Stencil test function", stencilTest, StencilTest_Never, StencilTest_GEqual); + return NULL_VAL; + } + Graphics::SetStencilTestFunc(stencilTest); return NULL_VAL; } /*** - * Draw.Video - * \desc - * \return + * Draw.SetStencilPassOperation + * \desc Sets a stencil operation for when the stencil test passes. + * \param stencilOp (Enum): One of the stencil operations. * \ns Draw */ -VMValue Draw_Video(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(3); - - MediaBag* video = GET_ARG(0, GetVideo); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - - Graphics::DrawTexture(video->VideoTexture, 0, 0, video->VideoTexture->Width, video->VideoTexture->Height, x, y, video->VideoTexture->Width, video->VideoTexture->Height); +VMValue Draw_SetStencilPassOperation(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int stencilOp = GET_ARG(0, GetInteger); + if (stencilOp < StencilOp_Keep || stencilOp > StencilOp_DecrWrap) { + OUT_OF_RANGE_ERROR("Stencil operation", stencilOp, StencilOp_Keep, StencilOp_DecrWrap); + return NULL_VAL; + } + Graphics::SetStencilPassFunc(stencilOp); return NULL_VAL; } /*** - * Draw.VideoPart - * \desc - * \return + * Draw.SetStencilFailOperation + * \desc Sets a stencil operation for when the stencil test fails. + * \param stencilOp (Enum): One of the stencil operations. * \ns Draw */ -VMValue Draw_VideoPart(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(7); - - MediaBag* video = GET_ARG(0, GetVideo); - float sx = GET_ARG(1, GetDecimal); - float sy = GET_ARG(2, GetDecimal); - float sw = GET_ARG(3, GetDecimal); - float sh = GET_ARG(4, GetDecimal); - float x = GET_ARG(5, GetDecimal); - float y = GET_ARG(6, GetDecimal); - - Graphics::DrawTexture(video->VideoTexture, sx, sy, sw, sh, x, y, sw, sh); +VMValue Draw_SetStencilFailOperation(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int stencilOp = GET_ARG(0, GetInteger); + if (stencilOp < StencilOp_Keep || stencilOp > StencilOp_DecrWrap) { + OUT_OF_RANGE_ERROR("Stencil operation", stencilOp, StencilOp_Keep, StencilOp_DecrWrap); + return NULL_VAL; + } + Graphics::SetStencilFailFunc(stencilOp); return NULL_VAL; } /*** - * Draw.VideoSized - * \desc - * \return - * \ns Draw + * Draw.SetStencilValue + * \desc Sets the stencil value. + * \param value (Integer): The stencil value. This value is clamped by the stencil buffer's bit depth. + * \ns Draw */ -VMValue Draw_VideoSized(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(5); - - MediaBag* video = GET_ARG(0, GetVideo); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - float w = GET_ARG(3, GetDecimal); - float h = GET_ARG(4, GetDecimal); - - #ifdef USING_FFMPEG - video->Player->GetVideoData(video->VideoTexture); - #endif - - Graphics::DrawTexture(video->VideoTexture, 0, 0, video->VideoTexture->Width, video->VideoTexture->Height, x, y, w, h); +VMValue Draw_SetStencilValue(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int value = GET_ARG(0, GetInteger); + Graphics::SetStencilValue(value); return NULL_VAL; } /*** - * Draw.VideoPartSized - * \desc - * \return + * Draw.SetStencilMask + * \desc Sets the mask used for all stencil tests. + * \param mask (Integer): The stencil mask. This value is clamped by the stencil buffer's bit depth. * \ns Draw */ -VMValue Draw_VideoPartSized(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(9); - - MediaBag* video = GET_ARG(0, GetVideo); - float sx = GET_ARG(1, GetDecimal); - float sy = GET_ARG(2, GetDecimal); - float sw = GET_ARG(3, GetDecimal); - float sh = GET_ARG(4, GetDecimal); - float x = GET_ARG(5, GetDecimal); - float y = GET_ARG(6, GetDecimal); - float w = GET_ARG(7, GetDecimal); - float h = GET_ARG(8, GetDecimal); - - Graphics::DrawTexture(video->VideoTexture, sx, sy, sw, sh, x, y, w, h); +VMValue Draw_SetStencilMask(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int mask = GET_ARG(0, GetInteger); + Graphics::SetStencilMask(mask); return NULL_VAL; } /*** - * Draw.Tile - * \desc Draws a tile. - * \param ID (Integer): ID of the tile to draw. - * \param x (Number): X position of where to draw the tile. - * \param y (Number): Y position of where to draw the tile. - * \param flipX (Integer): Whether or not to flip the tile horizontally. - * \param flipY (Integer): Whether or not to flip the tile vertically. + * Draw.ClearStencil + * \desc Clears the stencil. * \ns Draw */ -VMValue Draw_Tile(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(5); - - Uint32 id = GET_ARG(0, GetInteger); - int x = (int)GET_ARG(1, GetDecimal) + 8; - int y = (int)GET_ARG(2, GetDecimal) + 8; - int flipX = GET_ARG(3, GetInteger); - int flipY = GET_ARG(4, GetInteger); - - TileSpriteInfo info; - if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) { - Graphics::DrawSprite(info.Sprite, info.AnimationIndex, info.FrameIndex, x, y, flipX, flipY, 1.0f, 1.0f, 0.0f); - } +VMValue Draw_ClearStencil(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::ClearStencil(); return NULL_VAL; } /*** - * Draw.Texture - * \desc Draws a texture. - * \param texture (Integer): Texture index. - * \param x (Number): X position of where to draw the texture. - * \param y (Number): Y position of where to draw the texture. + * Draw.SetDotMask + * \desc Sets the dot mask. + * \param mask (Integer): The mask. * \ns Draw */ -VMValue Draw_Texture(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(3); - - GameTexture* gameTexture = GET_ARG(0, GetTexture); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - - if (!gameTexture) - return NULL_VAL; - - Texture* texture = gameTexture->GetTexture(); - if (texture) - Graphics::DrawTexture(texture, 0, 0, texture->Width, texture->Height, x, y, texture->Width, texture->Height); +VMValue Draw_SetDotMask(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + SoftwareRenderer::SetDotMask(GET_ARG(0, GetInteger)); return NULL_VAL; } /*** - * Draw.TextureSized - * \desc Draws a texture, but sized. - * \param texture (Integer): Texture index. - * \param x (Number): X position of where to draw the texture. - * \param y (Number): Y position of where to draw the texture. - * \param width (Number): Width to draw the texture. - * \param height (Number): Height to draw the texture. + * Draw.SetHorizontalDotMask + * \desc Sets the horizontal dot mask. + * \param mask (Integer): The mask. * \ns Draw */ -VMValue Draw_TextureSized(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(5); - - GameTexture* gameTexture = GET_ARG(0, GetTexture); - float x = GET_ARG(1, GetDecimal); - float y = GET_ARG(2, GetDecimal); - float w = GET_ARG(3, GetDecimal); - float h = GET_ARG(4, GetDecimal); - - if (!gameTexture) - return NULL_VAL; - - Texture* texture = gameTexture->GetTexture(); - if (texture) - Graphics::DrawTexture(texture, 0, 0, texture->Width, texture->Height, x, y, w, h); +VMValue Draw_SetHorizontalDotMask(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + SoftwareRenderer::SetDotMaskH(GET_ARG(0, GetInteger)); return NULL_VAL; } /*** - * Draw.TexturePart - * \desc Draws part of a texture. - * \param texture (Integer): Texture index. - * \param partX (Integer): X coordinate of part of texture to draw. - * \param partY (Integer): Y coordinate of part of texture to draw. - * \param partW (Integer): Width of part of texture to draw. - * \param partH (Integer): Height of part of texture to draw. - * \param x (Number): X position of where to draw the texture. - * \param y (Number): Y position of where to draw the texture. + * Draw.SetVerticalDotMask + * \desc Sets the vertical dot mask. + * \param mask (Integer): The mask. * \ns Draw */ -VMValue Draw_TexturePart(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(7); - - GameTexture* gameTexture = GET_ARG(0, GetTexture); - float sx = GET_ARG(1, GetDecimal); - float sy = GET_ARG(2, GetDecimal); - float sw = GET_ARG(3, GetDecimal); - float sh = GET_ARG(4, GetDecimal); - float x = GET_ARG(5, GetDecimal); - float y = GET_ARG(6, GetDecimal); - - if (!gameTexture) - return NULL_VAL; - - Texture* texture = gameTexture->GetTexture(); - if (texture) - Graphics::DrawTexture(texture, sx, sy, sw, sh, x, y, sw, sh); +VMValue Draw_SetVerticalDotMask(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + SoftwareRenderer::SetDotMaskV(GET_ARG(0, GetInteger)); return NULL_VAL; } - -float textAlign = 0.0f; -float textBaseline = 0.0f; -float textAscent = 1.25f; -float textAdvance = 1.0f; -int _Text_GetLetter(int l) { - if (l < 0) - return ' '; - return l; -} /*** - * Draw.SetFont - * \desc - * \return + * Draw.SetHorizontalDotMaskOffset + * \desc Sets the offset of the horizontal dot mask. + * \param offsetH (Integer): The offset. * \ns Draw */ -VMValue Draw_SetFont(int argCount, VMValue* args, Uint32 threadID) { +VMValue Draw_SetHorizontalDotMaskOffset(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + SoftwareRenderer::SetDotMaskOffsetH(GET_ARG(0, GetInteger)); return NULL_VAL; } /*** - * Draw.SetTextAlign - * \desc Sets the text drawing horizontal alignment. (default: left) - * \param baseline (Integer): 0 for left, 1 for center, 2 for right. + * Draw.SetVerticalDotMaskOffset + * \desc Sets the offset of the vertical dot mask. + * \param offsetV (Integer): The offset. * \ns Draw */ -VMValue Draw_SetTextAlign(int argCount, VMValue* args, Uint32 threadID) { - textAlign = GET_ARG(0, GetInteger) / 2.0f; +VMValue Draw_SetVerticalDotMaskOffset(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + SoftwareRenderer::SetDotMaskOffsetV(GET_ARG(0, GetInteger)); return NULL_VAL; } /*** - * Draw.SetTextBaseline - * \desc Sets the text drawing vertical alignment. (default: top) - * \param baseline (Integer): 0 for top, 1 for baseline, 2 for bottom. + * Draw.Line + * \desc Draws a line. + * \param x1 (Number): X position of where to start drawing the line. + * \param y1 (Number): Y position of where to start drawing the line. + * \param x2 (Number): X position of where to end drawing the line. + * \param y2 (Number): Y position of where to end drawing the line. * \ns Draw */ -VMValue Draw_SetTextBaseline(int argCount, VMValue* args, Uint32 threadID) { - textBaseline = GET_ARG(0, GetInteger) / 2.0f; +VMValue Draw_Line(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + Graphics::StrokeLine(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetTextAdvance - * \desc Sets the character spacing multiplier. (default: 1.0) - * \param ascent (Number): Multiplier for character spacing. + * Draw.Circle + * \desc Draws a circle. + * \param x (Number): Center X position of where to draw the circle. + * \param y (Number): Center Y position of where to draw the circle. + * \param radius (Number): Radius of the circle. * \ns Draw */ -VMValue Draw_SetTextAdvance(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - textAdvance = GET_ARG(0, GetDecimal); +VMValue Draw_Circle(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); + Graphics::FillCircle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetTextLineAscent - * \desc Sets the line height multiplier. (default: 1.25) - * \param ascent (Number): Multiplier for line height. + * Draw.Ellipse + * \desc Draws an ellipse. + * \param x (Number): X position of where to draw the ellipse. + * \param y (Number): Y position of where to draw the ellipse. + * \param width (Number): Width to draw the ellipse at. + * \param height (Number): Height to draw the ellipse at. * \ns Draw */ -VMValue Draw_SetTextLineAscent(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - textAscent = GET_ARG(0, GetDecimal); +VMValue Draw_Ellipse(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + Graphics::FillEllipse(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.MeasureText - * \desc Measures Extended UTF8 text using a sprite or font and stores max width and max height into the array. - * \param outArray (Array): Array to output size values to. - * \param sprite (Integer): Index of the loaded sprite to be used as text. - * \param text (String): Text to measure. - * \return Returns the array inputted into the function. + * Draw.Triangle + * \desc Draws a triangle. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. * \ns Draw */ -VMValue Draw_MeasureText(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(3); - - ObjArray* array = GET_ARG(0, GetArray); - ISprite* sprite = GET_ARG(1, GetSprite); - char* text = GET_ARG(2, GetString); - - float x = 0.0, y = 0.0; - float maxW = 0.0, maxH = 0.0; - float lineHeight = sprite->Animations[0].FrameToLoop; - for (char* i = text; *i; i++) { - if (*i == '\n') { - x = 0.0; - y += lineHeight * textAscent; - goto __MEASURE_Y; - } - - x += sprite->Animations[0].Frames[*i].Advance * textAdvance; - - if (maxW < x) - maxW = x; - - __MEASURE_Y: - if (maxH < y + (sprite->Animations[0].Frames[*i].Height - sprite->Animations[0].Frames[*i].OffsetY)) - maxH = y + (sprite->Animations[0].Frames[*i].Height - sprite->Animations[0].Frames[*i].OffsetY); - } - - if (ScriptManager::Lock()) { - array->Values->clear(); - array->Values->push_back(DECIMAL_VAL(maxW)); - array->Values->push_back(DECIMAL_VAL(maxH)); - ScriptManager::Unlock(); - return OBJECT_VAL(array); - } - return NULL_VAL; -} -/*** - * Draw.MeasureTextWrapped - * \desc Measures wrapped Extended UTF8 text using a sprite or font and stores max width and max height into the array. - * \param outArray (Array): Array to output size values to. - * \param sprite (Integer): Index of the loaded sprite to be used as text. - * \param text (String): Text to measure. - * \param maxWidth (Number): Max width that a line can be. - * \paramOpt maxLines (Integer): Max number of lines to measure. - * \return Returns the array inputted into the function. - * \ns Draw - */ -VMValue Draw_MeasureTextWrapped(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(4); - - ObjArray* array = GET_ARG(0, GetArray); - ISprite* sprite = GET_ARG(1, GetSprite); - char* text = GET_ARG(2, GetString); - float max_w = GET_ARG(3, GetDecimal); - int maxLines = 0x7FFFFFFF; - if (argCount > 4) - maxLines = GET_ARG(4, GetInteger); - - int word = 0; - char* linestart = text; - char* wordstart = text; - - float x = 0.0, y = 0.0; - float maxW = 0.0, maxH = 0.0; - float lineHeight = sprite->Animations[0].FrameToLoop; - - int lineNo = 1; - for (char* i = text; ; i++) { - if (((*i == ' ' || *i == 0) && i != wordstart) || *i == '\n') { - float testWidth = 0.0f; - for (char* o = linestart; o < i; o++) { - testWidth += sprite->Animations[0].Frames[*o].Advance * textAdvance; - } - if ((testWidth > max_w && word > 0) || *i == '\n') { - x = 0.0f; - for (char* o = linestart; o < wordstart - 1; o++) { - x += sprite->Animations[0].Frames[*o].Advance * textAdvance; - - if (maxW < x) - maxW = x; - if (maxH < y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY)) - maxH = y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY); - } - - if (lineNo == maxLines) - goto FINISH; - lineNo++; - - linestart = wordstart; - y += lineHeight * textAscent; - } - - wordstart = i + 1; - word++; - } - - if (!*i) - break; - } - - x = 0.0f; - for (char* o = linestart; *o; o++) { - x += sprite->Animations[0].Frames[*o].Advance * textAdvance; - if (maxW < x) - maxW = x; - if (maxH < y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY)) - maxH = y + (sprite->Animations[0].Frames[*o].Height + sprite->Animations[0].Frames[*o].OffsetY); - } - - FINISH: - if (ScriptManager::Lock()) { - array->Values->clear(); - array->Values->push_back(DECIMAL_VAL(maxW)); - array->Values->push_back(DECIMAL_VAL(maxH)); - ScriptManager::Unlock(); - return OBJECT_VAL(array); - } - return NULL_VAL; -} -/*** - * Draw.Text - * \desc Draws Extended UTF8 text using a sprite or font. - * \param sprite (Integer): Index of the loaded sprite to be used as text. - * \param text (String): Text to draw. - * \param x (Number): X position of where to draw the text. - * \param y (Number): Y position of where to draw the text. - * \ns Draw - */ -VMValue Draw_Text(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - - ISprite* sprite = GET_ARG(0, GetSprite); - char* text = GET_ARG(1, GetString); - float basex = GET_ARG(2, GetDecimal); - float basey = GET_ARG(3, GetDecimal); - - float x = basex; - float y = basey; - float* lineWidths; - int line = 0; - - // Count lines - for (char* i = text; *i; i++) { - if (*i == '\n') { - line++; - continue; - } - } - line++; - lineWidths = (float*)malloc(line * sizeof(float)); - if (!lineWidths) - return NULL_VAL; - - // Get line widths - line = 0; - x = 0.0f; - for (char* i = text, l; *i; i++) { - l = _Text_GetLetter((Uint8)*i); - if (l == '\n') { - lineWidths[line++] = x; - x = 0.0f; - continue; - } - x += sprite->Animations[0].Frames[l].Advance * textAdvance; - } - lineWidths[line++] = x; - - // Draw text - line = 0; - x = basex; - bool lineBack = true; - for (char* i = text, l; *i; i++) { - l = _Text_GetLetter((Uint8)*i); - if (lineBack) { - x -= sprite->Animations[0].Frames[l].OffsetX; - lineBack = false; - } - - if (l == '\n') { - x = basex; - y += sprite->Animations[0].FrameToLoop * textAscent; - lineBack = true; - line++; - continue; - } - - Graphics::DrawSprite(sprite, 0, l, x - lineWidths[line] * textAlign, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames[l].Advance * textAdvance; - } - - free(lineWidths); - return NULL_VAL; -} -/*** - * Draw.TextWrapped - * \desc Draws wrapped Extended UTF8 text using a sprite or font. - * \param sprite (Integer): Index of the loaded sprite to be used as text. - * \param text (String): Text to draw. - * \param x (Number): X position of where to draw the tile. - * \param y (Number): Y position of where to draw the tile. - * \param maxWidth (Number): Max width the text can draw in. - * \param maxLines (Integer): Max lines the text can draw. - * \ns Draw - */ -VMValue Draw_TextWrapped(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(5); - - ISprite* sprite = GET_ARG(0, GetSprite); - char* text = GET_ARG(1, GetString); - float basex = GET_ARG(2, GetDecimal); - float basey = GET_ARG(3, GetDecimal); - float max_w = GET_ARG(4, GetDecimal); - int maxLines = 0x7FFFFFFF; - if (argCount > 5) - maxLines = GET_ARG(5, GetInteger); - - float x = basex; - float y = basey; - - // Draw text - int word = 0; - char* linestart = text; - char* wordstart = text; - bool lineBack = true; - int lineNo = 1; - for (char* i = text, l; ; i++) { - l = _Text_GetLetter((Uint8)*i); - if (((l == ' ' || l == 0) && i != wordstart) || l == '\n') { - float testWidth = 0.0f; - for (char* o = linestart, lm; o < i; o++) { - lm = _Text_GetLetter((Uint8)*o); - testWidth += sprite->Animations[0].Frames[lm].Advance * textAdvance; - } - - if ((testWidth > max_w && word > 0) || l == '\n') { - float lineWidth = 0.0f; - for (char* o = linestart, lm; o < wordstart - 1; o++) { - lm = _Text_GetLetter((Uint8)*o); - if (lineBack) { - lineWidth -= sprite->Animations[0].Frames[lm].OffsetX; - lineBack = false; - } - lineWidth += sprite->Animations[0].Frames[lm].Advance * textAdvance; - } - lineBack = true; - - x = basex - lineWidth * textAlign; - for (char* o = linestart, lm; o < wordstart - 1; o++) { - lm = _Text_GetLetter((Uint8)*o); - if (lineBack) { - x -= sprite->Animations[0].Frames[lm].OffsetX; - lineBack = false; - } - Graphics::DrawSprite(sprite, 0, lm, x, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames[lm].Advance * textAdvance; - } - - if (lineNo == maxLines) - return NULL_VAL; - - lineNo++; - - linestart = wordstart; - y += sprite->Animations[0].FrameToLoop * textAscent; - lineBack = true; - } - - wordstart = i + 1; - word++; - } - if (!l) - break; - } - - float lineWidth = 0.0f; - for (char* o = linestart, l; *o; o++) { - l = _Text_GetLetter((Uint8)*o); - if (lineBack) { - lineWidth -= sprite->Animations[0].Frames[l].OffsetX; - lineBack = false; - } - lineWidth += sprite->Animations[0].Frames[l].Advance * textAdvance; - } - lineBack = true; - - x = basex - lineWidth * textAlign; - for (char* o = linestart, l; *o; o++) { - l = _Text_GetLetter((Uint8)*o); - if (lineBack) { - x -= sprite->Animations[0].Frames[l].OffsetX; - lineBack = false; - } - Graphics::DrawSprite(sprite, 0, l, x, y - sprite->Animations[0].AnimationSpeed * textBaseline, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames[l].Advance * textAdvance; - } - - // FINISH: - - return NULL_VAL; -} -/*** - * Draw.TextEllipsis - * \desc - * \return - * \ns Draw - */ -VMValue Draw_TextEllipsis(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(5); - - ISprite* sprite = GET_ARG(0, GetSprite); - char* text = GET_ARG(1, GetString); - float x = GET_ARG(2, GetDecimal); - float y = GET_ARG(3, GetDecimal); - float maxwidth = GET_ARG(4, GetDecimal); - - float elpisswidth = sprite->Animations[0].Frames['.'].Advance * 3; - - int t; - size_t textlen = strlen(text); - float textwidth = 0.0f; - for (size_t i = 0; i < textlen; i++) { - t = (int)text[i]; - textwidth += sprite->Animations[0].Frames[t].Advance; - } - // If smaller than or equal to maxwidth, just draw normally. - if (textwidth <= maxwidth) { - for (size_t i = 0; i < textlen; i++) { - t = (int)text[i]; - Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames[t].Advance; - } - } - else { - for (size_t i = 0; i < textlen; i++) { - t = (int)text[i]; - if (x + sprite->Animations[0].Frames[t].Advance + elpisswidth > maxwidth) { - Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames['.'].Advance; - Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames['.'].Advance; - Graphics::DrawSprite(sprite, 0, '.', x, y, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames['.'].Advance; - break; - } - Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); - x += sprite->Animations[0].Frames[t].Advance; - } - } - // Graphics::DrawSprite(sprite, 0, t, x, y, false, false, 1.0f, 1.0f, 0.0f); - return NULL_VAL; -} - -/*** - * Draw.SetBlendColor - * \desc Sets the color to be used for drawing and blending. - * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) - * \param alpha (Number): Opacity to use for drawing, 0.0 to 1.0. - * \ns Draw - */ -VMValue Draw_SetBlendColor(int argCount, VMValue* args, Uint32 threadID) { - if (argCount <= 2) { - CHECK_ARGCOUNT(2); - int hex = GET_ARG(0, GetInteger); - float alpha = GET_ARG(1, GetDecimal); - Graphics::SetBlendColor( - (hex >> 16 & 0xFF) / 255.f, - (hex >> 8 & 0xFF) / 255.f, - (hex & 0xFF) / 255.f, alpha); - return NULL_VAL; - } - CHECK_ARGCOUNT(4); - Graphics::SetBlendColor(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw_Triangle(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(6); + Graphics::FillTriangle( + GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), + GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), + GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetTextureBlend - * \desc Sets whether or not to use color and alpha blending on sprites, images, and textures. - * \param doBlend (Boolean): Whether or not to use blending. + * Draw.TriangleBlend + * \desc Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do (0xFFFFFF, 1.0) if you want the vertex colors unaffected.) + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param color1 (Integer): Color of the first vertex. + * \param color2 (Integer): Color of the second vertex. + * \param color3 (Integer): Color of the third vertex. * \ns Draw */ -VMValue Draw_SetTextureBlend(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Graphics::TextureBlend = !!GET_ARG(0, GetInteger); +VMValue Draw_TriangleBlend(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(9); + // TODO: Implement for GL renderer + SoftwareRenderer::FillTriangleBlend( + GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), + GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), + GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal), + GET_ARG(6, GetInteger), + GET_ARG(7, GetInteger), + GET_ARG(8, GetInteger)); return NULL_VAL; } /*** - * Draw.SetBlendMode - * \desc Sets the blend mode used for drawing. - * \param blendMode (Enum): The desired blend mode. - * \return + * Draw.Quad + * \desc Draws a quad. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. * \ns Draw */ -VMValue Draw_SetBlendMode(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int blendMode = GET_ARG(0, GetInteger); - if (blendMode < 0 || blendMode > BlendMode_MATCH_NOT_EQUAL) { - OUT_OF_RANGE_ERROR("Blend mode", blendMode, 0, BlendMode_MATCH_NOT_EQUAL); - return NULL_VAL; - } - Graphics::SetBlendMode(blendMode); +VMValue Draw_Quad(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(8); + // TODO: Implement for GL renderer + SoftwareRenderer::FillQuad( + GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), + GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), + GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal), + GET_ARG(6, GetDecimal), GET_ARG(7, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetBlendFactor - * \desc Sets the blend factors used for drawing. (Only for hardware-rendering) - * \param sourceFactor (Enum): Source factor for blending. - * \param destinationFactor (Enum): Destination factor for blending. - * \return + * Draw.QuadBlend + * \desc Draws a quad, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do (0xFFFFFF, 1.0) if you want the vertex colors unaffected.) + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \param color1 (Integer): Color of the first vertex. + * \param color2 (Integer): Color of the second vertex. + * \param color3 (Integer): Color of the third vertex. + * \param color4 (Integer): Color of the fourth vertex. * \ns Draw */ -VMValue Draw_SetBlendFactor(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - int src = GET_ARG(0, GetInteger); - int dst = GET_ARG(1, GetInteger); - Graphics::SetBlendMode(src, dst, src, dst); +VMValue Draw_QuadBlend(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(12); + // TODO: Implement for GL renderer + SoftwareRenderer::FillQuadBlend( + GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), + GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), + GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal), + GET_ARG(6, GetDecimal), GET_ARG(7, GetDecimal), + GET_ARG(8, GetInteger), + GET_ARG(9, GetInteger), + GET_ARG(10, GetInteger), + GET_ARG(11, GetInteger)); return NULL_VAL; } /*** - * Draw.SetBlendFactorExtended - * \desc Sets all the blend factors used for drawing. (Only for hardware-rendering) - * \param sourceColorFactor (Enum): Source factor for blending color. - * \param destinationColorFactor (Enum): Destination factor for blending color. - * \param sourceAlphaFactor (Enum): Source factor for blending alpha. - * \param destinationAlphaFactor (Enum): Destination factor for blending alpha. - * \return + * Draw.TriangleTextured + * \desc Draws a textured triangle. + * \param image (Integer): Image to draw triangle with. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt u1 (Number): Texture U of the first vertex. + * \paramOpt v1 (Number): Texture V of the first vertex. + * \paramOpt u2 (Number): Texture U of the second vertex. + * \paramOpt v2 (Number): Texture V of the second vertex. + * \paramOpt u3 (Number): Texture U of the third vertex. + * \paramOpt v3 (Number): Texture V of the third vertex. * \ns Draw */ -VMValue Draw_SetBlendFactorExtended(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - int srcC = GET_ARG(0, GetInteger); - int dstC = GET_ARG(1, GetInteger); - int srcA = GET_ARG(2, GetInteger); - int dstA = GET_ARG(3, GetInteger); - Graphics::SetBlendMode(srcC, dstC, srcA, dstA); +VMValue Draw_TriangleTextured(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(7); + + Image* image = GET_ARG(0, GetImage); + if (image) { + // TODO: Implement for GL renderer + SoftwareRenderer::DrawTriangleTextured(image->TexturePtr, + GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), + GET_ARG(3, GetDecimal), GET_ARG(4, GetDecimal), + GET_ARG(5, GetDecimal), GET_ARG(6, GetDecimal), + GET_ARG_OPT(7, GetInteger, 0xFFFFFF), + GET_ARG_OPT(8, GetInteger, 0xFFFFFF), + GET_ARG_OPT(9, GetInteger, 0xFFFFFF), + GET_ARG_OPT(10, GetDecimal, 0.0), GET_ARG_OPT(11, GetDecimal, 0.0), + GET_ARG_OPT(12, GetDecimal, 1.0), GET_ARG_OPT(13, GetDecimal, 0.0), + GET_ARG_OPT(14, GetDecimal, 1.0), GET_ARG_OPT(15, GetDecimal, 1.0)); + } + return NULL_VAL; } /*** - * Draw.SetCompareColor - * \desc Sets the Comparison Color to draw over for Comparison Drawing. - * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) + * Draw.QuadTextured + * \desc Draws a textured quad. + * \param image (Integer): Image to draw quad with. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt color4 (Integer): Color of the fourth vertex. + * \paramOpt u1 (Number): Texture U of the first vertex. + * \paramOpt v1 (Number): Texture V of the first vertex. + * \paramOpt u2 (Number): Texture U of the second vertex. + * \paramOpt v2 (Number): Texture V of the second vertex. + * \paramOpt u3 (Number): Texture U of the third vertex. + * \paramOpt v3 (Number): Texture V of the third vertex. + * \paramOpt u4 (Number): Texture U of the fourth vertex. + * \paramOpt v4 (Number): Texture V of the fourth vertex. * \ns Draw */ -VMValue Draw_SetCompareColor(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int hex = GET_ARG(0, GetInteger); - // SoftwareRenderer::CompareColor = 0xFF000000U | (hex & 0xF8F8F8); - SoftwareRenderer::CompareColor = 0xFF000000U | (hex & 0xFFFFFF); +VMValue Draw_QuadTextured(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(9); + + Image* image = GET_ARG(0, GetImage); + if (image) { + // TODO: Implement for GL renderer + SoftwareRenderer::DrawQuadTextured(image->TexturePtr, + GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), + GET_ARG(3, GetDecimal), GET_ARG(4, GetDecimal), + GET_ARG(5, GetDecimal), GET_ARG(6, GetDecimal), + GET_ARG(7, GetDecimal), GET_ARG(8, GetDecimal), + GET_ARG_OPT(9, GetInteger, 0xFFFFFF), + GET_ARG_OPT(10, GetInteger, 0xFFFFFF), + GET_ARG_OPT(11, GetInteger, 0xFFFFFF), + GET_ARG_OPT(12, GetInteger, 0xFFFFFF), + GET_ARG_OPT(13, GetDecimal, 0.0), GET_ARG_OPT(14, GetDecimal, 0.0), + GET_ARG_OPT(15, GetDecimal, 1.0), GET_ARG_OPT(16, GetDecimal, 0.0), + GET_ARG_OPT(17, GetDecimal, 1.0), GET_ARG_OPT(18, GetDecimal, 1.0), + GET_ARG_OPT(19, GetDecimal, 0.0), GET_ARG_OPT(20, GetDecimal, 1.0)); + } + return NULL_VAL; } /*** - * Draw.SetTintColor - * \desc Sets the color to be used for tinting. - * \param hex (Integer): Hexadecimal format of desired color. (ex: Red = 0xFF0000, Green = 0x00FF00, Blue = 0x0000FF) - * \param amount (Number): Tint amount, from 0.0 to 1.0. + * Draw.Rectangle + * \desc Draws a rectangle. + * \param x (Number): X position of where to draw the rectangle. + * \param y (Number): Y position of where to draw the rectangle. + * \param width (Number): Width to draw the rectangle at. + * \param height (Number): Height to draw the rectangle at. * \ns Draw */ -VMValue Draw_SetTintColor(int argCount, VMValue* args, Uint32 threadID) { - if (argCount <= 2) { - CHECK_ARGCOUNT(2); - int hex = GET_ARG(0, GetInteger); - float alpha = GET_ARG(1, GetDecimal); - Graphics::SetTintColor( - (hex >> 16 & 0xFF) / 255.f, - (hex >> 8 & 0xFF) / 255.f, - (hex & 0xFF) / 255.f, alpha); - return NULL_VAL; - } +VMValue Draw_Rectangle(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(4); - Graphics::SetTintColor(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); + Graphics::FillRectangle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetTintMode - * \desc Sets the tint mode used for drawing. - * \param tintMode (Enum): The desired tint mode. - * \return + * Draw.CircleStroke + * \desc Draws a circle outline. + * \param x (Number): Center X position of where to draw the circle. + * \param y (Number): Center Y position of where to draw the circle. + * \param radius (Number): Radius of the circle. + * \paramOpt thickness (Number): Thickness of the circle. * \ns Draw */ -VMValue Draw_SetTintMode(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int tintMode = GET_ARG(0, GetInteger); - if (tintMode < 0 || tintMode > TintMode_DST_BLEND) { - OUT_OF_RANGE_ERROR("Tint mode", tintMode, 0, TintMode_DST_BLEND); - return NULL_VAL; - } - Graphics::SetTintMode(tintMode); +VMValue Draw_CircleStroke(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(3); + Graphics::StrokeCircle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG_OPT(3, GetDecimal, 1.0)); return NULL_VAL; } /*** - * Draw.UseTinting - * \desc Sets whether or not to use color tinting when drawing. - * \param useTinting (Boolean): Whether or not to use color tinting when drawing. + * Draw.EllipseStroke + * \desc Draws an ellipse outline. + * \param x (Number): X position of where to draw the ellipse. + * \param y (Number): Y position of where to draw the ellipse. + * \param width (Number): Width to draw the ellipse at. + * \param height (Number): Height to draw the ellipse at. * \ns Draw */ -VMValue Draw_UseTinting(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int useTinting = GET_ARG(0, GetInteger); - Graphics::SetTintEnabled(useTinting); +VMValue Draw_EllipseStroke(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + Graphics::StrokeEllipse(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetFilter - * \desc Sets a filter type. - * \param filterType (Enum): The filter type. + * Draw.TriangleStroke + * \desc Draws a triangle outline. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. * \ns Draw */ -VMValue Draw_SetFilter(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int filterType = GET_ARG(0, GetInteger); - if (filterType < 0 || filterType > Filter_INVERT) { - OUT_OF_RANGE_ERROR("Filter", filterType, 0, Filter_INVERT); - return NULL_VAL; - } - SoftwareRenderer::SetFilter(filterType); +VMValue Draw_TriangleStroke(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(6); + Graphics::StrokeTriangle( + GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), + GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), + GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal)); return NULL_VAL; } /*** - * Draw.UseStencil - * \desc Enables or disables stencil operations. - * \param enabled (Boolean): Whether to enable or disable stencil operations. + * Draw.RectangleStroke + * \desc Draws a rectangle outline. + * \param x (Number): X position of where to draw the rectangle. + * \param y (Number): Y position of where to draw the rectangle. + * \param width (Number): Width to draw the rectangle at. + * \param height (Number): Height to draw the rectangle at. * \ns Draw */ -VMValue Draw_UseStencil(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Graphics::SetStencilEnabled(!!GET_ARG(0, GetInteger)); +VMValue Draw_RectangleStroke(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + Graphics::StrokeRectangle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetStencilTestFunction - * \desc Sets a stencil test function. - * \param stencilTest (Enum): One of the stencil test functions. + * Draw.UseFillSmoothing + * \desc Sets whether or not to use smoothing when drawing filled shapes. (hardware-renderer only) + * \param smoothFill (Boolean): Whether or not to use smoothing. + * \return * \ns Draw */ -VMValue Draw_SetStencilTestFunction(int argCount, VMValue* args, Uint32 threadID) { +VMValue Draw_UseFillSmoothing(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - int stencilTest = GET_ARG(0, GetInteger); - if (stencilTest < StencilTest_Never || stencilTest > StencilTest_GEqual) { - OUT_OF_RANGE_ERROR("Stencil test function", stencilTest, StencilTest_Never, StencilTest_GEqual); - return NULL_VAL; - } - Graphics::SetStencilTestFunc(stencilTest); + Graphics::SmoothFill = !!GET_ARG(0, GetInteger); return NULL_VAL; } /*** - * Draw.SetStencilPassOperation - * \desc Sets a stencil operation for when the stencil test passes. - * \param stencilOp (Enum): One of the stencil operations. + * Draw.UseStrokeSmoothing + * \desc Sets whether or not to use smoothing when drawing un-filled shapes. (hardware-renderer only) + * \param smoothFill (Boolean): Whether or not to use smoothing. * \ns Draw */ -VMValue Draw_SetStencilPassOperation(int argCount, VMValue* args, Uint32 threadID) { +VMValue Draw_UseStrokeSmoothing(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - int stencilOp = GET_ARG(0, GetInteger); - if (stencilOp < StencilOp_Keep || stencilOp > StencilOp_DecrWrap) { - OUT_OF_RANGE_ERROR("Stencil operation", stencilOp, StencilOp_Keep, StencilOp_DecrWrap); - return NULL_VAL; - } - Graphics::SetStencilPassFunc(stencilOp); + Graphics::SmoothStroke = !!GET_ARG(0, GetInteger); return NULL_VAL; } + /*** - * Draw.SetStencilFailOperation - * \desc Sets a stencil operation for when the stencil test fails. - * \param stencilOp (Enum): One of the stencil operations. + * Draw.SetClip + * \desc Sets the region in which drawing will occur. + * \param x (Number): X position of where to start the draw region. + * \param y (Number): Y position of where to start the draw region. + * \param width (Number): Width of the draw region. + * \param height (Number): Height of the draw region. * \ns Draw */ -VMValue Draw_SetStencilFailOperation(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int stencilOp = GET_ARG(0, GetInteger); - if (stencilOp < StencilOp_Keep || stencilOp > StencilOp_DecrWrap) { - OUT_OF_RANGE_ERROR("Stencil operation", stencilOp, StencilOp_Keep, StencilOp_DecrWrap); - return NULL_VAL; - } - Graphics::SetStencilFailFunc(stencilOp); +VMValue Draw_SetClip(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + Graphics::SetClip((int)GET_ARG(0, GetDecimal), (int)GET_ARG(1, GetDecimal), (int)GET_ARG(2, GetDecimal), (int)GET_ARG(3, GetDecimal)); return NULL_VAL; } /*** - * Draw.SetStencilValue - * \desc Sets the stencil value. - * \param value (Integer): The stencil value. This value is clamped by the stencil buffer's bit depth. + * Draw.ClearClip + * \desc Resets the drawing region. * \ns Draw */ -VMValue Draw_SetStencilValue(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int value = GET_ARG(0, GetInteger); - Graphics::SetStencilValue(value); +VMValue Draw_ClearClip(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::ClearClip(); return NULL_VAL; } + /*** - * Draw.SetStencilMask - * \desc Sets the mask used for all stencil tests. - * \param mask (Integer): The stencil mask. This value is clamped by the stencil buffer's bit depth. + * Draw.Save + * \desc + * \return * \ns Draw */ -VMValue Draw_SetStencilMask(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int mask = GET_ARG(0, GetInteger); - Graphics::SetStencilMask(mask); +VMValue Draw_Save(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::Save(); return NULL_VAL; } /*** - * Draw.ClearStencil - * \desc Clears the stencil. + * Draw.Scale + * \desc + * \return * \ns Draw */ -VMValue Draw_ClearStencil(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::ClearStencil(); +VMValue Draw_Scale(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(2); + float x = GET_ARG(0, GetDecimal); + float y = GET_ARG(1, GetDecimal); + float z = 1.0f; if (argCount == 3) z = GET_ARG(2, GetDecimal); + Graphics::Scale(x, y, z); return NULL_VAL; } /*** - * Draw.SetDotMask - * \desc Sets the dot mask. - * \param mask (Integer): The mask. + * Draw.Rotate + * \desc + * \return * \ns Draw */ -VMValue Draw_SetDotMask(int argCount, VMValue* args, Uint32 threadID) { +VMValue Draw_Rotate(int argCount, VMValue* args, Uint32 threadID) { CHECK_AT_LEAST_ARGCOUNT(1); - SoftwareRenderer::SetDotMask(GET_ARG(0, GetInteger)); + if (argCount == 3) { + float x = GET_ARG(0, GetDecimal); + float y = GET_ARG(1, GetDecimal); + float z = GET_ARG(2, GetDecimal); + Graphics::Rotate(x, y, z); + } + else { + float z = GET_ARG(0, GetDecimal); + Graphics::Rotate(0.0f, 0.0f, z); + } return NULL_VAL; } /*** - * Draw.SetHorizontalDotMask - * \desc Sets the horizontal dot mask. - * \param mask (Integer): The mask. + * Draw.Restore + * \desc + * \return * \ns Draw */ -VMValue Draw_SetHorizontalDotMask(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - SoftwareRenderer::SetDotMaskH(GET_ARG(0, GetInteger)); +VMValue Draw_Restore(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::Restore(); return NULL_VAL; } /*** - * Draw.SetVerticalDotMask - * \desc Sets the vertical dot mask. - * \param mask (Integer): The mask. + * Draw.Translate + * \desc + * \return * \ns Draw */ -VMValue Draw_SetVerticalDotMask(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - SoftwareRenderer::SetDotMaskV(GET_ARG(0, GetInteger)); +VMValue Draw_Translate(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(2); + float x = GET_ARG(0, GetDecimal); + float y = GET_ARG(1, GetDecimal); + float z = 0.0f; if (argCount == 3) z = GET_ARG(2, GetDecimal); + Graphics::Translate(x, y, z); return NULL_VAL; } /*** - * Draw.SetHorizontalDotMaskOffset - * \desc Sets the offset of the horizontal dot mask. - * \param offsetH (Integer): The offset. + * Draw.SetTextureTarget + * \desc + * \return * \ns Draw */ -VMValue Draw_SetHorizontalDotMaskOffset(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - SoftwareRenderer::SetDotMaskOffsetH(GET_ARG(0, GetInteger)); +VMValue Draw_SetTextureTarget(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + + GameTexture* gameTexture = GET_ARG(0, GetTexture); + if (!gameTexture) + return NULL_VAL; + + Texture* texture = gameTexture->GetTexture(); + if (texture) + Graphics::SetRenderTarget(texture); return NULL_VAL; } /*** - * Draw.SetVerticalDotMaskOffset - * \desc Sets the offset of the vertical dot mask. - * \param offsetV (Integer): The offset. + * Draw.Clear + * \desc + * \return * \ns Draw */ -VMValue Draw_SetVerticalDotMaskOffset(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - SoftwareRenderer::SetDotMaskOffsetV(GET_ARG(0, GetInteger)); +VMValue Draw_Clear(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::Clear(); return NULL_VAL; } /*** - * Draw.Line - * \desc Draws a line. - * \param x1 (Number): X position of where to start drawing the line. - * \param y1 (Number): Y position of where to start drawing the line. - * \param x2 (Number): X position of where to end drawing the line. - * \param y2 (Number): Y position of where to end drawing the line. + * Draw.ResetTextureTarget + * \desc + * \return * \ns Draw */ -VMValue Draw_Line(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::StrokeLine(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw_ResetTextureTarget(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + if (Graphics::CurrentView) { + Graphics::SetRenderTarget(!Graphics::CurrentView->UseDrawTarget ? NULL : Graphics::CurrentView->DrawTarget); + Graphics::UpdateProjectionMatrix(); + } return NULL_VAL; } /*** - * Draw.Circle - * \desc Draws a circle. - * \param x (Number): Center X position of where to draw the circle. - * \param y (Number): Center Y position of where to draw the circle. - * \param radius (Number): Radius of the circle. + * Draw.UseSpriteDeform + * \desc Sets whether or not to use sprite deform when drawing. + * \param useDeform (Boolean): Whether or not to use sprite deform when drawing. * \ns Draw */ -VMValue Draw_Circle(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(3); - Graphics::FillCircle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal)); +VMValue Draw_UseSpriteDeform(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int useDeform = GET_ARG(0, GetInteger); + SoftwareRenderer::UseSpriteDeform = useDeform; return NULL_VAL; } /*** - * Draw.Ellipse - * \desc Draws an ellipse. - * \param x (Number): X position of where to draw the ellipse. - * \param y (Number): Y position of where to draw the ellipse. - * \param width (Number): Width to draw the ellipse at. - * \param height (Number): Height to draw the ellipse at. + * Draw.SetSpriteDeformLine + * \desc Sets the sprite deform line at the specified line index. + * \param deformIndex (Integer): Index of deform line. (0 = top of screen, 1 = the line below it, 2 = etc.) + * \param deformValue (Decimal): Deform value. * \ns Draw */ -VMValue Draw_Ellipse(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::FillEllipse(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw_SetSpriteDeformLine(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int lineIndex = GET_ARG(0, GetInteger); + int deformValue = (int)GET_ARG(1, GetDecimal); + + SoftwareRenderer::SpriteDeformBuffer[lineIndex] = deformValue; return NULL_VAL; } /*** - * Draw.Triangle - * \desc Draws a triangle. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. + * Draw.UseDepthTesting + * \desc Sets whether or not to do depth tests when drawing. + * \param useDepthTesting (Boolean): Whether or not to do depth tests when drawing. * \ns Draw */ -VMValue Draw_Triangle(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(6); - Graphics::FillTriangle( - GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), - GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), - GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal)); +VMValue Draw_UseDepthTesting(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int useDepthTesting = GET_ARG(0, GetInteger); + Graphics::UseDepthTesting = useDepthTesting; + Graphics::SetDepthTesting(useDepthTesting); return NULL_VAL; } /*** - * Draw.TriangleBlend - * \desc Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do (0xFFFFFF, 1.0) if you want the vertex colors unaffected.) - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param color1 (Integer): Color of the first vertex. - * \param color2 (Integer): Color of the second vertex. - * \param color3 (Integer): Color of the third vertex. + * Draw.GetCurrentDrawGroup + * \desc Gets the draw group currently being drawn. + * \return Returns an Integer value. * \ns Draw */ -VMValue Draw_TriangleBlend(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(9); - SoftwareRenderer::FillTriangleBlend( - GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), - GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), - GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal), - GET_ARG(6, GetInteger), - GET_ARG(7, GetInteger), - GET_ARG(8, GetInteger)); - return NULL_VAL; +VMValue Draw_GetCurrentDrawGroup(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + return INTEGER_VAL(Scene::CurrentDrawGroup); } /*** - * Draw.QuadBlend - * \desc Draws a triangle, blending the colors at the vertices. (Colors are multipled by the global Draw Blend Color, do (0xFFFFFF, 1.0) if you want the vertex colors unaffected.) - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \param x4 (Number): X position of the fourth vertex. - * \param y4 (Number): Y position of the fourth vertex. - * \param color1 (Integer): Color of the first vertex. - * \param color2 (Integer): Color of the second vertex. - * \param color3 (Integer): Color of the third vertex. - * \param color4 (Integer): Color of the fourth vertex. + * Draw.CopyScreen + * \desc Copies the contents of the screen into a texture. + * \param texture (Integer): Texture index. * \ns Draw */ -VMValue Draw_QuadBlend(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(12); - SoftwareRenderer::FillQuadBlend( - GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), - GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), - GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal), - GET_ARG(6, GetDecimal), GET_ARG(7, GetDecimal), - GET_ARG(8, GetInteger), - GET_ARG(9, GetInteger), - GET_ARG(10, GetInteger), - GET_ARG(11, GetInteger)); +VMValue Draw_CopyScreen(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + GameTexture* gameTexture = GET_ARG(0, GetTexture); + if (!gameTexture) + return NULL_VAL; + + Texture* texture = gameTexture->GetTexture(); + if (texture) { + int width = Graphics::CurrentViewport.Width; + int height = Graphics::CurrentViewport.Height; + + View* currentView = Graphics::CurrentView; + if (currentView) { + // If we are using a draw target, then we can't reliably use the viewport's dimensions, + // because it might not match the view's size + if (currentView->UseDrawTarget && currentView->DrawTarget) { + width = Graphics::CurrentView->Width; + height = Graphics::CurrentView->Height; + } + } + + Graphics::CopyScreen( + // source + 0, 0, width, height, + // dest + 0, 0, texture->Width, texture->Height, + texture + ); + } + return NULL_VAL; +} +// #endregion + +// #region Draw3D +/*** + * Draw3D.BindVertexBuffer + * \desc Binds a vertex buffer. + * \param vertexBufferIndex (Integer): Sets the vertex buffer to bind. + * \ns Draw3D + */ +VMValue Draw3D_BindVertexBuffer(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Uint32 vertexBufferIndex = GET_ARG(0, GetInteger); + if (vertexBufferIndex < 0 || vertexBufferIndex >= MAX_VERTEX_BUFFERS) { + OUT_OF_RANGE_ERROR("Vertex index", vertexBufferIndex, 0, MAX_VERTEX_BUFFERS); + return NULL_VAL; + } + + Graphics::BindVertexBuffer(vertexBufferIndex); return NULL_VAL; } /*** - * Draw.Rectangle - * \desc Draws a rectangle. - * \param x (Number): X position of where to draw the rectangle. - * \param y (Number): Y position of where to draw the rectangle. - * \param width (Number): Width to draw the rectangle at. - * \param height (Number): Height to draw the rectangle at. - * \ns Draw + * Draw3D.UnbindVertexBuffer + * \desc Unbinds the currently bound vertex buffer. + * \ns Draw3D */ -VMValue Draw_Rectangle(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::FillRectangle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw3D_UnbindVertexBuffer(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + Graphics::UnbindVertexBuffer(); return NULL_VAL; } +#define GET_SCENE_3D() \ + if (scene3DIndex < 0 || scene3DIndex >= MAX_3D_SCENES) { \ + OUT_OF_RANGE_ERROR("Scene3D", scene3DIndex, 0, MAX_3D_SCENES - 1); \ + return NULL_VAL; \ + } \ + Scene3D* scene3D = &Graphics::Scene3Ds[scene3DIndex] /*** - * Draw.CircleStroke - * \desc Draws a circle outline. - * \param x (Number): Center X position of where to draw the circle. - * \param y (Number): Center Y position of where to draw the circle. - * \param radius (Number): Radius of the circle. - * \ns Draw + * Draw3D.BindScene + * \desc Binds a 3D scene for drawing polygons in 3D space. + * \param scene3DIndex (Integer): Sets the 3D scene to bind. + * \ns Draw3D */ -VMValue Draw_CircleStroke(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(3); - Graphics::StrokeCircle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal)); +VMValue Draw3D_BindScene(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Uint32 scene3DIndex = GET_ARG(0, GetInteger); + if (scene3DIndex < 0 || scene3DIndex >= MAX_3D_SCENES) { + OUT_OF_RANGE_ERROR("Scene3D", scene3DIndex, 0, MAX_3D_SCENES - 1); + return NULL_VAL; + } + + Graphics::BindScene3D(scene3DIndex); return NULL_VAL; } +static void PrepareMatrix(Matrix4x4 *output, ObjArray* input) { + MatrixHelper helper; + MatrixHelper_CopyFrom(&helper, input); + + for (int i = 0; i < 16; i++) { + int x = i >> 2; + int y = i & 3; + output->Values[i] = helper[x][y]; + } +} /*** - * Draw.EllipseStroke - * \desc Draws an ellipse outline. - * \param x (Number): X position of where to draw the ellipse. - * \param y (Number): Y position of where to draw the ellipse. - * \param width (Number): Width to draw the ellipse at. - * \param height (Number): Height to draw the ellipse at. - * \ns Draw + * Draw3D.Model + * \desc Draws a model. + * \param modelIndex (Integer): Index of loaded model. + * \param animation (Integer): Animation of model to draw. + * \param frame (Decimal): Frame of model to draw. + * \paramOpt matrixModel (Matrix): Matrix for transforming model coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming model normals. + * \ns Draw3D */ -VMValue Draw_EllipseStroke(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::StrokeEllipse(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw3D_Model(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); + + IModel* model = GET_ARG(0, GetModel); + int animation = GET_ARG(1, GetInteger); + int frame = GET_ARG(2, GetDecimal) * 0x100; + + ObjArray* matrixModelArr = NULL; + Matrix4x4 matrixModel; + if (!IS_NULL(args[3])) { + matrixModelArr = GET_ARG(3, GetArray); + PrepareMatrix(&matrixModel, matrixModelArr); + } + + ObjArray* matrixNormalArr = NULL; + Matrix4x4 matrixNormal; + if (!IS_NULL(args[4])) { + matrixNormalArr = GET_ARG(4, GetArray); + PrepareMatrix(&matrixNormal, matrixNormalArr); + } + + if (model) + Graphics::DrawModel(model, animation, frame, matrixModelArr ? &matrixModel : NULL, matrixNormalArr ? &matrixNormal : NULL); + return NULL_VAL; } /*** - * Draw.TriangleStroke - * \desc Draws a triangle outline. - * \param x1 (Number): X position of the first vertex. - * \param y1 (Number): Y position of the first vertex. - * \param x2 (Number): X position of the second vertex. - * \param y2 (Number): Y position of the second vertex. - * \param x3 (Number): X position of the third vertex. - * \param y3 (Number): Y position of the third vertex. - * \ns Draw + * Draw3D.ModelSkinned + * \desc Draws a skinned model. + * \param modelIndex (Integer): Index of loaded model. + * \param skeleton (Integer): Skeleton of model to skin the model. + * \paramOpt matrixModel (Matrix): Matrix for transforming model coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming model normals. + * \ns Draw3D */ -VMValue Draw_TriangleStroke(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(6); - Graphics::StrokeTriangle( - GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), - GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal), - GET_ARG(4, GetDecimal), GET_ARG(5, GetDecimal)); +VMValue Draw3D_ModelSkinned(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(4); + + IModel* model = GET_ARG(0, GetModel); + int armature = GET_ARG(1, GetInteger); + + ObjArray* matrixModelArr = NULL; + Matrix4x4 matrixModel; + if (!IS_NULL(args[2])) { + matrixModelArr = GET_ARG(2, GetArray); + PrepareMatrix(&matrixModel, matrixModelArr); + } + + ObjArray* matrixNormalArr = NULL; + Matrix4x4 matrixNormal; + if (!IS_NULL(args[3])) { + matrixNormalArr = GET_ARG(3, GetArray); + PrepareMatrix(&matrixNormal, matrixNormalArr); + } + + if (model) + Graphics::DrawModelSkinned(model, armature, matrixModelArr ? &matrixModel : NULL, matrixNormalArr ? &matrixNormal : NULL); + return NULL_VAL; } /*** - * Draw.RectangleStroke - * \desc Draws a rectangle outline. - * \param x (Number): X position of where to draw the rectangle. - * \param y (Number): Y position of where to draw the rectangle. - * \param width (Number): Width to draw the rectangle at. - * \param height (Number): Height to draw the rectangle at. - * \ns Draw + * Draw3D.ModelSimple + * \desc Draws a model without using matrices. + * \param modelIndex (Integer): Index of loaded model. + * \param animation (Integer): Animation of model to draw. + * \param frame (Integer): Frame of model to draw. + * \param x (Number): X position + * \param y (Number): Y position + * \param scale (Number): Model scale + * \param rx (Number): X rotation in radians + * \param ry (Number): Y rotation in radians + * \param rz (Number): Z rotation in radians + * \ns Draw3D */ -VMValue Draw_RectangleStroke(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::StrokeRectangle(GET_ARG(0, GetDecimal), GET_ARG(1, GetDecimal), GET_ARG(2, GetDecimal), GET_ARG(3, GetDecimal)); +VMValue Draw3D_ModelSimple(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(9); + + IModel* model = GET_ARG(0, GetModel); + int animation = GET_ARG(1, GetInteger); + int frame = GET_ARG(2, GetDecimal) * 0x100; + float x = GET_ARG(3, GetDecimal); + float y = GET_ARG(4, GetDecimal); + float scale = GET_ARG(5, GetDecimal); + float rx = GET_ARG(6, GetDecimal); + float ry = GET_ARG(7, GetDecimal); + float rz = GET_ARG(8, GetDecimal); + + Matrix4x4 matrixScaleTranslate; + Matrix4x4::IdentityScale(&matrixScaleTranslate, scale, scale, scale); + Matrix4x4::Translate(&matrixScaleTranslate, &matrixScaleTranslate, x, y, 0); + + Matrix4x4 matrixModel; + Matrix4x4::IdentityRotationXYZ(&matrixModel, 0, ry, rz); + Matrix4x4::Multiply(&matrixModel, &matrixModel, &matrixScaleTranslate); + + Matrix4x4 matrixRotationX; + Matrix4x4::IdentityRotationX(&matrixRotationX, rx); + Matrix4x4 matrixNormal; + Matrix4x4::IdentityRotationXYZ(&matrixNormal, 0, ry, rz); + Matrix4x4::Multiply(&matrixNormal, &matrixNormal, &matrixRotationX); + + Graphics::DrawModel(model, animation, frame, &matrixModel, &matrixNormal); return NULL_VAL; } + +#define PREPARE_MATRICES(matrixModelArr, matrixNormalArr) \ + Matrix4x4* matrixModel = NULL; \ + Matrix4x4* matrixNormal = NULL; \ + Matrix4x4 sMatrixModel, sMatrixNormal; \ + if (matrixModelArr) { \ + matrixModel = &sMatrixModel; \ + PrepareMatrix(matrixModel, matrixModelArr); \ + } \ + if (matrixNormalArr) { \ + matrixNormal = &sMatrixNormal; \ + PrepareMatrix(matrixNormal, matrixNormalArr); \ + } + +static void DrawPolygon3D(VertexAttribute *data, int vertexCount, int vertexFlag, Texture* texture, ObjArray* matrixModelArr, ObjArray* matrixNormalArr) { + PREPARE_MATRICES(matrixModelArr, matrixNormalArr); + Graphics::DrawPolygon3D(data, vertexCount, vertexFlag, texture, matrixModel, matrixNormal); +} + +#define VERTEX_ARGS(num, offset) \ + int argOffset = offset; \ + for (int i = 0; i < num; i++) { \ + data[i].Position.X = FP16_TO(GET_ARG(i * 3 + argOffset, GetDecimal)); \ + data[i].Position.Y = FP16_TO(GET_ARG(i * 3 + argOffset + 1, GetDecimal)); \ + data[i].Position.Z = FP16_TO(GET_ARG(i * 3 + argOffset + 2, GetDecimal)); \ + data[i].Normal.X = data[i].Normal.Y = data[i].Normal.Z = data[i].Normal.W = 0; \ + data[i].UV.X = data[i].UV.Y = 0; \ + } \ + argOffset += 3 * num + +#define VERTEX_COLOR_ARGS(num) \ + for (int i = 0; i < num; i++) { \ + if (argCount <= i + argOffset) \ + break; \ + if (!IS_NULL(args[i + argOffset])) \ + data[i].Color = GET_ARG(i + argOffset, GetInteger); \ + else \ + data[i].Color = 0xFFFFFF; \ + } \ + argOffset += num + +#define VERTEX_UV_ARGS(num) \ + for (int i = 0; i < num; i++) { \ + if (argCount <= (i * 2) + argOffset) \ + break; \ + if (!IS_NULL(args[(i * 2) + argOffset])) \ + data[i].UV.X = FP16_TO(GET_ARG((i * 2) + argOffset, GetDecimal)); \ + if (!IS_NULL(args[(i * 2) + 1 + argOffset])) \ + data[i].UV.Y = FP16_TO(GET_ARG((i * 2) + 1 + argOffset, GetDecimal)); \ + } \ + argOffset += num * 2 + +#define GET_MATRICES(offset) \ + ObjArray* matrixModelArr = NULL; \ + if (argCount > offset && !IS_NULL(args[offset])) \ + matrixModelArr = GET_ARG(offset, GetArray); \ + ObjArray* matrixNormalArr = NULL; \ + if (argCount > offset + 1 && !IS_NULL(args[offset + 1])) \ + matrixNormalArr = GET_ARG(offset + 1, GetArray) + /*** - * Draw.UseFillSmoothing - * \desc Sets whether or not to use smoothing when drawing filled shapes. (hardware-renderer only) - * \param smoothFill (Boolean): Whether or not to use smoothing. - * \return - * \ns Draw + * Draw.Triangle3D + * \desc Draws a triangle in 3D space. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_UseFillSmoothing(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Graphics::SmoothFill = !!GET_ARG(0, GetInteger); +VMValue Draw3D_Triangle(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(9); + + VertexAttribute data[3]; + + VERTEX_ARGS(3, 0); + VERTEX_COLOR_ARGS(3); + GET_MATRICES(argOffset); + + DrawPolygon3D(data, 3, VertexType_Position | VertexType_Color, NULL, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.UseStrokeSmoothing - * \desc Sets whether or not to use smoothing when drawing un-filled shapes. (hardware-renderer only) - * \param smoothFill (Boolean): Whether or not to use smoothing. - * \ns Draw + * Draw3D.Quad + * \desc Draws a quadrilateral in 3D space. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \param z4 (Number): Z position of the fourth vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt color4 (Integer): Color of the fourth vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_UseStrokeSmoothing(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - Graphics::SmoothStroke = !!GET_ARG(0, GetInteger); +VMValue Draw3D_Quad(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(12); + + VertexAttribute data[4]; + + VERTEX_ARGS(4, 0); + VERTEX_COLOR_ARGS(4); + GET_MATRICES(argOffset); + + DrawPolygon3D(data, 4, VertexType_Position | VertexType_Color, NULL, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.SetClip - * \desc Sets the region in which drawing will occur. - * \param x (Number): X position of where to start the draw region. - * \param y (Number): Y position of where to start the draw region. - * \param width (Number): Width of the draw region. - * \param height (Number): Height of the draw region. - * \ns Draw + * Draw3D.Sprite + * \desc Draws a sprite in 3D space. + * \param sprite (Integer): Index of the loaded sprite. + * \param animation (Integer): Index of the animation entry. + * \param frame (Integer): Index of the frame in the animation entry. + * \param x (Number): X position of where to draw the sprite. + * \param y (Number): Y position of where to draw the sprite. + * \param z (Number): Z position of where to draw the sprite. + * \param flipX (Integer): Whether or not to flip the sprite horizontally. + * \param flipY (Integer): Whether or not to flip the sprite vertically. + * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. + * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_SetClip(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(4); - Graphics::SetClip((int)GET_ARG(0, GetDecimal), (int)GET_ARG(1, GetDecimal), (int)GET_ARG(2, GetDecimal), (int)GET_ARG(3, GetDecimal)); +VMValue Draw3D_Sprite(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(7); + + ISprite* sprite = GET_ARG(0, GetSprite); + int animation = GET_ARG(1, GetInteger); + int frame = GET_ARG(2, GetInteger); + float x = GET_ARG(3, GetDecimal); + float y = GET_ARG(4, GetDecimal); + float z = GET_ARG(5, GetDecimal); + int flipX = GET_ARG(6, GetInteger); + int flipY = GET_ARG(7, GetInteger); + float scaleX = 1.0f; + float scaleY = 1.0f; + if (argCount > 8) + scaleX = GET_ARG(8, GetDecimal); + if (argCount > 9) + scaleY = GET_ARG(9, GetDecimal); + + GET_MATRICES(10); + + if (Graphics::SpriteRangeCheck(sprite, animation, frame)) + return NULL_VAL; + + AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; + Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + + VertexAttribute data[4]; + + x += frameStr.OffsetX * scaleX; + y -= frameStr.OffsetY * scaleY; + + Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, scaleX, scaleY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.ClearClip - * \desc Resets the drawing region. - * \ns Draw + * Draw3D.SpritePart + * \desc Draws part of a sprite in 3D space. + * \param sprite (Integer): Index of the loaded sprite. + * \param animation (Integer): Index of the animation entry. + * \param frame (Integer): Index of the frame in the animation entry. + * \param x (Number): X position of where to draw the sprite. + * \param y (Number): Y position of where to draw the sprite. + * \param z (Number): Z position of where to draw the sprite. + * \param partX (Integer): X coordinate of part of frame to draw. + * \param partY (Integer): Y coordinate of part of frame to draw. + * \param partW (Integer): Width of part of frame to draw. + * \param partH (Integer): Height of part of frame to draw. + * \param flipX (Integer): Whether or not to flip the sprite horizontally. + * \param flipY (Integer): Whether or not to flip the sprite vertically. + * \paramOpt scaleX (Number): Scale multiplier of the sprite horizontally. + * \paramOpt scaleY (Number): Scale multiplier of the sprite vertically. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_ClearClip(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::ClearClip(); - return NULL_VAL; -} +VMValue Draw3D_SpritePart(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(11); -/*** - * Draw.Save - * \desc - * \return - * \ns Draw - */ -VMValue Draw_Save(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::Save(); + ISprite* sprite = GET_ARG(0, GetSprite); + int animation = GET_ARG(1, GetInteger); + int frame = GET_ARG(2, GetInteger); + float x = GET_ARG(3, GetDecimal); + float y = GET_ARG(4, GetDecimal); + float z = GET_ARG(5, GetDecimal); + int sx = (int)GET_ARG(6, GetDecimal); + int sy = (int)GET_ARG(7, GetDecimal); + int sw = (int)GET_ARG(8, GetDecimal); + int sh = (int)GET_ARG(9, GetDecimal); + int flipX = GET_ARG(10, GetInteger); + int flipY = GET_ARG(11, GetInteger); + float scaleX = 1.0f; + float scaleY = 1.0f; + if (argCount > 12) + scaleX = GET_ARG(12, GetDecimal); + if (argCount > 13) + scaleY = GET_ARG(13, GetDecimal); + + GET_MATRICES(14); + + if (Graphics::SpriteRangeCheck(sprite, animation, frame)) + return NULL_VAL; + + if (sw < 1 || sh < 1) + return NULL_VAL; + + AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; + Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + + VertexAttribute data[4]; + + x += frameStr.OffsetX * scaleX; + y -= frameStr.OffsetY * scaleY; + + Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, scaleX, scaleY, texture, sx, sy, sw, sh); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.Scale - * \desc - * \return - * \ns Draw + * Draw3D.Image + * \desc Draws an image in 3D space. + * \param image (Integer): Index of the loaded image. + * \param x (Number): X position of where to draw the image. + * \param y (Number): Y position of where to draw the image. + * \param z (Number): Z position of where to draw the image. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_Scale(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(2); - float x = GET_ARG(0, GetDecimal); - float y = GET_ARG(1, GetDecimal); - float z = 1.0f; if (argCount == 3) z = GET_ARG(2, GetDecimal); - Graphics::Scale(x, y, z); +VMValue Draw3D_Image(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(4); + + Image* image = GET_ARG(0, GetImage); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + float z = GET_ARG(3, GetDecimal); + + GET_MATRICES(4); + + if (!image) + return NULL_VAL; + + Texture* texture = image->TexturePtr; + VertexAttribute data[4]; + + Graphics::MakeSpritePolygon(data, x, y, z, 0, 0, 1.0f, 1.0f, texture, 0, 0, texture->Width, texture->Height); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_Normal | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.Rotate - * \desc - * \return - * \ns Draw + * Draw3D.ImagePart + * \desc Draws part of an image in 3D space. + * \param image (Integer): Index of the loaded image. + * \param x (Number): X position of where to draw the image. + * \param y (Number): Y position of where to draw the image. + * \param z (Number): Z position of where to draw the image. + * \param partX (Integer): X coordinate of part of image to draw. + * \param partY (Integer): Y coordinate of part of image to draw. + * \param partW (Integer): Width of part of image to draw. + * \param partH (Integer): Height of part of image to draw. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_Rotate(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(1); - if (argCount == 3) { - float x = GET_ARG(0, GetDecimal); - float y = GET_ARG(1, GetDecimal); - float z = GET_ARG(2, GetDecimal); - Graphics::Rotate(x, y, z); - } - else { - float z = GET_ARG(0, GetDecimal); - Graphics::Rotate(0.0f, 0.0f, z); - } +VMValue Draw3D_ImagePart(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(8); + + Image* image = GET_ARG(0, GetImage); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + float z = GET_ARG(3, GetDecimal); + int sx = (int)GET_ARG(4, GetDecimal); + int sy = (int)GET_ARG(5, GetDecimal); + int sw = (int)GET_ARG(6, GetDecimal); + int sh = (int)GET_ARG(7, GetDecimal); + + GET_MATRICES(8); + + if (!image) + return NULL_VAL; + + Texture* texture = image->TexturePtr; + VertexAttribute data[4]; + + Graphics::MakeSpritePolygon(data, x, y, z, 0, 0, 1.0f, 1.0f, texture, sx, sy, sw, sh); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_Normal | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.Restore - * \desc - * \return - * \ns Draw + * Draw3D.Tile + * \desc Draws a tile in 3D space. + * \param ID (Integer): ID of the tile to draw. + * \param x (Number): X position of where to draw the tile. + * \param y (Number): Y position of where to draw the tile. + * \param z (Number): Z position of where to draw the tile. + * \param flipX (Integer): Whether or not to flip the tile horizontally. + * \param flipY (Integer): Whether or not to flip the tile vertically. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_Restore(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::Restore(); +VMValue Draw3D_Tile(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(6); + + Uint32 id = GET_ARG(0, GetInteger); + float x = GET_ARG(1, GetDecimal); + float y = GET_ARG(2, GetDecimal); + float z = GET_ARG(3, GetDecimal); + int flipX = GET_ARG(4, GetInteger); + int flipY = GET_ARG(5, GetInteger); + + GET_MATRICES(6); + + TileSpriteInfo info; + ISprite* sprite; + if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) + sprite = info.Sprite; + else + return NULL_VAL; + + AnimFrame frameStr = sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; + Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + + VertexAttribute data[4]; + + Graphics::MakeSpritePolygon(data, x, y, z, flipX, flipY, 1.0f, 1.0f, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.Translate - * \desc - * \return - * \ns Draw + * Draw3D.TriangleTextured + * \desc Draws a textured triangle in 3D space. The texture source should be an image. + * \param image (Integer): Index of the loaded image. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt u1 (Number): Texture U of the first vertex. + * \paramOpt v1 (Number): Texture V of the first vertex. + * \paramOpt u2 (Number): Texture U of the second vertex. + * \paramOpt v2 (Number): Texture V of the second vertex. + * \paramOpt u3 (Number): Texture U of the third vertex. + * \paramOpt v3 (Number): Texture V of the third vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_Translate(int argCount, VMValue* args, Uint32 threadID) { - CHECK_AT_LEAST_ARGCOUNT(2); - float x = GET_ARG(0, GetDecimal); - float y = GET_ARG(1, GetDecimal); - float z = 0.0f; if (argCount == 3) z = GET_ARG(2, GetDecimal); - Graphics::Translate(x, y, z); +VMValue Draw3D_TriangleTextured(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(7); + + VertexAttribute data[3]; + + Image* image = GET_ARG(0, GetImage); + + VERTEX_ARGS(3, 1); + VERTEX_COLOR_ARGS(3); + + // 0 + // | \ + // 1--2 + + data[1].UV.X = FP16_TO(1.0f); + + data[2].UV.X = FP16_TO(1.0f); + data[2].UV.Y = FP16_TO(1.0f); + + VERTEX_UV_ARGS(3); + + GET_MATRICES(argOffset); + + if (image) + DrawPolygon3D(data, 3, VertexType_Position | VertexType_UV | VertexType_Color, image->TexturePtr, matrixModelArr, matrixNormalArr); return NULL_VAL; } - /*** - * Draw.SetTextureTarget - * \desc - * \return - * \ns Draw + * Draw3D.QuadTextured + * \desc Draws a textured quad in 3D space. The texture source should be an image. + * \param image (Integer): Index of the loaded image. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \param z4 (Number): Z position of the fourth vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt color4 (Integer): Color of the fourth vertex. + * \paramOpt u1 (Number): Texture U of the first vertex. + * \paramOpt v1 (Number): Texture V of the first vertex. + * \paramOpt u2 (Number): Texture U of the second vertex. + * \paramOpt v2 (Number): Texture V of the second vertex. + * \paramOpt u3 (Number): Texture U of the third vertex. + * \paramOpt v3 (Number): Texture V of the third vertex. + * \paramOpt u4 (Number): Texture U of the fourth vertex. + * \paramOpt v4 (Number): Texture V of the fourth vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_SetTextureTarget(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); +VMValue Draw3D_QuadTextured(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(13); - GameTexture* gameTexture = GET_ARG(0, GetTexture); - if (!gameTexture) - return NULL_VAL; + VertexAttribute data[4]; - Texture* texture = gameTexture->GetTexture(); - if (texture) - Graphics::SetRenderTarget(texture); + Image* image = GET_ARG(0, GetImage); + + VERTEX_ARGS(4, 1); + VERTEX_COLOR_ARGS(4); + + // 0--1 + // | | + // 3--2 + + data[1].UV.X = FP16_TO(1.0f); + + data[2].UV.X = FP16_TO(1.0f); + data[2].UV.Y = FP16_TO(1.0f); + + data[3].UV.Y = FP16_TO(1.0f); + + VERTEX_UV_ARGS(4); + + GET_MATRICES(argOffset); + + if (image) + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, image->TexturePtr, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.Clear - * \desc - * \return - * \ns Draw + * Draw3D.SpritePoints + * \desc Draws a textured rectangle in 3D space. The texture source should be a sprite. + * \param sprite (Integer): Index of the loaded sprite. + * \param animation (Integer): Index of the animation entry. + * \param frame (Integer): Index of the frame in the animation entry. + * \param flipX (Integer): Whether or not to flip the sprite horizontally. + * \param flipY (Integer): Whether or not to flip the sprite vertically. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \param z4 (Number): Z position of the fourth vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt color4 (Integer): Color of the fourth vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_Clear(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - Graphics::Clear(); +VMValue Draw3D_SpritePoints(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(16); + + VertexAttribute data[4]; + + ISprite* sprite = GET_ARG(0, GetSprite); + int animation = GET_ARG(1, GetInteger); + int frame = GET_ARG(2, GetInteger); + int flipX = GET_ARG(3, GetInteger); + int flipY = GET_ARG(4, GetInteger); + + if (Graphics::SpriteRangeCheck(sprite, animation, frame)) + return NULL_VAL; + + AnimFrame frameStr = sprite->Animations[animation].Frames[frame]; + Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + + VERTEX_ARGS(4, 5); + VERTEX_COLOR_ARGS(4); + GET_MATRICES(argOffset); + + Graphics::MakeSpritePolygonUVs(data, flipX, flipY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.ResetTextureTarget - * \desc - * \return - * \ns Draw + * Draw3D.TilePoints + * \desc Draws a textured rectangle in 3D space. + * \param ID (Integer): ID of the tile to draw. + * \param flipX (Integer): Whether or not to flip the tile horizontally. + * \param flipY (Integer): Whether or not to flip the tile vertically. + * \param x1 (Number): X position of the first vertex. + * \param y1 (Number): Y position of the first vertex. + * \param z1 (Number): Z position of the first vertex. + * \param x2 (Number): X position of the second vertex. + * \param y2 (Number): Y position of the second vertex. + * \param z2 (Number): Z position of the second vertex. + * \param x3 (Number): X position of the third vertex. + * \param y3 (Number): Y position of the third vertex. + * \param z3 (Number): Z position of the third vertex. + * \param x4 (Number): X position of the fourth vertex. + * \param y4 (Number): Y position of the fourth vertex. + * \param z4 (Number): Z position of the fourth vertex. + * \paramOpt color1 (Integer): Color of the first vertex. + * \paramOpt color2 (Integer): Color of the second vertex. + * \paramOpt color3 (Integer): Color of the third vertex. + * \paramOpt color4 (Integer): Color of the fourth vertex. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_ResetTextureTarget(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - if (Graphics::CurrentView) { - Graphics::SetRenderTarget(!Graphics::CurrentView->UseDrawTarget ? NULL : Graphics::CurrentView->DrawTarget); - Graphics::UpdateProjectionMatrix(); - } +VMValue Draw3D_TilePoints(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(15); + + VertexAttribute data[4]; + TileSpriteInfo info; + ISprite* sprite; + + Uint32 id = GET_ARG(0, GetInteger); + int flipX = GET_ARG(1, GetInteger); + int flipY = GET_ARG(2, GetInteger); + if (id < Scene::TileSpriteInfos.size() && (info = Scene::TileSpriteInfos[id]).Sprite != NULL) + sprite = info.Sprite; + else + return NULL_VAL; + + AnimFrame frameStr = sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; + Texture* texture = sprite->Spritesheets[frameStr.SheetNumber]; + + VERTEX_ARGS(4, 3); + VERTEX_COLOR_ARGS(4); + GET_MATRICES(argOffset); + + Graphics::MakeSpritePolygonUVs(data, flipX, flipY, texture, frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height); + DrawPolygon3D(data, 4, VertexType_Position | VertexType_UV | VertexType_Color, texture, matrixModelArr, matrixNormalArr); return NULL_VAL; } /*** - * Draw.UseSpriteDeform - * \desc Sets whether or not to use sprite deform when drawing. - * \param useDeform (Boolean): Whether or not to use sprite deform when drawing. - * \ns Draw + * Draw3D.SceneLayer + * \desc Draws a scene layer in 3D space. + * \param layer (Integer): Index of the layer. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_UseSpriteDeform(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int useDeform = GET_ARG(0, GetInteger); - SoftwareRenderer::UseSpriteDeform = useDeform; +VMValue Draw3D_SceneLayer(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + int layerID = GET_ARG(0, GetInteger); + + GET_MATRICES(1); + PREPARE_MATRICES(matrixModelArr, matrixNormalArr); + + SceneLayer* layer = &Scene::Layers[layerID]; + Graphics::DrawSceneLayer3D(layer, 0, 0, layer->Width, layer->Height, matrixModel, matrixNormal); return NULL_VAL; } /*** - * Draw.SetSpriteDeformLine - * \desc Sets the sprite deform line at the specified line index. - * \param deformIndex (Integer): Index of deform line. (0 = top of screen, 1 = the line below it, 2 = etc.) - * \param deformValue (Decimal): Deform value. - * \ns Draw + * Draw3D.SceneLayerPart + * \desc Draws part of a scene layer in 3D space. + * \param layer (Integer): Index of the layer. + * \param partX (Integer): X coordinate (in tiles) of part of layer to draw. + * \param partY (Integer): Y coordinate (in tiles) of part of layer to draw. + * \param partW (Integer): Width (in tiles) of part of layer to draw. + * \param partH (Integer): Height (in tiles) of part of layer to draw. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \ns Draw3D */ -VMValue Draw_SetSpriteDeformLine(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - int lineIndex = GET_ARG(0, GetInteger); - int deformValue = (int)GET_ARG(1, GetDecimal); +VMValue Draw3D_SceneLayerPart(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(5); + int layerID = GET_ARG(0, GetInteger); + int sx = (int)GET_ARG(1, GetDecimal); + int sy = (int)GET_ARG(2, GetDecimal); + int sw = (int)GET_ARG(3, GetDecimal); + int sh = (int)GET_ARG(4, GetDecimal); - SoftwareRenderer::SpriteDeformBuffer[lineIndex] = deformValue; + GET_MATRICES(5); + PREPARE_MATRICES(matrixModelArr, matrixNormalArr); + + SceneLayer* layer = &Scene::Layers[layerID]; + if (sx < 0) + sx = 0; + if (sy < 0) + sy = 0; + if (sw <= 0 || sh <= 0) + return NULL_VAL; + if (sw > layer->Width) + sw = layer->Width; + if (sh > layer->Height) + sh = layer->Height; + if (sx >= sw || sy >= sh) + return NULL_VAL; + + Graphics::DrawSceneLayer3D(layer, sx, sy, sw, sh, matrixModel, matrixNormal); return NULL_VAL; } /*** - * Draw.UseDepthTesting - * \desc Sets whether or not to do depth tests when drawing. - * \param useDepthTesting (Boolean): Whether or not to do depth tests when drawing. - * \ns Draw + * Draw3D.VertexBuffer + * \desc Draws a vertex buffer. + * \param vertexBufferIndex (Integer): The vertex buffer to draw. + * \paramOpt matrixModel (Matrix): Matrix for transforming coordinates to world space. + * \paramOpt matrixNormal (Matrix): Matrix for transforming normals. + * \return + * \ns Draw3D */ -VMValue Draw_UseDepthTesting(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - int useDepthTesting = GET_ARG(0, GetInteger); - Graphics::UseDepthTesting = useDepthTesting; - Graphics::SetDepthTesting(useDepthTesting); +VMValue Draw3D_VertexBuffer(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + Uint32 vertexBufferIndex = GET_ARG(0, GetInteger); + if (vertexBufferIndex < 0 || vertexBufferIndex >= MAX_VERTEX_BUFFERS) + return NULL_VAL; + + GET_MATRICES(1); + PREPARE_MATRICES(matrixModelArr, matrixNormalArr); + + Graphics::DrawVertexBuffer(vertexBufferIndex, matrixModel, matrixNormal); return NULL_VAL; } +#undef PREPARE_MATRICES /*** - * Draw.GetCurrentDrawGroup - * \desc Gets the draw group currently being drawn. - * \return Returns an Integer value. - * \ns Draw - */ -VMValue Draw_GetCurrentDrawGroup(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - return INTEGER_VAL(Scene::CurrentDrawGroup); -} -/*** - * Draw.CopyScreen - * \desc Copies the contents of the screen into a texture. - * \param texture (Integer): Texture index. - * \ns Draw + * Draw3D.RenderScene + * \desc Draws everything in the 3D scene. + * \param scene3DIndex (Integer): The 3D scene at the index to draw. + * \paramOpt drawMode (Integer): The type of drawing to use for the vertices in the 3D scene. + * \ns Draw3D */ -VMValue Draw_CopyScreen(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(1); - GameTexture* gameTexture = GET_ARG(0, GetTexture); - if (!gameTexture) - return NULL_VAL; - - Texture* texture = gameTexture->GetTexture(); - if (texture) { - int width = Graphics::CurrentViewport.Width; - int height = Graphics::CurrentViewport.Height; - - View* currentView = Graphics::CurrentView; - if (currentView) { - // If we are using a draw target, then we can't reliably use the - // viewport's dimensions, because it might not match the view's size - if (currentView->UseDrawTarget && currentView->DrawTarget) { - width = Graphics::CurrentView->Width; - height = Graphics::CurrentView->Height; - } - } - - Graphics::CopyScreen( - // source - 0, 0, width, height, - // dest - 0, 0, texture->Width, texture->Height, - texture - ); - } +VMValue Draw3D_RenderScene(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + Uint32 scene3DIndex = GET_ARG(0, GetInteger); + Uint32 drawMode = GET_ARG_OPT(1, GetInteger, 0); + GET_SCENE_3D(); + Graphics::DrawScene3D(scene3DIndex, drawMode); return NULL_VAL; } // #endregion @@ -4885,7 +4876,7 @@ VMValue Draw_CopyScreen(int argCount, VMValue* args, Uint32 threadID) { * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InSine(GET_ARG(0, GetDecimal))); } +VMValue Ease_InSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InSine(GET_ARG(0, GetDecimal))); } /*** * Ease.OutSine * \desc Eases the value using the "OutSine" formula. @@ -4893,7 +4884,7 @@ VMValue Ease_InSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOU * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutSine(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutSine(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutSine * \desc Eases the value using the "InOutSine" formula. @@ -4901,7 +4892,7 @@ VMValue Ease_OutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutSine(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutSine(GET_ARG(0, GetDecimal))); } /*** * Ease.InQuad * \desc Eases the value using the "InQuad" formula. @@ -4909,7 +4900,7 @@ VMValue Ease_InOutSine(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InQuad(GET_ARG(0, GetDecimal))); } +VMValue Ease_InQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InQuad(GET_ARG(0, GetDecimal))); } /*** * Ease.OutQuad * \desc Eases the value using the "OutQuad" formula. @@ -4917,7 +4908,7 @@ VMValue Ease_InQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOU * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutQuad(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutQuad(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutQuad * \desc Eases the value using the "InOutQuad" formula. @@ -4925,7 +4916,7 @@ VMValue Ease_OutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutQuad(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutQuad(GET_ARG(0, GetDecimal))); } /*** * Ease.InCubic * \desc Eases the value using the "InCubic" formula. @@ -4933,7 +4924,7 @@ VMValue Ease_InOutQuad(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InCubic(GET_ARG(0, GetDecimal))); } +VMValue Ease_InCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InCubic(GET_ARG(0, GetDecimal))); } /*** * Ease.OutCubic * \desc Eases the value using the "OutCubic" formula. @@ -4941,7 +4932,7 @@ VMValue Ease_InCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutCubic(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutCubic(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutCubic * \desc Eases the value using the "InOutCubic" formula. @@ -4949,7 +4940,7 @@ VMValue Ease_OutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGC * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutCubic(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutCubic(GET_ARG(0, GetDecimal))); } /*** * Ease.InQuart * \desc Eases the value using the "InQuart" formula. @@ -4957,7 +4948,7 @@ VMValue Ease_InOutCubic(int argCount, VMValue* args, Uint32 threadID) { CHECK_AR * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InQuart(GET_ARG(0, GetDecimal))); } +VMValue Ease_InQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InQuart(GET_ARG(0, GetDecimal))); } /*** * Ease.OutQuart * \desc Eases the value using the "OutQuart" formula. @@ -4965,7 +4956,7 @@ VMValue Ease_InQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutQuart(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutQuart(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutQuart * \desc Eases the value using the "InOutQuart" formula. @@ -4973,7 +4964,7 @@ VMValue Ease_OutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGC * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutQuart(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutQuart(GET_ARG(0, GetDecimal))); } /*** * Ease.InQuint * \desc Eases the value using the "InQuint" formula. @@ -4981,7 +4972,7 @@ VMValue Ease_InOutQuart(int argCount, VMValue* args, Uint32 threadID) { CHECK_AR * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InQuint(GET_ARG(0, GetDecimal))); } +VMValue Ease_InQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InQuint(GET_ARG(0, GetDecimal))); } /*** * Ease.OutQuint * \desc Eases the value using the "OutQuint" formula. @@ -4989,7 +4980,7 @@ VMValue Ease_InQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutQuint(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutQuint(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutQuint * \desc Eases the value using the "InOutQuint" formula. @@ -4997,7 +4988,7 @@ VMValue Ease_OutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGC * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutQuint(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutQuint(GET_ARG(0, GetDecimal))); } /*** * Ease.InExpo * \desc Eases the value using the "InExpo" formula. @@ -5005,7 +4996,7 @@ VMValue Ease_InOutQuint(int argCount, VMValue* args, Uint32 threadID) { CHECK_AR * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InExpo(GET_ARG(0, GetDecimal))); } +VMValue Ease_InExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InExpo(GET_ARG(0, GetDecimal))); } /*** * Ease.OutExpo * \desc Eases the value using the "OutExpo" formula. @@ -5013,7 +5004,7 @@ VMValue Ease_InExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOU * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutExpo(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutExpo(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutExpo * \desc Eases the value using the "InOutExpo" formula. @@ -5021,7 +5012,7 @@ VMValue Ease_OutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutExpo(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutExpo(GET_ARG(0, GetDecimal))); } /*** * Ease.InCirc * \desc Eases the value using the "InCirc" formula. @@ -5029,7 +5020,7 @@ VMValue Ease_InOutExpo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InCirc(GET_ARG(0, GetDecimal))); } +VMValue Ease_InCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InCirc(GET_ARG(0, GetDecimal))); } /*** * Ease.OutCirc * \desc Eases the value using the "OutCirc" formula. @@ -5037,7 +5028,7 @@ VMValue Ease_InCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOU * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutCirc(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutCirc(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutCirc * \desc Eases the value using the "InOutCirc" formula. @@ -5045,7 +5036,7 @@ VMValue Ease_OutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutCirc(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutCirc(GET_ARG(0, GetDecimal))); } /*** * Ease.InBack * \desc Eases the value using the "InBack" formula. @@ -5053,7 +5044,7 @@ VMValue Ease_InOutCirc(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InBack(GET_ARG(0, GetDecimal))); } +VMValue Ease_InBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InBack(GET_ARG(0, GetDecimal))); } /*** * Ease.OutBack * \desc Eases the value using the "OutBack" formula. @@ -5061,7 +5052,7 @@ VMValue Ease_InBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOU * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutBack(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutBack(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutBack * \desc Eases the value using the "InOutBack" formula. @@ -5069,7 +5060,7 @@ VMValue Ease_OutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCO * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutBack(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutBack(GET_ARG(0, GetDecimal))); } /*** * Ease.InElastic * \desc Eases the value using the "InElastic" formula. @@ -5077,7 +5068,7 @@ VMValue Ease_InOutBack(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InElastic(GET_ARG(0, GetDecimal))); } +VMValue Ease_InElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InElastic(GET_ARG(0, GetDecimal))); } /*** * Ease.OutElastic * \desc Eases the value using the "OutElastic" formula. @@ -5085,7 +5076,7 @@ VMValue Ease_InElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutElastic(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutElastic(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutElastic * \desc Eases the value using the "InOutElastic" formula. @@ -5093,7 +5084,7 @@ VMValue Ease_OutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_AR * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutElastic(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutElastic(GET_ARG(0, GetDecimal))); } /*** * Ease.InBounce * \desc Eases the value using the "InBounce" formula. @@ -5101,7 +5092,7 @@ VMValue Ease_InOutElastic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InBounce(GET_ARG(0, GetDecimal))); } +VMValue Ease_InBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InBounce(GET_ARG(0, GetDecimal))); } /*** * Ease.OutBounce * \desc Eases the value using the "OutBounce" formula. @@ -5109,7 +5100,7 @@ VMValue Ease_InBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGC * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_OutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::OutBounce(GET_ARG(0, GetDecimal))); } +VMValue Ease_OutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::OutBounce(GET_ARG(0, GetDecimal))); } /*** * Ease.InOutBounce * \desc Eases the value using the "InOutBounce" formula. @@ -5117,7 +5108,7 @@ VMValue Ease_OutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARG * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_InOutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::InOutBounce(GET_ARG(0, GetDecimal))); } +VMValue Ease_InOutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::InOutBounce(GET_ARG(0, GetDecimal))); } /*** * Ease.Triangle * \desc Eases the value using the "Triangle" formula. @@ -5125,7 +5116,7 @@ VMValue Ease_InOutBounce(int argCount, VMValue* args, Uint32 threadID) { CHECK_A * \return Eased Number value between 0.0 and 1.0. * \ns Ease */ -VMValue Ease_Triangle(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return NUMBER_VAL(Ease::Triangle(GET_ARG(0, GetDecimal))); } +VMValue Ease_Triangle(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); return DECIMAL_VAL(Ease::Triangle(GET_ARG(0, GetDecimal))); } // #endregion // #region File @@ -5167,41 +5158,282 @@ VMValue File_ReadAllText(int argCount, VMValue* args, Uint32 threadID) { ScriptManager::Unlock(); return OBJECT_VAL(text); } - return NULL_VAL; + return NULL_VAL; +} +/*** + * File.WriteAllText + * \desc Writes all text to the given filename. + * \param path (String): The path of the file to read. + * \param text (String): The text to write to the file. + * \return Returns true if successful, false if otherwise. + * \ns File + */ +VMValue File_WriteAllText(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + char* filePath = GET_ARG(0, GetString); + // To verify 2nd argument is string + GET_ARG(1, GetString); + if (ScriptManager::Lock()) { + ObjString* text = AS_STRING(args[1]); + + Stream* stream = NULL; + if (strncmp(filePath, "save://", 7) == 0) + stream = FileStream::New(filePath + 7, FileStream::SAVEGAME_ACCESS | FileStream::WRITE_ACCESS); + else + stream = FileStream::New(filePath, FileStream::WRITE_ACCESS); + if (!stream) { + ScriptManager::Unlock(); + return INTEGER_VAL(false); + } + + stream->WriteBytes(text->Chars, text->Length); + stream->Close(); + + ScriptManager::Unlock(); + return INTEGER_VAL(true); + } + return INTEGER_VAL(false); +} +// #endregion + +// #region Geometry +static vector GetPolygonPoints(ObjArray *array, const char *arrName, int threadID) { + vector input; + + for (unsigned i = 0; i < array->Values->size(); i++) { + VMValue vtxVal = (*array->Values)[i]; + + if (!IS_ARRAY(vtxVal)) { + THROW_ERROR("Expected value at index %d of %s to be of type %s instead of %s.", i, arrName, GetObjectTypeString(OBJ_ARRAY), GetValueTypeString(vtxVal)); + return {}; + } + + ObjArray* vtx = AS_ARRAY(vtxVal); + VMValue xVal = (*vtx->Values)[0]; + VMValue yVal = (*vtx->Values)[1]; + + float x, y; + + // Get X + if (IS_DECIMAL(xVal)) + x = AS_DECIMAL(xVal); + else if (IS_INTEGER(xVal)) + x = (float)(AS_INTEGER(xVal)); + else { + THROW_ERROR("Expected X value (index %d) at vertex index %d of %s to be of type %s instead of %s.", 0, i, arrName, GetTypeString(VAL_DECIMAL), GetValueTypeString(xVal)); + return {}; + } + + // Get Y + if (IS_DECIMAL(yVal)) + y = AS_DECIMAL(yVal); + else if (IS_INTEGER(yVal)) + y = (float)(AS_INTEGER(yVal)); + else { + THROW_ERROR("Expected Y value (index %d) at vertex index %d of %s to be of type %s instead of %s.", 1, i, arrName, GetTypeString(VAL_DECIMAL), GetValueTypeString(yVal)); + return {}; + } + + FVector2 vec(x, y); + + input.push_back(vec); + } + + return input; +} +/*** + * Geometry.Triangulate + * \desc Triangulates a 2D polygon. + * \param polygon (Array): Array of vertices that compromise the polygon to triangulate. + * \paramOpt holes (Array): Array of polygons that compromise the holes to be made in the resulting shape. + * \return Returns an Array containing a list of triangles, or null if the polygon could not be triangulated. + * \ns Geometry + */ +VMValue Geometry_Triangulate(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + + ObjArray* arrPoly = GET_ARG(0, GetArray); + ObjArray* arrHoles = GET_ARG_OPT(1, GetArray, nullptr); + + vector points = GetPolygonPoints(arrPoly, "polygon array", threadID); + if (!points.size()) + return NULL_VAL; + + Polygon2D inputPoly(points); + vector inputHoles; + + if (arrHoles) { + for (unsigned i = 0; i < arrHoles->Values->size(); i++) { + VMValue value = (*arrHoles->Values)[i]; + if (!IS_ARRAY(value)) { + THROW_ERROR("Expected value at index %d of holes array to be of type %s instead of %s.", i, GetObjectTypeString(OBJ_ARRAY), GetValueTypeString(value)); + return NULL_VAL; + } + + Polygon2D hole(GetPolygonPoints(AS_ARRAY(value), "holes array", threadID)); + inputHoles.push_back(hole); + } + + // Holes must not be touching each other or the bounds of the shape, so these two operations are needed + vector* unionResult = Geometry::Intersect(GeoBooleanOp_Union, GeoFillRule_EvenOdd, inputHoles, {}); + inputHoles.clear(); + for (unsigned i = 0; i < unionResult->size(); i++) + inputHoles.push_back((*unionResult)[i]); + delete unionResult; + + vector* intersectResult = Geometry::Intersect(GeoBooleanOp_Intersection, GeoFillRule_EvenOdd, inputHoles, {inputPoly}); + inputHoles.clear(); + for (unsigned i = 0; i < intersectResult->size(); i++) + inputHoles.push_back((*intersectResult)[i]); + delete intersectResult; + } + + vector* output = Geometry::Triangulate(inputPoly, inputHoles); + if (!output) + return NULL_VAL; + + ObjArray* result = NewArray(); + + for (unsigned i = 0; i < output->size(); i++) { + Polygon2D poly = (*output)[i]; + ObjArray* triArr = NewArray(); + + for (unsigned j = 0; j < 3; j++) { + ObjArray* vtx = NewArray(); + vtx->Values->push_back(DECIMAL_VAL(poly.Points[j].X)); + vtx->Values->push_back(DECIMAL_VAL(poly.Points[j].Y)); + triArr->Values->push_back(OBJECT_VAL(vtx)); + } + + result->Values->push_back(OBJECT_VAL(triArr)); + } + + delete output; + + return OBJECT_VAL(result); +} +/*** + * Geometry.Intersect + * \desc Intersects a 2D polygon. + * \param subjects (Array): Array of subject polygons. + * \param clips (Array): Array of clip polygons. + * \paramOpt booleanOp (Enum): The boolean operation. Default is . + * \paramOpt fillRule (Enum): The fill rule. Default is . + * \return Returns an Array containing a list of intersected polygons, or null if the polygon could not be intersected. + * \ns Geometry + */ +VMValue Geometry_Intersect(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(2); + + ObjArray* subjects = GET_ARG(0, GetArray); + ObjArray* clips = GET_ARG(1, GetArray); + int booleanOp = GET_ARG_OPT(2, GetInteger, GeoBooleanOp_Intersection); + int fillRule = GET_ARG_OPT(3, GetInteger, GeoFillRule_EvenOdd); + + if (booleanOp < GeoBooleanOp_Intersection || booleanOp > GeoBooleanOp_ExclusiveOr) { + OUT_OF_RANGE_ERROR("Boolean operation", booleanOp, GeoBooleanOp_Intersection, GeoBooleanOp_ExclusiveOr); + return NULL_VAL; + } + + if (fillRule < GeoFillRule_EvenOdd || fillRule > GeoFillRule_Negative) { + OUT_OF_RANGE_ERROR("Fill rule", fillRule, GeoFillRule_EvenOdd, GeoFillRule_Negative); + return NULL_VAL; + } + + vector inputSubjects; + vector inputClips; + + // Get subjects + for (unsigned i = 0; i < subjects->Values->size(); i++) { + VMValue value = (*subjects->Values)[i]; + if (!IS_ARRAY(value)) { + THROW_ERROR("Expected value at index %d of subjects array to be of type %s instead of %s.", i, GetObjectTypeString(OBJ_ARRAY), GetValueTypeString(value)); + return NULL_VAL; + } + + Polygon2D subject(GetPolygonPoints(AS_ARRAY(value), "subject array", threadID)); + inputSubjects.push_back(subject); + } + + // Get clips + for (unsigned i = 0; i < clips->Values->size(); i++) { + VMValue value = (*clips->Values)[i]; + if (!IS_ARRAY(value)) { + THROW_ERROR("Expected value at index %d of clips array to be of type %s instead of %s.", i, GetObjectTypeString(OBJ_ARRAY), GetValueTypeString(value)); + return NULL_VAL; + } + + Polygon2D clip(GetPolygonPoints(AS_ARRAY(value), "clip array", threadID)); + inputClips.push_back(clip); + } + + vector* output = Geometry::Intersect(booleanOp, fillRule, inputSubjects, inputClips); + if (!output) + return NULL_VAL; + + ObjArray* result = NewArray(); + + for (unsigned i = 0; i < output->size(); i++) { + Polygon2D& poly = (*output)[i]; + ObjArray* polyArr = NewArray(); + + for (unsigned j = 0; j < poly.Points.size(); j++) { + ObjArray* vtx = NewArray(); + vtx->Values->push_back(DECIMAL_VAL(poly.Points[j].X)); + vtx->Values->push_back(DECIMAL_VAL(poly.Points[j].Y)); + polyArr->Values->push_back(OBJECT_VAL(vtx)); + } + + result->Values->push_back(OBJECT_VAL(polyArr)); + } + + delete output; + + return OBJECT_VAL(result); } /*** - * File.WriteAllText - * \desc Writes all text to the given filename. - * \param path (String): The path of the file to read. - * \param text (String): The text to write to the file. - * \return Returns true if successful, false if otherwise. - * \ns File + * Geometry.IsPointInsidePolygon + * \desc Checks if a point is inside a polygon. + * \param polygon (Array): The polygon. + * \param pointX (Decimal): The X of the point. + * \param pointY (Decimal): The Y of the point. + * \return Returns true if the point is inside, or false if the point is outside. + * \ns Geometry */ -VMValue File_WriteAllText(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - char* filePath = GET_ARG(0, GetString); - // To verify 2nd argument is string - GET_ARG(1, GetString); - if (ScriptManager::Lock()) { - ObjString* text = AS_STRING(args[1]); +VMValue Geometry_IsPointInsidePolygon(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); - Stream* stream = NULL; - if (strncmp(filePath, "save://", 7) == 0) - stream = FileStream::New(filePath + 7, FileStream::SAVEGAME_ACCESS | FileStream::WRITE_ACCESS); - else - stream = FileStream::New(filePath, FileStream::WRITE_ACCESS); - if (!stream) { - ScriptManager::Unlock(); - return INTEGER_VAL(false); - } + ObjArray* arr = GET_ARG(0, GetArray); + float pointX = GET_ARG(1, GetDecimal); + float pointY = GET_ARG(2, GetDecimal); - stream->WriteBytes(text->Chars, text->Length); - stream->Close(); + Polygon2D polygon(GetPolygonPoints(arr, "polygon array", threadID)); - ScriptManager::Unlock(); - return INTEGER_VAL(true); - } - return INTEGER_VAL(false); + return INTEGER_VAL(polygon.IsPointInside(pointX, pointY)); +} +/*** + * Geometry.IsLineIntersectingPolygon + * \desc Checks if a line segment is intersecting a polygon. + * \param polygon (Array): The polygon to check. + * \param x1 (Decimal): The starting X of the segment. + * \param y1 (Decimal): The starting Y of the segment. + * \param x2 (Decimal): The ending X of the segment. + * \param y2 (Decimal): The ending Y of the segment. + * \return Returns true if the line segment is intersecting the polygon, or false if it is not. + * \ns Geometry + */ +VMValue Geometry_IsLineIntersectingPolygon(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(5); + + ObjArray* arr = GET_ARG(0, GetArray); + float x1 = GET_ARG(1, GetDecimal); + float y1 = GET_ARG(2, GetDecimal); + float x2 = GET_ARG(3, GetDecimal); + float y2 = GET_ARG(4, GetDecimal); + + Polygon2D polygon(GetPolygonPoints(arr, "polygon array", threadID)); + + return INTEGER_VAL(polygon.IsLineSegmentIntersecting(x1, y1, x2, y2)); } // #endregion @@ -5291,6 +5523,41 @@ VMValue HTTP_GetToFile(int argCount, VMValue* args, Uint32 threadID) { } // #endregion +// #region Image +/*** + * Image.GetWidth + * \desc Gets the width of the specified image. + * \param image (Integer): The image index to check. + * \return Returns an Integer value. + * \ns Image + */ +VMValue Image_GetWidth(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Image* image = GET_ARG(0, GetImage); + if (image) { + Texture* texture = image->TexturePtr; + return INTEGER_VAL((int)texture->Width); + } + return INTEGER_VAL(0); +} +/*** + * Image.GetHeight + * \desc Gets the height of the specified image. + * \param image (Integer): The image index to check. + * \return Returns an Integer value. + * \ns Image + */ +VMValue Image_GetHeight(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + Image* image = GET_ARG(0, GetImage); + if (image) { + Texture* texture = image->TexturePtr; + return INTEGER_VAL((int)texture->Height); + } + return INTEGER_VAL(0); +} +// #endregion + // #region Input /*** * Input.GetMouseX @@ -5301,7 +5568,7 @@ VMValue HTTP_GetToFile(int argCount, VMValue* args, Uint32 threadID) { VMValue Input_GetMouseX(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); int value; SDL_GetMouseState(&value, NULL); - return NUMBER_VAL((float)value); + return DECIMAL_VAL((float)value); } /*** * Input.GetMouseY @@ -5312,7 +5579,7 @@ VMValue Input_GetMouseX(int argCount, VMValue* args, Uint32 threadID) { VMValue Input_GetMouseY(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); int value; SDL_GetMouseState(NULL, &value); - return NUMBER_VAL((float)value); + return DECIMAL_VAL((float)value); } /*** * Input.IsMouseButtonDown @@ -5403,72 +5670,6 @@ VMValue Input_IsKeyReleased(int argCount, VMValue* args, Uint32 threadID) { int down = InputManager::IsKeyReleased(key); return INTEGER_VAL(down); } -/*** - * Input.GetControllerCount - * \desc Gets the amount of connected controllers in the device. (Deprecated; use instead.) - * \return Returns the amount of connected controllers in the device. - * \ns Input - */ -VMValue Input_GetControllerCount(int argCount, VMValue* args, Uint32 threadID) { - return Controller_GetCount(argCount, args, threadID); -} -/*** - * Input.GetControllerAttached - * \desc Gets whether the controller at the index is connected. (Deprecated; use instead.) - * \param controllerIndex (Integer): Index of the controller to check. - * \return Returns whether the controller at the index is connected. - * \ns Input - */ -VMValue Input_GetControllerAttached(int argCount, VMValue* args, Uint32 threadID) { - return Controller_IsConnected(argCount, args, threadID); -} -/*** - * Input.GetControllerHat - * \desc Gets the hat value from the controller at the index. (Deprecated; use instead.) - * \param controllerIndex (Integer): Index of the controller to check. - * \param hatIndex (Integer): Index of the hat to check. - * \return Returns the hat value from the controller at the index. - * \ns Input - */ -VMValue Input_GetControllerHat(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(2); - int controller_index = GET_ARG(0, GetInteger); - int index = GET_ARG(1, GetInteger); - CHECK_CONTROLLER_INDEX(controller_index); - return INTEGER_VAL(InputManager::ControllerGetHat(controller_index, index)); -} -/*** - * Input.GetControllerAxis - * \desc Gets the axis value from the controller at the index. (Deprecated; use instead.) - * \param controllerIndex (Integer): Index of the controller to check. - * \param axisIndex (Integer): Index of the axis to check. - * \return Returns the axis value from the controller at the index. - * \ns Input - */ -VMValue Input_GetControllerAxis(int argCount, VMValue* args, Uint32 threadID) { - return Controller_GetAxis(argCount, args, threadID); -} -/*** - * Input.GetControllerButton - * \desc Gets the button value from the controller at the index. (Deprecated; use instead.) - * \param controllerIndex (Integer): Index of the controller to check. - * \param buttonIndex (Integer): Index of the button to check. - * \return Returns the button value from the controller at the index. - * \ns Input - */ -VMValue Input_GetControllerButton(int argCount, VMValue* args, Uint32 threadID) { - return Controller_GetButton(argCount, args, threadID); -} -/*** - * Input.GetControllerName - * \desc Gets the name of the controller at the index. (Deprecated; use instead.) - * \param controllerIndex (Integer): Index of the controller to check. - * \return Returns the name of the controller at the index. - * \ns Input - */ -VMValue Input_GetControllerName(int argCount, VMValue* args, Uint32 threadID) { - return Controller_GetName(argCount, args, threadID); -} #undef CHECK_CONTROLLER_INDEX /*** * Input.GetKeyName @@ -5741,7 +5942,7 @@ VMValue Instance_GetNextInstance(int argCount, VMValue* args, Uint32 threadID) { * Instance.GetBySlotID * \desc Gets an instance by its slot ID. * \param slotID (Integer): The slot ID to search a corresponding instance for. - * \return Returns the instance corresponding to the specified slot ID, null if the instance could not be found. + * \return Returns the instance corresponding to the specified slot ID, or null if no instance was found. * \ns Instance */ VMValue Instance_GetBySlotID(int argCount, VMValue* args, Uint32 threadID) { @@ -5783,13 +5984,12 @@ VMValue Instance_Copy(int argCount, VMValue* args, Uint32 threadID) { CHECK_AT_LEAST_ARGCOUNT(2); ObjInstance* destInstance = GET_ARG(0, GetInstance); ObjInstance* srcInstance = GET_ARG(1, GetInstance); - bool copyClass = argCount >= 3 ? !!GET_ARG(2, GetInteger) : true; - bool destroySrc = argCount >= 4 ? !!GET_ARG(3, GetInteger) : false; + bool copyClass = !!GET_ARG_OPT(2, GetInteger, true); ScriptEntity* destEntity = (ScriptEntity*)destInstance->EntityPtr; ScriptEntity* srcEntity = (ScriptEntity*)srcInstance->EntityPtr; if (destEntity && srcEntity) - srcEntity->Copy(destEntity, copyClass, destroySrc); + srcEntity->Copy(destEntity, copyClass); return NULL_VAL; } @@ -5804,31 +6004,17 @@ VMValue Instance_Copy(int argCount, VMValue* args, Uint32 threadID) { VMValue Instance_ChangeClass(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); - ObjInstance* instance = GET_ARG(0, GetInstance); - char* objectName = GET_ARG(1, GetString); + ObjInstance* instance = GET_ARG(0, GetInstance); + char* className = GET_ARG(1, GetString); ScriptEntity* self = (ScriptEntity*)instance->EntityPtr; if (!self) return INTEGER_VAL(false); - if (ScriptManager::ClassExists(objectName)) { - if (!ScriptManager::Classes->Exists(objectName)) - ScriptManager::LoadObjectClass(objectName, true); - - ObjClass* klass = AS_CLASS(ScriptManager::Globals->Get(objectName)); - if (!klass) { - return INTEGER_VAL(false); - } - - instance->Object.Class = klass; - } - else { - return INTEGER_VAL(false); - } + if (self->ChangeClass(className)) + return INTEGER_VAL(true); - ObjectList* objectList = Scene::ObjectLists->Get(objectName); - self->List = objectList; - return INTEGER_VAL(true); + return INTEGER_VAL(false); } // #endregion @@ -6606,9 +6792,9 @@ VMValue Math_RadianToInteger(int argCount, VMValue* args, Uint32 threadID) { } /*** * RSDK.Math.IntegerToRadian - * \desc Gets the radian decimal conversion of an integer, based on 256. + * \desc Gets the radia Decimal conversion of an integer, based on 256. * \param integer (Integer): Integer value to convert. - * \return A radian decimal value of the converted integer. + * \return A radia Decimal value of the converted integer. * \ns RSDK.Math */ VMValue Math_IntegerToRadian(int argCount, VMValue* args, Uint32 threadID) { @@ -7191,18 +7377,22 @@ VMValue Matrix_Rotate256(int argCount, VMValue* args, Uint32 threadID) { VMValue Model_GetVertexCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(0); return INTEGER_VAL((int)model->VertexCount); } /*** * Model.GetAnimationCount * \desc Returns how many animations exist in the model. * \param model (Integer): The model index to check. - * \return The animation count. Will always return 0 for vertex-animated models. + * \return Returns an Integer value. * \ns Model */ VMValue Model_GetAnimationCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(0); return INTEGER_VAL((int)model->AnimationCount); } /*** @@ -7219,7 +7409,7 @@ VMValue Model_GetAnimationName(int argCount, VMValue* args, Uint32 threadID) { IModel* model = GET_ARG(0, GetModel); int animation = GET_ARG(1, GetInteger); - if (model->AnimationCount == 0) + if (!model || model->AnimationCount == 0) return NULL_VAL; CHECK_MODEL_ANIMATION_INDEX(animation); @@ -7241,20 +7431,24 @@ VMValue Model_GetAnimationName(int argCount, VMValue* args, Uint32 threadID) { VMValue Model_GetAnimationIndex(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(-1); char* animationName = GET_ARG(1, GetString); return INTEGER_VAL(model->GetAnimationIndex(animationName)); } /*** * Model.GetFrameCount - * \desc Returns how many frames exist in the model. + * \desc Returns how many frames exist in the model. (Deprecated; use instead.) * \param model (Integer): The model index to check. - * \return The frame count. Will always return 0 for skeletal-animated models. + * \return Returns an Integer value. * \ns Model */ VMValue Model_GetFrameCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); - return INTEGER_VAL((int)model->FrameCount); + if (!model) + return INTEGER_VAL(0); + return INTEGER_VAL((int)model->Meshes[0]->FrameCount); } /*** * Model.GetAnimationLength @@ -7268,6 +7462,8 @@ VMValue Model_GetAnimationLength(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); IModel* model = GET_ARG(0, GetModel); int animation = GET_ARG(1, GetInteger); + if (!model) + return INTEGER_VAL(0); CHECK_MODEL_ANIMATION_INDEX(animation); return INTEGER_VAL((int)model->Animations[animation]->Length); } @@ -7281,6 +7477,8 @@ VMValue Model_GetAnimationLength(int argCount, VMValue* args, Uint32 threadID) { VMValue Model_HasMaterials(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(0); return INTEGER_VAL((int)model->HasMaterials()); } /*** @@ -7293,6 +7491,8 @@ VMValue Model_HasMaterials(int argCount, VMValue* args, Uint32 threadID) { VMValue Model_HasBones(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(0); return INTEGER_VAL((int)model->HasBones()); } /*** @@ -7305,6 +7505,8 @@ VMValue Model_HasBones(int argCount, VMValue* args, Uint32 threadID) { VMValue Model_CreateArmature(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); IModel* model = GET_ARG(0, GetModel); + if (!model) + return INTEGER_VAL(-1); return INTEGER_VAL(model->NewArmature()); } /*** @@ -7322,6 +7524,9 @@ VMValue Model_PoseArmature(int argCount, VMValue* args, Uint32 threadID) { IModel* model = GET_ARG(0, GetModel); int armature = GET_ARG(1, GetInteger); + if (!model) + return NULL_VAL; + CHECK_ARMATURE_INDEX(armature); if (argCount >= 3) { @@ -7352,6 +7557,8 @@ VMValue Model_ResetArmature(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); IModel* model = GET_ARG(0, GetModel); int armature = GET_ARG(1, GetInteger); + if (!model) + return NULL_VAL; CHECK_ARMATURE_INDEX(armature); model->ArmatureList[armature]->Reset(); return NULL_VAL; @@ -7368,6 +7575,8 @@ VMValue Model_DeleteArmature(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); IModel* model = GET_ARG(0, GetModel); int armature = GET_ARG(1, GetInteger); + if (!model) + return NULL_VAL; CHECK_ARMATURE_INDEX(armature); model->DeleteArmature((size_t)armature); return NULL_VAL; @@ -7397,8 +7606,8 @@ VMValue Music_Play(int argCount, VMValue* args, Uint32 threadID) { float fadeInAfterFinished = GET_ARG_OPT(4, GetDecimal, 0.0f); if (fadeInAfterFinished < 0.f) fadeInAfterFinished = 0.f; - - AudioManager::PushMusicAt(audio, 0.0, false, 0, panning, speed, volume, fadeInAfterFinished); + if (audio) + AudioManager::PushMusicAt(audio, 0.0, false, 0, panning, speed, volume, fadeInAfterFinished); return NULL_VAL; } /*** @@ -7422,8 +7631,8 @@ VMValue Music_PlayAtTime(int argCount, VMValue* args, Uint32 threadID) { float fadeInAfterFinished = GET_ARG_OPT(5, GetDecimal, 0.0f); if (fadeInAfterFinished < 0.f) fadeInAfterFinished = 0.f; - - AudioManager::PushMusicAt(audio, start_point, false, 0, panning, speed, volume, fadeInAfterFinished); + if (audio) + AudioManager::PushMusicAt(audio, start_point, false, 0, panning, speed, volume, fadeInAfterFinished); return NULL_VAL; } /*** @@ -7435,7 +7644,8 @@ VMValue Music_PlayAtTime(int argCount, VMValue* args, Uint32 threadID) { VMValue Music_Stop(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetMusic); - AudioManager::RemoveMusic(audio); + if (audio) + AudioManager::RemoveMusic(audio); return NULL_VAL; } /*** @@ -7513,8 +7723,8 @@ VMValue Music_Loop(int argCount, VMValue* args, Uint32 threadID) { float fadeInAfterFinished = GET_ARG_OPT(6, GetDecimal, 0.0f); if (fadeInAfterFinished < 0.f) fadeInAfterFinished = 0.f; - - AudioManager::PushMusic(audio, true, loop_point, panning, speed, volume, fadeInAfterFinished); + if (audio) + AudioManager::PushMusic(audio, true, loop_point, panning, speed, volume, fadeInAfterFinished); return NULL_VAL; } /*** @@ -7542,31 +7752,36 @@ VMValue Music_LoopAtTime(int argCount, VMValue* args, Uint32 threadID) { float fadeInAfterFinished = GET_ARG_OPT(7, GetDecimal, 0.0f); if (fadeInAfterFinished < 0.f) fadeInAfterFinished = 0.f; - - AudioManager::PushMusicAt(audio, start_point, true, loop_point, panning, speed, volume, fadeInAfterFinished); + if (audio) + AudioManager::PushMusicAt(audio, start_point, true, loop_point, panning, speed, volume, fadeInAfterFinished); return NULL_VAL; } /*** * Music.IsPlaying * \desc Checks to see if the specified music is currently playing. * \param music (Integer): The music index to play. - * \return Returns whether or not the music is playing. + * \return Returns a Boolean value. * \ns Music */ VMValue Music_IsPlaying(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetMusic); + if (!audio) + return INTEGER_VAL(0); return INTEGER_VAL(AudioManager::IsPlayingMusic(audio)); } /*** * Music.GetPosition * \desc Gets the position of the current track playing. * \param music (Integer): The music index to get the current position (in seconds) of. + * \return Returns a Decimal value. * \ns Music */ VMValue Music_GetPosition(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetMusic); + if (!audio) + return DECIMAL_VAL(0.0); return DECIMAL_VAL((float)AudioManager::GetMusicPosition(audio)); } /*** @@ -7593,8 +7808,8 @@ VMValue Music_Alter(int argCount, VMValue* args, Uint32 threadID) { * Number.ToString * \desc Converts a Number to a String. * \param n (Number): Number value. - * \paramOpt base (Integer): radix - * \return + * \paramOpt base (Integer): The numerical base, or radix. + * \return Returns a String value. * \ns Number */ VMValue Number_ToString(int argCount, VMValue* args, Uint32 threadID) { @@ -7654,9 +7869,9 @@ VMValue Number_AsInteger(int argCount, VMValue* args, Uint32 threadID) { } /*** * Number.AsDecimal - * \desc Converts a Integer to an Decimal. + * \desc Converts a Integer to a Decimal. * \param n (Number): Number value. - * \return Returns an Decimal value. + * \return Returns a Decimal value. * \ns Number */ VMValue Number_AsDecimal(int argCount, VMValue* args, Uint32 threadID) { @@ -7907,10 +8122,14 @@ VMValue Palette_LoadFromImage(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); int palIndex = GET_ARG(0, GetInteger); Image* image = GET_ARG(1, GetImage); - Texture* texture = image->TexturePtr; CHECK_PALETTE_INDEX(palIndex); + if (!image) + return NULL_VAL; + + Texture* texture = image->TexturePtr; + size_t x = 0; for (size_t y = 0; y < texture->Height; y++) { @@ -7933,6 +8152,7 @@ VMValue Palette_LoadFromImage(int argCount, VMValue* args, Uint32 threadID) { * \desc Gets a color from the specified palette. * \param paletteIndex (Integer): Index of palette. * \param colorIndex (Integer): Index of color. + * \return Returns an Integer value. * \ns Palette */ VMValue Palette_GetColor(int argCount, VMValue* args, Uint32 threadID) { @@ -7957,15 +8177,56 @@ VMValue Palette_SetColor(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(3); int palIndex = GET_ARG(0, GetInteger); int colorIndex = GET_ARG(1, GetInteger); + Uint32 hex = (Uint32)GET_ARG(2, GetInteger); CHECK_PALETTE_INDEX(palIndex); CHECK_COLOR_INDEX(colorIndex); - Uint32 hex = (Uint32)GET_ARG(2, GetInteger); Uint32* color = &Graphics::PaletteColors[palIndex][colorIndex]; *color = (hex & 0xFFFFFFU) | 0xFF000000U; Graphics::ConvertFromARGBtoNative(color, 1); Graphics::PaletteUpdated = true; return NULL_VAL; } +/*** + * Palette.GetColorTransparent + * \desc Gets if the color on the specified palette is transparent. + * \param paletteIndex (Integer): Index of palette. + * \param colorIndex (Integer): Index of color. + * \return Returns a Boolean value. + * \ns Palette + */ +VMValue Palette_GetColorTransparent(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int palIndex = GET_ARG(0, GetInteger); + int colorIndex = GET_ARG(1, GetInteger); + CHECK_PALETTE_INDEX(palIndex); + CHECK_COLOR_INDEX(colorIndex); + if (Graphics::PaletteColors[palIndex][colorIndex] & 0xFF000000U) + return INTEGER_VAL(false); + return INTEGER_VAL(true); +} +/*** + * Palette.SetColorTransparent + * \desc Sets a color on the specified palette transparent. + * \param paletteIndex (Integer): Index of palette. + * \param colorIndex (Integer): Index of color. + * \param isTransparent (Boolean): Whether to make the color transparent or not. + * \ns Palette + */ +VMValue Palette_SetColorTransparent(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); + int palIndex = GET_ARG(0, GetInteger); + int colorIndex = GET_ARG(1, GetInteger); + bool isTransparent = !!GET_ARG(2, GetInteger); + CHECK_PALETTE_INDEX(palIndex); + CHECK_COLOR_INDEX(colorIndex); + Uint32* color = &Graphics::PaletteColors[palIndex][colorIndex]; + if (isTransparent) + *color &= ~0xFF000000U; + else + *color |= 0xFF000000U; + Graphics::PaletteUpdated = true; + return NULL_VAL; +} /*** * Palette.MixPalettes * \desc Mixes colors between two palettes and outputs to another palette. @@ -8096,6 +8357,18 @@ VMValue Palette_CopyColors(int argCount, VMValue* args, Uint32 threadID) { return NULL_VAL; } +/*** + * Palette.UsePaletteIndexLines + * \desc Enables or disables the global palette index table. + * \param usePaletteIndexLines (Boolean): Whether or not to use the global palette index table. + * \ns Palette + */ +VMValue Palette_UsePaletteIndexLines(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int usePaletteIndexLines = GET_ARG(0, GetInteger); + Graphics::UsePaletteIndexLines = usePaletteIndexLines; + return NULL_VAL; +} /*** * Palette.SetPaletteIndexLines * \desc Sets the palette to be used for drawing on certain Y-positions on the screen (between the start and end lines). @@ -8127,26 +8400,6 @@ VMValue Palette_SetPaletteIndexLines(int argCount, VMValue* args, Uint32 threadI // #endregion // #region Resources -// return true if we found it in the list -bool GetResourceListSpace(vector* list, ResourceType* resource, size_t* index, bool* foundEmpty) { - *foundEmpty = false; - *index = list->size(); - for (size_t i = 0, listSz = list->size(); i < listSz; i++) { - if (!(*list)[i]) { - if (!(*foundEmpty)) { - *foundEmpty = true; - *index = i; - } - continue; - } - if ((*list)[i]->FilenameHash == resource->FilenameHash) { - *index = i; - delete resource; - return true; - } - } - return false; -} /*** * Resources.LoadSprite * \desc Loads a Sprite resource, returning its Sprite index. @@ -8159,19 +8412,22 @@ VMValue Resources_LoadSprite(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->UnloadPolicy = GET_ARG(1, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::SpriteList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); - // FIXME: This needs to return -1 if LoadAnimation fails. - resource->AsSprite = new (nothrow) ISprite(filename); + resource->AsSprite = new (std::nothrow) ISprite(filename); + if (resource->AsSprite->LoadFailed) { + delete resource->AsSprite; + delete resource; + (*list)[index] = NULL; + return INTEGER_VAL(-1); + } return INTEGER_VAL((int)index); } /*** @@ -8186,18 +8442,16 @@ VMValue Resources_LoadImage(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->UnloadPolicy = GET_ARG(1, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::ImageList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); - resource->AsImage = new (nothrow) Image(filename); + resource->AsImage = new (std::nothrow) Image(filename); if (!resource->AsImage->TexturePtr) { delete resource->AsImage; delete resource; @@ -8220,20 +8474,19 @@ VMValue Resources_LoadFont(int argCount, VMValue* args, Uint32 threadID) { char* filename = GET_ARG(0, GetString); int pixel_sz = (int)GET_ARG(1, GetDecimal); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->FilenameHash = CRC32::EncryptData(&pixel_sz, sizeof(int), resource->FilenameHash); resource->UnloadPolicy = GET_ARG(2, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::SpriteList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); ResourceStream* stream = ResourceStream::New(filename); if (!stream) { + delete resource; (*list)[index] = NULL; return INTEGER_VAL(-1); } @@ -8254,25 +8507,24 @@ VMValue Resources_LoadModel(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->UnloadPolicy = GET_ARG(1, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::ModelList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); ResourceStream* stream = ResourceStream::New(filename); if (!stream) { Log::Print(Log::LOG_ERROR, "Could not read resource \"%s\"!", filename); + delete resource; (*list)[index] = NULL; return INTEGER_VAL(-1); } - resource->AsModel = new (nothrow) IModel(); + resource->AsModel = new (std::nothrow) IModel(); if (!resource->AsModel->Load(stream, filename)) { delete resource->AsModel; delete resource; @@ -8296,18 +8548,22 @@ VMValue Resources_LoadMusic(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->UnloadPolicy = GET_ARG(1, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::MusicList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); - resource->AsMusic = new (nothrow) ISound(filename); + resource->AsMusic = new (std::nothrow) ISound(filename); + if (resource->AsMusic->LoadFailed) { + delete resource->AsMusic; + delete resource; + (*list)[index] = NULL; + return INTEGER_VAL(-1); + } return INTEGER_VAL((int)index); } /*** @@ -8322,18 +8578,22 @@ VMValue Resources_LoadSound(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); - ResourceType* resource = new (nothrow) ResourceType(); + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); resource->UnloadPolicy = GET_ARG(1, GetInteger); size_t index = 0; - bool emptySlot = false; vector* list = &Scene::SoundList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); - resource->AsSound = new (nothrow) ISound(filename); + resource->AsSound = new (std::nothrow) ISound(filename); + if (resource->AsSound->LoadFailed) { + delete resource->AsSound; + delete resource; + (*list)[index] = NULL; + return INTEGER_VAL(-1); + } return INTEGER_VAL((int)index); } /*** @@ -8347,19 +8607,18 @@ VMValue Resources_LoadSound(int argCount, VMValue* args, Uint32 threadID) { VMValue Resources_LoadVideo(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); char* filename = GET_ARG(0, GetString); + int unloadPolicy = GET_ARG(1, GetInteger); - ResourceType* resource = new (nothrow) ResourceType(); +#ifdef USING_FFMPEG + ResourceType* resource = new (std::nothrow) ResourceType(); resource->FilenameHash = CRC32::EncryptString(filename); - resource->UnloadPolicy = GET_ARG(1, GetInteger); + resource->UnloadPolicy = unloadPolicy; size_t index = 0; - bool emptySlot = false; vector* list = &Scene::MediaList; - if (GetResourceListSpace(list, resource, &index, &emptySlot)) + if (Scene::GetResource(list, resource, index)) return INTEGER_VAL((int)index); - else if (emptySlot) (*list)[index] = resource; else list->push_back(resource); - #ifdef USING_FFMPEG Texture* VideoTexture = NULL; MediaSource* Source = NULL; MediaPlayer* Player = NULL; @@ -8417,15 +8676,16 @@ VMValue Resources_LoadVideo(int argCount, VMValue* args, Uint32 threadID) { Log::Print(Log::LOG_INFO, " Channels: %d", playerInfo.Audio.Output.Channels); } - MediaBag* newMediaBag = new (nothrow) MediaBag; + MediaBag* newMediaBag = new (std::nothrow) MediaBag; newMediaBag->Source = Source; newMediaBag->Player = Player; newMediaBag->VideoTexture = VideoTexture; resource->AsMedia = newMediaBag; return INTEGER_VAL((int)index); - #endif +#else return INTEGER_VAL(-1); +#endif } /*** * Resources.FileExists @@ -8768,30 +9028,20 @@ VMValue Scene_LoadNoPersistency(int argCount, VMValue* args, Uint32 threadID) { } /*** * Scene.LoadPosition - * \desc Loads the scene located in the scene list's position slot, if a scene sist is loaded. + * \desc Loads the scene located in the scene list's position slot, if a scene list is loaded. * \paramOpt persistency (Boolean): Whether or not the scene should load with persistency. * \ns Scene */ VMValue Scene_LoadPosition(int argCount, VMValue* args, Uint32 threadID) { - if (Scene::ListData.size()) { - SceneListEntry scene = Scene::ListData[Scene::ListPos]; - if (!strcmp(scene.fileType, "bin")) { - snprintf(Scene::NextScene, sizeof(Scene::NextScene), "Stages/%s/Scene%s.%s", scene.folder, scene.id, scene.fileType); - } - else { - if (scene.folder[0] == '\0') - snprintf(Scene::NextScene, sizeof(Scene::NextScene), "Scenes/%s.%s", scene.id, scene.fileType); - else - snprintf(Scene::NextScene, sizeof(Scene::NextScene), "Scenes/%s/%s.%s", scene.folder, scene.id, scene.fileType); - } - if (argCount != 0) { - CHECK_ARGCOUNT(1); - Scene::NoPersistency = !!GET_ARG(1, GetInteger); - } - else { - Scene::NoPersistency = true; - } - } + if (!SceneInfo::IsEntryValid(Scene::CurrentSceneInList)) + return NULL_VAL; + + std::string path = SceneInfo::GetFilename(Scene::CurrentSceneInList); + + StringUtils::Copy(Scene::NextScene, path.c_str(), sizeof(Scene::NextScene)); + + Scene::NoPersistency = !!GET_ARG_OPT(1, GetInteger, false); + return NULL_VAL; } /*** @@ -8918,6 +9168,18 @@ VMValue Scene_GetLayerOpacity(int argCount, VMValue* args, Uint32 threadID) { int index = GET_ARG(0, GetInteger); return DECIMAL_VAL(Scene::Layers[index].Opacity); } +/*** + * Scene.GetLayerUsePaletteIndexLines + * \desc Gets whether the layer is using the global palette index table. + * \param layerIndex (Integer): Index of layer. + * \return Returns a Boolean value. + * \ns Scene + */ +VMValue Scene_GetLayerUsePaletteIndexLines(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int index = GET_ARG(0, GetInteger); + return INTEGER_VAL(Scene::Layers[index].UsePaletteIndexLines); +} /*** * Scene.GetLayerProperty * \desc Gets a property of the specified layer. @@ -9085,22 +9347,52 @@ VMValue Scene_GetLayerOffsetX(int argCount, VMValue* args, Uint32 threadID) { * \return Returns the Y offset of a layer index. * \ns Scene */ -VMValue Scene_GetLayerOffsetY(int argCount, VMValue* args, Uint32 threadID) { +VMValue Scene_GetLayerOffsetY(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + + return INTEGER_VAL(Scene::Layers[GET_ARG(0, GetInteger)].OffsetY); +} +/*** + * Scene.GetLayerDrawGroup + * \desc Gets the draw group of the specified layer. + * \param layerIndex (Integer): Index of layer. + * \return Returns an Integer value. + * \ns Scene + */ +VMValue Scene_GetLayerDrawGroup(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + + return INTEGER_VAL(Scene::Layers[GET_ARG(0, GetInteger)].DrawGroup); +} +/*** + * Scene.GetLayerHorizontalRepeat + * \desc Gets whether or not the layer repeats horizontally. + * \param layerIndex (Integer): Index of layer. + * \return Returns a Boolean value. + * \ns Scene + */ +VMValue Scene_GetLayerHorizontalRepeat(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - return INTEGER_VAL(Scene::Layers[GET_ARG(0, GetInteger)].OffsetY); + if (Scene::Layers[GET_ARG(0, GetInteger)].Flags & SceneLayer::FLAGS_REPEAT_X) + INTEGER_VAL(true); + + return INTEGER_VAL(false); } /*** - * Scene.GetLayerDrawGroup - * \desc Sets the draw group of the specified layer. + * Scene.GetLayerVerticalRepeat + * \desc Gets whether or not the layer repeats vertically. * \param layerIndex (Integer): Index of layer. - * \param drawGroup (Integer): Number from 0 to 15. (0 = Back, 15 = Front) + * \return Returns a Boolean value. * \ns Scene */ -VMValue Scene_GetLayerDrawGroup(int argCount, VMValue* args, Uint32 threadID) { +VMValue Scene_GetLayerVerticalRepeat(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - return INTEGER_VAL(Scene::Layers[GET_ARG(0, GetInteger)].DrawGroup); + if (Scene::Layers[GET_ARG(0, GetInteger)].Flags & SceneLayer::FLAGS_REPEAT_Y) + INTEGER_VAL(true); + + return INTEGER_VAL(false); } /*** * Scene.GetTilesetCount @@ -9172,7 +9464,19 @@ VMValue Scene_GetTilesetFirstTileID(int argCount, VMValue* args, Uint32 threadID CHECK_TILESET_INDEX return INTEGER_VAL((int)Scene::Tilesets[index].StartTile); } -#undef CHECK_TILESET_INDEX +/*** + * Scene.GetTilesetPaletteIndex + * \desc Gets the palette index for the specified tileset. + * \param tilesetID (Integer): The tileset index. + * \return Returns an Integer value. + * \ns Scene + */ +VMValue Scene_GetTilesetPaletteIndex(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int index = GET_ARG(0, GetInteger); + CHECK_TILESET_INDEX + return INTEGER_VAL((int)Scene::Tilesets[index].PaletteID); +} /*** * Scene.GetTileWidth * \desc Gets the width of tiles. @@ -9193,16 +9497,6 @@ VMValue Scene_GetTileHeight(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); return INTEGER_VAL(Scene::TileHeight); } -/*** - * Scene.GetTileSize - * \desc Gets the size of tiles. (Deprecated; use and instead.) - * \return Returns the size of tiles. - * \ns Scene - */ -VMValue Scene_GetTileSize(int argCount, VMValue* args, Uint32 threadID) { - CHECK_ARGCOUNT(0); - return INTEGER_VAL(Scene::TileWidth); -} /*** * Scene.GetTileID * \desc Gets the tile's index number at the tile coordinates. @@ -9286,13 +9580,13 @@ VMValue Scene_GetDrawGroupEntityDepthSorting(int argCount, VMValue* args, Uint32 } /*** * Scene.GetListPos - * \desc Gets the current list position of the scene. + * \desc Gets the current list position of the scene. (Deprecated) * \return Returns an Integer value. * \ns Scene */ VMValue Scene_GetListPos(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); - return INTEGER_VAL(Scene::ListPos); + return INTEGER_VAL(Scene::CurrentSceneInList); } /*** * Scene.GetCurrentFolder @@ -9346,23 +9640,23 @@ VMValue Scene_GetActiveCategory(int argCount, VMValue* args, Uint32 threadID) { } /*** * Scene.GetCategoryCount - * \desc Gets the amount of categories in the scene list. + * \desc Gets the amount of categories in the scene list. (Deprecated; use instead.) * \return Returns an Integer value. * \ns Scene */ VMValue Scene_GetCategoryCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); - return INTEGER_VAL(Scene::CategoryCount); + return INTEGER_VAL((int)SceneInfo::Categories.size()); } /*** * Scene.GetStageCount - * \desc Gets the amount of stages in the scene list. + * \desc Gets the amount of stages in the scene list. (Deprecated; use instead.) * \return Returns an Integer value. * \ns Scene */ VMValue Scene_GetStageCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); - return INTEGER_VAL(Scene::StageCount); + return INTEGER_VAL((int)SceneInfo::Entries.size()); } /*** * Scene.GetDebugMode @@ -9568,50 +9862,41 @@ VMValue Scene_GetTileAnimSequenceFrame(int argCount, VMValue* args, Uint32 threa } /*** * Scene.CheckValidScene - * \desc Checks whether the scene list's position is within the list's size, if a scene list is loaded. + * \desc Checks whether the scene list's position is within the list's size, if a scene list is loaded. (Deprecated) * \return Returns a Boolean value. * \ns Scene */ VMValue Scene_CheckValidScene(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(0); - if (Scene::ListData.size()) { - if (Scene::ActiveCategory >= Scene::CategoryCount) - return INTEGER_VAL(0); - - SceneListInfo list = Scene::ListCategory[Scene::ActiveCategory]; - return INTEGER_VAL((int)(!!(Scene::ListPos >= list.sceneOffsetStart && Scene::ListPos <= list.sceneOffsetEnd))); - } - else { - return INTEGER_VAL(0); - } + if (SceneInfo::IsEntryValidInCategory(Scene::ActiveCategory, Scene::CurrentSceneInList)) + return INTEGER_VAL(true); + return INTEGER_VAL(false); } /*** * Scene.CheckSceneFolder - * \desc Checks whether the current scene's folder matches the string to check, if a scene list is loaded. + * \desc Checks whether the current scene's folder matches the string to check, if a scene list is loaded. (Deprecated) * \param folder (String): Folder name to compare. * \return Returns a Boolean value. * \ns Scene */ VMValue Scene_CheckSceneFolder(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - if (Scene::ListData.size()) - return INTEGER_VAL((int)!!(strcmp(Scene::ListData[Scene::ListPos].folder, GET_ARG(0, GetString)) == 0)); - else - return INTEGER_VAL(0); + if (SceneInfo::IsEntryValid(Scene::CurrentSceneInList)) + return INTEGER_VAL(false); + return INTEGER_VAL((int)!!(strcmp(SceneInfo::Entries[Scene::CurrentSceneInList].Folder, GET_ARG(0, GetString)) == 0)); } /*** * Scene.CheckSceneID - * \desc Checks whether the current scene's ID matches the string to check, if a scene list is loaded. + * \desc Checks whether the current scene's ID matches the string to check, if a scene list is loaded. (Deprecated) * \param id (String): ID to compare. * \return Returns a Boolean value. * \ns Scene */ VMValue Scene_CheckSceneID(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - if (Scene::ListData.size()) - return INTEGER_VAL((int)!!(strcmp(Scene::ListData[Scene::ListPos].id, GET_ARG(0, GetString)) == 0)); - else - return INTEGER_VAL(0); + if (SceneInfo::IsEntryValid(Scene::CurrentSceneInList)) + return INTEGER_VAL(false); + return INTEGER_VAL((int)!!(strcmp(SceneInfo::Entries[Scene::CurrentSceneInList].ID, GET_ARG(0, GetString)) == 0)); } /*** * Scene.IsPaused @@ -9624,17 +9909,17 @@ VMValue Scene_IsPaused(int argCount, VMValue* args, Uint32 threadID) { } /*** * Scene.SetListPos - * \desc Sets the current list position of the scene. + * \desc Sets the current list position of the scene. (Deprecated) * \ns Scene */ VMValue Scene_SetListPos(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - Scene::ListPos = GET_ARG(0, GetInteger); + Scene::CurrentSceneInList = GET_ARG(0, GetInteger); return NULL_VAL; } /*** * Scene.SetActiveCategory - * \desc Sets the current category number of the scene. + * \desc Sets the current category number of the scene. (Deprecated) * \ns Scene */ VMValue Scene_SetActiveCategory(int argCount, VMValue* args, Uint32 threadID) { @@ -9654,14 +9939,14 @@ VMValue Scene_SetDebugMode(int argCount, VMValue* args, Uint32 threadID) { } /*** * Scene.SetScene - * \desc Sets the scene if the category and scene names exist within the scene list. + * \desc Sets the scene if the category and scene names exist within the scene list. (Deprecated) * \param category (String): Category name. - * \param scene (String): Scene name. If the scene name is not found but the category name is, the + * \param scene (String): Scene name. If the scene name is not found but the category name is, the first scene in the category is used. * \ns Scene */ VMValue Scene_SetScene(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); - Scene::SetScene(GET_ARG(0, GetString), GET_ARG(1, GetString)); + Scene::SetCurrent(GET_ARG(0, GetString), GET_ARG(1, GetString)); return NULL_VAL; } /*** @@ -9710,8 +9995,6 @@ VMValue Scene_SetTile(int argCount, VMValue* args, Uint32 threadID) { *tile |= collA; *tile |= collB; - // Scene::UpdateTileBatch(layer, x / 8, y / 8); - Scene::AnyLayerTileChange = true; return NULL_VAL; @@ -9914,6 +10197,23 @@ VMValue Scene_SetTileAnimSequenceFrame(int argCount, VMValue* args, Uint32 threa return NULL_VAL; } +/*** + * Scene.SetTilesetPaletteIndex + * \desc Sets the palette index of the specified tileset. + * \param tilesetID (Integer): The tileset index. + * \param paletteIndex (Integer): The palette index. + * \ns Scene + */ +VMValue Scene_SetTilesetPaletteIndex(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int index = GET_ARG(0, GetInteger); + int palIndex = GET_ARG(1, GetInteger); + CHECK_TILESET_INDEX + CHECK_PALETTE_INDEX(palIndex); + Scene::Tilesets[index].PaletteID = (unsigned)palIndex; + return NULL_VAL; +} +#undef CHECK_TILESET_INDEX /*** * Scene.SetLayerVisible * \desc Sets the visibility of the specified layer. @@ -10046,7 +10346,45 @@ VMValue Scene_SetLayerDrawBehavior(int argCount, VMValue* args, Uint32 threadID) VMValue Scene_SetLayerRepeat(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); int index = GET_ARG(0, GetInteger); - Scene::Layers[index].Repeat = !!GET_ARG(1, GetInteger); + bool doesRepeat = !!GET_ARG(1, GetInteger); + if (doesRepeat) + Scene::Layers[index].Flags |= SceneLayer::FLAGS_REPEAT_X | SceneLayer::FLAGS_REPEAT_Y; + else + Scene::Layers[index].Flags &= ~(SceneLayer::FLAGS_REPEAT_X | SceneLayer::FLAGS_REPEAT_Y); + return NULL_VAL; +} +/*** + * Scene.SetLayerHorizontalRepeat + * \desc Sets whether or not the specified layer repeats horizontally. + * \param layerIndex (Integer): Index of layer. + * \param doesRepeat (Boolean): Whether or not the layer repeats horizontally. + * \ns Scene + */ +VMValue Scene_SetLayerHorizontalRepeat(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int index = GET_ARG(0, GetInteger); + bool doesRepeat = !!GET_ARG(1, GetInteger); + if (doesRepeat) + Scene::Layers[index].Flags |= SceneLayer::FLAGS_REPEAT_X; + else + Scene::Layers[index].Flags &= ~SceneLayer::FLAGS_REPEAT_X; + return NULL_VAL; +} +/*** + * Scene.SetLayerVerticalRepeat + * \desc Sets whether or not the specified layer repeats vertically. + * \param layerIndex (Integer): Index of layer. + * \param doesRepeat (Boolean): Whether or not the layer repeats vertically. + * \ns Scene + */ +VMValue Scene_SetLayerVerticalRepeat(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int index = GET_ARG(0, GetInteger); + bool doesRepeat = !!GET_ARG(1, GetInteger); + if (doesRepeat) + Scene::Layers[index].Flags |= SceneLayer::FLAGS_REPEAT_Y; + else + Scene::Layers[index].Flags &= ~SceneLayer::FLAGS_REPEAT_Y; return NULL_VAL; } /*** @@ -10117,6 +10455,20 @@ VMValue Scene_SetLayerOpacity(int argCount, VMValue* args, Uint32 threadID) { Scene::Layers[index].Opacity = opacity; return NULL_VAL; } +/*** + * Scene.SetLayerUsePaletteIndexLines + * \desc Enables or disables the use of the global palette index table for the specified layer. + * \param layerIndex (Integer): Index of layer. + * \param usePaletteIndexLines (Boolean): Whether the layer is using the global palette index table. + * \ns Scene + */ +VMValue Scene_SetLayerUsePaletteIndexLines(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + int index = GET_ARG(0, GetInteger); + int usePaletteIndexLines = !!GET_ARG(1, GetInteger); + Scene::Layers[index].UsePaletteIndexLines = usePaletteIndexLines; + return NULL_VAL; +} /*** * Scene.SetLayerScroll * \desc Sets the scroll values of the layer. (Horizontal Parallax = Up/Down values, Vertical Parallax = Left/Right values) @@ -10455,6 +10807,275 @@ VMValue Scene_SetTileViewRender(int argCount, VMValue* args, Uint32 threadID) { } // #endregion +// #region SceneList +/*** + * SceneList.Get + * \desc Gets the scene path for the specified category and entry. + * \param category (String): The category. + * \param entry (String): The entry. + * \return Returns a String value. + * \ns SceneList + */ +VMValue SceneList_Get(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + + int categoryID = -1; + int entryID = -1; + + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return NULL_VAL; + } + + if (IS_INTEGER(args[1])) + entryID = GET_ARG(1, GetInteger); + else { + entryID = SceneInfo::GetEntryPosInCategory(categoryID, GET_ARG(1, GetString)); + if (entryID < 0) + return NULL_VAL; + } + + int actualEntryID = SceneInfo::GetEntryID(categoryID, entryID); + if (actualEntryID < 0) + return NULL_VAL; + return OBJECT_VAL(CopyString(SceneInfo::GetFilename(entryID).c_str())); +} +/*** + * SceneList.GetEntryID + * \desc Gets the entry ID for the specified category and entry name. + * \param categoryName (String): The category name. + * \param entryName (String): The entry name. + * \return Returns the entry ID, or -1 if not found. + * \ns SceneList + */ +VMValue SceneList_GetEntryID(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + char* categoryName = GET_ARG(0, GetString); + char* entryName = GET_ARG(1, GetString); + int entryID = SceneInfo::GetEntryID(categoryName, entryName); + if (entryID < 0) + return INTEGER_VAL(-1); + return INTEGER_VAL((int)SceneInfo::Entries[entryID].CategoryPos); +} +/*** + * SceneList.GetCategoryID + * \desc Gets the category ID for the specified category name. + * \param categoryName (String): The category name. + * \return Returns the category ID, or -1 if not found. + * \ns SceneList + */ +VMValue SceneList_GetCategoryID(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + char* categoryName = GET_ARG(0, GetString); + int categoryID = SceneInfo::GetCategoryID(categoryName); + return INTEGER_VAL(categoryID); +} +/*** + * SceneList.GetEntryName + * \desc Gets the entry name for the specified category and entry. + * \param category (String): The category. + * \param entryID (Integer): The entry ID. + * \return Returns the entry name. + * \ns SceneList + */ +VMValue SceneList_GetEntryName(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + + int categoryID = -1; + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return NULL_VAL; + } + + int actualEntryID = SceneInfo::GetEntryID(categoryID, GET_ARG(1, GetInteger)); + return OBJECT_VAL(CopyString(SceneInfo::Entries[actualEntryID].Name)); +} +/*** + * SceneList.GetCategoryName + * \desc Gets the category name for the specified category ID. + * \param categoryID (Integer): The category ID. + * \return Returns the category name, or -1 if not valid. + * \ns SceneList + */ +VMValue SceneList_GetCategoryName(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(1); + int categoryID = GET_ARG(0, GetInteger); + if (!SceneInfo::IsCategoryValid(categoryID)) + return NULL_VAL; + return OBJECT_VAL(CopyString(SceneInfo::Categories[categoryID].Name)); +} +/*** + * SceneList.GetEntryProperty + * \desc Gets a property for an entry. + * \param category (String): The category. + * \param entry (String): The entry. + * \param property (String): The property. + * \return Returns a String value, or null if the entry has no such property. + * \ns SceneList + */ +VMValue SceneList_GetEntryProperty(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); + + int categoryID = -1; + int entryID = -1; + + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return NULL_VAL; + } + + if (IS_INTEGER(args[1])) + entryID = GET_ARG(1, GetInteger); + else { + entryID = SceneInfo::GetEntryPosInCategory(categoryID, GET_ARG(1, GetString)); + if (entryID < 0) + return NULL_VAL; + } + + char* propertyName = GET_ARG(2, GetString); + + int actualEntryID = SceneInfo::GetEntryID(categoryID, entryID); + if (actualEntryID < 0) + return NULL_VAL; + + char* property = SceneInfo::GetEntryProperty(actualEntryID, propertyName); + if (property == nullptr) + return NULL_VAL; + + return OBJECT_VAL(CopyString(property)); +} +/*** + * SceneList.GetCategoryProperty + * \desc Gets a property for a category. + * \param category (String): The category. + * \param property (String): The property. + * \return Returns a String value, or null if the category has no such property. + * \ns SceneList + */ +VMValue SceneList_GetCategoryProperty(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + + int categoryID = -1; + + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return NULL_VAL; + } + + char* propertyName = GET_ARG(1, GetString); + + char* property = SceneInfo::GetCategoryProperty(categoryID, propertyName); + if (property == nullptr) + return NULL_VAL; + + return OBJECT_VAL(CopyString(property)); +} +/*** + * SceneList.HasEntryProperty + * \desc Checks if a given property exists in the entry. + * \param category (String): The category. + * \param entry (String): The entry. + * \param property (String): The property. + * \return Returns true if the property exists, false if not. + * \ns SceneList + */ +VMValue SceneList_HasEntryProperty(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(3); + + int categoryID = -1; + int entryID = -1; + + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return INTEGER_VAL(false); + } + + if (IS_INTEGER(args[1])) + entryID = GET_ARG(1, GetInteger); + else { + entryID = SceneInfo::GetEntryPosInCategory(categoryID, GET_ARG(1, GetString)); + if (entryID < 0) + return INTEGER_VAL(false); + } + + int actualEntryID = SceneInfo::GetEntryID(categoryID, entryID); + if (actualEntryID < 0) + return INTEGER_VAL(false); + + return INTEGER_VAL(!!SceneInfo::HasEntryProperty(actualEntryID, GET_ARG(2, GetString))); +} +/*** + * SceneList.HasCategoryProperty + * \desc Checks if a given property exists in the category. + * \param category (String): The category. + * \param property (String): The property. + * \return Returns true if the property exists, false if not. + * \ns SceneList + */ +VMValue SceneList_HasCategoryProperty(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(2); + + int categoryID = -1; + + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else { + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (categoryID < 0) + return INTEGER_VAL(false); + } + + return INTEGER_VAL(!!SceneInfo::HasCategoryProperty(categoryID, GET_ARG(1, GetString))); +} +/*** + * SceneList.GetCategoryCount + * \desc Gets the amount of categories in the scene list. + * \return Returns an Integer value. + * \ns SceneList + */ +VMValue SceneList_GetCategoryCount(int argCount, VMValue* args, Uint32 threadID) { + CHECK_ARGCOUNT(0); + return INTEGER_VAL((int)SceneInfo::Categories.size()); +} +/*** + * SceneList.GetSceneCount + * \desc Gets the amount of scenes in a category. + * \paramOpt categoryName (String): The category name. + * \return Returns the number of scenes in the category. If categoryName is omitted, this returns the total amount of scenes in the entire list. + * \ns SceneList + */ +VMValue SceneList_GetSceneCount(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(0); + if (argCount >= 1) { + int categoryID = -1; + if (IS_INTEGER(args[0])) + categoryID = GET_ARG(0, GetInteger); + else + categoryID = SceneInfo::GetCategoryID(GET_ARG(0, GetString)); + if (!SceneInfo::IsCategoryValid(categoryID)) + return INTEGER_VAL(0); + return INTEGER_VAL((int)SceneInfo::Categories[categoryID].Count); + } + else + return INTEGER_VAL((int)SceneInfo::Entries.size()); +} +// #endregion + // #region Scene3D /*** * Scene3D.Create @@ -11402,7 +12023,7 @@ VMValue SocketClient_WriteString(int argCount, VMValue* args, Uint32 threadID) { * \paramOpt panning (Decimal): Control the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it. (0.0 is the default.) * \paramOpt speed (Decimal): Control the speed of the audio. > 1.0 makes it faster, < 1.0 is slower, 1.0 is normal speed. (1.0 is the default.) * \paramOpt volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.) - * \return Returns the channel index where the sound began to play. + * \return Returns the channel index where the sound began to play, or -1 if no channel was available. * \ns Sound */ VMValue Sound_Play(int argCount, VMValue* args, Uint32 threadID) { @@ -11411,8 +12032,11 @@ VMValue Sound_Play(int argCount, VMValue* args, Uint32 threadID) { float panning = GET_ARG_OPT(1, GetDecimal, 0.0f); float speed = GET_ARG_OPT(2, GetDecimal, 1.0f); float volume = GET_ARG_OPT(3, GetDecimal, 1.0f); - AudioManager::AudioStop(audio); - int channel = AudioManager::PlaySound(audio, false, 0, panning, speed, volume, nullptr); + int channel = -1; + if (audio) { + AudioManager::AudioStop(audio); + channel = AudioManager::PlaySound(audio, false, 0, panning, speed, volume, nullptr); + } return INTEGER_VAL(channel); } /*** @@ -11423,7 +12047,7 @@ VMValue Sound_Play(int argCount, VMValue* args, Uint32 threadID) { * \paramOpt panning (Decimal): Control the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it. (0.0 is the default.) * \paramOpt speed (Decimal): Control the speed of the audio. > 1.0 makes it faster, < 1.0 is slower, 1.0 is normal speed. (1.0 is the default.) * \paramOpt volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.) - * \return Returns the channel index where the sound began to play. + * \return Returns the channel index where the sound began to play, or -1 if no channel was available. * \ns Sound */ VMValue Sound_Loop(int argCount, VMValue* args, Uint32 threadID) { @@ -11433,49 +12057,50 @@ VMValue Sound_Loop(int argCount, VMValue* args, Uint32 threadID) { float panning = GET_ARG_OPT(2, GetDecimal, 0.0f); float speed = GET_ARG_OPT(3, GetDecimal, 1.0f); float volume = GET_ARG_OPT(4, GetDecimal, 1.0f); - AudioManager::AudioStop(audio); - int channel = AudioManager::PlaySound(audio, true, loopPoint, panning, speed, volume, nullptr); + int channel = -1; + if (audio) { + AudioManager::AudioStop(audio); + channel = AudioManager::PlaySound(audio, true, loopPoint, panning, speed, volume, nullptr); + } return INTEGER_VAL(channel); } /*** * Sound.Stop * \desc Stops an actively playing sound. * \param sound (Integer): The sound index to stop. - * \return * \ns Sound */ VMValue Sound_Stop(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); - ISound* audio = GET_ARG(0, GetSound); - - AudioManager::AudioStop(audio); + if (audio) + AudioManager::AudioStop(audio); return NULL_VAL; } /*** * Sound.Pause * \desc Pauses an actively playing sound. * \param sound (Integer): The sound index to pause. - * \return * \ns Sound */ VMValue Sound_Pause(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetSound); - AudioManager::AudioPause(audio); + if (audio) + AudioManager::AudioPause(audio); return NULL_VAL; } /*** * Sound.Resume * \desc Unpauses a paused sound. * \param sound (Integer): The sound index to resume. - * \return * \ns Sound */ VMValue Sound_Resume(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetSound); - AudioManager::AudioUnpause(audio); + if (audio) + AudioManager::AudioUnpause(audio); return NULL_VAL; } /*** @@ -11512,11 +12137,14 @@ VMValue Sound_ResumeAll(int argCount, VMValue* args, Uint32 threadID) { * Sound.IsPlaying * \param sound (Integer): The sound index. * \desc Checks whether a sound is currently playing or not. + * \return Returns a Boolean value. * \ns Sound */ VMValue Sound_IsPlaying(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISound* audio = GET_ARG(0, GetSound); + if (!audio) + return INTEGER_VAL(0); return INTEGER_VAL(AudioManager::AudioIsPlaying(audio)); } /*** @@ -11526,7 +12154,7 @@ VMValue Sound_IsPlaying(int argCount, VMValue* args, Uint32 threadID) { * \paramOpt panning (Decimal): Control the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it. (0.0 is the default.) * \paramOpt speed (Decimal): Control the speed of the audio. > 1.0 makes it faster, < 1.0 is slower, 1.0 is normal speed. (1.0 is the default.) * \paramOpt volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.) - * \return Returns the channel index where the sound began to play. + * \return Returns the channel index where the sound began to play, or -1 if no channel was available. * \ns Sound */ VMValue Sound_PlayMultiple(int argCount, VMValue* args, Uint32 threadID) { @@ -11535,7 +12163,10 @@ VMValue Sound_PlayMultiple(int argCount, VMValue* args, Uint32 threadID) { float panning = GET_ARG_OPT(1, GetDecimal, 0.0f); float speed = GET_ARG_OPT(2, GetDecimal, 1.0f); float volume = GET_ARG_OPT(3, GetDecimal, 1.0f); - int channel = AudioManager::PlaySound(audio, false, 0, panning, speed, volume, nullptr); + int channel = -1; + if (audio) { + channel = AudioManager::PlaySound(audio, false, 0, panning, speed, volume, nullptr); + } return INTEGER_VAL(channel); } /*** @@ -11546,7 +12177,7 @@ VMValue Sound_PlayMultiple(int argCount, VMValue* args, Uint32 threadID) { * \paramOpt panning (Decimal): Control the panning of the audio. -1.0 makes it sound in left ear only, 1.0 makes it sound in right ear, and closer to 0.0 centers it. (0.0 is the default.) * \paramOpt speed (Decimal): Control the speed of the audio. > 1.0 makes it faster, < 1.0 is slower, 1.0 is normal speed. (1.0 is the default.) * \paramOpt volume (Decimal): Controls the volume of the audio. 0.0 is muted, 1.0 is normal volume. (1.0 is the default.) - * \return Returns the channel index where the sound began to play. + * \return Returns the channel index where the sound began to play, or -1 if no channel was available. * \ns Sound */ VMValue Sound_LoopMultiple(int argCount, VMValue* args, Uint32 threadID) { @@ -11556,7 +12187,10 @@ VMValue Sound_LoopMultiple(int argCount, VMValue* args, Uint32 threadID) { float panning = GET_ARG_OPT(2, GetDecimal, 0.0f); float speed = GET_ARG_OPT(3, GetDecimal, 1.0f); float volume = GET_ARG_OPT(4, GetDecimal, 1.0f); - int channel = AudioManager::PlaySound(audio, true, loopPoint, panning, speed, volume, nullptr); + int channel = -1; + if (audio) { + channel = AudioManager::PlaySound(audio, true, loopPoint, panning, speed, volume, nullptr); + } return INTEGER_VAL(channel); } /*** @@ -11581,7 +12215,8 @@ VMValue Sound_PlayAtChannel(int argCount, VMValue* args, Uint32 threadID) { THROW_ERROR("Invalid channel index %d.", channel); return NULL_VAL; } - AudioManager::SetSound(channel % AudioManager::SoundArrayLength, audio, false, 0, panning, speed, volume, nullptr); + if (audio) + AudioManager::SetSound(channel % AudioManager::SoundArrayLength, audio, false, 0, panning, speed, volume, nullptr); return NULL_VAL; } /*** @@ -11608,7 +12243,8 @@ VMValue Sound_LoopAtChannel(int argCount, VMValue* args, Uint32 threadID) { THROW_ERROR("Invalid channel index %d.", channel); return NULL_VAL; } - AudioManager::SetSound(channel % AudioManager::SoundArrayLength, audio, true, loopPoint, panning, speed, volume, nullptr); + if (audio) + AudioManager::SetSound(channel % AudioManager::SoundArrayLength, audio, true, loopPoint, panning, speed, volume, nullptr); return NULL_VAL; } /*** @@ -11734,6 +12370,8 @@ VMValue Sound_IsChannelFree(int argCount, VMValue* args, Uint32 threadID) { VMValue Sprite_GetAnimationCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISprite* sprite = GET_ARG(0, GetSprite); + if (!sprite) + return INTEGER_VAL(0); return INTEGER_VAL((int)sprite->Animations.size()); } /*** @@ -11748,6 +12386,8 @@ VMValue Sprite_GetAnimationName(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); int index = GET_ARG(1, GetInteger); + if (!sprite) + return NULL_VAL; CHECK_ANIMATION_INDEX(index); return OBJECT_VAL(CopyString(sprite->Animations[index].Name)); } @@ -11763,6 +12403,8 @@ VMValue Sprite_GetAnimationIndexByName(int argCount, VMValue* args, Uint32 threa CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); char* name = GET_ARG(1, GetString); + if (!sprite) + return INTEGER_VAL(-1); for (size_t i = 0; i < sprite->Animations.size(); i++) { if (strcmp(name, sprite->Animations[i].Name) == 0) return INTEGER_VAL((int)i); @@ -11781,6 +12423,8 @@ VMValue Sprite_GetFrameLoopIndex(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMATION_INDEX(animation); return INTEGER_VAL(sprite->Animations[animation].FrameToLoop); } @@ -11796,6 +12440,8 @@ VMValue Sprite_GetFrameCount(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMATION_INDEX(animation); return INTEGER_VAL((int)sprite->Animations[animation].Frames.size()); } @@ -11813,6 +12459,8 @@ VMValue Sprite_GetFrameDuration(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].Duration); } @@ -11828,6 +12476,8 @@ VMValue Sprite_GetFrameSpeed(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMATION_INDEX(animation); return INTEGER_VAL(sprite->Animations[animation].AnimationSpeed); } @@ -11845,6 +12495,8 @@ VMValue Sprite_GetFrameWidth(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].Width); } @@ -11862,6 +12514,8 @@ VMValue Sprite_GetFrameHeight(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].Height); } @@ -11879,6 +12533,8 @@ VMValue Sprite_GetFrameID(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].Advance); } @@ -11896,6 +12552,8 @@ VMValue Sprite_GetFrameOffsetX(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].OffsetX); } @@ -11913,6 +12571,8 @@ VMValue Sprite_GetFrameOffsetY(int argCount, VMValue* args, Uint32 threadID) { ISprite* sprite = GET_ARG(0, GetSprite); int animation = GET_ARG(1, GetInteger); int frame = GET_ARG(2, GetInteger); + if (!sprite) + return INTEGER_VAL(0); CHECK_ANIMFRAME_INDEX(animation, frame); return INTEGER_VAL(sprite->Animations[animation].Frames[frame].OffsetY); } @@ -11966,6 +12626,8 @@ VMValue Sprite_MakePalettized(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(2); ISprite* sprite = GET_ARG(0, GetSprite); int palIndex = GET_ARG(1, GetInteger); + if (!sprite) + return NULL_VAL; CHECK_PALETTE_INDEX(palIndex); sprite->ConvertToPalette(palIndex); return NULL_VAL; @@ -11979,7 +12641,8 @@ VMValue Sprite_MakePalettized(int argCount, VMValue* args, Uint32 threadID) { VMValue Sprite_MakeNonPalettized(int argCount, VMValue* args, Uint32 threadID) { CHECK_ARGCOUNT(1); ISprite* sprite = GET_ARG(0, GetSprite); - sprite->ConvertToRGBA(); + if (sprite) + sprite->ConvertToRGBA(); return NULL_VAL; } #undef CHECK_ANIMATION_INDEX @@ -12759,9 +13422,9 @@ VMValue String_ParseInteger(int argCount, VMValue* args, Uint32 threadID) { } /*** * String.ParseDecimal - * \desc Convert a String value to an Decimal value if possible. + * \desc Convert a String value to a Decimal value if possible. * \param string (String): The string to parse. - * \return Returns the value as an Decimal. + * \return Returns the value as a Decimal. * \ns String */ VMValue String_ParseDecimal(int argCount, VMValue* args, Uint32 threadID) { @@ -14447,8 +15110,8 @@ static VMValue XML_FillMap(XMLNode* parent) { size_t attrNameSize = 0; for (size_t i = 0; i < numAttr; i++) { - char *key = attributes->KeyVector[i]; - char *value = XMLParser::TokenToString(attributes->ValueMap.Get(key)); + char* key = attributes->KeyVector[i]; + char* value = XMLParser::TokenToString(attributes->ValueMap.Get(key)); size_t length = strlen(key) + 2; if (length > attrNameSize) { @@ -14465,6 +15128,8 @@ static VMValue XML_FillMap(XMLNode* parent) { keyHash = map->Keys->HashFunction(attrName, attrNameSize - 1); map->Keys->Put(keyHash, StringUtils::Duplicate(attrName)); map->Values->Put(keyHash, OBJECT_VAL(CopyString(value))); + + Memory::Free(value); } free(attrName); @@ -14557,7 +15222,8 @@ PUBLIC STATIC void StandardLibrary::Link() { #define INIT_NAMESPACE(nsName) \ ObjNamespace* ns_##nsName = InitNamespace(#nsName); \ - ScriptManager::Constants->Put(ns_##nsName->Hash, OBJECT_VAL(ns_##nsName)) + ScriptManager::Constants->Put(ns_##nsName->Hash, OBJECT_VAL(ns_##nsName)); \ + ScriptManager::AllNamespaces.push_back(ns_##nsName) #define INIT_NAMESPACED_CLASS(nsName, className) \ klass = InitClass(#className); \ ns_##nsName->Fields->Put(klass->Hash, OBJECT_VAL(klass)) @@ -14700,6 +15366,8 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Array, Clear); DEF_NATIVE(Array, Shift); DEF_NATIVE(Array, SetAll); + DEF_NATIVE(Array, Reverse); + DEF_NATIVE(Array, Sort); // #endregion // #region Controller @@ -14712,7 +15380,9 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Controller, HasShareButton); DEF_NATIVE(Controller, HasMicrophoneButton); DEF_NATIVE(Controller, HasPaddles); - DEF_NATIVE(Controller, GetButton); + DEF_NATIVE(Controller, IsButtonHeld); + DEF_NATIVE(Controller, IsButtonPressed); + DEF_NATIVE(Controller, GetButton); // deprecated DEF_NATIVE(Controller, GetAxis); DEF_NATIVE(Controller, GetType); DEF_NATIVE(Controller, GetName); @@ -14723,8 +15393,8 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Controller, Rumble); DEF_NATIVE(Controller, StopRumble); DEF_NATIVE(Controller, SetRumblePaused); - DEF_NATIVE(Controller, SetLargeMotorFrequency); - DEF_NATIVE(Controller, SetSmallMotorFrequency); + DEF_NATIVE(Controller, SetLargeMotorFrequency); // deprecated + DEF_NATIVE(Controller, SetSmallMotorFrequency); // deprecated /*** * \constant NUM_CONTROLLER_BUTTONS * \type Integer @@ -15064,40 +15734,6 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Draw, ViewPart); DEF_NATIVE(Draw, ViewSized); DEF_NATIVE(Draw, ViewPartSized); - DEF_NATIVE(Draw, BindVertexBuffer); - DEF_NATIVE(Draw, UnbindVertexBuffer); - DEF_NATIVE(Draw, BindScene3D); - DEF_NATIVE(Draw, InitArrayBuffer); // deprecated - DEF_NATIVE(Draw, BindArrayBuffer); // deprecated - DEF_NATIVE(Draw, SetArrayBufferDrawMode); // deprecated - DEF_NATIVE(Draw, SetProjectionMatrix); // deprecated - DEF_NATIVE(Draw, SetViewMatrix); // deprecated - DEF_NATIVE(Draw, SetAmbientLighting); // deprecated - DEF_NATIVE(Draw, SetDiffuseLighting); // deprecated - DEF_NATIVE(Draw, SetSpecularLighting); // deprecated - DEF_NATIVE(Draw, SetFogDensity); // deprecated - DEF_NATIVE(Draw, SetFogColor); // deprecated - DEF_NATIVE(Draw, SetClipPolygons); // deprecated - DEF_NATIVE(Draw, SetPointSize); // deprecated - DEF_NATIVE(Draw, Model); - DEF_NATIVE(Draw, ModelSkinned); - DEF_NATIVE(Draw, ModelSimple); - DEF_NATIVE(Draw, Triangle3D); - DEF_NATIVE(Draw, Quad3D); - DEF_NATIVE(Draw, Sprite3D); - DEF_NATIVE(Draw, SpritePart3D); - DEF_NATIVE(Draw, Image3D); - DEF_NATIVE(Draw, ImagePart3D); - DEF_NATIVE(Draw, Tile3D); - DEF_NATIVE(Draw, TriangleTextured); - DEF_NATIVE(Draw, QuadTextured); - DEF_NATIVE(Draw, SpritePoints); - DEF_NATIVE(Draw, TilePoints); - DEF_NATIVE(Draw, SceneLayer3D); - DEF_NATIVE(Draw, SceneLayerPart3D); - DEF_NATIVE(Draw, VertexBuffer); - DEF_NATIVE(Draw, RenderArrayBuffer); // deprecated - DEF_NATIVE(Draw, RenderScene3D); DEF_NATIVE(Draw, Video); DEF_NATIVE(Draw, VideoPart); DEF_NATIVE(Draw, VideoSized); @@ -15143,7 +15779,10 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Draw, Ellipse); DEF_NATIVE(Draw, Triangle); DEF_NATIVE(Draw, TriangleBlend); + DEF_NATIVE(Draw, Quad); DEF_NATIVE(Draw, QuadBlend); + DEF_NATIVE(Draw, TriangleTextured); + DEF_NATIVE(Draw, QuadTextured); DEF_NATIVE(Draw, Rectangle); DEF_NATIVE(Draw, CircleStroke); DEF_NATIVE(Draw, EllipseStroke); @@ -15460,6 +16099,31 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_ENUM(BlendFactor_INV_DST_ALPHA); // #endregion + // #region Draw3D + INIT_CLASS(Draw3D); + DEF_NATIVE(Draw3D, BindVertexBuffer); + DEF_NATIVE(Draw3D, UnbindVertexBuffer); + DEF_NATIVE(Draw3D, BindScene); + DEF_NATIVE(Draw3D, Model); + DEF_NATIVE(Draw3D, ModelSkinned); + DEF_NATIVE(Draw3D, ModelSimple); + DEF_NATIVE(Draw3D, Triangle); + DEF_NATIVE(Draw3D, Quad); + DEF_NATIVE(Draw3D, Sprite); + DEF_NATIVE(Draw3D, SpritePart); + DEF_NATIVE(Draw3D, Image); + DEF_NATIVE(Draw3D, ImagePart); + DEF_NATIVE(Draw3D, Tile); + DEF_NATIVE(Draw3D, TriangleTextured); + DEF_NATIVE(Draw3D, QuadTextured); + DEF_NATIVE(Draw3D, SpritePoints); + DEF_NATIVE(Draw3D, TilePoints); + DEF_NATIVE(Draw3D, SceneLayer); + DEF_NATIVE(Draw3D, SceneLayerPart); + DEF_NATIVE(Draw3D, VertexBuffer); + DEF_NATIVE(Draw3D, RenderScene); + // #endregion + // #region Tile Collision States /*** * \enum TILECOLLISION_NONE @@ -15596,86 +16260,86 @@ PUBLIC STATIC void StandardLibrary::Link() { // #region Hitbox Sides /*** - * \enum LEFT + * \enum HitboxSide_LEFT * \desc Left side, slot 0 of a hitbox array. */ - DEF_ENUM(LEFT); + DEF_ENUM(HitboxSide_LEFT); /*** - * \enum TOP + * \enum HitboxSide_TOP * \desc Top side, slot 1 of a hitbox array. */ - DEF_ENUM(TOP); + DEF_ENUM(HitboxSide_TOP); /*** - * \enum RIGHT + * \enum HitboxSide_RIGHT * \desc Right side, slot 2 of a hitbox array. */ - DEF_ENUM(RIGHT); + DEF_ENUM(HitboxSide_RIGHT); /*** - * \enum BOTTOM + * \enum HitboxSide_BOTTOM * \desc Bottom side, slot 3 of a hitbox array. */ - DEF_ENUM(BOTTOM); + DEF_ENUM(HitboxSide_BOTTOM); // #endregion // #region Weekdays /*** - * \enum SUNDAY - * \desc The first day of the week (value 0). + * \enum Weekday_SUNDAY + * \desc The first day of the week. */ - DEF_ENUM(SUNDAY); + DEF_CONST_INT("Weekday_SUNDAY", (int)Weekday::SUNDAY); /*** - * \enum MONDAY - * \desc The second day of the week (value 1). + * \enum Weekday_MONDAY + * \desc The second day of the week. */ - DEF_ENUM(MONDAY); + DEF_CONST_INT("Weekday_MONDAY", (int)Weekday::MONDAY); /*** - * \enum TUESDAY - * \desc The third day of the week (value 2). + * \enum Weekday_TUESDAY + * \desc The third day of the week. */ - DEF_ENUM(TUESDAY); + DEF_CONST_INT("Weekday_TUESDAY", (int)Weekday::TUESDAY); /*** - * \enum WEDNESDAY - * \desc The fourth day of the week (value 3). + * \enum Weekday_WEDNESDAY + * \desc The fourth day of the week. */ - DEF_ENUM(WEDNESDAY); + DEF_CONST_INT("Weekday_WEDNESDAY", (int)Weekday::WEDNESDAY); /*** - * \enum THURSDAY - * \desc The fifth day of the week (value 4). + * \enum Weekday_THURSDAY + * \desc The fifth day of the week. */ - DEF_ENUM(THURSDAY); + DEF_CONST_INT("Weekday_THURSDAY", (int)Weekday::THURSDAY); /*** - * \enum FRIDAY - * \desc The sixth day of the week (value 5). + * \enum Weekday_FRIDAY + * \desc The sixth day of the week. */ - DEF_ENUM(FRIDAY); + DEF_CONST_INT("Weekday_FRIDAY", (int)Weekday::FRIDAY); /*** - * \enum SATURDAY - * \desc The seventh day of the week (value 6). + * \enum Weekday_SATURDAY + * \desc The seventh day of the week. */ - DEF_ENUM(SATURDAY); + DEF_CONST_INT("Weekday_SATURDAY", (int)Weekday::SATURDAY); // #endregion // #region TimesOfDay /*** - * \enum MORNING - * \desc The early hours of the day (5AM to 11AM, 0500 to 1100). + * \enum TimeOfDay_MORNING + * \desc The early hours of the day (5AM to 11AM, or 05:00 to 11:00). */ - DEF_ENUM(MORNING); + DEF_CONST_INT("TimeOfDay_MORNING", (int)TimeOfDay::MORNING); /*** - * \enum MIDDAY - * \desc The middle hours of the day (12PM to 4PM, 1200 to 1600). + * \enum TimeOfDay_MIDDAY + * \desc The middle hours of the day (12PM to 4PM, or 12:00 to 16:00). */ - DEF_ENUM(MIDDAY); + DEF_CONST_INT("TimeOfDay_MIDDAY", (int)TimeOfDay::MIDDAY); /*** - * \enum EVENING - * \desc The later hours of the day (5PM to 8PM, 1700 to 2000). + * \enum TimeOfDay_EVENING + * \desc The later hours of the day (5PM to 8PM, or 17:00 to 20:00). */ - DEF_ENUM(EVENING); + DEF_CONST_INT("TimeOfDay_EVENING", (int)TimeOfDay::EVENING); /*** - * \enum NIGHT - * \desc The very late and very early hours of the day (9PM to 4AM, 2100 to 400). + * \enum TimeOfDay_NIGHT + * \desc The very late and very early hours of the day (9PM to 4AM, or 21:00 to 4:00). */ - DEF_ENUM(NIGHT); + DEF_CONST_INT("TimeOfDay_NIGHT", (int)TimeOfDay::NIGHT); // #endregion // #region Ease @@ -15720,12 +16384,68 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(File, WriteAllText); // #endregion + // #region Geometry + INIT_CLASS(Geometry); + DEF_NATIVE(Geometry, Triangulate); + DEF_NATIVE(Geometry, Intersect); + DEF_NATIVE(Geometry, IsPointInsidePolygon); + DEF_NATIVE(Geometry, IsLineIntersectingPolygon); + + /*** + * \enum GeoBooleanOp_Intersection + * \desc AND operation. + */ + DEF_ENUM(GeoBooleanOp_Intersection); + /*** + * \enum GeoBooleanOp_Union + * \desc OR operation. + */ + DEF_ENUM(GeoBooleanOp_Union); + /*** + * \enum GeoBooleanOp_Difference + * \desc NOT operation. + */ + DEF_ENUM(GeoBooleanOp_Difference); + /*** + * \enum GeoBooleanOp_ExclusiveOr + * \desc XOR operation. + */ + DEF_ENUM(GeoBooleanOp_ExclusiveOr); + + /*** + * \enum GeoFillRule_EvenOdd + * \desc Only odd numbered subregions are filled. + */ + DEF_ENUM(GeoFillRule_EvenOdd); + /*** + * \enum GeoFillRule_NonZero + * \desc Only non-zero subregions are filled. + */ + DEF_ENUM(GeoFillRule_NonZero); + /*** + * \enum GeoFillRule_Positive + * \desc Only subregions that have winding counts greater than zero (> 0) are filled. + */ + DEF_ENUM(GeoFillRule_Positive); + /*** + * \enum GeoFillRule_Negative + * \desc Only subregions that have winding counts lesser than zero (< 0) are filled. + */ + DEF_ENUM(GeoFillRule_Negative); + // #endregion + // #region HTTP INIT_CLASS(HTTP); DEF_NATIVE(HTTP, GetString); DEF_NATIVE(HTTP, GetToFile); // #endregion + // #region Image + INIT_CLASS(Image); + DEF_NATIVE(Image, GetWidth); + DEF_NATIVE(Image, GetHeight); + // #endregion + // #region Input INIT_CLASS(Input); DEF_NATIVE(Input, GetMouseX); @@ -15736,12 +16456,6 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Input, IsKeyDown); DEF_NATIVE(Input, IsKeyPressed); DEF_NATIVE(Input, IsKeyReleased); - DEF_NATIVE(Input, GetControllerCount); // deprecated - DEF_NATIVE(Input, GetControllerAttached); // deprecated - DEF_NATIVE(Input, GetControllerHat); // deprecated - DEF_NATIVE(Input, GetControllerAxis); // deprecated - DEF_NATIVE(Input, GetControllerButton); // deprecated - DEF_NATIVE(Input, GetControllerName); // deprecated DEF_NATIVE(Input, GetKeyName); DEF_NATIVE(Input, GetButtonName); DEF_NATIVE(Input, GetAxisName); @@ -15918,10 +16632,13 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Palette, LoadFromImage); DEF_NATIVE(Palette, GetColor); DEF_NATIVE(Palette, SetColor); + DEF_NATIVE(Palette, GetColorTransparent); + DEF_NATIVE(Palette, SetColorTransparent); DEF_NATIVE(Palette, MixPalettes); DEF_NATIVE(Palette, RotateColorsLeft); DEF_NATIVE(Palette, RotateColorsRight); DEF_NATIVE(Palette, CopyColors); + DEF_NATIVE(Palette, UsePaletteIndexLines); DEF_NATIVE(Palette, SetPaletteIndexLines); // #endregion @@ -15971,6 +16688,7 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, GetLayerIndex); DEF_NATIVE(Scene, GetLayerVisible); DEF_NATIVE(Scene, GetLayerOpacity); + DEF_NATIVE(Scene, GetLayerUsePaletteIndexLines); DEF_NATIVE(Scene, GetLayerProperty); DEF_NATIVE(Scene, GetLayerExists); DEF_NATIVE(Scene, GetLayerDeformSplitLine); @@ -15985,9 +16703,10 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, GetLayerOffsetX); DEF_NATIVE(Scene, GetLayerOffsetY); DEF_NATIVE(Scene, GetLayerDrawGroup); + DEF_NATIVE(Scene, GetLayerHorizontalRepeat); + DEF_NATIVE(Scene, GetLayerVerticalRepeat); DEF_NATIVE(Scene, GetTileWidth); DEF_NATIVE(Scene, GetTileHeight); - DEF_NATIVE(Scene, GetTileSize); // deprecated DEF_NATIVE(Scene, GetTileID); DEF_NATIVE(Scene, GetTileFlipX); DEF_NATIVE(Scene, GetTileFlipY); @@ -15996,16 +16715,17 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, GetTilesetName); DEF_NATIVE(Scene, GetTilesetTileCount); DEF_NATIVE(Scene, GetTilesetFirstTileID); + DEF_NATIVE(Scene, GetTilesetPaletteIndex); DEF_NATIVE(Scene, GetDrawGroupCount); DEF_NATIVE(Scene, GetDrawGroupEntityDepthSorting); - DEF_NATIVE(Scene, GetListPos); + DEF_NATIVE(Scene, GetListPos); // deprecated DEF_NATIVE(Scene, GetCurrentFolder); DEF_NATIVE(Scene, GetCurrentID); DEF_NATIVE(Scene, GetCurrentSpriteFolder); DEF_NATIVE(Scene, GetCurrentCategory); DEF_NATIVE(Scene, GetActiveCategory); - DEF_NATIVE(Scene, GetCategoryCount); - DEF_NATIVE(Scene, GetStageCount); + DEF_NATIVE(Scene, GetCategoryCount); // deprecated + DEF_NATIVE(Scene, GetStageCount); // deprecated DEF_NATIVE(Scene, GetDebugMode); DEF_NATIVE(Scene, GetFirstInstance); DEF_NATIVE(Scene, GetLastInstance); @@ -16018,14 +16738,14 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, GetTileAnimSequencePaused); DEF_NATIVE(Scene, GetTileAnimSequenceSpeed); DEF_NATIVE(Scene, GetTileAnimSequenceFrame); - DEF_NATIVE(Scene, CheckValidScene); - DEF_NATIVE(Scene, CheckSceneFolder); - DEF_NATIVE(Scene, CheckSceneID); + DEF_NATIVE(Scene, CheckValidScene); // deprecated + DEF_NATIVE(Scene, CheckSceneFolder); // deprecated + DEF_NATIVE(Scene, CheckSceneID); // deprecated DEF_NATIVE(Scene, IsPaused); - DEF_NATIVE(Scene, SetListPos); - DEF_NATIVE(Scene, SetActiveCategory); + DEF_NATIVE(Scene, SetListPos); // deprecated + DEF_NATIVE(Scene, SetActiveCategory); // deprecated DEF_NATIVE(Scene, SetDebugMode); - DEF_NATIVE(Scene, SetScene); + DEF_NATIVE(Scene, SetScene); // deprecated DEF_NATIVE(Scene, SetTile); DEF_NATIVE(Scene, SetTileCollisionSides); DEF_NATIVE(Scene, SetPaused); @@ -16035,6 +16755,7 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, SetTileAnimSequencePaused); DEF_NATIVE(Scene, SetTileAnimSequenceSpeed); DEF_NATIVE(Scene, SetTileAnimSequenceFrame); + DEF_NATIVE(Scene, SetTilesetPaletteIndex); DEF_NATIVE(Scene, SetLayerVisible); DEF_NATIVE(Scene, SetLayerCollidable); DEF_NATIVE(Scene, SetLayerInternalSize); @@ -16044,10 +16765,13 @@ PUBLIC STATIC void StandardLibrary::Link() { DEF_NATIVE(Scene, SetLayerDrawGroup); DEF_NATIVE(Scene, SetLayerDrawBehavior); DEF_NATIVE(Scene, SetLayerRepeat); + DEF_NATIVE(Scene, SetLayerHorizontalRepeat); + DEF_NATIVE(Scene, SetLayerVerticalRepeat); DEF_NATIVE(Scene, SetDrawGroupCount); DEF_NATIVE(Scene, SetDrawGroupEntityDepthSorting); DEF_NATIVE(Scene, SetLayerBlend); DEF_NATIVE(Scene, SetLayerOpacity); + DEF_NATIVE(Scene, SetLayerUsePaletteIndexLines); DEF_NATIVE(Scene, SetLayerScroll); DEF_NATIVE(Scene, SetLayerSetParallaxLinesBegin); DEF_NATIVE(Scene, SetLayerSetParallaxLines); @@ -16081,6 +16805,21 @@ PUBLIC STATIC void StandardLibrary::Link() { // #endregion // #region Scene + INIT_CLASS(SceneList); + DEF_NATIVE(SceneList, Get); + DEF_NATIVE(SceneList, GetEntryID); + DEF_NATIVE(SceneList, GetCategoryID); + DEF_NATIVE(SceneList, GetEntryName); + DEF_NATIVE(SceneList, GetCategoryName); + DEF_NATIVE(SceneList, GetEntryProperty); + DEF_NATIVE(SceneList, GetCategoryProperty); + DEF_NATIVE(SceneList, HasEntryProperty); + DEF_NATIVE(SceneList, HasCategoryProperty); + DEF_NATIVE(SceneList, GetCategoryCount); + DEF_NATIVE(SceneList, GetSceneCount); + // #endregion + + // #region Scene3D INIT_CLASS(Scene3D); DEF_NATIVE(Scene3D, Create); DEF_NATIVE(Scene3D, Delete); @@ -16524,7 +17263,7 @@ PUBLIC STATIC void StandardLibrary::Link() { * \type Integer * \desc The position of the current scene in the scene list. */ - DEF_LINK_INT("Scene_ListPos", &Scene::ListPos); + DEF_LINK_INT("Scene_ListPos", &Scene::CurrentSceneInList); /*** * \global Scene_ActiveCategory * \type Integer diff --git a/source/Engine/Bytecode/TypeImpl/ArrayImpl.cpp b/source/Engine/Bytecode/TypeImpl/ArrayImpl.cpp index a2f4f952..dce38d6a 100644 --- a/source/Engine/Bytecode/TypeImpl/ArrayImpl.cpp +++ b/source/Engine/Bytecode/TypeImpl/ArrayImpl.cpp @@ -35,7 +35,7 @@ PUBLIC STATIC VMValue ArrayImpl::VM_Iterate(int argCount, VMValue* args, Uint32 if (array->Values->size() && IS_NULL(args[1])) return INTEGER_VAL(0); - else { + else if (!IS_NULL(args[1])) { int iteration = GET_ARG(1, GetInteger) + 1; if (iteration >= 0 && iteration < array->Values->size()) return INTEGER_VAL(iteration); diff --git a/source/Engine/Bytecode/TypeImpl/StringImpl.cpp b/source/Engine/Bytecode/TypeImpl/StringImpl.cpp new file mode 100644 index 00000000..9b0db657 --- /dev/null +++ b/source/Engine/Bytecode/TypeImpl/StringImpl.cpp @@ -0,0 +1,88 @@ +#if INTERFACE +#include +#include + +class StringImpl { +public: + static ObjClass *Class; +}; +#endif + +#include +#include +#include + +ObjClass* StringImpl::Class = nullptr; + +PUBLIC STATIC void StringImpl::Init() { + const char *name = "$$StringImpl"; + + Class = NewClass(Murmur::EncryptString(name)); + Class->Name = CopyString(name); + Class->ElementGet = StringImpl::VM_ElementGet; + Class->ElementSet = StringImpl::VM_ElementSet; + + ScriptManager::ClassImplList.push_back(Class); +} + +#define THROW_ERROR(...) ScriptManager::Threads[threadID].ThrowRuntimeError(false, __VA_ARGS__) + +PUBLIC STATIC bool StringImpl::VM_ElementGet(Obj* object, VMValue at, VMValue* result, Uint32 threadID) { + ObjString* string = (ObjString*)object; + + if (!IS_INTEGER(at)) { + THROW_ERROR("Cannot get value from array using non-Integer value as an index."); + if (result) + *result = NULL_VAL; + return true; + } + + int index = AS_INTEGER(at); + if (index < 0) + index = string->Length + index; + + if (index >= string->Length) { + THROW_ERROR("Index %d is out of bounds of string of length %d.", index, (int)string->Length); + if (result) + *result = NULL_VAL; + return true; + } + + if (result) + *result = OBJECT_VAL(CopyString(&string->Chars[index], 1)); + return true; +} +PUBLIC STATIC bool StringImpl::VM_ElementSet(Obj* object, VMValue at, VMValue value, Uint32 threadID) { + ObjString* string = (ObjString*)object; + + if (!IS_INTEGER(at)) { + THROW_ERROR("Cannot set value from array using non-Integer value as an index."); + return true; + } + + int index = AS_INTEGER(at); + if (index < 0) + index = string->Length + index; + + if (index >= string->Length) { + THROW_ERROR("Index %d is out of bounds of string of length %d.", index, (int)string->Length); + return true; + } + + if (IS_INTEGER(value)) { + int chr = AS_INTEGER(value); + string->Chars[index] = (Uint8)chr; + } + else if (IS_STRING(value)) { + ObjString* str = AS_STRING(value); + if (str->Length > 1) + THROW_ERROR("Cannot modify string character a String value longer than a single character."); + if (str->Length > 0) + string->Chars[index] = str->Chars[0]; + } + else { + THROW_ERROR("Cannot modify string character using non-Integer or non-String value."); + } + + return true; +} diff --git a/source/Engine/Bytecode/Types.cpp b/source/Engine/Bytecode/Types.cpp index c18a9338..5b22b5f3 100644 --- a/source/Engine/Bytecode/Types.cpp +++ b/source/Engine/Bytecode/Types.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ static Obj* AllocateObject(size_t size, ObjType type) { static ObjString* AllocateString(char* chars, size_t length, Uint32 hash) { ObjString* string = ALLOCATE_OBJ(ObjString, OBJ_STRING); Memory::Track(string, "NewString"); + string->Object.Class = StringImpl::Class; string->Length = length; string->Chars = chars; string->Hash = hash; @@ -57,6 +59,13 @@ ObjString* CopyString(const char* chars, size_t length) { ObjString* CopyString(const char* chars) { return CopyString(chars, strlen(chars)); } +ObjString* CopyString(ObjString* string) { + char* heapChars = ALLOCATE(char, string->Length + 1); + memcpy(heapChars, string->Chars, string->Length); + heapChars[string->Length] = '\0'; + + return AllocateString(heapChars, string->Length, string->Hash); +} ObjString* AllocString(size_t length) { char* heapChars = ALLOCATE(char, length + 1); heapChars[length] = '\0'; @@ -69,10 +78,11 @@ ObjFunction* NewFunction() { Memory::Track(function, "NewFunction"); function->Object.Class = FunctionImpl::Class; function->Arity = 0; + function->MinArity = 0; function->UpvalueCount = 0; + function->Module = NULL; function->Name = NULL; function->ClassName = NULL; - function->SourceFilename = NULL; function->Chunk.Init(); return function; } @@ -108,6 +118,10 @@ ObjClass* NewClass(Uint32 hash) { klass->Hash = hash; klass->Methods = new Table(NULL, 4); klass->Fields = new Table(NULL, 16); + klass->PropertyGet = NULL; + klass->PropertySet = NULL; + klass->ElementGet = NULL; + klass->ElementSet = NULL; klass->Initializer = NULL_VAL; klass->Type = CLASS_TYPE_NORMAL; klass->ParentHash = 0; @@ -120,6 +134,8 @@ ObjInstance* NewInstance(ObjClass* klass) { instance->Object.Class = klass; instance->Fields = new Table(NULL, 16); instance->EntityPtr = NULL; + instance->PropertyGet = NULL; + instance->PropertySet = NULL; return instance; } ObjBoundMethod* NewBoundMethod(VMValue receiver, ObjFunction* method) { @@ -158,16 +174,25 @@ ObjNamespace* NewNamespace(Uint32 hash) { ns->Name = NULL; ns->Hash = hash; ns->Fields = new Table(NULL, 16); + ns->InUse = false; return ns; } -ObjEnum* NewEnumeration(Uint32 hash) { +ObjEnum* NewEnum(Uint32 hash) { ObjEnum* enumeration = ALLOCATE_OBJ(ObjEnum, OBJ_ENUM); - Memory::Track(enumeration, "NewEnumeration"); + Memory::Track(enumeration, "NewEnum"); enumeration->Name = NULL; enumeration->Hash = hash; enumeration->Fields = new Table(NULL, 16); return enumeration; } +ObjModule* NewModule() { + ObjModule* module = ALLOCATE_OBJ(ObjModule, OBJ_MODULE); + Memory::Track(module, "NewModule"); + module->Functions = new vector(); + module->Locals = new vector(); + module->SourceFilename = NULL; + return module; +} bool ValuesEqual(VMValue a, VMValue b) { if (a.Type != b.Type) return false; @@ -223,6 +248,8 @@ const char* GetObjectTypeString(Uint32 type) { return "Stream"; case OBJ_NAMESPACE: return "Namespace"; + case OBJ_MODULE: + return "Module"; } return "Unknown Object Type"; } diff --git a/source/Engine/Bytecode/Types.h b/source/Engine/Bytecode/Types.h index 9f7f4964..07216f94 100644 --- a/source/Engine/Bytecode/Types.h +++ b/source/Engine/Bytecode/Types.h @@ -95,33 +95,17 @@ const char* GetValueTypeString(VMValue value); #define AS_LINKED_INTEGER(value) (*((value).as.LinkedInteger)) #define AS_LINKED_DECIMAL(value) (*((value).as.LinkedDecimal)) -#define IS_NOT_NUMBER(value) (!IS_DECIMAL(value) && !IS_INTEGER(value) && !IS_LINKED_DECIMAL(value) && !IS_LINKED_INTEGER(value)) - -// NOTE: Engine can either use integer or decimal for the number value. -// Set this to integer for Sonic, and decimal for non-optimized, floating-point projects. -// #define IE_FIXED_POINT_MATH -#ifdef IE_FIXED_POINT_MATH - #define IS_NUMBER(value) (IS_INTEGER(value)) - #define IS_LINKED_NUMBER(value) (IS_LINKED_INTEGER(value)) - #define AS_NUMBER(value) (AS_INTEGER(value)) - #define AS_LINKED_NUMBER(value) (AS_LINKED_INTEGER(value)) - #define NUMBER_VAL(value) (INTEGER_VAL(value)) - #define VAL_NUMBER VAL_INTEGER - #define VAL_LINKED_NUMBER VAL_LINKED_INTEGER - #define NUMBER_CTYPE int -#else - #define IS_NUMBER(value) (IS_DECIMAL(value)) - #define IS_LINKED_NUMBER(value) (IS_LINKED_DECIMAL(value)) - #define AS_NUMBER(value) (AS_DECIMAL(value)) - #define AS_LINKED_NUMBER(value) (AS_LINKED_DECIMAL(value)) - #define NUMBER_VAL(value) (DECIMAL_VAL(value)) - #define VAL_NUMBER VAL_DECIMAL - #define VAL_LINKED_NUMBER VAL_LINKED_DECIMAL - #define NUMBER_CTYPE float -#endif +#define IS_NUMBER(value) (IS_DECIMAL(value) || IS_INTEGER(value) || IS_LINKED_DECIMAL(value) || IS_LINKED_INTEGER(value)) +#define IS_NOT_NUMBER(value) (!IS_DECIMAL(value) && !IS_INTEGER(value) && !IS_LINKED_DECIMAL(value) && !IS_LINKED_INTEGER(value)) typedef VMValue (*NativeFn)(int argCount, VMValue* args, Uint32 threadID); +typedef bool (*ValueGetFn)(Obj* object, Uint32 hash, VMValue* value, Uint32 threadID); +typedef bool (*ValueSetFn)(Obj* object, Uint32 hash, VMValue value, Uint32 threadID); + +typedef bool (*StructGetFn)(Obj* object, VMValue at, VMValue* value, Uint32 threadID); +typedef bool (*StructSetFn)(Obj* object, VMValue at, VMValue value, Uint32 threadID); + #define OBJECT_TYPE(value) (AS_OBJECT(value)->Type) #define IS_BOUND_METHOD(value) IsObjectType(value, OBJ_BOUND_METHOD) #define IS_CLASS(value) IsObjectType(value, OBJ_CLASS) @@ -135,6 +119,7 @@ typedef VMValue (*NativeFn)(int argCount, VMValue* args, Uint32 threadID); #define IS_STREAM(value) IsObjectType(value, OBJ_STREAM) #define IS_NAMESPACE(value) IsObjectType(value, OBJ_NAMESPACE) #define IS_ENUM(value) IsObjectType(value, OBJ_ENUM) +#define IS_MODULE(value) IsObjectType(value, OBJ_MODULE) #define AS_BOUND_METHOD(value) ((ObjBoundMethod*)AS_OBJECT(value)) #define AS_CLASS(value) ((ObjClass*)AS_OBJECT(value)) @@ -149,6 +134,7 @@ typedef VMValue (*NativeFn)(int argCount, VMValue* args, Uint32 threadID); #define AS_STREAM(value) ((ObjStream*)AS_OBJECT(value)) #define AS_NAMESPACE(value) ((ObjNamespace*)AS_OBJECT(value)) #define AS_ENUM(value) ((ObjEnum*)AS_OBJECT(value)) +#define AS_MODULE(value) ((ObjModule*)AS_OBJECT(value)) enum ObjType { OBJ_BOUND_METHOD, @@ -164,10 +150,11 @@ enum ObjType { OBJ_STREAM, OBJ_NAMESPACE, OBJ_ENUM, - - MAX_OBJ_TYPE + OBJ_MODULE }; +#define MAX_OBJ_TYPE (OBJ_MODULE + 1) + typedef HashMap Table; struct Obj { @@ -182,15 +169,21 @@ struct ObjString { char* Chars; Uint32 Hash; }; +struct ObjModule { + Obj Object; + vector* Functions; + vector* Locals; + ObjString* SourceFilename; +}; struct ObjFunction { Obj Object; int Arity; + int MinArity; int UpvalueCount; struct Chunk Chunk; - size_t FunctionListOffset; + ObjModule* Module; ObjString* Name; ObjString* ClassName; - ObjString* SourceFilename; Uint32 NameHash; }; struct ObjNative { @@ -210,20 +203,26 @@ struct ObjClosure { int UpvalueCount; }; struct ObjClass { - Obj Object; - ObjString* Name; - Uint32 Hash; - Table* Methods; - Table* Fields; // Keep this as a pointer, so that a new table isn't created when passing an ObjClass value around - VMValue Initializer; - Uint8 Type; - Uint32 ParentHash; - ObjClass* Parent; + Obj Object; + ObjString* Name; + Uint32 Hash; + Table* Methods; + Table* Fields; // Keep this as a pointer, so that a new table isn't created when passing an ObjClass value around + ValueGetFn PropertyGet; + ValueSetFn PropertySet; + StructGetFn ElementGet; + StructSetFn ElementSet; + VMValue Initializer; + Uint8 Type; + Uint32 ParentHash; + ObjClass* Parent; }; struct ObjInstance { - Obj Object; - Table* Fields; - void* EntityPtr; + Obj Object; + Table* Fields; + void* EntityPtr; + ValueGetFn PropertyGet; + ValueSetFn PropertySet; }; struct ObjBoundMethod { Obj Object; @@ -240,16 +239,17 @@ struct ObjMap { HashMap* Keys; }; struct ObjStream { - Obj Object; - Stream* StreamPtr; - bool Writable; - bool Closed; + Obj Object; + Stream* StreamPtr; + bool Writable; + bool Closed; }; struct ObjNamespace { Obj Object; ObjString* Name; Uint32 Hash; Table* Fields; + bool InUse; }; struct ObjEnum { Obj Object; @@ -262,6 +262,7 @@ ObjString* TakeString(char* chars, size_t length); ObjString* TakeString(char* chars); ObjString* CopyString(const char* chars, size_t length); ObjString* CopyString(const char* chars); +ObjString* CopyString(ObjString* string); ObjString* AllocString(size_t length); ObjFunction* NewFunction(); ObjNative* NewNative(NativeFn function); @@ -274,7 +275,8 @@ ObjArray* NewArray(); ObjMap* NewMap(); ObjStream* NewStream(Stream* streamPtr, bool writable); ObjNamespace* NewNamespace(Uint32 hash); -ObjEnum* NewEnumeration(Uint32 hash); +ObjEnum* NewEnum(Uint32 hash); +ObjModule* NewModule(); #define FREE_OBJ(obj, type) \ assert(GarbageCollector::GarbageSize >= sizeof(type)); \ @@ -305,7 +307,7 @@ struct CallFrame { Uint8* IPLast; Uint8* IPStart; VMValue* Slots; - int FunctionListOffset; + ObjModule* Module; VMValue WithReceiverStack[16]; VMValue* WithReceiverStackTop = WithReceiverStack; @@ -398,6 +400,11 @@ enum OpCode { OP_IMPORT_MODULE, OP_ADD_ENUM, OP_NEW_ENUM, + OP_GET_SUPERCLASS, + OP_GET_MODULE_LOCAL, + OP_SET_MODULE_LOCAL, + OP_DEFINE_MODULE_LOCAL, + OP_USE_NAMESPACE, OP_SYNC = 0xFF, }; diff --git a/source/Engine/Bytecode/VMThread.cpp b/source/Engine/Bytecode/VMThread.cpp index 6ee57c79..a5f1409d 100644 --- a/source/Engine/Bytecode/VMThread.cpp +++ b/source/Engine/Bytecode/VMThread.cpp @@ -14,6 +14,7 @@ class VMThread { Uint32 ReturnFrame; VMValue FunctionToInvoke; + VMValue InterpretResult; enum ThreadState { CREATED = 0, @@ -150,8 +151,8 @@ PRIVATE void VMThread::PrintStackTrace(PrintBuffer* buffer, const char* error line = function->Chunk.Lines[bpos] & 0xFFFF; std::string functionName = GetFunctionName(function); - if (function->SourceFilename) - buffer_printf(buffer, "In %s of %s, line %d:\n\n %s\n", functionName.c_str(), function->SourceFilename->Chars, line, errorString); + if (function->Module->SourceFilename) + buffer_printf(buffer, "In %s of %s, line %d:\n\n %s\n", functionName.c_str(), function->Module->SourceFilename->Chars, line, errorString); else buffer_printf(buffer, "In %s, line %d:\n\n %s\n", functionName.c_str(), line, errorString); } @@ -167,7 +168,7 @@ PRIVATE void VMThread::PrintStackTrace(PrintBuffer* buffer, const char* error for (Uint32 i = 0; i < FrameCount; i++) { CallFrame* fr = &Frames[i]; function = fr->Function; - source = function->SourceFilename ? function->SourceFilename->Chars : nullptr; + source = function->Module->SourceFilename ? function->Module->SourceFilename->Chars : nullptr; line = -1; if (i > 0) { CallFrame* fr2 = &Frames[i - 1]; @@ -211,8 +212,8 @@ PUBLIC int VMThread::ThrowRuntimeError(bool fatal, const char* errorMessage, if (function) { std::string functionName = GetFunctionName(function); - if (function->SourceFilename) - buffer_printf(&buffer, "While calling %s of %s:\n\n %s\n", functionName.c_str(), function->SourceFilename->Chars, errorString); + if (function->Module->SourceFilename) + buffer_printf(&buffer, "While calling %s of %s:\n\n %s\n", functionName.c_str(), function->Module->SourceFilename->Chars, errorString); else buffer_printf(&buffer, "While calling %s:\n\n %s\n", functionName.c_str(), errorString); } @@ -240,8 +241,7 @@ PUBLIC void VMThread::PrintStack() { } } PUBLIC void VMThread::ReturnFromNative() throw() { - // std::longjmp(VMThread::JumpBuffer, 1); - // throw "should be ignored"; + } // #endregion @@ -252,14 +252,6 @@ PUBLIC void VMThread::Push(VMValue value) { return; } - // bool debugInstruction = ID == 1; - // if (debugInstruction) printf("push\n"); - - // if (IS_OBJECT(value)) { - // if (AS_OBJECT(value) == NULL) { - // ThrowRuntimeError(true, "hol up"); - // } - // } *(StackTop++) = value; } PUBLIC VMValue VMThread::Pop() { @@ -268,12 +260,13 @@ PUBLIC VMValue VMThread::Pop() { return *StackTop; } - // bool debugInstruction = ID == 1; - // if (debugInstruction) printf("pop\n"); - StackTop--; return *StackTop; } +PUBLIC void VMThread::Pop(unsigned amount) { + while (amount-- > 0) + Pop(); +} PUBLIC VMValue VMThread::Peek(int offset) { return *(StackTop - offset - 1); } @@ -396,6 +389,11 @@ PUBLIC int VMThread::RunInstruction() { VM_ADD_DISPATCH(OP_IMPORT_MODULE), VM_ADD_DISPATCH(OP_ADD_ENUM), VM_ADD_DISPATCH(OP_NEW_ENUM), + VM_ADD_DISPATCH(OP_GET_SUPERCLASS), + VM_ADD_DISPATCH(OP_GET_MODULE_LOCAL), + VM_ADD_DISPATCH(OP_SET_MODULE_LOCAL), + VM_ADD_DISPATCH(OP_DEFINE_MODULE_LOCAL), + VM_ADD_DISPATCH(OP_USE_NAMESPACE), VM_ADD_DISPATCH_NULL(OP_SYNC), }; #define VM_START(ins) goto *dispatch_table[(ins)]; @@ -487,6 +485,11 @@ PUBLIC int VMThread::RunInstruction() { PRINT_CASE(OP_IMPORT_MODULE) PRINT_CASE(OP_ADD_ENUM) PRINT_CASE(OP_NEW_ENUM) + PRINT_CASE(OP_GET_SUPERCLASS) + PRINT_CASE(OP_GET_MODULE_LOCAL) + PRINT_CASE(OP_SET_MODULE_LOCAL) + PRINT_CASE(OP_DEFINE_MODULE_LOCAL) + PRINT_CASE(OP_USE_NAMESPACE) default: Log::Print(Log::LOG_ERROR, "Unknown opcode %d\n", frame->IP); break; @@ -577,7 +580,7 @@ PUBLIC int VMThread::RunInstruction() { if (ScriptManager::Globals->GetIfExists(hash, &originalValue)) { // If the value is a class and original is a class, if (IS_CLASS(value) && IS_CLASS(originalValue)) { - DoClassExtension(value, originalValue); + DoClassExtension(value, originalValue, true); } // Otherwise, else { @@ -588,7 +591,7 @@ PUBLIC int VMThread::RunInstruction() { else if (ScriptManager::Constants->GetIfExists(hash, &originalValue)) { // If the value is a class and original is a class, if (IS_CLASS(value) && IS_CLASS(originalValue)) { - DoClassExtension(value, originalValue); + DoClassExtension(value, originalValue, true); } // Can't do that else { @@ -626,13 +629,12 @@ PUBLIC int VMThread::RunInstruction() { } ObjClass* klass = instance->Object.Class; - if (GetMethod(klass, hash)) { + if (GetProperty((Obj*)instance, klass, hash, false, instance->PropertyGet)) { ScriptManager::Unlock(); VM_BREAK; } - if (ThrowRuntimeError(false, "Could not find %s in instance!", GetVariableOrMethodName(hash)) == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_PROPERTY; + ThrowRuntimeError(false, "Could not find %s in instance!", GetVariableOrMethodName(hash)); goto FAIL_OP_GET_PROPERTY; } } @@ -641,21 +643,12 @@ PUBLIC int VMThread::RunInstruction() { ObjClass* klass = AS_CLASS(object); if (ScriptManager::Lock()) { - // Fields have priority over methods - if (klass->Fields->GetIfExists(hash, &result)) { - Pop(); - Push(ScriptManager::DelinkValue(result)); - ScriptManager::Unlock(); - VM_BREAK; - } - - if (GetMethod(klass, hash)) { + if (GetProperty((Obj*)klass, klass, hash)) { ScriptManager::Unlock(); VM_BREAK; } - if (ThrowRuntimeError(false, "Could not find %s in class!", GetVariableOrMethodName(hash)) == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_PROPERTY; + ThrowRuntimeError(false, "Could not find %s in class!", GetVariableOrMethodName(hash)); goto FAIL_OP_GET_PROPERTY; } } @@ -671,8 +664,7 @@ PUBLIC int VMThread::RunInstruction() { VM_BREAK; } - if (ThrowRuntimeError(false, "Could not find %s in namespace!", GetVariableOrMethodName(hash)) == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_PROPERTY; + ThrowRuntimeError(false, "Could not find %s in namespace!", GetVariableOrMethodName(hash)); goto FAIL_OP_GET_PROPERTY; } } @@ -681,19 +673,19 @@ PUBLIC int VMThread::RunInstruction() { ObjClass* klass = AS_OBJECT(object)->Class; if (ScriptManager::Lock()) { - if (GetMethod(klass, hash)) { + if (GetProperty((Obj*)klass, klass, hash)) { ScriptManager::Unlock(); VM_BREAK; } - if (ThrowRuntimeError(false, "Could not find %s in object!", GetVariableOrMethodName(hash)) == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_PROPERTY; - goto FAIL_OP_GET_PROPERTY; + ThrowRuntimeError(false, "Could not find %s in object!", GetVariableOrMethodName(hash)); } + + goto FAIL_OP_GET_PROPERTY; } else { - if (ThrowRuntimeError(false, "Only instances and classes have properties; value was of type %s.", GetValueTypeString(object)) == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_PROPERTY; + ThrowRuntimeError(false, "Only instances and classes have properties; value was of type %s.", GetValueTypeString(object)); + goto FAIL_OP_GET_PROPERTY; } VM_BREAK; @@ -707,17 +699,26 @@ PUBLIC int VMThread::RunInstruction() { Uint32 hash = ReadUInt32(frame); VMValue field; VMValue value; - VMValue result; VMValue object; Table* fields; + ObjClass* klass; + Obj* objPtr; + ValueSetFn setter = nullptr; object = Peek(1); if (IS_INSTANCE(object)) { - fields = AS_INSTANCE(object)->Fields; + ObjInstance* instance = AS_INSTANCE(object); + klass = instance->Object.Class; + fields = instance->Fields; + setter = instance->PropertySet; + objPtr = (Obj*)instance; } else if (IS_CLASS(object)) { - fields = AS_CLASS(object)->Fields; + klass = AS_CLASS(object); + fields = klass->Fields; + setter = klass->PropertySet; + objPtr = (Obj*)klass; } else if (IS_NAMESPACE(object)) { if (ThrowRuntimeError(false, "Cannot modify a namespace.") == ERROR_RES_CONTINUE) @@ -734,34 +735,19 @@ PUBLIC int VMThread::RunInstruction() { if (ScriptManager::Lock()) { value = Pop(); + if (fields->GetIfExists(hash, &field)) { - switch (field.Type) { - case VAL_LINKED_INTEGER: - result = ScriptManager::CastValueAsInteger(value); - if (IS_NULL(result)) { - // Conversion failed - if (ThrowRuntimeError(false, "Expected value to be of type %s instead of %s.", GetTypeString(VAL_INTEGER), GetValueTypeString(value)) == ERROR_RES_CONTINUE) - goto FAIL_OP_SET_PROPERTY; - } - AS_LINKED_INTEGER(field) = AS_INTEGER(result); - break; - case VAL_LINKED_DECIMAL: - result = ScriptManager::CastValueAsDecimal(value); - if (IS_NULL(result)) { - // Conversion failed - if (ThrowRuntimeError(false, "Expected value to be of type %s instead of %s.", GetTypeString(VAL_DECIMAL), GetValueTypeString(value)) == ERROR_RES_CONTINUE) - goto FAIL_OP_SET_PROPERTY; - } - AS_LINKED_DECIMAL(field) = AS_DECIMAL(result); - break; - default: - fields->Put(hash, value); - } + if (!SetProperty(fields, hash, field, value)) + goto FAIL_OP_SET_PROPERTY; } else { + if (setter && setter(objPtr, hash, value, this->ID)) + goto SUCCESS_OP_SET_PROPERTY; + fields->Put(hash, value); } +SUCCESS_OP_SET_PROPERTY: Pop(); // Instance / Class Push(value); ScriptManager::Unlock(); @@ -794,7 +780,7 @@ PUBLIC int VMThread::RunInstruction() { } ObjClass* klass = instance->Object.Class; - if (HasMethod(klass, hash)) { + if (HasProperty((Obj*)instance, klass, hash, false, instance->PropertyGet)) { Pop(); Push(INTEGER_VAL(true)); ScriptManager::Unlock(); @@ -807,15 +793,7 @@ PUBLIC int VMThread::RunInstruction() { ObjClass* klass = AS_CLASS(object); if (ScriptManager::Lock()) { - // Fields have priority over methods - if (klass->Fields->Exists(hash)) { - Pop(); - Push(INTEGER_VAL(true)); - ScriptManager::Unlock(); - VM_BREAK; - } - - if (HasMethod(klass, hash)) { + if (HasProperty((Obj*)klass, klass, hash)) { Pop(); Push(INTEGER_VAL(true)); ScriptManager::Unlock(); @@ -826,28 +804,31 @@ PUBLIC int VMThread::RunInstruction() { // Otherwise, if it's a namespace, else if (IS_NAMESPACE(object)) { ObjNamespace* ns = AS_NAMESPACE(object); - if (ScriptManager::Lock() && ns->Fields->Exists(hash)) { - Pop(); - Push(INTEGER_VAL(true)); - ScriptManager::Unlock(); - VM_BREAK; + if (ScriptManager::Lock()) { + if (ns->Fields->Exists(hash)) { + Pop(); + Push(INTEGER_VAL(true)); + ScriptManager::Unlock(); + VM_BREAK; + } } } // If it's any other object, else if (IS_OBJECT(object) && AS_OBJECT(object)->Class) { ObjClass* klass = AS_OBJECT(object)->Class; - if (ScriptManager::Lock() && HasMethod(klass, hash)) { - Pop(); - Push(INTEGER_VAL(true)); - ScriptManager::Unlock(); - VM_BREAK; + if (ScriptManager::Lock()) { + if (HasProperty((Obj*)klass, klass, hash)) { + Pop(); + Push(INTEGER_VAL(true)); + ScriptManager::Unlock(); + VM_BREAK; + } } } else { ThrowRuntimeError(false, "Only instances and classes have properties; value was of type %s.", GetValueTypeString(object)); } - FAIL_OP_HAS_PROPERTY: Pop(); Push(INTEGER_VAL(false)); ScriptManager::Unlock(); @@ -856,6 +837,7 @@ PUBLIC int VMThread::RunInstruction() { VM_CASE(OP_GET_ELEMENT): { VMValue at = Pop(); VMValue obj = Pop(); + VMValue result; if (!IS_OBJECT(obj)) { if (ThrowRuntimeError(false, "Cannot get value from non-Array or non-Map.") == ERROR_RES_CONTINUE) goto FAIL_OP_GET_ELEMENT; @@ -873,7 +855,8 @@ PUBLIC int VMThread::RunInstruction() { if (ThrowRuntimeError(false, "Index %d is out of bounds of array of size %d.", index, (int)array->Values->size()) == ERROR_RES_CONTINUE) goto FAIL_OP_GET_ELEMENT; } - Push((*array->Values)[index]); + result = (*array->Values)[index]; + Push(result); ScriptManager::Unlock(); } } @@ -891,7 +874,6 @@ PUBLIC int VMThread::RunInstruction() { goto FAIL_OP_GET_ELEMENT; } - VMValue result; if (!map->Values->GetIfExists(index, &result)) { goto FAIL_OP_GET_ELEMENT; } @@ -901,8 +883,17 @@ PUBLIC int VMThread::RunInstruction() { } } else { - if (ThrowRuntimeError(false, "Cannot get value from object that's non-Array or non-Map.") == ERROR_RES_CONTINUE) - goto FAIL_OP_GET_ELEMENT; + if (IS_OBJECT(obj) && AS_OBJECT(obj)->Class) { + ObjClass* klass = AS_OBJECT(obj)->Class; + if (klass->ElementGet && klass->ElementGet(AS_OBJECT(obj), at, &result, this->ID)) { + Push(result); + ScriptManager::Unlock(); + VM_BREAK; + } + } + + ThrowRuntimeError(false, "Cannot get value from object that's non-Array or non-Map."); + goto FAIL_OP_GET_ELEMENT; } VM_BREAK; @@ -922,7 +913,7 @@ PUBLIC int VMThread::RunInstruction() { if (IS_ARRAY(obj)) { if (!IS_INTEGER(at)) { - if (ThrowRuntimeError(false, "Cannot get value from array using non-Integer value as an index.") == ERROR_RES_CONTINUE) + if (ThrowRuntimeError(false, "Cannot set value from array using non-Integer value as an index.") == ERROR_RES_CONTINUE) goto FAIL_OP_SET_ELEMENT; } @@ -957,10 +948,18 @@ PUBLIC int VMThread::RunInstruction() { } } else { - if (ThrowRuntimeError(false, "Cannot set value in object that's non-Array or non-Map.") == ERROR_RES_CONTINUE) - goto FAIL_OP_SET_ELEMENT; + if (IS_OBJECT(obj) && AS_OBJECT(obj)->Class) { + ObjClass* klass = AS_OBJECT(obj)->Class; + if (klass->ElementSet && klass->ElementSet(AS_OBJECT(obj), at, value, this->ID)) { + goto SUCCESS_OP_SET_ELEMENT; + } + } + + ThrowRuntimeError(false, "Cannot set value in object that's non-Array or non-Map."); + goto FAIL_OP_SET_ELEMENT; } + SUCCESS_OP_SET_ELEMENT: Pop(); // value Pop(); // at Pop(); // Array @@ -1190,7 +1189,7 @@ PUBLIC int VMThread::RunInstruction() { // Frame stuffs & Returning VM_CASE(OP_RETURN): { - VMValue result = Pop(); + InterpretResult = Pop(); FrameCount--; if (FrameCount == ReturnFrame) { @@ -1198,7 +1197,7 @@ PUBLIC int VMThread::RunInstruction() { } StackTop = frame->Slots; - Push(result); + Push(InterpretResult); frame = &Frames[FrameCount - 1]; VM_BREAK; @@ -1552,14 +1551,17 @@ PUBLIC int VMThread::RunInstruction() { } VM_CASE(OP_EVENT): { int index = ReadByte(frame); - VMValue method = OBJECT_VAL(ScriptManager::AllFunctionList[frame->FunctionListOffset + index]); - Push(method); + if ((unsigned)index < frame->Module->Functions->size()) { + VMValue method = OBJECT_VAL((*frame->Module->Functions)[index]); + Push(method); + } VM_BREAK; } VM_CASE(OP_METHOD): { int index = ReadByte(frame); Uint32 hash = ReadUInt32(frame); - ScriptManager::DefineMethod(this, frame->FunctionListOffset + index, hash); + if ((unsigned)index < frame->Module->Functions->size()) + ScriptManager::DefineMethod(this, (*frame->Module->Functions)[index], hash); VM_BREAK; } @@ -1578,7 +1580,7 @@ PUBLIC int VMThread::RunInstruction() { VM_CASE(OP_NEW_ENUM): { Uint32 hash = ReadUInt32(frame); - ObjEnum* enumeration = NewEnumeration(hash); + ObjEnum* enumeration = NewEnum(hash); if (!__Tokens__ || !__Tokens__->Exists(hash)) { char name[9]; @@ -1623,8 +1625,8 @@ PUBLIC int VMThread::RunInstruction() { Pop(); Push(value); ScriptManager::Unlock(); + VM_BREAK; } - VM_BREAK; FAIL_OP_ADD_ENUM: Pop(); @@ -1634,6 +1636,115 @@ PUBLIC int VMThread::RunInstruction() { VM_BREAK; } + VM_CASE(OP_GET_SUPERCLASS): { + ObjClass* klass = nullptr; + VMValue object = Peek(0); + + // If it's an instance, + if (IS_INSTANCE(object)) { + klass = AS_INSTANCE(object)->Object.Class; + } + // Otherwise, if it's a class, + else if (IS_CLASS(object)) { + klass = AS_CLASS(object); + } + // If it's any other object, + else if (IS_OBJECT(object) && AS_OBJECT(object)->Class) { + klass = AS_OBJECT(object)->Class; + } + else { + if (ThrowRuntimeError(false, "Only instances and classes have superclasses; value was of type %s.", GetValueTypeString(object)) == ERROR_RES_CONTINUE) + goto FAIL_OP_GET_SUPERCLASS; + } + + if (ScriptManager::Lock()) { + ObjClass* parentClass = ScriptManager::GetClassParent(klass); + if (parentClass) { + Pop(); + Push(OBJECT_VAL(parentClass)); + VM_BREAK; + } + else { + ThrowRuntimeError(false, "Class '%s' has no superclass!", klass->Name ? klass->Name->Chars : GetToken(klass->Hash)); + } + } + + FAIL_OP_GET_SUPERCLASS: + Pop(); + Push(NULL_VAL); + ScriptManager::Unlock(); + VM_BREAK; + } + + VM_CASE(OP_GET_MODULE_LOCAL): { + Uint16 slot = ReadUInt16(frame); + if (slot < frame->Module->Locals->size()) + Push((*frame->Module->Locals)[slot]); + else + Push(NULL_VAL); + VM_BREAK; + } + VM_CASE(OP_SET_MODULE_LOCAL): { + Uint16 slot = ReadUInt16(frame); + if (slot < frame->Module->Locals->size()) + (*frame->Module->Locals)[slot] = Peek(0); + VM_BREAK; + } + VM_CASE(OP_DEFINE_MODULE_LOCAL): { + frame->Module->Locals->push_back(Pop()); + VM_BREAK; + } + + VM_CASE(OP_USE_NAMESPACE): { + Uint32 hash = ReadUInt32(frame); + if (ScriptManager::Lock()) { + VMValue result; + if (!ScriptManager::Globals->GetIfExists(hash, &result) + && !ScriptManager::Constants->GetIfExists(hash, &result)) { + ThrowRuntimeError(false, "Namespace %s does not exist.", GetVariableOrMethodName(hash)); + ScriptManager::Unlock(); + VM_BREAK; + } + + if (!IS_NAMESPACE(result)) { + ThrowRuntimeError(false, "Value was not a namespace."); + ScriptManager::Unlock(); + VM_BREAK; + } + + ObjNamespace* ns = AS_NAMESPACE(result); + + // Namespace already in use, so do nothing + if (ns->InUse) { + ScriptManager::Unlock(); + VM_BREAK; + } + + ns->Fields->WithAll([this](Uint32 hash, VMValue value) -> void { + VMValue originalValue; + + bool replace = true; + + if (ScriptManager::Globals->GetIfExists(hash, &originalValue) + || ScriptManager::Constants->GetIfExists(hash, &originalValue)) { + if (IS_CLASS(value) && IS_CLASS(originalValue)) { + DoClassExtension(value, originalValue, false); + replace = false; + } + } + + if (replace) + ScriptManager::Globals->Put(hash, value); + }); + + ns->InUse = true; + + ScriptManager::Unlock(); + } + + VM_BREAK; + } + VM_CASE(OP_FAILSAFE): { int offset = ReadUInt16(frame); frame->Function->Chunk.Failsafe = frame->IPStart + offset; @@ -1710,7 +1821,7 @@ PUBLIC void VMThread::InvokeForEntity(VMValue value, int argCount) { ReturnFrame = lastReturnFrame; StackTop = lastStackTop; } -PUBLIC void VMThread::RunEntityFunction(ObjFunction* function, int argCount) { +PUBLIC VMValue VMThread::RunEntityFunction(ObjFunction* function, int argCount) { VMValue* lastStackTop = StackTop; int lastReturnFrame = ReturnFrame; @@ -1723,12 +1834,14 @@ PUBLIC void VMThread::RunEntityFunction(ObjFunction* function, int argCount) FunctionToInvoke = NULL_VAL; ReturnFrame = lastReturnFrame; StackTop = lastStackTop; + + return InterpretResult; } PUBLIC void VMThread::CallInitializer(VMValue value) { FunctionToInvoke = value; ObjFunction* initializer = AS_FUNCTION(value); - if (initializer->Arity != 0) { + if (initializer->MinArity) { ThrowRuntimeError(false, "Initializer must have no parameters."); } else { @@ -1746,141 +1859,177 @@ PUBLIC void VMThread::CallInitializer(VMValue value) { FunctionToInvoke = NULL_VAL; } -PUBLIC bool VMThread::GetMethod(ObjClass* klass, Uint32 hash) { +PRIVATE bool VMThread::GetProperty(Obj* object, ObjClass* klass, Uint32 hash, bool checkFields, ValueGetFn getter) { if (ScriptManager::Lock()) { - VMValue method; - if (klass->Methods->GetIfExists(hash, &method)) { - Pop(); // Instance. - Push(method); + VMValue value; + + if (checkFields && klass->Fields->GetIfExists(hash, &value)) { + // Fields have priority over methods + Pop(); + Push(ScriptManager::DelinkValue(value)); + ScriptManager::Unlock(); + return true; + } + else if (klass->Methods->GetIfExists(hash, &value)) { + Pop(); + Push(value); + ScriptManager::Unlock(); + return true; + } + + if (getter && getter(object, hash, &value, this->ID)) { + Pop(); + Push(value); + ScriptManager::Unlock(); + return true; + } + + ObjClass* parentClass = ScriptManager::GetClassParent(klass); + if (parentClass) { + ScriptManager::Unlock(); + return GetProperty((Obj*)parentClass, parentClass, hash, checkFields); } else { - ObjClass* parentClass = ScriptManager::GetClassParent(klass); - if (parentClass) { - ScriptManager::Unlock(); - return GetMethod(parentClass, hash); - } - else { - ThrowRuntimeError(false, "Undefined property %s.", GetVariableOrMethodName(hash)); - Pop(); // Instance. - Push(NULL_VAL); - return false; - } + ThrowRuntimeError(false, "Undefined property %s.", GetVariableOrMethodName(hash)); + Pop(); // Instance. + Push(NULL_VAL); } - ScriptManager::Unlock(); - return true; } + ScriptManager::Unlock(); return false; } -PUBLIC bool VMThread::HasMethod(ObjClass* klass, Uint32 hash) { +PRIVATE bool VMThread::GetProperty(Obj* object, ObjClass* klass, Uint32 hash, bool checkFields) { + return GetProperty(object, klass, hash, true, klass->PropertyGet); +} +PRIVATE bool VMThread::GetProperty(Obj* object, ObjClass* klass, Uint32 hash) { + return GetProperty(object, klass, hash, true); +} +PRIVATE bool VMThread::HasProperty(Obj* object, ObjClass* klass, Uint32 hash, bool checkFields, ValueGetFn getter) { if (ScriptManager::Lock()) { - bool hasMethod = false; - if (klass->Methods->Exists(hash)) { - hasMethod = true; + if (checkFields && klass->Fields->Exists(hash)) { + // Fields have priority over methods + ScriptManager::Unlock(); + return true; } - else { - ObjClass* parentClass = ScriptManager::GetClassParent(klass); - if (parentClass) { - ScriptManager::Unlock(); - return HasMethod(parentClass, hash); - } + else if (klass->Methods->Exists(hash)) { + ScriptManager::Unlock(); + return true; + } + + if (getter && getter(object, hash, nullptr, this->ID)) { + ScriptManager::Unlock(); + return true; + } + + ObjClass* parentClass = ScriptManager::GetClassParent(klass); + if (parentClass) { + ScriptManager::Unlock(); + return HasProperty((Obj*)parentClass, parentClass, hash, checkFields, parentClass->PropertyGet); } - ScriptManager::Unlock(); - return hasMethod; } + ScriptManager::Unlock(); return false; } -PUBLIC bool VMThread::BindMethod(VMValue receiver, VMValue method) { +PRIVATE bool VMThread::HasProperty(Obj* object, ObjClass* klass, Uint32 hash, bool checkFields) { + return HasProperty(object, klass, checkFields, klass->PropertyGet); +} +PRIVATE bool VMThread::HasProperty(Obj* object, ObjClass* klass, Uint32 hash) { + return HasProperty(object, klass, true); +} +PRIVATE bool VMThread::SetProperty(Table* fields, Uint32 hash, VMValue field, VMValue value) { + switch (field.Type) { + case VAL_LINKED_INTEGER: + if (!ScriptManager::DoIntegerConversion(value, this->ID)) + return false; + AS_LINKED_INTEGER(field) = AS_INTEGER(value); + break; + case VAL_LINKED_DECIMAL: + if (!ScriptManager::DoDecimalConversion(value, this->ID)) + return false; + AS_LINKED_DECIMAL(field) = AS_DECIMAL(value); + break; + default: + fields->Put(hash, value); + } + return true; +} +PRIVATE bool VMThread::BindMethod(VMValue receiver, VMValue method) { ObjBoundMethod* bound = NewBoundMethod(receiver, AS_FUNCTION(method)); Push(OBJECT_VAL(bound)); return true; } -PUBLIC bool VMThread::CallBoundMethod(ObjBoundMethod* bound, int argCount) { +PRIVATE bool VMThread::CallBoundMethod(ObjBoundMethod* bound, int argCount) { // Replace the bound method with the receiver so it's in the // right slot when the method is called. StackTop[-argCount - 1] = bound->Receiver; return Call(bound->Method, argCount); } -PUBLIC bool VMThread::CallValue(VMValue callee, int argCount) { - if (ScriptManager::Lock()) { - bool result; - if (IS_OBJECT(callee)) { - switch (OBJECT_TYPE(callee)) { - case OBJ_BOUND_METHOD: { - result = CallBoundMethod(AS_BOUND_METHOD(callee), argCount); - ScriptManager::Unlock(); - return result; - } - case OBJ_FUNCTION: - result = Call(AS_FUNCTION(callee), argCount); - ScriptManager::Unlock(); - return result; - case OBJ_NATIVE: { - NativeFn native = AS_NATIVE(callee); - - VMValue result = NULL_VAL; - try { - result = native(argCount, StackTop - argCount, ID); - } - catch (const char* err) { } - - // Pop arguments - StackTop -= argCount; - // Pop receiver / class - StackTop -= 1; - // Push result - Push(result); - ScriptManager::Unlock(); - return true; - } - default: - // Do nothing. - break; - } - } - ScriptManager::Unlock(); - } - - return false; -} -PUBLIC bool VMThread::CallForObject(VMValue callee, int argCount) { - if (ScriptManager::Lock()) { - bool result = false; +PRIVATE bool VMThread::CallValue(VMValue callee, int argCount) { + bool result = false; + if (ScriptManager::Lock() && IS_OBJECT(callee)) { switch (OBJECT_TYPE(callee)) { case OBJ_BOUND_METHOD: result = CallBoundMethod(AS_BOUND_METHOD(callee), argCount); break; + case OBJ_FUNCTION: + result = Call(AS_FUNCTION(callee), argCount); + break; case OBJ_NATIVE: { - NativeFn native = AS_NATIVE(callee); + NativeFn nativeFn = AS_NATIVE(callee); VMValue returnValue = NULL_VAL; try { - // Calling a native function for some object needs to correctly pass the - // receiver, which is why the +1 and -1 are there. - returnValue = native(argCount + 1, StackTop - argCount - 1, ID); + returnValue = nativeFn(argCount, StackTop - argCount, ID); } - catch (const char* err) { } - - // Pop arguments - StackTop -= argCount; - // Pop receiver / class - StackTop -= 1; - // Push returned value - Push(returnValue); - ScriptManager::Unlock(); + catch (const char* err) { + (void)err; + } + + StackTop -= argCount; // Pop arguments + StackTop -= 1; // Pop receiver / class + Push(returnValue); // Push result + result = true; break; } default: - result = Call(AS_FUNCTION(callee), argCount); + ThrowRuntimeError(false, "Cannot call value of type %s.", GetObjectTypeString(OBJECT_TYPE(callee))); break; } + } + ScriptManager::Unlock(); + return result; +} +PRIVATE bool VMThread::CallForObject(VMValue callee, int argCount) { + if (ScriptManager::Lock()) { + // Special case for native functions + if (OBJECT_TYPE(callee) == OBJ_NATIVE) { + NativeFn native = AS_NATIVE(callee); + + VMValue returnValue = NULL_VAL; + try { + // Calling a native function for an object needs to correctly pass the + // receiver, which is the reason these +1 and -1 are here. + returnValue = native(argCount + 1, StackTop - argCount - 1, ID); + } + catch (const char* err) { + (void)err; + } + + StackTop -= argCount; // Pop arguments + StackTop -= 1; // Pop receiver / class + Push(returnValue); // Push returned value + + ScriptManager::Unlock(); + return true; + } ScriptManager::Unlock(); - return result; + return CallValue(callee, argCount); } return false; } -PUBLIC bool VMThread::InstantiateClass(VMValue callee, int argCount) { +PRIVATE bool VMThread::InstantiateClass(VMValue callee, int argCount) { if (ScriptManager::Lock()) { bool result = false; if (!IS_OBJECT(callee) || OBJECT_TYPE(callee) != OBJ_CLASS) { @@ -1910,9 +2059,24 @@ PUBLIC bool VMThread::InstantiateClass(VMValue callee, int argCount) { return false; } PUBLIC bool VMThread::Call(ObjFunction* function, int argCount) { - if (argCount != function->Arity) { - if (ThrowRuntimeError(false, "Expected %d arguments to function call, got %d.", function->Arity, argCount) == ERROR_RES_CONTINUE) + if (function->MinArity < function->Arity) { + if (argCount < function->MinArity) { + ThrowRuntimeError(false, "Expected at least %d arguments to function call, got %d.", function->MinArity, argCount); + return false; + } + else if (argCount > function->Arity) { + ThrowRuntimeError(false, "Expected at most %d arguments to function call, got %d.", function->Arity, argCount); return false; + } + + if (argCount < function->Arity) { + for (int i = argCount; i < function->Arity; i++) + Push(NULL_VAL); + } + } + else if (argCount != function->Arity) { + ThrowRuntimeError(false, "Expected %d arguments to function call, got %d.", function->Arity, argCount); + return false; } if (FrameCount == FRAMES_MAX) { @@ -1927,31 +2091,26 @@ PUBLIC bool VMThread::Call(ObjFunction* function, int argCount) { frame->Slots = StackTop - (function->Arity + 1); frame->WithReceiverStackTop = frame->WithReceiverStack; frame->WithIteratorStackTop = frame->WithIteratorStack; - frame->FunctionListOffset = function->FunctionListOffset; + frame->Module = function->Module; return true; } PUBLIC bool VMThread::InvokeFromClass(ObjClass* klass, Uint32 hash, int argCount) { if (ScriptManager::Lock()) { VMValue method; - if (klass->Methods->GetIfExists(hash, &method)) { - // Done + // Found the method, so just call it + return CallForObject(method, argCount); } else { + // If there is a parent class, walk up the inheritance chain until we find the method. ObjClass* parentClass = ScriptManager::GetClassParent(klass); if (parentClass) { ScriptManager::Unlock(); return InvokeFromClass(parentClass, hash, argCount); } - else { - ScriptManager::Unlock(); - return false; - } } - ScriptManager::Unlock(); - return CallForObject(method, argCount); } return false; } @@ -1981,19 +2140,21 @@ PUBLIC bool VMThread::InvokeForInstance(Uint32 hash, int argCount, bool isSup } return InvokeFromClass(klass, hash, argCount); } -PUBLIC bool VMThread::DoClassExtension(VMValue value, VMValue originalValue) { +PRIVATE bool VMThread::DoClassExtension(VMValue value, VMValue originalValue, bool clearSrc) { ObjClass* src = AS_CLASS(value); ObjClass* dst = AS_CLASS(originalValue); src->Methods->WithAll([dst](Uint32 hash, VMValue value) -> void { dst->Methods->Put(hash, value); }); - src->Methods->Clear(); + if (clearSrc) + src->Methods->Clear(); src->Fields->WithAll([dst](Uint32 hash, VMValue value) -> void { dst->Fields->Put(hash, value); }); - src->Fields->Clear(); + if (clearSrc) + src->Fields->Clear(); return true; } @@ -2451,6 +2612,9 @@ PUBLIC VMValue VMThread::Value_TypeOf() { case OBJ_ENUM: valueType = "enum"; break; + case OBJ_MODULE: + valueType = "module"; + break; } } } diff --git a/source/Engine/Bytecode/Values.cpp b/source/Engine/Bytecode/Values.cpp index 7c45dbe1..91e9b85d 100644 --- a/source/Engine/Bytecode/Values.cpp +++ b/source/Engine/Bytecode/Values.cpp @@ -58,6 +58,9 @@ PUBLIC STATIC void Values::PrintObject(PrintBuffer* buffer, VMValue value, int i case OBJ_FUNCTION: buffer_printf(buffer, "", AS_FUNCTION(value)->Name ? AS_FUNCTION(value)->Name->Chars : "(null)"); break; + case OBJ_MODULE: + buffer_printf(buffer, "", AS_MODULE(value)->SourceFilename ? AS_MODULE(value)->SourceFilename->Chars : "(null)"); + break; case OBJ_INSTANCE: buffer_printf(buffer, " instance", AS_INSTANCE(value)->Object.Class->Name ? AS_INSTANCE(value)->Object.Class->Name->Chars : "(null)"); break; diff --git a/source/Engine/Diagnostics/Clock.cpp b/source/Engine/Diagnostics/Clock.cpp index 71b93ffd..cda13327 100644 --- a/source/Engine/Diagnostics/Clock.cpp +++ b/source/Engine/Diagnostics/Clock.cpp @@ -10,10 +10,13 @@ class Clock { #include #ifdef WIN32 +#define USE_WIN32_CLOCK +#endif + +#ifdef USE_WIN32_CLOCK #include bool Win32_PerformanceFrequencyEnabled = false; - LARGE_INTEGER Win32_Frequency; double Win32_CPUFreq; Sint64 Win32_GameStartTime; stack Win32_ClockStack; @@ -24,70 +27,77 @@ class Clock { #include #include -chrono::steady_clock::time_point GameStartTime; -stack ClockStack; +std::chrono::steady_clock::time_point GameStartTime; +stack ClockStack; PUBLIC STATIC void Clock::Init() { - #ifdef WIN32 - if (QueryPerformanceFrequency(&Win32_Frequency)) { - Win32_PerformanceFrequencyEnabled = true; - Win32_CPUFreq = (double)Win32_Frequency.QuadPart / 1000.0; - // Log::Print(Log::LOG_INFO, "CPU Frequency: %.1f GHz", Win32_Frequency.QuadPart / 1000000.0); - - LARGE_INTEGER ticks; - if (QueryPerformanceCounter(&ticks)) { - Win32_GameStartTime = ticks.QuadPart; - } - } - else { - Win32_PerformanceFrequencyEnabled = false; - // Win32_GameStartTime = timeGetTime(); +#ifdef USE_WIN32_CLOCK + LARGE_INTEGER Win32_Frequency; + + if (QueryPerformanceFrequency(&Win32_Frequency)) { + Win32_PerformanceFrequencyEnabled = true; + Win32_CPUFreq = (double)Win32_Frequency.QuadPart / 1000.0; + + LARGE_INTEGER ticks; + if (QueryPerformanceCounter(&ticks)) { + Win32_GameStartTime = ticks.QuadPart; } - #endif - GameStartTime = chrono::steady_clock::now(); + return; + } + else { + Win32_PerformanceFrequencyEnabled = false; + } +#endif + + GameStartTime = std::chrono::steady_clock::now(); } PUBLIC STATIC void Clock::Start() { - #ifdef WIN32 +#ifdef USE_WIN32_CLOCK + if (Win32_PerformanceFrequencyEnabled) { Win32_ClockStack.push(Clock::GetTicks()); - #endif + return; + } +#endif - ClockStack.push(chrono::steady_clock::now()); + ClockStack.push(std::chrono::steady_clock::now()); } PUBLIC STATIC double Clock::GetTicks() { - #ifdef WIN32 - if (Win32_PerformanceFrequencyEnabled) { - LARGE_INTEGER ticks; - if (QueryPerformanceCounter(&ticks)) { - return (double)(ticks.QuadPart - Win32_GameStartTime) / Win32_CPUFreq; - } +#ifdef USE_WIN32_CLOCK + if (Win32_PerformanceFrequencyEnabled) { + LARGE_INTEGER ticks; + if (QueryPerformanceCounter(&ticks)) { + return (double)(ticks.QuadPart - Win32_GameStartTime) / Win32_CPUFreq; } - else { - // return (double)(timeGetTime() - Win32_GameStartTime); - } - #endif - return (chrono::steady_clock::now() - GameStartTime).count() / 1000000.0; + return 0.0; + } +#endif + + return (std::chrono::steady_clock::now() - GameStartTime).count() / 1000000.0; } PUBLIC STATIC double Clock::End() { - #ifdef WIN32 - { +#ifdef USE_WIN32_CLOCK + if (Win32_PerformanceFrequencyEnabled) { auto t1 = Win32_ClockStack.top(); auto t2 = Clock::GetTicks(); Win32_ClockStack.pop(); return t2 - t1; } - #endif +#endif auto t1 = ClockStack.top(); - auto t2 = chrono::steady_clock::now(); + auto t2 = std::chrono::steady_clock::now(); ClockStack.pop(); return (t2 - t1).count() / 1000000.0; } PUBLIC STATIC void Clock::Delay(double milliseconds) { - #ifdef WIN32 +#ifdef USE_WIN32_CLOCK + if (Win32_PerformanceFrequencyEnabled) { Sleep((DWORD)milliseconds); return; - #endif - this_thread::sleep_for(chrono::nanoseconds((int)(milliseconds * 1000000.0))); + } +#endif + + std::this_thread::sleep_for(std::chrono::nanoseconds((int)(milliseconds * 1000000.0))); } diff --git a/source/Engine/Filesystem/Directory.cpp b/source/Engine/Filesystem/Directory.cpp index 3f744e42..ac0bd65e 100644 --- a/source/Engine/Filesystem/Directory.cpp +++ b/source/Engine/Filesystem/Directory.cpp @@ -13,14 +13,14 @@ class Directory { #if WIN32 #include #include -#elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #define MAX_PATH_SIZE 1024 +#else #include #include #include + #define MAX_PATH_SIZE 4096 #endif -#define MAX_PATH_SIZE 1024 - bool CompareFunction(char* i, char* j) { return strcmp(i, j) < 0; } @@ -30,7 +30,7 @@ PUBLIC STATIC bool Directory::Exists(const char* path) { DWORD ftyp = GetFileAttributesA(path); if (ftyp == INVALID_FILE_ATTRIBUTES) return false; // Something is wrong with your path if (ftyp & FILE_ATTRIBUTE_DIRECTORY) return true; - #elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #else DIR* dir = opendir(path); if (dir) { closedir(dir); @@ -42,25 +42,23 @@ PUBLIC STATIC bool Directory::Exists(const char* path) { PUBLIC STATIC bool Directory::Create(const char* path) { #if WIN32 return CreateDirectoryA(path, NULL); - #elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #else return mkdir(path, 0777) == 0; #endif - return false; } PUBLIC STATIC bool Directory::GetCurrentWorkingDirectory(char* out, size_t sz) { #if WIN32 return _getcwd(out, sz) != NULL; - #elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #else return getcwd(out, sz) != NULL; #endif - return false; } PUBLIC STATIC void Directory::GetFiles(vector* files, const char* path, const char* searchPattern, bool allDirs) { #if WIN32 char winPath[MAX_PATH_SIZE]; - sprintf(winPath, "%s%s*", path, path[strlen(path) - 1] == '/' ? "" : "/"); + snprintf(winPath, MAX_PATH_SIZE, "%s%s*", path, path[strlen(path) - 1] == '/' ? "" : "/"); for (char* i = winPath; *i; i++) { if (*i == '/') *i = '\\'; @@ -78,14 +76,14 @@ PUBLIC STATIC void Directory::GetFiles(vector* files, const char if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (allDirs) { - sprintf(fullpath, "%s\\%s", path, data.cFileName); + snprintf(fullpath, sizeof fullpath, "%s\\%s", path, data.cFileName); Directory::GetFiles(files, fullpath, searchPattern, true); } } else if (StringUtils::WildcardMatch(data.cFileName, searchPattern)) { i = strlen(data.cFileName) + strlen(path) + 1; char* str = (char*)calloc(1, i + 1); - sprintf(str, "%s/%s", path, data.cFileName); + snprintf(str, i + 1, "%s/%s", path, data.cFileName); str[i] = 0; for (char* istr = str; *istr; istr++) { if (*istr == '\\') *istr = '/'; @@ -96,7 +94,7 @@ PUBLIC STATIC void Directory::GetFiles(vector* files, const char while (FindNextFile(hFind, &data)); FindClose(hFind); } - #elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #else char fullpath[MAX_PATH_SIZE]; DIR* dir = opendir(path); if (dir) { @@ -109,14 +107,14 @@ PUBLIC STATIC void Directory::GetFiles(vector* files, const char if (d->d_type == DT_DIR) { if (allDirs) { - sprintf(fullpath, "%s/%s", path, d->d_name); + snprintf(fullpath, sizeof fullpath, "%s/%s", path, d->d_name); Directory::GetFiles(files, fullpath, searchPattern, true); } } else if (StringUtils::WildcardMatch(d->d_name, searchPattern)) { i = strlen(d->d_name) + strlen(path) + 1; char* str = (char*)calloc(1, i + 1); - sprintf(str, "%s/%s", path, d->d_name); + snprintf(str, i + 1, "%s/%s", path, d->d_name); str[i] = 0; files->push_back(str); @@ -137,7 +135,7 @@ PUBLIC STATIC vector Directory::GetFiles(const char* path, const char* se PUBLIC STATIC void Directory::GetDirectories(vector* files, const char* path, const char* searchPattern, bool allDirs) { #if WIN32 char winPath[MAX_PATH_SIZE]; - sprintf(winPath, "%s%s*", path, path[strlen(path) - 1] == '/' ? "" : "/"); + snprintf(winPath, MAX_PATH_SIZE, "%s%s*", path, path[strlen(path) - 1] == '/' ? "" : "/"); for (char* i = winPath; *i; i++) { if (*i == '/') *i = '\\'; @@ -157,7 +155,7 @@ PUBLIC STATIC void Directory::GetDirectories(vector* files, cons if (StringUtils::WildcardMatch(data.cFileName, searchPattern)) { i = strlen(data.cFileName) + strlen(path) + 1; char* str = (char*)calloc(1, i + 1); - sprintf(str, "%s/%s", path, data.cFileName); + snprintf(str, i + 1, "%s/%s", path, data.cFileName); str[i] = 0; for (char* istr = str; *istr; istr++) { if (*istr == '\\') *istr = '/'; @@ -165,7 +163,7 @@ PUBLIC STATIC void Directory::GetDirectories(vector* files, cons files->push_back(str); } if (allDirs) { - sprintf(fullpath, "%s\\%s", path, data.cFileName); + snprintf(fullpath, sizeof fullpath, "%s\\%s", path, data.cFileName); Directory::GetFiles(files, fullpath, searchPattern, true); } } @@ -173,7 +171,7 @@ PUBLIC STATIC void Directory::GetDirectories(vector* files, cons while (FindNextFile(hFind, &data)); FindClose(hFind); } - #elif MACOSX || LINUX || SWITCH || IOS || ANDROID + #else char fullpath[MAX_PATH_SIZE]; DIR* dir = opendir(path); if (dir) { @@ -188,12 +186,12 @@ PUBLIC STATIC void Directory::GetDirectories(vector* files, cons if (StringUtils::WildcardMatch(d->d_name, searchPattern)) { i = strlen(d->d_name) + strlen(path) + 1; char* str = (char*)calloc(1, i + 1); - sprintf(str, "%s/%s", path, d->d_name); + snprintf(str, i + 1, "%s/%s", path, d->d_name); str[i] = 0; files->push_back(str); } if (allDirs) { - sprintf(fullpath, "%s/%s", path, d->d_name); + snprintf(fullpath, sizeof fullpath, "%s/%s", path, d->d_name); Directory::GetFiles(files, fullpath, searchPattern, true); } } diff --git a/source/Engine/Filesystem/File.cpp b/source/Engine/Filesystem/File.cpp index b402c37a..8b379c13 100644 --- a/source/Engine/Filesystem/File.cpp +++ b/source/Engine/Filesystem/File.cpp @@ -45,7 +45,7 @@ PUBLIC STATIC bool File::Exists(const char* path) { return false; #elif SWITCH_ROMFS char romfsPath[256]; - sprintf(romfsPath, "romfs:/%s", path); + snprintf(romfsPath, romfsPath, "romfs:/%s", path); if (access(romfsPath, F_OK) != -1) { Log::Print(Log::LOG_WARN, "YES access \"%s\".", romfsPath); return true; @@ -55,9 +55,7 @@ PUBLIC STATIC bool File::Exists(const char* path) { return false; #else -#ifndef LINUX - Log::Print(Log::LOG_WARN, "FALLBACK access \"%s\".", path); -#endif + // access probably works in most systems... right?! return access(path, F_OK) != -1; #endif } @@ -89,11 +87,4 @@ PUBLIC STATIC bool File::WriteAllBytes(const char* path, const char* bytes, si return true; } return false; - - // FILE* f = fopen(path, "wb"); - // if (!f) return false; - // - // fwrite(bytes, len, 1, f); - // fclose(f); - // return true; } diff --git a/source/Engine/FontFace.cpp b/source/Engine/FontFace.cpp index 53186257..988cf247 100644 --- a/source/Engine/FontFace.cpp +++ b/source/Engine/FontFace.cpp @@ -249,7 +249,7 @@ PUBLIC STATIC ISprite* FontFace::SpriteFromFont(Stream* stream, int pixelSize, c } char testFilename[256]; - sprintf(testFilename, "Fonts/%s_%d.bmp", filenameJustName, pixelSize); + snprintf(testFilename, sizeof testFilename, "Fonts/%s_%d.bmp", filenameJustName, pixelSize); strncpy(sprite->SpritesheetsFilenames[0], testFilename, 32); SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(pixelData, package->Width, package->Height, 32, package->Width * 4, @@ -257,7 +257,7 @@ PUBLIC STATIC ISprite* FontFace::SpriteFromFont(Stream* stream, int pixelSize, c SDL_SaveBMP(surface, testFilename); SDL_FreeSurface(surface); - sprintf(testFilename, "Fonts/%s_%d.bin", filenameJustName, pixelSize); + snprintf(testFilename, sizeof testFilename, "Fonts/%s_%d.bin", filenameJustName, pixelSize); sprite->SaveAnimation(testFilename); } diff --git a/source/Engine/Graphics.cpp b/source/Engine/Graphics.cpp index 58f33dea..882ae965 100644 --- a/source/Engine/Graphics.cpp +++ b/source/Engine/Graphics.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,7 @@ class Graphics { static Uint32 MaxTextureHeight; static Texture* TextureHead; - static VertexBuffer* VertexBuffers[MAX_VERTEX_BUFFERS]; + static vector VertexBuffers; static Scene3D Scene3Ds[MAX_3D_SCENES]; static stack StateStack; @@ -80,6 +81,7 @@ class Graphics { static float PixelOffset; static bool NoInternalTextures; static bool UsePalettes; + static bool UsePaletteIndexLines; static bool UseTinting; static bool UseDepthTesting; static bool UseSoftwareRenderer; @@ -123,7 +125,7 @@ Uint32 Graphics::MaxTextureWidth = 1; Uint32 Graphics::MaxTextureHeight = 1; Texture* Graphics::TextureHead = NULL; -VertexBuffer* Graphics::VertexBuffers[MAX_VERTEX_BUFFERS]; +vector Graphics::VertexBuffers; Scene3D Graphics::Scene3Ds[MAX_3D_SCENES]; stack Graphics::StateStack; @@ -168,6 +170,7 @@ bool Graphics::SmoothStroke = false; float Graphics::PixelOffset = 0.0f; bool Graphics::NoInternalTextures = false; bool Graphics::UsePalettes = false; +bool Graphics::UsePaletteIndexLines = false; bool Graphics::UseTinting = false; bool Graphics::UseDepthTesting = false; bool Graphics::UseSoftwareRenderer = false; @@ -277,6 +280,7 @@ PUBLIC STATIC void Graphics::SetVSync(bool enabled) { PUBLIC STATIC void Graphics::Reset() { Graphics::UseSoftwareRenderer = false; Graphics::UsePalettes = false; + Graphics::UsePaletteIndexLines = false; Graphics::BlendColors[0] = Graphics::BlendColors[1] = @@ -304,8 +308,9 @@ PUBLIC STATIC void Graphics::Reset() { Graphics::StencilOpFail = StencilOp_Keep; } PUBLIC STATIC void Graphics::Dispose() { - for (Uint32 i = 0; i < MAX_VERTEX_BUFFERS; i++) + for (Uint32 i = 0; i < Graphics::VertexBuffers.size(); i++) Graphics::DeleteVertexBuffer(i); + Graphics::VertexBuffers.clear(); for (Uint32 i = 0; i < MAX_3D_SCENES; i++) Graphics::DeleteScene3D(i); @@ -461,24 +466,37 @@ PUBLIC STATIC void Graphics::DisposeTexture(Texture* texture) { } PUBLIC STATIC Uint32 Graphics::CreateVertexBuffer(Uint32 maxVertices, int unloadPolicy) { - for (Uint32 i = 0; i < MAX_VERTEX_BUFFERS; i++) { + Uint32 idx = 0xFFFFFFFF; + + for (Uint32 i = 0; i < Graphics::VertexBuffers.size(); i++) { if (Graphics::VertexBuffers[i] == NULL) { - VertexBuffer* vtxbuf; - if (Graphics::Internal.CreateVertexBuffer) - vtxbuf = (VertexBuffer*)Graphics::Internal.CreateVertexBuffer(maxVertices); - else - vtxbuf = new VertexBuffer(maxVertices); - - vtxbuf->UnloadPolicy = unloadPolicy; - Graphics::VertexBuffers[i] = vtxbuf; - return i; + idx = i; + break; } } - return 0xFFFFFFFF; + VertexBuffer* vtxbuf; + if (Graphics::Internal.CreateVertexBuffer) + vtxbuf = (VertexBuffer*)Graphics::Internal.CreateVertexBuffer(maxVertices); + else + vtxbuf = new VertexBuffer(maxVertices); + + vtxbuf->UnloadPolicy = unloadPolicy; + + if (idx == 0xFFFFFFFF) { + size_t sz = Graphics::VertexBuffers.size(); + if (sz < MAX_VERTEX_BUFFERS) { + Graphics::VertexBuffers.push_back(vtxbuf); + idx = sz; + } + } + else + Graphics::VertexBuffers[idx] = vtxbuf; + + return idx; } PUBLIC STATIC void Graphics::DeleteVertexBuffer(Uint32 vertexBufferIndex) { - if (vertexBufferIndex < 0 || vertexBufferIndex >= MAX_3D_SCENES) + if (vertexBufferIndex < 0 || vertexBufferIndex >= Graphics::VertexBuffers.size()) return; if (!Graphics::VertexBuffers[vertexBufferIndex]) return; @@ -534,7 +552,7 @@ PUBLIC STATIC void Graphics::UpdateGlobalPalette() { } PUBLIC STATIC void Graphics::UnloadSceneData() { - for (Uint32 i = 0; i < MAX_VERTEX_BUFFERS; i++) { + for (Uint32 i = 0; i < Graphics::VertexBuffers.size(); i++) { VertexBuffer* buffer = Graphics::VertexBuffers[i]; if (!buffer || buffer->UnloadPolicy > SCOPE_SCENE) continue; @@ -742,14 +760,15 @@ PUBLIC STATIC void Graphics::PushState() { GraphicsState state; - state.CurrentViewport = Graphics::CurrentViewport; - state.CurrentClip = Graphics::CurrentClip; - state.BlendMode = Graphics::BlendMode; - state.TintMode = Graphics::TintMode; - state.TextureBlend = Graphics::TextureBlend; - state.UsePalettes = Graphics::UsePalettes; - state.UseTinting = Graphics::UseTinting; - state.UseDepthTesting = Graphics::UseDepthTesting; + state.CurrentViewport = Graphics::CurrentViewport; + state.CurrentClip = Graphics::CurrentClip; + state.BlendMode = Graphics::BlendMode; + state.TintMode = Graphics::TintMode; + state.TextureBlend = Graphics::TextureBlend; + state.UsePalettes = Graphics::UsePalettes; + state.UsePaletteIndexLines = Graphics::UsePaletteIndexLines; + state.UseTinting = Graphics::UseTinting; + state.UseDepthTesting = Graphics::UseDepthTesting; memcpy(state.BlendColors, Graphics::BlendColors, sizeof(Graphics::BlendColors)); memcpy(state.TintColors, Graphics::TintColors, sizeof(Graphics::TintColors)); @@ -770,11 +789,12 @@ PUBLIC STATIC void Graphics::PopState() { Graphics::SetTintMode(state.TintMode); Graphics::SetTintColor(state.TintColors[0], state.TintColors[1], state.TintColors[2], state.TintColors[3]); - Graphics::CurrentViewport = state.CurrentViewport; - Graphics::CurrentClip = state.CurrentClip; - Graphics::TextureBlend = state.TextureBlend; - Graphics::UsePalettes = state.UsePalettes; - Graphics::UseDepthTesting = state.UseDepthTesting; + Graphics::CurrentViewport = state.CurrentViewport; + Graphics::CurrentClip = state.CurrentClip; + Graphics::TextureBlend = state.TextureBlend; + Graphics::UsePalettes = state.UsePalettes; + Graphics::UsePaletteIndexLines = state.UsePaletteIndexLines; + Graphics::UseDepthTesting = state.UseDepthTesting; Graphics::SetDepthTesting(Graphics::UseDepthTesting); @@ -847,8 +867,8 @@ PUBLIC STATIC void Graphics::SetLineWidth(float n) { PUBLIC STATIC void Graphics::StrokeLine(float x1, float y1, float x2, float y2) { Graphics::GfxFunctions->StrokeLine(x1, y1, x2, y2); } -PUBLIC STATIC void Graphics::StrokeCircle(float x, float y, float rad) { - Graphics::GfxFunctions->StrokeCircle(x, y, rad); +PUBLIC STATIC void Graphics::StrokeCircle(float x, float y, float rad, float thickness) { + Graphics::GfxFunctions->StrokeCircle(x, y, rad, thickness); } PUBLIC STATIC void Graphics::StrokeEllipse(float x, float y, float w, float h) { Graphics::GfxFunctions->StrokeEllipse(x, y, w, h); @@ -877,11 +897,17 @@ PUBLIC STATIC void Graphics::FillRectangle(float x, float y, float w, float PUBLIC STATIC void Graphics::DrawTexture(Texture* texture, float sx, float sy, float sw, float sh, float x, float y, float w, float h) { Graphics::GfxFunctions->DrawTexture(texture, sx, sy, sw, sh, x, y, w, h); } +PUBLIC STATIC void Graphics::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { + Graphics::GfxFunctions->DrawSprite(sprite, animation, frame, x, y, flipX, flipY, scaleW, scaleH, rotation, paletteID); +} +PUBLIC STATIC void Graphics::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { + Graphics::GfxFunctions->DrawSpritePart(sprite, animation, frame, sx, sy, sw, sh, x, y, flipX, flipY, scaleW, scaleH, rotation, paletteID); +} PUBLIC STATIC void Graphics::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { - Graphics::GfxFunctions->DrawSprite(sprite, animation, frame, x, y, flipX, flipY, scaleW, scaleH, rotation); + DrawSprite(sprite, animation, frame, x, y, flipX, flipY, scaleW, scaleH, rotation, 0); } PUBLIC STATIC void Graphics::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { - Graphics::GfxFunctions->DrawSpritePart(sprite, animation, frame, sx, sy, sw, sh, x, y, flipX, flipY, scaleW, scaleH, rotation); + DrawSpritePart(sprite, animation, frame, sx, sy, sw, sh, x, y, flipX, flipY, scaleW, scaleH, rotation, 0); } PUBLIC STATIC void Graphics::DrawTile(int tile, int x, int y, bool flipX, bool flipY) { @@ -892,7 +918,7 @@ PUBLIC STATIC void Graphics::DrawTile(int tile, int x, int y, bool flipX, bo } TileSpriteInfo info = Scene::TileSpriteInfos[tile]; - Graphics::GfxFunctions->DrawSprite(info.Sprite, info.AnimationIndex, info.FrameIndex, x, y, flipX, flipY, 1.0f, 1.0f, 0.0f); + DrawSprite(info.Sprite, info.AnimationIndex, info.FrameIndex, x, y, flipX, flipY, 1.0f, 1.0f, 0.0f); } PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* layer, View* currentView) { int tileWidth = Scene::TileWidth; @@ -942,7 +968,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l TileBaseY = baseYOff; // Loop or cut off sourceTileCellX - if (layer->Flags & SceneLayer::FLAGS_NO_REPEAT_X) { + if (!(layer->Flags & SceneLayer::FLAGS_REPEAT_X)) { if (sourceTileCellX < 0) goto SKIP_TILE_ROW_DRAW_ROT90; if (sourceTileCellX >= layer->Width) goto SKIP_TILE_ROW_DRAW_ROT90; } @@ -961,7 +987,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l for (int t = 0; t < tileCellMaxHeight; t++) { // Loop or cut off sourceTileCellX sourceTileCellY = iy; - if (layer->Flags & SceneLayer::FLAGS_NO_REPEAT_Y) { + if (!(layer->Flags & SceneLayer::FLAGS_REPEAT_Y)) { if (sourceTileCellY < 0) goto SKIP_TILE_DRAW_ROT90; if (sourceTileCellY >= layer->Height) goto SKIP_TILE_DRAW_ROT90; } @@ -983,7 +1009,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l if (flipX) partY = tileWidth - height - partY; TileSpriteInfo info = Scene::TileSpriteInfos[tile]; - Graphics::DrawSpritePart(info.Sprite, info.AnimationIndex, info.FrameIndex, partY, 0, height, tileWidth, baseX, baseY, flipX, flipY, 1.0f, 1.0f, 0.0f); + Graphics::DrawSpritePart(info.Sprite, info.AnimationIndex, info.FrameIndex, partY, 0, height, tileWidth, baseX, baseY, flipX, flipY, 1.0f, 1.0f, 0.0f, 0); if (Scene::ShowTileCollisionFlag && baseTileCfg && layer->ScrollInfoCount <= 1) { col = 0; @@ -1063,7 +1089,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l TileBaseX = baseXOff; // Loop or cut off sourceTileCellY - if (layer->Flags & SceneLayer::FLAGS_NO_REPEAT_Y) { + if (!(layer->Flags & SceneLayer::FLAGS_REPEAT_Y)) { if (sourceTileCellY < 0) goto SKIP_TILE_ROW_DRAW; if (sourceTileCellY >= layer->Height) goto SKIP_TILE_ROW_DRAW; } @@ -1083,7 +1109,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l for (int t = 0; t < tileCellMaxWidth; t++) { // Loop or cut off sourceTileCellX sourceTileCellX = ix; - if (layer->Flags & SceneLayer::FLAGS_NO_REPEAT_X) { + if (!(layer->Flags & SceneLayer::FLAGS_REPEAT_X)) { if (sourceTileCellX < 0) goto SKIP_TILE_DRAW; if (sourceTileCellX >= layer->Width) goto SKIP_TILE_DRAW; } @@ -1105,7 +1131,7 @@ PUBLIC STATIC void Graphics::DrawSceneLayer_HorizontalParallax(SceneLayer* l if (flipY) partY = tileHeight - height - partY; TileSpriteInfo info = Scene::TileSpriteInfos[tile]; - Graphics::DrawSpritePart(info.Sprite, info.AnimationIndex, info.FrameIndex, 0, partY, tileWidth, height, baseX, baseY, flipX, flipY, 1.0f, 1.0f, 0.0f); + Graphics::DrawSpritePart(info.Sprite, info.AnimationIndex, info.FrameIndex, 0, partY, tileWidth, height, baseX, baseY, flipX, flipY, 1.0f, 1.0f, 0.0f, 0); if (Scene::ShowTileCollisionFlag && baseTileCfg && layer->ScrollInfoCount <= 1) { col = 0; @@ -1191,12 +1217,12 @@ PUBLIC STATIC void Graphics::DrawSceneLayer(SceneLayer* layer, View* current } PUBLIC STATIC void Graphics::RunCustomSceneLayerFunction(ObjFunction* func, int layerIndex) { VMThread* thread = &ScriptManager::Threads[0]; - if (func->Arity == 1) { - thread->Push(INTEGER_VAL(layerIndex)); - thread->RunEntityFunction(func, 1); + if (func->Arity == 0) { + thread->RunEntityFunction(func, 0); } else { - thread->RunEntityFunction(func, 0); + thread->Push(INTEGER_VAL(layerIndex)); + thread->RunEntityFunction(func, 1); } } diff --git a/source/Engine/Hashing/CRC32.cpp b/source/Engine/Hashing/CRC32.cpp index 02876c12..64d6d577 100644 --- a/source/Engine/Hashing/CRC32.cpp +++ b/source/Engine/Hashing/CRC32.cpp @@ -12,17 +12,6 @@ class CRC32 { PUBLIC STATIC Uint32 CRC32::EncryptString(char* data) { return CRC32::EncryptData(data, strlen(data)); - // crc = 0xFFFFFFFFU; - // while (*message) { - // byte = *message; - // crc = crc ^ byte; - // for (j = 7; j >= 0; j--) { - // mask = -(crc & 1); - // crc = (crc >> 1) ^ (0xEDB88320 & mask); - // } - // message++; - // } - // return ~crc; } PUBLIC STATIC Uint32 CRC32::EncryptString(const char* message) { return CRC32::EncryptString((char*)message); diff --git a/source/Engine/Hashing/MD5.cpp b/source/Engine/Hashing/MD5.cpp index b278552d..54c7bc85 100644 --- a/source/Engine/Hashing/MD5.cpp +++ b/source/Engine/Hashing/MD5.cpp @@ -149,16 +149,13 @@ PUBLIC STATIC Uint8* MD5::EncryptString(Uint8* dest, const char* message) { PUBLIC STATIC Uint8* MD5::EncryptData(Uint8* dest, void* data, size_t size) { // Init - // Uint32 block[16]; Uint8 buffer[64]; - Uint32 lo = 0, hi = 0; + size_t lo = 0, hi = 0; Uint32 a = 0x67452301, b = 0xefcdab89, c = 0x98badcfe, d = 0x10325476; // Update - Uint32 saved_lo; size_t used, available; - - saved_lo = lo; + size_t saved_lo = lo; if ((lo = (saved_lo + size) & 0x1fffffff) < saved_lo) hi++; hi += size >> 29; @@ -187,7 +184,6 @@ PUBLIC STATIC Uint8* MD5::EncryptData(Uint8* dest, void* data, size_t size) { memcpy(buffer, data, size); // Final - // unsigned long used, available; used = lo & 0x3f; buffer[used++] = 0x80; diff --git a/source/Engine/IO/FileStream.cpp b/source/Engine/IO/FileStream.cpp index 0f55e454..bb24e683 100644 --- a/source/Engine/IO/FileStream.cpp +++ b/source/Engine/IO/FileStream.cpp @@ -26,7 +26,7 @@ extern "C" { #endif PUBLIC STATIC FileStream* FileStream::New(const char* filename, Uint32 access) { - FileStream* stream = new (nothrow) FileStream; + FileStream* stream = new (std::nothrow) FileStream; if (!stream) { return NULL; } diff --git a/source/Engine/IO/MemoryStream.cpp b/source/Engine/IO/MemoryStream.cpp index d401e944..36cbcfdd 100644 --- a/source/Engine/IO/MemoryStream.cpp +++ b/source/Engine/IO/MemoryStream.cpp @@ -33,7 +33,7 @@ PUBLIC STATIC MemoryStream* MemoryStream::New(Stream* other) { return stream; } PUBLIC STATIC MemoryStream* MemoryStream::New(void* data, size_t size) { - MemoryStream* stream = new (nothrow) MemoryStream; + MemoryStream* stream = new (std::nothrow) MemoryStream; if (!stream) { return NULL; } diff --git a/source/Engine/IO/ResourceStream.cpp b/source/Engine/IO/ResourceStream.cpp index b1c9bcb8..976abd9c 100644 --- a/source/Engine/IO/ResourceStream.cpp +++ b/source/Engine/IO/ResourceStream.cpp @@ -14,7 +14,7 @@ class ResourceStream : public Stream { #include PUBLIC STATIC ResourceStream* ResourceStream::New(const char* filename) { - ResourceStream* stream = new (nothrow) ResourceStream; + ResourceStream* stream = new (std::nothrow) ResourceStream; if (!stream) { return NULL; } diff --git a/source/Engine/IO/Serializer.cpp b/source/Engine/IO/Serializer.cpp index 71f34c96..cffe5bfa 100644 --- a/source/Engine/IO/Serializer.cpp +++ b/source/Engine/IO/Serializer.cpp @@ -2,8 +2,6 @@ #include #include -#include - class Serializer { public: std::map ObjToID; @@ -96,6 +94,9 @@ PRIVATE void Serializer::WriteValue(VMValue val) { StreamPtr->WriteByte(Serializer::VAL_TYPE_OBJECT); StreamPtr->WriteUInt32(objectID); return; + default: + StreamPtr->WriteByte(Serializer::VAL_TYPE_NULL); + return; } } } @@ -286,6 +287,8 @@ PRIVATE void Serializer::AddUniqueObject(Obj* obj) { }); return; } + default: + return; } } @@ -408,7 +411,7 @@ PRIVATE void Serializer::ReadObject(Obj* obj) { } else if (StringList[stringID].Chars != nullptr) { Uint32 length = StringList[stringID].Length; - char* mapKey = StringUtils::Duplicate(StringList[stringID].Chars, length); + char* mapKey = StringUtils::Create((void*)StringList[stringID].Chars, length); if (mapKey) map->Keys->Put(mapKey, mapKey); } diff --git a/source/Engine/Includes/DateTime.h b/source/Engine/Includes/DateTime.h new file mode 100644 index 00000000..570bff24 --- /dev/null +++ b/source/Engine/Includes/DateTime.h @@ -0,0 +1,21 @@ +#ifndef DATETIME_H +#define DATETIME_H + +enum class Weekday { + SUNDAY = 0, + MONDAY = 1, + TUESDAY = 2, + WEDNESDAY = 3, + THURSDAY = 4, + FRIDAY = 5, + SATURDAY = 6 +}; + +enum class TimeOfDay { + MORNING = 0, // Hours 5AM to 11AM. (05:00 to 11:00) + MIDDAY = 1, // Hours 12PM to 4PM. (12:00 to 16:00) + EVENING = 2, // Hours 5PM to 8PM. (17:00 to 20:00) + NIGHT = 3 // Hours 9PM to 4AM. (21:00 to 4:00) +}; + +#endif diff --git a/source/Engine/Includes/Standard.h b/source/Engine/Includes/Standard.h index 586584fe..b5022775 100644 --- a/source/Engine/Includes/Standard.h +++ b/source/Engine/Includes/Standard.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -28,7 +29,19 @@ #define R_PI 3.1415927 #endif -using namespace std; +template +using vector = std::vector; + +template +using map = std::map; + +template +using stack = std::stack; + +template +using deque = std::deque; + +using string = std::string; enum class Platforms { Windows, diff --git a/source/Engine/Includes/Token.h b/source/Engine/Includes/Token.h new file mode 100644 index 00000000..ba44183c --- /dev/null +++ b/source/Engine/Includes/Token.h @@ -0,0 +1,16 @@ +#ifndef ENGINE_TOKEN_H +#define ENGINE_TOKEN_H + +struct Token { + int Type; + char* Start; + size_t Length; + int Line; + size_t Pos; + + std::string ToString() { + return std::string(Start, Length); + } +}; + +#endif diff --git a/source/Engine/Includes/Version.h b/source/Engine/Includes/Version.h index 6bd944fe..d8b14f5e 100644 --- a/source/Engine/Includes/Version.h +++ b/source/Engine/Includes/Version.h @@ -2,8 +2,8 @@ #define VERSION_H #define VERSION_MAJOR 1 -#define VERSION_MINOR 1 -#define VERSION_PATCH 0 +#define VERSION_MINOR 2 +#define VERSION_PATCH 2 // #define VERSION_PRERELEASE // #define VERSION_CODENAME diff --git a/source/Engine/Input/Controller.cpp b/source/Engine/Input/Controller.cpp index a8da2515..1c6ace85 100644 --- a/source/Engine/Input/Controller.cpp +++ b/source/Engine/Input/Controller.cpp @@ -8,6 +8,10 @@ class Controller { ControllerType Type; bool Connected; + bool* ButtonsPressed; + bool* ButtonsHeld; + float* AxisValues; + ControllerRumble* Rumble; SDL_GameController* Device; @@ -82,20 +86,22 @@ PRIVATE STATIC ControllerType Controller::DetermineType(void* gamecontroller) { return ControllerType::PS4; case SDL_CONTROLLER_TYPE_PS5: return ControllerType::PS5; - case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: - return ControllerType::SwitchJoyConLeft; - case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: - return ControllerType::SwitchJoyConRight; - case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: - return ControllerType::SwitchJoyConPair; case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: return ControllerType::SwitchPro; case SDL_CONTROLLER_TYPE_GOOGLE_STADIA: return ControllerType::Stadia; case SDL_CONTROLLER_TYPE_AMAZON_LUNA: return ControllerType::AmazonLuna; +#if SDL_VERSION_ATLEAST(2,24,0) + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: + return ControllerType::SwitchJoyConLeft; + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: + return ControllerType::SwitchJoyConRight; + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: + return ControllerType::SwitchJoyConPair; case SDL_CONTROLLER_TYPE_NVIDIA_SHIELD: return ControllerType::NvidiaShield; +#endif case SDL_CONTROLLER_TYPE_UNKNOWN: return ControllerType::Unknown; default: @@ -116,6 +122,10 @@ PUBLIC bool Controller::Open(int index) { if (SDL_GameControllerHasRumble(Device)) Rumble = new ControllerRumble(Device); + ButtonsPressed = (bool*)Memory::Calloc((int)ControllerButton::Max, sizeof(bool)); + ButtonsHeld = (bool*)Memory::Calloc((int)ControllerButton::Max, sizeof(bool)); + AxisValues = (float*)Memory::Calloc((int)ControllerAxis::Max, sizeof(float)); + return true; } @@ -123,6 +133,22 @@ PUBLIC void Controller::Close() { if (Rumble) { Rumble->Stop(); delete Rumble; + Rumble = nullptr; + } + + if (ButtonsPressed) { + Memory::Free(ButtonsPressed); + ButtonsPressed = nullptr; + } + + if (ButtonsHeld) { + Memory::Free(ButtonsHeld); + ButtonsHeld = nullptr; + } + + if (AxisValues) { + Memory::Free(AxisValues); + AxisValues = nullptr; } SDL_GameControllerClose(Device); @@ -152,16 +178,37 @@ PUBLIC bool Controller::GetButton(int button) { return SDL_GameControllerGetButton(Device, ButtonEnums[button]); } +PUBLIC bool Controller::IsButtonHeld(int button) { + if (button < 0 || button >= (int)ControllerButton::Max) + return false; + return ButtonsHeld[button]; +} +PUBLIC bool Controller::IsButtonPressed(int button) { + if (button < 0 || button >= (int)ControllerButton::Max) + return false; + return ButtonsPressed[button]; +} + PUBLIC float Controller::GetAxis(int axis) { - if (axis >= (int)ControllerAxis::Max) + if (axis < 0 || axis >= (int)ControllerAxis::Max) return 0.0f; - Sint16 value = SDL_GameControllerGetAxis(Device, AxisEnums[axis]); - return (float)value / 32767; + return AxisValues[axis]; } PUBLIC void Controller::Update() { if (Rumble) Rumble->Update(); + + for (unsigned i = 0; i < (unsigned)ControllerButton::Max; i++) { + bool isDown = GetButton(i); + ButtonsPressed[i] = !ButtonsHeld[i] && isDown; + ButtonsHeld[i] = isDown; + } + + for (unsigned i = 0; i < (unsigned)ControllerAxis::Max; i++) { + Sint16 value = SDL_GameControllerGetAxis(Device, AxisEnums[i]); + AxisValues[i] = (float)value / 32767; + } } PUBLIC bool Controller::IsXbox() { diff --git a/source/Engine/InputManager.cpp b/source/Engine/InputManager.cpp index efb579f3..0886a06a 100644 --- a/source/Engine/InputManager.cpp +++ b/source/Engine/InputManager.cpp @@ -450,98 +450,113 @@ PUBLIC STATIC bool InputManager::IsKeyReleased(int key) { return !KeyboardState[scancode] && KeyboardStateLast[scancode]; } -#define GET_CONTROLLER(ret) \ - if (index < 0 || index >= InputManager::NumControllers) \ - return ret; \ - Controller* controller = InputManager::Controllers[index]; \ - if (!controller) return ret +PRIVATE STATIC Controller* InputManager::GetController(int index) { + if (index >= 0 && index < InputManager::NumControllers) { + return InputManager::Controllers[index]; + } + return nullptr; +} PUBLIC STATIC bool InputManager::ControllerIsConnected(int index) { - GET_CONTROLLER(false); - return controller->Connected; + Controller* controller = GetController(index); + if (controller) + return controller->Connected; + return false; } PUBLIC STATIC bool InputManager::ControllerIsXbox(int index) { - GET_CONTROLLER(false); - return controller->IsXbox(); + Controller* controller = GetController(index); + if (controller) + return controller->IsXbox(); + return false; } PUBLIC STATIC bool InputManager::ControllerIsPlayStation(int index) { - GET_CONTROLLER(false); - return controller->IsPlayStation(); + Controller* controller = GetController(index); + if (controller) + return controller->IsXbox(); + return false; } PUBLIC STATIC bool InputManager::ControllerIsJoyCon(int index) { - GET_CONTROLLER(false); - return controller->IsJoyCon(); + Controller* controller = GetController(index); + if (controller) + return controller->IsJoyCon(); + return false; } PUBLIC STATIC bool InputManager::ControllerHasShareButton(int index) { - GET_CONTROLLER(false); - return controller->HasShareButton(); + Controller* controller = GetController(index); + if (controller) + return controller->HasShareButton(); + return false; } PUBLIC STATIC bool InputManager::ControllerHasMicrophoneButton(int index) { - GET_CONTROLLER(false); - return controller->HasMicrophoneButton(); + Controller* controller = GetController(index); + if (controller) + return controller->HasMicrophoneButton(); + return false; } PUBLIC STATIC bool InputManager::ControllerHasPaddles(int index) { - GET_CONTROLLER(false); - return controller->HasPaddles(); -} -PUBLIC STATIC bool InputManager::ControllerGetButton(int index, int button) { - GET_CONTROLLER(false); - return controller->GetButton(button); -} -// For backwards compatibility. Use ControllerGetButton instead. -PUBLIC STATIC int InputManager::ControllerGetHat(int index, int hat) { - if (hat != 0) return 0; - GET_CONTROLLER(0); - - int flags = 0; - if (controller->GetButton((int)ControllerButton::DPadUp)) - flags |= SDL_HAT_UP; - if (controller->GetButton((int)ControllerButton::DPadDown)) - flags |= SDL_HAT_DOWN; - if (controller->GetButton((int)ControllerButton::DPadLeft)) - flags |= SDL_HAT_LEFT; - if (controller->GetButton((int)ControllerButton::DPadRight)) - flags |= SDL_HAT_RIGHT; - - return flags; + Controller* controller = GetController(index); + if (controller) + return controller->HasPaddles(); + return false; +} +PUBLIC STATIC bool InputManager::ControllerIsButtonHeld(int index, int button) { + Controller* controller = GetController(index); + if (controller) + return controller->IsButtonHeld(button); + return false; +} +PUBLIC STATIC bool InputManager::ControllerIsButtonPressed(int index, int button) { + Controller* controller = GetController(index); + if (controller) + return controller->IsButtonPressed(button); + return false; } PUBLIC STATIC float InputManager::ControllerGetAxis(int index, int axis) { - GET_CONTROLLER(0.0f); - return controller->GetAxis(axis); + Controller* controller = GetController(index); + if (controller) + return controller->GetAxis(axis); + return 0.0f; } PUBLIC STATIC int InputManager::ControllerGetType(int index) { - GET_CONTROLLER((int)ControllerType::Unknown); - return (int)controller->Type; + Controller* controller = GetController(index); + if (controller) + return (int)controller->Type; + return (int)ControllerType::Unknown; } PUBLIC STATIC char* InputManager::ControllerGetName(int index) { - GET_CONTROLLER(nullptr); - return controller->GetName(); + Controller* controller = GetController(index); + if (controller) + return controller->GetName(); + return nullptr; } PUBLIC STATIC void InputManager::ControllerSetPlayerIndex(int index, int player_index) { - GET_CONTROLLER(); - controller->SetPlayerIndex(player_index); + Controller* controller = GetController(index); + if (controller) + controller->SetPlayerIndex(player_index); } PUBLIC STATIC bool InputManager::ControllerHasRumble(int index) { - GET_CONTROLLER(false); - return controller->Rumble != nullptr; + Controller* controller = GetController(index); + return controller && controller->Rumble; } PUBLIC STATIC bool InputManager::ControllerIsRumbleActive(int index) { - GET_CONTROLLER(false); - if (!controller->Rumble) return false; - return controller->Rumble->Active; + Controller* controller = GetController(index); + if (controller && controller->Rumble) + return controller->Rumble->Active; + return false; } PUBLIC STATIC bool InputManager::ControllerRumble(int index, float large_frequency, float small_frequency, int duration) { - GET_CONTROLLER(false); - if (!controller->Rumble) return false; - return controller->Rumble->Enable(large_frequency, small_frequency, (Uint32)duration); + Controller* controller = GetController(index); + if (controller && controller->Rumble) + return controller->Rumble->Enable(large_frequency, small_frequency, (Uint32)duration); + return false; } PUBLIC STATIC bool InputManager::ControllerRumble(int index, float strength, int duration) { return InputManager::ControllerRumble(index, strength, strength, duration); } PUBLIC STATIC void InputManager::ControllerStopRumble(int index) { - GET_CONTROLLER(); - if (!controller->Rumble) return; - controller->Rumble->Stop(); + Controller* controller = GetController(index); + if (controller && controller->Rumble) + controller->Rumble->Stop(); } PUBLIC STATIC void InputManager::ControllerStopRumble() { for (int i = 0; i < InputManager::NumControllers; i++) { @@ -554,28 +569,29 @@ PUBLIC STATIC void InputManager::ControllerStopRumble() { } } PUBLIC STATIC bool InputManager::ControllerIsRumblePaused(int index) { - GET_CONTROLLER(false); - if (!controller->Rumble) return false; - return controller->Rumble->Paused; + Controller* controller = GetController(index); + if (controller && controller->Rumble) + return controller->Rumble->Paused; + return false; } PUBLIC STATIC void InputManager::ControllerSetRumblePaused(int index, bool paused) { - GET_CONTROLLER(); - if (!controller->Rumble) return; - controller->Rumble->SetPaused(paused); + Controller* controller = GetController(index); + if (controller && controller->Rumble) + controller->Rumble->SetPaused(paused); } PUBLIC STATIC bool InputManager::ControllerSetLargeMotorFrequency(int index, float frequency) { - GET_CONTROLLER(false); - if (!controller->Rumble) return false; - return controller->Rumble->SetLargeMotorFrequency(frequency); + Controller* controller = GetController(index); + if (controller && controller->Rumble) + return controller->Rumble->SetLargeMotorFrequency(frequency); + return false; } PUBLIC STATIC bool InputManager::ControllerSetSmallMotorFrequency(int index, float frequency) { - GET_CONTROLLER(false); - if (!controller->Rumble) return false; - return controller->Rumble->SetSmallMotorFrequency(frequency); + Controller* controller = GetController(index); + if (controller && controller->Rumble) + return controller->Rumble->SetSmallMotorFrequency(frequency); + return false; } -#undef GET_CONTROLLER - PUBLIC STATIC float InputManager::TouchGetX(int touch_index) { TouchState* states = (TouchState*)TouchStates; return states[touch_index].X; diff --git a/source/Engine/Math/Geometry.cpp b/source/Engine/Math/Geometry.cpp new file mode 100644 index 00000000..629bd95b --- /dev/null +++ b/source/Engine/Math/Geometry.cpp @@ -0,0 +1,182 @@ +#if INTERFACE +#include +#include + +class Geometry { +public: +}; +#endif + +#include +#include + +#include + +#include +#include + +PRIVATE STATIC bool Geometry::CheckEar(vector& input, unsigned count, unsigned prev, unsigned curr, unsigned next) { + FVector2& a = input[prev]; + FVector2& b = input[curr]; + FVector2& c = input[next]; + + FVector2 ab = b - a; + FVector2 bc = c - b; + FVector2 ca = a - c; + + if (FVector2::Determinant(ab, bc) < 0) + return false; + + float da = FVector2::Determinant(ab, a); + float db = FVector2::Determinant(bc, b); + float dc = FVector2::Determinant(ca, c); + + unsigned i = (next + 1) % count; + while (i != prev) { + FVector2& point = input[i]; + + if (FVector2::Determinant(ab, point) > da + && FVector2::Determinant(bc, point) > db + && FVector2::Determinant(ca, point) > dc) + return false; + + i = (i + 1) % count; + } + + return true; +} + +PRIVATE STATIC int Geometry::GetPointForTriangulation(int point, unsigned count) { + if (point < 0) + return point + count; + else if (point >= count) + return point % count; + else + return point; +} + +static std::vector GetP2TPoints(Polygon2D& input) { + std::vector points; + + for (unsigned i = 0; i < input.Points.size(); i++) + points.push_back(new p2t::Point(input.Points[i].X, input.Points[i].Y)); + + return points; +} + +static void FreeP2TPoints(std::vector& points) { + for (unsigned i = 0; i < points.size(); i++) + delete points[i]; +} + +PUBLIC STATIC vector* Geometry::Triangulate(Polygon2D& input, vector holes) { + vector points = input.Points; + + unsigned count = points.size(); + if (!count || count < 3) + return nullptr; + + vector* output = new vector(); + + std::vector inputPoly = GetP2TPoints(input); + std::vector> inputHoles; + + p2t::CDT* cdt = new p2t::CDT(inputPoly); + + for (Polygon2D hole : holes) { + std::vector inputHole = GetP2TPoints(hole); + inputHoles.push_back(inputHole); + cdt->AddHole(inputHole); + } + + try { + cdt->Triangulate(); + + vector triangles = cdt->GetTriangles(); + + for (unsigned int i = 0; i < triangles.size(); i++) { + p2t::Triangle& t = *triangles[i]; + p2t::Point& a = *t.GetPoint(0); + p2t::Point& b = *t.GetPoint(1); + p2t::Point& c = *t.GetPoint(2); + + Polygon2D polygon; + polygon.AddPoint(a.x, a.y); + polygon.AddPoint(b.x, b.y); + polygon.AddPoint(c.x, c.y); + + output->push_back(polygon); + } + } catch (std::runtime_error& err) { + Log::Print(Log::LOG_ERROR, "Geometry::Triangulate error: %s", err.what()); + } + + FreeP2TPoints(inputPoly); + + for (std::vector hole : inputHoles) + FreeP2TPoints(hole); + + delete cdt; + + return output; +} + +static Clipper2Lib::ClipType GetClipType(unsigned clipType) { + switch (clipType) { + case GeoBooleanOp_Intersection: + return Clipper2Lib::ClipType::Intersection; + case GeoBooleanOp_Union: + return Clipper2Lib::ClipType::Union; + case GeoBooleanOp_Difference: + return Clipper2Lib::ClipType::Difference; + case GeoBooleanOp_ExclusiveOr: + return Clipper2Lib::ClipType::Xor; + default: + return Clipper2Lib::ClipType::None; + } +} + +static Clipper2Lib::FillRule GetFillRule(unsigned fillRule) { + switch (fillRule) { + case GeoFillRule_EvenOdd: + return Clipper2Lib::FillRule::EvenOdd; + case GeoFillRule_NonZero: + return Clipper2Lib::FillRule::NonZero; + case GeoFillRule_Positive: + return Clipper2Lib::FillRule::Positive; + case GeoFillRule_Negative: + return Clipper2Lib::FillRule::Negative; + default: + return Clipper2Lib::FillRule::EvenOdd; + } +} + +PUBLIC STATIC vector* Geometry::Intersect(unsigned clipType, unsigned fillRule, vector inputSubjects, vector inputClips) { + Clipper2Lib::PathsD subjects; + Clipper2Lib::PathsD clips; + + for (Polygon2D& sub : inputSubjects) + subjects.push_back(Clipper2Lib::MakePathD(sub.ToList())); + for (Polygon2D& clip : inputClips) + clips.push_back(Clipper2Lib::MakePathD(clip.ToList())); + + Clipper2Lib::ClipperD clipper; + clipper.AddSubject(subjects); + clipper.AddClip(clips); + + Clipper2Lib::PathsD result; + clipper.Execute(GetClipType(clipType), GetFillRule(fillRule), result); + + vector* output = new vector(); + + for (Clipper2Lib::PathD& path : result) { + Polygon2D polygon; + + for (Clipper2Lib::PointD& point : path) + polygon.AddPoint(point.x, point.y); + + output->push_back(polygon); + } + + return output; +} diff --git a/source/Engine/Math/GeometryTypes.h b/source/Engine/Math/GeometryTypes.h new file mode 100644 index 00000000..35890c8a --- /dev/null +++ b/source/Engine/Math/GeometryTypes.h @@ -0,0 +1,245 @@ +#ifndef GEOMETRYTYPES_H +#define GEOMETRYTYPES_H + +#include +#include + +#include + +enum { + GeoBooleanOp_Intersection, + GeoBooleanOp_Union, + GeoBooleanOp_Difference, + GeoBooleanOp_ExclusiveOr +}; + +enum { + GeoFillRule_EvenOdd, + GeoFillRule_NonZero, + GeoFillRule_Positive, + GeoFillRule_Negative +}; + +struct Polygon2D { + vector Points; + + float MinX, MinY, MaxX, MaxY; + + Polygon2D() { + Points.resize(0); + MinX = 0.0; + MinY = 0.0; + MaxX = 0.0; + MaxY = 0.0; + } + + Polygon2D(vector input) { + Points = input; + CalcBounds(); + } + + void AddPoint(FVector2 point) { + Points.push_back(point); + CalcBounds(); + } + + void AddPoint(float x, float y) { + FVector2 vec(x, y); + AddPoint(vec); + } + + vector ToList() { + unsigned count = Points.size(); + + vector vertices; + + for (unsigned i = 0; i < count; i++) { + vertices.push_back(Points[i].X); + vertices.push_back(Points[i].Y); + } + + return vertices; + } + + bool IsValid() { + return Points.size() >= 3; + } + + bool IsPointInside(FVector2 point) { + // Cannot possibly be inside + if (!IsValid() || point.X < MinX || point.X > MaxX || point.Y < MinY || point.Y > MaxY) + return false; + + bool isInside = false; + unsigned currPt = 0; + unsigned prevPt = Points.size() - 1; + + while (currPt < Points.size()) { + FVector2& a = Points[currPt]; + FVector2& b = Points[prevPt]; + + if (a.Y > point.Y != b.Y > point.Y) { + if (point.X < (b.X - a.X) * (point.Y - a.Y) / (b.Y - a.Y) + a.X) + isInside = !isInside; + } + + prevPt = currPt; + currPt++; + } + + return isInside; + } + + bool IsPointInside(float x, float y) { + FVector2 vec(x, y); + return IsPointInside(vec); + } + + bool IsLineSegmentIntersecting(FVector2 lineA, FVector2 lineB) { + if (!IsValid()) + return false; + + unsigned currPt = 0; + while (currPt < Points.size() - 1) { + FVector2& a = Points[currPt]; + FVector2& b = Points[currPt + 1]; + + FVector2 result; + if (FLineSegment::DoIntersection(a, b, lineA, lineB, result)) + return true; + + currPt++; + } + + return false; + } + + bool IsLineSegmentIntersecting(FLineSegment line) { + return IsLineSegmentIntersecting(line.A, line.B); + } + + bool IsLineSegmentIntersecting(float x1, float y1, float x2, float y2) { + FLineSegment line(x1, y1, x2, y2); + return IsLineSegmentIntersecting(line); + } + + int CalculateWinding() { + if (!IsValid()) + return 0; + + float calc = 0.0; + + size_t numPoints = Points.size(); + + FVector2& prev = Points[numPoints - 1]; + for (size_t i = 0; i < numPoints; i++) { + FVector2& next = Points[i]; + calc += (next.X - prev.X) * (next.Y + prev.Y); + prev = next; + } + + if (calc > 0.0) + return 1; + + return -1; + } + +private: + void CalcBounds() { + if (!IsValid()) + return; + + float xMin = FLT_MAX; + float yMin = FLT_MAX; + float xMax = FLT_MIN; + float yMax = FLT_MIN; + + for (unsigned i = 0; i < Points.size(); i++) { + float ptX = Points[i].X; + float ptY = Points[i].Y; + + if (ptX > xMax) + xMax = ptX; + if (ptX < xMin) + xMin = ptX; + + if (ptY > yMax) + yMax = ptY; + if (ptY < yMin) + yMin = ptY; + } + + MinX = xMin; + MinY = yMin; + MaxX = xMax; + MaxY = yMax; + } +}; + +struct Triangle { + FVector2 A, B, C; + + Triangle(FVector2 a, FVector2 b, FVector2 c) { + A = a; + B = b; + C = c; + } + + Triangle(vector& points) { + A = points[0]; + B = points[1]; + C = points[2]; + } + + Polygon2D ToPolygon() { + Polygon2D tri; + tri.Points.push_back(A); + tri.Points.push_back(B); + tri.Points.push_back(C); + return tri; + } + + bool IsClockwise() { + return FVector2::CrossProduct(A, B, C) < 0; + } + + bool IsCounterClockwise() { + return FVector2::CrossProduct(A, B, C) > 0; + } + + float GetArea() { + float area = + A.X * (B.Y - C.Y) + + B.X * (C.Y - A.Y) + + C.X * (A.Y - B.Y); + + return area / 2; + } + + bool IsPointInside(FVector2 point) { + FVector2 v1 = C - A; + FVector2 v2 = B - A; + FVector2 v3 = point - A; + + float d11 = FVector2::DotProduct(v1, v1); + float d12 = FVector2::DotProduct(v1, v2); + float d13 = FVector2::DotProduct(v1, v3); + float d22 = FVector2::DotProduct(v2, v2); + float d23 = FVector2::DotProduct(v2, v3); + + float denom = (d11 * d22) - (d12 * d12); + if (fabsf(denom) <= 0.0) + return true; + + float invDenom = 1.0 / denom; + float u = (d22 * d13 - d12 * d23) * invDenom; + float v = (d11 * d23 - d12 * d13) * invDenom; + + if (u >= 0.0 && v >= 0.0 && (u + v) < 1.0) + return true; + + return false; + } +}; + +#endif /* GEOMETRYTYPES_H */ diff --git a/source/Engine/Math/IMath.cpp.unused b/source/Engine/Math/IMath.cpp.unused deleted file mode 100644 index 6fece432..00000000 --- a/source/Engine/Math/IMath.cpp.unused +++ /dev/null @@ -1,116 +0,0 @@ -#if INTERFACE -#include - -class Math { -public: - static int CosValues[256]; - static int SinValues[256]; - static int AtanValues[258]; - - static double CosDoubleValues[256]; - static double SinDoubleValues[256]; - - static char Str[258]; -}; -#endif - -#include - -int Math::CosValues[256]; -int Math::SinValues[256]; -int Math::AtanValues[258]; -double Math::CosDoubleValues[256]; -double Math::SinDoubleValues[256]; -char Math::Str[258]; - -PUBLIC STATIC void Math::Init() { - for (int i = 0; i < 256; i++) { - CosValues[i] = (int)(cos(i * M_PI / 128.0) * 0x10000); - SinValues[i] = (int)(-sin(i * M_PI / 128.0) * 0x10000); - CosDoubleValues[i] = (double)cos(i * M_PI / 128.0); - SinDoubleValues[i] = (double)-sin(i * M_PI / 128.0); - AtanValues[i] = (int)(atan2(i * 1.0, 256.0) * 0x80 / M_PI + 0x100) & 0xFF; - } - for (int i = 256; i < 258; i++) { - AtanValues[i] = (int)(atan2(i * 1.0, 256.0) * 0x80 / M_PI + 0x100) & 0xFF; - } -} - -// Trig functions -PUBLIC STATIC int Math::Cos(int n) { - return CosValues[n & 0xFF]; -} -PUBLIC STATIC int Math::Sin(int n) { - return SinValues[n & 0xFF]; -} -PUBLIC STATIC int Math::Atan(int x, int y) { - if (x == 0 && y == 0) return 0x0; - - y = -y; - - int val; - int ax = Math::Abs(x); - int ay = Math::Abs(y); - - if (ay < ax) { - ay = (ay << 8) / ax; - val = AtanValues[ay & 0xFF]; - } - else if (ay > ax) { - ax = (ax << 8) / ay; - val = 0x40 - AtanValues[ax & 0xFF]; - } - else { - val = 0x20; - } - - if (x < 0) - val = -val + 0x80; - if (y < 0) - val = -val + 0x100; - - return val & 0xFF; -} -PUBLIC STATIC int Math::Distance(int x1, int y1, int x2, int y2) { - x2 -= x1; x2 *= x2; - y2 -= y1; y2 *= y2; - return (int)sqrt(x2 + y2); -} -PUBLIC STATIC double Math::CosDouble(int n) { - return CosDoubleValues[n & 0xFF]; -} -PUBLIC STATIC double Math::SinDouble(int n) { - return SinDoubleValues[n & 0xFF]; -} -// Deterministic functions -PUBLIC STATIC int Math::Abs(int n) { - return n < 0 ? -n : n; -} -PUBLIC STATIC int Math::Max(int a, int b) { - return a > b ? a : b; -} -PUBLIC STATIC int Math::Min(int a, int b) { - return a < b ? a : b; -} -PUBLIC STATIC int Math::Clamp(int v, int a, int b) { - return Math::Max(a, Math::Min(v, b)); -} -PUBLIC STATIC int Math::Sign(int a) { - return -(a < 0); -} - -// Random functions (inclusive) -PUBLIC STATIC int Math::Random() { - return rand() & 0xFFFFFFFF; -} -PUBLIC STATIC int Math::RandomMax(int max) { - return rand() % (max + 1); -} -PUBLIC STATIC int Math::RandomRange(int min, int max) { - return (rand() % (max - min + 1)) + min; -} - -PUBLIC STATIC char* Math::ToString(int a) { - sprintf(Math::Str, "%d", a); - return Math::Str; -} diff --git a/source/Engine/Math/Matrix4x4.cpp b/source/Engine/Math/Matrix4x4.cpp index 86119c7a..4bab939b 100644 --- a/source/Engine/Math/Matrix4x4.cpp +++ b/source/Engine/Math/Matrix4x4.cpp @@ -279,8 +279,8 @@ PUBLIC STATIC void Matrix4x4::IdentityRotationXYZ(Matrix4x4* out, float x, float cosZ = Math::Cos(z); float sinXY = sinX * sinY; out->Values[9] = sinX; + out->Values[12] = 0.f; out->Values[13] = 0.f; - out->Values[14] = 0.f; out->Values[0] = (cosY * cosZ) + (sinZ * sinXY); out->Values[4] = (cosY * sinZ) - (cosZ * sinXY); out->Values[8] = cosX * sinY; @@ -290,12 +290,12 @@ PUBLIC STATIC void Matrix4x4::IdentityRotationXYZ(Matrix4x4* out, float x, float sincosXY = sinX * cosY; out->Values[2] = (sinZ * sincosXY) - (sinY * cosZ); out->Values[6] = (-(sinZ * sinY)) - (cosZ * sincosXY); - out->Values[15] = 0.f; + out->Values[14] = 0.f; out->Values[3] = 0.f; out->Values[7] = 0.f; out->Values[10] = cosX * cosY; out->Values[11] = 0.f; - out->Values[16] = 1.f; + out->Values[15] = 1.f; } PUBLIC STATIC void Matrix4x4::Transpose(Matrix4x4* out) { Matrix4x4 transposed; diff --git a/source/Engine/Math/Vector.cpp b/source/Engine/Math/Vector.cpp index 4396c22b..ff0675e1 100644 --- a/source/Engine/Math/Vector.cpp +++ b/source/Engine/Math/Vector.cpp @@ -29,7 +29,7 @@ PUBLIC STATIC Vector4 Vector::Subtract(Vector4 v1, Vector4 v2) { return result; } -PUBLIC STATIC Vector4 Vector::Multiply(Vector4 v, int t) { +PUBLIC STATIC Vector4 Vector::Multiply(Vector4 v, Sint64 t) { Vector4 result; result.X = FP16_MULTIPLY(v.X, t); result.Y = FP16_MULTIPLY(v.Y, t); @@ -61,6 +61,15 @@ PUBLIC STATIC Vector3 Vector::Multiply(Vector3 v, Matrix4x4* m) { return result; } +PUBLIC STATIC Vector2 Vector::Interpolate(Vector2 v1, Vector2 v2, Sint64 t) { + Vector2 result; + + result.X = v1.X + FP16_MULTIPLY(v2.X - v1.X, t); + result.Y = v1.Y + FP16_MULTIPLY(v2.Y - v1.Y, t); + + return result; +} + PUBLIC STATIC Vector3 Vector::Interpolate(Vector3 v1, Vector3 v2, Sint64 t) { Vector3 result; diff --git a/source/Engine/Math/VectorTypes.h b/source/Engine/Math/VectorTypes.h index f9d7d7ea..e8414653 100644 --- a/source/Engine/Math/VectorTypes.h +++ b/source/Engine/Math/VectorTypes.h @@ -17,4 +17,97 @@ struct Vector4 { Sint64 W; }; +struct FVector2 { + float X = 0.0; + float Y = 0.0; + + FVector2() { } + + FVector2(float x, float y) { + X = x; + Y = y; + } + + FVector2 operator+(const FVector2& b) { + FVector2 result(X + b.X, Y + b.Y); + return result; + } + + FVector2 operator-(const FVector2& b) { + FVector2 result(X - b.X, Y - b.Y); + return result; + } + + FVector2 operator-() { + return FVector2(-X, -Y); + } + + bool operator==(const FVector2& rhs) { + return X == rhs.X && Y == rhs.Y; + } + + bool operator!=(const FVector2& rhs) { + return !(*this == rhs); + } + + static float CrossProduct(FVector2 v1, FVector2 v2, FVector2 v3) { + FVector2 va = v2 - v1; + FVector2 vb = v3 - v2; + return Determinant(va, vb); + } + + static float DotProduct(FVector2 v1, FVector2 v2) { + return (v1.X * v2.X) + (v1.Y * v2.Y); + } + + static float Determinant(FVector2 v1, FVector2 v2) { + return (v1.X * v2.Y) - (v1.Y * v2.X); + } +}; + +struct FLineSegment { + FVector2 A, B; + + FLineSegment(FVector2 a, FVector2 b) { + A = a; + B = b; + } + + FLineSegment(float x1, float y1, float x2, float y2) { + A.X = x1; + A.Y = y1; + B.X = x2; + B.Y = y2; + } + + static bool DoIntersection(FVector2 line1A, FVector2 line1B, FVector2 line2A, FVector2 line2B, FVector2& result) { + float dx1 = line1B.X - line1A.X; + float dy1 = line1B.Y - line1A.Y; + float dx2 = line2B.X - line2A.X; + float dy2 = line2B.Y - line2A.Y; + float d = dx1 * dy2 - dy1 * dx2; + if (d == 0.0) + return false; + + float n = ((line1A.Y - line2A.Y) * dx2) - ((line1A.X - line2A.X) * dy2); + float t = n / d; + if (t < 0.0 || t > 1.0) + return false; + + float n2 = ((line1A.Y - line2A.Y) * dx1) - ((line1A.X - line2A.X) * dy1); + float t2 = n2 / d; + if (t2 < 0.0 || t2 > 1.0) + return false; + + result.X = line1A.X + (t * dx1); + result.Y = line1A.Y + (t * dy1); + + return true; + } + + bool DoIntersection(FVector2 lineA, FVector2 lineB, FVector2& result) { + return FLineSegment::DoIntersection(A, B, lineA, lineB, result); + } +}; + #endif /* VECTORTYPES_H */ diff --git a/source/Engine/Media/MediaSource.cpp b/source/Engine/Media/MediaSource.cpp index 0c73fe5c..939bd018 100644 --- a/source/Engine/Media/MediaSource.cpp +++ b/source/Engine/Media/MediaSource.cpp @@ -72,8 +72,8 @@ void _AVLogCallback(void *ptr, int level, const char* fmt, va_list vargs) { return; } - char str[4000]; - vsprintf(str, fmt, vargs); + char str[4096]; + vsnprintf(str, sizeof str, fmt, vargs); str[strlen(str) - 1] = 0; char* force = (char*)str + strlen(str); diff --git a/source/Engine/Network/WebSocketClient.cpp b/source/Engine/Network/WebSocketClient.cpp index d17c0217..07bfdf1e 100644 --- a/source/Engine/Network/WebSocketClient.cpp +++ b/source/Engine/Network/WebSocketClient.cpp @@ -232,7 +232,7 @@ size_t socket_send_string(socket_t sockfd, const char* str, ...) { char line[1024]; va_list args; va_start(args, str); - vsprintf(line, str, args); + vsnprintf(line, sizeof 1024, str, args); return send(sockfd, line, strlen(line), 0); } diff --git a/source/Engine/Rendering/3D.h b/source/Engine/Rendering/3D.h index 9733828a..83ea7236 100644 --- a/source/Engine/Rendering/3D.h +++ b/source/Engine/Rendering/3D.h @@ -23,7 +23,7 @@ enum { }; #define MAX_3D_SCENES 0x20 -#define MAX_VERTEX_BUFFERS 256 +#define MAX_VERTEX_BUFFERS 2048 #define MAX_POLYGON_VERTICES 16 #define NUM_FRUSTUM_PLANES 6 diff --git a/source/Engine/Rendering/D3D/D3DRenderer.cpp b/source/Engine/Rendering/D3D/D3DRenderer.cpp index 202c3646..40347700 100644 --- a/source/Engine/Rendering/D3D/D3DRenderer.cpp +++ b/source/Engine/Rendering/D3D/D3DRenderer.cpp @@ -1268,7 +1268,7 @@ PUBLIC STATIC void D3DRenderer::StrokeLine(float x1, float y1, float x2, flo // glDrawArrays(GL_LINES, 0, 2); Graphics::Restore(); } -PUBLIC STATIC void D3DRenderer::StrokeCircle(float x, float y, float rad) { +PUBLIC STATIC void D3DRenderer::StrokeCircle(float x, float y, float rad, float thickness) { D3D_BeginDrawShape(D3D_BufferCircleStroke, 361); Graphics::Save(); @@ -1365,7 +1365,7 @@ PUBLIC STATIC void D3DRenderer::DrawTexture(Texture* texture, float sx, floa sx = 0.0, sy = 0.0, sw = texture->Width, sh = texture->Height; D3D_DrawTextureRaw(texture, sx, sy, sw, sh, x, y, w, h, false, texture->Access != SDL_TEXTUREACCESS_TARGET); } -PUBLIC STATIC void D3DRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void D3DRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; AnimFrame animframe = sprite->Animations[animation].Frames[frame]; @@ -1381,7 +1381,7 @@ PUBLIC STATIC void D3DRenderer::DrawSprite(ISprite* sprite, int animation, i D3D_DrawTextureRaw(sprite->Spritesheets[animframe.SheetNumber], animframe.X, animframe.Y, animframe.Width, animframe.Height, animframe.OffsetX, animframe.OffsetY, animframe.Width, animframe.Height, flipX, flipY); Graphics::Restore(); } -PUBLIC STATIC void D3DRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void D3DRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; AnimFrame animframe = sprite->Animations[animation].Frames[frame]; diff --git a/source/Engine/Rendering/Enums.h b/source/Engine/Rendering/Enums.h index 9719b95e..8a97b60b 100644 --- a/source/Engine/Rendering/Enums.h +++ b/source/Engine/Rendering/Enums.h @@ -91,49 +91,6 @@ enum { DrawMode_FlagsMask = ~0xF }; -enum { - TILECOLLISION_NONE = 0, - TILECOLLISION_DOWN = 1, - TILECOLLISION_UP = 2 -}; - -enum { - C_NONE = 0, - C_TOP = 1, - C_LEFT = 2, - C_RIGHT = 3, - C_BOTTOM = 4 -}; - -enum { - FLIP_NONE = 0, - FLIP_X = 1, - FLIP_Y = 2, - FLIP_XY = 3 -}; - -enum { - CMODE_FLOOR = 0, - CMODE_LWALL = 1, - CMODE_ROOF = 2, - CMODE_RWALL = 3 -}; - -enum { - H_TYPE_TOUCH = 0, - H_TYPE_CIRCLE = 1, - H_TYPE_BOX = 2, - H_TYPE_PLAT = 3 -}; - -#define TILE_FLIPX_MASK 0x80000000U -#define TILE_FLIPY_MASK 0x40000000U -// #define TILE_DIAGO_MASK 0x20000000U -#define TILE_COLLA_MASK 0x30000000U -#define TILE_COLLB_MASK 0x0C000000U -#define TILE_COLLC_MASK 0x03000000U -#define TILE_IDENT_MASK 0x00FFFFFFU - struct TileScanLine { Sint64 SrcX; Sint64 SrcY; @@ -172,6 +129,7 @@ struct GraphicsState { bool UseTinting; bool UseDepthTesting; bool UsePalettes; + bool UsePaletteIndexLines; }; struct TintState { bool Enabled; diff --git a/source/Engine/Rendering/FaceInfo.cpp b/source/Engine/Rendering/FaceInfo.cpp index eb2484f7..306b2e95 100644 --- a/source/Engine/Rendering/FaceInfo.cpp +++ b/source/Engine/Rendering/FaceInfo.cpp @@ -28,14 +28,14 @@ PUBLIC void FaceInfo::SetMaterial(Material* material) { UseMaterial = true; MaterialInfo.Texture = NULL; - Image* image = material->ImagePtr; + Image* image = material->TextureDiffuse; if (image && image->TexturePtr) MaterialInfo.Texture = (Texture*)image->TexturePtr; for (unsigned i = 0; i < 4; i++) { - MaterialInfo.Specular[i] = material->Specular[i] * 0x100; - MaterialInfo.Ambient[i] = material->Ambient[i] * 0x100; - MaterialInfo.Diffuse[i] = material->Diffuse[i] * 0x100; + MaterialInfo.Specular[i] = material->ColorSpecular[i] * 0x100; + MaterialInfo.Ambient[i] = material->ColorAmbient[i] * 0x100; + MaterialInfo.Diffuse[i] = material->ColorDiffuse[i] * 0x100; } } diff --git a/source/Engine/Rendering/GL/GLRenderer.cpp b/source/Engine/Rendering/GL/GLRenderer.cpp index 42d3582a..f78bfecd 100644 --- a/source/Engine/Rendering/GL/GLRenderer.cpp +++ b/source/Engine/Rendering/GL/GLRenderer.cpp @@ -34,6 +34,8 @@ class GLRenderer { // #define HAVE_GL_PERFSTATS +#define USE_USHORT_VTXBUFFER + #include #include @@ -133,6 +135,8 @@ struct GL_VertexBuffer { vector* Entries; Uint32 Capacity; vector*> VertexIndexList; + void* VertexIndexBuffer; + size_t VertexIndexBufferCapacity; bool UseVertexIndices; bool Changed; }; @@ -164,9 +168,6 @@ struct GL_Scene3DBatch { vector VertexIndices; }; -void *GL_VertexIndexBuffer = nullptr; -size_t GL_VertexIndexBufferCapacity = 0; - GLenum GL_VertexIndexBufferFormat; size_t GL_VertexIndexBufferMaxElements; size_t GL_VertexIndexBufferStride; @@ -669,14 +670,14 @@ void GL_UpdateVertexBuffer(Scene3D* scene, VertexBuffer* vertexBuffer, Uint32 dr if (glFace.PrimitiveType == GL_TRIANGLE_FAN) glFace.PrimitiveType = GL_TRIANGLES; - // Make a triangle fan + // Make a triangle strip if (vertexCount > 3) { glFace.NumVertices = 3; - for (unsigned i = 0; i < vertexCount - 2; i++) { - glFace.VertexIndices[0] = vtxIdx; - glFace.VertexIndices[1] = vtxIdx + i + 1; - glFace.VertexIndices[2] = vtxIdx + i + 2; + for (unsigned i = 0; i < vertexCount - 1; i += 2) { + glFace.VertexIndices[0] = vtxIdx + i; + glFace.VertexIndices[1] = vtxIdx + ((i + 1) % vertexCount); + glFace.VertexIndices[2] = vtxIdx + ((i + 2) % vertexCount); vertexIndices->push_back(glFace.VertexIndices[0]); vertexIndices->push_back(glFace.VertexIndices[1]); @@ -685,17 +686,20 @@ void GL_UpdateVertexBuffer(Scene3D* scene, VertexBuffer* vertexBuffer, Uint32 dr driverData->Faces->push_back(glFace); } } + else { + glFace.VertexIndices[0] = vtxIdx; + glFace.VertexIndices[1] = vtxIdx + 1; + glFace.VertexIndices[2] = vtxIdx + 2; - glFace.VertexIndices[0] = vtxIdx; - glFace.VertexIndices[1] = vtxIdx + 1; - glFace.VertexIndices[2] = vtxIdx + 2; + vertexIndices->push_back(glFace.VertexIndices[0]); + vertexIndices->push_back(glFace.VertexIndices[1]); + vertexIndices->push_back(glFace.VertexIndices[2]); - vertexIndices->push_back(glFace.VertexIndices[0]); - vertexIndices->push_back(glFace.VertexIndices[1]); - vertexIndices->push_back(glFace.VertexIndices[2]); + driverData->Faces->push_back(glFace); + } } - - driverData->Faces->push_back(glFace); + else + driverData->Faces->push_back(glFace); verticesStartIndex += vertexCount; } @@ -854,33 +858,41 @@ void GL_UpdateStateFromFace(GL_State& state, GL_VertexBufferFace& face, Scene3D* state.PrimitiveType = face.PrimitiveType; state.VertexAtrribs = face.Data; } -void GL_DrawBatchedScene3D(vector* vertexIndices, GLenum primitiveType) { +void GL_DrawBatchedScene3D(GL_VertexBuffer *driverData, vector* vertexIndices, GLenum primitiveType, bool remakeVtxIdxBuf) { size_t numIndices = vertexIndices->size(); size_t capacity = numIndices * GL_VertexIndexBufferStride; - if (GL_VertexIndexBuffer == nullptr) - GL_VertexIndexBuffer = (void*)Memory::Malloc(capacity); - else if (capacity > GL_VertexIndexBufferCapacity) - GL_VertexIndexBuffer = (void*)Memory::Realloc(GL_VertexIndexBuffer, capacity); - GL_VertexIndexBufferCapacity = capacity; - - if (GL_VertexIndexBufferFormat == GL_UNSIGNED_BYTE) { - Uint8* buf = (Uint8*)GL_VertexIndexBuffer; - for (size_t i = 0; i < numIndices; i++) - buf[i] = (*vertexIndices)[i]; - } - else if (GL_VertexIndexBufferFormat == GL_UNSIGNED_SHORT) { - Uint16* buf = (Uint16*)GL_VertexIndexBuffer; - for (size_t i = 0; i < numIndices; i++) - buf[i] = (*vertexIndices)[i]; + if (driverData->VertexIndexBuffer == nullptr) { + driverData->VertexIndexBuffer = (void*)Memory::Malloc(capacity); + remakeVtxIdxBuf = true; } - else { - Uint32* buf = (Uint32*)GL_VertexIndexBuffer; - for (size_t i = 0; i < numIndices; i++) - buf[i] = (*vertexIndices)[i]; + else if (capacity > driverData->VertexIndexBufferCapacity) { + driverData->VertexIndexBuffer = (void*)Memory::Realloc(driverData->VertexIndexBuffer, capacity); + remakeVtxIdxBuf = true; } - glDrawElements(primitiveType, numIndices, GL_VertexIndexBufferFormat, (const void *)GL_VertexIndexBuffer); CHECK_GL(); + driverData->VertexIndexBufferCapacity = capacity; + + // This can take enough time to matter with buffers that have a lot of vertices, so this is only done when needed. + if (remakeVtxIdxBuf) { + if (GL_VertexIndexBufferFormat == GL_UNSIGNED_BYTE) { + Uint8* buf = (Uint8*)driverData->VertexIndexBuffer; + for (size_t i = 0; i < numIndices; i++) + buf[i] = (*vertexIndices)[i]; + } + else if (GL_VertexIndexBufferFormat == GL_UNSIGNED_SHORT) { + Uint16* buf = (Uint16*)driverData->VertexIndexBuffer; + for (size_t i = 0; i < numIndices; i++) + buf[i] = (*vertexIndices)[i]; + } + else { + Uint32* buf = (Uint32*)driverData->VertexIndexBuffer; + for (size_t i = 0; i < numIndices; i++) + buf[i] = (*vertexIndices)[i]; + } + } + + glDrawElements(primitiveType, numIndices, GL_VertexIndexBufferFormat, (const void *)driverData->VertexIndexBuffer); CHECK_GL(); } PolygonRenderer* GL_GetPolygonRenderer() { if (!polyRenderer.SetBuffers()) @@ -915,10 +927,11 @@ PUBLIC STATIC void GLRenderer::Init() { } #endif - if (Application::Platform == Platforms::iOS) { - SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); - } + if (Application::Platform == Platforms::iOS) + SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0); + + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); Context = SDL_GL_CreateContext(Application::Window); CHECK_GL(); if (!Context) { @@ -982,6 +995,11 @@ PUBLIC STATIC void GLRenderer::Init() { glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); CHECK_GL(); #endif +#ifdef USE_USHORT_VTXBUFFER + GL_VertexIndexBufferFormat = GL_UNSIGNED_SHORT; + GL_VertexIndexBufferMaxElements = 0xFFFF; + GL_VertexIndexBufferStride = sizeof(Uint16); +#else if (Application::Platform == Platforms::iOS || Application::Platform == Platforms::Android) { GL_VertexIndexBufferFormat = GL_UNSIGNED_SHORT; GL_VertexIndexBufferMaxElements = 0xFFFF; @@ -992,6 +1010,7 @@ PUBLIC STATIC void GLRenderer::Init() { GL_VertexIndexBufferMaxElements = 0xFFFFFFFF; GL_VertexIndexBufferStride = sizeof(Uint32); } +#endif GL_MakeShaders(); GL_MakeShapeBuffers(); @@ -1570,7 +1589,7 @@ PUBLIC STATIC void GLRenderer::StrokeLine(float x1, float y1, float x2, floa glDrawArrays(GL_LINES, 0, 2); CHECK_GL(); // Graphics::Restore(); } -PUBLIC STATIC void GLRenderer::StrokeCircle(float x, float y, float rad) { +PUBLIC STATIC void GLRenderer::StrokeCircle(float x, float y, float rad, float thickness) { Graphics::Save(); Graphics::Translate(x, y, 0.0f); Graphics::Scale(rad, rad, 1.0f); @@ -1721,7 +1740,7 @@ PUBLIC STATIC void GLRenderer::DrawTexture(Texture* texture, float sx, float h *= RetinaScale; GL_DrawTexture(texture, sx, sy, sw, sh, x, y, w, h); } -PUBLIC STATIC void GLRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void GLRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; // /* @@ -1744,7 +1763,7 @@ PUBLIC STATIC void GLRenderer::DrawSprite(ISprite* sprite, int animation, in // x + fX * animframe.OffsetX, // y + fY * animframe.OffsetY, fX * sw, fY * sh); } -PUBLIC STATIC void GLRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void GLRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; AnimFrame animframe = sprite->Animations[animation].Frames[frame]; @@ -1824,6 +1843,9 @@ PUBLIC STATIC void GLRenderer::DrawVertexBuffer(Uint32 vertexBufferIndex, Ma GL_VertexBuffer* driverData = (GL_VertexBuffer*)vertexBuffer->DriverData; driverData->Changed = true; + + driverData = (GL_VertexBuffer*)scene->Buffer->DriverData; + driverData->Changed = true; } PUBLIC STATIC void GLRenderer::BindVertexBuffer(Uint32 vertexBufferIndex) { @@ -1852,10 +1874,12 @@ PUBLIC STATIC void GLRenderer::DrawScene3D(Uint32 sceneIndex, Uint32 drawMod GL_VertexBuffer *driverData = (GL_VertexBuffer*)vertexBuffer->DriverData; bool useBatching = true; + bool remakeVtxIdxBuf = false; bool driverDataChanged = driverData->Changed; if (driverDataChanged) { GL_UpdateVertexBuffer(scene, vertexBuffer, drawMode, useBatching); driverData->Changed = false; + remakeVtxIdxBuf = true; } size_t numFaces = driverData->Faces->size(); @@ -1916,7 +1940,7 @@ PUBLIC STATIC void GLRenderer::DrawScene3D(Uint32 sceneIndex, Uint32 drawMod size_t numBatches = driverData->VertexIndexList.size(); for (size_t i = 0; i < numBatches; i++) { GL_SetVertexAttribPointers((*driverData->Entries)[i]); - GL_DrawBatchedScene3D(driverData->VertexIndexList[i], state.PrimitiveType); + GL_DrawBatchedScene3D(driverData, driverData->VertexIndexList[i], state.PrimitiveType, remakeVtxIdxBuf); PERF_DRAW_CALL(perf); } } @@ -1950,7 +1974,7 @@ PUBLIC STATIC void GLRenderer::DrawScene3D(Uint32 sceneIndex, Uint32 drawMod // Draw the current batch, then start the next if (batch.ShouldDraw) { - GL_DrawBatchedScene3D(&batch.VertexIndices, lastState.PrimitiveType); + GL_DrawBatchedScene3D(driverData, &batch.VertexIndices, lastState.PrimitiveType, true); PERF_DRAW_CALL(perf); batch.VertexIndices.clear(); didDraw = true; @@ -1985,7 +2009,7 @@ PUBLIC STATIC void GLRenderer::DrawScene3D(Uint32 sceneIndex, Uint32 drawMod // Draw the last remaining batch if (batch.ShouldDraw) { GL_SetState(state, driverData, &projMat, &viewMat); - GL_DrawBatchedScene3D(&batch.VertexIndices, state.PrimitiveType); + GL_DrawBatchedScene3D(driverData, &batch.VertexIndices, state.PrimitiveType, true); PERF_STATE_CHANGE(perf); PERF_DRAW_CALL(perf); } @@ -2042,6 +2066,8 @@ PUBLIC STATIC void GLRenderer::DeleteVertexBuffer(void* vtxBuf) { delete driverData->VertexIndexList[i]; for (size_t e = 0; e < driverData->Entries->size(); e++) Memory::Free((*driverData->Entries)[e]); + if (driverData->VertexIndexBuffer) + Memory::Free(driverData->VertexIndexBuffer); delete driverData->Entries; delete driverData->Faces; diff --git a/source/Engine/Rendering/GraphicsFunctions.h b/source/Engine/Rendering/GraphicsFunctions.h index c3f79306..c0a31dfe 100644 --- a/source/Engine/Rendering/GraphicsFunctions.h +++ b/source/Engine/Rendering/GraphicsFunctions.h @@ -47,7 +47,7 @@ struct GraphicsFunctions { void (*SetLineWidth)(float n); void (*StrokeLine)(float x1, float y1, float x2, float y2); - void (*StrokeCircle)(float x, float y, float rad); + void (*StrokeCircle)(float x, float y, float rad, float thickness); void (*StrokeEllipse)(float x, float y, float w, float h); void (*StrokeRectangle)(float x, float y, float w, float h); void (*FillCircle)(float x, float y, float rad); @@ -56,8 +56,8 @@ struct GraphicsFunctions { void (*FillRectangle)(float x, float y, float w, float h); void (*DrawTexture)(Texture* texture, float sx, float sy, float sw, float sh, float x, float y, float w, float h); - void (*DrawSprite)(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation); - void (*DrawSpritePart)(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation); + void (*DrawSprite)(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID); + void (*DrawSpritePart)(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID); void (*DrawPolygon3D)(void* data, int vertexCount, int vertexFlag, Texture* texture, Matrix4x4* modelMatrix, Matrix4x4* normalMatrix); void (*DrawSceneLayer3D)(void* layer, int sx, int sy, int sw, int sh, Matrix4x4* modelMatrix, Matrix4x4* normalMatrix); diff --git a/source/Engine/Rendering/Material.cpp b/source/Engine/Rendering/Material.cpp index 1b7cb4a1..522ba883 100644 --- a/source/Engine/Rendering/Material.cpp +++ b/source/Engine/Rendering/Material.cpp @@ -4,44 +4,54 @@ class Material { public: - float Diffuse[4]; - float Specular[4]; - float Ambient[4]; - float Emissive[4]; - - float Shininess; - float ShininessStrength; - float Opacity; - float IndexOfRefraction; - - Image* ImagePtr; + char* Name = nullptr; + + float ColorDiffuse[4]; + float ColorSpecular[4]; + float ColorAmbient[4]; + float ColorEmissive[4]; + + float Shininess = 0.0f; + float ShininessStrength = 1.0f; + float Opacity = 1.0f; + + char* TextureDiffuseName = nullptr; + char* TextureSpecularName = nullptr; + char* TextureAmbientName = nullptr; + char* TextureEmissiveName = nullptr; + + Image* TextureDiffuse = nullptr; + Image* TextureSpecular = nullptr; + Image* TextureAmbient = nullptr; + Image* TextureEmissive = nullptr; }; #endif #include +#include + PUBLIC Material::Material() { - for (int i = 0; i < 3; i++) { - Diffuse[i] = - Specular[i] = - Ambient[i] = - Emissive[i] = 0.0f; + for (int i = 0; i < 4; i++) { + ColorDiffuse[i] = + ColorSpecular[i] = + ColorAmbient[i] = + ColorEmissive[i] = 1.0f; } - - Diffuse[3] = - Specular[3] = - Ambient[3] = - Emissive[3] = 1.0f; - - Shininess = 0.0f; - ShininessStrength = 1.0f; - Opacity = 1.0f; - - ImagePtr = nullptr; } PUBLIC void Material::Dispose() { - delete ImagePtr; + delete TextureDiffuse; + delete TextureSpecular; + delete TextureAmbient; + delete TextureEmissive; + + Memory::Free(Name); + + Memory::Free(TextureDiffuseName); + Memory::Free(TextureSpecularName); + Memory::Free(TextureAmbientName); + Memory::Free(TextureEmissiveName); } PUBLIC Material::~Material() { diff --git a/source/Engine/Rendering/Mesh.h b/source/Engine/Rendering/Mesh.h index 0fc1e74a..4cb83302 100644 --- a/source/Engine/Rendering/Mesh.h +++ b/source/Engine/Rendering/Mesh.h @@ -107,20 +107,20 @@ struct NodeAnim { } }; -struct ModelAnim { - char* Name; +struct ModelAnim; + +struct SkeletalAnim { + ModelAnim* ParentAnim; vector Channels; HashMap* NodeLookup; - Uint32 Length; Uint32 DurationInFrames; + double BaseDuration; double TicksPerSecond; - ~ModelAnim() { - Memory::Free(Name); - + ~SkeletalAnim() { for (size_t i = 0; i < Channels.size(); i++) delete Channels[i]; @@ -128,6 +128,21 @@ struct ModelAnim { } }; +struct ModelAnim { + char* Name = nullptr; + + Uint32 StartFrame = 0; + Uint32 Length = 0; + + SkeletalAnim* Skeletal = nullptr; + + ~ModelAnim() { + Memory::Free(Name); + + delete Skeletal; + } +}; + struct Skeleton { MeshBone** Bones; size_t NumBones; @@ -288,17 +303,23 @@ struct Mesh { Vector2* UVBuffer; Uint32* ColorBuffer; - size_t NumVertices; + Uint32 VertexCount; - Sint16* VertexIndexBuffer; - Uint16 VertexIndexCount; + // For vertex animation + Uint32 FrameCount; + Vector3* InbetweenPositions; + Vector3* InbetweenNormals; + + Sint32* VertexIndexBuffer; + Uint32 VertexIndexCount; Uint8 VertexFlag; int MaterialIndex; int SkeletonIndex; Mesh() { - NumVertices = 0; + VertexCount = 0; + FrameCount = 0; VertexFlag = 0; MaterialIndex = -1; SkeletonIndex = -1; @@ -306,6 +327,8 @@ struct Mesh { NormalBuffer = nullptr; UVBuffer = nullptr; ColorBuffer = nullptr; + InbetweenPositions = nullptr; + InbetweenNormals = nullptr; Name = nullptr; }; @@ -316,6 +339,8 @@ struct Mesh { Memory::Free(UVBuffer); Memory::Free(ColorBuffer); Memory::Free(VertexIndexBuffer); + Memory::Free(InbetweenPositions); + Memory::Free(InbetweenNormals); } }; diff --git a/source/Engine/Rendering/ModelRenderer.cpp b/source/Engine/Rendering/ModelRenderer.cpp index c5aebe9e..cf183117 100644 --- a/source/Engine/Rendering/ModelRenderer.cpp +++ b/source/Engine/Rendering/ModelRenderer.cpp @@ -115,9 +115,38 @@ PRIVATE int ModelRenderer::ClipFace(int faceVertexCount) { } PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skeleton, Matrix4x4& mvpMatrix) { + Vector3* positionBuffer = mesh->PositionBuffer; + Vector3* normalBuffer = mesh->NormalBuffer; + Vector2* uvBuffer = mesh->UVBuffer; + + if (skeleton) { + positionBuffer = skeleton->TransformedPositions; + normalBuffer = skeleton->TransformedNormals; + } + + DrawMesh(model, mesh, positionBuffer, normalBuffer, uvBuffer, mvpMatrix); +} + +PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Uint16 animation, Uint32 frame, Matrix4x4& mvpMatrix) { + Vector3* positionBuffer = mesh->PositionBuffer; + Vector3* normalBuffer = mesh->NormalBuffer; + Vector2* uvBuffer = mesh->UVBuffer; + + if (model->UseVertexAnimation) { + ModelAnim* anim = nullptr; + if (animation < model->AnimationCount) + anim = model->Animations[animation]; + + model->DoVertexFrameInterpolation(mesh, anim, frame, &positionBuffer, &normalBuffer, &uvBuffer); + } + + DrawMesh(model, mesh, positionBuffer, normalBuffer, uvBuffer, mvpMatrix); +} + +PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Vector3* positionBuffer, Vector3* normalBuffer, Vector2* uvBuffer, Matrix4x4& mvpMatrix) { Material* material = mesh->MaterialIndex != -1 ? model->Materials[mesh->MaterialIndex] : nullptr; - Sint16* modelVertexIndexPtr = mesh->VertexIndexBuffer; + Sint32* modelVertexIndexPtr = mesh->VertexIndexBuffer; int vertexTypeMask = VertexType_Position | VertexType_Normal | VertexType_Color | VertexType_UV; int color = CurrentColor; @@ -127,14 +156,6 @@ PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skelet Uint32* colorPtr; Vector2* uvPtr; - Vector3* positionBuffer = mesh->PositionBuffer; - Vector3* normalBuffer = mesh->NormalBuffer; - - if (skeleton) { - positionBuffer = skeleton->TransformedPositions; - normalBuffer = skeleton->TransformedNormals; - } - switch (mesh->VertexFlag & vertexTypeMask) { case VertexType_Position: // For every face, @@ -259,7 +280,7 @@ PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skelet while (numVertices--) { positionPtr = &positionBuffer[*modelVertexIndexPtr]; normalPtr = &normalBuffer[*modelVertexIndexPtr]; - uvPtr = &mesh->UVBuffer[*modelVertexIndexPtr]; + uvPtr = &uvBuffer[*modelVertexIndexPtr]; APPLY_MAT4X4(Vertex->Position, positionPtr[0], mvpMatrix.Values); APPLY_MAT4X4(Vertex->Normal, normalPtr[0], NormalMatrix->Values); Vertex->Color = color; @@ -282,7 +303,7 @@ PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skelet while (numVertices--) { positionPtr = &positionBuffer[*modelVertexIndexPtr]; normalPtr = &normalBuffer[*modelVertexIndexPtr]; - uvPtr = &mesh->UVBuffer[*modelVertexIndexPtr]; + uvPtr = &uvBuffer[*modelVertexIndexPtr]; APPLY_MAT4X4(Vertex->Position, positionPtr[0], mvpMatrix.Values); COPY_NORMAL(Vertex->Normal, normalPtr[0]); Vertex->Color = color; @@ -307,7 +328,7 @@ PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skelet while (numVertices--) { positionPtr = &positionBuffer[*modelVertexIndexPtr]; normalPtr = &normalBuffer[*modelVertexIndexPtr]; - uvPtr = &mesh->UVBuffer[*modelVertexIndexPtr]; + uvPtr = &uvBuffer[*modelVertexIndexPtr]; colorPtr = &mesh->ColorBuffer[*modelVertexIndexPtr]; APPLY_MAT4X4(Vertex->Position, positionPtr[0], mvpMatrix.Values); APPLY_MAT4X4(Vertex->Normal, normalPtr[0], NormalMatrix->Values); @@ -331,7 +352,7 @@ PRIVATE void ModelRenderer::DrawMesh(IModel* model, Mesh* mesh, Skeleton* skelet while (numVertices--) { positionPtr = &positionBuffer[*modelVertexIndexPtr]; normalPtr = &normalBuffer[*modelVertexIndexPtr]; - uvPtr = &mesh->UVBuffer[*modelVertexIndexPtr]; + uvPtr = &uvBuffer[*modelVertexIndexPtr]; colorPtr = &mesh->ColorBuffer[*modelVertexIndexPtr]; APPLY_MAT4X4(Vertex->Position, positionPtr[0], mvpMatrix.Values); COPY_NORMAL(Vertex->Normal, normalPtr[0]); @@ -382,7 +403,7 @@ PRIVATE void ModelRenderer::DrawNode(IModel* model, ModelNode* node, Matrix4x4* DrawNode(model, node->Children[i], world); } -PUBLIC void ModelRenderer::DrawModel(IModel* model, Uint32 frame) { +PRIVATE void ModelRenderer::DrawModelInternal(IModel* model, Uint16 animation, Uint32 frame) { if (DoProjection) Graphics::CalculateMVPMatrix(&MVPMatrix, ModelMatrix, ViewMatrix, ProjectionMatrix); else @@ -395,39 +416,28 @@ PUBLIC void ModelRenderer::DrawModel(IModel* model, Uint32 frame) { DrawNode(model, model->BaseArmature->RootNode, &identity); } else { - static Skeleton vertexAnimSkeleton; - - frame = model->GetKeyFrame(frame) % model->FrameCount; - // Just render every mesh directly - for (size_t i = 0; i < model->MeshCount; i++) { - Mesh* mesh = model->Meshes[i]; - - Skeleton *skeletonPtr = nullptr; - if (frame) { - skeletonPtr = &vertexAnimSkeleton; - skeletonPtr->TransformedPositions = mesh->PositionBuffer + (frame * model->VertexCount); - skeletonPtr->TransformedNormals = mesh->NormalBuffer + (frame * model->VertexCount); - } - - DrawMesh(model, mesh, skeletonPtr, MVPMatrix); - } + for (size_t i = 0; i < model->MeshCount; i++) + DrawMesh(model, model->Meshes[i], animation, frame, MVPMatrix); } } PUBLIC void ModelRenderer::DrawModel(IModel* model, Uint16 animation, Uint32 frame) { + Uint16 numAnims = model->AnimationCount; + if (numAnims > 0) { + if (animation >= numAnims) + animation = numAnims - 1; + } + else + animation = 0; + if (!model->UseVertexAnimation) { if (ArmaturePtr == nullptr) ArmaturePtr = model->BaseArmature; - Uint16 numAnims = model->AnimationCount; - if (numAnims > 0) { - if (animation >= numAnims) - animation = numAnims - 1; - + if (numAnims > 0) model->Animate(ArmaturePtr, model->Animations[animation], frame); - } } - DrawModel(model, frame); + DrawModelInternal(model, animation, frame); } diff --git a/source/Engine/Rendering/PolygonRenderer.cpp b/source/Engine/Rendering/PolygonRenderer.cpp index 8f53b518..2014b164 100644 --- a/source/Engine/Rendering/PolygonRenderer.cpp +++ b/source/Engine/Rendering/PolygonRenderer.cpp @@ -382,7 +382,7 @@ PUBLIC void PolygonRenderer::DrawModelSkinned(IModel* model, Uint16 armature) { rend.ClipFaces = DoProjection; rend.ArmaturePtr = model->ArmatureList[armature]; rend.SetMatrices(ModelMatrix, ViewMatrix, ProjectionMatrix, NormalMatrix); - rend.DrawModel(model, 0); + rend.DrawModel(model, 0, 0); } PUBLIC void PolygonRenderer::DrawVertexBuffer() { Matrix4x4 mvpMatrix; diff --git a/source/Engine/Rendering/SDL2/SDL2Renderer.cpp b/source/Engine/Rendering/SDL2/SDL2Renderer.cpp index e36c1acf..55262179 100644 --- a/source/Engine/Rendering/SDL2/SDL2Renderer.cpp +++ b/source/Engine/Rendering/SDL2/SDL2Renderer.cpp @@ -346,7 +346,7 @@ PUBLIC STATIC void SDL2Renderer::SetLineWidth(float n) { PUBLIC STATIC void SDL2Renderer::StrokeLine(float x1, float y1, float x2, float y2) { } -PUBLIC STATIC void SDL2Renderer::StrokeCircle(float x, float y, float rad) { +PUBLIC STATIC void SDL2Renderer::StrokeCircle(float x, float y, float rad, float thickness) { } PUBLIC STATIC void SDL2Renderer::StrokeEllipse(float x, float y, float w, float h) { @@ -397,7 +397,7 @@ PUBLIC STATIC void SDL2Renderer::DrawTexture(Texture* texture, float sx, flo } SDL_RenderCopyEx(Renderer, *textureData, &src, &dst, 0.0, NULL, (SDL_RendererFlip)flip); } -PUBLIC STATIC void SDL2Renderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void SDL2Renderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; AnimFrame animframe = sprite->Animations[animation].Frames[frame]; @@ -411,7 +411,7 @@ PUBLIC STATIC void SDL2Renderer::DrawSprite(ISprite* sprite, int animation, x + fX * animframe.OffsetX, y + fY * animframe.OffsetY, fX * sw, fY * sh); } -PUBLIC STATIC void SDL2Renderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void SDL2Renderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; AnimFrame animframe = sprite->Animations[animation].Frames[frame]; diff --git a/source/Engine/Rendering/Software/PolygonRasterizer.cpp b/source/Engine/Rendering/Software/PolygonRasterizer.cpp index 75b3bfc5..3169fc79 100644 --- a/source/Engine/Rendering/Software/PolygonRasterizer.cpp +++ b/source/Engine/Rendering/Software/PolygonRasterizer.cpp @@ -211,6 +211,9 @@ static void GetPolygonBounds(T* positions, int count, int& minVal, int& maxVal) // Draws a polygon PUBLIC STATIC void PolygonRasterizer::DrawBasic(Vector2* positions, Uint32 color, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -247,7 +250,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawBasic(Vector2* positions, Uint32 color int* multTableAt = &SoftwareRenderer::MultTable[opacity << 8]; int* multSubTableAt = &SoftwareRenderer::MultSubTable[opacity << 8]; int dst_strideY = dst_y1 * dstStride; - if (!SoftwareRenderer::IsStencilEnabled() && (blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT) == BlendFlag_OPAQUE)) { + if (!SoftwareRenderer::IsStencilEnabled() && ((blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT)) == BlendFlag_OPAQUE)) { for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { Contour contour = ContourField[dst_y]; if (contour.MaxX < contour.MinX) { @@ -275,6 +278,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawBasic(Vector2* positions, Uint32 color } // Draws a blended polygon PUBLIC STATIC void PolygonRasterizer::DrawBasicBlend(Vector2* positions, int* colors, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -340,6 +346,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawBasicBlend(Vector2* positions, int* co } // Draws a polygon with lighting PUBLIC STATIC void PolygonRasterizer::DrawShaded(Vector3* positions, Uint32 color, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -435,6 +444,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawShaded(Vector3* positions, Uint32 colo } // Draws a blended polygon with lighting PUBLIC STATIC void PolygonRasterizer::DrawBlendShaded(Vector3* positions, int* colors, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -525,6 +537,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendShaded(Vector3* positions, int* c } // Draws an affine texture mapped polygon PUBLIC STATIC void PolygonRasterizer::DrawAffine(Texture* texture, Vector3* positions, Vector2* uvs, Uint32 color, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; Uint32* srcPx = (Uint32*)texture->Pixels; @@ -581,7 +596,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawAffine(Texture* texture, Vector3* posi } #define DRAW_PLACEPIXEL_PAL(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ col = DoColorTint(color, index[texCol]); \ SCANLINE_WRITE_PIXEL(col); \ dpW(iz); \ @@ -596,7 +611,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawAffine(Texture* texture, Vector3* posi } #define DRAW_PLACEPIXEL_PAL_FOG(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ col = DoColorTint(color, index[texCol]); \ col = DoFogLighting(col, mapZ); \ SCANLINE_WRITE_PIXEL(col); \ @@ -620,7 +635,10 @@ PUBLIC STATIC void PolygonRasterizer::DrawAffine(Texture* texture, Vector3* posi } \ if (contour.MaxX > max_x) \ contour.MaxX = max_x; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + else \ + index = &Graphics::PaletteColors[0][0]; \ for (int dst_x = contour.MinX; dst_x < contour.MaxX; dst_x++) { \ SCANLINE_GET_MAPZ(); \ SCANLINE_GET_INVZ(); \ @@ -655,6 +673,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawAffine(Texture* texture, Vector3* posi } // Draws an affine texture mapped polygon with blending PUBLIC STATIC void PolygonRasterizer::DrawBlendAffine(Texture* texture, Vector3* positions, Vector2* uvs, int* colors, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; Uint32* srcPx = (Uint32*)texture->Pixels; @@ -714,7 +735,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendAffine(Texture* texture, Vector3* } #define DRAW_PLACEPIXEL_PAL(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ SCANLINE_GET_COLOR(); \ col = DoColorTint(col, index[texCol]); \ SCANLINE_WRITE_PIXEL(col); \ @@ -731,7 +752,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendAffine(Texture* texture, Vector3* } #define DRAW_PLACEPIXEL_PAL_FOG(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ SCANLINE_GET_COLOR(); \ col = DoColorTint(col, index[texCol]); \ col = DoFogLighting(col, mapZ); \ @@ -758,7 +779,10 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendAffine(Texture* texture, Vector3* } \ if (contour.MaxX > max_x) \ contour.MaxX = max_x; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + else \ + index = &Graphics::PaletteColors[0][0]; \ for (int dst_x = contour.MinX; dst_x < contour.MaxX; dst_x++) { \ SCANLINE_GET_MAPZ(); \ SCANLINE_GET_INVZ(); \ @@ -867,6 +891,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendAffine(Texture* texture, Vector3* } #endif PUBLIC STATIC void PolygonRasterizer::DrawPerspective(Texture* texture, Vector3* positions, Vector2* uvs, Uint32 color, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; Uint32* srcPx = (Uint32*)texture->Pixels; @@ -913,7 +940,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawPerspective(Texture* texture, Vector3* } #define DRAW_PLACEPIXEL_PAL(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ col = DoColorTint(color, index[texCol]); \ SCANLINE_WRITE_PIXEL(col); \ dpW(iz); \ @@ -928,7 +955,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawPerspective(Texture* texture, Vector3* } #define DRAW_PLACEPIXEL_PAL_FOG(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ col = DoColorTint(color, index[texCol]); \ col = DoFogLighting(col, mapZ); \ SCANLINE_WRITE_PIXEL(col); \ @@ -956,7 +983,10 @@ PUBLIC STATIC void PolygonRasterizer::DrawPerspective(Texture* texture, Vector3* SCANLINE_STEP_Z_BY(diff); \ SCANLINE_STEP_UV_BY(diff); \ } \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + else \ + index = &Graphics::PaletteColors[0][0]; \ DO_PERSP_MAPPING(placePixelMacro, dpR, dpW); \ dst_strideY += dstStride; \ } @@ -983,6 +1013,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawPerspective(Texture* texture, Vector3* } // Draws a perspective-correct texture mapped polygon with blending PUBLIC STATIC void PolygonRasterizer::DrawBlendPerspective(Texture* texture, Vector3* positions, Vector2* uvs, int* colors, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; Uint32* srcPx = (Uint32*)texture->Pixels; @@ -1032,7 +1065,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendPerspective(Texture* texture, Vec } #define DRAW_PLACEPIXEL_PAL(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ SCANLINE_GET_COLOR(); \ col = DoColorTint(col, index[texCol]); \ SCANLINE_WRITE_PIXEL(col); \ @@ -1049,7 +1082,7 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendPerspective(Texture* texture, Vec } #define DRAW_PLACEPIXEL_PAL_FOG(dpW) \ - if ((texCol = srcPx[(texV * srcStride) + texU])) { \ + if ((texCol = srcPx[(texV * srcStride) + texU]) && (index[texCol] & 0xFF000000U)) { \ SCANLINE_GET_COLOR(); \ col = DoColorTint(col, index[texCol]); \ col = DoFogLighting(col, mapZ); \ @@ -1081,7 +1114,10 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendPerspective(Texture* texture, Vec SCANLINE_STEP_RGB_BY(diff); \ SCANLINE_STEP_UV_BY(diff); \ } \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + else \ + index = &Graphics::PaletteColors[0][0]; \ DO_PERSP_MAPPING(placePixelMacro, dpR, dpW); \ dst_strideY += dstStride; \ } @@ -1108,6 +1144,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawBlendPerspective(Texture* texture, Vec } // Draws a polygon with depth testing PUBLIC STATIC void PolygonRasterizer::DrawDepth(Vector3* positions, Uint32 color, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -1199,6 +1238,9 @@ PUBLIC STATIC void PolygonRasterizer::DrawDepth(Vector3* positions, Uint32 color } // Draws a blended polygon with depth testing PUBLIC STATIC void PolygonRasterizer::DrawBlendDepth(Vector3* positions, int* colors, int count, BlendState blendState) { + if (!Graphics::CurrentRenderTarget) + return; + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; diff --git a/source/Engine/Rendering/Software/SoftwareRenderer.cpp b/source/Engine/Rendering/Software/SoftwareRenderer.cpp index f76c4fe1..4a2ca85a 100644 --- a/source/Engine/Rendering/Software/SoftwareRenderer.cpp +++ b/source/Engine/Rendering/Software/SoftwareRenderer.cpp @@ -700,10 +700,14 @@ static void StencilOpReplace(Uint8* buf, Uint8 value) { *buf = value; } static void StencilOpIncrWrap(Uint8* buf, Uint8 value) { - *buf++; + value = *buf; + value++; + *buf = value; } static void StencilOpDecrWrap(Uint8* buf, Uint8 value) { - *buf--; + value = *buf; + value--; + *buf = value; } // Stencil buffer funcs @@ -1539,7 +1543,7 @@ PUBLIC STATIC void SoftwareRenderer::StrokeLine(float x1, float y1, float x2 DoLineStrokeBounded(dst_x1, dst_y1, dst_x2, dst_y2, minX, maxX, minY, maxY, pixelFunction, ColRGB, blendState, multTableAt, multSubTableAt, dstPx, dstStride); } -PUBLIC STATIC void SoftwareRenderer::StrokeCircle(float x, float y, float rad) { +PUBLIC STATIC void SoftwareRenderer::StrokeCircle(float x, float y, float rad, float thickness) { Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; Uint32 dstStride = Graphics::CurrentRenderTarget->Width; @@ -1547,6 +1551,11 @@ PUBLIC STATIC void SoftwareRenderer::StrokeCircle(float x, float y, float ra if (!currentView) return; + if (thickness > 1.0) { + StrokeThickCircle(x, y, rad, thickness); + return; + } + int cx = (int)std::floor(currentView->X); int cy = (int)std::floor(currentView->Y); @@ -1625,7 +1634,199 @@ PUBLIC STATIC void SoftwareRenderer::StrokeCircle(float x, float y, float ra bx++; } - #undef DRAW_POINT +#undef DRAW_POINT +} +PRIVATE STATIC void SoftwareRenderer::InitContour(Contour *contourBuffer, int dst_y1, int scanLineCount) { + Contour* contourPtr = &contourBuffer[dst_y1]; + while (scanLineCount--) { + contourPtr->MinX = 0x7FFFFFFF; + contourPtr->MaxX = -1; + contourPtr++; + } +} +PRIVATE STATIC void SoftwareRenderer::RasterizeCircle(int ccx, int ccy, int dst_x1, int dst_y1, int dst_x2, int dst_y2, float rad, Contour *contourBuffer) { + #define SEEK_MIN(our_x, our_y) if (our_y >= dst_y1 && our_y < dst_y2 && our_x < (cont = &contourBuffer[our_y])->MinX) \ + cont->MinX = our_x < dst_x1 ? dst_x1 : our_x > (dst_x2 - 1) ? dst_x2 - 1 : our_x; + #define SEEK_MAX(our_x, our_y) if (our_y >= dst_y1 && our_y < dst_y2 && our_x > (cont = &contourBuffer[our_y])->MaxX) \ + cont->MaxX = our_x < dst_x1 ? dst_x1 : our_x > (dst_x2 - 1) ? dst_x2 - 1 : our_x; + + Contour* cont; + int bx = 0, by = rad; + int bd = 3 - 2 * rad; + while (bx <= by) { + SEEK_MAX(ccx + bx, ccy - by); + SEEK_MIN(ccx - bx, ccy - by); + SEEK_MAX(ccx + by, ccy - bx); + SEEK_MIN(ccx - by, ccy - bx); + ccy--; + SEEK_MAX(ccx + bx, ccy + by); + SEEK_MIN(ccx - bx, ccy + by); + SEEK_MAX(ccx + by, ccy + bx); + SEEK_MIN(ccx - by, ccy + bx); + ccy++; + if (bd <= 0) { + bd += 4 * bx + 6; + } + else { + bd += 4 * (bx - by) + 10; + by--; + } + bx++; + } + +#undef SEEK_MIN +#undef SEEK_MAX +} +PRIVATE STATIC void SoftwareRenderer::StrokeThickCircle(float x, float y, float rad, float thickness) { + Uint32* dstPx = (Uint32*)Graphics::CurrentRenderTarget->Pixels; + Uint32 dstStride = Graphics::CurrentRenderTarget->Width; + + View* currentView = Graphics::CurrentView; + if (!currentView) + return; + + float radA = rad + (thickness * 0.5); + float radB = radA - thickness; + if (radB <= 0.0) { + SoftwareRenderer::FillCircle(x, y, rad); + return; + } + + rad = radA; + + int cx = (int)std::floor(currentView->X); + int cy = (int)std::floor(currentView->Y); + + Matrix4x4* out = Graphics::ModelViewMatrix; + x += out->Values[12]; + y += out->Values[13]; + x -= cx; + y -= cy; + + int dst_x1 = x - rad - 1; + int dst_y1 = y - rad - 1; + int dst_x2 = x + rad + 1; + int dst_y2 = y + rad + 1; + + int clip_x1, clip_y1, clip_x2, clip_y2; + GetClipRegion(clip_x1, clip_y1, clip_x2, clip_y2); + if (!CheckClipRegion(clip_x1, clip_y1, clip_x2, clip_y2)) + return; + + if (dst_x1 < clip_x1) + dst_x1 = clip_x1; + if (dst_y1 < clip_y1) + dst_y1 = clip_y1; + if (dst_x2 > clip_x2) + dst_x2 = clip_x2; + if (dst_y2 > clip_y2) + dst_y2 = clip_y2; + + if (dst_x2 < 0 || dst_y2 < 0 || dst_x1 >= dst_x2 || dst_y1 >= dst_y2) + return; + + int in_dst_x1 = x - radB - 1; + int in_dst_y1 = y - radB - 1; + int in_dst_x2 = x + radB + 1; + int in_dst_y2 = y + radB + 1; + + if (in_dst_x1 < clip_x1) + in_dst_x1 = clip_x1; + if (in_dst_y1 < clip_y1) + in_dst_y1 = clip_y1; + if (in_dst_x2 > clip_x2) + in_dst_x2 = clip_x2; + if (in_dst_y2 > clip_y2) + in_dst_y2 = clip_y2; + + if (in_dst_x2 < 0 || in_dst_y2 < 0 || in_dst_x1 >= dst_x2 || in_dst_y1 >= dst_y2) + return; + + BlendState blendState = GetBlendState(); + if (!AlterBlendState(blendState)) + return; + + int blendFlag = blendState.Mode; + int opacity = blendState.Opacity; + + Contour* contourBufferA = ContourBuffer; + Contour contourBufferB[MAX_FRAMEBUFFER_HEIGHT]; + + InitContour(contourBufferA, dst_y1, dst_y2 - dst_y1 + 1); + InitContour(contourBufferB, in_dst_y1, in_dst_y2 - in_dst_y1 + 1); + + if (blendFlag & (BlendFlag_TINT_BIT | BlendFlag_FILTER_BIT)) + SetTintFunction(blendFlag); + + int* multTableAt = &MultTable[opacity << 8]; + int* multSubTableAt = &MultSubTable[opacity << 8]; + + Uint32 col = ColRGB; + + RasterizeCircle(x, y, dst_x1, dst_y1, dst_x2, dst_y2, rad, contourBufferA); + RasterizeCircle(x, y, in_dst_x1, in_dst_y1, in_dst_x2, in_dst_y2, radB, contourBufferB); + + int dst_strideY = dst_y1 * dstStride; + + if (!UseStencil && ((blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT)) == BlendFlag_OPAQUE)) { + for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++, dst_strideY += dstStride) { + Contour contourA = contourBufferA[dst_y]; + if (contourA.MaxX < contourA.MinX) + continue; + + if (dst_y <= in_dst_y1 || dst_y >= in_dst_y2-1) { + Memory::Memset4(&dstPx[contourA.MinX + dst_strideY], col, contourA.MaxX - contourA.MinX); + continue; + } + + Contour contourB = contourBufferB[dst_y]; + if (contourB.MinX == 0x7FFFFFFF) + contourB.MinX = 0; + else if (contourB.MinX < contourA.MinX) + continue; + if (contourB.MaxX == -1) + contourB.MaxX = dst_x2; + else if (contourB.MaxX >= contourA.MaxX) + continue; + if (contourB.MaxX < contourB.MinX) + continue; + + Memory::Memset4(&dstPx[contourA.MinX + dst_strideY], col, contourB.MinX - contourA.MinX); + Memory::Memset4(&dstPx[contourB.MaxX + dst_strideY], col, contourA.MaxX - contourB.MaxX); + } + } + else { + PixelFunction pixelFunction = GetPixelFunction(blendFlag); + + for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++, dst_strideY += dstStride) { + Contour contourA = contourBufferA[dst_y]; + if (contourA.MaxX < contourA.MinX) + continue; + + if (dst_y <= in_dst_y1 || dst_y >= in_dst_y2-1) { + for (int dst_x = contourA.MinX; dst_x < contourA.MaxX; dst_x++) + pixelFunction((Uint32*)&col, &dstPx[dst_x + dst_strideY], blendState, multTableAt, multSubTableAt); + continue; + } + + Contour contourB = contourBufferB[dst_y]; + if (contourB.MinX == 0x7FFFFFFF) + contourB.MinX = 0; + else if (contourB.MinX < contourA.MinX) + continue; + if (contourB.MaxX == -1) + contourB.MaxX = dst_x2; + else if (contourB.MaxX >= contourA.MaxX) + continue; + if (contourB.MaxX < contourB.MinX) + continue; + + for (int dst_x = contourA.MinX; dst_x < contourB.MinX; dst_x++) + pixelFunction((Uint32*)&col, &dstPx[dst_x + dst_strideY], blendState, multTableAt, multSubTableAt); + for (int dst_x = contourB.MaxX; dst_x < contourA.MaxX; dst_x++) + pixelFunction((Uint32*)&col, &dstPx[dst_x + dst_strideY], blendState, multTableAt, multSubTableAt); + } + } } PUBLIC STATIC void SoftwareRenderer::StrokeEllipse(float x, float y, float w, float h) { @@ -1746,43 +1947,14 @@ PUBLIC STATIC void SoftwareRenderer::FillCircle(float x, float y, float rad) int blendFlag = blendState.Mode; int opacity = blendState.Opacity; - int scanLineCount = dst_y2 - dst_y1 + 1; - Contour* contourPtr = &ContourBuffer[dst_y1]; - while (scanLineCount--) { - contourPtr->MinX = 0x7FFFFFFF; - contourPtr->MaxX = -1; - contourPtr++; - } + InitContour(ContourBuffer, dst_y1, dst_y2 - dst_y1 + 1); #define SEEK_MIN(our_x, our_y) if (our_y >= dst_y1 && our_y < dst_y2 && our_x < (cont = &ContourBuffer[our_y])->MinX) \ cont->MinX = our_x < dst_x1 ? dst_x1 : our_x > (dst_x2 - 1) ? dst_x2 - 1 : our_x; #define SEEK_MAX(our_x, our_y) if (our_y >= dst_y1 && our_y < dst_y2 && our_x > (cont = &ContourBuffer[our_y])->MaxX) \ cont->MaxX = our_x < dst_x1 ? dst_x1 : our_x > (dst_x2 - 1) ? dst_x2 - 1 : our_x; - Contour* cont; - int ccx = x, ccy = y; - int bx = 0, by = rad; - int bd = 3 - 2 * rad; - while (bx <= by) { - SEEK_MAX(ccx + bx, ccy - by); - SEEK_MIN(ccx - bx, ccy - by); - SEEK_MAX(ccx + by, ccy - bx); - SEEK_MIN(ccx - by, ccy - bx); - ccy--; - SEEK_MAX(ccx + bx, ccy + by); - SEEK_MIN(ccx - bx, ccy + by); - SEEK_MAX(ccx + by, ccy + bx); - SEEK_MIN(ccx - by, ccy + bx); - ccy++; - if (bd <= 0) { - bd += 4 * bx + 6; - } - else { - bd += 4 * (bx - by) + 10; - by--; - } - bx++; - } + RasterizeCircle(x, y, dst_x1, dst_y1, dst_x2, dst_y2, rad, ContourBuffer); Uint32 col = ColRGB; @@ -1793,7 +1965,7 @@ PUBLIC STATIC void SoftwareRenderer::FillCircle(float x, float y, float rad) int* multSubTableAt = &MultSubTable[opacity << 8]; int dst_strideY = dst_y1 * dstStride; - if (!UseStencil && (blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT) == BlendFlag_OPAQUE)) { + if (!UseStencil && ((blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT)) == BlendFlag_OPAQUE)) { for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { Contour contour = ContourBuffer[dst_y]; if (contour.MaxX < contour.MinX) { @@ -1826,6 +1998,9 @@ PUBLIC STATIC void SoftwareRenderer::FillCircle(float x, float y, float rad) dst_strideY += dstStride; } } + +#undef SEEK_MIN +#undef SEEK_MAX } PUBLIC STATIC void SoftwareRenderer::FillEllipse(float x, float y, float w, float h) { @@ -1884,7 +2059,7 @@ PUBLIC STATIC void SoftwareRenderer::FillRectangle(float x, float y, float w int* multSubTableAt = &MultSubTable[opacity << 8]; int dst_strideY = dst_y1 * dstStride; - if (!UseStencil && (blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT) == BlendFlag_OPAQUE)) { + if (!UseStencil && ((blendFlag & (BlendFlag_MODE_MASK | BlendFlag_TINT_BIT)) == BlendFlag_OPAQUE)) { for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { Memory::Memset4(&dstPx[dst_x1 + dst_strideY], col, dst_x2 - dst_x1); dst_strideY += dstStride; @@ -1946,6 +2121,29 @@ PUBLIC STATIC void SoftwareRenderer::FillTriangleBlend(float x1, float y1, f vectors[2].X = ((int)x3 + x) << 16; vectors[2].Y = ((int)y3 + y) << 16; colors[2] = ColorUtils::Multiply(c3, GetBlendColor()); PolygonRasterizer::DrawBasicBlend(vectors, colors, 3, GetBlendState()); } +PUBLIC STATIC void SoftwareRenderer::FillQuad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { + View* currentView = Graphics::CurrentView; + if (!currentView) + return; + + int cx = (int)std::floor(currentView->X); + int cy = (int)std::floor(currentView->Y); + + int x = 0, y = 0; + + Matrix4x4* out = Graphics::ModelViewMatrix; + x += out->Values[12]; + y += out->Values[13]; + x -= cx; + y -= cy; + + Vector2 vectors[4]; + vectors[0].X = ((int)x1 + x) << 16; vectors[0].Y = ((int)y1 + y) << 16; + vectors[1].X = ((int)x2 + x) << 16; vectors[1].Y = ((int)y2 + y) << 16; + vectors[2].X = ((int)x3 + x) << 16; vectors[2].Y = ((int)y3 + y) << 16; + vectors[3].X = ((int)x4 + x) << 16; vectors[3].Y = ((int)y4 + y) << 16; + PolygonRasterizer::DrawBasic(vectors, ColRGB, 4, GetBlendState()); +} PUBLIC STATIC void SoftwareRenderer::FillQuadBlend(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int c1, int c2, int c3, int c4) { View* currentView = Graphics::CurrentView; if (!currentView) @@ -1970,8 +2168,102 @@ PUBLIC STATIC void SoftwareRenderer::FillQuadBlend(float x1, float y1, float vectors[3].X = ((int)x4 + x) << 16; vectors[3].Y = ((int)y4 + y) << 16; colors[3] = ColorUtils::Multiply(c4, GetBlendColor()); PolygonRasterizer::DrawBasicBlend(vectors, colors, 4, GetBlendState()); } +PRIVATE STATIC void SoftwareRenderer::DrawShapeTextured(Texture* texturePtr, unsigned numPoints, float* px, float* py, int* pc, float* pu, float* pv) { + View* currentView = Graphics::CurrentView; + if (!currentView) + return; + + int cx = (int)std::floor(currentView->X); + int cy = (int)std::floor(currentView->Y); -void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int sy, int flipFlag, BlendState blendState) { + int x = 0, y = 0; + + Matrix4x4* out = Graphics::ModelViewMatrix; + x += out->Values[12]; + y += out->Values[13]; + x -= cx; + y -= cy; + + int colors[MAX_POLYGON_VERTICES]; + Vector3 vectors[MAX_POLYGON_VERTICES]; + Vector2 uv[MAX_POLYGON_VERTICES]; + + if (numPoints > MAX_POLYGON_VERTICES) + numPoints = MAX_POLYGON_VERTICES; + + for (unsigned i = 0; i < numPoints; i++) { + vectors[i].X = ((int)px[i] + x) << 16; + vectors[i].Y = ((int)py[i] + y) << 16; + vectors[i].Z = FP16_TO(1.0f); + colors[i] = ColorUtils::Multiply(pc[i], GetBlendColor()); + uv[i].X = ((int)pu[i]) << 16; + uv[i].Y = ((int)pv[i]) << 16; + } + + PolygonRasterizer::DrawBlendPerspective(texturePtr, vectors, uv, colors, numPoints, GetBlendState()); +} +PUBLIC STATIC void SoftwareRenderer::DrawTriangleTextured(Texture* texturePtr, float x1, float y1, float x2, float y2, float x3, float y3, int c1, int c2, int c3, float u1, float v1, float u2, float v2, float u3, float v3) { + float px[3]; + float py[3]; + float pu[3]; + float pv[3]; + int pc[3]; + + px[0] = x1; + py[0] = y1; + pu[0] = u1; + pv[0] = v1; + pc[0] = c1; + + px[1] = x2; + py[1] = y2; + pu[1] = u2; + pv[1] = v2; + pc[1] = c2; + + px[2] = x3; + py[2] = y3; + pu[2] = u3; + pv[2] = v3; + pc[2] = c3; + + DrawShapeTextured(texturePtr, 3, px, py, pc, pu, pv); +} +PUBLIC STATIC void SoftwareRenderer::DrawQuadTextured(Texture* texturePtr, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int c1, int c2, int c3, int c4, float u1, float v1, float u2, float v2, float u3, float v3, float u4, float v4) { + float px[4]; + float py[4]; + float pu[4]; + float pv[4]; + int pc[4]; + + px[0] = x1; + py[0] = y1; + pu[0] = u1; + pv[0] = v1; + pc[0] = c1; + + px[1] = x2; + py[1] = y2; + pu[1] = u2; + pv[1] = v2; + pc[1] = c2; + + px[2] = x3; + py[2] = y3; + pu[2] = u3; + pv[2] = v3; + pc[2] = c3; + + px[3] = x4; + py[3] = y4; + pu[3] = u4; + pv[3] = v4; + pc[3] = c4; + + DrawShapeTextured(texturePtr, 4, px, py, pc, pu, pv); +} + +void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int sy, int flipFlag, unsigned paletteID, BlendState blendState) { Uint32* srcPx = (Uint32*)texture->Pixels; Uint32 srcStride = texture->Width; Uint32* srcPxLine; @@ -2043,14 +2335,15 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s if ((color = srcPxLine[src_x]) & 0xFF000000U) \ pixelFunction(&color, &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); #define DRAW_PLACEPIXEL_PAL() \ - if ((color = srcPxLine[src_x])) \ + if ((color = srcPxLine[src_x]) && (index[color] & 0xFF000000U)) \ pixelFunction(&index[color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); #define DRAW_NOFLIP(placePixelMacro) \ for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { \ srcPxLine = srcPx + src_strideY; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, src_x = src_x1; dst_x < dst_x2; dst_x++, src_x++) { \ DEFORM_X; \ @@ -2067,7 +2360,8 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s #define DRAW_FLIPX(placePixelMacro) for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { \ srcPxLine = srcPx + src_strideY; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, src_x = src_x2; dst_x < dst_x2; dst_x++, src_x--) { \ DEFORM_X; \ @@ -2084,7 +2378,8 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s #define DRAW_FLIPY(placePixelMacro) for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { \ srcPxLine = srcPx + src_strideY; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, src_x = src_x1; dst_x < dst_x2; dst_x++, src_x++) { \ DEFORM_X; \ @@ -2101,7 +2396,8 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s #define DRAW_FLIPXY(placePixelMacro) for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { \ srcPxLine = srcPx + src_strideY; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, src_x = src_x2; dst_x < dst_x2; dst_x++, src_x--) { \ DEFORM_X; \ @@ -2120,13 +2416,16 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s SoftwareRenderer::SetTintFunction(blendFlag); Uint32 color; - Uint32* index; + Uint32* index = nullptr; int dst_strideY, src_strideY; int* multTableAt = &SoftwareRenderer::MultTable[opacity << 8]; int* multSubTableAt = &SoftwareRenderer::MultSubTable[opacity << 8]; Sint32* deformValues = &SoftwareRenderer::SpriteDeformBuffer[dst_y1]; if (Graphics::UsePalettes && texture->Paletted) { + if (!Graphics::UsePaletteIndexLines) + index = &Graphics::PaletteColors[paletteID][0]; + switch (flipFlag) { case 0: dst_strideY = dst_y1 * dstStride; @@ -2182,7 +2481,7 @@ void DrawSpriteImage(Texture* texture, int x, int y, int w, int h, int sx, int s #undef DRAW_FLIPY #undef DRAW_FLIPXY } -void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int offy, int w, int h, int sx, int sy, int sw, int sh, int flipFlag, int rotation, BlendState blendState) { +void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int offy, int w, int h, int sx, int sy, int sw, int sh, int flipFlag, int rotation, unsigned paletteID, BlendState blendState) { Uint32* srcPx = (Uint32*)texture->Pixels; Uint32 srcStride = texture->Width; @@ -2306,14 +2605,15 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of if ((color = srcPx[src_x + src_strideY]) & 0xFF000000U) \ pixelFunction(&color, &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); #define DRAW_PLACEPIXEL_PAL() \ - if ((color = srcPx[src_x + src_strideY])) \ + if ((color = srcPx[src_x + src_strideY]) && (index[color] & 0xFF000000U)) \ pixelFunction(&index[color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); #define DRAW_NOFLIP(placePixelMacro) for (int dst_y = dst_y1, i_y = dst_y1 - y; dst_y < dst_y2; dst_y++, i_y++) { \ i_y_rsin = -i_y * rsin; \ i_y_rcos = i_y * rcos; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, i_x = dst_x1 - x; dst_x < dst_x2; dst_x++, i_x++) { \ DEFORM_X; \ @@ -2344,7 +2644,8 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of i_y_rsin = -i_y * rsin; \ i_y_rcos = i_y * rcos; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, i_x = dst_x1 - x; dst_x < dst_x2; dst_x++, i_x++) { \ DEFORM_X; \ @@ -2375,7 +2676,8 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of i_y_rsin = -i_y * rsin; \ i_y_rcos = i_y * rcos; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, i_x = dst_x1 - x; dst_x < dst_x2; dst_x++, i_x++) { \ DEFORM_X; \ @@ -2406,7 +2708,8 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of i_y_rsin = -i_y * rsin; \ i_y_rcos = i_y * rcos; \ dstPxLine = dstPx + dst_strideY; \ - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ + if (Graphics::UsePaletteIndexLines) \ + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; \ if (SoftwareRenderer::UseSpriteDeform) \ for (int dst_x = dst_x1, i_x = dst_x1 - x; dst_x < dst_x2; dst_x++, i_x++) { \ DEFORM_X; \ @@ -2438,7 +2741,7 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of SoftwareRenderer::SetTintFunction(blendFlag); Uint32 color; - Uint32* index; + Uint32* index = nullptr; int i_y_rsin, i_y_rcos; int dst_strideY, src_strideY; int* multTableAt = &SoftwareRenderer::MultTable[opacity << 8]; @@ -2446,6 +2749,9 @@ void DrawSpriteImageTransformed(Texture* texture, int x, int y, int offx, int of Sint32* deformValues = &SoftwareRenderer::SpriteDeformBuffer[dst_y1]; if (Graphics::UsePalettes && texture->Paletted) { + if (!Graphics::UsePaletteIndexLines) + index = &Graphics::PaletteColors[paletteID][0]; + switch (flipFlag) { case 0: dst_strideY = dst_y1 * dstStride; @@ -2518,11 +2824,11 @@ PUBLIC STATIC void SoftwareRenderer::DrawTexture(Texture* texture, float sx, BlendState blendState = GetBlendState(); if (sw != textureWidth || sh != textureHeight) - DrawSpriteImageTransformed(texture, x, y, sx, sy, sw, sh, sx, sy, sw, sh, 0, 0, blendState); + DrawSpriteImageTransformed(texture, x, y, sx, sy, sw, sh, sx, sy, sw, sh, 0, 0, 0, blendState); else - DrawSpriteImage(texture, x, y, sw, sh, sx, sy, 0, blendState); + DrawSpriteImage(texture, x, y, sw, sh, sx, sy, 0, 0, blendState); } -PUBLIC STATIC void SoftwareRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void SoftwareRenderer::DrawSprite(ISprite* sprite, int animation, int frame, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; View* currentView = Graphics::CurrentView; @@ -2552,7 +2858,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSprite(ISprite* sprite, int animati frameStr.X, frameStr.Y, frameStr.Width, frameStr.Height, - flipFlag, rot, + flipFlag, rot, paletteID, blendState); return; } @@ -2561,29 +2867,29 @@ PUBLIC STATIC void SoftwareRenderer::DrawSprite(ISprite* sprite, int animati DrawSpriteImage(texture, x + frameStr.OffsetX, y + frameStr.OffsetY, - frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, blendState); + frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, paletteID, blendState); break; case 1: DrawSpriteImage(texture, x - frameStr.OffsetX - frameStr.Width, y + frameStr.OffsetY, - frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, blendState); + frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, paletteID, blendState); break; case 2: DrawSpriteImage(texture, x + frameStr.OffsetX, y - frameStr.OffsetY - frameStr.Height, - frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, blendState); + frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, paletteID, blendState); break; case 3: DrawSpriteImage(texture, x - frameStr.OffsetX - frameStr.Width, y - frameStr.OffsetY - frameStr.Height, - frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, blendState); + frameStr.Width, frameStr.Height, frameStr.X, frameStr.Y, flipFlag, paletteID, blendState); break; } } -PUBLIC STATIC void SoftwareRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation) { +PUBLIC STATIC void SoftwareRenderer::DrawSpritePart(ISprite* sprite, int animation, int frame, int sx, int sy, int sw, int sh, int x, int y, bool flipX, bool flipY, float scaleW, float scaleH, float rotation, unsigned paletteID) { if (Graphics::SpriteRangeCheck(sprite, animation, frame)) return; View* currentView = Graphics::CurrentView; @@ -2618,7 +2924,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSpritePart(ISprite* sprite, int ani frameStr.X + sx, frameStr.Y + sy, sw, sh, - flipFlag, rot, + flipFlag, rot, paletteID, blendState); return; } @@ -2627,25 +2933,25 @@ PUBLIC STATIC void SoftwareRenderer::DrawSpritePart(ISprite* sprite, int ani DrawSpriteImage(texture, x + frameStr.OffsetX + sx, y + frameStr.OffsetY + sy, - sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, blendState); + sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, paletteID, blendState); break; case 1: DrawSpriteImage(texture, x - frameStr.OffsetX - sw - sx, y + frameStr.OffsetY + sy, - sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, blendState); + sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, paletteID, blendState); break; case 2: DrawSpriteImage(texture, x + frameStr.OffsetX + sx, y - frameStr.OffsetY - sh - sy, - sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, blendState); + sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, paletteID, blendState); break; case 3: DrawSpriteImage(texture, x - frameStr.OffsetX - sw - sx, y - frameStr.OffsetY - sh - sy, - sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, blendState); + sw, sh, frameStr.X + sx, frameStr.Y + sy, flipFlag, paletteID, blendState); break; } } @@ -2672,7 +2978,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_InitTileScanLines(SceneL for (int i = 0; i < layer->ScrollInfoCount; i++) { info->Offset = Scene::Frame * info->ConstantParallax; info->Position = (info->Offset + ((viewX + layerOffsetX) * info->RelativeParallax)) >> 8; - if (layer->Repeat) { + if (layer->Flags & SceneLayer::FLAGS_REPEAT_Y) { info->Position %= layerWidth; if (info->Position < 0) info->Position += layerWidth; @@ -2813,7 +3119,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene bool canCollide = (layer->Flags & SceneLayer::FLAGS_COLLIDEABLE); int layerWidthInBits = layer->WidthInBits; - int layerWidthInPixels = layer->Width * 16; + int layerWidthInPixels = layer->Width * Scene::TileWidth; int layerWidth = layer->Width; int sourceTileCellX, sourceTileCellY; int tileID; @@ -2841,14 +3147,17 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene Uint32* index; int dst_strideY = dst_y1 * dstStride; - int maxTileDraw = ((int)currentView->Stride >> 4) - 1; + int viewWidth = (int)currentView->Width; + int maxTileDraw = ((int)currentView->Stride / Scene::TileWidth) - 1; vector srcStrides; vector tileSources; vector isPalettedSources; + vector paletteIDs; srcStrides.resize(Scene::TileSpriteInfos.size()); tileSources.resize(Scene::TileSpriteInfos.size()); isPalettedSources.resize(Scene::TileSpriteInfos.size()); + paletteIDs.resize(Scene::TileSpriteInfos.size()); for (size_t i = 0; i < Scene::TileSpriteInfos.size(); i++) { TileSpriteInfo info = Scene::TileSpriteInfos[i]; AnimFrame frameStr = info.Sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; @@ -2856,6 +3165,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene srcStrides[i] = srcStride = texture->Width; tileSources[i] = (&((Uint32*)texture->Pixels)[frameStr.X + frameStr.Y * srcStride]); isPalettedSources[i] = Graphics::UsePalettes && texture->Paletted; + paletteIDs[i] = Scene::Tilesets[info.TilesetID].PaletteID; } Uint32 DRAW_COLLISION = 0; @@ -2867,17 +3177,19 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene baseTileCfg = Scene::TileCfg[collisionPlane]; } + bool usePaletteIndexLines = Graphics::UsePaletteIndexLines && layer->UsePaletteIndexLines; + PixelFunction pixelFunction = GetPixelFunction(blendFlag); int j; TileScanLine* tScanLine = &TileScanLineBuffer[dst_y1]; - for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { + for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++, tScanLine++, dst_strideY += dstStride) { tScanLine->SrcX >>= 16; tScanLine->SrcY >>= 16; dstPxLine = dstPx + dst_strideY; bool isInLayer = tScanLine->SrcX >= 0 && tScanLine->SrcX < layerWidthInPixels; - if (!isInLayer && layer->Repeat) { + if (!isInLayer && layer->Flags & SceneLayer::FLAGS_REPEAT_X) { if (tScanLine->SrcX < 0) tScanLine->SrcX += layerWidthInPixels; else if (tScanLine->SrcX >= layerWidthInPixels) @@ -2888,7 +3200,6 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene int dst_x = dst_x1, c_dst_x = dst_x1; int pixelsOfTileRemaining; Sint64 srcX = tScanLine->SrcX, srcY = tScanLine->SrcY; - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; // Draw leftmost tile in scanline int srcTX = srcX & 15; @@ -2901,6 +3212,10 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene if (isInLayer && (*tile & TILE_IDENT_MASK) != Scene::EmptyTile) { tileID = *tile & TILE_IDENT_MASK; + if (usePaletteIndexLines) + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; + else + index = &Graphics::PaletteColors[paletteIDs[tileID]][0]; if (Scene::ShowTileCollisionFlag && baseTileCfg) { c_dst_x = dst_x; if (Scene::ShowTileCollisionFlag == 1) @@ -2924,7 +3239,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene color = &tileSources[tileID][srcTX + srcTY * srcStrides[tileID]]; if (isPalettedSources[tileID]) { while (pixelsOfTileRemaining) { - if (*color) + if (*color && (index[*color] & 0xFF000000U)) pixelFunction(&index[*color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); pixelsOfTileRemaining--; dst_x++; @@ -2946,7 +3261,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene color = &tileSources[tileID][srcTX + srcTY * srcStrides[tileID]]; if (isPalettedSources[tileID]) { while (pixelsOfTileRemaining) { - if (*color) + if (*color && (index[*color] & 0xFF000000U)) pixelFunction(&index[*color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); pixelsOfTileRemaining--; dst_x++; @@ -2994,7 +3309,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene continue; } else if (sourceTileCellX >= layerWidth) { - if (layer->Repeat) { + if (layer->Flags & SceneLayer::FLAGS_REPEAT_X) { sourceTileCellX -= layerWidth; tile -= layerWidth; } @@ -3019,6 +3334,10 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene int srcTYb = srcTY; tileID = *tile & TILE_IDENT_MASK; if (tileID != Scene::EmptyTile) { + if (usePaletteIndexLines) + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; + else + index = &Graphics::PaletteColors[paletteIDs[tileID]][0]; // If y-flipped if ((*tile & TILE_FLIPY_MASK)) srcTYb ^= 15; @@ -3026,7 +3345,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene if ((*tile & TILE_FLIPX_MASK)) { color = &tileSources[tileID][srcTYb * srcStrides[tileID]]; if (isPalettedSources[tileID]) { - #define UNLOOPED(n, k) if (color[n]) { pixelFunction(&index[color[n]], &dstPxLine[dst_x + k], blendState, multTableAt, multSubTableAt); } + #define UNLOOPED(n, k) if (color[n] && (index[color[n]] & 0xFF000000U)) { pixelFunction(&index[color[n]], &dstPxLine[dst_x + k], blendState, multTableAt, multSubTableAt); } UNLOOPED(0, 15); UNLOOPED(1, 14); UNLOOPED(2, 13); @@ -3070,7 +3389,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene else { color = &tileSources[tileID][srcTYb * srcStrides[tileID]]; if (isPalettedSources[tileID]) { - #define UNLOOPED(n, k) if (color[n]) { pixelFunction(&index[color[n]], &dstPxLine[dst_x + k], blendState, multTableAt, multSubTableAt); } + #define UNLOOPED(n, k) if (color[n] && (index[color[n]] & 0xFF000000U)) { pixelFunction(&index[color[n]], &dstPxLine[dst_x + k], blendState, multTableAt, multSubTableAt); } UNLOOPED(0, 0); UNLOOPED(1, 1); UNLOOPED(2, 2); @@ -3129,10 +3448,114 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_HorizontalParallax(Scene } } } - srcX += maxTileDraw * 16; - tScanLine++; - dst_strideY += dstStride; + if (dst_x >= viewWidth) + continue; + + // Draw rightmost tile in scanline + srcX += (maxTileDraw + 1) * Scene::TileWidth; + if (srcX < 0 || srcX >= layerWidthInPixels) { + if ((layer->Flags & SceneLayer::FLAGS_REPEAT_X) == 0) + continue; + + if (srcX < 0) + srcX += layerWidthInPixels; + else if (srcX >= layerWidthInPixels) + srcX -= layerWidthInPixels; + } + + srcTX = 0; + sourceTileCellX = (srcX >> 4); + pixelsOfTileRemaining = std::min(viewWidth - dst_x, 16); + c_pixelsOfTileRemaining = pixelsOfTileRemaining; + tile = &layer->Tiles[sourceTileCellX + (sourceTileCellY << layerWidthInBits)]; + + if ((*tile & TILE_IDENT_MASK) != Scene::EmptyTile) { + tileID = *tile & TILE_IDENT_MASK; + if (usePaletteIndexLines) + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; + else + index = &Graphics::PaletteColors[paletteIDs[tileID]][0]; + if (Scene::ShowTileCollisionFlag && baseTileCfg) { + c_dst_x = dst_x; + if (Scene::ShowTileCollisionFlag == 1) + DRAW_COLLISION = (*tile & TILE_COLLA_MASK) >> 28; + else if (Scene::ShowTileCollisionFlag == 2) + DRAW_COLLISION = (*tile & TILE_COLLB_MASK) >> 26; + + switch (DRAW_COLLISION) { + case 1: DRAW_COLLISION = 0xFFFFFF00U; break; + case 2: DRAW_COLLISION = 0xFFFF0000U; break; + case 3: DRAW_COLLISION = 0xFFFFFFFFU; break; + } + } + + // If y-flipped + if ((*tile & TILE_FLIPY_MASK)) + srcTY ^= 15; + // If x-flipped + if ((*tile & TILE_FLIPX_MASK)) { + srcTX ^= 15; + color = &tileSources[tileID][srcTX + srcTY * srcStrides[tileID]]; + if (isPalettedSources[tileID]) { + while (pixelsOfTileRemaining) { + if (*color && (index[*color] & 0xFF000000U)) + pixelFunction(&index[*color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); + pixelsOfTileRemaining--; + dst_x++; + color--; + } + } + else { + while (pixelsOfTileRemaining) { + if (*color & 0xFF000000U) + pixelFunction(color, &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); + pixelsOfTileRemaining--; + dst_x++; + color--; + } + } + } + // Otherwise + else { + color = &tileSources[tileID][srcTX + srcTY * srcStrides[tileID]]; + if (isPalettedSources[tileID]) { + while (pixelsOfTileRemaining) { + if (*color && (index[*color] & 0xFF000000U)) + pixelFunction(&index[*color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); + pixelsOfTileRemaining--; + dst_x++; + color++; + } + } + else { + while (pixelsOfTileRemaining) { + if (*color & 0xFF000000U) + pixelFunction(color, &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); + pixelsOfTileRemaining--; + dst_x++; + color++; + } + } + } + + if (canCollide && DRAW_COLLISION) { + tileFlipOffset = ( + ( (!!(*tile & TILE_FLIPY_MASK)) << 1 ) | (!!(*tile & TILE_FLIPX_MASK)) + ) * Scene::TileCount; + + bool flipY = !!(*tile & TILE_FLIPY_MASK); + bool isCeiling = !!baseTileCfg[tileID].IsCeiling; + TileConfig* tile = (&baseTileCfg[tileID] + tileFlipOffset); + for (int gg = c_pixelsOfTileRemaining; gg < 16; gg++) { + if ((flipY == isCeiling && (srcY & 15) >= tile->CollisionTop[gg] && tile->CollisionTop[gg] < 0xF0) || + (flipY != isCeiling && (srcY & 15) <= tile->CollisionBottom[gg] && tile->CollisionBottom[gg] < 0xF0)) { + PixelNoFiltSetOpaque(&DRAW_COLLISION, &dstPxLine[c_dst_x], CurrentBlendState, NULL, NULL); + } + c_dst_x++; + } + } + } } } PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_VerticalParallax(SceneLayer* layer, View* currentView) { @@ -3184,9 +3607,11 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_CustomTileScanLines(Scen vector srcStrides; vector tileSources; vector isPalettedSources; + vector paletteIDs; srcStrides.resize(Scene::TileSpriteInfos.size()); tileSources.resize(Scene::TileSpriteInfos.size()); isPalettedSources.resize(Scene::TileSpriteInfos.size()); + paletteIDs.resize(Scene::TileSpriteInfos.size()); for (size_t i = 0; i < Scene::TileSpriteInfos.size(); i++) { info = Scene::TileSpriteInfos[i]; frameStr = info.Sprite->Animations[info.AnimationIndex].Frames[info.FrameIndex]; @@ -3194,8 +3619,11 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_CustomTileScanLines(Scen srcStrides[i] = srcStride = texture->Width; tileSources[i] = (&((Uint32*)texture->Pixels)[frameStr.X + frameStr.Y * srcStride]); isPalettedSources[i] = Graphics::UsePalettes && texture->Paletted; + paletteIDs[i] = Scene::Tilesets[info.TilesetID].PaletteID; } + bool usePaletteIndexLines = Graphics::UsePaletteIndexLines && layer->UsePaletteIndexLines; + TileScanLine* scanLine = &TileScanLineBuffer[dst_y1]; for (int dst_y = dst_y1; dst_y < dst_y2; dst_y++) { dstPxLine = dstPx + dst_strideY; @@ -3240,8 +3668,6 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_CustomTileScanLines(Scen else linePixelFunction = PixelNoFiltFunctions[blendFlag & BlendFlag_MODE_MASK]; - index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; - for (int dst_x = dst_x1; dst_x < dst_x2; dst_x++) { int srcTX = srcX >> 16; int srcTY = srcY >> 16; @@ -3259,6 +3685,11 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_CustomTileScanLines(Scen if ((tile & TILE_IDENT_MASK) != Scene::EmptyTile) { int tileID = tile & TILE_IDENT_MASK; + if (usePaletteIndexLines) + index = &Graphics::PaletteColors[Graphics::PaletteIndexLines[dst_y]][0]; + else + index = &Graphics::PaletteColors[paletteIDs[tileID]][0]; + // If y-flipped if (tile & TILE_FLIPY_MASK) srcTY ^= 15; @@ -3268,7 +3699,7 @@ PUBLIC STATIC void SoftwareRenderer::DrawSceneLayer_CustomTileScanLines(Scen color = tileSources[tileID][(srcTX & 15) + (srcTY & 15) * srcStrides[tileID]]; if (isPalettedSources[tileID]) { - if (color) + if (color && (index[color] & 0xFF000000U)) linePixelFunction(&index[color], &dstPxLine[dst_x], blendState, multTableAt, multSubTableAt); } else { diff --git a/source/Engine/Rendering/Texture.cpp b/source/Engine/Rendering/Texture.cpp index 13b81aee..5e4df7f2 100644 --- a/source/Engine/Rendering/Texture.cpp +++ b/source/Engine/Rendering/Texture.cpp @@ -82,7 +82,7 @@ PUBLIC bool Texture::ConvertToPalette(Uint32 *palColors, unsigned numPa Uint32 color = pixels[i]; if (color & 0xFF000000) { if (!colorsHash->GetIfExists(color, &nearestColor)) { - Uint32 rgb[3]; + Uint8 rgb[3]; ColorUtils::SeparateRGB(color, rgb); nearestColor = ColorUtils::NearestColor(rgb[0], rgb[1], rgb[2], palColors, numPaletteColors); colorsHash->Put(color, nearestColor); diff --git a/source/Engine/ResourceTypes/IModel.cpp b/source/Engine/ResourceTypes/IModel.cpp index eca6602e..e5790989 100644 --- a/source/Engine/ResourceTypes/IModel.cpp +++ b/source/Engine/ResourceTypes/IModel.cpp @@ -12,7 +12,6 @@ class IModel { size_t MeshCount; size_t VertexCount; - size_t FrameCount; size_t VertexIndexCount; Uint8 VertexPerFace; @@ -41,13 +40,15 @@ class IModel { #include #include #include +#include +#include +#include +#include #include - -#define RSDK_MODEL_MAGIC 0x4D444C00 // MDL0 +#include PUBLIC IModel::IModel() { VertexCount = 0; - FrameCount = 0; Meshes = nullptr; MeshCount = 0; @@ -80,20 +81,77 @@ PUBLIC bool IModel::Load(Stream* stream, const char* filename) { if (!stream) return false; if (!filename) return false; - Uint32 magic = stream->ReadUInt32BE(); + bool success; + + Clock::Start(); - stream->Seek(0); + if (HatchModel::IsMagic(stream)) + success = HatchModel::Convert(this, stream, filename); + else if (MD3Model::IsMagic(stream)) + success = MD3Model::Convert(this, stream, filename); + else if (RSDKModel::IsMagic(stream)) + success = RSDKModel::Convert(this, stream); + else + success = ModelImporter::Convert(this, stream, filename); - if (magic == RSDK_MODEL_MAGIC) - return this->ReadRSDK(stream); + if (success) { + Log::Print(Log::LOG_VERBOSE, "Model load took %.3f ms (%s)", Clock::End(), filename); + return true; + } + else + Log::Print(Log::LOG_ERROR, "Could not load model \"%s\"!", filename); - return !!ModelImporter::Convert(this, stream, filename); + return false; } PUBLIC bool IModel::HasMaterials() { return MaterialCount > 0; } +PRIVATE STATIC Image* IModel::TryLoadMaterialImage(std::string imagePath, const char *parentDirectory) { + std::string filename = imagePath; + + if (parentDirectory) { + char* concat = StringUtils::ConcatPaths(parentDirectory, filename.c_str()); + filename = std::string(concat); + Memory::Free(concat); + } + + const char *cfilename = filename.c_str(); + if (!ResourceManager::ResourceExists(cfilename)) + return nullptr; + + Image* image = new Image(cfilename); + if (image->TexturePtr) + return image; + + image->Dispose(); + + return nullptr; +} + +PUBLIC STATIC Image* IModel::LoadMaterialImage(string imagePath, const char *parentDirectory) { + // Try possible combinations + Image* image = nullptr; + + if ((image = TryLoadMaterialImage(imagePath, parentDirectory))) return image; + if ((image = TryLoadMaterialImage(imagePath + ".png", parentDirectory))) return image; + if ((image = TryLoadMaterialImage("Textures/" + imagePath, parentDirectory))) return image; + if ((image = TryLoadMaterialImage("Textures/" + imagePath + ".png", parentDirectory))) return image; + + if ((image = TryLoadMaterialImage(imagePath, nullptr))) return image; + if ((image = TryLoadMaterialImage(imagePath + ".png", nullptr))) return image; + if ((image = TryLoadMaterialImage("Textures/" + imagePath, nullptr))) return image; + if ((image = TryLoadMaterialImage("Textures/" + imagePath + ".png", nullptr))) return image; + + // Well, we tried + return nullptr; +} + +PUBLIC STATIC Image* IModel::LoadMaterialImage(const char *imagePath, const char *parentDirectory) { + return LoadMaterialImage(std::string(imagePath), parentDirectory); +} + PUBLIC bool IModel::HasBones() { if (BaseArmature == nullptr) return false; @@ -101,7 +159,7 @@ PUBLIC bool IModel::HasBones() { return BaseArmature->NumSkeletons > 0; } -PUBLIC void IModel::AnimateNode(ModelNode* node, ModelAnim* animation, Uint32 frame, Matrix4x4* parentMatrix) { +PUBLIC void IModel::AnimateNode(ModelNode* node, SkeletalAnim* animation, Uint32 frame, Matrix4x4* parentMatrix) { NodeAnim* nodeAnim = animation->NodeLookup->Get(node->Name); if (nodeAnim) UpdateChannel(node->LocalTransform, nodeAnim, frame); @@ -116,7 +174,7 @@ PUBLIC void IModel::Pose() { BaseArmature->RootNode->Transform(); } -PUBLIC void IModel::Pose(Armature* armature, ModelAnim* animation, Uint32 frame) { +PUBLIC void IModel::Pose(Armature* armature, SkeletalAnim* animation, Uint32 frame) { Matrix4x4 identity; Matrix4x4::Identity(&identity); @@ -226,6 +284,61 @@ PUBLIC Sint64 IModel::GetInBetween(Uint32 frame) { return inbetween; } +PUBLIC void IModel::DoVertexFrameInterpolation(Mesh* mesh, ModelAnim* animation, Uint32 frame, Vector3** positionBuffer, Vector3** normalBuffer, Vector2** uvBuffer) { + Uint32 startFrame = 0; + Uint32 animLength; + + if (animation) { + animLength = animation->Length % (mesh->FrameCount + 1); + if (!animLength) + animLength = 1; + startFrame = animation->StartFrame % animLength; + } + else if (mesh->FrameCount) + animLength = mesh->FrameCount; + else + animLength = 1; + + Uint32 keyframe = startFrame + (GetKeyFrame(frame) % animLength); + Uint32 nextKeyframe = startFrame + ((keyframe + 1) % animLength); + Sint64 inbetween = GetInBetween(frame); + + if (inbetween == 0 || inbetween == 0x10000) { + if (inbetween == 0x10000) + keyframe = nextKeyframe; + + *positionBuffer = mesh->PositionBuffer + (keyframe * mesh->VertexCount); + *normalBuffer = mesh->NormalBuffer + (keyframe * mesh->VertexCount); + *uvBuffer = mesh->UVBuffer + (keyframe * mesh->VertexCount); + } + else { + if (mesh->InbetweenPositions == nullptr) + mesh->InbetweenPositions = (Vector3*)Memory::Malloc(mesh->VertexCount * sizeof(Vector3)); + if (mesh->InbetweenNormals == nullptr) + mesh->InbetweenNormals = (Vector3*)Memory::Malloc(mesh->VertexCount * sizeof(Vector3)); + + Vector3* outPos = mesh->InbetweenPositions; + Vector3* outNormal = mesh->InbetweenNormals; + + *positionBuffer = outPos; + *normalBuffer = outNormal; + + // UVs are not interpolated + *uvBuffer = mesh->UVBuffer + (keyframe * mesh->VertexCount); + + for (size_t i = 0; i < mesh->VertexCount; i++) { + Vector3 posA = mesh->PositionBuffer[(keyframe * mesh->VertexCount) + i]; + Vector3 posB = mesh->PositionBuffer[(nextKeyframe * mesh->VertexCount) + i]; + + Vector3 normA = mesh->NormalBuffer[(keyframe * mesh->VertexCount) + i]; + Vector3 normB = mesh->NormalBuffer[(nextKeyframe * mesh->VertexCount) + i]; + + *outPos++ = Vector::Interpolate(posA, posB, inbetween); + *outNormal++ = Vector::Interpolate(normA, normB, inbetween); + } + } +} + PRIVATE void IModel::UpdateChannel(Matrix4x4* out, NodeAnim* channel, Uint32 frame) { Uint32 keyframe = GetKeyFrame(frame); Sint64 inbetween = GetInBetween(frame); @@ -264,11 +377,26 @@ PRIVATE void IModel::UpdateChannel(Matrix4x4* out, NodeAnim* channel, Uint32 fra } PUBLIC void IModel::Animate(Armature* armature, ModelAnim* animation, Uint32 frame) { - Pose(armature, animation, frame); + if (animation->Skeletal == nullptr) + return; + + if (armature == nullptr) + armature = BaseArmature; + + Pose(armature, animation->Skeletal, frame); armature->UpdateSkeletons(); } +PUBLIC void IModel::Animate(Uint16 animation, Uint32 frame) { + if (AnimationCount > 0) { + if (animation >= AnimationCount) + animation = AnimationCount - 1; + + Animate(nullptr, Animations[animation], frame); + } +} + PUBLIC int IModel::GetAnimationIndex(const char* animationName) { if (!AnimationCount) return -1; @@ -358,106 +486,3 @@ PUBLIC void IModel::Dispose() { PUBLIC IModel::~IModel() { Dispose(); } - -PUBLIC bool IModel::ReadRSDK(Stream* stream) { - if (stream->ReadUInt32BE() != RSDK_MODEL_MAGIC) { - Log::Print(Log::LOG_ERROR, "Model not of RSDK type!"); - return false; - } - - Uint8 vertexFlag = stream->ReadByte(); - - VertexPerFace = stream->ReadByte(); - VertexCount = stream->ReadUInt16(); - FrameCount = stream->ReadUInt16(); - - // We only need one mesh for RSDK models - Mesh* mesh = new Mesh; - Meshes = new Mesh*[1]; - Meshes[0] = mesh; - MeshCount = 1; - - mesh->VertexFlag = vertexFlag; - mesh->PositionBuffer = (Vector3*)Memory::Malloc(VertexCount * FrameCount * sizeof(Vector3)); - - if (vertexFlag & VertexType_Normal) - mesh->NormalBuffer = (Vector3*)Memory::Malloc(VertexCount * FrameCount * sizeof(Vector3)); - - if (vertexFlag & VertexType_UV) - mesh->UVBuffer = (Vector2*)Memory::Malloc(VertexCount * FrameCount * sizeof(Vector2)); - - if (vertexFlag & VertexType_Color) - mesh->ColorBuffer = (Uint32*)Memory::Malloc(VertexCount * FrameCount * sizeof(Uint32)); - - // Read UVs - if (vertexFlag & VertexType_UV) { - int uvX, uvY; - for (size_t i = 0; i < VertexCount; i++) { - Vector2* uv = &mesh->UVBuffer[i]; - uv->X = uvX = (int)(stream->ReadFloat() * 0x10000); - uv->Y = uvY = (int)(stream->ReadFloat() * 0x10000); - // Copy the values to other frames - for (size_t f = 1; f < FrameCount; f++) { - uv += VertexCount; - uv->X = uvX; - uv->Y = uvY; - } - } - } - // Read Colors - if (vertexFlag & VertexType_Color) { - Uint32* colorPtr, color; - for (size_t i = 0; i < VertexCount; i++) { - colorPtr = &mesh->ColorBuffer[i]; - *colorPtr = color = stream->ReadUInt32(); - // Copy the value to other frames - for (size_t f = 1; f < FrameCount; f++) { - colorPtr += VertexCount; - *colorPtr = color; - } - } - } - - Materials = nullptr; - Animations = nullptr; - BaseArmature = nullptr; - GlobalInverseMatrix = nullptr; - UseVertexAnimation = true; - - VertexIndexCount = stream->ReadInt16(); - mesh->VertexIndexCount = VertexIndexCount; - mesh->VertexIndexBuffer = (Sint16*)Memory::Malloc((VertexIndexCount + 1) * sizeof(Sint16)); - - for (size_t i = 0; i < VertexIndexCount; i++) - mesh->VertexIndexBuffer[i] = stream->ReadInt16(); - mesh->VertexIndexBuffer[VertexIndexCount] = -1; - - if (vertexFlag & VertexType_Normal) { - Vector3* vert = mesh->PositionBuffer; - Vector3* norm = mesh->NormalBuffer; - size_t totalVertexCount = VertexCount * FrameCount; - for (size_t v = 0; v < totalVertexCount; v++) { - vert->X = (int)(stream->ReadFloat() * 0x10000); - vert->Y = (int)(stream->ReadFloat() * 0x10000); - vert->Z = (int)(stream->ReadFloat() * 0x10000); - vert++; - - norm->X = (int)(stream->ReadFloat() * 0x10000); - norm->Y = (int)(stream->ReadFloat() * 0x10000); - norm->Z = (int)(stream->ReadFloat() * 0x10000); - norm++; - } - } - else { - Vector3* vert = mesh->PositionBuffer; - size_t totalVertexCount = VertexCount * FrameCount; - for (size_t v = 0; v < totalVertexCount; v++) { - vert->X = (int)(stream->ReadFloat() * 0x10000); - vert->Y = (int)(stream->ReadFloat() * 0x10000); - vert->Z = (int)(stream->ReadFloat() * 0x10000); - vert++; - } - } - - return true; -} diff --git a/source/Engine/ResourceTypes/ISprite.cpp b/source/Engine/ResourceTypes/ISprite.cpp index c840a35e..f919bac0 100644 --- a/source/Engine/ResourceTypes/ISprite.cpp +++ b/source/Engine/ResourceTypes/ISprite.cpp @@ -7,6 +7,8 @@ class ISprite { public: char Filename[256]; + bool LoadFailed; + Texture* Spritesheets[32]; bool SpritesheetsBorrowed[32]; char SpritesheetsFilenames[128][32]; @@ -41,6 +43,7 @@ PUBLIC ISprite::ISprite() { memset(Spritesheets, 0, sizeof(Spritesheets)); memset(SpritesheetsBorrowed, 0, sizeof(SpritesheetsBorrowed)); memset(Filename, 0, 256); + LoadFailed = true; } PUBLIC ISprite::ISprite(const char* filename) { memset(Spritesheets, 0, sizeof(Spritesheets)); @@ -48,7 +51,7 @@ PUBLIC ISprite::ISprite(const char* filename) { memset(Filename, 0, 256); strncpy(Filename, filename, 255); - LoadAnimation(Filename); + LoadFailed = !LoadAnimation(Filename); } PUBLIC STATIC Texture* ISprite::AddSpriteSheet(const char* filename) { @@ -224,7 +227,7 @@ PUBLIC void ISprite::ConvertToPalette(unsigned paletteNumber) { PUBLIC bool ISprite::LoadAnimation(const char* filename) { char* str, altered[4096]; - int animationCount, previousAnimationCount, frameCount; + int animationCount, previousAnimationCount; Stream* reader = ResourceStream::New(filename); if (!reader) { @@ -266,7 +269,7 @@ PUBLIC bool ISprite::LoadAnimation(const char* filename) { strcpy(SpritesheetsFilenames[i], str); - sprintf(altered, "Sprites/%s", str); + snprintf(altered, sizeof altered, "Sprites/%s", str); Memory::Free(str); if (Graphics::SpriteSheetTextureMap->Exists(altered)) diff --git a/source/Engine/ResourceTypes/ModelFormats/HatchModel.cpp b/source/Engine/ResourceTypes/ModelFormats/HatchModel.cpp new file mode 100644 index 00000000..45cc7a94 --- /dev/null +++ b/source/Engine/ResourceTypes/ModelFormats/HatchModel.cpp @@ -0,0 +1,919 @@ +#if INTERFACE +#include +#include +class HatchModel { +public: + static Sint32 Version; + + static Uint32 NumVertexStore; + static Uint32 NumNormalStore; + static Uint32 NumTexCoordStore; + static Uint32 NumColorStore; + + static Vector3* VertexStore; + static Vector3* NormalStore; + static Vector2* TexCoordStore; + static Uint32* ColorStore; +}; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#define HATCH_MODEL_MAGIC 0x484D444C // HMDL + +Sint32 HatchModel::Version; + +Uint32 HatchModel::NumVertexStore; +Uint32 HatchModel::NumNormalStore; +Uint32 HatchModel::NumTexCoordStore; +Uint32 HatchModel::NumColorStore; + +Vector3* HatchModel::VertexStore; +Vector3* HatchModel::NormalStore; +Vector2* HatchModel::TexCoordStore; +Uint32* HatchModel::ColorStore; + +PUBLIC STATIC bool HatchModel::IsMagic(Stream* stream) { + Uint32 magic = stream->ReadUInt32BE(); + + stream->Skip(-4); + + return magic == HATCH_MODEL_MAGIC; +} + +PUBLIC STATIC void HatchModel::ReadMaterialInfo(Stream* stream, Uint8 *destColors, char **texName) { + *texName = stream->ReadString(); + + Uint32 colorIndex = stream->ReadUInt32(); + + Uint32 color = GetStoredColor(colorIndex); + + ColorUtils::Separate(color, destColors); +} + +PRIVATE STATIC Material* HatchModel::ReadMaterial(Stream* stream, const char *parentDirectory) { + Material* material = new Material(); + + material->Name = stream->ReadString(); + + Uint8 flags = stream->ReadByte(); + + // Read diffuse + if (flags & 1) { + char *diffuseTexture; + Uint8 diffuseColor[4]; + + ReadMaterialInfo(stream, diffuseColor, &diffuseTexture); + + ColorUtils::Separate(material->ColorDiffuse, diffuseColor); + + material->TextureDiffuse = IModel::LoadMaterialImage(diffuseTexture, parentDirectory); + if (material->TextureDiffuse) + material->TextureDiffuseName = StringUtils::Duplicate(material->TextureDiffuse->Filename); + } + + // Read specular + if (flags & 2) { + char *specularTexture; + Uint8 specularColor[4]; + + ReadMaterialInfo(stream, specularColor, &specularTexture); + + ColorUtils::Separate(material->ColorSpecular, specularColor); + + material->TextureSpecular = IModel::LoadMaterialImage(specularTexture, parentDirectory); + if (material->TextureSpecular) + material->TextureSpecularName = StringUtils::Duplicate(material->TextureSpecular->Filename); + } + + // Read ambient + if (flags & 4) { + char *ambientTexture; + Uint8 ambientColor[4]; + + ReadMaterialInfo(stream, ambientColor, &ambientTexture); + + ColorUtils::Separate(material->ColorAmbient, ambientColor); + + material->TextureAmbient = IModel::LoadMaterialImage(ambientTexture, parentDirectory); + if (material->TextureAmbient) + material->TextureAmbientName = StringUtils::Duplicate(material->TextureAmbient->Filename); + } + + // Read emissive + if (flags & 8) { + char *emissiveTexture; + Uint8 emissiveColor[4]; + + ReadMaterialInfo(stream, emissiveColor, &emissiveTexture); + + ColorUtils::Separate(material->ColorEmissive, emissiveColor); + + material->TextureEmissive = IModel::LoadMaterialImage(emissiveTexture, parentDirectory); + if (material->TextureEmissive) + material->TextureEmissiveName = StringUtils::Duplicate(material->TextureEmissive->Filename); + } + + // Read shininess + if (flags & 16) { + Uint8 val = stream->ReadByte(); + material->Shininess = (float)val / 255; + val = stream->ReadByte(); + material->ShininessStrength = (float)val / 255; + } + + // Read opacity + if (flags & 32) { + Uint8 val = stream->ReadByte(); + material->Opacity = (float)val / 255; + } + + return material; +} + +PRIVATE STATIC void HatchModel::ReadVertexStore(Stream* stream) { + NumVertexStore = stream->ReadUInt32(); + if (!NumVertexStore) + return; + + VertexStore = (Vector3*)Memory::Malloc(NumVertexStore * sizeof(Vector3)); + + Vector3* vert = VertexStore; + for (Uint32 i = 0; i < NumVertexStore; i++) { + vert->X = stream->ReadInt64(); + vert->Y = stream->ReadInt64(); + vert->Z = stream->ReadInt64(); + vert++; + } +} + +PRIVATE STATIC void HatchModel::ReadNormalStore(Stream* stream) { + NumNormalStore = stream->ReadUInt32(); + if (!NumNormalStore) + return; + + NormalStore = (Vector3*)Memory::Malloc(NumNormalStore * sizeof(Vector3)); + + Vector3* norm = NormalStore; + for (Uint32 i = 0; i < NumNormalStore; i++) { + norm->X = stream->ReadInt64(); + norm->Y = stream->ReadInt64(); + norm->Z = stream->ReadInt64(); + norm++; + } +} + +PRIVATE STATIC void HatchModel::ReadTexCoordStore(Stream* stream) { + NumTexCoordStore = stream->ReadUInt32(); + if (!NumTexCoordStore) + return; + + TexCoordStore = (Vector2*)Memory::Malloc(NumTexCoordStore * sizeof(Vector2)); + + Vector2* uvs = TexCoordStore; + for (Uint32 i = 0; i < NumTexCoordStore; i++) { + uvs->X = stream->ReadInt64(); + uvs->Y = stream->ReadInt64(); + uvs++; + } +} + +PRIVATE STATIC void HatchModel::ReadColorStore(Stream* stream) { + NumColorStore = stream->ReadUInt32(); + if (!NumColorStore) + return; + + ColorStore = (Uint32*)Memory::Malloc(NumColorStore * sizeof(Uint32)); + + Uint32* colors = ColorStore; + for (Uint32 i = 0; i < NumColorStore; i++) { + Uint8 r = stream->ReadByte(); + Uint8 g = stream->ReadByte(); + Uint8 b = stream->ReadByte(); + Uint8 a = stream->ReadByte(); + *colors = ColorUtils::ToRGB(r, g, b, a); + colors++; + } +} + +PRIVATE STATIC Vector3 HatchModel::GetStoredVertex(Uint32 idx) { + if (idx < 0 || idx >= NumVertexStore) + return {}; + + return VertexStore[idx]; +} + +PRIVATE STATIC Vector3 HatchModel::GetStoredNormal(Uint32 idx) { + if (idx < 0 || idx >= NumNormalStore) + return {}; + + return NormalStore[idx]; +} + +PRIVATE STATIC Vector2 HatchModel::GetStoredTexCoord(Uint32 idx) { + if (idx < 0 || idx >= NumTexCoordStore) + return {}; + + return TexCoordStore[idx]; +} + +PRIVATE STATIC Uint32 HatchModel::GetStoredColor(Uint32 idx) { + if (idx < 0 || idx >= NumColorStore) + return 0; + + return ColorStore[idx]; +} + +PRIVATE STATIC void HatchModel::ReadVertexIndices(Sint32* indices, Uint32 triangleCount, Stream* stream) { + for (Uint32 i = 0; i < triangleCount; i++) { + *indices++ = stream->ReadUInt32(); + *indices++ = stream->ReadUInt32(); + *indices++ = stream->ReadUInt32(); + } + + *indices = -1; +} + +PRIVATE STATIC Mesh* HatchModel::ReadMesh(IModel* model, Stream* stream) { + // Read mesh data + Mesh* mesh = new Mesh; + mesh->Name = stream->ReadString(); + mesh->VertexFlag = VertexType_Position; + + Uint8 flags = stream->ReadByte(); + if (flags & 1) + mesh->VertexFlag |= VertexType_Normal; + if (flags & 2) + mesh->VertexFlag |= VertexType_UV; + if (flags & 4) + mesh->VertexFlag |= VertexType_Color; + if (flags & 8) + mesh->MaterialIndex = stream->ReadByte(); + + Uint32 vertexCount = stream->ReadUInt32(); + if (!vertexCount) { + Log::Print(Log::LOG_ERROR, "Mesh \"%s\" has no vertices!", mesh->Name); + return nullptr; + } + + Uint32 triangleCount = stream->ReadUInt32(); + if (!triangleCount) { + Log::Print(Log::LOG_ERROR, "Mesh \"%s\" has no triangles!", mesh->Name); + return nullptr; + } + + Uint16 frameCount = stream->ReadUInt16(); + if (!frameCount) { + Log::Print(Log::LOG_ERROR, "Mesh \"%s\" has no frames!", mesh->Name); + return nullptr; + } + + mesh->VertexCount = vertexCount; + mesh->FrameCount = frameCount; + + mesh->PositionBuffer = (Vector3*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector3)); + + // Read vertices + Vector3* vert = mesh->PositionBuffer; + for (Uint16 i = 0; i < frameCount; i++) { + for (Uint32 j = 0; j < vertexCount; j++) + *vert++ = GetStoredVertex(stream->ReadUInt32()); + } + + // Read normals + if (mesh->VertexFlag & VertexType_Normal) { + mesh->NormalBuffer = (Vector3*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector3)); + + Vector3* norm = mesh->NormalBuffer; + for (Uint16 i = 0; i < frameCount; i++) + for (Uint32 j = 0; j < vertexCount; j++) + *norm++ = GetStoredNormal(stream->ReadUInt32()); + } + + // Read UVs + if (mesh->VertexFlag & VertexType_UV) { + mesh->UVBuffer = (Vector2*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector2)); + + Vector2* uv = mesh->UVBuffer; + for (Uint16 i = 0; i < frameCount; i++) + for (Uint32 j = 0; j < vertexCount; j++) + *uv++ = GetStoredTexCoord(stream->ReadUInt32()); + } + + // Read colors + if (mesh->VertexFlag & VertexType_Color) { + mesh->ColorBuffer = (Uint32*)Memory::Malloc(vertexCount * frameCount * sizeof(Uint32)); + + Uint32* colors = mesh->ColorBuffer; + for (Uint16 i = 0; i < frameCount; i++) + for (Uint32 j = 0; j < vertexCount; j++) + *colors++ = GetStoredColor(stream->ReadUInt32()); + } + + // Read vertex indices + mesh->VertexIndexCount = triangleCount * 3; + model->VertexIndexCount += mesh->VertexIndexCount; + + mesh->VertexIndexBuffer = (Sint32*)Memory::Malloc((mesh->VertexIndexCount + 1) * sizeof(Sint32)); + + ReadVertexIndices(mesh->VertexIndexBuffer, triangleCount, stream); + + return mesh; +} + +PUBLIC STATIC bool HatchModel::Convert(IModel* model, Stream* stream, const char* path) { + bool success = false; + + if (stream->ReadUInt32BE() != HATCH_MODEL_MAGIC) { + Log::Print(Log::LOG_ERROR, "Model not of Hatch type!"); + return false; + } + + Version = stream->ReadByte(); + + if (Version > 0) { + Log::Print(Log::LOG_ERROR, "Unsupported Hatch model version!"); + return false; + } + + Uint16 meshCount = stream->ReadUInt16(); + if (!meshCount) { + Log::Print(Log::LOG_ERROR, "Model has no meshes!"); + return false; + } + + Uint8 materialCount; + Uint16 animCount; + + Uint32 vertexDataOffset = stream->ReadUInt32(); + Uint32 normalDataOffset = stream->ReadUInt32(); + Uint32 uvDataOffset = stream->ReadUInt32(); + Uint32 colorDataOffset = stream->ReadUInt32(); + Uint32 meshDataOffset = stream->ReadUInt32(); + Uint32 materialDataOffset = stream->ReadUInt32(); + Uint32 animDataOffset = stream->ReadUInt32(); + + // Read vertex storage + stream->Seek(vertexDataOffset); + ReadVertexStore(stream); + + // Read normal storage + stream->Seek(normalDataOffset); + ReadNormalStore(stream); + + // Read UV storage + stream->Seek(uvDataOffset); + ReadTexCoordStore(stream); + + // Read color storage + stream->Seek(colorDataOffset); + ReadColorStore(stream); + + // Create model + model->Meshes = new Mesh*[meshCount]; + model->MeshCount = meshCount; + model->VertexCount = 0; + model->VertexPerFace = 3; + model->UseVertexAnimation = true; + + // Read materials + stream->Seek(materialDataOffset); + + materialCount = stream->ReadByte(); + + if (materialCount) { + model->MaterialCount = materialCount; + model->Materials = new Material*[materialCount]; + + const char *parentDirectory = StringUtils::GetPath(path); + + for (Uint8 i = 0; i < materialCount; i++) { + Material* material = ReadMaterial(stream, parentDirectory); + if (material == nullptr) { + for (unsigned j = 0; j <= i; j++) { + delete model->Materials[j]; + delete model->Materials; + model->Materials = nullptr; + } + + goto fail; + } + + model->Materials[i] = material; + } + } + + // Read animations + stream->Seek(animDataOffset); + + animCount = stream->ReadUInt16(); + + if (animCount) { + model->AnimationCount = animCount; + model->Animations = new ModelAnim*[animCount]; + + for (Uint16 i = 0; i < animCount; i++) { + ModelAnim* anim = new ModelAnim; + anim->Name = stream->ReadString(); + anim->StartFrame = stream->ReadUInt32(); + anim->Length = stream->ReadUInt32(); + model->Animations[i] = anim; + } + } + + // Read meshes + stream->Seek(meshDataOffset); + + for (Uint16 i = 0; i < meshCount; i++) { + Mesh* mesh = ReadMesh(model, stream); + if (mesh == nullptr) { + for (unsigned j = 0; j <= i; j++) { + delete model->Meshes[j]; + delete model->Meshes; + model->Meshes = nullptr; + } + + goto fail; + } + + model->Meshes[i] = mesh; + model->VertexCount += mesh->VertexCount; + } + + success = true; + +fail: + Memory::Free(VertexStore); + Memory::Free(NormalStore); + Memory::Free(TexCoordStore); + Memory::Free(ColorStore); + + VertexStore = nullptr; + NormalStore = nullptr; + TexCoordStore = nullptr; + ColorStore = nullptr; + + return success; +} + +static HashMap* vertexIDs; +static HashMap* normalIDs; +static HashMap* texCoordIDs; +static HashMap* colorIDs; + +static vector vertexList; +static vector normalList; +static vector texCoordList; +static vector colorList; + +PRIVATE STATIC void HatchModel::WriteMesh(Mesh* mesh, Stream* stream) { + Uint8 flags = 0; + if (mesh->VertexFlag & VertexType_Normal) + flags |= 1; + if (mesh->VertexFlag & VertexType_UV) + flags |= 2; + if (mesh->VertexFlag & VertexType_Color) + flags |= 4; + if (mesh->MaterialIndex != -1) + flags |= 8; + + stream->WriteString(mesh->Name); + stream->WriteByte(flags); + + if (flags & 8) + stream->WriteByte(mesh->MaterialIndex); + + Uint32 vertexCount = mesh->VertexCount; + Uint16 frameCount = mesh->FrameCount; + + stream->WriteUInt32(vertexCount); + stream->WriteUInt32(mesh->VertexIndexCount / 3); + stream->WriteUInt16(frameCount); + + // Write vertices + Vector3* vert = mesh->PositionBuffer; + for (Uint16 j = 0; j < frameCount; j++) { + for (Uint32 k = 0; k < vertexCount; k++) { + Uint32 key = vertexIDs->HashFunction(vert, sizeof(*vert)); + if (vertexIDs->Exists(key)) + stream->WriteUInt32(vertexIDs->Get(key)); + else { + vertexIDs->Put(key, (Uint32)(vertexList.size())); + stream->WriteUInt32(vertexList.size()); + vertexList.push_back(*vert); + } + vert++; + } + } + + // Write normals + if (flags & 1) { + Vector3* norm = mesh->NormalBuffer; + for (Uint16 j = 0; j < frameCount; j++) { + for (Uint32 k = 0; k < vertexCount; k++) { + Uint32 key = normalIDs->HashFunction(norm, sizeof(*norm)); + if (normalIDs->Exists(key)) + stream->WriteUInt32(normalIDs->Get(key)); + else { + normalIDs->Put(key, (Uint32)(normalList.size())); + stream->WriteUInt32(normalList.size()); + normalList.push_back(*norm); + } + norm++; + } + } + } + + // Write texture coordinates + if (flags & 2) { + Vector2* uv = mesh->UVBuffer; + for (Uint16 j = 0; j < frameCount; j++) { + for (Uint32 k = 0; k < vertexCount; k++) { + Uint32 key = texCoordIDs->HashFunction(uv, sizeof(*uv)); + if (texCoordIDs->Exists(key)) + stream->WriteUInt32(texCoordIDs->Get(key)); + else { + texCoordIDs->Put(key, (Uint32)(texCoordList.size())); + stream->WriteUInt32(texCoordList.size()); + texCoordList.push_back(*uv); + } + uv++; + } + } + } + + // Write colors + if (flags & 4) { + Uint32* color = mesh->ColorBuffer; + for (Uint16 j = 0; j < frameCount; j++) { + for (Uint32 k = 0; k < vertexCount; k++) { + HatchModel::WriteColorIndex(color, stream); + color++; + } + } + } + + // Write vertex indices + for (Uint32 j = 0; j < mesh->VertexIndexCount; j++) + stream->WriteUInt32(mesh->VertexIndexBuffer[j]); +} + +PRIVATE STATIC char* HatchModel::GetMaterialTextureName(const char* name, const char* parentDirectory) { + const char* result = strstr(name, parentDirectory); + if (result) { + size_t offset = strlen(parentDirectory); + while (name[offset] == '/') + offset++; + return StringUtils::Create(name + offset); + } + + return StringUtils::Duplicate(name); +} + +PRIVATE STATIC void HatchModel::WriteColorIndex(Uint32* color, Stream* stream) { + Uint32 key = colorIDs->HashFunction(color, sizeof(*color)); + if (colorIDs->Exists(key)) + stream->WriteUInt32(colorIDs->Get(key)); + else { + colorIDs->Put(key, (Uint32)(colorList.size())); + stream->WriteUInt32(colorList.size()); + colorList.push_back(*color); + } +} + +PRIVATE STATIC void HatchModel::WriteMaterial(Material* material, Stream* stream, const char* parentDirectory) { + stream->WriteString(material->Name); + + Uint8 flags = 0; + + if ((material->ColorDiffuse[0] != 1.0 + && material->ColorDiffuse[1] != 1.0 + && material->ColorDiffuse[2] != 1.0 + && material->ColorDiffuse[3] != 1.0) + || material->TextureDiffuseName) + flags |= 1; + + if ((material->ColorSpecular[0] != 1.0 + && material->ColorSpecular[1] != 1.0 + && material->ColorSpecular[2] != 1.0 + && material->ColorSpecular[3] != 1.0) + || material->TextureSpecularName) + flags |= 2; + + if ((material->ColorAmbient[0] != 1.0 + && material->ColorAmbient[1] != 1.0 + && material->ColorAmbient[2] != 1.0 + && material->ColorAmbient[3] != 1.0) + || material->TextureAmbientName) + flags |= 4; + + if ((material->ColorEmissive[0] != 1.0 + && material->ColorEmissive[1] != 1.0 + && material->ColorEmissive[2] != 1.0 + && material->ColorEmissive[3] != 1.0) + || material->TextureEmissiveName) + flags |= 8; + + if (material->Shininess != 0.0 || material->ShininessStrength != 1.0) + flags |= 16; + + if (material->Opacity != 1.0) + flags |= 32; + + Log::Print(Log::LOG_VERBOSE, "Material: %s", material->Name); + Log::Print(Log::LOG_VERBOSE, " - Flags: %d", flags); + + stream->WriteByte(flags); + + // Write diffuse + if (flags & 1) { + if (material->TextureDiffuseName) { + char* name = GetMaterialTextureName(material->TextureDiffuseName, parentDirectory); + + stream->WriteString(name); + + Log::Print(Log::LOG_VERBOSE, " - Diffuse texture: %s", name); + + Memory::Free(name); + } + else + stream->WriteByte('\0'); + + Uint32 color = ColorUtils::ToRGBA(material->ColorDiffuse); + + HatchModel::WriteColorIndex(&color, stream); + + Log::Print(Log::LOG_VERBOSE, " - Diffuse color: %f %f %f %f", + material->ColorDiffuse[0], + material->ColorDiffuse[1], + material->ColorDiffuse[2], + material->ColorDiffuse[3]); + } + + // Write specular + if (flags & 2) { + if (material->TextureSpecularName) { + char* name = GetMaterialTextureName(material->TextureSpecularName, parentDirectory); + + stream->WriteString(name); + + Log::Print(Log::LOG_VERBOSE, " - Specular texture: %s", name); + + Memory::Free(name); + } + else + stream->WriteByte('\0'); + + Uint32 color = ColorUtils::ToRGBA(material->ColorSpecular); + + HatchModel::WriteColorIndex(&color, stream); + + Log::Print(Log::LOG_VERBOSE, " - Specular color: %f %f %f %f", + material->ColorSpecular[0], + material->ColorSpecular[1], + material->ColorSpecular[2], + material->ColorSpecular[3]); + } + + // Write ambient + if (flags & 4) { + if (material->TextureAmbientName) { + char* name = GetMaterialTextureName(material->TextureAmbientName, parentDirectory); + + stream->WriteString(name); + + Log::Print(Log::LOG_VERBOSE, " - Ambient texture: %s", name); + + Memory::Free(name); + } + else + stream->WriteByte('\0'); + + Uint32 color = ColorUtils::ToRGBA(material->ColorAmbient); + + HatchModel::WriteColorIndex(&color, stream); + + Log::Print(Log::LOG_VERBOSE, " - Ambient color: %f %f %f %f", + material->ColorAmbient[0], + material->ColorAmbient[1], + material->ColorAmbient[2], + material->ColorAmbient[3]); + } + + // Write emissive + if (flags & 8) { + if (material->TextureEmissiveName) { + char* name = GetMaterialTextureName(material->TextureEmissiveName, parentDirectory); + + stream->WriteString(name); + + Log::Print(Log::LOG_VERBOSE, " - Emissive texture: %s", name); + + Memory::Free(name); + } + else + stream->WriteByte('\0'); + + Uint32 color = ColorUtils::ToRGBA(material->ColorEmissive); + + HatchModel::WriteColorIndex(&color, stream); + + Log::Print(Log::LOG_VERBOSE, " - Emissive color: %f %f %f %f", + material->ColorEmissive[0], + material->ColorEmissive[1], + material->ColorEmissive[2], + material->ColorEmissive[3]); + } + + // Write shininess + if (flags & 16) { + stream->WriteByte(material->Shininess * 0xFF); + stream->WriteByte(material->ShininessStrength * 0xFF); + + Log::Print(Log::LOG_VERBOSE, " - Shininess: %f", material->Shininess); + Log::Print(Log::LOG_VERBOSE, " - Shininess strength: %f", material->ShininessStrength); + } + + // Write opacity + if (flags & 32) { + stream->WriteByte(material->Opacity * 0xFF); + + Log::Print(Log::LOG_VERBOSE, " - Opacity: %f", material->Opacity); + } +} + +PUBLIC STATIC bool HatchModel::Save(IModel* model, const char* filename) { + Stream* stream = FileStream::New(filename, FileStream::WRITE_ACCESS); + if (!stream) { + Log::Print(Log::LOG_ERROR, "Couldn't open \"%s\"!", filename); + return false; + } + + stream->WriteUInt32BE(HATCH_MODEL_MAGIC); + stream->WriteByte(0); + + stream->WriteUInt16(model->MeshCount); + + Uint32 vertexDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 normalDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 uvDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 colorDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 meshDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 materialDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + Uint32 animDataOffsetPos = stream->Position(); stream->WriteUInt32(0x00000000); + + vertexIDs = new HashMap(NULL, 1024); + normalIDs = new HashMap(NULL, 1024); + texCoordIDs = new HashMap(NULL, 1024); + colorIDs = new HashMap(NULL, 1024); + + vertexList.clear(); + normalList.clear(); + texCoordList.clear(); + colorList.clear(); + + // Write meshes + size_t lastPos = stream->Position(); + stream->Seek(meshDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + Log::Print(Log::LOG_VERBOSE, "Mesh count: %d (%08X)", model->MeshCount, lastPos); + + for (size_t i = 0; i < model->MeshCount; i++) { + WriteMesh(model->Meshes[i], stream); + } + + // Write materials + lastPos = stream->Position(); + stream->Seek(materialDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + size_t numMaterials = model->MaterialCount; + + stream->WriteByte(numMaterials); + + Log::Print(Log::LOG_VERBOSE, "Material count: %d (%08X)", numMaterials, lastPos); + + const char *parentDirectory = StringUtils::GetPath(filename); + if (StringUtils::StartsWith(parentDirectory, "./")) + parentDirectory += 2; + if (StringUtils::StartsWith(parentDirectory, "Resources/")) + parentDirectory += 10; + + for (size_t i = 0; i < numMaterials; i++) { + WriteMaterial(model->Materials[i], stream, parentDirectory); + } + + // Write animations + lastPos = stream->Position(); + stream->Seek(animDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + stream->WriteByte(model->AnimationCount); + + Log::Print(Log::LOG_VERBOSE, "Animation count: %d (%08X)", model->AnimationCount, lastPos); + + for (size_t i = 0; i < model->AnimationCount; i++) { + ModelAnim* anim = model->Animations[i]; + stream->WriteString(anim->Name); + stream->WriteUInt32(anim->StartFrame); + stream->WriteUInt32(anim->Length); + } + + // Write stored vertices + lastPos = stream->Position(); + stream->Seek(vertexDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + size_t numVertices = vertexList.size(); + + stream->WriteUInt32(numVertices); + + Log::Print(Log::LOG_VERBOSE, "Vertex list size: %d (%08X)", numVertices, lastPos); + + for (size_t i = 0; i < numVertices; i++) { + Vector3 v = vertexList[i]; + stream->WriteInt64(v.X); + stream->WriteInt64(v.Y); + stream->WriteInt64(v.Z); + } + + // Write stored normals + lastPos = stream->Position(); + stream->Seek(normalDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + size_t numNormals = normalList.size(); + + stream->WriteUInt32(numNormals); + + Log::Print(Log::LOG_VERBOSE, "Normal list size: %d (%08X)", numNormals, lastPos); + + for (size_t i = 0; i < numNormals; i++) { + Vector3 n = normalList[i]; + stream->WriteInt64(n.X); + stream->WriteInt64(n.Y); + stream->WriteInt64(n.Z); + } + + // Write stored texture coordinates + lastPos = stream->Position(); + stream->Seek(uvDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + size_t numTexCoords = texCoordList.size(); + + stream->WriteUInt32(numTexCoords); + + Log::Print(Log::LOG_VERBOSE, "Texture coordinate list size: %d (%08X)", numTexCoords, lastPos); + + for (size_t i = 0; i < numTexCoords; i++) { + Vector2 t = texCoordList[i]; + stream->WriteInt64(t.X); + stream->WriteInt64(t.Y); + } + + // Write stored colors + lastPos = stream->Position(); + stream->Seek(colorDataOffsetPos); + stream->WriteUInt32(lastPos); + stream->Seek(lastPos); + + size_t numColors = colorList.size(); + + stream->WriteUInt32(numColors); + + Log::Print(Log::LOG_VERBOSE, "Color list size: %d (%08X)", numColors, lastPos); + + for (size_t i = 0; i < numColors; i++) { + Uint32 color = colorList[i]; + Uint8 rgba[4]; + ColorUtils::Separate(color, rgba); + stream->WriteByte(rgba[0]); + stream->WriteByte(rgba[1]); + stream->WriteByte(rgba[2]); + stream->WriteByte(rgba[3]); + } + + stream->Close(); + + delete vertexIDs; + delete normalIDs; + delete texCoordIDs; + delete colorIDs; + + return true; +} diff --git a/source/Engine/ResourceTypes/ModelFormats/Importer.cpp b/source/Engine/ResourceTypes/ModelFormats/Importer.cpp index 1604ef72..979e7521 100644 --- a/source/Engine/ResourceTypes/ModelFormats/Importer.cpp +++ b/source/Engine/ResourceTypes/ModelFormats/Importer.cpp @@ -14,7 +14,6 @@ class ModelImporter { #include #include #include -#include vector ModelImporter::MeshIDs; char* ModelImporter::ParentDirectory; @@ -55,7 +54,7 @@ static void CopyColors(float dest[4], aiColor4D& src) { } static char* GetString(aiString src) { - return StringUtils::Duplicate(src.C_Str()); + return StringUtils::Create(src.C_Str()); } static Matrix4x4* CopyMatrix(aiMatrix4x4 mat) { @@ -67,28 +66,6 @@ static Matrix4x4* CopyMatrix(aiMatrix4x4 mat) { return out; } -static Image* LoadImage(const char* path) { - Image* image = new Image(path); - - // Couldn't find an image, so try again, prefixing the parent path - if (!image->TexturePtr && ModelImporter::ParentDirectory) { - image->Dispose(); - - char* concat = StringUtils::ConcatPaths(ModelImporter::ParentDirectory, path); - image = new Image(concat); - - Memory::Free(concat); - } - - // Well, we tried - if (!image->TexturePtr) { - image->Dispose(); - image = nullptr; - } - - return image; -} - static AnimBehavior ConvertPrePostState(aiAnimBehaviour state) { switch (state) { case aiAnimBehaviour_CONSTANT: @@ -131,10 +108,11 @@ PRIVATE STATIC Mesh* ModelImporter::LoadMesh(IModel* imodel, struct aiMesh* ames Mesh* mesh = new Mesh; mesh->Name = GetString(amesh->mName); - mesh->NumVertices = numVertices; + mesh->VertexCount = numVertices; + mesh->FrameCount = 1; mesh->VertexIndexCount = numFaces * 3; - mesh->VertexIndexBuffer = (Sint16*)Memory::Malloc((mesh->VertexIndexCount + 1) * sizeof(Sint16)); + mesh->VertexIndexBuffer = (Sint32*)Memory::Malloc((mesh->VertexIndexCount + 1) * sizeof(Sint32)); mesh->MaterialIndex = (int)amesh->mMaterialIndex; @@ -207,28 +185,52 @@ PRIVATE STATIC Mesh* ModelImporter::LoadMesh(IModel* imodel, struct aiMesh* ames return mesh; } -PRIVATE STATIC Material* ModelImporter::LoadMaterial(IModel* imodel, struct aiMaterial* mat) { +PRIVATE STATIC Material* ModelImporter::LoadMaterial(IModel* imodel, struct aiMaterial* mat, unsigned i) { Material* material = new Material(); + aiString matName; + aiString texDiffuse; + aiString texSpecular; + aiString texAmbient; + aiString texEmissive; + aiColor4D colorDiffuse; aiColor4D colorSpecular; aiColor4D colorAmbient; aiColor4D colorEmissive; + ai_real shininess, shininessStrength, opacity; + unsigned int n = 1; + if (mat->Get(AI_MATKEY_NAME, matName) == AI_SUCCESS) + material->Name = GetString(matName); + else { + char temp[20]; + + snprintf(temp, sizeof temp, "Material %d", i); + + material->Name = StringUtils::Duplicate(temp); + } + if (mat->GetTexture(aiTextureType_DIFFUSE, 0, &texDiffuse) == AI_SUCCESS) - material->ImagePtr = LoadImage(texDiffuse.data); + material->TextureDiffuse = IModel::LoadMaterialImage(texDiffuse.data, ModelImporter::ParentDirectory); + if (mat->GetTexture(aiTextureType_SPECULAR, 0, &texSpecular) == AI_SUCCESS) + material->TextureSpecular = IModel::LoadMaterialImage(texSpecular.data, ModelImporter::ParentDirectory); + if (mat->GetTexture(aiTextureType_AMBIENT, 0, &texAmbient) == AI_SUCCESS) + material->TextureAmbient = IModel::LoadMaterialImage(texAmbient.data, ModelImporter::ParentDirectory); + if (mat->GetTexture(aiTextureType_EMISSIVE, 0, &texEmissive) == AI_SUCCESS) + material->TextureEmissive = IModel::LoadMaterialImage(texEmissive.data, ModelImporter::ParentDirectory); if (aiGetMaterialColor(mat, AI_MATKEY_COLOR_DIFFUSE, &colorDiffuse) == AI_SUCCESS) - CopyColors(material->Diffuse, colorDiffuse); + CopyColors(material->ColorDiffuse, colorDiffuse); if (aiGetMaterialColor(mat, AI_MATKEY_COLOR_SPECULAR, &colorSpecular) == AI_SUCCESS) - CopyColors(material->Specular, colorSpecular); + CopyColors(material->ColorSpecular, colorSpecular); if (aiGetMaterialColor(mat, AI_MATKEY_COLOR_AMBIENT, &colorAmbient) == AI_SUCCESS) - CopyColors(material->Ambient, colorAmbient); + CopyColors(material->ColorAmbient, colorAmbient); if (aiGetMaterialColor(mat, AI_MATKEY_COLOR_EMISSIVE, &colorEmissive) == AI_SUCCESS) - CopyColors(material->Emissive, colorEmissive); + CopyColors(material->ColorEmissive, colorEmissive); if (aiGetMaterialFloatArray(mat, AI_MATKEY_SHININESS, &shininess, &n) == AI_SUCCESS) material->Shininess = shininess; @@ -268,7 +270,7 @@ PRIVATE STATIC Skeleton* ModelImporter::LoadBones(IModel* imodel, Mesh* mesh, st Skeleton* skeleton = new Skeleton; skeleton->NumBones = amesh->mNumBones; - skeleton->NumVertices = mesh->NumVertices; + skeleton->NumVertices = mesh->VertexCount; skeleton->Bones = new MeshBone*[skeleton->NumBones]; skeleton->VertexWeights = (Uint32*)Memory::Calloc(skeleton->NumVertices, sizeof(Uint32)); skeleton->PositionBuffer = mesh->PositionBuffer; @@ -309,9 +311,8 @@ PRIVATE STATIC Skeleton* ModelImporter::LoadBones(IModel* imodel, Mesh* mesh, st return skeleton; } -PRIVATE STATIC ModelAnim* ModelImporter::LoadAnimation(IModel* imodel, struct aiAnimation* aanim) { - ModelAnim* anim = new ModelAnim; - anim->Name = GetString(aanim->mName); +PRIVATE STATIC SkeletalAnim* ModelImporter::LoadAnimation(IModel* imodel, ModelAnim* parentAnim, struct aiAnimation* aanim) { + SkeletalAnim* anim = new SkeletalAnim; anim->Channels.resize(aanim->mNumChannels); anim->NodeLookup = new HashMap(NULL, 256); // Might be enough @@ -322,11 +323,13 @@ PRIVATE STATIC ModelAnim* ModelImporter::LoadAnimation(IModel* imodel, struct ai double durationInSeconds = baseDuration / ticksPerSecond; - anim->Length = (int)baseDuration; anim->DurationInFrames = (int)(durationInSeconds * 60); anim->BaseDuration = baseDuration; anim->TicksPerSecond = ticksPerSecond; + parentAnim->StartFrame = 0; + parentAnim->Length = (int)baseDuration; + for (size_t i = 0; i < aanim->mNumChannels; i++) { struct aiNodeAnim* channel = aanim->mChannels[i]; NodeAnim* nodeAnim = new NodeAnim; @@ -374,8 +377,12 @@ PRIVATE STATIC bool ModelImporter::DoConversion(const struct aiScene* scene, IMo continue; } + int meshID = (int)meshCount; + ameshes.push_back(amesh); - MeshIDs.push_back(meshCount++); + MeshIDs.push_back(meshID); + + meshCount++; totalVertices += amesh->mNumVertices; } @@ -396,7 +403,7 @@ PRIVATE STATIC bool ModelImporter::DoConversion(const struct aiScene* scene, IMo imodel->Materials = new Material*[imodel->MaterialCount]; for (size_t i = 0; i < imodel->MaterialCount; i++) - imodel->Materials[i] = LoadMaterial(imodel, scene->mMaterials[i]); + imodel->Materials[i] = LoadMaterial(imodel, scene->mMaterials[i], i); } // Load meshes @@ -453,14 +460,22 @@ PRIVATE STATIC bool ModelImporter::DoConversion(const struct aiScene* scene, IMo } // Load animations - // FIXME: Doesn't seem to be working with Collada scenes for some reason. - // Might be an issue in Open Asset Importer? if (scene->HasAnimations()) { imodel->AnimationCount = scene->mNumAnimations; imodel->Animations = new ModelAnim*[imodel->AnimationCount]; - for (size_t i = 0; i < imodel->AnimationCount; i++) - imodel->Animations[i] = LoadAnimation(imodel, scene->mAnimations[i]); + for (size_t i = 0; i < imodel->AnimationCount; i++) { + struct aiAnimation* aanim = scene->mAnimations[i]; + + ModelAnim* parentAnim = new ModelAnim; + parentAnim->Name = GetString(aanim->mName); + + SkeletalAnim *skAnim = LoadAnimation(imodel, parentAnim, aanim); + skAnim->ParentAnim = parentAnim; + parentAnim->Skeletal = skAnim; + + imodel->Animations[i] = parentAnim; + } } return true; @@ -505,14 +520,7 @@ PUBLIC STATIC bool ModelImporter::Convert(IModel* model, Stream* stream, const c MeshIDs.clear(); ParentDirectory = StringUtils::GetPath(path); - bool success; - - Clock::Start(); - success = DoConversion(scene, model); - Log::Print(Log::LOG_VERBOSE, "Model load took %.3f ms", Clock::End()); - - if (!success) - model->Dispose(); + bool success = DoConversion(scene, model); Memory::Free(data); Memory::Free(ParentDirectory); diff --git a/source/Engine/ResourceTypes/ModelFormats/MD3Model.cpp b/source/Engine/ResourceTypes/ModelFormats/MD3Model.cpp new file mode 100644 index 00000000..55aa91c5 --- /dev/null +++ b/source/Engine/ResourceTypes/ModelFormats/MD3Model.cpp @@ -0,0 +1,334 @@ +#if INTERFACE +#include +#include +class MD3Model { +public: + static Sint32 Version; + static bool UseUVKeyframes; + static Sint32 DataEndOffset; + static vector MaterialNames; +}; +#endif + +#include +#include +#include +#include +#include +#include + +#define MD3_MODEL_MAGIC 0x49445033 // IDP3 + +#define MD3_BASE_VERSION 15 +#define MD3_EXTRA_VERSION 2038 + +#define MD3_XYZ_SCALE (1.0 / 64) + +#define MD3_MAX_TAGS 16 +#define MD3_MAX_SURFACES 32 +#define MD3_MAX_FRAMES 1024 +#define MD3_MAX_SHADERS 256 +#define MAX_QPATH 64 + +Sint32 MD3Model::Version; +bool MD3Model::UseUVKeyframes; +Sint32 MD3Model::DataEndOffset; +vector MD3Model::MaterialNames; + +PUBLIC STATIC bool MD3Model::IsMagic(Stream* stream) { + Uint32 magic = stream->ReadUInt32BE(); + + stream->Skip(-4); + + return magic == MD3_MODEL_MAGIC; +} + +PRIVATE STATIC void MD3Model::DecodeNormal(Uint16 index, float& x, float& y, float& z) { + unsigned latIdx = (index >> 8) & 0xFF; + unsigned lngIdx = index & 0xFF; + + float lat = latIdx * (M_PI / 128.0f); + float lng = lngIdx * (M_PI / 128.0f); + + x = cosf(lat) * sinf(lng); + y = sinf(lat) * sinf(lng); + z = cosf(lng); +} + +PRIVATE STATIC void MD3Model::ReadShader(Stream* stream) { + char name[MAX_QPATH + 1]; + memset(name, '\0', sizeof name); + stream->ReadBytes(name, MAX_QPATH); + + std::string shaderName = std::string(name); + + MaterialNames.push_back(shaderName); +} + +PRIVATE STATIC void MD3Model::ReadVerticesAndNormals(Vector3* vert, Vector3* norm, Sint32 vertexCount, Stream* stream) { + for (Sint32 i = 0; i < vertexCount; i++) { + // MD3 coordinate system is usually Z up and Y forward (I think.) + vert->X = stream->ReadInt16() * FP16_TO(MD3_XYZ_SCALE); + vert->Z = stream->ReadInt16() * FP16_TO(MD3_XYZ_SCALE); + vert->Y = stream->ReadInt16() * FP16_TO(MD3_XYZ_SCALE); + vert++; + + // Normal + float nx, ny, nz; + DecodeNormal(stream->ReadInt16(), nx, ny, nz); + norm->X = nx * 32767; + norm->Y = nz * 32767; // Not a typo; see above. + norm->Z = ny * 32767; + norm++; + } +} + +PRIVATE STATIC void MD3Model::ReadUVs(Vector2* uvs, Sint32 vertexCount, Stream* stream) { + for (Sint32 i = 0; i < vertexCount; i++) { + uvs->X = (int)(stream->ReadFloat() * 0x10000); + uvs->Y = (int)(stream->ReadFloat() * 0x10000); + uvs++; + } +} + +PRIVATE STATIC void MD3Model::ReadVertexIndices(Sint32* indices, Sint32 triangleCount, Stream* stream) { + for (Sint32 i = 0; i < triangleCount; i++) { + *indices++ = stream->ReadUInt32(); + *indices++ = stream->ReadUInt32(); + *indices++ = stream->ReadUInt32(); + } + + *indices = -1; +} + +PRIVATE STATIC Mesh* MD3Model::ReadSurface(IModel* model, Stream* stream, size_t surfaceDataOffset) { + Sint32 magic = stream->ReadUInt32BE(); + if (magic != MD3_MODEL_MAGIC) { + Log::Print(Log::LOG_ERROR, "Invalid magic for MD3 surface!"); + return nullptr; + } + + // Read mesh data + Mesh* mesh = new Mesh; + + // Read name + mesh->Name = (char *)Memory::Calloc(1, MAX_QPATH + 1); + + stream->ReadBytes(mesh->Name, MAX_QPATH); + + // Flags. Purpose seems unknown. + stream->ReadInt32(); + + Sint32 frameCount = stream->ReadInt32(); + Sint32 shaderCount = stream->ReadInt32(); + Sint32 vertexCount = stream->ReadInt32(); + Sint32 triangleCount = stream->ReadInt32(); + + Sint32 triangleDataOffset = stream->ReadInt32(); + Sint32 shaderDataOffset = stream->ReadInt32(); + Sint32 stDataOffset = stream->ReadInt32(); + Sint32 vertexDataOffset = stream->ReadInt32(); + + DataEndOffset = stream->ReadInt32(); + + mesh->VertexFlag = VertexType_Position | VertexType_Normal | VertexType_UV; + + mesh->VertexCount = vertexCount; + mesh->FrameCount = frameCount; + + mesh->PositionBuffer = (Vector3*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector3)); + mesh->NormalBuffer = (Vector3*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector3)); + mesh->UVBuffer = (Vector2*)Memory::Malloc(vertexCount * frameCount * sizeof(Vector2)); + + mesh->VertexIndexCount = triangleCount * 3; + model->VertexIndexCount += mesh->VertexIndexCount; + + mesh->VertexIndexBuffer = (Sint32*)Memory::Malloc((mesh->VertexIndexCount + 1) * sizeof(Sint32)); + + const size_t surfaceDataSize = sizeof(Sint16) * 4; + + // Read vertices and normals + Vector3* vert = mesh->PositionBuffer; + Vector3* norm = mesh->NormalBuffer; + + for (Sint32 i = 0; i < frameCount; i++) { + stream->Seek(surfaceDataOffset + vertexDataOffset + (i * vertexCount * surfaceDataSize)); + + ReadVerticesAndNormals(vert, norm, vertexCount, stream); + + vert += vertexCount; + norm += vertexCount; + } + + // Read UVs + Vector2* uv = mesh->UVBuffer; + + stream->Seek(surfaceDataOffset + stDataOffset); + + if (UseUVKeyframes) { + for (Sint32 i = 0; i < frameCount; i++) { + ReadUVs(uv, vertexCount, stream); + uv += vertexCount; + } + } + else { + ReadUVs(uv, vertexCount, stream); + + // Copy the values to other frames + for (Sint32 i = 0; i < vertexCount; i++) { + Vector2* uvA = &mesh->UVBuffer[i]; + + for (Sint32 j = 1; j < frameCount; j++) { + Vector2* uvB = &mesh->UVBuffer[i + (vertexCount * j)]; + uvB->X = uvA->X; + uvB->Y = uvA->X; + } + } + } + + // Read vertex indices + stream->Seek(surfaceDataOffset + triangleDataOffset); + + ReadVertexIndices(mesh->VertexIndexBuffer, triangleCount, stream); + + // Read shaders + const size_t shaderDataSize = (sizeof(Uint8) * 64) + sizeof(Sint32); + + if (shaderCount) { + if (shaderCount > MD3_MAX_SHADERS) { + Log::Print(Log::LOG_WARN, + "MD3 surface has a shader count higher than the usual (maximum is %d, but surface has %d)", + MD3_MAX_SHADERS, shaderCount); + } + + mesh->MaterialIndex = MaterialNames.size(); + } + + for (Sint32 i = 0; i < shaderCount; i++) { + stream->Seek(surfaceDataOffset + shaderDataOffset + (i * shaderDataSize)); + ReadShader(stream); + } + + return mesh; +} + +PUBLIC STATIC bool MD3Model::Convert(IModel* model, Stream* stream, const char* path) { + if (stream->ReadUInt32BE() != MD3_MODEL_MAGIC) { + Log::Print(Log::LOG_ERROR, "Model not of MD3 (Quake III) type!"); + return false; + } + + Version = stream->ReadInt32(); + + if (Version != MD3_BASE_VERSION && Version != MD3_EXTRA_VERSION) { + Log::Print(Log::LOG_ERROR, "Unknown MD3 model version!"); + return false; + } + + UseUVKeyframes = Version == MD3_EXTRA_VERSION; + + char name[MAX_QPATH + 1]; + memset(name, '\0', sizeof name); + stream->ReadBytes(name, MAX_QPATH); + + stream->ReadInt32(); // Flags. Purpose seems unknown. + + Sint32 frameCount = stream->ReadInt32(); + Sint32 tagCount = stream->ReadInt32(); + Sint32 surfCount = stream->ReadInt32(); + + if (!surfCount) { + Log::Print(Log::LOG_ERROR, "MD3 model has no surfaces!"); + return false; + } + + if (frameCount > MD3_MAX_FRAMES) { + Log::Print(Log::LOG_WARN, + "MD3 model has a frame count higher than the usual (maximum is %d, but model has %d)", + MD3_MAX_FRAMES, frameCount); + } + if (tagCount > MD3_MAX_TAGS) { + Log::Print(Log::LOG_WARN, + "MD3 model has a tag count higher than the usual (maximum is %d, but model has %d)", + MD3_MAX_TAGS, tagCount); + } + if (surfCount > MD3_MAX_SURFACES) { + Log::Print(Log::LOG_WARN, + "MD3 model has a surface count higher than the usual (maximum is %d, but model has %d)", + MD3_MAX_SURFACES, surfCount); + } + + stream->ReadInt32(); // Skin count. Apparently a leftover from the previous MD2 format. + + Sint32 frameDataOffset = stream->ReadInt32(); + Sint32 tagDataOffset = stream->ReadInt32(); + Sint32 surfaceDataOffset = stream->ReadInt32(); + Sint32 dataEndOffset = stream->ReadInt32(); + + // Create model + model->Meshes = new Mesh*[surfCount]; + model->MeshCount = surfCount; + model->VertexCount = 0; + model->VertexPerFace = 3; + model->UseVertexAnimation = true; + + // Read surfaces + stream->Seek(surfaceDataOffset); + + DataEndOffset = 0; + MaterialNames.clear(); + + size_t offset = surfaceDataOffset; + + Sint32 maxFrameCount = frameCount; + + for (Sint32 i = 0; i < surfCount; i++) { + Mesh* mesh = ReadSurface(model, stream, offset); + if (mesh == nullptr) { + for (signed j = 0; j <= i; j++) { + delete model->Meshes[j]; + delete model->Meshes; + model->Meshes = nullptr; + } + return false; + } + + model->Meshes[i] = mesh; + model->VertexCount += mesh->VertexCount; + + if (mesh->FrameCount > maxFrameCount) + maxFrameCount = mesh->FrameCount; + + offset += DataEndOffset; + + stream->Seek(offset); + } + + // Add materials + size_t numMaterials = MaterialNames.size(); + if (numMaterials) { + model->MaterialCount = numMaterials; + model->Materials = new Material*[numMaterials]; + + const char *parentDirectory = StringUtils::GetPath(path); + + for (size_t i = 0; i < numMaterials; i++) { + Material* material = new Material(); + material->Name = StringUtils::Create(MaterialNames[i]); + material->TextureDiffuse = IModel::LoadMaterialImage(MaterialNames[i], parentDirectory); + if (material->TextureDiffuse) + material->TextureDiffuseName = StringUtils::Duplicate(material->TextureDiffuse->Filename); + model->Materials[i] = material; + } + + MaterialNames.clear(); + } + + model->AnimationCount = 1; + model->Animations = new ModelAnim*[1]; + model->Animations[0] = new ModelAnim; + model->Animations[0]->Name = StringUtils::Duplicate("Vertex Animation"); + model->Animations[0]->Length = maxFrameCount; + + return true; +} diff --git a/source/Engine/ResourceTypes/ModelFormats/RSDKModel.cpp b/source/Engine/ResourceTypes/ModelFormats/RSDKModel.cpp new file mode 100644 index 00000000..accd781f --- /dev/null +++ b/source/Engine/ResourceTypes/ModelFormats/RSDKModel.cpp @@ -0,0 +1,139 @@ +#if INTERFACE +#include +#include +class RSDKModel { +public: + +}; +#endif + +#include +#include +#include +#include +#include +#include + +#define RSDK_MODEL_MAGIC 0x4D444C00 // MDL0 + +PUBLIC STATIC bool RSDKModel::IsMagic(Stream* stream) { + Uint32 magic = stream->ReadUInt32BE(); + + stream->Skip(-4); + + return magic == RSDK_MODEL_MAGIC; +} + +PUBLIC STATIC bool RSDKModel::Convert(IModel* model, Stream* stream) { + if (stream->ReadUInt32BE() != RSDK_MODEL_MAGIC) { + Log::Print(Log::LOG_ERROR, "Model not of RSDK type!"); + return false; + } + + Uint8 vertexFlag = stream->ReadByte(); + + model->VertexPerFace = stream->ReadByte(); + + Uint16 vertexCount = stream->ReadUInt16(); + Uint16 frameCount = stream->ReadUInt16(); + + // We only need one mesh for RSDK models + Mesh* mesh = new Mesh; + model->Meshes = new Mesh*[1]; + model->Meshes[0] = mesh; + model->MeshCount = 1; + model->VertexCount = vertexCount; + + mesh->VertexCount = vertexCount; + mesh->FrameCount = frameCount; + + mesh->VertexFlag = vertexFlag; + mesh->PositionBuffer = (Vector3*)Memory::Malloc(mesh->VertexCount * frameCount * sizeof(Vector3)); + + if (vertexFlag & VertexType_Normal) + mesh->NormalBuffer = (Vector3*)Memory::Malloc(mesh->VertexCount * frameCount * sizeof(Vector3)); + + if (vertexFlag & VertexType_UV) + mesh->UVBuffer = (Vector2*)Memory::Malloc(mesh->VertexCount * frameCount * sizeof(Vector2)); + + if (vertexFlag & VertexType_Color) + mesh->ColorBuffer = (Uint32*)Memory::Malloc(mesh->VertexCount * frameCount * sizeof(Uint32)); + + // Read UVs + if (vertexFlag & VertexType_UV) { + int uvX, uvY; + for (size_t i = 0; i < mesh->VertexCount; i++) { + Vector2* uv = &mesh->UVBuffer[i]; + uv->X = uvX = (int)(stream->ReadFloat() * 0x10000); + uv->Y = uvY = (int)(stream->ReadFloat() * 0x10000); + // Copy the values to other frames + for (size_t f = 1; f < frameCount; f++) { + uv += mesh->VertexCount; + uv->X = uvX; + uv->Y = uvY; + } + } + } + // Read Colors + if (vertexFlag & VertexType_Color) { + Uint32* colorPtr, color; + for (size_t i = 0; i < mesh->VertexCount; i++) { + colorPtr = &mesh->ColorBuffer[i]; + *colorPtr = color = stream->ReadUInt32(); + // Copy the value to other frames + for (size_t f = 1; f < frameCount; f++) { + colorPtr += mesh->VertexCount; + *colorPtr = color; + } + } + } + + model->Materials = nullptr; + model->Animations = nullptr; + model->BaseArmature = nullptr; + model->GlobalInverseMatrix = nullptr; + model->UseVertexAnimation = true; + + model->AnimationCount = 1; + model->Animations = new ModelAnim*[1]; + model->Animations[0] = new ModelAnim; + model->Animations[0]->Name = StringUtils::Duplicate("Vertex Animation"); + model->Animations[0]->Length = frameCount; + + model->VertexIndexCount = stream->ReadInt16(); + mesh->VertexIndexCount = model->VertexIndexCount; + mesh->VertexIndexBuffer = (Sint32*)Memory::Malloc((model->VertexIndexCount + 1) * sizeof(Sint32)); + + for (size_t i = 0; i < model->VertexIndexCount; i++) + mesh->VertexIndexBuffer[i] = stream->ReadInt16(); + mesh->VertexIndexBuffer[model->VertexIndexCount] = -1; + + if (vertexFlag & VertexType_Normal) { + Vector3* vert = mesh->PositionBuffer; + Vector3* norm = mesh->NormalBuffer; + size_t totalVertexCount = mesh->VertexCount * frameCount; + for (size_t v = 0; v < totalVertexCount; v++) { + vert->X = (int)(stream->ReadFloat() * 0x10000); + vert->Y = (int)(stream->ReadFloat() * 0x10000); + vert->Z = (int)(stream->ReadFloat() * 0x10000); + vert++; + + norm->X = (int)(stream->ReadFloat() * 0x10000); + norm->Y = (int)(stream->ReadFloat() * 0x10000); + norm->Z = (int)(stream->ReadFloat() * 0x10000); + norm++; + } + } + else { + Vector3* vert = mesh->PositionBuffer; + size_t totalVertexCount = mesh->VertexCount * frameCount; + for (size_t v = 0; v < totalVertexCount; v++) { + vert->X = (int)(stream->ReadFloat() * 0x10000); + vert->Y = (int)(stream->ReadFloat() * 0x10000); + vert->Z = (int)(stream->ReadFloat() * 0x10000); + vert++; + } + } + + return true; +} diff --git a/source/Engine/ResourceTypes/ResourceManager.cpp b/source/Engine/ResourceTypes/ResourceManager.cpp index a650b8fd..cfc5c1b1 100644 --- a/source/Engine/ResourceTypes/ResourceManager.cpp +++ b/source/Engine/ResourceTypes/ResourceManager.cpp @@ -44,25 +44,15 @@ HashMap* ResourceRegistry = NULL; bool ResourceManager::UsingDataFolder = true; bool ResourceManager::UsingModPack = false; -PUBLIC STATIC void ResourceManager::PrefixResourcePath(char* out, const char* path) { - #if 0 - sprintf(out, "%s", path); - // #elif defined(MACOSX_APP_BUNDLE) - // sprintf(out, "%s", path); - #elif defined(SWITCH_ROMFS) - sprintf(out, "romfs:/%s", path); - #elif defined(ANDROID) - sprintf(out, "Resources/%s", path); - #else - sprintf(out, "Resources/%s", path); - #endif +PUBLIC STATIC void ResourceManager::PrefixResourcePath(char* out, size_t outSize, const char* path) { + snprintf(out, outSize, "Resources/%s", path); } -PUBLIC STATIC void ResourceManager::PrefixParentPath(char* out, const char* path) { - #if defined(SWITCH_ROMFS) - sprintf(out, "romfs:/%s", path); - #else - sprintf(out, "%s", path); - #endif +PUBLIC STATIC void ResourceManager::PrefixParentPath(char* out, size_t outSize, const char* path) { +#if defined(SWITCH_ROMFS) + snprintf(out, outSize, "romfs:/%s", path); +#else + snprintf(out, outSize, "%s", path); +#endif } PUBLIC STATIC void ResourceManager::Init(const char* filename) { @@ -99,7 +89,7 @@ PUBLIC STATIC void ResourceManager::Load(const char* filename) { // Load directly from Resource folder char resourcePath[4096]; - ResourceManager::PrefixParentPath(resourcePath, filename); + ResourceManager::PrefixParentPath(resourcePath, sizeof resourcePath, filename); SDLStream* dataTableStream = SDLStream::New(resourcePath, SDLStream::READ_ACCESS); if (!dataTableStream) { @@ -143,7 +133,7 @@ PUBLIC STATIC void ResourceManager::Load(const char* filename) { } PUBLIC STATIC bool ResourceManager::LoadResource(const char* filename, Uint8** out, size_t* size) { Uint8* memory; - char resourcePath[256]; + char resourcePath[4096]; ResourceRegistryItem item; if (ResourceManager::UsingDataFolder && !ResourceManager::UsingModPack) @@ -246,7 +236,7 @@ PUBLIC STATIC bool ResourceManager::LoadResource(const char* filename, Uint8** return true; DATA_FOLDER: - ResourceManager::PrefixResourcePath(resourcePath, filename); + ResourceManager::PrefixResourcePath(resourcePath, sizeof resourcePath, filename); SDL_RWops* rw = SDL_RWFromFile(resourcePath, "rb"); if (!rw) { @@ -273,7 +263,7 @@ PUBLIC STATIC bool ResourceManager::LoadResource(const char* filename, Uint8** return true; } PUBLIC STATIC bool ResourceManager::ResourceExists(const char* filename) { - char resourcePath[256]; + char resourcePath[4096]; if (ResourceManager::UsingDataFolder && !ResourceManager::UsingModPack) goto DATA_FOLDER; @@ -286,7 +276,7 @@ PUBLIC STATIC bool ResourceManager::ResourceExists(const char* filename) { return true; DATA_FOLDER: - ResourceManager::PrefixResourcePath(resourcePath, filename); + ResourceManager::PrefixResourcePath(resourcePath, sizeof resourcePath, filename); SDL_RWops* rw = SDL_RWFromFile(resourcePath, "rb"); if (!rw) { diff --git a/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp b/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp index e9420052..78df81d6 100644 --- a/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp +++ b/source/Engine/ResourceTypes/SceneFormats/HatchSceneReader.cpp @@ -39,10 +39,6 @@ Uint32 HatchSceneReader::Magic = 0x4E435348; // HSCN #define HSCN_FLIPY_MASK 0x00002000U #define HSCN_FXYID_MASK 0x00003FFFU // Max. 4096 tiles -#define TILE_FLIPX_MASK 0x80000000U -#define TILE_FLIPY_MASK 0x40000000U -#define TILE_IDENT_MASK 0x00FFFFFFU // Max. 16777216 tiles - PUBLIC STATIC bool HatchSceneReader::Read(const char* filename, const char* parentFolder) { Stream* r = ResourceStream::New(filename); if (!r) { @@ -123,7 +119,7 @@ PRIVATE STATIC SceneLayer HatchSceneReader::ReadLayer(Stream* r) { size_t nameBufLen = sizeof(layer.Name); memset(layer.Name, 0x00, nameBufLen); - layer.Flags = SceneLayer::FLAGS_COLLIDEABLE | SceneLayer::FLAGS_NO_REPEAT_X | SceneLayer::FLAGS_NO_REPEAT_Y; + layer.Flags = SceneLayer::FLAGS_COLLIDEABLE; layer.Visible = true; // Copy its name @@ -353,6 +349,7 @@ PRIVATE STATIC void HatchSceneReader::LoadTileset(const char* parentFolder) { info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = (int)tileSprite->Animations[0].Frames.size(); + info.TilesetID = Scene::Tilesets.size(); Scene::TileSpriteInfos.push_back(info); tileSprite->AddFrame(0, @@ -367,6 +364,7 @@ PRIVATE STATIC void HatchSceneReader::LoadTileset(const char* parentFolder) { info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = (int)tileSprite->Animations[0].Frames.size(); + info.TilesetID = Scene::Tilesets.size(); Scene::TileSpriteInfos.push_back(info); tileSprite->AddFrame(0, 0, 0, 1, 1, 0, 0); diff --git a/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp b/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp index 30bba007..b24fc72b 100644 --- a/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp +++ b/source/Engine/ResourceTypes/SceneFormats/RSDKSceneReader.cpp @@ -252,13 +252,10 @@ PRIVATE STATIC SceneLayer RSDKSceneReader::ReadLayer(Stream* r) { if (layer.Name[0] == 'F' && layer.Name[1] == 'G') layer.Flags |= SceneLayer::FLAGS_COLLIDEABLE; - if (strcmp(layer.Name, "Move") == 0) { - layer.Flags |= SceneLayer::FLAGS_NO_REPEAT_X | SceneLayer::FLAGS_NO_REPEAT_Y; - // layer.Flags |= SceneLayer::FLAGS_NO_REPEAT_X | SceneLayer::FLAGS_NO_REPEAT_Y; + if (strcmp(layer.Name, "Move") != 0) { + layer.Flags |= SceneLayer::FLAGS_REPEAT_X | SceneLayer::FLAGS_REPEAT_Y; } - // layer.Flags |= SceneLayer::FLAGS_NO_REPEAT_X | SceneLayer::FLAGS_NO_REPEAT_Y; - layer.DrawGroup = DrawGroup & 0xF; if (DrawGroup & 0x10) layer.Visible = false; @@ -558,16 +555,16 @@ PUBLIC STATIC bool RSDKSceneReader::Read(Stream* r, const char* parentFolder) { // Load Tileset and copy palette LoadTileset(parentFolder); - char stageConfigFilename[256]; + const char* gameConfigFilename = "Game/GameConfig.bin"; // Load GameConfig palettes - sprintf(stageConfigFilename, "Game/GameConfig.bin"); - if (ResourceManager::ResourceExists(stageConfigFilename)) - GameConfig_GetColors(stageConfigFilename); + if (ResourceManager::ResourceExists(gameConfigFilename)) + GameConfig_GetColors(gameConfigFilename); else - Log::Print(Log::LOG_WARN, "No GameConfig at '%s'!", stageConfigFilename); + Log::Print(Log::LOG_WARN, "No GameConfig at '%s'!", gameConfigFilename); // Load StageConfig palettes - sprintf(stageConfigFilename, "%sStageConfig.bin", parentFolder); + char stageConfigFilename[4096]; + snprintf(stageConfigFilename, sizeof stageConfigFilename, "%sStageConfig.bin", parentFolder); if (ResourceManager::ResourceExists(stageConfigFilename)) StageConfig_GetColors(stageConfigFilename); else @@ -619,6 +616,7 @@ PRIVATE STATIC void RSDKSceneReader::LoadTileset(const char* parentFolder) { info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = i; + info.TilesetID = Scene::Tilesets.size(); Scene::TileSpriteInfos.push_back(info); } diff --git a/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp b/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp index 3a130cde..a1180433 100644 --- a/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp +++ b/source/Engine/ResourceTypes/SceneFormats/TiledMapReader.cpp @@ -185,13 +185,7 @@ PRIVATE STATIC void TiledMapReader::ParsePropertyNode(XMLNode* node, HashMapattributes.Get("name"); - char* scene_attribute_name = (char*)malloc(property_name.Length + 1); - memcpy(scene_attribute_name, property_name.Start, property_name.Length); - scene_attribute_name[property_name.Length] = 0; - - properties->Put(scene_attribute_name, TiledMapReader::ParseProperty(node)); - - free(scene_attribute_name); + properties->Put(property_name.ToString().c_str(), TiledMapReader::ParseProperty(node)); } PRIVATE STATIC ObjArray* TiledMapReader::ParsePolyPoints(XMLNode* node) { @@ -199,9 +193,7 @@ PRIVATE STATIC ObjArray* TiledMapReader::ParsePolyPoints(XMLNode* node) { return nullptr; Token points_token = node->attributes.Get("points"); - char* points_text = (char*)malloc(points_token.Length + 1); - memcpy(points_text, points_token.Start, points_token.Length); - points_text[points_token.Length] = 0; + char* points_text = StringUtils::Create(points_token); ObjArray* array = NewArray(); @@ -219,7 +211,7 @@ PRIVATE STATIC ObjArray* TiledMapReader::ParsePolyPoints(XMLNode* node) { token = strtok(NULL, " "); } - free(points_text); + Memory::Free(points_text); return array; } @@ -251,6 +243,7 @@ PRIVATE STATIC Tileset* TiledMapReader::ParseTilesetImage(XMLNode* node, int fir info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = (int)tileSprite->Animations[0].Frames.size(); + info.TilesetID = Scene::Tilesets.size(); Scene::TileSpriteInfos.push_back(info); tileSprite->AddFrame(0, 0, 0, 1, 1, 0, 0); @@ -261,6 +254,7 @@ PRIVATE STATIC Tileset* TiledMapReader::ParseTilesetImage(XMLNode* node, int fir info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = (int)tileSprite->Animations[0].Frames.size(); + info.TilesetID = Scene::Tilesets.size(); Scene::TileSpriteInfos.push_back(info); tileSprite->AddFrame(0, @@ -449,7 +443,7 @@ PUBLIC STATIC void TiledMapReader::Read(const char* sourceF, const char* parentF scenelayer.RelativeY = 0x100; scenelayer.ConstantY = 0x00; - scenelayer.Flags = SceneLayer::FLAGS_COLLIDEABLE | SceneLayer::FLAGS_NO_REPEAT_X | SceneLayer::FLAGS_NO_REPEAT_Y; + scenelayer.Flags = SceneLayer::FLAGS_COLLIDEABLE; scenelayer.DrawGroup = 0; scenelayer.Properties = layer_properties; @@ -498,12 +492,8 @@ PUBLIC STATIC void TiledMapReader::Read(const char* sourceF, const char* parentF Token object_type = object->attributes.Get("name"); float object_x = XMLParser::TokenToNumber(object->attributes.Get("x")); float object_y = XMLParser::TokenToNumber(object->attributes.Get("y")); - char object_type_string[256]; - - strncpy(object_type_string, object_type.Start, object_type.Length); - object_type_string[object_type.Length] = 0; - ObjectList* objectList = Scene::GetStaticObjectList(object_type_string); + ObjectList* objectList = Scene::GetStaticObjectList(object_type.ToString().c_str()); if (objectList->SpawnFunction) { ScriptEntity* obj = (ScriptEntity*)objectList->Spawn(); if (!obj) diff --git a/source/Engine/ResourceTypes/SoundFormats/OGG.cpp b/source/Engine/ResourceTypes/SoundFormats/OGG.cpp index 04ab02d7..cf1f6bda 100644 --- a/source/Engine/ResourceTypes/SoundFormats/OGG.cpp +++ b/source/Engine/ResourceTypes/SoundFormats/OGG.cpp @@ -89,7 +89,7 @@ PUBLIC STATIC SoundFormat* OGG::Load(const char* filename) { } #ifdef USING_LIBOGG - ogg = new (nothrow) OGG; + ogg = new (std::nothrow) OGG; if (!ogg) { goto OGG_Load_FAIL; } @@ -152,20 +152,15 @@ PUBLIC STATIC SoundFormat* OGG::Load(const char* filename) { goto OGG_Load_SUCCESS; #else - size_t fileLength; - void* fileData; - ogg = new (nothrow) OGG; + ogg = new (std::nothrow) OGG; if (!ogg) { goto OGG_Load_FAIL; } - // ogg->StreamPtr = stream; - { vorbis = (VorbisGroup*)ogg->Vorbis; - size_t fileLength = stream->Length(); void* fileData = malloc(fileLength); stream->ReadBytes(fileData, fileLength); @@ -268,7 +263,8 @@ PUBLIC STATIC SoundFormat* OGG::Load(const char* filename) { ogg = NULL; OGG_Load_SUCCESS: - stream->Close(); + if (stream) + stream->Close(); return ogg; } diff --git a/source/Engine/ResourceTypes/SoundFormats/WAV.cpp b/source/Engine/ResourceTypes/SoundFormats/WAV.cpp index 548546ee..6c6d2730 100644 --- a/source/Engine/ResourceTypes/SoundFormats/WAV.cpp +++ b/source/Engine/ResourceTypes/SoundFormats/WAV.cpp @@ -56,7 +56,7 @@ PUBLIC STATIC SoundFormat* WAV::Load(const char* filename) { goto WAV_Load_FAIL; } - wav = new (nothrow) WAV; + wav = new (std::nothrow) WAV; if (!wav) { goto WAV_Load_FAIL; } diff --git a/source/Engine/Scene.cpp b/source/Engine/Scene.cpp index ce5c23ce..39984e1d 100644 --- a/source/Engine/Scene.cpp +++ b/source/Engine/Scene.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -104,17 +105,12 @@ class Scene { static int Filter; - static vector ListData; - static vector ListCategory; - static int ListPos; - static char CurrentFolder[16]; - static char CurrentID[16]; - static char CurrentSpriteFolder[16]; - static char CurrentCategory[16]; + static int CurrentSceneInList; + static char CurrentFolder[256]; + static char CurrentID[256]; + static char CurrentSpriteFolder[256]; + static char CurrentCategory[256]; static int ActiveCategory; - static int CategoryCount; - static int ListCount; - static int StageCount; static int DebugMode; @@ -166,7 +162,7 @@ class Scene { #include #include #include -#include +#include #include #include #include @@ -247,17 +243,12 @@ int Scene::Minutes = 0; int Scene::Filter = 0xFF; // Scene list variables -vector Scene::ListData; -vector Scene::ListCategory; -int Scene::ListPos; -char Scene::CurrentFolder[16]; -char Scene::CurrentID[16]; -char Scene::CurrentSpriteFolder[16]; -char Scene::CurrentCategory[16]; +int Scene::CurrentSceneInList; +char Scene::CurrentFolder[256]; +char Scene::CurrentID[256]; +char Scene::CurrentSpriteFolder[256]; +char Scene::CurrentCategory[256]; int Scene::ActiveCategory; -int Scene::CategoryCount; -int Scene::ListCount; -int Scene::StageCount; // Debug mode variables int Scene::DebugMode; @@ -325,19 +316,8 @@ void UpdateObjectEarly(Entity* ent) { elapsed = Clock::GetTicks() - elapsed; - if (ent->List) { - ObjectList* list = ent->List; - double count = list->AverageUpdateEarlyItemCount; - if (count < 60.0 * 60.0) { - count += 1.0; - if (count == 1.0) - list->AverageUpdateEarlyTime = elapsed; - else - list->AverageUpdateEarlyTime = - list->AverageUpdateEarlyTime + (elapsed - list->AverageUpdateEarlyTime) / count; - list->AverageUpdateEarlyItemCount = count; - } - } + if (ent->List) + ent->List->Performance.EarlyUpdate.DoAverage(elapsed); } void UpdateObjectLate(Entity* ent) { if (Scene::Paused && ent->Pauseable && ent->Activity != ACTIVE_PAUSED && ent->Activity != ACTIVE_ALWAYS) @@ -353,19 +333,8 @@ void UpdateObjectLate(Entity* ent) { elapsed = Clock::GetTicks() - elapsed; - if (ent->List) { - ObjectList* list = ent->List; - double count = list->AverageUpdateLateItemCount; - if (count < 60.0 * 60.0) { - count += 1.0; - if (count == 1.0) - list->AverageUpdateLateTime = elapsed; - else - list->AverageUpdateLateTime = - list->AverageUpdateLateTime + (elapsed - list->AverageUpdateLateTime) / count; - list->AverageUpdateLateItemCount = count; - } - } + if (ent->List) + ent->List->Performance.LateUpdate.DoAverage(elapsed); } void UpdateObject(Entity* ent) { if (Scene::Paused && ent->Pauseable && ent->Activity != ACTIVE_PAUSED && ent->Activity != ACTIVE_ALWAYS) @@ -486,19 +455,8 @@ void UpdateObject(Entity* ent) { elapsed = Clock::GetTicks() - elapsed; - if (ent->List) { - ObjectList* list = ent->List; - double count = list->AverageUpdateItemCount; - if (count < 60.0 * 60.0) { - count += 1.0; - if (count == 1.0) - list->AverageUpdateTime = elapsed; - else - list->AverageUpdateTime = - list->AverageUpdateTime + (elapsed - list->AverageUpdateTime) / count; - list->AverageUpdateItemCount = count; - } - } + if (ent->List) + ent->List->Performance.Update.DoAverage(elapsed); ent->WasOffScreen = false; } @@ -673,22 +631,40 @@ PUBLIC STATIC void Scene::OnEvent(Uint32 event) { } // Scene List Functions -PUBLIC STATIC void Scene::SetScene(const char* categoryName, const char* sceneName) { - for (int i = 0; i < Scene::CategoryCount; ++i) { - if (!strcmp(Scene::ListCategory[i].name, categoryName)) { - Scene::ActiveCategory = i; - Scene::ListPos = Scene::ListCategory[i].sceneOffsetStart; - - for (int s = 0; s < Scene::ListCategory[i].sceneCount; ++s) { - if (!strcmp(Scene::ListData[Scene::ListCategory[i].sceneOffsetStart + s].name, sceneName)) { - Scene::ListPos = Scene::ListCategory[i].sceneOffsetStart + s; - break; - } - } +PUBLIC STATIC void Scene::SetCurrent(const char* categoryName, const char* sceneName) { + int categoryID = SceneInfo::GetCategoryID(categoryName); + if (categoryID < 0) + return; - break; - } - } + SceneListCategory& category = SceneInfo::Categories[categoryID]; + if (!SceneInfo::IsEntryValid(category.OffsetStart)) + return; + + Scene::ActiveCategory = categoryID; + + int entryID = SceneInfo::GetEntryIDWithinRange(category.OffsetStart, category.OffsetEnd, sceneName); + if (entryID != -1) + Scene::CurrentSceneInList = entryID; + else + Scene::CurrentSceneInList = category.OffsetStart; +} +PUBLIC STATIC void Scene::SetInfoFromCurrentID() { + if (!SceneInfo::IsCategoryValid(Scene::ActiveCategory)) + return; + + SceneListCategory& category = SceneInfo::Categories[Scene::ActiveCategory]; + size_t entryID = (size_t)Scene::CurrentSceneInList; + if (Scene::CurrentSceneInList >= category.OffsetEnd) + return; + + SceneListEntry& scene = SceneInfo::Entries[entryID]; + + strcpy(Scene::CurrentFolder, scene.Folder); + strcpy(Scene::CurrentID, scene.ID); + strcpy(Scene::CurrentSpriteFolder, scene.SpriteFolder); + strcpy(Scene::CurrentCategory, category.Name); + + Scene::CurrentSceneInList = entryID; } // Scene Lifecycle @@ -1124,19 +1100,8 @@ PUBLIC STATIC void Scene::RenderView(int viewIndex, bool doPerf) { elapsed = Clock::GetTicks() - elapsed; - if (ent->List) { - ObjectList* list = ent->List; - double count = list->AverageRenderItemCount; - if (count < 60.0 * 60.0) { - count += 1.0; - if (count == 1.0) - list->AverageRenderTime = elapsed; - else - list->AverageRenderTime = - list->AverageRenderTime + (elapsed - list->AverageRenderTime) / count; - list->AverageRenderItemCount = count; - } - } + if (ent->List) + ent->List->Performance.Render.DoAverage(elapsed); } } objectTime = Clock::GetTicks() - objectTime; @@ -1662,28 +1627,12 @@ PUBLIC STATIC void Scene::LoadScene(const char* filename) { TiledMapReader::Read(filename, pathParent); } - // Prepare tile collisions InitTileCollisions(); + SetInfoFromCurrentID(); - // Load scene info and tile collisions - if (Scene::ListData.size()) { - SceneListEntry scene = Scene::ListData[Scene::ListPos]; - - strcpy(Scene::CurrentFolder, scene.folder); - strcpy(Scene::CurrentID, scene.id); - strcpy(Scene::CurrentSpriteFolder, scene.spriteFolder); - - char filePath[4096]; - if (!strcmp(scene.fileType, "bin")) { - snprintf(filePath, sizeof(filePath), "Stages/%s/TileConfig.bin", scene.folder); - } - else { - if (scene.folder[0] == '\0') - snprintf(filePath, sizeof(filePath), "Scenes/TileConfig.bin"); - else - snprintf(filePath, sizeof(filePath), "Scenes/%s/TileConfig.bin", scene.folder); - } - Scene::LoadTileCollisions(filePath, 0); + if (SceneInfo::IsEntryValid(CurrentSceneInList)) { + std::string filename = SceneInfo::GetTileConfigFilename(CurrentSceneInList); + Scene::LoadTileCollisions(filename.c_str(), 0); } } else @@ -1720,7 +1669,7 @@ PUBLIC STATIC void Scene::ProcessSceneTimer() { } PUBLIC STATIC ObjectList* Scene::NewObjectList(const char* objectName) { - ObjectList* objectList = new (nothrow) ObjectList(objectName); + ObjectList* objectList = new (std::nothrow) ObjectList(objectName); if (objectList && ScriptManager::LoadObjectClass(objectName, true)) objectList->SpawnFunction = ScriptManager::ObjectSpawnFunction; return objectList; @@ -2344,6 +2293,7 @@ PUBLIC STATIC bool Scene::AddTileset(char* path) { info.Sprite = tileSprite; info.AnimationIndex = 0; info.FrameIndex = (int)tileSprite->Animations[0].Frames.size(); + info.TilesetID = Scene::Tilesets.size() - 1; Scene::TileSpriteInfos.push_back(info); tileSprite->AddFrame(0, @@ -2437,6 +2387,48 @@ PUBLIC STATIC void Scene::UnloadTileCollisions() { Scene::TileCount = 0; } +// Resource Management +// return true if we found it in the list +PUBLIC STATIC bool Scene::GetResourceListSpace(vector* list, ResourceType* resource, size_t& index, bool& foundEmpty) { + foundEmpty = false; + index = list->size(); + for (size_t i = 0, listSz = list->size(); i < listSz; i++) { + if (!(*list)[i]) { + if (!foundEmpty) { + foundEmpty = true; + index = i; + } + continue; + } + if ((*list)[i]->FilenameHash == resource->FilenameHash) { + index = i; + delete resource; + return true; + } + } + return false; +} + +PUBLIC STATIC bool Scene::GetResource(vector* list, ResourceType* resource, size_t& index) { + bool foundEmpty = false; + if (GetResourceListSpace(list, resource, index, foundEmpty)) + return true; + else if (foundEmpty) + (*list)[index] = resource; + else + list->push_back(resource); + return false; +} + +PUBLIC STATIC ISprite* Scene::GetSpriteResource(int index) { + if (index < 0 || index >= (int)Scene::SpriteList.size()) + return NULL; + + if (!Scene::SpriteList[index]) return NULL; + + return Scene::SpriteList[index]->AsSprite; +} + PUBLIC STATIC void Scene::DisposeInScope(Uint32 scope) { // Images for (size_t i = 0, i_sz = Scene::ImageList.size(); i < i_sz; i++) { @@ -3385,7 +3377,7 @@ PUBLIC STATIC bool Scene::ObjectTileCollision(Entity* entity, int cLayers, int c default: return false; case CMODE_FLOOR: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3432,7 +3424,7 @@ PUBLIC STATIC bool Scene::ObjectTileCollision(Entity* entity, int cLayers, int c return collided; case CMODE_LWALL: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3479,7 +3471,7 @@ PUBLIC STATIC bool Scene::ObjectTileCollision(Entity* entity, int cLayers, int c return collided; case CMODE_ROOF: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3526,7 +3518,7 @@ PUBLIC STATIC bool Scene::ObjectTileCollision(Entity* entity, int cLayers, int c return collided; case CMODE_RWALL: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3591,7 +3583,7 @@ PUBLIC STATIC bool Scene::ObjectTileGrip(Entity* entity, int cLayers, int cMode, default: return false; case CMODE_FLOOR: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3641,7 +3633,7 @@ PUBLIC STATIC bool Scene::ObjectTileGrip(Entity* entity, int cLayers, int cMode, return collided; case CMODE_LWALL: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3691,7 +3683,7 @@ PUBLIC STATIC bool Scene::ObjectTileGrip(Entity* entity, int cLayers, int cMode, return collided; case CMODE_ROOF: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3741,7 +3733,7 @@ PUBLIC STATIC bool Scene::ObjectTileGrip(Entity* entity, int cLayers, int cMode, return collided; case CMODE_RWALL: - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -3949,7 +3941,7 @@ PUBLIC STATIC void Scene::ProcessPathGrip() { } if (Sensors[0].Angle < 0xDE && Sensors[0].Angle > 0x80) - CollisionEntity->CollisionMode == CMODE_LWALL; + CollisionEntity->CollisionMode = CMODE_LWALL; if (Sensors[0].Angle > 0x22 && Sensors[0].Angle < 0x80) CollisionEntity->CollisionMode = CMODE_RWALL; break; @@ -5041,7 +5033,7 @@ PUBLIC STATIC void Scene::FindLWallPosition(CollisionSensor* sensor) { int startX = posX; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5111,7 +5103,7 @@ PUBLIC STATIC void Scene::FindRoofPosition(CollisionSensor* sensor) { int startY = posY; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5180,7 +5172,7 @@ PUBLIC STATIC void Scene::FindRWallPosition(CollisionSensor* sensor) { int startX = posX; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5251,7 +5243,7 @@ PUBLIC STATIC void Scene::FloorCollision(CollisionSensor* sensor) { float collidePos = 65536.0; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5326,7 +5318,7 @@ PUBLIC STATIC void Scene::LWallCollision(CollisionSensor* sensor) { int solid = 2; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5390,7 +5382,7 @@ PUBLIC STATIC void Scene::RoofCollision(CollisionSensor* sensor) { float collidePos = -1.0; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) @@ -5462,7 +5454,7 @@ PUBLIC STATIC void Scene::RWallCollision(CollisionSensor* sensor) { int solid = 2; int layerID = 1; - for (size_t l = 0; l < Layers.size(); ++l, layerID << 1) { + for (size_t l = 0; l < Layers.size(); ++l, layerID <<= 1) { SceneLayer layer = Layers[l]; if (!(layer.Flags & SceneLayer::FLAGS_COLLIDEABLE)) diff --git a/source/Engine/Scene/SceneConfig.h b/source/Engine/Scene/SceneConfig.h index ae9da73a..f6426905 100644 --- a/source/Engine/Scene/SceneConfig.h +++ b/source/Engine/Scene/SceneConfig.h @@ -1,19 +1,29 @@ #ifndef ENGINE_SCENE_SCENECONFIG_H #define ENGINE_SCENE_SCENECONFIG_H -struct SceneListInfo { - char name[32]; - int sceneOffsetStart; - int sceneOffsetEnd; - int sceneCount; +#include + +struct SceneListCategory { + char* Name = nullptr; + + size_t OffsetStart; + size_t OffsetEnd; + size_t Count; + + HashMap* Properties = nullptr; }; struct SceneListEntry { - char name[32]; - char folder[16]; - char id[8]; - char spriteFolder[16]; - char fileType[8]; + char* Name = nullptr; + char* Folder = nullptr; + char* ID = nullptr; + char* SpriteFolder = nullptr; + char* Filetype = nullptr; + + size_t ParentCategoryID; + size_t CategoryPos; + + HashMap* Properties = nullptr; }; -#endif /* ENGINE_SCENE_SCENECONFIG_H */ \ No newline at end of file +#endif /* ENGINE_SCENE_SCENECONFIG_H */ diff --git a/source/Engine/Scene/SceneEnums.h b/source/Engine/Scene/SceneEnums.h new file mode 100644 index 00000000..f8628584 --- /dev/null +++ b/source/Engine/Scene/SceneEnums.h @@ -0,0 +1,47 @@ +#ifndef ENGINE_SCENE_ENUMS +#define ENGINE_SCENE_ENUMS + +enum { + TILECOLLISION_NONE = 0, + TILECOLLISION_DOWN = 1, + TILECOLLISION_UP = 2 +}; + +enum { + C_NONE = 0, + C_TOP = 1, + C_LEFT = 2, + C_RIGHT = 3, + C_BOTTOM = 4 +}; + +enum { + FLIP_NONE = 0, + FLIP_X = 1, + FLIP_Y = 2, + FLIP_XY = 3 +}; + +enum { + CMODE_FLOOR = 0, + CMODE_LWALL = 1, + CMODE_ROOF = 2, + CMODE_RWALL = 3 +}; + +enum { + H_TYPE_TOUCH = 0, + H_TYPE_CIRCLE = 1, + H_TYPE_BOX = 2, + H_TYPE_PLAT = 3 +}; + +#define TILE_FLIPX_MASK 0x80000000U +#define TILE_FLIPY_MASK 0x40000000U +// #define TILE_DIAGO_MASK 0x20000000U +#define TILE_COLLA_MASK 0x30000000U +#define TILE_COLLB_MASK 0x0C000000U +#define TILE_COLLC_MASK 0x03000000U +#define TILE_IDENT_MASK 0x00FFFFFFU // Max. 16777216 tiles + +#endif diff --git a/source/Engine/Scene/SceneInfo.cpp b/source/Engine/Scene/SceneInfo.cpp new file mode 100644 index 00000000..fa6ef666 --- /dev/null +++ b/source/Engine/Scene/SceneInfo.cpp @@ -0,0 +1,302 @@ +#if INTERFACE +#include +#include +#include +#include + +class SceneInfo { +public: + static vector Entries; + static vector Categories; +}; +#endif + +#include +#include + +vector SceneInfo::Entries; +vector SceneInfo::Categories; + +PUBLIC STATIC void SceneInfo::Dispose() { + for (size_t i = 0; i < Categories.size(); i++) { + Categories[i].Properties->WithAll([](Uint32 hash, char* string) -> void { + Memory::Free(string); + }); + delete Categories[i].Properties; + } + + for (size_t i = 0; i < Entries.size(); i++) { + Entries[i].Properties->WithAll([](Uint32 hash, char* string) -> void { + Memory::Free(string); + }); + delete Entries[i].Properties; + } + + Categories.clear(); + Categories.shrink_to_fit(); + + Entries.clear(); + Entries.shrink_to_fit(); +} + +PUBLIC STATIC bool SceneInfo::IsCategoryValid(int categoryID) { + return categoryID >= 0 && categoryID < (int)Categories.size(); +} + +PUBLIC STATIC bool SceneInfo::IsEntryValid(int entryID) { + return entryID >= 0 && entryID < (int)Entries.size(); +} + +PUBLIC STATIC bool SceneInfo::IsEntryValidInCategory(size_t categoryID, size_t entryID) { + if (!IsCategoryValid((int)categoryID)) + return false; + + return entryID >= Categories[categoryID].OffsetStart && entryID < Categories[categoryID].OffsetEnd; +} + +PUBLIC STATIC int SceneInfo::GetCategoryID(const char* categoryName) { + for (size_t i = 0; i < Categories.size(); i++) { + if (!strcmp(Categories[i].Name, categoryName)) + return i; + } + + return -1; +} + +PUBLIC STATIC int SceneInfo::GetEntryID(const char* categoryName, const char* entryName) { + int categoryID = GetCategoryID(categoryName); + if (categoryID < 0) + return -1; + + SceneListCategory& category = Categories[categoryID]; + return GetEntryIDWithinRange(category.OffsetStart, category.OffsetEnd, entryName); +} + +PUBLIC STATIC int SceneInfo::GetEntryID(const char* categoryName, size_t entryID) { + int categoryID = GetCategoryID(categoryName); + if (categoryID < 0) + return -1; + + return GetEntryID((size_t)categoryID, (size_t)entryID); +} + +PUBLIC STATIC int SceneInfo::GetEntryID(size_t categoryID, size_t entryID) { + if (!SceneInfo::IsCategoryValid((int)categoryID)) + return -1; + + SceneListCategory& category = Categories[categoryID]; + size_t actualEntryID = category.OffsetStart + entryID; + if (!SceneInfo::IsEntryValidInCategory(categoryID, actualEntryID)) + return -1; + + return (int)actualEntryID; +} + +PUBLIC STATIC int SceneInfo::GetEntryPosInCategory(const char *categoryName, const char* entryName) { + int categoryID = GetCategoryID(categoryName); + if (categoryID < 0) + return -1; + + return GetEntryPosInCategory((size_t)categoryID, entryName); +} + +PUBLIC STATIC int SceneInfo::GetEntryPosInCategory(size_t categoryID, const char* entryName) { + if (!SceneInfo::IsCategoryValid((int)categoryID)) + return -1; + + SceneListCategory& category = Categories[categoryID]; + int actualEntryID = GetEntryIDWithinRange(category.OffsetStart, category.OffsetEnd, entryName); + if (actualEntryID < 0) + return -1; + + return actualEntryID - (int)category.OffsetStart; +} + +PUBLIC STATIC int SceneInfo::GetEntryIDWithinRange(size_t start, size_t end, const char* entryName) { + for (size_t i = start; i < end; i++) { + if (!strcmp(Entries[i].Name, entryName)) + return (int)i; + } + + return -1; +} + +PUBLIC STATIC string SceneInfo::GetParentPath(int entryID) { + SceneListEntry& entry = Entries[entryID]; + + char filePath[4096]; + if (!strcmp(entry.Filetype, "bin")) { + snprintf(filePath, sizeof(filePath), "Stages/%s/", entry.Folder); + } + else { + if (entry.Folder == nullptr) + snprintf(filePath, sizeof(filePath), "Scenes/"); + else + snprintf(filePath, sizeof(filePath), "Scenes/%s/", entry.Folder); + } + + return std::string(filePath); +} + +PUBLIC STATIC string SceneInfo::GetFilename(int entryID) { + SceneListEntry scene = Entries[entryID]; + + std::string parentPath = GetParentPath(entryID); + + const char* id = scene.ID != nullptr ? scene.ID : scene.Name; + + char filePath[4096]; + if (!strcmp(scene.Filetype, "bin")) { + if (scene.Folder == nullptr) { + if (scene.Filetype == nullptr) + snprintf(filePath, sizeof(filePath), "Scene%s", id); + else + snprintf(filePath, sizeof(filePath), "Scene%s.%s", id, scene.Filetype); + } + else if (scene.Filetype == nullptr) + snprintf(filePath, sizeof(filePath), "%s/Scene%s", scene.Folder, id); + else + snprintf(filePath, sizeof(filePath), "%s/Scene%s.%s", scene.Folder, id, scene.Filetype); + } + else { + if (scene.Folder == nullptr) { + if (scene.Filetype == nullptr) + snprintf(filePath, sizeof(filePath), "%s", id); + else + snprintf(filePath, sizeof(filePath), "%s.%s", id, scene.Filetype); + } + else if (scene.Filetype == nullptr) + snprintf(filePath, sizeof(filePath), "%s/%s", scene.Folder, id); + else + snprintf(filePath, sizeof(filePath), "%s/%s.%s", scene.Folder, id, scene.Filetype); + } + + parentPath += std::string(filePath); + + return parentPath; +} + +PUBLIC STATIC string SceneInfo::GetTileConfigFilename(int entryID) { + return GetParentPath(entryID) + "TileConfig.bin"; +} + +PUBLIC STATIC char* SceneInfo::GetEntryProperty(int entryID, char* property) { + if (IsEntryValid(entryID)) { + SceneListEntry& entry = Entries[entryID]; + if (entry.Properties->Exists(property)) + return entry.Properties->Get(property); + } + return nullptr; +} +PUBLIC STATIC char* SceneInfo::GetCategoryProperty(int categoryID, char* property) { + if (IsCategoryValid(categoryID)) { + SceneListCategory& category = Categories[categoryID]; + if (category.Properties->Exists(property)) + return category.Properties->Get(property); + } + return nullptr; +} + +PUBLIC STATIC bool SceneInfo::HasEntryProperty(int entryID, char* property) { + if (IsEntryValid(entryID)) + return Entries[entryID].Properties->Exists(property); + return false; +} +PUBLIC STATIC bool SceneInfo::HasCategoryProperty(int categoryID, char* property) { + if (IsCategoryValid(categoryID)) + return Categories[categoryID].Properties->Exists(property); + return false; +} + +PRIVATE STATIC void SceneInfo::FillAttributesHashMap(XMLAttributes* attr, HashMap* map) { + for (size_t i = 0; i < attr->KeyVector.size(); i++) { + char *key = attr->KeyVector[i]; + char *value = XMLParser::TokenToString(attr->ValueMap.Get(key)); + if (!map->Exists(key)) + map->Put(key, value); + } +} + +PUBLIC STATIC bool SceneInfo::Load(XMLNode* node) { + for (size_t i = 0; i < node->children.size(); ++i) { + XMLNode* listElement = node->children[i]; + if (XMLParser::MatchToken(listElement->name, "category")) { + SceneListCategory category; + + category.OffsetStart = Entries.size(); + category.Count = 0; + + if (listElement->attributes.Exists("name")) + category.Name = XMLParser::TokenToString(listElement->attributes.Get("name")); + else { + char buf[32]; + snprintf(buf, sizeof(buf), "Unknown category #%d", ((int)i) + 1); + category.Name = StringUtils::Duplicate(buf); + } + + // Fill properties + category.Properties = new HashMap(NULL, 8); + category.Properties->Put("name", category.Name); + + FillAttributesHashMap(&listElement->attributes, category.Properties); + + for (size_t s = 0; s < listElement->children.size(); ++s) { + XMLNode* stgElement = listElement->children[s]; + if (XMLParser::MatchToken(stgElement->name, "stage")) { + SceneListEntry entry; + + // Name + if (stgElement->attributes.Exists("name")) + entry.Name = XMLParser::TokenToString(stgElement->attributes.Get("name")); + else + entry.Name = StringUtils::Duplicate("Unknown"); + + // Folder + if (stgElement->attributes.Exists("folder")) + entry.Folder = XMLParser::TokenToString(stgElement->attributes.Get("folder")); + + // ID + if (stgElement->attributes.Exists("id")) + entry.ID = XMLParser::TokenToString(stgElement->attributes.Get("id")); + else { + char buf[16]; + snprintf(buf, sizeof(buf), "%d", ((int)s) + 1); + entry.ID = StringUtils::Duplicate(buf); + } + + // Sprite folder + if (stgElement->attributes.Exists("spriteFolder")) + entry.SpriteFolder = XMLParser::TokenToString(stgElement->attributes.Get("spriteFolder")); + + // Filetype + if (stgElement->attributes.Exists("fileExtension")) + entry.Filetype = XMLParser::TokenToString(stgElement->attributes.Get("fileExtension")); + else if (stgElement->attributes.Exists("type")) + entry.Filetype = XMLParser::TokenToString(stgElement->attributes.Get("type")); + + entry.ParentCategoryID = Categories.size(); + entry.CategoryPos = category.Count; + + // Fill properties + entry.Properties = new HashMap(NULL, 8); + entry.Properties->Put("name", entry.Name); + entry.Properties->Put("folder", entry.Folder); + entry.Properties->Put("id", entry.ID); + entry.Properties->Put("spriteFolder", entry.SpriteFolder); + entry.Properties->Put("fileExtension", entry.Filetype); + + FillAttributesHashMap(&stgElement->attributes, entry.Properties); + + Entries.push_back(entry); + category.Count++; + } + + category.OffsetEnd = category.OffsetStart + category.Count; + } + + Categories.push_back(category); + } + } + + return Categories.size() > 0; +} diff --git a/source/Engine/Scene/SceneLayer.cpp b/source/Engine/Scene/SceneLayer.cpp index e4cfc1d6..a38d8add 100644 --- a/source/Engine/Scene/SceneLayer.cpp +++ b/source/Engine/Scene/SceneLayer.cpp @@ -25,7 +25,6 @@ class SceneLayer { int ConstantY = 0x0000; int OffsetX = 0x0000; int OffsetY = 0x0000; - bool Repeat = true; Uint32* Tiles = NULL; Uint32* TilesBackup = NULL; @@ -47,6 +46,8 @@ class SceneLayer { Uint8 BlendMode = 0; // BlendMode_NORMAL float Opacity = 1.0f; + bool UsePaletteIndexLines = false; + bool UsingCustomScanlineFunction = false; ObjFunction CustomScanlineFunction; @@ -65,8 +66,8 @@ class SceneLayer { enum { FLAGS_COLLIDEABLE = 1, - FLAGS_NO_REPEAT_X = 2, - FLAGS_NO_REPEAT_Y = 4, + FLAGS_REPEAT_X = 2, + FLAGS_REPEAT_Y = 4, }; }; #endif diff --git a/source/Engine/Scene/TileSpriteInfo.cpp b/source/Engine/Scene/TileSpriteInfo.cpp index 86dd5a9d..a4b6057c 100644 --- a/source/Engine/Scene/TileSpriteInfo.cpp +++ b/source/Engine/Scene/TileSpriteInfo.cpp @@ -4,5 +4,6 @@ class TileSpriteInfo { ISprite* Sprite; int AnimationIndex; int FrameIndex; + size_t TilesetID; }; #endif diff --git a/source/Engine/TextFormats/XML/XMLNode.h b/source/Engine/TextFormats/XML/XMLNode.h index 3d8bfa01..6158dd7a 100644 --- a/source/Engine/TextFormats/XML/XMLNode.h +++ b/source/Engine/TextFormats/XML/XMLNode.h @@ -1,7 +1,8 @@ #ifndef XMLNODE_H #define XMLNODE_H -#include +#include +#include class XMLAttributes { public: @@ -21,8 +22,7 @@ class XMLAttributes { } void Dispose() { for (size_t i = 0; i < KeyVector.size(); i++) - free(KeyVector[i]); - + Memory::Free(KeyVector[i]); KeyVector.clear(); } ~XMLAttributes() { diff --git a/source/Engine/TextFormats/XML/XMLParser.cpp b/source/Engine/TextFormats/XML/XMLParser.cpp index 9f3b863a..df0d9835 100644 --- a/source/Engine/TextFormats/XML/XMLParser.cpp +++ b/source/Engine/TextFormats/XML/XMLParser.cpp @@ -14,10 +14,12 @@ class XMLParser { #include +#include #include #include #include #include +#include Parser parser; Scanner scanner; @@ -331,7 +333,7 @@ void GetAttributes() { } } void GetStart() { - XMLNode* node = new (nothrow) XMLNode; + XMLNode* node = new (std::nothrow) XMLNode; if (!node) return; @@ -390,21 +392,11 @@ PUBLIC STATIC bool XMLParser::MatchToken(Token tok, const char* string) { return memcmp(string, tok.Start, tok.Length) == 0; } PUBLIC STATIC float XMLParser::TokenToNumber(Token tok) { - float value; - char* sourPls = (char*)malloc(tok.Length + 1); - if (sourPls) { - memcpy(sourPls, tok.Start, tok.Length); - sourPls[tok.Length] = 0; - value = atof(sourPls); - free(sourPls); - } - else - value = NAN; - return value; + return atof(tok.ToString().c_str()); } PUBLIC STATIC XMLNode* XMLParser::Parse() { - XMLNode* XMLRoot = new (nothrow) XMLNode; + XMLNode* XMLRoot = new (std::nothrow) XMLNode; if (!XMLRoot) return NULL; @@ -446,7 +438,7 @@ PUBLIC STATIC XMLNode* XMLParser::Parse() { data.Length = scanner.Current - data.Start; data.Type = TOKEN_CDATA; - XMLNode* node = new (nothrow) XMLNode; + XMLNode* node = new (std::nothrow) XMLNode; if (!node) return NULL; @@ -521,22 +513,14 @@ PUBLIC STATIC XMLNode* XMLParser::ParseFromResource(const char* filename) { } PUBLIC STATIC char* XMLParser::TokenToString(Token tok) { - char* string = (char*)malloc(tok.Length + 1); + char* string = StringUtils::Create(tok); if (!string) { Log::Print(Log::LOG_ERROR, "Out of memory converting XML token to string!"); - exit(-1); + abort(); } - - memcpy(string, tok.Start, tok.Length); - string[tok.Length] = '\0'; - return string; } -PUBLIC STATIC string XMLParser::TokenToStdString(Token tok) { - return std::string(tok.Start, tok.Length); -} - PUBLIC STATIC void XMLParser::CopyTokenToString(Token tok, char* buffer, size_t size) { size_t length = tok.Length; if (length >= size) diff --git a/source/Engine/Types/Collision.h b/source/Engine/Types/Collision.h new file mode 100644 index 00000000..5cf953bd --- /dev/null +++ b/source/Engine/Types/Collision.h @@ -0,0 +1,55 @@ +#ifndef COLLISION_H +#define COLLISION_H + +struct EntityHitbox { + float Width = 0.0f; + float Height = 0.0f; + float OffsetX = 0.0f; + float OffsetY = 0.0f; + + float GetLeft() { + return (-Width / 2) + OffsetX; + } + float GetRight() { + return (Width / 2) + OffsetX; + } + float GetTop() { + return (-Height / 2) + OffsetY; + } + float GetBottom() { + return (Height / 2) + OffsetY; + } + + void SetLeft(float left) { + Width = GetRight() - left; + OffsetX = left + Width * 0.5f; + } + void SetRight(float right) { + Width = right - GetLeft(); + OffsetX = right - Width * 0.5f; + } + void SetTop(float top) { + Height = GetBottom() - top; + OffsetY = top + Height * 0.5f; + } + void SetBottom(float bottom) { + Height = bottom - GetTop(); + OffsetY = bottom - Height * 0.5f; + } + + void Clear() { + Width = 0.0f; + Height = 0.0f; + OffsetX = 0.0f; + OffsetY = 0.0f; + } + + void Set(CollisionBox box) { + Width = box.Right - box.Left; + Height = box.Bottom - box.Top; + OffsetX = box.Left + Width * 0.5f; + OffsetY = box.Top + Height * 0.5f; + } +}; + +#endif diff --git a/source/Engine/Types/Entity.cpp b/source/Engine/Types/Entity.cpp index bbed26d5..525e1f62 100644 --- a/source/Engine/Types/Entity.cpp +++ b/source/Engine/Types/Entity.cpp @@ -80,10 +80,7 @@ class Entity { int AnimationFrameDuration = 0; int AnimationLoopIndex = 0; - float HitboxW = 0.0f; - float HitboxH = 0.0f; - float HitboxOffX = 0.0f; - float HitboxOffY = 0.0f; + EntityHitbox Hitbox; int FlipFlag = 0; float SensorX = 0.0f; @@ -127,12 +124,9 @@ PUBLIC void Entity::ApplyMotion() { Y += YSpeed; } PUBLIC void Entity::Animate() { - if (Sprite < 0 || (size_t)Sprite >= Scene::SpriteList.size()) - return; - - ISprite* sprite = Scene::SpriteList[Sprite]->AsSprite; + ISprite* sprite = Scene::GetSpriteResource(Sprite); - if (CurrentAnimation < 0 || (size_t)CurrentAnimation >= sprite->Animations.size()) + if (!sprite || CurrentAnimation < 0 || (size_t)CurrentAnimation >= sprite->Animations.size()) return; #ifdef USE_RSDK_ANIMATE @@ -159,12 +153,12 @@ PUBLIC void Entity::Animate() { OnAnimationFinish(); // Sprite may have changed after a call to OnAnimationFinish - sprite = Scene::SpriteList[Sprite]->AsSprite; + sprite = Scene::GetSpriteResource(Sprite); } // Do a basic range check, for strange loop points // (or just in case CurrentAnimation happens to be invalid, which is very possible) - if (CurrentFrame < CurrentFrameCount && CurrentAnimation >= 0 && CurrentAnimation < sprite->Animations.size()) { + if (sprite && CurrentFrame < CurrentFrameCount && CurrentAnimation >= 0 && CurrentAnimation < sprite->Animations.size()) { AnimationFrameDuration = sprite->Animations[CurrentAnimation].Frames[CurrentFrame].Duration; } else { @@ -184,12 +178,9 @@ PUBLIC void Entity::SetAnimation(int animation, int frame) { ResetAnimation(animation, frame); } PUBLIC void Entity::ResetAnimation(int animation, int frame) { - if (Sprite < 0 || (size_t)Sprite >= Scene::SpriteList.size()) - return; + ISprite* sprite = Scene::GetSpriteResource(Sprite); - ISprite* sprite = Scene::SpriteList[Sprite]->AsSprite; - - if (animation < 0 || (size_t)animation >= sprite->Animations.size()) + if (!sprite || animation < 0 || (size_t)animation >= sprite->Animations.size()) return; if (frame < 0 || (size_t)frame >= sprite->Animations[animation].Frames.size()) @@ -203,29 +194,39 @@ PUBLIC void Entity::ResetAnimation(int animation, int frame) { AnimationSpeed = sprite->Animations[CurrentAnimation].AnimationSpeed; AnimationLoopIndex = sprite->Animations[CurrentAnimation].FrameToLoop; } +PUBLIC bool Entity::BasicCollideWithObject(Entity* other) { + float otherHitboxW = other->Hitbox.Width; + float otherHitboxH = other->Hitbox.Height; + + if (otherHitboxW == 0.0f || otherHitboxH == 0.0f) + return false; + + return + other->X + other->Hitbox.GetLeft() >= X + Hitbox.GetLeft() && + other->Y + other->Hitbox.GetTop() >= Y + Hitbox.GetTop() && + other->X + other->Hitbox.GetRight() < X + Hitbox.GetRight() && + other->Y + other->Hitbox.GetBottom() < Y + Hitbox.GetBottom(); +} PUBLIC bool Entity::CollideWithObject(Entity* other) { float sourceFlipX = (this->FlipFlag & 1) ? -1.0 : 1.0; float sourceFlipY = (this->FlipFlag & 2) ? -1.0 : 1.0; float otherFlipX = (other->FlipFlag & 1) ? -1.0 : 1.0; float otherFlipY = (other->FlipFlag & 2) ? -1.0 : 1.0; - float sourceX = std::floor(this->X + this->HitboxOffX * sourceFlipX); - float sourceY = std::floor(this->Y + this->HitboxOffY * sourceFlipY); - float otherX = std::floor(other->X + other->HitboxOffX * otherFlipX); - float otherY = std::floor(other->Y + other->HitboxOffY * otherFlipY); + float sourceX = std::floor(this->X + this->Hitbox.OffsetX * sourceFlipX); + float sourceY = std::floor(this->Y + this->Hitbox.OffsetY * sourceFlipY); + float otherX = std::floor(other->X + other->Hitbox.OffsetX * otherFlipX); + float otherY = std::floor(other->Y + other->Hitbox.OffsetY * otherFlipY); - float otherHitboxW = (other->HitboxW) * 0.5; - float otherHitboxH = (other->HitboxH) * 0.5; - float sourceHitboxW = (this->HitboxW) * 0.5; - float sourceHitboxH = (this->HitboxH) * 0.5; + float otherHitboxW = other->Hitbox.Width * 0.5; + float otherHitboxH = other->Hitbox.Height * 0.5; + float sourceHitboxW = this->Hitbox.Width * 0.5; + float sourceHitboxH = this->Hitbox.Height * 0.5; - if (otherY + otherHitboxH < sourceY - sourceHitboxH || + return !(otherY + otherHitboxH < sourceY - sourceHitboxH || otherY - otherHitboxH > sourceY + sourceHitboxH || sourceX - sourceHitboxW > otherX + otherHitboxW || - sourceX + sourceHitboxW < otherX - otherHitboxW) - return false; - - return true; + sourceX + sourceHitboxW < otherX - otherHitboxW); } PUBLIC int Entity::SolidCollideWithObject(Entity* other, int flag) { // NOTE: "flag" is setValues @@ -239,28 +240,21 @@ PUBLIC int Entity::SolidCollideWithObject(Entity* other, int flag) { int collideSideHori = 0; int collideSideVert = 0; - float otherHitboxW = (other->HitboxW) * 0.5; - float otherHitboxH = (other->HitboxH) * 0.5; - float otherHitboxWSq = (other->HitboxW - 2.0) * 0.5; - float otherHitboxHSq = (other->HitboxH - 2.0) * 0.5; - float sourceHitboxW = (this->HitboxW) * 0.5; - float sourceHitboxH = (this->HitboxH) * 0.5; - - float sourceHitboxOffX = (this->FlipFlag & 1) ? -this->HitboxOffX : this->HitboxOffX; - float sourceHitboxOffY = (this->FlipFlag & 2) ? -this->HitboxOffY : this->HitboxOffY; - float otherHitboxOffX = (other->FlipFlag & 1) ? -other->HitboxOffX : other->HitboxOffX; - float otherHitboxOffY = (other->FlipFlag & 2) ? -other->HitboxOffY : other->HitboxOffY; + float otherHitboxW = other->Hitbox.Width * 0.5; + float otherHitboxH = other->Hitbox.Height * 0.5; + float otherHitboxWSq = (other->Hitbox.Width - 2.0) * 0.5; + float otherHitboxHSq = (other->Hitbox.Height - 2.0) * 0.5; + float sourceHitboxW = this->Hitbox.Width * 0.5; + float sourceHitboxH = this->Hitbox.Height * 0.5; - // NOTE: Keep this. - // if ( other_X <= (sourceHitbox->Right + sourceHitbox->Left + 2 * source_X) >> 1 ) - // if ( other_X <= (sourceHitbox->Right + sourceHitbox->Left) / 2 + source_X ) - // if ( other_X <= source_X + (sourceHitbox->Right + sourceHitbox->Left) / 2 ) - // if other->X <= this->X + this->HitboxCenterX + float sourceHitboxOffX = (this->FlipFlag & 1) ? -this->Hitbox.OffsetX : this->Hitbox.OffsetX; + float sourceHitboxOffY = (this->FlipFlag & 2) ? -this->Hitbox.OffsetY : this->Hitbox.OffsetY; + float otherHitboxOffX = (other->FlipFlag & 1) ? -other->Hitbox.OffsetX : other->Hitbox.OffsetX; + float otherHitboxOffY = (other->FlipFlag & 2) ? -other->Hitbox.OffsetY : other->Hitbox.OffsetY; // Check squeezed vertically if (sourceY + (-sourceHitboxH + sourceHitboxOffY) < initialOtherY + otherHitboxHSq && sourceY + (sourceHitboxH + sourceHitboxOffY) > initialOtherY - otherHitboxHSq) { - // if other->X <= this->X + this->HitboxCenterX if (otherX <= sourceX) { if (otherX + otherHitboxW >= sourceX - sourceHitboxW) { collideSideHori = 2; @@ -394,15 +388,15 @@ PUBLIC bool Entity::TopSolidCollideWithObject(Entity* other, int flag) { float otherY = std::floor(initialOtherY); float otherYMinusYSpeed = std::floor(initialOtherY - other->YSpeed); - float otherHitboxW = (other->HitboxW) * 0.5; - float otherHitboxH = (other->HitboxH) * 0.5; - float sourceHitboxW = (this->HitboxW) * 0.5; - float sourceHitboxH = (this->HitboxH) * 0.5; + float otherHitboxW = other->Hitbox.Width * 0.5; + float otherHitboxH = other->Hitbox.Height * 0.5; + float sourceHitboxW = this->Hitbox.Width * 0.5; + float sourceHitboxH = this->Hitbox.Height * 0.5; - float sourceHitboxOffX = (this->FlipFlag & 1) ? -this->HitboxOffX : this->HitboxOffX; - float sourceHitboxOffY = (this->FlipFlag & 2) ? -this->HitboxOffY : this->HitboxOffY; - float otherHitboxOffX = (other->FlipFlag & 1) ? -other->HitboxOffX : other->HitboxOffX; - float otherHitboxOffY = (other->FlipFlag & 2) ? -other->HitboxOffY : other->HitboxOffY; + float sourceHitboxOffX = (this->FlipFlag & 1) ? -this->Hitbox.OffsetX : this->Hitbox.OffsetX; + float sourceHitboxOffY = (this->FlipFlag & 2) ? -this->Hitbox.OffsetY : this->Hitbox.OffsetY; + float otherHitboxOffX = (other->FlipFlag & 1) ? -other->Hitbox.OffsetX : other->Hitbox.OffsetX; + float otherHitboxOffY = (other->FlipFlag & 2) ? -other->Hitbox.OffsetY : other->Hitbox.OffsetY; if ((otherHitboxH + otherHitboxOffY) + otherY < sourceY + (-sourceHitboxH + sourceHitboxOffY) || (otherHitboxH + otherHitboxOffY) + otherYMinusYSpeed > sourceY + (sourceHitboxH + sourceHitboxOffY) || @@ -511,10 +505,7 @@ PUBLIC void Entity::CopyFields(Entity* other) { COPY(AnimationFrameDuration); COPY(AnimationLoopIndex); - COPY(HitboxW); - COPY(HitboxH); - COPY(HitboxOffX); - COPY(HitboxOffY); + COPY(Hitbox); COPY(FlipFlag); COPY(SensorX); diff --git a/source/Engine/Types/EntityTypes.h b/source/Engine/Types/EntityTypes.h index 246dec3b..74efeb26 100644 --- a/source/Engine/Types/EntityTypes.h +++ b/source/Engine/Types/EntityTypes.h @@ -1,6 +1,8 @@ #ifndef ENTITYTYPES_H #define ENTITYTYPES_H +#include + enum { Persistence_NONE, Persistence_SCENE, @@ -8,10 +10,10 @@ enum { }; enum { - LEFT = 0, - TOP = 1, - RIGHT = 2, - BOTTOM = 3 + HitboxSide_LEFT = 0, + HitboxSide_TOP = 1, + HitboxSide_RIGHT = 2, + HitboxSide_BOTTOM = 3 }; enum { @@ -25,23 +27,6 @@ enum { ACTIVE_RBOUNDS = 7 // Updates within a radius (UpdateRegionW) }; -enum { - SUNDAY = 0, - MONDAY = 1, - TUESDAY = 2, - WEDNESDAY = 3, - THURSDAY = 4, - FRIDAY = 5, - SATURDAY = 6 -}; - -enum { - MORNING = 0, // Hours 5AM to 11AM. 0500 to 1100. - MIDDAY = 1, // Hours 12PM to 4PM. 1200 to 1600. - EVENING = 2, // Hours 5PM to 8PM. 1700 to 2000. - NIGHT = 3 // Hours 9PM to 4AM. 2100 to 400. -}; - namespace CollideSide { enum { NONE = 0, @@ -70,7 +55,51 @@ struct CollisionSensor { int Angle; }; -#define DEBUG_HITBOX_COUNT (0x400) +struct ObjectListPerformanceStats { + double AverageTime = 0.0; + double AverageItemCount = 0; + + void DoAverage(double elapsed) { + double count = AverageItemCount; + if (count < 60.0 * 60.0) { + count += 1.0; + if (count == 1.0) + AverageTime = elapsed; + else + AverageTime = AverageTime + (elapsed - AverageTime) / count; + AverageItemCount = count; + } + } + + double GetAverageTime() { + return AverageTime * 1000.0; + } + + double GetTotalAverageTime() { + return GetAverageTime() * AverageItemCount; + } + + void Clear() { + AverageTime = 0.0; + AverageItemCount = 0; + } +}; + +struct ObjectListPerformance { + ObjectListPerformanceStats EarlyUpdate; + ObjectListPerformanceStats Update; + ObjectListPerformanceStats LateUpdate; + ObjectListPerformanceStats Render; + + void Clear() { + EarlyUpdate.Clear(); + Update.Clear(); + LateUpdate.Clear(); + Render.Clear(); + } +}; + +#define DEBUG_HITBOX_COUNT 0x400 struct DebugHitboxInfo { int type; diff --git a/source/Engine/Types/ObjectList.cpp b/source/Engine/Types/ObjectList.cpp index a0169aed..3cda52a2 100644 --- a/source/Engine/Types/ObjectList.cpp +++ b/source/Engine/Types/ObjectList.cpp @@ -6,22 +6,16 @@ class ObjectList { public: int EntityCount = 0; int Activity = ACTIVE_NORMAL; - Entity* EntityFirst = NULL; - Entity* EntityLast = NULL; - - char ObjectName[256]; - char LoadFunctionName[256 + 5]; - char GlobalUpdateFunctionName[256 + 13]; - double AverageUpdateEarlyTime = 0.0; - double AverageUpdateTime = 0.0; - double AverageUpdateLateTime = 0.0; - double AverageUpdateEarlyItemCount = 0; - double AverageUpdateItemCount = 0; - double AverageUpdateLateItemCount = 0; - double AverageRenderTime = 0.0; - double AverageRenderItemCount = 0; - - Entity* (*SpawnFunction)(const char*) = NULL; + Entity* EntityFirst = nullptr; + Entity* EntityLast = nullptr; + + char* ObjectName; + char* LoadFunctionName; + char* GlobalUpdateFunctionName; + + ObjectListPerformance Performance; + + Entity* (*SpawnFunction)(ObjectList*) = nullptr; }; #endif @@ -30,9 +24,18 @@ class ObjectList { #include PUBLIC ObjectList::ObjectList(const char* name) { - StringUtils::Copy(ObjectName, name, sizeof(ObjectName)); - snprintf(LoadFunctionName, sizeof LoadFunctionName, "%s_Load", ObjectName); - snprintf(GlobalUpdateFunctionName, sizeof GlobalUpdateFunctionName, "%s_GlobalUpdate", ObjectName); + ObjectName = StringUtils::Duplicate(name); + + std::string loadFunctionName = std::string(name) + "_Load"; + std::string globalUpdateFunctionName = std::string(name) + "_GlobalUpdate"; + + LoadFunctionName = StringUtils::Create(loadFunctionName); + GlobalUpdateFunctionName = StringUtils::Create(globalUpdateFunctionName); +} +PUBLIC ObjectList::~ObjectList() { + Memory::Free(ObjectName); + Memory::Free(LoadFunctionName); + Memory::Free(GlobalUpdateFunctionName); } // Double linked-list functions @@ -88,15 +91,12 @@ PUBLIC void ObjectList::Clear() { EntityFirst = NULL; EntityLast = NULL; - AverageUpdateTime = 0.0; - AverageUpdateItemCount = 0; - AverageRenderTime = 0.0; - AverageRenderItemCount = 0; + ResetPerf(); } // ObjectList functions PUBLIC Entity* ObjectList::Spawn() { - return SpawnFunction(ObjectName); + return SpawnFunction(this); } PUBLIC void ObjectList::Iterate(std::function func) { for (Entity* ent = EntityFirst; ent != NULL; ent = ent->NextEntityInList) @@ -116,11 +116,7 @@ PUBLIC void ObjectList::RemoveNonPersistentFromLinkedList(Entity* first) { RemoveNonPersistentFromLinkedList(first, Persistence_NONE); } PUBLIC void ObjectList::ResetPerf() { - // AverageUpdateTime = 0.0; - AverageUpdateItemCount = 0.0; - AverageUpdateEarlyItemCount = 0.0; - AverageUpdateLateItemCount = 0.0; - AverageRenderItemCount = 0.0; + Performance.Clear(); } PUBLIC Entity* ObjectList::GetNth(int n) { Entity* ent = EntityFirst; diff --git a/source/Engine/Types/Tileset.cpp b/source/Engine/Types/Tileset.cpp index 950f870c..ba3fe851 100644 --- a/source/Engine/Types/Tileset.cpp +++ b/source/Engine/Types/Tileset.cpp @@ -3,8 +3,6 @@ #include #include -#include - class Tileset { public: ISprite* Sprite = nullptr; @@ -16,6 +14,7 @@ class Tileset { size_t StartTile = 0; size_t FirstGlobalTileID = 0; size_t TileCount = 0; + unsigned PaletteID = 0; std::map AnimatorMap; }; #endif diff --git a/source/Engine/Utilities/ColorUtils.cpp b/source/Engine/Utilities/ColorUtils.cpp index f0b91d3c..c6db53c5 100644 --- a/source/Engine/Utilities/ColorUtils.cpp +++ b/source/Engine/Utilities/ColorUtils.cpp @@ -17,6 +17,14 @@ PUBLIC STATIC Uint32 ColorUtils::ToRGB(int r, int g, int b) { return 0xFF000000U | r << 16 | g << 8 | b; } +PUBLIC STATIC Uint32 ColorUtils::ToRGB(int r, int g, int b, int a) { + CLAMP_VAL(r, 0x00, 0xFF); + CLAMP_VAL(g, 0x00, 0xFF); + CLAMP_VAL(b, 0x00, 0xFF); + CLAMP_VAL(a, 0x00, 0xFF); + + return a << 24 | r << 16 | g << 8 | b; +} PUBLIC STATIC Uint32 ColorUtils::ToRGB(float r, float g, float b) { int colR = (int)(r * 0xFF); int colG = (int)(g * 0xFF); @@ -24,9 +32,20 @@ PUBLIC STATIC Uint32 ColorUtils::ToRGB(float r, float g, float b) { return ColorUtils::ToRGB(colR, colG, colB); } +PUBLIC STATIC Uint32 ColorUtils::ToRGB(float r, float g, float b, float a) { + int colR = (int)(r * 0xFF); + int colG = (int)(g * 0xFF); + int colB = (int)(b * 0xFF); + int colA = (int)(a * 0xFF); + + return ColorUtils::ToRGB(colR, colG, colB, colA); +} PUBLIC STATIC Uint32 ColorUtils::ToRGB(float *r) { return ToRGB(r[0], r[1], r[2]); } +PUBLIC STATIC Uint32 ColorUtils::ToRGBA(float *r) { + return ToRGB(r[0], r[1], r[2], r[3]); +} PUBLIC STATIC void ColorUtils::SeparateRGB(Uint32 color, float* dest) { dest[0] = (color >> 16 & 0xFF) / 255.f; dest[1] = (color >> 8 & 0xFF) / 255.f; @@ -36,15 +55,24 @@ PUBLIC STATIC void ColorUtils::Separate(Uint32 color, float* dest) { dest[3] = (color >> 24 & 0xFF) / 255.f; SeparateRGB(color, dest); } -PUBLIC STATIC void ColorUtils::SeparateRGB(Uint32 color, Uint32* dest) { +PUBLIC STATIC void ColorUtils::SeparateRGB(Uint32 color, Uint8* dest) { dest[0] = (color >> 16) & 0xFF; dest[1] = (color >> 8) & 0xFF; dest[2] = color & 0xFF; } -PUBLIC STATIC void ColorUtils::Separate(Uint32 color, Uint32* dest) { +PUBLIC STATIC void ColorUtils::Separate(Uint32 color, Uint8* dest) { dest[3] = (color >> 24) & 0xFF; SeparateRGB(color, dest); } +PUBLIC STATIC void ColorUtils::SeparateRGB(float* color, Uint8* dest) { + dest[0] = color[0] * 0xFF; + dest[1] = color[1] * 0xFF; + dest[2] = color[2] * 0xFF; +} +PUBLIC STATIC void ColorUtils::Separate(float* color, Uint8* dest) { + dest[2] = color[3] * 0xFF; + SeparateRGB(color, dest); +} PUBLIC STATIC Uint32 ColorUtils::Tint(Uint32 color, Uint32 colorMult) { Uint32 dR = (colorMult >> 16) & 0xFF; Uint32 dG = (colorMult >> 8) & 0xFF; diff --git a/source/Engine/Utilities/StringUtils.cpp b/source/Engine/Utilities/StringUtils.cpp index 1fffbacc..980d45ee 100644 --- a/source/Engine/Utilities/StringUtils.cpp +++ b/source/Engine/Utilities/StringUtils.cpp @@ -1,5 +1,6 @@ #if INTERFACE #include +#include class StringUtils { public: @@ -9,6 +10,21 @@ class StringUtils { #include #include +PUBLIC STATIC char* StringUtils::Create(void* src, size_t length) { + char* string = (char*)Memory::Malloc(length + 1); + memcpy(string, src, length); + string[length] = '\0'; + return string; +} +PUBLIC STATIC char* StringUtils::Create(string src) { + return StringUtils::Duplicate(src.c_str()); +} +PUBLIC STATIC char* StringUtils::Create(Token token) { + char* string = (char*)Memory::Malloc(token.Length + 1); + memcpy(string, token.Start, token.Length); + string[token.Length] = '\0'; + return string; +} PUBLIC STATIC char* StringUtils::Duplicate(const char* src) { size_t length = strlen(src) + 1; char* string = (char*)Memory::Malloc(length); @@ -24,6 +40,15 @@ PUBLIC STATIC char* StringUtils::Duplicate(const char* src, size_t length) { string[length] = '\0'; return string; } +PUBLIC STATIC char* StringUtils::Resize(char* src, size_t length) { + size_t originalSize = strlen(src); + char* string = (char *)Memory::Realloc(src, length + 1); + if (length > originalSize) + memset(&string[originalSize], 0x00, (length - originalSize) + 1); + else + string[length] = '\0'; + return string; +} PUBLIC STATIC bool StringUtils::WildcardMatch(const char* first, const char* second) { if (*first == 0 && *second == 0) return true; diff --git a/source/Libraries/Clipper2/clipper.core.h b/source/Libraries/Clipper2/clipper.core.h new file mode 100644 index 00000000..9185ac3e --- /dev/null +++ b/source/Libraries/Clipper2/clipper.core.h @@ -0,0 +1,965 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 22 December 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : Core Clipper Library structures and functions * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_CORE_H +#define CLIPPER_CORE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "clipper.version.h" + +namespace Clipper2Lib +{ + +#if (defined(__cpp_exceptions) && __cpp_exceptions) || (defined(__EXCEPTIONS) && __EXCEPTIONS) + + class Clipper2Exception : public std::exception { + public: + explicit Clipper2Exception(const char* description) : + m_descr(description) {} + virtual const char* what() const throw() override { return m_descr.c_str(); } + private: + std::string m_descr; + }; + + static const char* precision_error = + "Precision exceeds the permitted range"; + static const char* range_error = + "Values exceed permitted range"; + static const char* scale_error = + "Invalid scale (either 0 or too large)"; + static const char* non_pair_error = + "There must be 2 values for each coordinate"; + static const char* undefined_error = + "There is an undefined error in Clipper2"; +#endif + + // error codes (2^n) + const int precision_error_i = 1; // non-fatal + const int scale_error_i = 2; // non-fatal + const int non_pair_error_i = 4; // non-fatal + const int undefined_error_i = 32; // fatal + const int range_error_i = 64; + +#ifndef PI + static const double PI = 3.141592653589793238; +#endif + +#ifdef CLIPPER2_MAX_DECIMAL_PRECISION + const int CLIPPER2_MAX_DEC_PRECISION = CLIPPER2_MAX_DECIMAL_PRECISION; +#else + const int CLIPPER2_MAX_DEC_PRECISION = 8; // see Discussions #564 +#endif + + static const int64_t MAX_COORD = INT64_MAX >> 2; + static const int64_t MIN_COORD = -MAX_COORD; + static const int64_t INVALID = INT64_MAX; + const double max_coord = static_cast(MAX_COORD); + const double min_coord = static_cast(MIN_COORD); + + static const double MAX_DBL = (std::numeric_limits::max)(); + + static void DoError([[maybe_unused]] int error_code) + { +#if (defined(__cpp_exceptions) && __cpp_exceptions) || (defined(__EXCEPTIONS) && __EXCEPTIONS) + switch (error_code) + { + case precision_error_i: + throw Clipper2Exception(precision_error); + case scale_error_i: + throw Clipper2Exception(scale_error); + case non_pair_error_i: + throw Clipper2Exception(non_pair_error); + case undefined_error_i: + throw Clipper2Exception(undefined_error); + case range_error_i: + throw Clipper2Exception(range_error); + } +#else + ++error_code; // only to stop compiler warning +#endif + } + + + //By far the most widely used filling rules for polygons are EvenOdd + //and NonZero, sometimes called Alternate and Winding respectively. + //https://en.wikipedia.org/wiki/Nonzero-rule + enum class FillRule { EvenOdd, NonZero, Positive, Negative }; + + // Point ------------------------------------------------------------------------ + + template + struct Point { + T x; + T y; +#ifdef USINGZ + int64_t z; + + template + inline void Init(const T2 x_ = 0, const T2 y_ = 0, const int64_t z_ = 0) + { + if constexpr (std::numeric_limits::is_integer && + !std::numeric_limits::is_integer) + { + x = static_cast(std::round(x_)); + y = static_cast(std::round(y_)); + z = z_; + } + else + { + x = static_cast(x_); + y = static_cast(y_); + z = z_; + } + } + + explicit Point() : x(0), y(0), z(0) {}; + + template + Point(const T2 x_, const T2 y_, const int64_t z_ = 0) + { + Init(x_, y_); + z = z_; + } + + template + explicit Point(const Point& p) + { + Init(p.x, p.y, p.z); + } + + Point operator * (const double scale) const + { + return Point(x * scale, y * scale, z); + } + + void SetZ(const int64_t z_value) { z = z_value; } + + friend std::ostream& operator<<(std::ostream& os, const Point& point) + { + os << point.x << "," << point.y << "," << point.z; + return os; + } + +#else + + template + inline void Init(const T2 x_ = 0, const T2 y_ = 0) + { + if constexpr (std::numeric_limits::is_integer && + !std::numeric_limits::is_integer) + { + x = static_cast(std::round(x_)); + y = static_cast(std::round(y_)); + } + else + { + x = static_cast(x_); + y = static_cast(y_); + } + } + + explicit Point() : x(0), y(0) {}; + + template + Point(const T2 x_, const T2 y_) { Init(x_, y_); } + + template + explicit Point(const Point& p) { Init(p.x, p.y); } + + Point operator * (const double scale) const + { + return Point(x * scale, y * scale); + } + + friend std::ostream& operator<<(std::ostream& os, const Point& point) + { + os << point.x << "," << point.y; + return os; + } +#endif + + friend bool operator==(const Point& a, const Point& b) + { + return a.x == b.x && a.y == b.y; + } + + friend bool operator!=(const Point& a, const Point& b) + { + return !(a == b); + } + + inline Point operator-() const + { + return Point(-x, -y); + } + + inline Point operator+(const Point& b) const + { + return Point(x + b.x, y + b.y); + } + + inline Point operator-(const Point& b) const + { + return Point(x - b.x, y - b.y); + } + + inline void Negate() { x = -x; y = -y; } + + }; + + //nb: using 'using' here (instead of typedef) as they can be used in templates + using Point64 = Point; + using PointD = Point; + + template + using Path = std::vector>; + template + using Paths = std::vector>; + + using Path64 = Path; + using PathD = Path; + using Paths64 = std::vector< Path64>; + using PathsD = std::vector< PathD>; + + static const Point64 InvalidPoint64 = Point64( + (std::numeric_limits::max)(), + (std::numeric_limits::max)()); + static const PointD InvalidPointD = PointD( + (std::numeric_limits::max)(), + (std::numeric_limits::max)()); + + template + static inline Point MidPoint(const Point& p1, const Point& p2) + { + Point result; + result.x = (p1.x + p2.x) / 2; + result.y = (p1.y + p2.y) / 2; + return result; + } + + // Rect ------------------------------------------------------------------------ + + template + struct Rect; + + using Rect64 = Rect; + using RectD = Rect; + + template + struct Rect { + T left; + T top; + T right; + T bottom; + + Rect(T l, T t, T r, T b) : + left(l), + top(t), + right(r), + bottom(b) {} + + Rect(bool is_valid = true) + { + if (is_valid) + { + left = right = top = bottom = 0; + } + else + { + left = top = (std::numeric_limits::max)(); + right = bottom = std::numeric_limits::lowest(); + } + } + + static Rect InvalidRect() + { + return { + (std::numeric_limits::max)(), + (std::numeric_limits::max)(), + std::numeric_limits::lowest(), + std::numeric_limits::lowest() }; + } + + bool IsValid() const { return left != (std::numeric_limits::max)(); } + + T Width() const { return right - left; } + T Height() const { return bottom - top; } + void Width(T width) { right = left + width; } + void Height(T height) { bottom = top + height; } + + Point MidPoint() const + { + return Point((left + right) / 2, (top + bottom) / 2); + } + + Path AsPath() const + { + Path result; + result.reserve(4); + result.push_back(Point(left, top)); + result.push_back(Point(right, top)); + result.push_back(Point(right, bottom)); + result.push_back(Point(left, bottom)); + return result; + } + + bool Contains(const Point& pt) const + { + return pt.x > left && pt.x < right&& pt.y > top && pt.y < bottom; + } + + bool Contains(const Rect& rec) const + { + return rec.left >= left && rec.right <= right && + rec.top >= top && rec.bottom <= bottom; + } + + void Scale(double scale) { + left *= scale; + top *= scale; + right *= scale; + bottom *= scale; + } + + bool IsEmpty() const { return bottom <= top || right <= left; }; + + bool Intersects(const Rect& rec) const + { + return ((std::max)(left, rec.left) <= (std::min)(right, rec.right)) && + ((std::max)(top, rec.top) <= (std::min)(bottom, rec.bottom)); + }; + + bool operator==(const Rect& other) const { + return left == other.left && right == other.right && + top == other.top && bottom == other.bottom; + } + + friend std::ostream& operator<<(std::ostream& os, const Rect& rect) { + os << "(" << rect.left << "," << rect.top << "," << rect.right << "," << rect.bottom << ") "; + return os; + } + }; + + template + inline Rect ScaleRect(const Rect& rect, double scale) + { + Rect result; + + if constexpr (std::numeric_limits::is_integer && + !std::numeric_limits::is_integer) + { + result.left = static_cast(std::round(rect.left * scale)); + result.top = static_cast(std::round(rect.top * scale)); + result.right = static_cast(std::round(rect.right * scale)); + result.bottom = static_cast(std::round(rect.bottom * scale)); + } + else + { + result.left = rect.left * scale; + result.top = rect.top * scale; + result.right = rect.right * scale; + result.bottom = rect.bottom * scale; + } + return result; + } + + static const Rect64 InvalidRect64 = Rect64::InvalidRect(); + static const RectD InvalidRectD = RectD::InvalidRect(); + + template + Rect GetBounds(const Path& path) + { + T xmin = (std::numeric_limits::max)(); + T ymin = (std::numeric_limits::max)(); + T xmax = std::numeric_limits::lowest(); + T ymax = std::numeric_limits::lowest(); + for (const auto& p : path) + { + if (p.x < xmin) xmin = p.x; + if (p.x > xmax) xmax = p.x; + if (p.y < ymin) ymin = p.y; + if (p.y > ymax) ymax = p.y; + } + return Rect(xmin, ymin, xmax, ymax); + } + + template + Rect GetBounds(const Paths& paths) + { + T xmin = (std::numeric_limits::max)(); + T ymin = (std::numeric_limits::max)(); + T xmax = std::numeric_limits::lowest(); + T ymax = std::numeric_limits::lowest(); + for (const Path& path : paths) + for (const Point& p : path) + { + if (p.x < xmin) xmin = p.x; + if (p.x > xmax) xmax = p.x; + if (p.y < ymin) ymin = p.y; + if (p.y > ymax) ymax = p.y; + } + return Rect(xmin, ymin, xmax, ymax); + } + + template + Rect GetBounds(const Path& path) + { + T xmin = (std::numeric_limits::max)(); + T ymin = (std::numeric_limits::max)(); + T xmax = std::numeric_limits::lowest(); + T ymax = std::numeric_limits::lowest(); + for (const auto& p : path) + { + if (p.x < xmin) xmin = p.x; + if (p.x > xmax) xmax = p.x; + if (p.y < ymin) ymin = p.y; + if (p.y > ymax) ymax = p.y; + } + return Rect(xmin, ymin, xmax, ymax); + } + + template + Rect GetBounds(const Paths& paths) + { + T xmin = (std::numeric_limits::max)(); + T ymin = (std::numeric_limits::max)(); + T xmax = std::numeric_limits::lowest(); + T ymax = std::numeric_limits::lowest(); + for (const Path& path : paths) + for (const Point& p : path) + { + if (p.x < xmin) xmin = p.x; + if (p.x > xmax) xmax = p.x; + if (p.y < ymin) ymin = p.y; + if (p.y > ymax) ymax = p.y; + } + return Rect(xmin, ymin, xmax, ymax); + } + + template + std::ostream& operator << (std::ostream& outstream, const Path& path) + { + if (!path.empty()) + { + auto pt = path.cbegin(), last = path.cend() - 1; + while (pt != last) + outstream << *pt++ << ", "; + outstream << *last << std::endl; + } + return outstream; + } + + template + std::ostream& operator << (std::ostream& outstream, const Paths& paths) + { + for (auto p : paths) + outstream << p; + return outstream; + } + + + template + inline Path ScalePath(const Path& path, + double scale_x, double scale_y, int& error_code) + { + Path result; + if (scale_x == 0 || scale_y == 0) + { + error_code |= scale_error_i; + DoError(scale_error_i); + // if no exception, treat as non-fatal error + if (scale_x == 0) scale_x = 1.0; + if (scale_y == 0) scale_y = 1.0; + } + + result.reserve(path.size()); +#ifdef USINGZ + std::transform(path.begin(), path.end(), back_inserter(result), + [scale_x, scale_y](const auto& pt) + { return Point(pt.x * scale_x, pt.y * scale_y, pt.z); }); +#else + std::transform(path.begin(), path.end(), back_inserter(result), + [scale_x, scale_y](const auto& pt) + { return Point(pt.x * scale_x, pt.y * scale_y); }); +#endif + return result; + } + + template + inline Path ScalePath(const Path& path, + double scale, int& error_code) + { + return ScalePath(path, scale, scale, error_code); + } + + template + inline Paths ScalePaths(const Paths& paths, + double scale_x, double scale_y, int& error_code) + { + Paths result; + + if constexpr (std::numeric_limits::is_integer) + { + RectD r = GetBounds(paths); + if ((r.left * scale_x) < min_coord || + (r.right * scale_x) > max_coord || + (r.top * scale_y) < min_coord || + (r.bottom * scale_y) > max_coord) + { + error_code |= range_error_i; + DoError(range_error_i); + return result; // empty path + } + } + + result.reserve(paths.size()); + std::transform(paths.begin(), paths.end(), back_inserter(result), + [=, &error_code](const auto& path) + { return ScalePath(path, scale_x, scale_y, error_code); }); + return result; + } + + template + inline Paths ScalePaths(const Paths& paths, + double scale, int& error_code) + { + return ScalePaths(paths, scale, scale, error_code); + } + + template + inline Path TransformPath(const Path& path) + { + Path result; + result.reserve(path.size()); + std::transform(path.cbegin(), path.cend(), std::back_inserter(result), + [](const Point& pt) {return Point(pt); }); + return result; + } + + template + inline Paths TransformPaths(const Paths& paths) + { + Paths result; + std::transform(paths.cbegin(), paths.cend(), std::back_inserter(result), + [](const Path& path) {return TransformPath(path); }); + return result; + } + + template + inline double Sqr(T val) + { + return static_cast(val) * static_cast(val); + } + + template + inline bool NearEqual(const Point& p1, + const Point& p2, double max_dist_sqrd) + { + return Sqr(p1.x - p2.x) + Sqr(p1.y - p2.y) < max_dist_sqrd; + } + + template + inline Path StripNearEqual(const Path& path, + double max_dist_sqrd, bool is_closed_path) + { + if (path.size() == 0) return Path(); + Path result; + result.reserve(path.size()); + typename Path::const_iterator path_iter = path.cbegin(); + Point first_pt = *path_iter++, last_pt = first_pt; + result.push_back(first_pt); + for (; path_iter != path.cend(); ++path_iter) + { + if (!NearEqual(*path_iter, last_pt, max_dist_sqrd)) + { + last_pt = *path_iter; + result.push_back(last_pt); + } + } + if (!is_closed_path) return result; + while (result.size() > 1 && + NearEqual(result.back(), first_pt, max_dist_sqrd)) result.pop_back(); + return result; + } + + template + inline Paths StripNearEqual(const Paths& paths, + double max_dist_sqrd, bool is_closed_path) + { + Paths result; + result.reserve(paths.size()); + for (typename Paths::const_iterator paths_citer = paths.cbegin(); + paths_citer != paths.cend(); ++paths_citer) + { + result.push_back(StripNearEqual(*paths_citer, max_dist_sqrd, is_closed_path)); + } + return result; + } + + template + inline void StripDuplicates( Path& path, bool is_closed_path) + { + //https://stackoverflow.com/questions/1041620/whats-the-most-efficient-way-to-erase-duplicates-and-sort-a-vector#:~:text=Let%27s%20compare%20three%20approaches%3A + path.erase(std::unique(path.begin(), path.end()), path.end()); + if (is_closed_path) + while (path.size() > 1 && path.back() == path.front()) path.pop_back(); + } + + template + inline void StripDuplicates( Paths& paths, bool is_closed_path) + { + for (typename Paths::iterator paths_citer = paths.begin(); + paths_citer != paths.end(); ++paths_citer) + { + StripDuplicates(*paths_citer, is_closed_path); + } + } + + // Miscellaneous ------------------------------------------------------------ + + inline void CheckPrecisionRange(int& precision, int& error_code) + { + if (precision >= -CLIPPER2_MAX_DEC_PRECISION && + precision <= CLIPPER2_MAX_DEC_PRECISION) return; + error_code |= precision_error_i; // non-fatal error + DoError(precision_error_i); // does nothing when exceptions are disabled + precision = precision > 0 ? CLIPPER2_MAX_DEC_PRECISION : -CLIPPER2_MAX_DEC_PRECISION; + } + + inline void CheckPrecisionRange(int& precision) + { + int error_code = 0; + CheckPrecisionRange(precision, error_code); + } + + template + inline double CrossProduct(const Point& pt1, const Point& pt2, const Point& pt3) { + return (static_cast(pt2.x - pt1.x) * static_cast(pt3.y - + pt2.y) - static_cast(pt2.y - pt1.y) * static_cast(pt3.x - pt2.x)); + } + + template + inline double CrossProduct(const Point& vec1, const Point& vec2) + { + return static_cast(vec1.y * vec2.x) - static_cast(vec2.y * vec1.x); + } + + template + inline double DotProduct(const Point& pt1, const Point& pt2, const Point& pt3) { + return (static_cast(pt2.x - pt1.x) * static_cast(pt3.x - pt2.x) + + static_cast(pt2.y - pt1.y) * static_cast(pt3.y - pt2.y)); + } + + template + inline double DotProduct(const Point& vec1, const Point& vec2) + { + return static_cast(vec1.x * vec2.x) + static_cast(vec1.y * vec2.y); + } + + template + inline double DistanceSqr(const Point pt1, const Point pt2) + { + return Sqr(pt1.x - pt2.x) + Sqr(pt1.y - pt2.y); + } + + template + inline double DistanceFromLineSqrd(const Point& pt, const Point& ln1, const Point& ln2) + { + //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²) + //see http://en.wikipedia.org/wiki/Perpendicular_distance + double A = static_cast(ln1.y - ln2.y); + double B = static_cast(ln2.x - ln1.x); + double C = A * ln1.x + B * ln1.y; + C = A * pt.x + B * pt.y - C; + return (C * C) / (A * A + B * B); + } + + template + inline double Area(const Path& path) + { + size_t cnt = path.size(); + if (cnt < 3) return 0.0; + double a = 0.0; + typename Path::const_iterator it1, it2 = path.cend() - 1, stop = it2; + if (!(cnt & 1)) ++stop; + for (it1 = path.cbegin(); it1 != stop;) + { + a += static_cast(it2->y + it1->y) * (it2->x - it1->x); + it2 = it1 + 1; + a += static_cast(it1->y + it2->y) * (it1->x - it2->x); + it1 += 2; + } + if (cnt & 1) + a += static_cast(it2->y + it1->y) * (it2->x - it1->x); + return a * 0.5; + } + + template + inline double Area(const Paths& paths) + { + double a = 0.0; + for (typename Paths::const_iterator paths_iter = paths.cbegin(); + paths_iter != paths.cend(); ++paths_iter) + { + a += Area(*paths_iter); + } + return a; + } + + template + inline bool IsPositive(const Path& poly) + { + // A curve has positive orientation [and area] if a region 'R' + // is on the left when traveling around the outside of 'R'. + //https://mathworld.wolfram.com/CurveOrientation.html + //nb: This statement is premised on using Cartesian coordinates + return Area(poly) >= 0; + } + +#if CLIPPER2_HI_PRECISION + // caution: this will compromise performance + // https://github.com/AngusJohnson/Clipper2/issues/317#issuecomment-1314023253 + // See also CPP/BenchMark/GetIntersectPtBenchmark.cpp + #define CC_MIN(x,y) ((x)>(y)?(y):(x)) + #define CC_MAX(x,y) ((x)<(y)?(y):(x)) + template + inline bool GetIntersectPoint(const Point& ln1a, const Point& ln1b, + const Point& ln2a, const Point& ln2b, Point& ip) + { + double ln1dy = static_cast(ln1b.y - ln1a.y); + double ln1dx = static_cast(ln1a.x - ln1b.x); + double ln2dy = static_cast(ln2b.y - ln2a.y); + double ln2dx = static_cast(ln2a.x - ln2b.x); + double det = (ln2dy * ln1dx) - (ln1dy * ln2dx); + if (det == 0.0) return false; + T bb0minx = CC_MIN(ln1a.x, ln1b.x); + T bb0miny = CC_MIN(ln1a.y, ln1b.y); + T bb0maxx = CC_MAX(ln1a.x, ln1b.x); + T bb0maxy = CC_MAX(ln1a.y, ln1b.y); + T bb1minx = CC_MIN(ln2a.x, ln2b.x); + T bb1miny = CC_MIN(ln2a.y, ln2b.y); + T bb1maxx = CC_MAX(ln2a.x, ln2b.x); + T bb1maxy = CC_MAX(ln2a.y, ln2b.y); + + if constexpr (std::numeric_limits::is_integer) + { + int64_t originx = (CC_MIN(bb0maxx, bb1maxx) + CC_MAX(bb0minx, bb1minx)) >> 1; + int64_t originy = (CC_MIN(bb0maxy, bb1maxy) + CC_MAX(bb0miny, bb1miny)) >> 1; + double ln0c = (ln1dy * static_cast(ln1a.x - originx)) + + (ln1dx * static_cast(ln1a.y - originy)); + double ln1c = (ln2dy * static_cast(ln2a.x - originx)) + + (ln2dx * static_cast(ln2a.y - originy)); + double hitx = ((ln1dx * ln1c) - (ln2dx * ln0c)) / det; + double hity = ((ln2dy * ln0c) - (ln1dy * ln1c)) / det; + + ip.x = originx + (T)nearbyint(hitx); + ip.y = originy + (T)nearbyint(hity); + } + else + { + double originx = (CC_MIN(bb0maxx, bb1maxx) + CC_MAX(bb0minx, bb1minx)) / 2.0; + double originy = (CC_MIN(bb0maxy, bb1maxy) + CC_MAX(bb0miny, bb1miny)) / 2.0; + double ln0c = (ln1dy * static_cast(ln1a.x - originx)) + + (ln1dx * static_cast(ln1a.y - originy)); + double ln1c = (ln2dy * static_cast(ln2a.x - originx)) + + (ln2dx * static_cast(ln2a.y - originy)); + double hitx = ((ln1dx * ln1c) - (ln2dx * ln0c)) / det; + double hity = ((ln2dy * ln0c) - (ln1dy * ln1c)) / det; + + ip.x = originx + static_cast(hitx); + ip.y = originy + static_cast(hity); + } + return true; +} +#else + template + inline bool GetIntersectPoint(const Point& ln1a, const Point& ln1b, + const Point& ln2a, const Point& ln2b, Point& ip) + { + // https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection + double dx1 = static_cast(ln1b.x - ln1a.x); + double dy1 = static_cast(ln1b.y - ln1a.y); + double dx2 = static_cast(ln2b.x - ln2a.x); + double dy2 = static_cast(ln2b.y - ln2a.y); + + double det = dy1 * dx2 - dy2 * dx1; + if (det == 0.0) return false; + double t = ((ln1a.x - ln2a.x) * dy2 - (ln1a.y - ln2a.y) * dx2) / det; + if (t <= 0.0) ip = ln1a; + else if (t >= 1.0) ip = ln1b; + else + { + ip.x = static_cast(ln1a.x + t * dx1); + ip.y = static_cast(ln1a.y + t * dy1); + } + return true; + } +#endif + + template + inline Point TranslatePoint(const Point& pt, double dx, double dy) + { +#ifdef USINGZ + return Point(pt.x + dx, pt.y + dy, pt.z); +#else + return Point(pt.x + dx, pt.y + dy); +#endif + } + + + template + inline Point ReflectPoint(const Point& pt, const Point& pivot) + { +#ifdef USINGZ + return Point(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y), pt.z); +#else + return Point(pivot.x + (pivot.x - pt.x), pivot.y + (pivot.y - pt.y)); +#endif + } + + inline bool SegmentsIntersect(const Point64& seg1a, const Point64& seg1b, + const Point64& seg2a, const Point64& seg2b, bool inclusive = false) + { + if (inclusive) + { + double res1 = CrossProduct(seg1a, seg2a, seg2b); + double res2 = CrossProduct(seg1b, seg2a, seg2b); + if (res1 * res2 > 0) return false; + double res3 = CrossProduct(seg2a, seg1a, seg1b); + double res4 = CrossProduct(seg2b, seg1a, seg1b); + if (res3 * res4 > 0) return false; + return (res1 || res2 || res3 || res4); // ensures not collinear + } + else { + return (CrossProduct(seg1a, seg2a, seg2b) * + CrossProduct(seg1b, seg2a, seg2b) < 0) && + (CrossProduct(seg2a, seg1a, seg1b) * + CrossProduct(seg2b, seg1a, seg1b) < 0); + } + } + + template + inline Point GetClosestPointOnSegment(const Point& offPt, + const Point& seg1, const Point& seg2) + { + if (seg1.x == seg2.x && seg1.y == seg2.y) return seg1; + double dx = static_cast(seg2.x - seg1.x); + double dy = static_cast(seg2.y - seg1.y); + double q = + (static_cast(offPt.x - seg1.x) * dx + + static_cast(offPt.y - seg1.y) * dy) / + (Sqr(dx) + Sqr(dy)); + if (q < 0) q = 0; else if (q > 1) q = 1; + if constexpr (std::numeric_limits::is_integer) + return Point( + seg1.x + static_cast(nearbyint(q * dx)), + seg1.y + static_cast(nearbyint(q * dy))); + else + return Point( + seg1.x + static_cast(q * dx), + seg1.y + static_cast(q * dy)); + } + + enum class PointInPolygonResult { IsOn, IsInside, IsOutside }; + + template + inline PointInPolygonResult PointInPolygon(const Point& pt, const Path& polygon) + { + if (polygon.size() < 3) + return PointInPolygonResult::IsOutside; + + int val = 0; + typename Path::const_iterator cbegin = polygon.cbegin(), first = cbegin, curr, prev; + typename Path::const_iterator cend = polygon.cend(); + + while (first != cend && first->y == pt.y) ++first; + if (first == cend) // not a proper polygon + return PointInPolygonResult::IsOutside; + + bool is_above = first->y < pt.y, starting_above = is_above; + curr = first +1; + while (true) + { + if (curr == cend) + { + if (cend == first || first == cbegin) break; + cend = first; + curr = cbegin; + } + + if (is_above) + { + while (curr != cend && curr->y < pt.y) ++curr; + if (curr == cend) continue; + } + else + { + while (curr != cend && curr->y > pt.y) ++curr; + if (curr == cend) continue; + } + + if (curr == cbegin) + prev = polygon.cend() - 1; //nb: NOT cend (since might equal first) + else + prev = curr - 1; + + if (curr->y == pt.y) + { + if (curr->x == pt.x || + (curr->y == prev->y && + ((pt.x < prev->x) != (pt.x < curr->x)))) + return PointInPolygonResult::IsOn; + ++curr; + if (curr == first) break; + continue; + } + + if (pt.x < curr->x && pt.x < prev->x) + { + // we're only interested in edges crossing on the left + } + else if (pt.x > prev->x && pt.x > curr->x) + val = 1 - val; // toggle val + else + { + double d = CrossProduct(*prev, *curr, pt); + if (d == 0) return PointInPolygonResult::IsOn; + if ((d < 0) == is_above) val = 1 - val; + } + is_above = !is_above; + ++curr; + } + + if (is_above != starting_above) + { + cend = polygon.cend(); + if (curr == cend) curr = cbegin; + if (curr == cbegin) prev = cend - 1; + else prev = curr - 1; + double d = CrossProduct(*prev, *curr, pt); + if (d == 0) return PointInPolygonResult::IsOn; + if ((d < 0) == is_above) val = 1 - val; + } + + return (val == 0) ? + PointInPolygonResult::IsOutside : + PointInPolygonResult::IsInside; + } + +} // namespace + +#endif // CLIPPER_CORE_H diff --git a/source/Libraries/Clipper2/clipper.engine.cpp b/source/Libraries/Clipper2/clipper.engine.cpp new file mode 100644 index 00000000..4ca85258 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.engine.cpp @@ -0,0 +1,3103 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 1 December 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : This is the main polygon clipping module * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "clipper.engine.h" +#include "clipper.h" + +// https://github.com/AngusJohnson/Clipper2/discussions/334 +// #discussioncomment-4248602 +#if defined(_MSC_VER) && ( defined(_M_AMD64) || defined(_M_X64) ) +#include +#include +#define fmin(a,b) _mm_cvtsd_f64(_mm_min_sd(_mm_set_sd(a),_mm_set_sd(b))) +#define fmax(a,b) _mm_cvtsd_f64(_mm_max_sd(_mm_set_sd(a),_mm_set_sd(b))) +#define nearbyint(a) _mm_cvtsd_si64(_mm_set_sd(a)) /* Note: expression type is (int64_t) */ +#endif + +namespace Clipper2Lib { + + static const Rect64 invalid_rect = Rect64(false); + + // Every closed path (or polygon) is made up of a series of vertices forming + // edges that alternate between going up (relative to the Y-axis) and going + // down. Edges consecutively going up or consecutively going down are called + // 'bounds' (ie sides if they're simple polygons). 'Local Minima' refer to + // vertices where descending bounds become ascending ones. + + struct Scanline { + int64_t y = 0; + Scanline* next = nullptr; + + explicit Scanline(int64_t y_) : y(y_) {} + }; + + struct HorzSegSorter { + inline bool operator()(const HorzSegment& hs1, const HorzSegment& hs2) + { + if (!hs1.right_op || !hs2.right_op) return (hs1.right_op); + return hs2.left_op->pt.x > hs1.left_op->pt.x; + } + }; + + struct LocMinSorter { + inline bool operator()(const LocalMinima_ptr& locMin1, + const LocalMinima_ptr& locMin2) + { + if (locMin2->vertex->pt.y != locMin1->vertex->pt.y) + return locMin2->vertex->pt.y < locMin1->vertex->pt.y; + else + return locMin2->vertex->pt.x > locMin1->vertex->pt.x; + } + }; + + + inline bool IsOdd(int val) + { + return (val & 1) ? true : false; + } + + + inline bool IsHotEdge(const Active& e) + { + return (e.outrec); + } + + + inline bool IsOpen(const Active& e) + { + return (e.local_min->is_open); + } + + + inline bool IsOpenEnd(const Vertex& v) + { + return (v.flags & (VertexFlags::OpenStart | VertexFlags::OpenEnd)) != + VertexFlags::None; + } + + + inline bool IsOpenEnd(const Active& ae) + { + return IsOpenEnd(*ae.vertex_top); + } + + + inline Active* GetPrevHotEdge(const Active& e) + { + Active* prev = e.prev_in_ael; + while (prev && (IsOpen(*prev) || !IsHotEdge(*prev))) + prev = prev->prev_in_ael; + return prev; + } + + inline bool IsFront(const Active& e) + { + return (&e == e.outrec->front_edge); + } + + inline bool IsInvalidPath(OutPt* op) + { + return (!op || op->next == op); + } + + /******************************************************************************* + * Dx: 0(90deg) * + * | * + * +inf (180deg) <--- o ---> -inf (0deg) * + *******************************************************************************/ + + inline double GetDx(const Point64& pt1, const Point64& pt2) + { + double dy = double(pt2.y - pt1.y); + if (dy != 0) + return double(pt2.x - pt1.x) / dy; + else if (pt2.x > pt1.x) + return -std::numeric_limits::max(); + else + return std::numeric_limits::max(); + } + + inline int64_t TopX(const Active& ae, const int64_t currentY) + { + if ((currentY == ae.top.y) || (ae.top.x == ae.bot.x)) return ae.top.x; + else if (currentY == ae.bot.y) return ae.bot.x; + else return ae.bot.x + static_cast(nearbyint(ae.dx * (currentY - ae.bot.y))); + // nb: std::nearbyint (or std::round) substantially *improves* performance here + // as it greatly improves the likelihood of edge adjacency in ProcessIntersectList(). + } + + + inline bool IsHorizontal(const Active& e) + { + return (e.top.y == e.bot.y); + } + + + inline bool IsHeadingRightHorz(const Active& e) + { + return e.dx == -std::numeric_limits::max(); + } + + + inline bool IsHeadingLeftHorz(const Active& e) + { + return e.dx == std::numeric_limits::max(); + } + + + inline void SwapActives(Active*& e1, Active*& e2) + { + Active* e = e1; + e1 = e2; + e2 = e; + } + + inline PathType GetPolyType(const Active& e) + { + return e.local_min->polytype; + } + + inline bool IsSamePolyType(const Active& e1, const Active& e2) + { + return e1.local_min->polytype == e2.local_min->polytype; + } + + inline void SetDx(Active& e) + { + e.dx = GetDx(e.bot, e.top); + } + + inline Vertex* NextVertex(const Active& e) + { + if (e.wind_dx > 0) + return e.vertex_top->next; + else + return e.vertex_top->prev; + } + + //PrevPrevVertex: useful to get the (inverted Y-axis) top of the + //alternate edge (ie left or right bound) during edge insertion. + inline Vertex* PrevPrevVertex(const Active& ae) + { + if (ae.wind_dx > 0) + return ae.vertex_top->prev->prev; + else + return ae.vertex_top->next->next; + } + + + inline Active* ExtractFromSEL(Active* ae) + { + Active* res = ae->next_in_sel; + if (res) + res->prev_in_sel = ae->prev_in_sel; + ae->prev_in_sel->next_in_sel = res; + return res; + } + + + inline void Insert1Before2InSEL(Active* ae1, Active* ae2) + { + ae1->prev_in_sel = ae2->prev_in_sel; + if (ae1->prev_in_sel) + ae1->prev_in_sel->next_in_sel = ae1; + ae1->next_in_sel = ae2; + ae2->prev_in_sel = ae1; + } + + inline bool IsMaxima(const Vertex& v) + { + return ((v.flags & VertexFlags::LocalMax) != VertexFlags::None); + } + + + inline bool IsMaxima(const Active& e) + { + return IsMaxima(*e.vertex_top); + } + + inline Vertex* GetCurrYMaximaVertex_Open(const Active& e) + { + Vertex* result = e.vertex_top; + if (e.wind_dx > 0) + while ((result->next->pt.y == result->pt.y) && + ((result->flags & (VertexFlags::OpenEnd | + VertexFlags::LocalMax)) == VertexFlags::None)) + result = result->next; + else + while (result->prev->pt.y == result->pt.y && + ((result->flags & (VertexFlags::OpenEnd | + VertexFlags::LocalMax)) == VertexFlags::None)) + result = result->prev; + if (!IsMaxima(*result)) result = nullptr; // not a maxima + return result; + } + + inline Vertex* GetCurrYMaximaVertex(const Active& e) + { + Vertex* result = e.vertex_top; + if (e.wind_dx > 0) + while (result->next->pt.y == result->pt.y) result = result->next; + else + while (result->prev->pt.y == result->pt.y) result = result->prev; + if (!IsMaxima(*result)) result = nullptr; // not a maxima + return result; + } + + Active* GetMaximaPair(const Active& e) + { + Active* e2; + e2 = e.next_in_ael; + while (e2) + { + if (e2->vertex_top == e.vertex_top) return e2; // Found! + e2 = e2->next_in_ael; + } + return nullptr; + } + + inline int PointCount(OutPt* op) + { + OutPt* op2 = op; + int cnt = 0; + do + { + op2 = op2->next; + ++cnt; + } while (op2 != op); + return cnt; + } + + inline OutPt* DuplicateOp(OutPt* op, bool insert_after) + { + OutPt* result = new OutPt(op->pt, op->outrec); + if (insert_after) + { + result->next = op->next; + result->next->prev = result; + result->prev = op; + op->next = result; + } + else + { + result->prev = op->prev; + result->prev->next = result; + result->next = op; + op->prev = result; + } + return result; + } + + inline OutPt* DisposeOutPt(OutPt* op) + { + OutPt* result = op->next; + op->prev->next = op->next; + op->next->prev = op->prev; + delete op; + return result; + } + + + inline void DisposeOutPts(OutRec* outrec) + { + OutPt* op = outrec->pts; + op->prev->next = nullptr; + while (op) + { + OutPt* tmp = op; + op = op->next; + delete tmp; + }; + outrec->pts = nullptr; + } + + + bool IntersectListSort(const IntersectNode& a, const IntersectNode& b) + { + //note different inequality tests ... + return (a.pt.y == b.pt.y) ? (a.pt.x < b.pt.x) : (a.pt.y > b.pt.y); + } + + + inline void SetSides(OutRec& outrec, Active& start_edge, Active& end_edge) + { + outrec.front_edge = &start_edge; + outrec.back_edge = &end_edge; + } + + + void SwapOutrecs(Active& e1, Active& e2) + { + OutRec* or1 = e1.outrec; + OutRec* or2 = e2.outrec; + if (or1 == or2) + { + Active* e = or1->front_edge; + or1->front_edge = or1->back_edge; + or1->back_edge = e; + return; + } + if (or1) + { + if (&e1 == or1->front_edge) + or1->front_edge = &e2; + else + or1->back_edge = &e2; + } + if (or2) + { + if (&e2 == or2->front_edge) + or2->front_edge = &e1; + else + or2->back_edge = &e1; + } + e1.outrec = or2; + e2.outrec = or1; + } + + + double Area(OutPt* op) + { + //https://en.wikipedia.org/wiki/Shoelace_formula + double result = 0.0; + OutPt* op2 = op; + do + { + result += static_cast(op2->prev->pt.y + op2->pt.y) * + static_cast(op2->prev->pt.x - op2->pt.x); + op2 = op2->next; + } while (op2 != op); + return result * 0.5; + } + + inline double AreaTriangle(const Point64& pt1, + const Point64& pt2, const Point64& pt3) + { + return (static_cast(pt3.y + pt1.y) * static_cast(pt3.x - pt1.x) + + static_cast(pt1.y + pt2.y) * static_cast(pt1.x - pt2.x) + + static_cast(pt2.y + pt3.y) * static_cast(pt2.x - pt3.x)); + } + + void ReverseOutPts(OutPt* op) + { + if (!op) return; + + OutPt* op1 = op; + OutPt* op2; + + do + { + op2 = op1->next; + op1->next = op1->prev; + op1->prev = op2; + op1 = op2; + } while (op1 != op); + } + + inline void SwapSides(OutRec& outrec) + { + Active* e2 = outrec.front_edge; + outrec.front_edge = outrec.back_edge; + outrec.back_edge = e2; + outrec.pts = outrec.pts->next; + } + + inline OutRec* GetRealOutRec(OutRec* outrec) + { + while (outrec && !outrec->pts) outrec = outrec->owner; + return outrec; + } + + inline bool IsValidOwner(OutRec* outrec, OutRec* testOwner) + { + // prevent outrec owning itself either directly or indirectly + while (testOwner && testOwner != outrec) testOwner = testOwner->owner; + return !testOwner; + } + + inline void UncoupleOutRec(Active ae) + { + OutRec* outrec = ae.outrec; + if (!outrec) return; + outrec->front_edge->outrec = nullptr; + outrec->back_edge->outrec = nullptr; + outrec->front_edge = nullptr; + outrec->back_edge = nullptr; + } + + + inline bool PtsReallyClose(const Point64& pt1, const Point64& pt2) + { + return (std::llabs(pt1.x - pt2.x) < 2) && (std::llabs(pt1.y - pt2.y) < 2); + } + + inline bool IsVerySmallTriangle(const OutPt& op) + { + return op.next->next == op.prev && + (PtsReallyClose(op.prev->pt, op.next->pt) || + PtsReallyClose(op.pt, op.next->pt) || + PtsReallyClose(op.pt, op.prev->pt)); + } + + inline bool IsValidClosedPath(const OutPt* op) + { + return op && (op->next != op) && (op->next != op->prev) && + !IsVerySmallTriangle(*op); + } + + inline bool OutrecIsAscending(const Active* hotEdge) + { + return (hotEdge == hotEdge->outrec->front_edge); + } + + inline void SwapFrontBackSides(OutRec& outrec) + { + Active* tmp = outrec.front_edge; + outrec.front_edge = outrec.back_edge; + outrec.back_edge = tmp; + outrec.pts = outrec.pts->next; + } + + inline bool EdgesAdjacentInAEL(const IntersectNode& inode) + { + return (inode.edge1->next_in_ael == inode.edge2) || (inode.edge1->prev_in_ael == inode.edge2); + } + + inline bool IsJoined(const Active& e) + { + return e.join_with != JoinWith::None; + } + + inline void SetOwner(OutRec* outrec, OutRec* new_owner) + { + //precondition1: new_owner is never null + while (new_owner->owner && !new_owner->owner->pts) + new_owner->owner = new_owner->owner->owner; + OutRec* tmp = new_owner; + while (tmp && tmp != outrec) tmp = tmp->owner; + if (tmp) new_owner->owner = outrec->owner; + outrec->owner = new_owner; + } + + static PointInPolygonResult PointInOpPolygon(const Point64& pt, OutPt* op) + { + if (op == op->next || op->prev == op->next) + return PointInPolygonResult::IsOutside; + + OutPt* op2 = op; + do + { + if (op->pt.y != pt.y) break; + op = op->next; + } while (op != op2); + if (op->pt.y == pt.y) // not a proper polygon + return PointInPolygonResult::IsOutside; + + bool is_above = op->pt.y < pt.y, starting_above = is_above; + int val = 0; + op2 = op->next; + while (op2 != op) + { + if (is_above) + while (op2 != op && op2->pt.y < pt.y) op2 = op2->next; + else + while (op2 != op && op2->pt.y > pt.y) op2 = op2->next; + if (op2 == op) break; + + // must have touched or crossed the pt.Y horizonal + // and this must happen an even number of times + + if (op2->pt.y == pt.y) // touching the horizontal + { + if (op2->pt.x == pt.x || (op2->pt.y == op2->prev->pt.y && + (pt.x < op2->prev->pt.x) != (pt.x < op2->pt.x))) + return PointInPolygonResult::IsOn; + + op2 = op2->next; + if (op2 == op) break; + continue; + } + + if (pt.x < op2->pt.x && pt.x < op2->prev->pt.x); + // do nothing because + // we're only interested in edges crossing on the left + else if ((pt.x > op2->prev->pt.x && pt.x > op2->pt.x)) + val = 1 - val; // toggle val + else + { + double d = CrossProduct(op2->prev->pt, op2->pt, pt); + if (d == 0) return PointInPolygonResult::IsOn; + if ((d < 0) == is_above) val = 1 - val; + } + is_above = !is_above; + op2 = op2->next; + } + + if (is_above != starting_above) + { + double d = CrossProduct(op2->prev->pt, op2->pt, pt); + if (d == 0) return PointInPolygonResult::IsOn; + if ((d < 0) == is_above) val = 1 - val; + } + + if (val == 0) return PointInPolygonResult::IsOutside; + else return PointInPolygonResult::IsInside; + } + + inline Path64 GetCleanPath(OutPt* op) + { + Path64 result; + OutPt* op2 = op; + while (op2->next != op && + ((op2->pt.x == op2->next->pt.x && op2->pt.x == op2->prev->pt.x) || + (op2->pt.y == op2->next->pt.y && op2->pt.y == op2->prev->pt.y))) op2 = op2->next; + result.push_back(op2->pt); + OutPt* prevOp = op2; + op2 = op2->next; + while (op2 != op) + { + if ((op2->pt.x != op2->next->pt.x || op2->pt.x != prevOp->pt.x) && + (op2->pt.y != op2->next->pt.y || op2->pt.y != prevOp->pt.y)) + { + result.push_back(op2->pt); + prevOp = op2; + } + op2 = op2->next; + } + return result; + } + + inline bool Path1InsidePath2(OutPt* op1, OutPt* op2) + { + // we need to make some accommodation for rounding errors + // so we won't jump if the first vertex is found outside + PointInPolygonResult result; + int outside_cnt = 0; + OutPt* op = op1; + do + { + result = PointInOpPolygon(op->pt, op2); + if (result == PointInPolygonResult::IsOutside) ++outside_cnt; + else if (result == PointInPolygonResult::IsInside) --outside_cnt; + op = op->next; + } while (op != op1 && std::abs(outside_cnt) < 2); + if (std::abs(outside_cnt) > 1) return (outside_cnt < 0); + // since path1's location is still equivocal, check its midpoint + Point64 mp = GetBounds(GetCleanPath(op1)).MidPoint(); + Path64 path2 = GetCleanPath(op2); + return PointInPolygon(mp, path2) != PointInPolygonResult::IsOutside; + } + + //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ + + void AddLocMin(LocalMinimaList& list, + Vertex& vert, PathType polytype, bool is_open) + { + //make sure the vertex is added only once ... + if ((VertexFlags::LocalMin & vert.flags) != VertexFlags::None) return; + + vert.flags = (vert.flags | VertexFlags::LocalMin); + list.push_back(std::make_unique (&vert, polytype, is_open)); + } + + void AddPaths_(const Paths64& paths, PathType polytype, bool is_open, + std::vector& vertexLists, LocalMinimaList& locMinList) + { + const auto total_vertex_count = + std::accumulate(paths.begin(), paths.end(), 0, + [](const auto& a, const Path64& path) + {return a + static_cast(path.size()); }); + if (total_vertex_count == 0) return; + + Vertex* vertices = new Vertex[total_vertex_count], * v = vertices; + for (const Path64& path : paths) + { + //for each path create a circular double linked list of vertices + Vertex* v0 = v, * curr_v = v, * prev_v = nullptr; + + if (path.empty()) + continue; + + v->prev = nullptr; + int cnt = 0; + for (const Point64& pt : path) + { + if (prev_v) + { + if (prev_v->pt == pt) continue; // ie skips duplicates + prev_v->next = curr_v; + } + curr_v->prev = prev_v; + curr_v->pt = pt; + curr_v->flags = VertexFlags::None; + prev_v = curr_v++; + cnt++; + } + if (!prev_v || !prev_v->prev) continue; + if (!is_open && prev_v->pt == v0->pt) + prev_v = prev_v->prev; + prev_v->next = v0; + v0->prev = prev_v; + v = curr_v; // ie get ready for next path + if (cnt < 2 || (cnt == 2 && !is_open)) continue; + + //now find and assign local minima + bool going_up, going_up0; + if (is_open) + { + curr_v = v0->next; + while (curr_v != v0 && curr_v->pt.y == v0->pt.y) + curr_v = curr_v->next; + going_up = curr_v->pt.y <= v0->pt.y; + if (going_up) + { + v0->flags = VertexFlags::OpenStart; + AddLocMin(locMinList , *v0, polytype, true); + } + else + v0->flags = VertexFlags::OpenStart | VertexFlags::LocalMax; + } + else // closed path + { + prev_v = v0->prev; + while (prev_v != v0 && prev_v->pt.y == v0->pt.y) + prev_v = prev_v->prev; + if (prev_v == v0) + continue; // only open paths can be completely flat + going_up = prev_v->pt.y > v0->pt.y; + } + + going_up0 = going_up; + prev_v = v0; + curr_v = v0->next; + while (curr_v != v0) + { + if (curr_v->pt.y > prev_v->pt.y && going_up) + { + prev_v->flags = (prev_v->flags | VertexFlags::LocalMax); + going_up = false; + } + else if (curr_v->pt.y < prev_v->pt.y && !going_up) + { + going_up = true; + AddLocMin(locMinList, *prev_v, polytype, is_open); + } + prev_v = curr_v; + curr_v = curr_v->next; + } + + if (is_open) + { + prev_v->flags = prev_v->flags | VertexFlags::OpenEnd; + if (going_up) + prev_v->flags = prev_v->flags | VertexFlags::LocalMax; + else + AddLocMin(locMinList, *prev_v, polytype, is_open); + } + else if (going_up != going_up0) + { + if (going_up0) AddLocMin(locMinList, *prev_v, polytype, false); + else prev_v->flags = prev_v->flags | VertexFlags::LocalMax; + } + } // end processing current path + + vertexLists.emplace_back(vertices); + } + + //------------------------------------------------------------------------------ + // ReuseableDataContainer64 methods ... + //------------------------------------------------------------------------------ + + void ReuseableDataContainer64::AddLocMin(Vertex& vert, PathType polytype, bool is_open) + { + //make sure the vertex is added only once ... + if ((VertexFlags::LocalMin & vert.flags) != VertexFlags::None) return; + + vert.flags = (vert.flags | VertexFlags::LocalMin); + minima_list_.push_back(std::make_unique (&vert, polytype, is_open)); + } + + void ReuseableDataContainer64::AddPaths(const Paths64& paths, + PathType polytype, bool is_open) + { + AddPaths_(paths, polytype, is_open, vertex_lists_, minima_list_); + } + + ReuseableDataContainer64::~ReuseableDataContainer64() + { + Clear(); + } + + void ReuseableDataContainer64::Clear() + { + minima_list_.clear(); + for (auto v : vertex_lists_) delete[] v; + vertex_lists_.clear(); + } + + //------------------------------------------------------------------------------ + // ClipperBase methods ... + //------------------------------------------------------------------------------ + + ClipperBase::~ClipperBase() + { + Clear(); + } + + void ClipperBase::DeleteEdges(Active*& e) + { + while (e) + { + Active* e2 = e; + e = e->next_in_ael; + delete e2; + } + } + + void ClipperBase::CleanUp() + { + DeleteEdges(actives_); + scanline_list_ = std::priority_queue(); + intersect_nodes_.clear(); + DisposeAllOutRecs(); + horz_seg_list_.clear(); + horz_join_list_.clear(); + } + + + void ClipperBase::Clear() + { + CleanUp(); + DisposeVerticesAndLocalMinima(); + current_locmin_iter_ = minima_list_.begin(); + minima_list_sorted_ = false; + has_open_paths_ = false; + } + + + void ClipperBase::Reset() + { + if (!minima_list_sorted_) + { + std::stable_sort(minima_list_.begin(), minima_list_.end(), LocMinSorter()); //#594 + minima_list_sorted_ = true; + } + LocalMinimaList::const_reverse_iterator i; + for (i = minima_list_.rbegin(); i != minima_list_.rend(); ++i) + InsertScanline((*i)->vertex->pt.y); + + current_locmin_iter_ = minima_list_.begin(); + actives_ = nullptr; + sel_ = nullptr; + succeeded_ = true; + } + + +#ifdef USINGZ + void ClipperBase::SetZ(const Active& e1, const Active& e2, Point64& ip) + { + if (!zCallback_) return; + // prioritize subject over clip vertices by passing + // subject vertices before clip vertices in the callback + if (GetPolyType(e1) == PathType::Subject) + { + if (ip == e1.bot) ip.z = e1.bot.z; + else if (ip == e1.top) ip.z = e1.top.z; + else if (ip == e2.bot) ip.z = e2.bot.z; + else if (ip == e2.top) ip.z = e2.top.z; + else ip.z = DefaultZ; + zCallback_(e1.bot, e1.top, e2.bot, e2.top, ip); + } + else + { + if (ip == e2.bot) ip.z = e2.bot.z; + else if (ip == e2.top) ip.z = e2.top.z; + else if (ip == e1.bot) ip.z = e1.bot.z; + else if (ip == e1.top) ip.z = e1.top.z; + else ip.z = DefaultZ; + zCallback_(e2.bot, e2.top, e1.bot, e1.top, ip); + } + } +#endif + + void ClipperBase::AddPath(const Path64& path, PathType polytype, bool is_open) + { + Paths64 tmp; + tmp.push_back(path); + AddPaths(tmp, polytype, is_open); + } + + void ClipperBase::AddPaths(const Paths64& paths, PathType polytype, bool is_open) + { + if (is_open) has_open_paths_ = true; + minima_list_sorted_ = false; + AddPaths_(paths, polytype, is_open, vertex_lists_, minima_list_); + } + + void ClipperBase::AddReuseableData(const ReuseableDataContainer64& reuseable_data) + { + // nb: reuseable_data will continue to own the vertices + // and remains responsible for their clean up. + succeeded_ = false; + minima_list_sorted_ = false; + LocalMinimaList::const_iterator i; + for (i = reuseable_data.minima_list_.cbegin(); i != reuseable_data.minima_list_.cend(); ++i) + { + minima_list_.push_back(std::make_unique ((*i)->vertex, (*i)->polytype, (*i)->is_open)); + if ((*i)->is_open) has_open_paths_ = true; + } + } + + void ClipperBase::InsertScanline(int64_t y) + { + scanline_list_.push(y); + } + + + bool ClipperBase::PopScanline(int64_t& y) + { + if (scanline_list_.empty()) return false; + y = scanline_list_.top(); + scanline_list_.pop(); + while (!scanline_list_.empty() && y == scanline_list_.top()) + scanline_list_.pop(); // Pop duplicates. + return true; + } + + + bool ClipperBase::PopLocalMinima(int64_t y, LocalMinima*& local_minima) + { + if (current_locmin_iter_ == minima_list_.end() || (*current_locmin_iter_)->vertex->pt.y != y) return false; + local_minima = (current_locmin_iter_++)->get(); + return true; + } + + void ClipperBase::DisposeAllOutRecs() + { + for (auto outrec : outrec_list_) + { + if (outrec->pts) DisposeOutPts(outrec); + delete outrec; + } + outrec_list_.resize(0); + } + + void ClipperBase::DisposeVerticesAndLocalMinima() + { + minima_list_.clear(); + for (auto v : vertex_lists_) delete[] v; + vertex_lists_.clear(); + } + + + void ClipperBase::AddLocMin(Vertex& vert, PathType polytype, bool is_open) + { + //make sure the vertex is added only once ... + if ((VertexFlags::LocalMin & vert.flags) != VertexFlags::None) return; + + vert.flags = (vert.flags | VertexFlags::LocalMin); + minima_list_.push_back(std::make_unique (&vert, polytype, is_open)); + } + + bool ClipperBase::IsContributingClosed(const Active& e) const + { + switch (fillrule_) + { + case FillRule::EvenOdd: + break; + case FillRule::NonZero: + if (abs(e.wind_cnt) != 1) return false; + break; + case FillRule::Positive: + if (e.wind_cnt != 1) return false; + break; + case FillRule::Negative: + if (e.wind_cnt != -1) return false; + break; + } + + switch (cliptype_) + { + case ClipType::None: + return false; + case ClipType::Intersection: + switch (fillrule_) + { + case FillRule::Positive: + return (e.wind_cnt2 > 0); + case FillRule::Negative: + return (e.wind_cnt2 < 0); + default: + return (e.wind_cnt2 != 0); + } + break; + + case ClipType::Union: + switch (fillrule_) + { + case FillRule::Positive: + return (e.wind_cnt2 <= 0); + case FillRule::Negative: + return (e.wind_cnt2 >= 0); + default: + return (e.wind_cnt2 == 0); + } + break; + + case ClipType::Difference: + bool result; + switch (fillrule_) + { + case FillRule::Positive: + result = (e.wind_cnt2 <= 0); + break; + case FillRule::Negative: + result = (e.wind_cnt2 >= 0); + break; + default: + result = (e.wind_cnt2 == 0); + } + if (GetPolyType(e) == PathType::Subject) + return result; + else + return !result; + break; + + case ClipType::Xor: return true; break; + } + return false; // we should never get here + } + + + inline bool ClipperBase::IsContributingOpen(const Active& e) const + { + bool is_in_clip, is_in_subj; + switch (fillrule_) + { + case FillRule::Positive: + is_in_clip = e.wind_cnt2 > 0; + is_in_subj = e.wind_cnt > 0; + break; + case FillRule::Negative: + is_in_clip = e.wind_cnt2 < 0; + is_in_subj = e.wind_cnt < 0; + break; + default: + is_in_clip = e.wind_cnt2 != 0; + is_in_subj = e.wind_cnt != 0; + } + + switch (cliptype_) + { + case ClipType::Intersection: return is_in_clip; + case ClipType::Union: return (!is_in_subj && !is_in_clip); + default: return !is_in_clip; + } + } + + + void ClipperBase::SetWindCountForClosedPathEdge(Active& e) + { + //Wind counts refer to polygon regions not edges, so here an edge's WindCnt + //indicates the higher of the wind counts for the two regions touching the + //edge. (NB Adjacent regions can only ever have their wind counts differ by + //one. Also, open paths have no meaningful wind directions or counts.) + + Active* e2 = e.prev_in_ael; + //find the nearest closed path edge of the same PolyType in AEL (heading left) + PathType pt = GetPolyType(e); + while (e2 && (GetPolyType(*e2) != pt || IsOpen(*e2))) e2 = e2->prev_in_ael; + + if (!e2) + { + e.wind_cnt = e.wind_dx; + e2 = actives_; + } + else if (fillrule_ == FillRule::EvenOdd) + { + e.wind_cnt = e.wind_dx; + e.wind_cnt2 = e2->wind_cnt2; + e2 = e2->next_in_ael; + } + else + { + //NonZero, positive, or negative filling here ... + //if e's WindCnt is in the SAME direction as its WindDx, then polygon + //filling will be on the right of 'e'. + //NB neither e2.WindCnt nor e2.WindDx should ever be 0. + if (e2->wind_cnt * e2->wind_dx < 0) + { + //opposite directions so 'e' is outside 'e2' ... + if (abs(e2->wind_cnt) > 1) + { + //outside prev poly but still inside another. + if (e2->wind_dx * e.wind_dx < 0) + //reversing direction so use the same WC + e.wind_cnt = e2->wind_cnt; + else + //otherwise keep 'reducing' the WC by 1 (ie towards 0) ... + e.wind_cnt = e2->wind_cnt + e.wind_dx; + } + else + //now outside all polys of same polytype so set own WC ... + e.wind_cnt = (IsOpen(e) ? 1 : e.wind_dx); + } + else + { + //'e' must be inside 'e2' + if (e2->wind_dx * e.wind_dx < 0) + //reversing direction so use the same WC + e.wind_cnt = e2->wind_cnt; + else + //otherwise keep 'increasing' the WC by 1 (ie away from 0) ... + e.wind_cnt = e2->wind_cnt + e.wind_dx; + } + e.wind_cnt2 = e2->wind_cnt2; + e2 = e2->next_in_ael; // ie get ready to calc WindCnt2 + } + + //update wind_cnt2 ... + if (fillrule_ == FillRule::EvenOdd) + while (e2 != &e) + { + if (GetPolyType(*e2) != pt && !IsOpen(*e2)) + e.wind_cnt2 = (e.wind_cnt2 == 0 ? 1 : 0); + e2 = e2->next_in_ael; + } + else + while (e2 != &e) + { + if (GetPolyType(*e2) != pt && !IsOpen(*e2)) + e.wind_cnt2 += e2->wind_dx; + e2 = e2->next_in_ael; + } + } + + + void ClipperBase::SetWindCountForOpenPathEdge(Active& e) + { + Active* e2 = actives_; + if (fillrule_ == FillRule::EvenOdd) + { + int cnt1 = 0, cnt2 = 0; + while (e2 != &e) + { + if (GetPolyType(*e2) == PathType::Clip) + cnt2++; + else if (!IsOpen(*e2)) + cnt1++; + e2 = e2->next_in_ael; + } + e.wind_cnt = (IsOdd(cnt1) ? 1 : 0); + e.wind_cnt2 = (IsOdd(cnt2) ? 1 : 0); + } + else + { + while (e2 != &e) + { + if (GetPolyType(*e2) == PathType::Clip) + e.wind_cnt2 += e2->wind_dx; + else if (!IsOpen(*e2)) + e.wind_cnt += e2->wind_dx; + e2 = e2->next_in_ael; + } + } + } + + + bool IsValidAelOrder(const Active& resident, const Active& newcomer) + { + if (newcomer.curr_x != resident.curr_x) + return newcomer.curr_x > resident.curr_x; + + //get the turning direction a1.top, a2.bot, a2.top + double d = CrossProduct(resident.top, newcomer.bot, newcomer.top); + if (d != 0) return d < 0; + + //edges must be collinear to get here + //for starting open paths, place them according to + //the direction they're about to turn + if (!IsMaxima(resident) && (resident.top.y > newcomer.top.y)) + { + return CrossProduct(newcomer.bot, + resident.top, NextVertex(resident)->pt) <= 0; + } + else if (!IsMaxima(newcomer) && (newcomer.top.y > resident.top.y)) + { + return CrossProduct(newcomer.bot, + newcomer.top, NextVertex(newcomer)->pt) >= 0; + } + + int64_t y = newcomer.bot.y; + bool newcomerIsLeft = newcomer.is_left_bound; + + if (resident.bot.y != y || resident.local_min->vertex->pt.y != y) + return newcomer.is_left_bound; + //resident must also have just been inserted + else if (resident.is_left_bound != newcomerIsLeft) + return newcomerIsLeft; + else if (CrossProduct(PrevPrevVertex(resident)->pt, + resident.bot, resident.top) == 0) return true; + else + //compare turning direction of the alternate bound + return (CrossProduct(PrevPrevVertex(resident)->pt, + newcomer.bot, PrevPrevVertex(newcomer)->pt) > 0) == newcomerIsLeft; + } + + + void ClipperBase::InsertLeftEdge(Active& e) + { + Active* e2; + if (!actives_) + { + e.prev_in_ael = nullptr; + e.next_in_ael = nullptr; + actives_ = &e; + } + else if (!IsValidAelOrder(*actives_, e)) + { + e.prev_in_ael = nullptr; + e.next_in_ael = actives_; + actives_->prev_in_ael = &e; + actives_ = &e; + } + else + { + e2 = actives_; + while (e2->next_in_ael && IsValidAelOrder(*e2->next_in_ael, e)) + e2 = e2->next_in_ael; + if (e2->join_with == JoinWith::Right) + e2 = e2->next_in_ael; + if (!e2) return; // should never happen and stops compiler warning :) + e.next_in_ael = e2->next_in_ael; + if (e2->next_in_ael) e2->next_in_ael->prev_in_ael = &e; + e.prev_in_ael = e2; + e2->next_in_ael = &e; + } + } + + + void InsertRightEdge(Active& e, Active& e2) + { + e2.next_in_ael = e.next_in_ael; + if (e.next_in_ael) e.next_in_ael->prev_in_ael = &e2; + e2.prev_in_ael = &e; + e.next_in_ael = &e2; + } + + + void ClipperBase::InsertLocalMinimaIntoAEL(int64_t bot_y) + { + LocalMinima* local_minima; + Active* left_bound, * right_bound; + //Add any local minima (if any) at BotY ... + //nb: horizontal local minima edges should contain locMin.vertex.prev + + while (PopLocalMinima(bot_y, local_minima)) + { + if ((local_minima->vertex->flags & VertexFlags::OpenStart) != VertexFlags::None) + { + left_bound = nullptr; + } + else + { + left_bound = new Active(); + left_bound->bot = local_minima->vertex->pt; + left_bound->curr_x = left_bound->bot.x; + left_bound->wind_dx = -1; + left_bound->vertex_top = local_minima->vertex->prev; // ie descending + left_bound->top = left_bound->vertex_top->pt; + left_bound->local_min = local_minima; + SetDx(*left_bound); + } + + if ((local_minima->vertex->flags & VertexFlags::OpenEnd) != VertexFlags::None) + { + right_bound = nullptr; + } + else + { + right_bound = new Active(); + right_bound->bot = local_minima->vertex->pt; + right_bound->curr_x = right_bound->bot.x; + right_bound->wind_dx = 1; + right_bound->vertex_top = local_minima->vertex->next; // ie ascending + right_bound->top = right_bound->vertex_top->pt; + right_bound->local_min = local_minima; + SetDx(*right_bound); + } + + //Currently LeftB is just the descending bound and RightB is the ascending. + //Now if the LeftB isn't on the left of RightB then we need swap them. + if (left_bound && right_bound) + { + if (IsHorizontal(*left_bound)) + { + if (IsHeadingRightHorz(*left_bound)) SwapActives(left_bound, right_bound); + } + else if (IsHorizontal(*right_bound)) + { + if (IsHeadingLeftHorz(*right_bound)) SwapActives(left_bound, right_bound); + } + else if (left_bound->dx < right_bound->dx) + SwapActives(left_bound, right_bound); + } + else if (!left_bound) + { + left_bound = right_bound; + right_bound = nullptr; + } + + bool contributing; + left_bound->is_left_bound = true; + InsertLeftEdge(*left_bound); + + if (IsOpen(*left_bound)) + { + SetWindCountForOpenPathEdge(*left_bound); + contributing = IsContributingOpen(*left_bound); + } + else + { + SetWindCountForClosedPathEdge(*left_bound); + contributing = IsContributingClosed(*left_bound); + } + + if (right_bound) + { + right_bound->is_left_bound = false; + right_bound->wind_cnt = left_bound->wind_cnt; + right_bound->wind_cnt2 = left_bound->wind_cnt2; + InsertRightEdge(*left_bound, *right_bound); /////// + if (contributing) + { + AddLocalMinPoly(*left_bound, *right_bound, left_bound->bot, true); + if (!IsHorizontal(*left_bound)) + CheckJoinLeft(*left_bound, left_bound->bot); + } + + while (right_bound->next_in_ael && + IsValidAelOrder(*right_bound->next_in_ael, *right_bound)) + { + IntersectEdges(*right_bound, *right_bound->next_in_ael, right_bound->bot); + SwapPositionsInAEL(*right_bound, *right_bound->next_in_ael); + } + + if (IsHorizontal(*right_bound)) + PushHorz(*right_bound); + else + { + CheckJoinRight(*right_bound, right_bound->bot); + InsertScanline(right_bound->top.y); + } + } + else if (contributing) + { + StartOpenPath(*left_bound, left_bound->bot); + } + + if (IsHorizontal(*left_bound)) + PushHorz(*left_bound); + else + InsertScanline(left_bound->top.y); + } // while (PopLocalMinima()) + } + + + inline void ClipperBase::PushHorz(Active& e) + { + e.next_in_sel = (sel_ ? sel_ : nullptr); + sel_ = &e; + } + + + inline bool ClipperBase::PopHorz(Active*& e) + { + e = sel_; + if (!e) return false; + sel_ = sel_->next_in_sel; + return true; + } + + + OutPt* ClipperBase::AddLocalMinPoly(Active& e1, Active& e2, + const Point64& pt, bool is_new) + { + OutRec* outrec = NewOutRec(); + e1.outrec = outrec; + e2.outrec = outrec; + + if (IsOpen(e1)) + { + outrec->owner = nullptr; + outrec->is_open = true; + if (e1.wind_dx > 0) + SetSides(*outrec, e1, e2); + else + SetSides(*outrec, e2, e1); + } + else + { + Active* prevHotEdge = GetPrevHotEdge(e1); + //e.windDx is the winding direction of the **input** paths + //and unrelated to the winding direction of output polygons. + //Output orientation is determined by e.outrec.frontE which is + //the ascending edge (see AddLocalMinPoly). + if (prevHotEdge) + { + if (using_polytree_) + SetOwner(outrec, prevHotEdge->outrec); + if (OutrecIsAscending(prevHotEdge) == is_new) + SetSides(*outrec, e2, e1); + else + SetSides(*outrec, e1, e2); + } + else + { + outrec->owner = nullptr; + if (is_new) + SetSides(*outrec, e1, e2); + else + SetSides(*outrec, e2, e1); + } + } + + OutPt* op = new OutPt(pt, outrec); + outrec->pts = op; + return op; + } + + + OutPt* ClipperBase::AddLocalMaxPoly(Active& e1, Active& e2, const Point64& pt) + { + if (IsJoined(e1)) Split(e1, pt); + if (IsJoined(e2)) Split(e2, pt); + + if (IsFront(e1) == IsFront(e2)) + { + if (IsOpenEnd(e1)) + SwapFrontBackSides(*e1.outrec); + else if (IsOpenEnd(e2)) + SwapFrontBackSides(*e2.outrec); + else + { + succeeded_ = false; + return nullptr; + } + } + + OutPt* result = AddOutPt(e1, pt); + if (e1.outrec == e2.outrec) + { + OutRec& outrec = *e1.outrec; + outrec.pts = result; + + if (using_polytree_) + { + Active* e = GetPrevHotEdge(e1); + if (!e) + outrec.owner = nullptr; + else + SetOwner(&outrec, e->outrec); + // nb: outRec.owner here is likely NOT the real + // owner but this will be checked in RecursiveCheckOwners() + } + + UncoupleOutRec(e1); + result = outrec.pts; + if (outrec.owner && !outrec.owner->front_edge) + outrec.owner = GetRealOutRec(outrec.owner); + } + //and to preserve the winding orientation of outrec ... + else if (IsOpen(e1)) + { + if (e1.wind_dx < 0) + JoinOutrecPaths(e1, e2); + else + JoinOutrecPaths(e2, e1); + } + else if (e1.outrec->idx < e2.outrec->idx) + JoinOutrecPaths(e1, e2); + else + JoinOutrecPaths(e2, e1); + return result; + } + + void ClipperBase::JoinOutrecPaths(Active& e1, Active& e2) + { + //join e2 outrec path onto e1 outrec path and then delete e2 outrec path + //pointers. (NB Only very rarely do the joining ends share the same coords.) + OutPt* p1_st = e1.outrec->pts; + OutPt* p2_st = e2.outrec->pts; + OutPt* p1_end = p1_st->next; + OutPt* p2_end = p2_st->next; + if (IsFront(e1)) + { + p2_end->prev = p1_st; + p1_st->next = p2_end; + p2_st->next = p1_end; + p1_end->prev = p2_st; + e1.outrec->pts = p2_st; + e1.outrec->front_edge = e2.outrec->front_edge; + if (e1.outrec->front_edge) + e1.outrec->front_edge->outrec = e1.outrec; + } + else + { + p1_end->prev = p2_st; + p2_st->next = p1_end; + p1_st->next = p2_end; + p2_end->prev = p1_st; + e1.outrec->back_edge = e2.outrec->back_edge; + if (e1.outrec->back_edge) + e1.outrec->back_edge->outrec = e1.outrec; + } + + //after joining, the e2.OutRec must contains no vertices ... + e2.outrec->front_edge = nullptr; + e2.outrec->back_edge = nullptr; + e2.outrec->pts = nullptr; + + if (IsOpenEnd(e1)) + { + e2.outrec->pts = e1.outrec->pts; + e1.outrec->pts = nullptr; + } + else + SetOwner(e2.outrec, e1.outrec); + + //and e1 and e2 are maxima and are about to be dropped from the Actives list. + e1.outrec = nullptr; + e2.outrec = nullptr; + } + + OutRec* ClipperBase::NewOutRec() + { + OutRec* result = new OutRec(); + result->idx = outrec_list_.size(); + outrec_list_.push_back(result); + result->pts = nullptr; + result->owner = nullptr; + result->polypath = nullptr; + result->is_open = false; + result->splits = nullptr; + return result; + } + + + OutPt* ClipperBase::AddOutPt(const Active& e, const Point64& pt) + { + OutPt* new_op = nullptr; + + //Outrec.OutPts: a circular doubly-linked-list of POutPt where ... + //op_front[.Prev]* ~~~> op_back & op_back == op_front.Next + OutRec* outrec = e.outrec; + bool to_front = IsFront(e); + OutPt* op_front = outrec->pts; + OutPt* op_back = op_front->next; + + if (to_front) + { + if (pt == op_front->pt) + return op_front; + } + else if (pt == op_back->pt) + return op_back; + + new_op = new OutPt(pt, outrec); + op_back->prev = new_op; + new_op->prev = op_front; + new_op->next = op_back; + op_front->next = new_op; + if (to_front) outrec->pts = new_op; + return new_op; + } + + + void ClipperBase::CleanCollinear(OutRec* outrec) + { + outrec = GetRealOutRec(outrec); + if (!outrec || outrec->is_open) return; + if (!IsValidClosedPath(outrec->pts)) + { + DisposeOutPts(outrec); + return; + } + + OutPt* startOp = outrec->pts, * op2 = startOp; + for (; ; ) + { + //NB if preserveCollinear == true, then only remove 180 deg. spikes + if ((CrossProduct(op2->prev->pt, op2->pt, op2->next->pt) == 0) && + (op2->pt == op2->prev->pt || + op2->pt == op2->next->pt || !preserve_collinear_ || + DotProduct(op2->prev->pt, op2->pt, op2->next->pt) < 0)) + { + + if (op2 == outrec->pts) outrec->pts = op2->prev; + + op2 = DisposeOutPt(op2); + if (!IsValidClosedPath(op2)) + { + DisposeOutPts(outrec); + return; + } + startOp = op2; + continue; + } + op2 = op2->next; + if (op2 == startOp) break; + } + FixSelfIntersects(outrec); + } + + void ClipperBase::DoSplitOp(OutRec* outrec, OutPt* splitOp) + { + // splitOp.prev -> splitOp && + // splitOp.next -> splitOp.next.next are intersecting + OutPt* prevOp = splitOp->prev; + OutPt* nextNextOp = splitOp->next->next; + outrec->pts = prevOp; + + Point64 ip; + GetIntersectPoint(prevOp->pt, splitOp->pt, + splitOp->next->pt, nextNextOp->pt, ip); + +#ifdef USINGZ + if (zCallback_) zCallback_(prevOp->pt, splitOp->pt, + splitOp->next->pt, nextNextOp->pt, ip); +#endif + double area1 = Area(outrec->pts); + double absArea1 = std::fabs(area1); + if (absArea1 < 2) + { + DisposeOutPts(outrec); + return; + } + + double area2 = AreaTriangle(ip, splitOp->pt, splitOp->next->pt); + double absArea2 = std::fabs(area2); + + // de-link splitOp and splitOp.next from the path + // while inserting the intersection point + if (ip == prevOp->pt || ip == nextNextOp->pt) + { + nextNextOp->prev = prevOp; + prevOp->next = nextNextOp; + } + else + { + OutPt* newOp2 = new OutPt(ip, prevOp->outrec); + newOp2->prev = prevOp; + newOp2->next = nextNextOp; + nextNextOp->prev = newOp2; + prevOp->next = newOp2; + } + + // area1 is the path's area *before* splitting, whereas area2 is + // the area of the triangle containing splitOp & splitOp.next. + // So the only way for these areas to have the same sign is if + // the split triangle is larger than the path containing prevOp or + // if there's more than one self-intersection. + if (absArea2 >= 1 && + (absArea2 > absArea1 || (area2 > 0) == (area1 > 0))) + { + OutRec* newOr = NewOutRec(); + newOr->owner = outrec->owner; + + splitOp->outrec = newOr; + splitOp->next->outrec = newOr; + OutPt* newOp = new OutPt(ip, newOr); + newOp->prev = splitOp->next; + newOp->next = splitOp; + newOr->pts = newOp; + splitOp->prev = newOp; + splitOp->next->next = newOp; + + if (using_polytree_) + { + if (Path1InsidePath2(prevOp, newOp)) + { + newOr->splits = new OutRecList(); + newOr->splits->push_back(outrec); + } + else + { + if (!outrec->splits) outrec->splits = new OutRecList(); + outrec->splits->push_back(newOr); + } + } + } + else + { + delete splitOp->next; + delete splitOp; + } + } + + void ClipperBase::FixSelfIntersects(OutRec* outrec) + { + OutPt* op2 = outrec->pts; + for (; ; ) + { + // triangles can't self-intersect + if (op2->prev == op2->next->next) break; + if (SegmentsIntersect(op2->prev->pt, + op2->pt, op2->next->pt, op2->next->next->pt)) + { + if (op2 == outrec->pts || op2->next == outrec->pts) + outrec->pts = outrec->pts->prev; + DoSplitOp(outrec, op2); + if (!outrec->pts) break; + op2 = outrec->pts; + continue; + } + else + op2 = op2->next; + + if (op2 == outrec->pts) break; + } + } + + + inline void UpdateOutrecOwner(OutRec* outrec) + { + OutPt* opCurr = outrec->pts; + for (; ; ) + { + opCurr->outrec = outrec; + opCurr = opCurr->next; + if (opCurr == outrec->pts) return; + } + } + + + OutPt* ClipperBase::StartOpenPath(Active& e, const Point64& pt) + { + OutRec* outrec = NewOutRec(); + outrec->is_open = true; + + if (e.wind_dx > 0) + { + outrec->front_edge = &e; + outrec->back_edge = nullptr; + } + else + { + outrec->front_edge = nullptr; + outrec->back_edge = &e; + } + + e.outrec = outrec; + + OutPt* op = new OutPt(pt, outrec); + outrec->pts = op; + return op; + } + + inline void TrimHorz(Active& horzEdge, bool preserveCollinear) + { + bool wasTrimmed = false; + Point64 pt = NextVertex(horzEdge)->pt; + while (pt.y == horzEdge.top.y) + { + //always trim 180 deg. spikes (in closed paths) + //but otherwise break if preserveCollinear = true + if (preserveCollinear && + ((pt.x < horzEdge.top.x) != (horzEdge.bot.x < horzEdge.top.x))) + break; + + horzEdge.vertex_top = NextVertex(horzEdge); + horzEdge.top = pt; + wasTrimmed = true; + if (IsMaxima(horzEdge)) break; + pt = NextVertex(horzEdge)->pt; + } + + if (wasTrimmed) SetDx(horzEdge); // +/-infinity + } + + + inline void ClipperBase::UpdateEdgeIntoAEL(Active* e) + { + e->bot = e->top; + e->vertex_top = NextVertex(*e); + e->top = e->vertex_top->pt; + e->curr_x = e->bot.x; + SetDx(*e); + + if (IsJoined(*e)) Split(*e, e->bot); + + if (IsHorizontal(*e)) + { + if (!IsOpen(*e)) TrimHorz(*e, preserve_collinear_); + return; + } + + InsertScanline(e->top.y); + CheckJoinLeft(*e, e->bot); + CheckJoinRight(*e, e->bot, true); // (#500) + } + + Active* FindEdgeWithMatchingLocMin(Active* e) + { + Active* result = e->next_in_ael; + while (result) + { + if (result->local_min == e->local_min) return result; + else if (!IsHorizontal(*result) && e->bot != result->bot) result = nullptr; + else result = result->next_in_ael; + } + result = e->prev_in_ael; + while (result) + { + if (result->local_min == e->local_min) return result; + else if (!IsHorizontal(*result) && e->bot != result->bot) return nullptr; + else result = result->prev_in_ael; + } + return result; + } + + + OutPt* ClipperBase::IntersectEdges(Active& e1, Active& e2, const Point64& pt) + { + //MANAGE OPEN PATH INTERSECTIONS SEPARATELY ... + if (has_open_paths_ && (IsOpen(e1) || IsOpen(e2))) + { + if (IsOpen(e1) && IsOpen(e2)) return nullptr; + Active* edge_o, * edge_c; + if (IsOpen(e1)) + { + edge_o = &e1; + edge_c = &e2; + } + else + { + edge_o = &e2; + edge_c = &e1; + } + if (IsJoined(*edge_c)) Split(*edge_c, pt); // needed for safety + + if (abs(edge_c->wind_cnt) != 1) return nullptr; + switch (cliptype_) + { + case ClipType::Union: + if (!IsHotEdge(*edge_c)) return nullptr; + break; + default: + if (edge_c->local_min->polytype == PathType::Subject) + return nullptr; + } + + switch (fillrule_) + { + case FillRule::Positive: if (edge_c->wind_cnt != 1) return nullptr; break; + case FillRule::Negative: if (edge_c->wind_cnt != -1) return nullptr; break; + default: if (std::abs(edge_c->wind_cnt) != 1) return nullptr; break; + } + + OutPt* resultOp; + //toggle contribution ... + if (IsHotEdge(*edge_o)) + { + resultOp = AddOutPt(*edge_o, pt); + if (IsFront(*edge_o)) edge_o->outrec->front_edge = nullptr; + else edge_o->outrec->back_edge = nullptr; + edge_o->outrec = nullptr; + } + + //horizontal edges can pass under open paths at a LocMins + else if (pt == edge_o->local_min->vertex->pt && + !IsOpenEnd(*edge_o->local_min->vertex)) + { + //find the other side of the LocMin and + //if it's 'hot' join up with it ... + Active* e3 = FindEdgeWithMatchingLocMin(edge_o); + if (e3 && IsHotEdge(*e3)) + { + edge_o->outrec = e3->outrec; + if (edge_o->wind_dx > 0) + SetSides(*e3->outrec, *edge_o, *e3); + else + SetSides(*e3->outrec, *e3, *edge_o); + return e3->outrec->pts; + } + else + resultOp = StartOpenPath(*edge_o, pt); + } + else + resultOp = StartOpenPath(*edge_o, pt); + +#ifdef USINGZ + if (zCallback_) SetZ(*edge_o, *edge_c, resultOp->pt); +#endif + return resultOp; + } // end of an open path intersection + + //MANAGING CLOSED PATHS FROM HERE ON + + if (IsJoined(e1)) Split(e1, pt); + if (IsJoined(e2)) Split(e2, pt); + + //UPDATE WINDING COUNTS... + + int old_e1_windcnt, old_e2_windcnt; + if (e1.local_min->polytype == e2.local_min->polytype) + { + if (fillrule_ == FillRule::EvenOdd) + { + old_e1_windcnt = e1.wind_cnt; + e1.wind_cnt = e2.wind_cnt; + e2.wind_cnt = old_e1_windcnt; + } + else + { + if (e1.wind_cnt + e2.wind_dx == 0) + e1.wind_cnt = -e1.wind_cnt; + else + e1.wind_cnt += e2.wind_dx; + if (e2.wind_cnt - e1.wind_dx == 0) + e2.wind_cnt = -e2.wind_cnt; + else + e2.wind_cnt -= e1.wind_dx; + } + } + else + { + if (fillrule_ != FillRule::EvenOdd) + { + e1.wind_cnt2 += e2.wind_dx; + e2.wind_cnt2 -= e1.wind_dx; + } + else + { + e1.wind_cnt2 = (e1.wind_cnt2 == 0 ? 1 : 0); + e2.wind_cnt2 = (e2.wind_cnt2 == 0 ? 1 : 0); + } + } + + switch (fillrule_) + { + case FillRule::EvenOdd: + case FillRule::NonZero: + old_e1_windcnt = abs(e1.wind_cnt); + old_e2_windcnt = abs(e2.wind_cnt); + break; + default: + if (fillrule_ == fillpos) + { + old_e1_windcnt = e1.wind_cnt; + old_e2_windcnt = e2.wind_cnt; + } + else + { + old_e1_windcnt = -e1.wind_cnt; + old_e2_windcnt = -e2.wind_cnt; + } + break; + } + + const bool e1_windcnt_in_01 = old_e1_windcnt == 0 || old_e1_windcnt == 1; + const bool e2_windcnt_in_01 = old_e2_windcnt == 0 || old_e2_windcnt == 1; + + if ((!IsHotEdge(e1) && !e1_windcnt_in_01) || (!IsHotEdge(e2) && !e2_windcnt_in_01)) + { + return nullptr; + } + + //NOW PROCESS THE INTERSECTION ... + OutPt* resultOp = nullptr; + //if both edges are 'hot' ... + if (IsHotEdge(e1) && IsHotEdge(e2)) + { + if ((old_e1_windcnt != 0 && old_e1_windcnt != 1) || (old_e2_windcnt != 0 && old_e2_windcnt != 1) || + (e1.local_min->polytype != e2.local_min->polytype && cliptype_ != ClipType::Xor)) + { + resultOp = AddLocalMaxPoly(e1, e2, pt); +#ifdef USINGZ + if (zCallback_ && resultOp) SetZ(e1, e2, resultOp->pt); +#endif + } + else if (IsFront(e1) || (e1.outrec == e2.outrec)) + { + //this 'else if' condition isn't strictly needed but + //it's sensible to split polygons that ony touch at + //a common vertex (not at common edges). + + resultOp = AddLocalMaxPoly(e1, e2, pt); +#ifdef USINGZ + OutPt* op2 = AddLocalMinPoly(e1, e2, pt); + if (zCallback_ && resultOp) SetZ(e1, e2, resultOp->pt); + if (zCallback_) SetZ(e1, e2, op2->pt); +#else + AddLocalMinPoly(e1, e2, pt); +#endif + } + else + { + resultOp = AddOutPt(e1, pt); +#ifdef USINGZ + OutPt* op2 = AddOutPt(e2, pt); + if (zCallback_) + { + SetZ(e1, e2, resultOp->pt); + SetZ(e1, e2, op2->pt); + } +#else + AddOutPt(e2, pt); +#endif + SwapOutrecs(e1, e2); + } + } + else if (IsHotEdge(e1)) + { + resultOp = AddOutPt(e1, pt); +#ifdef USINGZ + if (zCallback_) SetZ(e1, e2, resultOp->pt); +#endif + SwapOutrecs(e1, e2); + } + else if (IsHotEdge(e2)) + { + resultOp = AddOutPt(e2, pt); +#ifdef USINGZ + if (zCallback_) SetZ(e1, e2, resultOp->pt); +#endif + SwapOutrecs(e1, e2); + } + else + { + int64_t e1Wc2, e2Wc2; + switch (fillrule_) + { + case FillRule::EvenOdd: + case FillRule::NonZero: + e1Wc2 = abs(e1.wind_cnt2); + e2Wc2 = abs(e2.wind_cnt2); + break; + default: + if (fillrule_ == fillpos) + { + e1Wc2 = e1.wind_cnt2; + e2Wc2 = e2.wind_cnt2; + } + else + { + e1Wc2 = -e1.wind_cnt2; + e2Wc2 = -e2.wind_cnt2; + } + break; + } + + if (!IsSamePolyType(e1, e2)) + { + resultOp = AddLocalMinPoly(e1, e2, pt, false); +#ifdef USINGZ + if (zCallback_) SetZ(e1, e2, resultOp->pt); +#endif + } + else if (old_e1_windcnt == 1 && old_e2_windcnt == 1) + { + resultOp = nullptr; + switch (cliptype_) + { + case ClipType::Union: + if (e1Wc2 <= 0 && e2Wc2 <= 0) + resultOp = AddLocalMinPoly(e1, e2, pt, false); + break; + case ClipType::Difference: + if (((GetPolyType(e1) == PathType::Clip) && (e1Wc2 > 0) && (e2Wc2 > 0)) || + ((GetPolyType(e1) == PathType::Subject) && (e1Wc2 <= 0) && (e2Wc2 <= 0))) + { + resultOp = AddLocalMinPoly(e1, e2, pt, false); + } + break; + case ClipType::Xor: + resultOp = AddLocalMinPoly(e1, e2, pt, false); + break; + default: + if (e1Wc2 > 0 && e2Wc2 > 0) + resultOp = AddLocalMinPoly(e1, e2, pt, false); + break; + } +#ifdef USINGZ + if (resultOp && zCallback_) SetZ(e1, e2, resultOp->pt); +#endif + } + } + return resultOp; + } + + inline void ClipperBase::DeleteFromAEL(Active& e) + { + Active* prev = e.prev_in_ael; + Active* next = e.next_in_ael; + if (!prev && !next && (&e != actives_)) return; // already deleted + if (prev) + prev->next_in_ael = next; + else + actives_ = next; + if (next) next->prev_in_ael = prev; + delete& e; + } + + + inline void ClipperBase::AdjustCurrXAndCopyToSEL(const int64_t top_y) + { + Active* e = actives_; + sel_ = e; + while (e) + { + e->prev_in_sel = e->prev_in_ael; + e->next_in_sel = e->next_in_ael; + e->jump = e->next_in_sel; + if (e->join_with == JoinWith::Left) + e->curr_x = e->prev_in_ael->curr_x; // also avoids complications + else + e->curr_x = TopX(*e, top_y); + e = e->next_in_ael; + } + } + + bool ClipperBase::ExecuteInternal(ClipType ct, FillRule fillrule, bool use_polytrees) + { + cliptype_ = ct; + fillrule_ = fillrule; + using_polytree_ = use_polytrees; + Reset(); + int64_t y; + if (ct == ClipType::None || !PopScanline(y)) return true; + + while (succeeded_) + { + InsertLocalMinimaIntoAEL(y); + Active* e; + while (PopHorz(e)) DoHorizontal(*e); + if (horz_seg_list_.size() > 0) + { + ConvertHorzSegsToJoins(); + horz_seg_list_.clear(); + } + bot_y_ = y; // bot_y_ == bottom of scanbeam + if (!PopScanline(y)) break; // y new top of scanbeam + DoIntersections(y); + DoTopOfScanbeam(y); + while (PopHorz(e)) DoHorizontal(*e); + } + if (succeeded_) ProcessHorzJoins(); + return succeeded_; + } + + inline void FixOutRecPts(OutRec* outrec) + { + OutPt* op = outrec->pts; + do { + op->outrec = outrec; + op = op->next; + } while (op != outrec->pts); + } + + inline bool SetHorzSegHeadingForward(HorzSegment& hs, OutPt* opP, OutPt* opN) + { + if (opP->pt.x == opN->pt.x) return false; + if (opP->pt.x < opN->pt.x) + { + hs.left_op = opP; + hs.right_op = opN; + hs.left_to_right = true; + } + else + { + hs.left_op = opN; + hs.right_op = opP; + hs.left_to_right = false; + } + return true; + } + + inline bool UpdateHorzSegment(HorzSegment& hs) + { + OutPt* op = hs.left_op; + OutRec* outrec = GetRealOutRec(op->outrec); + bool outrecHasEdges = outrec->front_edge; + int64_t curr_y = op->pt.y; + OutPt* opP = op, * opN = op; + if (outrecHasEdges) + { + OutPt* opA = outrec->pts, * opZ = opA->next; + while (opP != opZ && opP->prev->pt.y == curr_y) + opP = opP->prev; + while (opN != opA && opN->next->pt.y == curr_y) + opN = opN->next; + } + else + { + while (opP->prev != opN && opP->prev->pt.y == curr_y) + opP = opP->prev; + while (opN->next != opP && opN->next->pt.y == curr_y) + opN = opN->next; + } + bool result = + SetHorzSegHeadingForward(hs, opP, opN) && + !hs.left_op->horz; + + if (result) + hs.left_op->horz = &hs; + else + hs.right_op = nullptr; // (for sorting) + return result; + } + + void ClipperBase::ConvertHorzSegsToJoins() + { + auto j = std::count_if(horz_seg_list_.begin(), + horz_seg_list_.end(), + [](HorzSegment& hs) { return UpdateHorzSegment(hs); }); + if (j < 2) return; + std::stable_sort(horz_seg_list_.begin(), horz_seg_list_.end(), HorzSegSorter()); + + HorzSegmentList::iterator hs1 = horz_seg_list_.begin(), hs2; + HorzSegmentList::iterator hs_end = hs1 +j; + HorzSegmentList::iterator hs_end1 = hs_end - 1; + + for (; hs1 != hs_end1; ++hs1) + { + for (hs2 = hs1 + 1; hs2 != hs_end; ++hs2) + { + if ((hs2->left_op->pt.x >= hs1->right_op->pt.x) || + (hs2->left_to_right == hs1->left_to_right) || + (hs2->right_op->pt.x <= hs1->left_op->pt.x)) continue; + int64_t curr_y = hs1->left_op->pt.y; + if (hs1->left_to_right) + { + while (hs1->left_op->next->pt.y == curr_y && + hs1->left_op->next->pt.x <= hs2->left_op->pt.x) + hs1->left_op = hs1->left_op->next; + while (hs2->left_op->prev->pt.y == curr_y && + hs2->left_op->prev->pt.x <= hs1->left_op->pt.x) + hs2->left_op = hs2->left_op->prev; + HorzJoin join = HorzJoin( + DuplicateOp(hs1->left_op, true), + DuplicateOp(hs2->left_op, false)); + horz_join_list_.push_back(join); + } + else + { + while (hs1->left_op->prev->pt.y == curr_y && + hs1->left_op->prev->pt.x <= hs2->left_op->pt.x) + hs1->left_op = hs1->left_op->prev; + while (hs2->left_op->next->pt.y == curr_y && + hs2->left_op->next->pt.x <= hs1->left_op->pt.x) + hs2->left_op = hs2->left_op->next; + HorzJoin join = HorzJoin( + DuplicateOp(hs2->left_op, true), + DuplicateOp(hs1->left_op, false)); + horz_join_list_.push_back(join); + } + } + } + } + + void MoveSplits(OutRec* fromOr, OutRec* toOr) + { + if (!fromOr->splits) return; + if (!toOr->splits) toOr->splits = new OutRecList(); + OutRecList::iterator orIter = fromOr->splits->begin(); + for (; orIter != fromOr->splits->end(); ++orIter) + toOr->splits->push_back(*orIter); + fromOr->splits->clear(); + } + + + void ClipperBase::ProcessHorzJoins() + { + for (const HorzJoin& j : horz_join_list_) + { + OutRec* or1 = GetRealOutRec(j.op1->outrec); + OutRec* or2 = GetRealOutRec(j.op2->outrec); + + OutPt* op1b = j.op1->next; + OutPt* op2b = j.op2->prev; + j.op1->next = j.op2; + j.op2->prev = j.op1; + op1b->prev = op2b; + op2b->next = op1b; + + if (or1 == or2) // 'join' is really a split + { + or2 = NewOutRec(); + or2->pts = op1b; + FixOutRecPts(or2); + + //if or1->pts has moved to or2 then update or1->pts!! + if (or1->pts->outrec == or2) + { + or1->pts = j.op1; + or1->pts->outrec = or1; + } + + if (using_polytree_) //#498, #520, #584, D#576, #618 + { + if (Path1InsidePath2(or1->pts, or2->pts)) + { + //swap or1's & or2's pts + OutPt* tmp = or1->pts; + or1->pts = or2->pts; + or2->pts = tmp; + FixOutRecPts(or1); + FixOutRecPts(or2); + //or2 is now inside or1 + or2->owner = or1; + } + else if (Path1InsidePath2(or2->pts, or1->pts)) + { + or2->owner = or1; + } + else + or2->owner = or1->owner; + + if (!or1->splits) or1->splits = new OutRecList(); + or1->splits->push_back(or2); + } + else + or2->owner = or1; + } + else + { + or2->pts = nullptr; + if (using_polytree_) + { + SetOwner(or2, or1); + MoveSplits(or2, or1); //#618 + } + else + or2->owner = or1; + } + } + } + + void ClipperBase::DoIntersections(const int64_t top_y) + { + if (BuildIntersectList(top_y)) + { + ProcessIntersectList(); + intersect_nodes_.clear(); + } + } + + void ClipperBase::AddNewIntersectNode(Active& e1, Active& e2, int64_t top_y) + { + Point64 ip; + if (!GetIntersectPoint(e1.bot, e1.top, e2.bot, e2.top, ip)) + ip = Point64(e1.curr_x, top_y); //parallel edges + + //rounding errors can occasionally place the calculated intersection + //point either below or above the scanbeam, so check and correct ... + if (ip.y > bot_y_ || ip.y < top_y) + { + double abs_dx1 = std::fabs(e1.dx); + double abs_dx2 = std::fabs(e2.dx); + if (abs_dx1 > 100 && abs_dx2 > 100) + { + if (abs_dx1 > abs_dx2) + ip = GetClosestPointOnSegment(ip, e1.bot, e1.top); + else + ip = GetClosestPointOnSegment(ip, e2.bot, e2.top); + } + else if (abs_dx1 > 100) + ip = GetClosestPointOnSegment(ip, e1.bot, e1.top); + else if (abs_dx2 > 100) + ip = GetClosestPointOnSegment(ip, e2.bot, e2.top); + else + { + if (ip.y < top_y) ip.y = top_y; + else ip.y = bot_y_; + if (abs_dx1 < abs_dx2) ip.x = TopX(e1, ip.y); + else ip.x = TopX(e2, ip.y); + } + } + intersect_nodes_.push_back(IntersectNode(&e1, &e2, ip)); + } + + bool ClipperBase::BuildIntersectList(const int64_t top_y) + { + if (!actives_ || !actives_->next_in_ael) return false; + + //Calculate edge positions at the top of the current scanbeam, and from this + //we will determine the intersections required to reach these new positions. + AdjustCurrXAndCopyToSEL(top_y); + //Find all edge intersections in the current scanbeam using a stable merge + //sort that ensures only adjacent edges are intersecting. Intersect info is + //stored in FIntersectList ready to be processed in ProcessIntersectList. + //Re merge sorts see https://stackoverflow.com/a/46319131/359538 + + Active* left = sel_, * right, * l_end, * r_end, * curr_base, * tmp; + + while (left && left->jump) + { + Active* prev_base = nullptr; + while (left && left->jump) + { + curr_base = left; + right = left->jump; + l_end = right; + r_end = right->jump; + left->jump = r_end; + while (left != l_end && right != r_end) + { + if (right->curr_x < left->curr_x) + { + tmp = right->prev_in_sel; + for (; ; ) + { + AddNewIntersectNode(*tmp, *right, top_y); + if (tmp == left) break; + tmp = tmp->prev_in_sel; + } + + tmp = right; + right = ExtractFromSEL(tmp); + l_end = right; + Insert1Before2InSEL(tmp, left); + if (left == curr_base) + { + curr_base = tmp; + curr_base->jump = r_end; + if (!prev_base) sel_ = curr_base; + else prev_base->jump = curr_base; + } + } + else left = left->next_in_sel; + } + prev_base = curr_base; + left = r_end; + } + left = sel_; + } + return intersect_nodes_.size() > 0; + } + + void ClipperBase::ProcessIntersectList() + { + //We now have a list of intersections required so that edges will be + //correctly positioned at the top of the scanbeam. However, it's important + //that edge intersections are processed from the bottom up, but it's also + //crucial that intersections only occur between adjacent edges. + + //First we do a quicksort so intersections proceed in a bottom up order ... + std::sort(intersect_nodes_.begin(), intersect_nodes_.end(), IntersectListSort); + //Now as we process these intersections, we must sometimes adjust the order + //to ensure that intersecting edges are always adjacent ... + + IntersectNodeList::iterator node_iter, node_iter2; + for (node_iter = intersect_nodes_.begin(); + node_iter != intersect_nodes_.end(); ++node_iter) + { + if (!EdgesAdjacentInAEL(*node_iter)) + { + node_iter2 = node_iter + 1; + while (!EdgesAdjacentInAEL(*node_iter2)) ++node_iter2; + std::swap(*node_iter, *node_iter2); + } + + IntersectNode& node = *node_iter; + IntersectEdges(*node.edge1, *node.edge2, node.pt); + SwapPositionsInAEL(*node.edge1, *node.edge2); + + node.edge1->curr_x = node.pt.x; + node.edge2->curr_x = node.pt.x; + CheckJoinLeft(*node.edge2, node.pt, true); + CheckJoinRight(*node.edge1, node.pt, true); + } + } + + void ClipperBase::SwapPositionsInAEL(Active& e1, Active& e2) + { + //preconditon: e1 must be immediately to the left of e2 + Active* next = e2.next_in_ael; + if (next) next->prev_in_ael = &e1; + Active* prev = e1.prev_in_ael; + if (prev) prev->next_in_ael = &e2; + e2.prev_in_ael = prev; + e2.next_in_ael = &e1; + e1.prev_in_ael = &e2; + e1.next_in_ael = next; + if (!e2.prev_in_ael) actives_ = &e2; + } + + inline OutPt* GetLastOp(const Active& hot_edge) + { + OutRec* outrec = hot_edge.outrec; + OutPt* result = outrec->pts; + if (&hot_edge != outrec->front_edge) + result = result->next; + return result; + } + + void ClipperBase::AddTrialHorzJoin(OutPt* op) + { + if (op->outrec->is_open) return; + horz_seg_list_.push_back(HorzSegment(op)); + } + + bool ClipperBase::ResetHorzDirection(const Active& horz, + const Vertex* max_vertex, int64_t& horz_left, int64_t& horz_right) + { + if (horz.bot.x == horz.top.x) + { + //the horizontal edge is going nowhere ... + horz_left = horz.curr_x; + horz_right = horz.curr_x; + Active* e = horz.next_in_ael; + while (e && e->vertex_top != max_vertex) e = e->next_in_ael; + return e != nullptr; + } + else if (horz.curr_x < horz.top.x) + { + horz_left = horz.curr_x; + horz_right = horz.top.x; + return true; + } + else + { + horz_left = horz.top.x; + horz_right = horz.curr_x; + return false; // right to left + } + } + + void ClipperBase::DoHorizontal(Active& horz) + /******************************************************************************* + * Notes: Horizontal edges (HEs) at scanline intersections (ie at the top or * + * bottom of a scanbeam) are processed as if layered.The order in which HEs * + * are processed doesn't matter. HEs intersect with the bottom vertices of * + * other HEs[#] and with non-horizontal edges [*]. Once these intersections * + * are completed, intermediate HEs are 'promoted' to the next edge in their * + * bounds, and they in turn may be intersected[%] by other HEs. * + * * + * eg: 3 horizontals at a scanline: / | / / * + * | / | (HE3)o ========%========== o * + * o ======= o(HE2) / | / / * + * o ============#=========*======*========#=========o (HE1) * + * / | / | / * + *******************************************************************************/ + { + Point64 pt; + bool horzIsOpen = IsOpen(horz); + int64_t y = horz.bot.y; + Vertex* vertex_max; + if (horzIsOpen) + vertex_max = GetCurrYMaximaVertex_Open(horz); + else + vertex_max = GetCurrYMaximaVertex(horz); + + //// remove 180 deg.spikes and also simplify + //// consecutive horizontals when PreserveCollinear = true + //if (!horzIsOpen && vertex_max != horz.vertex_top) + // TrimHorz(horz, PreserveCollinear); + + int64_t horz_left, horz_right; + bool is_left_to_right = + ResetHorzDirection(horz, vertex_max, horz_left, horz_right); + + if (IsHotEdge(horz)) + { +#ifdef USINGZ + OutPt* op = AddOutPt(horz, Point64(horz.curr_x, y, horz.bot.z)); +#else + OutPt* op = AddOutPt(horz, Point64(horz.curr_x, y)); +#endif + AddTrialHorzJoin(op); + } + + while (true) // loop through consec. horizontal edges + { + Active* e; + if (is_left_to_right) e = horz.next_in_ael; + else e = horz.prev_in_ael; + + while (e) + { + if (e->vertex_top == vertex_max) + { + if (IsHotEdge(horz) && IsJoined(*e)) + Split(*e, e->top); + + //if (IsHotEdge(horz) != IsHotEdge(*e)) + // DoError(undefined_error_i); + + if (IsHotEdge(horz)) + { + while (horz.vertex_top != vertex_max) + { + AddOutPt(horz, horz.top); + UpdateEdgeIntoAEL(&horz); + } + if (is_left_to_right) + AddLocalMaxPoly(horz, *e, horz.top); + else + AddLocalMaxPoly(*e, horz, horz.top); + } + DeleteFromAEL(*e); + DeleteFromAEL(horz); + return; + } + + //if horzEdge is a maxima, keep going until we reach + //its maxima pair, otherwise check for break conditions + if (vertex_max != horz.vertex_top || IsOpenEnd(horz)) + { + //otherwise stop when 'ae' is beyond the end of the horizontal line + if ((is_left_to_right && e->curr_x > horz_right) || + (!is_left_to_right && e->curr_x < horz_left)) break; + + if (e->curr_x == horz.top.x && !IsHorizontal(*e)) + { + pt = NextVertex(horz)->pt; + if (is_left_to_right) + { + //with open paths we'll only break once past horz's end + if (IsOpen(*e) && !IsSamePolyType(*e, horz) && !IsHotEdge(*e)) + { + if (TopX(*e, pt.y) > pt.x) break; + } + //otherwise we'll only break when horz's outslope is greater than e's + else if (TopX(*e, pt.y) >= pt.x) break; + } + else + { + if (IsOpen(*e) && !IsSamePolyType(*e, horz) && !IsHotEdge(*e)) + { + if (TopX(*e, pt.y) < pt.x) break; + } + else if (TopX(*e, pt.y) <= pt.x) break; + } + } + } + + pt = Point64(e->curr_x, horz.bot.y); + if (is_left_to_right) + { + IntersectEdges(horz, *e, pt); + SwapPositionsInAEL(horz, *e); + CheckJoinLeft(*e, pt); + horz.curr_x = e->curr_x; + e = horz.next_in_ael; + } + else + { + IntersectEdges(*e, horz, pt); + SwapPositionsInAEL(*e, horz); + CheckJoinRight(*e, pt); + horz.curr_x = e->curr_x; + e = horz.prev_in_ael; + } + + if (horz.outrec) + { + //nb: The outrec containining the op returned by IntersectEdges + //above may no longer be associated with horzEdge. + AddTrialHorzJoin(GetLastOp(horz)); + } + } + + //check if we've finished with (consecutive) horizontals ... + if (horzIsOpen && IsOpenEnd(horz)) // ie open at top + { + if (IsHotEdge(horz)) + { + AddOutPt(horz, horz.top); + if (IsFront(horz)) + horz.outrec->front_edge = nullptr; + else + horz.outrec->back_edge = nullptr; + horz.outrec = nullptr; + } + DeleteFromAEL(horz); + return; + } + else if (NextVertex(horz)->pt.y != horz.top.y) + break; + + //still more horizontals in bound to process ... + if (IsHotEdge(horz)) + AddOutPt(horz, horz.top); + UpdateEdgeIntoAEL(&horz); + + is_left_to_right = + ResetHorzDirection(horz, vertex_max, horz_left, horz_right); + } + + if (IsHotEdge(horz)) + { + OutPt* op = AddOutPt(horz, horz.top); + AddTrialHorzJoin(op); + } + + UpdateEdgeIntoAEL(&horz); // end of an intermediate horiz. + } + + void ClipperBase::DoTopOfScanbeam(const int64_t y) + { + sel_ = nullptr; // sel_ is reused to flag horizontals (see PushHorz below) + Active* e = actives_; + while (e) + { + //nb: 'e' will never be horizontal here + if (e->top.y == y) + { + e->curr_x = e->top.x; + if (IsMaxima(*e)) + { + e = DoMaxima(*e); // TOP OF BOUND (MAXIMA) + continue; + } + else + { + //INTERMEDIATE VERTEX ... + if (IsHotEdge(*e)) AddOutPt(*e, e->top); + UpdateEdgeIntoAEL(e); + if (IsHorizontal(*e)) + PushHorz(*e); // horizontals are processed later + } + } + else // i.e. not the top of the edge + e->curr_x = TopX(*e, y); + + e = e->next_in_ael; + } + } + + + Active* ClipperBase::DoMaxima(Active& e) + { + Active* next_e, * prev_e, * max_pair; + prev_e = e.prev_in_ael; + next_e = e.next_in_ael; + if (IsOpenEnd(e)) + { + if (IsHotEdge(e)) AddOutPt(e, e.top); + if (!IsHorizontal(e)) + { + if (IsHotEdge(e)) + { + if (IsFront(e)) + e.outrec->front_edge = nullptr; + else + e.outrec->back_edge = nullptr; + e.outrec = nullptr; + } + DeleteFromAEL(e); + } + return next_e; + } + + max_pair = GetMaximaPair(e); + if (!max_pair) return next_e; // eMaxPair is horizontal + + if (IsJoined(e)) Split(e, e.top); + if (IsJoined(*max_pair)) Split(*max_pair, max_pair->top); + + //only non-horizontal maxima here. + //process any edges between maxima pair ... + while (next_e != max_pair) + { + IntersectEdges(e, *next_e, e.top); + SwapPositionsInAEL(e, *next_e); + next_e = e.next_in_ael; + } + + if (IsOpen(e)) + { + if (IsHotEdge(e)) + AddLocalMaxPoly(e, *max_pair, e.top); + DeleteFromAEL(*max_pair); + DeleteFromAEL(e); + return (prev_e ? prev_e->next_in_ael : actives_); + } + + // e.next_in_ael== max_pair ... + if (IsHotEdge(e)) + AddLocalMaxPoly(e, *max_pair, e.top); + + DeleteFromAEL(e); + DeleteFromAEL(*max_pair); + return (prev_e ? prev_e->next_in_ael : actives_); + } + + void ClipperBase::Split(Active& e, const Point64& pt) + { + if (e.join_with == JoinWith::Right) + { + e.join_with = JoinWith::None; + e.next_in_ael->join_with = JoinWith::None; + AddLocalMinPoly(e, *e.next_in_ael, pt, true); + } + else + { + e.join_with = JoinWith::None; + e.prev_in_ael->join_with = JoinWith::None; + AddLocalMinPoly(*e.prev_in_ael, e, pt, true); + } + } + + void ClipperBase::CheckJoinLeft(Active& e, + const Point64& pt, bool check_curr_x) + { + Active* prev = e.prev_in_ael; + if (!prev || + !IsHotEdge(e) || !IsHotEdge(*prev) || + IsHorizontal(e) || IsHorizontal(*prev) || + IsOpen(e) || IsOpen(*prev) ) return; + if ((pt.y < e.top.y + 2 || pt.y < prev->top.y + 2) && + ((e.bot.y > pt.y) || (prev->bot.y > pt.y))) return; // avoid trivial joins + + if (check_curr_x) + { + if (DistanceFromLineSqrd(pt, prev->bot, prev->top) > 0.25) return; + } + else if (e.curr_x != prev->curr_x) return; + if (CrossProduct(e.top, pt, prev->top)) return; + + if (e.outrec->idx == prev->outrec->idx) + AddLocalMaxPoly(*prev, e, pt); + else if (e.outrec->idx < prev->outrec->idx) + JoinOutrecPaths(e, *prev); + else + JoinOutrecPaths(*prev, e); + prev->join_with = JoinWith::Right; + e.join_with = JoinWith::Left; + } + + void ClipperBase::CheckJoinRight(Active& e, + const Point64& pt, bool check_curr_x) + { + Active* next = e.next_in_ael; + if (!next || + !IsHotEdge(e) || !IsHotEdge(*next) || + IsHorizontal(e) || IsHorizontal(*next) || + IsOpen(e) || IsOpen(*next)) return; + if ((pt.y < e.top.y +2 || pt.y < next->top.y +2) && + ((e.bot.y > pt.y) || (next->bot.y > pt.y))) return; // avoid trivial joins + + if (check_curr_x) + { + if (DistanceFromLineSqrd(pt, next->bot, next->top) > 0.35) return; + } + else if (e.curr_x != next->curr_x) return; + if (CrossProduct(e.top, pt, next->top)) return; + + if (e.outrec->idx == next->outrec->idx) + AddLocalMaxPoly(e, *next, pt); + else if (e.outrec->idx < next->outrec->idx) + JoinOutrecPaths(e, *next); + else + JoinOutrecPaths(*next, e); + + e.join_with = JoinWith::Right; + next->join_with = JoinWith::Left; + } + + inline bool GetHorzExtendedHorzSeg(OutPt*& op, OutPt*& op2) + { + OutRec* outrec = GetRealOutRec(op->outrec); + op2 = op; + if (outrec->front_edge) + { + while (op->prev != outrec->pts && + op->prev->pt.y == op->pt.y) op = op->prev; + while (op2 != outrec->pts && + op2->next->pt.y == op2->pt.y) op2 = op2->next; + return op2 != op; + } + else + { + while (op->prev != op2 && op->prev->pt.y == op->pt.y) + op = op->prev; + while (op2->next != op && op2->next->pt.y == op2->pt.y) + op2 = op2->next; + return op2 != op && op2->next != op; + } + } + + bool BuildPath64(OutPt* op, bool reverse, bool isOpen, Path64& path) + { + if (!op || op->next == op || (!isOpen && op->next == op->prev)) + return false; + + path.resize(0); + Point64 lastPt; + OutPt* op2; + if (reverse) + { + lastPt = op->pt; + op2 = op->prev; + } + else + { + op = op->next; + lastPt = op->pt; + op2 = op->next; + } + path.push_back(lastPt); + + while (op2 != op) + { + if (op2->pt != lastPt) + { + lastPt = op2->pt; + path.push_back(lastPt); + } + if (reverse) + op2 = op2->prev; + else + op2 = op2->next; + } + + if (path.size() == 3 && IsVerySmallTriangle(*op2)) return false; + else return true; + } + + bool ClipperBase::CheckBounds(OutRec* outrec) + { + if (!outrec->pts) return false; + if (!outrec->bounds.IsEmpty()) return true; + CleanCollinear(outrec); + if (!outrec->pts || + !BuildPath64(outrec->pts, reverse_solution_, false, outrec->path)){ + return false;} + outrec->bounds = GetBounds(outrec->path); + return true; + } + + bool ClipperBase::CheckSplitOwner(OutRec* outrec, OutRecList* splits) + { + for (auto split : *splits) + { + split = GetRealOutRec(split); + if(!split || split == outrec || split->recursive_split == outrec) continue; + split->recursive_split = outrec; // prevent infinite loops + + if (split->splits && CheckSplitOwner(outrec, split->splits)) + return true; + else if (CheckBounds(split) && + IsValidOwner(outrec, split) && + split->bounds.Contains(outrec->bounds) && + Path1InsidePath2(outrec->pts, split->pts)) + { + outrec->owner = split; //found in split + return true; + } + } + return false; + } + + void ClipperBase::RecursiveCheckOwners(OutRec* outrec, PolyPath* polypath) + { + // pre-condition: outrec will have valid bounds + // post-condition: if a valid path, outrec will have a polypath + + if (outrec->polypath || outrec->bounds.IsEmpty()) return; + + while (outrec->owner) + { + if (outrec->owner->splits && CheckSplitOwner(outrec, outrec->owner->splits)) break; + if (outrec->owner->pts && CheckBounds(outrec->owner) && + outrec->owner->bounds.Contains(outrec->bounds) && + Path1InsidePath2(outrec->pts, outrec->owner->pts)) break; + outrec->owner = outrec->owner->owner; + } + + if (outrec->owner) + { + if (!outrec->owner->polypath) + RecursiveCheckOwners(outrec->owner, polypath); + outrec->polypath = outrec->owner->polypath->AddChild(outrec->path); + } + else + outrec->polypath = polypath->AddChild(outrec->path); + } + + void Clipper64::BuildPaths64(Paths64& solutionClosed, Paths64* solutionOpen) + { + solutionClosed.resize(0); + solutionClosed.reserve(outrec_list_.size()); + if (solutionOpen) + { + solutionOpen->resize(0); + solutionOpen->reserve(outrec_list_.size()); + } + + // nb: outrec_list_.size() may change in the following + // while loop because polygons may be split during + // calls to CleanCollinear which calls FixSelfIntersects + for (size_t i = 0; i < outrec_list_.size(); ++i) + { + OutRec* outrec = outrec_list_[i]; + if (outrec->pts == nullptr) continue; + + Path64 path; + if (solutionOpen && outrec->is_open) + { + if (BuildPath64(outrec->pts, reverse_solution_, true, path)) + solutionOpen->emplace_back(std::move(path)); + } + else + { + // nb: CleanCollinear can add to outrec_list_ + CleanCollinear(outrec); + //closed paths should always return a Positive orientation + if (BuildPath64(outrec->pts, reverse_solution_, false, path)) + solutionClosed.emplace_back(std::move(path)); + } + } + } + + void Clipper64::BuildTree64(PolyPath64& polytree, Paths64& open_paths) + { + polytree.Clear(); + open_paths.resize(0); + if (has_open_paths_) + open_paths.reserve(outrec_list_.size()); + + // outrec_list_.size() is not static here because + // CheckBounds below can indirectly add additional + // OutRec (via FixOutRecPts & CleanCollinear) + for (size_t i = 0; i < outrec_list_.size(); ++i) + { + OutRec* outrec = outrec_list_[i]; + if (!outrec || !outrec->pts) continue; + if (outrec->is_open) + { + Path64 path; + if (BuildPath64(outrec->pts, reverse_solution_, true, path)) + open_paths.push_back(path); + continue; + } + + if (CheckBounds(outrec)) + RecursiveCheckOwners(outrec, &polytree); + } + } + + bool BuildPathD(OutPt* op, bool reverse, bool isOpen, PathD& path, double inv_scale) + { + if (!op || op->next == op || (!isOpen && op->next == op->prev)) + return false; + + path.resize(0); + Point64 lastPt; + OutPt* op2; + if (reverse) + { + lastPt = op->pt; + op2 = op->prev; + } + else + { + op = op->next; + lastPt = op->pt; + op2 = op->next; + } +#ifdef USINGZ + path.push_back(PointD(lastPt.x * inv_scale, lastPt.y * inv_scale, lastPt.z)); +#else + path.push_back(PointD(lastPt.x * inv_scale, lastPt.y * inv_scale)); +#endif + + while (op2 != op) + { + if (op2->pt != lastPt) + { + lastPt = op2->pt; +#ifdef USINGZ + path.push_back(PointD(lastPt.x * inv_scale, lastPt.y * inv_scale, lastPt.z)); +#else + path.push_back(PointD(lastPt.x * inv_scale, lastPt.y * inv_scale)); +#endif + + } + if (reverse) + op2 = op2->prev; + else + op2 = op2->next; + } + if (path.size() == 3 && IsVerySmallTriangle(*op2)) return false; + return true; + } + + void ClipperD::BuildPathsD(PathsD& solutionClosed, PathsD* solutionOpen) + { + solutionClosed.resize(0); + solutionClosed.reserve(outrec_list_.size()); + if (solutionOpen) + { + solutionOpen->resize(0); + solutionOpen->reserve(outrec_list_.size()); + } + + // outrec_list_.size() is not static here because + // CleanCollinear below can indirectly add additional + // OutRec (via FixOutRecPts) + for (std::size_t i = 0; i < outrec_list_.size(); ++i) + { + OutRec* outrec = outrec_list_[i]; + if (outrec->pts == nullptr) continue; + + PathD path; + if (solutionOpen && outrec->is_open) + { + if (BuildPathD(outrec->pts, reverse_solution_, true, path, invScale_)) + solutionOpen->emplace_back(std::move(path)); + } + else + { + CleanCollinear(outrec); + //closed paths should always return a Positive orientation + if (BuildPathD(outrec->pts, reverse_solution_, false, path, invScale_)) + solutionClosed.emplace_back(std::move(path)); + } + } + } + + void ClipperD::BuildTreeD(PolyPathD& polytree, PathsD& open_paths) + { + polytree.Clear(); + open_paths.resize(0); + if (has_open_paths_) + open_paths.reserve(outrec_list_.size()); + + // outrec_list_.size() is not static here because + // BuildPathD below can indirectly add additional OutRec //#607 + for (size_t i = 0; i < outrec_list_.size(); ++i) + { + OutRec* outrec = outrec_list_[i]; + if (!outrec || !outrec->pts) continue; + if (outrec->is_open) + { + PathD path; + if (BuildPathD(outrec->pts, reverse_solution_, true, path, invScale_)) + open_paths.push_back(path); + continue; + } + + if (CheckBounds(outrec)) + RecursiveCheckOwners(outrec, &polytree); + } + } + +} // namespace clipper2lib diff --git a/source/Libraries/Clipper2/clipper.engine.h b/source/Libraries/Clipper2/clipper.engine.h new file mode 100644 index 00000000..6b724cb5 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.engine.h @@ -0,0 +1,637 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 13 December 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : This is the main polygon clipping module * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_ENGINE_H +#define CLIPPER_ENGINE_H + +#include +#include //#541 +#include +#include +#include +#include +#include +#include + +#include "clipper.core.h" + +namespace Clipper2Lib { + + struct Scanline; + struct IntersectNode; + struct Active; + struct Vertex; + struct LocalMinima; + struct OutRec; + struct HorzSegment; + + //Note: all clipping operations except for Difference are commutative. + enum class ClipType { None, Intersection, Union, Difference, Xor }; + + enum class PathType { Subject, Clip }; + enum class JoinWith { None, Left, Right }; + + enum class VertexFlags : uint32_t { + None = 0, OpenStart = 1, OpenEnd = 2, LocalMax = 4, LocalMin = 8 + }; + + constexpr enum VertexFlags operator &(enum VertexFlags a, enum VertexFlags b) + { + return (enum VertexFlags)(uint32_t(a) & uint32_t(b)); + } + + constexpr enum VertexFlags operator |(enum VertexFlags a, enum VertexFlags b) + { + return (enum VertexFlags)(uint32_t(a) | uint32_t(b)); + } + + struct Vertex { + Point64 pt; + Vertex* next = nullptr; + Vertex* prev = nullptr; + VertexFlags flags = VertexFlags::None; + }; + + struct OutPt { + Point64 pt; + OutPt* next = nullptr; + OutPt* prev = nullptr; + OutRec* outrec; + HorzSegment* horz = nullptr; + + OutPt(const Point64& pt_, OutRec* outrec_): pt(pt_), outrec(outrec_) { + next = this; + prev = this; + } + }; + + class PolyPath; + class PolyPath64; + class PolyPathD; + using PolyTree64 = PolyPath64; + using PolyTreeD = PolyPathD; + + struct OutRec; + typedef std::vector OutRecList; + + //OutRec: contains a path in the clipping solution. Edges in the AEL will + //have OutRec pointers assigned when they form part of the clipping solution. + struct OutRec { + size_t idx = 0; + OutRec* owner = nullptr; + Active* front_edge = nullptr; + Active* back_edge = nullptr; + OutPt* pts = nullptr; + PolyPath* polypath = nullptr; + OutRecList* splits = nullptr; + OutRec* recursive_split = nullptr; + Rect64 bounds = {}; + Path64 path; + bool is_open = false; + + ~OutRec() { + if (splits) delete splits; + // nb: don't delete the split pointers + // as these are owned by ClipperBase's outrec_list_ + }; + }; + + /////////////////////////////////////////////////////////////////// + //Important: UP and DOWN here are premised on Y-axis positive down + //displays, which is the orientation used in Clipper's development. + /////////////////////////////////////////////////////////////////// + + struct Active { + Point64 bot; + Point64 top; + int64_t curr_x = 0; //current (updated at every new scanline) + double dx = 0.0; + int wind_dx = 1; //1 or -1 depending on winding direction + int wind_cnt = 0; + int wind_cnt2 = 0; //winding count of the opposite polytype + OutRec* outrec = nullptr; + //AEL: 'active edge list' (Vatti's AET - active edge table) + // a linked list of all edges (from left to right) that are present + // (or 'active') within the current scanbeam (a horizontal 'beam' that + // sweeps from bottom to top over the paths in the clipping operation). + Active* prev_in_ael = nullptr; + Active* next_in_ael = nullptr; + //SEL: 'sorted edge list' (Vatti's ST - sorted table) + // linked list used when sorting edges into their new positions at the + // top of scanbeams, but also (re)used to process horizontals. + Active* prev_in_sel = nullptr; + Active* next_in_sel = nullptr; + Active* jump = nullptr; + Vertex* vertex_top = nullptr; + LocalMinima* local_min = nullptr; // the bottom of an edge 'bound' (also Vatti) + bool is_left_bound = false; + JoinWith join_with = JoinWith::None; + }; + + struct LocalMinima { + Vertex* vertex; + PathType polytype; + bool is_open; + LocalMinima(Vertex* v, PathType pt, bool open) : + vertex(v), polytype(pt), is_open(open){} + }; + + struct IntersectNode { + Point64 pt; + Active* edge1; + Active* edge2; + IntersectNode() : pt(Point64(0,0)), edge1(NULL), edge2(NULL) {} + IntersectNode(Active* e1, Active* e2, Point64& pt_) : + pt(pt_), edge1(e1), edge2(e2) {} + }; + + struct HorzSegment { + OutPt* left_op; + OutPt* right_op = nullptr; + bool left_to_right = true; + HorzSegment() : left_op(nullptr) { } + explicit HorzSegment(OutPt* op) : left_op(op) { } + }; + + struct HorzJoin { + OutPt* op1 = nullptr; + OutPt* op2 = nullptr; + HorzJoin() {}; + explicit HorzJoin(OutPt* ltr, OutPt* rtl) : op1(ltr), op2(rtl) { } + }; + +#ifdef USINGZ + typedef std::function ZCallback64; + + typedef std::function ZCallbackD; +#endif + + typedef std::vector HorzSegmentList; + typedef std::unique_ptr LocalMinima_ptr; + typedef std::vector LocalMinimaList; + typedef std::vector IntersectNodeList; + + // ReuseableDataContainer64 ------------------------------------------------ + + class ReuseableDataContainer64 { + private: + friend class ClipperBase; + LocalMinimaList minima_list_; + std::vector vertex_lists_; + void AddLocMin(Vertex& vert, PathType polytype, bool is_open); + public: + virtual ~ReuseableDataContainer64(); + void Clear(); + void AddPaths(const Paths64& paths, PathType polytype, bool is_open); + }; + + // ClipperBase ------------------------------------------------------------- + + class ClipperBase { + private: + ClipType cliptype_ = ClipType::None; + FillRule fillrule_ = FillRule::EvenOdd; + FillRule fillpos = FillRule::Positive; + int64_t bot_y_ = 0; + bool minima_list_sorted_ = false; + bool using_polytree_ = false; + Active* actives_ = nullptr; + Active *sel_ = nullptr; + LocalMinimaList minima_list_; //pointers in case of memory reallocs + LocalMinimaList::iterator current_locmin_iter_; + std::vector vertex_lists_; + std::priority_queue scanline_list_; + IntersectNodeList intersect_nodes_; + HorzSegmentList horz_seg_list_; + std::vector horz_join_list_; + void Reset(); + inline void InsertScanline(int64_t y); + inline bool PopScanline(int64_t &y); + inline bool PopLocalMinima(int64_t y, LocalMinima*& local_minima); + void DisposeAllOutRecs(); + void DisposeVerticesAndLocalMinima(); + void DeleteEdges(Active*& e); + inline void AddLocMin(Vertex &vert, PathType polytype, bool is_open); + bool IsContributingClosed(const Active &e) const; + inline bool IsContributingOpen(const Active &e) const; + void SetWindCountForClosedPathEdge(Active &edge); + void SetWindCountForOpenPathEdge(Active &e); + void InsertLocalMinimaIntoAEL(int64_t bot_y); + void InsertLeftEdge(Active &e); + inline void PushHorz(Active &e); + inline bool PopHorz(Active *&e); + inline OutPt* StartOpenPath(Active &e, const Point64& pt); + inline void UpdateEdgeIntoAEL(Active *e); + OutPt* IntersectEdges(Active &e1, Active &e2, const Point64& pt); + inline void DeleteFromAEL(Active &e); + inline void AdjustCurrXAndCopyToSEL(const int64_t top_y); + void DoIntersections(const int64_t top_y); + void AddNewIntersectNode(Active &e1, Active &e2, const int64_t top_y); + bool BuildIntersectList(const int64_t top_y); + void ProcessIntersectList(); + void SwapPositionsInAEL(Active& edge1, Active& edge2); + OutRec* NewOutRec(); + OutPt* AddOutPt(const Active &e, const Point64& pt); + OutPt* AddLocalMinPoly(Active &e1, Active &e2, + const Point64& pt, bool is_new = false); + OutPt* AddLocalMaxPoly(Active &e1, Active &e2, const Point64& pt); + void DoHorizontal(Active &horz); + bool ResetHorzDirection(const Active &horz, const Vertex* max_vertex, + int64_t &horz_left, int64_t &horz_right); + void DoTopOfScanbeam(const int64_t top_y); + Active *DoMaxima(Active &e); + void JoinOutrecPaths(Active &e1, Active &e2); + void FixSelfIntersects(OutRec* outrec); + void DoSplitOp(OutRec* outRec, OutPt* splitOp); + + inline void AddTrialHorzJoin(OutPt* op); + void ConvertHorzSegsToJoins(); + void ProcessHorzJoins(); + + void Split(Active& e, const Point64& pt); + inline void CheckJoinLeft(Active& e, + const Point64& pt, bool check_curr_x = false); + inline void CheckJoinRight(Active& e, + const Point64& pt, bool check_curr_x = false); + protected: + bool preserve_collinear_ = true; + bool reverse_solution_ = false; + int error_code_ = 0; + bool has_open_paths_ = false; + bool succeeded_ = true; + OutRecList outrec_list_; //pointers in case list memory reallocated + bool ExecuteInternal(ClipType ct, FillRule ft, bool use_polytrees); + void CleanCollinear(OutRec* outrec); + bool CheckBounds(OutRec* outrec); + bool CheckSplitOwner(OutRec* outrec, OutRecList* splits); + void RecursiveCheckOwners(OutRec* outrec, PolyPath* polypath); +#ifdef USINGZ + ZCallback64 zCallback_ = nullptr; + void SetZ(const Active& e1, const Active& e2, Point64& pt); +#endif + void CleanUp(); // unlike Clear, CleanUp preserves added paths + void AddPath(const Path64& path, PathType polytype, bool is_open); + void AddPaths(const Paths64& paths, PathType polytype, bool is_open); + public: + virtual ~ClipperBase(); + int ErrorCode() const { return error_code_; }; + void PreserveCollinear(bool val) { preserve_collinear_ = val; }; + bool PreserveCollinear() const { return preserve_collinear_;}; + void ReverseSolution(bool val) { reverse_solution_ = val; }; + bool ReverseSolution() const { return reverse_solution_; }; + void Clear(); + void AddReuseableData(const ReuseableDataContainer64& reuseable_data); +#ifdef USINGZ + int64_t DefaultZ = 0; +#endif + }; + + // PolyPath / PolyTree -------------------------------------------------------- + + //PolyTree: is intended as a READ-ONLY data structure for CLOSED paths returned + //by clipping operations. While this structure is more complex than the + //alternative Paths structure, it does preserve path 'ownership' - ie those + //paths that contain (or own) other paths. This will be useful to some users. + + class PolyPath { + protected: + PolyPath* parent_; + public: + PolyPath(PolyPath* parent = nullptr): parent_(parent){} + virtual ~PolyPath() {}; + //https://en.cppreference.com/w/cpp/language/rule_of_three + PolyPath(const PolyPath&) = delete; + PolyPath& operator=(const PolyPath&) = delete; + + unsigned Level() const + { + unsigned result = 0; + const PolyPath* p = parent_; + while (p) { ++result; p = p->parent_; } + return result; + } + + virtual PolyPath* AddChild(const Path64& path) = 0; + + virtual void Clear() = 0; + virtual size_t Count() const { return 0; } + + const PolyPath* Parent() const { return parent_; } + + bool IsHole() const + { + unsigned lvl = Level(); + //Even levels except level 0 + return lvl && !(lvl & 1); + } + }; + + typedef typename std::vector> PolyPath64List; + typedef typename std::vector> PolyPathDList; + + class PolyPath64 : public PolyPath { + private: + PolyPath64List childs_; + Path64 polygon_; + public: + explicit PolyPath64(PolyPath64* parent = nullptr) : PolyPath(parent) {} + + ~PolyPath64() { + childs_.resize(0); + } + + PolyPath64* operator [] (size_t index) const + { + return childs_[index].get(); //std::unique_ptr + } + + PolyPath64* Child(size_t index) const + { + return childs_[index].get(); + } + + PolyPath64List::const_iterator begin() const { return childs_.cbegin(); } + PolyPath64List::const_iterator end() const { return childs_.cend(); } + + PolyPath64* AddChild(const Path64& path) override + { + auto p = std::make_unique(this); + auto* result = childs_.emplace_back(std::move(p)).get(); + result->polygon_ = path; + return result; + } + + void Clear() override + { + childs_.resize(0); + } + + size_t Count() const override + { + return childs_.size(); + } + + const Path64& Polygon() const { return polygon_; }; + + double Area() const + { + return std::accumulate(childs_.cbegin(), childs_.cend(), + Clipper2Lib::Area(polygon_), + [](double a, const auto& child) {return a + child->Area(); }); + } + + }; + + class PolyPathD : public PolyPath { + private: + PolyPathDList childs_; + double scale_; + PathD polygon_; + public: + explicit PolyPathD(PolyPathD* parent = nullptr) : PolyPath(parent) + { + scale_ = parent ? parent->scale_ : 1.0; + } + + ~PolyPathD() { + childs_.resize(0); + } + + PolyPathD* operator [] (size_t index) const + { + return childs_[index].get(); + } + + PolyPathD* Child(size_t index) const + { + return childs_[index].get(); + } + + PolyPathDList::const_iterator begin() const { return childs_.cbegin(); } + PolyPathDList::const_iterator end() const { return childs_.cend(); } + + void SetScale(double value) { scale_ = value; } + double Scale() const { return scale_; } + + PolyPathD* AddChild(const Path64& path) override + { + int error_code = 0; + auto p = std::make_unique(this); + PolyPathD* result = childs_.emplace_back(std::move(p)).get(); + result->polygon_ = ScalePath(path, scale_, error_code); + return result; + } + + PolyPathD* AddChild(const PathD& path) + { + auto p = std::make_unique(this); + PolyPathD* result = childs_.emplace_back(std::move(p)).get(); + result->polygon_ = path; + return result; + } + + void Clear() override + { + childs_.resize(0); + } + + size_t Count() const override + { + return childs_.size(); + } + + const PathD& Polygon() const { return polygon_; }; + + double Area() const + { + return std::accumulate(childs_.begin(), childs_.end(), + Clipper2Lib::Area(polygon_), + [](double a, const auto& child) {return a + child->Area(); }); + } + }; + + class Clipper64 : public ClipperBase + { + private: + void BuildPaths64(Paths64& solutionClosed, Paths64* solutionOpen); + void BuildTree64(PolyPath64& polytree, Paths64& open_paths); + public: +#ifdef USINGZ + void SetZCallback(ZCallback64 cb) { zCallback_ = cb; } +#endif + + void AddSubject(const Paths64& subjects) + { + AddPaths(subjects, PathType::Subject, false); + } + void AddOpenSubject(const Paths64& open_subjects) + { + AddPaths(open_subjects, PathType::Subject, true); + } + void AddClip(const Paths64& clips) + { + AddPaths(clips, PathType::Clip, false); + } + + bool Execute(ClipType clip_type, + FillRule fill_rule, Paths64& closed_paths) + { + Paths64 dummy; + return Execute(clip_type, fill_rule, closed_paths, dummy); + } + + bool Execute(ClipType clip_type, FillRule fill_rule, + Paths64& closed_paths, Paths64& open_paths) + { + closed_paths.clear(); + open_paths.clear(); + if (ExecuteInternal(clip_type, fill_rule, false)) + BuildPaths64(closed_paths, &open_paths); + CleanUp(); + return succeeded_; + } + + bool Execute(ClipType clip_type, FillRule fill_rule, PolyTree64& polytree) + { + Paths64 dummy; + return Execute(clip_type, fill_rule, polytree, dummy); + } + + bool Execute(ClipType clip_type, + FillRule fill_rule, PolyTree64& polytree, Paths64& open_paths) + { + if (ExecuteInternal(clip_type, fill_rule, true)) + { + open_paths.clear(); + polytree.Clear(); + BuildTree64(polytree, open_paths); + } + CleanUp(); + return succeeded_; + } + }; + + class ClipperD : public ClipperBase { + private: + double scale_ = 1.0, invScale_ = 1.0; +#ifdef USINGZ + ZCallbackD zCallbackD_ = nullptr; +#endif + void BuildPathsD(PathsD& solutionClosed, PathsD* solutionOpen); + void BuildTreeD(PolyPathD& polytree, PathsD& open_paths); + public: + explicit ClipperD(int precision = 2) : ClipperBase() + { + CheckPrecisionRange(precision, error_code_); + // to optimize scaling / descaling precision + // set the scale to a power of double's radix (2) (#25) + scale_ = std::pow(std::numeric_limits::radix, + std::ilogb(std::pow(10, precision)) + 1); + invScale_ = 1 / scale_; + } + +#ifdef USINGZ + void SetZCallback(ZCallbackD cb) { zCallbackD_ = cb; }; + + void ZCB(const Point64& e1bot, const Point64& e1top, + const Point64& e2bot, const Point64& e2top, Point64& pt) + { + // de-scale (x & y) + // temporarily convert integers to their initial float values + // this will slow clipping marginally but will make it much easier + // to understand the coordinates passed to the callback function + PointD tmp = PointD(pt) * invScale_; + PointD e1b = PointD(e1bot) * invScale_; + PointD e1t = PointD(e1top) * invScale_; + PointD e2b = PointD(e2bot) * invScale_; + PointD e2t = PointD(e2top) * invScale_; + zCallbackD_(e1b,e1t, e2b, e2t, tmp); + pt.z = tmp.z; // only update 'z' + }; + + void CheckCallback() + { + if(zCallbackD_) + // if the user defined float point callback has been assigned + // then assign the proxy callback function + ClipperBase::zCallback_ = + std::bind(&ClipperD::ZCB, this, std::placeholders::_1, + std::placeholders::_2, std::placeholders::_3, + std::placeholders::_4, std::placeholders::_5); + else + ClipperBase::zCallback_ = nullptr; + } + +#endif + + void AddSubject(const PathsD& subjects) + { + AddPaths(ScalePaths(subjects, scale_, error_code_), PathType::Subject, false); + } + + void AddOpenSubject(const PathsD& open_subjects) + { + AddPaths(ScalePaths(open_subjects, scale_, error_code_), PathType::Subject, true); + } + + void AddClip(const PathsD& clips) + { + AddPaths(ScalePaths(clips, scale_, error_code_), PathType::Clip, false); + } + + bool Execute(ClipType clip_type, FillRule fill_rule, PathsD& closed_paths) + { + PathsD dummy; + return Execute(clip_type, fill_rule, closed_paths, dummy); + } + + bool Execute(ClipType clip_type, + FillRule fill_rule, PathsD& closed_paths, PathsD& open_paths) + { +#ifdef USINGZ + CheckCallback(); +#endif + if (ExecuteInternal(clip_type, fill_rule, false)) + { + BuildPathsD(closed_paths, &open_paths); + } + CleanUp(); + return succeeded_; + } + + bool Execute(ClipType clip_type, FillRule fill_rule, PolyTreeD& polytree) + { + PathsD dummy; + return Execute(clip_type, fill_rule, polytree, dummy); + } + + bool Execute(ClipType clip_type, + FillRule fill_rule, PolyTreeD& polytree, PathsD& open_paths) + { +#ifdef USINGZ + CheckCallback(); +#endif + if (ExecuteInternal(clip_type, fill_rule, true)) + { + polytree.Clear(); + polytree.SetScale(invScale_); + open_paths.clear(); + BuildTreeD(polytree, open_paths); + } + CleanUp(); + return succeeded_; + } + + }; + +} // namespace + +#endif // CLIPPER_ENGINE_H diff --git a/source/Libraries/Clipper2/clipper.export.h b/source/Libraries/Clipper2/clipper.export.h new file mode 100644 index 00000000..4d3f44b9 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.export.h @@ -0,0 +1,565 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 1 December 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : This module exports the Clipper2 Library (ie DLL/so) * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + + +/* + Boolean clipping: + cliptype: None=0, Intersection=1, Union=2, Difference=3, Xor=4 + fillrule: EvenOdd=0, NonZero=1, Positive=2, Negative=3 + + Polygon offsetting (inflate/deflate): + jointype: Square=0, Bevel=1, Round=2, Miter=3 + endtype: Polygon=0, Joined=1, Butt=2, Square=3, Round=4 + +The path structures used extensively in other parts of this library are all +based on std::vector classes. Since C++ classes can't be accessed by other +languages, these paths must be converted into simple C data structures that +can be understood by just about any programming language. And these C style +path structures are simple arrays of int64_t (CPath64) and double (CPathD). + +CPath64 and CPathD: +These are arrays of consecutive x and y path coordinates preceeded by +a pair of values containing the path's length (N) and a 0 value. +__________________________________ +|counter|coord1|coord2|...|coordN| +|N, 0 |x1, y1|x2, y2|...|xN, yN| +__________________________________ + +CPaths64 and CPathsD: +These are also arrays containing any number of consecutive CPath64 or +CPathD structures. But preceeding these consecutive paths, there is pair of +values that contain the total length of the array (A) structure and +the number (C) of CPath64 or CPathD it contains. +_______________________________ +|counter|path1|path2|...|pathC| +|A , C | | +_______________________________ + +CPolytree64 and CPolytreeD: +These are also arrays consisting of CPolyPath structures that represent +individual paths in a tree structure. However, the very first (ie top) +CPolyPath is just the tree container that won't have a path. And because +of that, its structure will be very slightly different from the remaining +CPolyPath. This difference will be discussed below. + +CPolyPath64 and CPolyPathD: +These are simple arrays consisting of a series of path coordinates followed +by any number of child (ie nested) CPolyPath. Preceeding these are two values +indicating the length of the path (N) and the number of child CPolyPath (C). +____________________________________________________________ +|counter|coord1|coord2|...|coordN| child1|child2|...|childC| +|N , C |x1, y1|x2, y2|...|xN, yN| | +____________________________________________________________ + +As mentioned above, the very first CPolyPath structure is just a container +that owns (both directly and indirectly) every other CPolyPath in the tree. +Since this first CPolyPath has no path, instead of a path length, its very +first value will contain the total length of the CPolytree array structure. + +All theses exported structures (CPaths64, CPathsD, CPolyTree64 & CPolyTreeD) +are arrays of type int64_t or double. And the first value in these arrays +will always contain the length of that array. + +These array structures are allocated in heap memory which will eventually +need to be released. But since applications dynamically linking to these +functions may use different memory managers, the only safe way to free up +this memory is to use the exported DisposeArray64 and DisposeArrayD +functions below. +*/ + + +#ifndef CLIPPER2_EXPORT_H +#define CLIPPER2_EXPORT_H + +#include +#include + +#include "clipper.core.h" +#include "clipper.engine.h" +#include "clipper.offset.h" +#include "clipper.rectclip.h" + +namespace Clipper2Lib { + +typedef int64_t* CPath64; +typedef int64_t* CPaths64; +typedef double* CPathD; +typedef double* CPathsD; + +typedef int64_t* CPolyPath64; +typedef int64_t* CPolyTree64; +typedef double* CPolyPathD; +typedef double* CPolyTreeD; + +template +struct CRect { + T left; + T top; + T right; + T bottom; +}; + +typedef CRect CRect64; +typedef CRect CRectD; + +template +inline bool CRectIsEmpty(const CRect& rect) +{ + return (rect.right <= rect.left) || (rect.bottom <= rect.top); +} + +template +inline Rect CRectToRect(const CRect& rect) +{ + Rect result; + result.left = rect.left; + result.top = rect.top; + result.right = rect.right; + result.bottom = rect.bottom; + return result; +} + +#ifdef _WIN32 + #define EXTERN_DLL_EXPORT extern "C" __declspec(dllexport) +#else + #define EXTERN_DLL_EXPORT extern "C" +#endif + + +////////////////////////////////////////////////////// +// EXPORTED FUNCTION DECLARATIONS +////////////////////////////////////////////////////// + +EXTERN_DLL_EXPORT const char* Version(); + +EXTERN_DLL_EXPORT void DisposeArray64(int64_t*& p) +{ + delete[] p; +} + +EXTERN_DLL_EXPORT void DisposeArrayD(double*& p) +{ + delete[] p; +} + +EXTERN_DLL_EXPORT int BooleanOp64(uint8_t cliptype, + uint8_t fillrule, const CPaths64 subjects, + const CPaths64 subjects_open, const CPaths64 clips, + CPaths64& solution, CPaths64& solution_open, + bool preserve_collinear = true, bool reverse_solution = false); + +EXTERN_DLL_EXPORT int BooleanOp_PolyTree64(uint8_t cliptype, + uint8_t fillrule, const CPaths64 subjects, + const CPaths64 subjects_open, const CPaths64 clips, + CPolyTree64& sol_tree, CPaths64& solution_open, + bool preserve_collinear = true, bool reverse_solution = false); + +EXTERN_DLL_EXPORT int BooleanOpD(uint8_t cliptype, + uint8_t fillrule, const CPathsD subjects, + const CPathsD subjects_open, const CPathsD clips, + CPathsD& solution, CPathsD& solution_open, int precision = 2, + bool preserve_collinear = true, bool reverse_solution = false); + +EXTERN_DLL_EXPORT int BooleanOp_PolyTreeD(uint8_t cliptype, + uint8_t fillrule, const CPathsD subjects, + const CPathsD subjects_open, const CPathsD clips, + CPolyTreeD& solution, CPathsD& solution_open, int precision = 2, + bool preserve_collinear = true, bool reverse_solution = false); + +EXTERN_DLL_EXPORT CPaths64 InflatePaths64(const CPaths64 paths, + double delta, uint8_t jointype, uint8_t endtype, + double miter_limit = 2.0, double arc_tolerance = 0.0, + bool reverse_solution = false); +EXTERN_DLL_EXPORT CPathsD InflatePathsD(const CPathsD paths, + double delta, uint8_t jointype, uint8_t endtype, + int precision = 2, double miter_limit = 2.0, + double arc_tolerance = 0.0, bool reverse_solution = false); + +// RectClip & RectClipLines: +EXTERN_DLL_EXPORT CPaths64 RectClip64(const CRect64& rect, + const CPaths64 paths); +EXTERN_DLL_EXPORT CPathsD RectClipD(const CRectD& rect, + const CPathsD paths, int precision = 2); +EXTERN_DLL_EXPORT CPaths64 RectClipLines64(const CRect64& rect, + const CPaths64 paths); +EXTERN_DLL_EXPORT CPathsD RectClipLinesD(const CRectD& rect, + const CPathsD paths, int precision = 2); + +////////////////////////////////////////////////////// +// INTERNAL FUNCTIONS +////////////////////////////////////////////////////// + +template +static void GetPathCountAndCPathsArrayLen(const Paths& paths, + size_t& cnt, size_t& array_len) +{ + array_len = 2; + cnt = 0; + for (const Path& path : paths) + if (path.size()) + { + array_len += path.size() * 2 + 2; + ++cnt; + } +} + +static size_t GetPolyPath64ArrayLen(const PolyPath64& pp) +{ + size_t result = 2; // poly_length + child_count + result += pp.Polygon().size() * 2; + //plus nested children :) + for (size_t i = 0; i < pp.Count(); ++i) + result += GetPolyPath64ArrayLen(*pp[i]); + return result; +} + +static void GetPolytreeCountAndCStorageSize(const PolyTree64& tree, + size_t& cnt, size_t& array_len) +{ + cnt = tree.Count(); // nb: top level count only + array_len = GetPolyPath64ArrayLen(tree); +} + +template +static T* CreateCPaths(const Paths& paths) +{ + size_t cnt = 0, array_len = 0; + GetPathCountAndCPathsArrayLen(paths, cnt, array_len); + T* result = new T[array_len], * v = result; + *v++ = array_len; + *v++ = cnt; + for (const Path& path : paths) + { + if (!path.size()) continue; + *v++ = path.size(); + *v++ = 0; + for (const Point& pt : path) + { + *v++ = pt.x; + *v++ = pt.y; + } + } + return result; +} + + +CPathsD CreateCPathsDFromPaths64(const Paths64& paths, double scale) +{ + if (!paths.size()) return nullptr; + size_t cnt, array_len; + GetPathCountAndCPathsArrayLen(paths, cnt, array_len); + CPathsD result = new double[array_len], v = result; + *v++ = (double)array_len; + *v++ = (double)cnt; + for (const Path64& path : paths) + { + if (!path.size()) continue; + *v = (double)path.size(); + ++v; *v++ = 0; + for (const Point64& pt : path) + { + *v++ = pt.x * scale; + *v++ = pt.y * scale; + } + } + return result; +} + +template +static Paths ConvertCPaths(T* paths) +{ + Paths result; + if (!paths) return result; + T* v = paths; ++v; + size_t cnt = static_cast(*v++); + result.reserve(cnt); + for (size_t i = 0; i < cnt; ++i) + { + size_t cnt2 = static_cast(*v); + v += 2; + Path path; + path.reserve(cnt2); + for (size_t j = 0; j < cnt2; ++j) + { + T x = *v++, y = *v++; + path.push_back(Point(x, y)); + } + result.push_back(path); + } + return result; +} + + +static Paths64 ConvertCPathsDToPaths64(const CPathsD paths, double scale) +{ + Paths64 result; + if (!paths) return result; + double* v = paths; + ++v; // skip the first value (0) + size_t cnt = static_cast(*v++); + result.reserve(cnt); + for (size_t i = 0; i < cnt; ++i) + { + size_t cnt2 = static_cast(*v); + v += 2; + Path64 path; + path.reserve(cnt2); + for (size_t j = 0; j < cnt2; ++j) + { + double x = *v++ * scale; + double y = *v++ * scale; + path.push_back(Point64(x, y)); + } + result.push_back(path); + } + return result; +} + +template +static void CreateCPolyPath(const PolyPath64* pp, T*& v, T scale) +{ + *v++ = static_cast(pp->Polygon().size()); + *v++ = static_cast(pp->Count()); + for (const Point64& pt : pp->Polygon()) + { + *v++ = static_cast(pt.x * scale); + *v++ = static_cast(pt.y * scale); + } + for (size_t i = 0; i < pp->Count(); ++i) + CreateCPolyPath(pp->Child(i), v, scale); +} + +template +static T* CreateCPolyTree(const PolyTree64& tree, T scale) +{ + if (scale == 0) scale = 1; + size_t cnt, array_len; + GetPolytreeCountAndCStorageSize(tree, cnt, array_len); + if (!cnt) return nullptr; + // allocate storage + T* result = new T[array_len]; + T* v = result; + + *v++ = static_cast(array_len); + *v++ = static_cast(tree.Count()); + for (size_t i = 0; i < tree.Count(); ++i) + CreateCPolyPath(tree.Child(i), v, scale); + return result; +} + +////////////////////////////////////////////////////// +// EXPORTED FUNCTION DEFINITIONS +////////////////////////////////////////////////////// + +EXTERN_DLL_EXPORT const char* Version() +{ + return CLIPPER2_VERSION; +} + +EXTERN_DLL_EXPORT int BooleanOp64(uint8_t cliptype, + uint8_t fillrule, const CPaths64 subjects, + const CPaths64 subjects_open, const CPaths64 clips, + CPaths64& solution, CPaths64& solution_open, + bool preserve_collinear, bool reverse_solution) +{ + if (cliptype > static_cast(ClipType::Xor)) return -4; + if (fillrule > static_cast(FillRule::Negative)) return -3; + + Paths64 sub, sub_open, clp, sol, sol_open; + sub = ConvertCPaths(subjects); + sub_open = ConvertCPaths(subjects_open); + clp = ConvertCPaths(clips); + + Clipper64 clipper; + clipper.PreserveCollinear(preserve_collinear); + clipper.ReverseSolution(reverse_solution); + if (sub.size() > 0) clipper.AddSubject(sub); + if (sub_open.size() > 0) clipper.AddOpenSubject(sub_open); + if (clp.size() > 0) clipper.AddClip(clp); + if (!clipper.Execute(ClipType(cliptype), FillRule(fillrule), sol, sol_open)) + return -1; // clipping bug - should never happen :) + solution = CreateCPaths(sol); + solution_open = CreateCPaths(sol_open); + return 0; //success !! +} + +EXTERN_DLL_EXPORT int BooleanOp_PolyTree64(uint8_t cliptype, + uint8_t fillrule, const CPaths64 subjects, + const CPaths64 subjects_open, const CPaths64 clips, + CPolyTree64& sol_tree, CPaths64& solution_open, + bool preserve_collinear, bool reverse_solution) +{ + if (cliptype > static_cast(ClipType::Xor)) return -4; + if (fillrule > static_cast(FillRule::Negative)) return -3; + Paths64 sub, sub_open, clp, sol_open; + sub = ConvertCPaths(subjects); + sub_open = ConvertCPaths(subjects_open); + clp = ConvertCPaths(clips); + + PolyTree64 tree; + Clipper64 clipper; + clipper.PreserveCollinear(preserve_collinear); + clipper.ReverseSolution(reverse_solution); + if (sub.size() > 0) clipper.AddSubject(sub); + if (sub_open.size() > 0) clipper.AddOpenSubject(sub_open); + if (clp.size() > 0) clipper.AddClip(clp); + if (!clipper.Execute(ClipType(cliptype), FillRule(fillrule), tree, sol_open)) + return -1; // clipping bug - should never happen :) + + sol_tree = CreateCPolyTree(tree, (int64_t)1); + solution_open = CreateCPaths(sol_open); + return 0; //success !! +} + +EXTERN_DLL_EXPORT int BooleanOpD(uint8_t cliptype, + uint8_t fillrule, const CPathsD subjects, + const CPathsD subjects_open, const CPathsD clips, + CPathsD& solution, CPathsD& solution_open, int precision, + bool preserve_collinear, bool reverse_solution) +{ + if (precision < -8 || precision > 8) return -5; + if (cliptype > static_cast(ClipType::Xor)) return -4; + if (fillrule > static_cast(FillRule::Negative)) return -3; + const double scale = std::pow(10, precision); + + Paths64 sub, sub_open, clp, sol, sol_open; + sub = ConvertCPathsDToPaths64(subjects, scale); + sub_open = ConvertCPathsDToPaths64(subjects_open, scale); + clp = ConvertCPathsDToPaths64(clips, scale); + + Clipper64 clipper; + clipper.PreserveCollinear(preserve_collinear); + clipper.ReverseSolution(reverse_solution); + if (sub.size() > 0) clipper.AddSubject(sub); + if (sub_open.size() > 0) clipper.AddOpenSubject(sub_open); + if (clp.size() > 0) clipper.AddClip(clp); + if (!clipper.Execute(ClipType(cliptype), + FillRule(fillrule), sol, sol_open)) return -1; + solution = CreateCPathsDFromPaths64(sol, 1 / scale); + solution_open = CreateCPathsDFromPaths64(sol_open, 1 / scale); + return 0; +} + +EXTERN_DLL_EXPORT int BooleanOp_PolyTreeD(uint8_t cliptype, + uint8_t fillrule, const CPathsD subjects, + const CPathsD subjects_open, const CPathsD clips, + CPolyTreeD& solution, CPathsD& solution_open, int precision, + bool preserve_collinear, bool reverse_solution) +{ + if (precision < -8 || precision > 8) return -5; + if (cliptype > static_cast(ClipType::Xor)) return -4; + if (fillrule > static_cast(FillRule::Negative)) return -3; + + double scale = std::pow(10, precision); + + int err = 0; + Paths64 sub, sub_open, clp, sol_open; + sub = ConvertCPathsDToPaths64(subjects, scale); + sub_open = ConvertCPathsDToPaths64(subjects_open, scale); + clp = ConvertCPathsDToPaths64(clips, scale); + + PolyTree64 tree; + Clipper64 clipper; + clipper.PreserveCollinear(preserve_collinear); + clipper.ReverseSolution(reverse_solution); + if (sub.size() > 0) clipper.AddSubject(sub); + if (sub_open.size() > 0) clipper.AddOpenSubject(sub_open); + if (clp.size() > 0) clipper.AddClip(clp); + if (!clipper.Execute(ClipType(cliptype), FillRule(fillrule), tree, sol_open)) + return -1; // clipping bug - should never happen :) + + solution = CreateCPolyTree(tree, 1/scale); + solution_open = CreateCPathsDFromPaths64(sol_open, 1 / scale); + return 0; //success !! +} + +EXTERN_DLL_EXPORT CPaths64 InflatePaths64(const CPaths64 paths, + double delta, uint8_t jointype, uint8_t endtype, double miter_limit, + double arc_tolerance, bool reverse_solution) +{ + Paths64 pp; + pp = ConvertCPaths(paths); + ClipperOffset clip_offset( miter_limit, + arc_tolerance, reverse_solution); + clip_offset.AddPaths(pp, JoinType(jointype), EndType(endtype)); + Paths64 result; + clip_offset.Execute(delta, result); + return CreateCPaths(result); +} + +EXTERN_DLL_EXPORT CPathsD InflatePathsD(const CPathsD paths, + double delta, uint8_t jointype, uint8_t endtype, + int precision, double miter_limit, + double arc_tolerance, bool reverse_solution) +{ + if (precision < -8 || precision > 8 || !paths) return nullptr; + + const double scale = std::pow(10, precision); + ClipperOffset clip_offset(miter_limit, arc_tolerance, reverse_solution); + Paths64 pp = ConvertCPathsDToPaths64(paths, scale); + clip_offset.AddPaths(pp, JoinType(jointype), EndType(endtype)); + Paths64 result; + clip_offset.Execute(delta * scale, result); + + return CreateCPathsDFromPaths64(result, 1 / scale); +} + +EXTERN_DLL_EXPORT CPaths64 RectClip64(const CRect64& rect, const CPaths64 paths) +{ + if (CRectIsEmpty(rect) || !paths) return nullptr; + Rect64 r64 = CRectToRect(rect); + class RectClip64 rc(r64); + Paths64 pp = ConvertCPaths(paths); + Paths64 result = rc.Execute(pp); + return CreateCPaths(result); +} + +EXTERN_DLL_EXPORT CPathsD RectClipD(const CRectD& rect, const CPathsD paths, int precision) +{ + if (CRectIsEmpty(rect) || !paths) return nullptr; + if (precision < -8 || precision > 8) return nullptr; + const double scale = std::pow(10, precision); + + RectD r = CRectToRect(rect); + Rect64 rec = ScaleRect(r, scale); + Paths64 pp = ConvertCPathsDToPaths64(paths, scale); + class RectClip64 rc(rec); + Paths64 result = rc.Execute(pp); + + return CreateCPathsDFromPaths64(result, 1 / scale); +} + +EXTERN_DLL_EXPORT CPaths64 RectClipLines64(const CRect64& rect, + const CPaths64 paths) +{ + if (CRectIsEmpty(rect) || !paths) return nullptr; + Rect64 r = CRectToRect(rect); + class RectClipLines64 rcl (r); + Paths64 pp = ConvertCPaths(paths); + Paths64 result = rcl.Execute(pp); + return CreateCPaths(result); +} + +EXTERN_DLL_EXPORT CPathsD RectClipLinesD(const CRectD& rect, + const CPathsD paths, int precision) +{ + if (CRectIsEmpty(rect) || !paths) return nullptr; + if (precision < -8 || precision > 8) return nullptr; + + const double scale = std::pow(10, precision); + Rect64 r = ScaleRect(CRectToRect(rect), scale); + class RectClipLines64 rcl(r); + Paths64 pp = ConvertCPathsDToPaths64(paths, scale); + Paths64 result = rcl.Execute(pp); + return CreateCPathsDFromPaths64(result, 1 / scale); +} + +} // end Clipper2Lib namespace + +#endif // CLIPPER2_EXPORT_H diff --git a/source/Libraries/Clipper2/clipper.h b/source/Libraries/Clipper2/clipper.h new file mode 100644 index 00000000..17a2a681 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.h @@ -0,0 +1,781 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 13 December 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : This module provides a simple interface to the Clipper Library * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_H +#define CLIPPER_H + +#include +#include +#include + +#include "clipper.core.h" +#include "clipper.engine.h" +#include "clipper.offset.h" +#include "clipper.minkowski.h" +#include "clipper.rectclip.h" + +namespace Clipper2Lib { + + inline Paths64 BooleanOp(ClipType cliptype, FillRule fillrule, + const Paths64& subjects, const Paths64& clips) + { + Paths64 result; + Clipper64 clipper; + clipper.AddSubject(subjects); + clipper.AddClip(clips); + clipper.Execute(cliptype, fillrule, result); + return result; + } + + inline void BooleanOp(ClipType cliptype, FillRule fillrule, + const Paths64& subjects, const Paths64& clips, PolyTree64& solution) + { + Paths64 sol_open; + Clipper64 clipper; + clipper.AddSubject(subjects); + clipper.AddClip(clips); + clipper.Execute(cliptype, fillrule, solution, sol_open); + } + + inline PathsD BooleanOp(ClipType cliptype, FillRule fillrule, + const PathsD& subjects, const PathsD& clips, int precision = 2) + { + int error_code = 0; + CheckPrecisionRange(precision, error_code); + PathsD result; + if (error_code) return result; + ClipperD clipper(precision); + clipper.AddSubject(subjects); + clipper.AddClip(clips); + clipper.Execute(cliptype, fillrule, result); + return result; + } + + inline void BooleanOp(ClipType cliptype, FillRule fillrule, + const PathsD& subjects, const PathsD& clips, + PolyTreeD& polytree, int precision = 2) + { + polytree.Clear(); + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (error_code) return; + ClipperD clipper(precision); + clipper.AddSubject(subjects); + clipper.AddClip(clips); + clipper.Execute(cliptype, fillrule, polytree); + } + + inline Paths64 Intersect(const Paths64& subjects, const Paths64& clips, FillRule fillrule) + { + return BooleanOp(ClipType::Intersection, fillrule, subjects, clips); + } + + inline PathsD Intersect(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimal_prec = 2) + { + return BooleanOp(ClipType::Intersection, fillrule, subjects, clips, decimal_prec); + } + + inline Paths64 Union(const Paths64& subjects, const Paths64& clips, FillRule fillrule) + { + return BooleanOp(ClipType::Union, fillrule, subjects, clips); + } + + inline PathsD Union(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimal_prec = 2) + { + return BooleanOp(ClipType::Union, fillrule, subjects, clips, decimal_prec); + } + + inline Paths64 Union(const Paths64& subjects, FillRule fillrule) + { + Paths64 result; + Clipper64 clipper; + clipper.AddSubject(subjects); + clipper.Execute(ClipType::Union, fillrule, result); + return result; + } + + inline PathsD Union(const PathsD& subjects, FillRule fillrule, int precision = 2) + { + PathsD result; + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (error_code) return result; + ClipperD clipper(precision); + clipper.AddSubject(subjects); + clipper.Execute(ClipType::Union, fillrule, result); + return result; + } + + inline Paths64 Difference(const Paths64& subjects, const Paths64& clips, FillRule fillrule) + { + return BooleanOp(ClipType::Difference, fillrule, subjects, clips); + } + + inline PathsD Difference(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimal_prec = 2) + { + return BooleanOp(ClipType::Difference, fillrule, subjects, clips, decimal_prec); + } + + inline Paths64 Xor(const Paths64& subjects, const Paths64& clips, FillRule fillrule) + { + return BooleanOp(ClipType::Xor, fillrule, subjects, clips); + } + + inline PathsD Xor(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimal_prec = 2) + { + return BooleanOp(ClipType::Xor, fillrule, subjects, clips, decimal_prec); + } + + inline Paths64 InflatePaths(const Paths64& paths, double delta, + JoinType jt, EndType et, double miter_limit = 2.0, + double arc_tolerance = 0.0) + { + if (!delta) return paths; + ClipperOffset clip_offset(miter_limit, arc_tolerance); + clip_offset.AddPaths(paths, jt, et); + Paths64 solution; + clip_offset.Execute(delta, solution); + return solution; + } + + inline PathsD InflatePaths(const PathsD& paths, double delta, + JoinType jt, EndType et, double miter_limit = 2.0, + int precision = 2, double arc_tolerance = 0.0) + { + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (!delta) return paths; + if (error_code) return PathsD(); + const double scale = std::pow(10, precision); + ClipperOffset clip_offset(miter_limit, arc_tolerance); + clip_offset.AddPaths(ScalePaths(paths, scale, error_code), jt, et); + if (error_code) return PathsD(); + Paths64 solution; + clip_offset.Execute(delta * scale, solution); + return ScalePaths(solution, 1 / scale, error_code); + } + + template + inline Path TranslatePath(const Path& path, T dx, T dy) + { + Path result; + result.reserve(path.size()); + std::transform(path.begin(), path.end(), back_inserter(result), + [dx, dy](const auto& pt) { return Point(pt.x + dx, pt.y +dy); }); + return result; + } + + inline Path64 TranslatePath(const Path64& path, int64_t dx, int64_t dy) + { + return TranslatePath(path, dx, dy); + } + + inline PathD TranslatePath(const PathD& path, double dx, double dy) + { + return TranslatePath(path, dx, dy); + } + + template + inline Paths TranslatePaths(const Paths& paths, T dx, T dy) + { + Paths result; + result.reserve(paths.size()); + std::transform(paths.begin(), paths.end(), back_inserter(result), + [dx, dy](const auto& path) { return TranslatePath(path, dx, dy); }); + return result; + } + + inline Paths64 TranslatePaths(const Paths64& paths, int64_t dx, int64_t dy) + { + return TranslatePaths(paths, dx, dy); + } + + inline PathsD TranslatePaths(const PathsD& paths, double dx, double dy) + { + return TranslatePaths(paths, dx, dy); + } + + inline Paths64 RectClip(const Rect64& rect, const Paths64& paths) + { + if (rect.IsEmpty() || paths.empty()) return Paths64(); + RectClip64 rc(rect); + return rc.Execute(paths); + } + + inline Paths64 RectClip(const Rect64& rect, const Path64& path) + { + if (rect.IsEmpty() || path.empty()) return Paths64(); + RectClip64 rc(rect); + return rc.Execute(Paths64{ path }); + } + + inline PathsD RectClip(const RectD& rect, const PathsD& paths, int precision = 2) + { + if (rect.IsEmpty() || paths.empty()) return PathsD(); + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (error_code) return PathsD(); + const double scale = std::pow(10, precision); + Rect64 r = ScaleRect(rect, scale); + RectClip64 rc(r); + Paths64 pp = ScalePaths(paths, scale, error_code); + if (error_code) return PathsD(); // ie: error_code result is lost + return ScalePaths( + rc.Execute(pp), 1 / scale, error_code); + } + + inline PathsD RectClip(const RectD& rect, const PathD& path, int precision = 2) + { + return RectClip(rect, PathsD{ path }, precision); + } + + inline Paths64 RectClipLines(const Rect64& rect, const Paths64& lines) + { + if (rect.IsEmpty() || lines.empty()) return Paths64(); + RectClipLines64 rcl(rect); + return rcl.Execute(lines); + } + + inline Paths64 RectClipLines(const Rect64& rect, const Path64& line) + { + return RectClipLines(rect, Paths64{ line }); + } + + inline PathsD RectClipLines(const RectD& rect, const PathsD& lines, int precision = 2) + { + if (rect.IsEmpty() || lines.empty()) return PathsD(); + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (error_code) return PathsD(); + const double scale = std::pow(10, precision); + Rect64 r = ScaleRect(rect, scale); + RectClipLines64 rcl(r); + Paths64 p = ScalePaths(lines, scale, error_code); + if (error_code) return PathsD(); + p = rcl.Execute(p); + return ScalePaths(p, 1 / scale, error_code); + } + + inline PathsD RectClipLines(const RectD& rect, const PathD& line, int precision = 2) + { + return RectClipLines(rect, PathsD{ line }, precision); + } + + namespace details + { + + inline void PolyPathToPaths64(const PolyPath64& polypath, Paths64& paths) + { + paths.push_back(polypath.Polygon()); + for (const auto& child : polypath) + PolyPathToPaths64(*child, paths); + } + + inline void PolyPathToPathsD(const PolyPathD& polypath, PathsD& paths) + { + paths.push_back(polypath.Polygon()); + for (const auto& child : polypath) + PolyPathToPathsD(*child, paths); + } + + inline bool PolyPath64ContainsChildren(const PolyPath64& pp) + { + for (const auto& child : pp) + { + // return false if this child isn't fully contained by its parent + + // checking for a single vertex outside is a bit too crude since + // it doesn't account for rounding errors. It's better to check + // for consecutive vertices found outside the parent's polygon. + + int outsideCnt = 0; + for (const Point64& pt : child->Polygon()) + { + PointInPolygonResult result = PointInPolygon(pt, pp.Polygon()); + if (result == PointInPolygonResult::IsInside) --outsideCnt; + else if (result == PointInPolygonResult::IsOutside) ++outsideCnt; + if (outsideCnt > 1) return false; + else if (outsideCnt < -1) break; + } + + // now check any nested children too + if (child->Count() > 0 && !PolyPath64ContainsChildren(*child)) + return false; + } + return true; + } + + static void OutlinePolyPath(std::ostream& os, + size_t idx, bool isHole, size_t count, const std::string& preamble) + { + std::string plural = (count == 1) ? "." : "s."; + if (isHole) + os << preamble << "+- Hole (" << idx << ") contains " << count << + " nested polygon" << plural << std::endl; + else + os << preamble << "+- Polygon (" << idx << ") contains " << count << + " hole" << plural << std::endl; + } + + static void OutlinePolyPath64(std::ostream& os, const PolyPath64& pp, + size_t idx, std::string preamble) + { + OutlinePolyPath(os, idx, pp.IsHole(), pp.Count(), preamble); + for (size_t i = 0; i < pp.Count(); ++i) + if (pp.Child(i)->Count()) + details::OutlinePolyPath64(os, *pp.Child(i), i, preamble + " "); + } + + static void OutlinePolyPathD(std::ostream& os, const PolyPathD& pp, + size_t idx, std::string preamble) + { + OutlinePolyPath(os, idx, pp.IsHole(), pp.Count(), preamble); + for (size_t i = 0; i < pp.Count(); ++i) + if (pp.Child(i)->Count()) + details::OutlinePolyPathD(os, *pp.Child(i), i, preamble + " "); + } + + template + inline constexpr void MakePathGeneric(const T an_array, + size_t array_size, std::vector& result) + { + result.reserve(array_size / 2); + for (size_t i = 0; i < array_size; i +=2) +#ifdef USINGZ + result.push_back( U{ an_array[i], an_array[i + 1], 0} ); +#else + result.push_back( U{ an_array[i], an_array[i + 1]} ); +#endif + } + + } // end details namespace + + inline std::ostream& operator<< (std::ostream& os, const PolyTree64& pp) + { + std::string plural = (pp.Count() == 1) ? " polygon." : " polygons."; + os << std::endl << "Polytree with " << pp.Count() << plural << std::endl; + for (size_t i = 0; i < pp.Count(); ++i) + if (pp.Child(i)->Count()) + details::OutlinePolyPath64(os, *pp.Child(i), i, " "); + os << std::endl << std::endl; + return os; + } + + inline std::ostream& operator<< (std::ostream& os, const PolyTreeD& pp) + { + std::string plural = (pp.Count() == 1) ? " polygon." : " polygons."; + os << std::endl << "Polytree with " << pp.Count() << plural << std::endl; + for (size_t i = 0; i < pp.Count(); ++i) + if (pp.Child(i)->Count()) + details::OutlinePolyPathD(os, *pp.Child(i), i, " "); + os << std::endl << std::endl; + if (!pp.Level()) os << std::endl; + return os; + } + + inline Paths64 PolyTreeToPaths64(const PolyTree64& polytree) + { + Paths64 result; + for (const auto& child : polytree) + details::PolyPathToPaths64(*child, result); + return result; + } + + inline PathsD PolyTreeToPathsD(const PolyTreeD& polytree) + { + PathsD result; + for (const auto& child : polytree) + details::PolyPathToPathsD(*child, result); + return result; + } + + inline bool CheckPolytreeFullyContainsChildren(const PolyTree64& polytree) + { + for (const auto& child : polytree) + if (child->Count() > 0 && + !details::PolyPath64ContainsChildren(*child)) + return false; + return true; + } + + template::value && + !std::is_same::value, bool + >::type = true> + inline Path64 MakePath(const std::vector& list) + { + const auto size = list.size() - list.size() % 2; + if (list.size() != size) + DoError(non_pair_error_i); // non-fatal without exception handling + Path64 result; + details::MakePathGeneric(list, size, result); + return result; + } + + template::value && + !std::is_same::value, bool + >::type = true> + inline Path64 MakePath(const T(&list)[N]) + { + // Make the compiler error on unpaired value (i.e. no runtime effects). + static_assert(N % 2 == 0, "MakePath requires an even number of arguments"); + Path64 result; + details::MakePathGeneric(list, N, result); + return result; + } + + template::value && + !std::is_same::value, bool + >::type = true> + inline PathD MakePathD(const std::vector& list) + { + const auto size = list.size() - list.size() % 2; + if (list.size() != size) + DoError(non_pair_error_i); // non-fatal without exception handling + PathD result; + details::MakePathGeneric(list, size, result); + return result; + } + + template::value && + !std::is_same::value, bool + >::type = true> + inline PathD MakePathD(const T(&list)[N]) + { + // Make the compiler error on unpaired value (i.e. no runtime effects). + static_assert(N % 2 == 0, "MakePath requires an even number of arguments"); + PathD result; + details::MakePathGeneric(list, N, result); + return result; + } + +#ifdef USINGZ + template + inline Path64 MakePathZ(const T2(&list)[N]) + { + static_assert(N % 3 == 0 && std::numeric_limits::is_integer, + "MakePathZ requires integer values in multiples of 3"); + std::size_t size = N / 3; + Path64 result(size); + for (size_t i = 0; i < size; ++i) + result[i] = Point64(list[i * 3], + list[i * 3 + 1], list[i * 3 + 2]); + return result; + } + + template + inline PathD MakePathZD(const T2(&list)[N]) + { + static_assert(N % 3 == 0, + "MakePathZD requires values in multiples of 3"); + std::size_t size = N / 3; + PathD result(size); + if constexpr (std::numeric_limits::is_integer) + for (size_t i = 0; i < size; ++i) + result[i] = PointD(list[i * 3], + list[i * 3 + 1], list[i * 3 + 2]); + else + for (size_t i = 0; i < size; ++i) + result[i] = PointD(list[i * 3], list[i * 3 + 1], + static_cast(list[i * 3 + 2])); + return result; + } +#endif + + inline Path64 TrimCollinear(const Path64& p, bool is_open_path = false) + { + size_t len = p.size(); + if (len < 3) + { + if (!is_open_path || len < 2 || p[0] == p[1]) return Path64(); + else return p; + } + + Path64 dst; + dst.reserve(len); + Path64::const_iterator srcIt = p.cbegin(), prevIt, stop = p.cend() - 1; + + if (!is_open_path) + { + while (srcIt != stop && !CrossProduct(*stop, *srcIt, *(srcIt + 1))) + ++srcIt; + while (srcIt != stop && !CrossProduct(*(stop - 1), *stop, *srcIt)) + --stop; + if (srcIt == stop) return Path64(); + } + + prevIt = srcIt++; + dst.push_back(*prevIt); + for (; srcIt != stop; ++srcIt) + { + if (CrossProduct(*prevIt, *srcIt, *(srcIt + 1))) + { + prevIt = srcIt; + dst.push_back(*prevIt); + } + } + + if (is_open_path) + dst.push_back(*srcIt); + else if (CrossProduct(*prevIt, *stop, dst[0])) + dst.push_back(*stop); + else + { + while (dst.size() > 2 && + !CrossProduct(dst[dst.size() - 1], dst[dst.size() - 2], dst[0])) + dst.pop_back(); + if (dst.size() < 3) return Path64(); + } + return dst; + } + + inline PathD TrimCollinear(const PathD& path, int precision, bool is_open_path = false) + { + int error_code = 0; + CheckPrecisionRange(precision, error_code); + if (error_code) return PathD(); + const double scale = std::pow(10, precision); + Path64 p = ScalePath(path, scale, error_code); + if (error_code) return PathD(); + p = TrimCollinear(p, is_open_path); + return ScalePath(p, 1/scale, error_code); + } + + template + inline double Distance(const Point pt1, const Point pt2) + { + return std::sqrt(DistanceSqr(pt1, pt2)); + } + + template + inline double Length(const Path& path, bool is_closed_path = false) + { + double result = 0.0; + if (path.size() < 2) return result; + auto it = path.cbegin(), stop = path.end() - 1; + for (; it != stop; ++it) + result += Distance(*it, *(it + 1)); + if (is_closed_path) + result += Distance(*stop, *path.cbegin()); + return result; + } + + + template + inline bool NearCollinear(const Point& pt1, const Point& pt2, const Point& pt3, double sin_sqrd_min_angle_rads) + { + double cp = std::abs(CrossProduct(pt1, pt2, pt3)); + return (cp * cp) / (DistanceSqr(pt1, pt2) * DistanceSqr(pt2, pt3)) < sin_sqrd_min_angle_rads; + } + + template + inline Path Ellipse(const Rect& rect, int steps = 0) + { + return Ellipse(rect.MidPoint(), + static_cast(rect.Width()) *0.5, + static_cast(rect.Height()) * 0.5, steps); + } + + template + inline Path Ellipse(const Point& center, + double radiusX, double radiusY = 0, int steps = 0) + { + if (radiusX <= 0) return Path(); + if (radiusY <= 0) radiusY = radiusX; + if (steps <= 2) + steps = static_cast(PI * sqrt((radiusX + radiusY) / 2)); + + double si = std::sin(2 * PI / steps); + double co = std::cos(2 * PI / steps); + double dx = co, dy = si; + Path result; + result.reserve(steps); + result.push_back(Point(center.x + radiusX, static_cast(center.y))); + for (int i = 1; i < steps; ++i) + { + result.push_back(Point(center.x + radiusX * dx, center.y + radiusY * dy)); + double x = dx * co - dy * si; + dy = dy * co + dx * si; + dx = x; + } + return result; + } + + template + inline double PerpendicDistFromLineSqrd(const Point& pt, + const Point& line1, const Point& line2) + { + double a = static_cast(pt.x - line1.x); + double b = static_cast(pt.y - line1.y); + double c = static_cast(line2.x - line1.x); + double d = static_cast(line2.y - line1.y); + if (c == 0 && d == 0) return 0; + return Sqr(a * d - c * b) / (c * c + d * d); + } + + inline size_t GetNext(size_t current, size_t high, + const std::vector& flags) + { + ++current; + while (current <= high && flags[current]) ++current; + if (current <= high) return current; + current = 0; + while (flags[current]) ++current; + return current; + } + + inline size_t GetPrior(size_t current, size_t high, + const std::vector& flags) + { + if (current == 0) current = high; + else --current; + while (current > 0 && flags[current]) --current; + if (!flags[current]) return current; + current = high; + while (flags[current]) --current; + return current; + } + + template + inline Path SimplifyPath(const Path &path, + double epsilon, bool isClosedPath = true) + { + const size_t len = path.size(), high = len -1; + const double epsSqr = Sqr(epsilon); + if (len < 4) return Path(path); + + std::vector flags(len); + std::vector distSqr(len); + size_t prior = high, curr = 0, start, next, prior2; + if (isClosedPath) + { + distSqr[0] = PerpendicDistFromLineSqrd(path[0], path[high], path[1]); + distSqr[high] = PerpendicDistFromLineSqrd(path[high], path[0], path[high - 1]); + } + else + { + distSqr[0] = MAX_DBL; + distSqr[high] = MAX_DBL; + } + for (size_t i = 1; i < high; ++i) + distSqr[i] = PerpendicDistFromLineSqrd(path[i], path[i - 1], path[i + 1]); + + for (;;) + { + if (distSqr[curr] > epsSqr) + { + start = curr; + do + { + curr = GetNext(curr, high, flags); + } while (curr != start && distSqr[curr] > epsSqr); + if (curr == start) break; + } + + prior = GetPrior(curr, high, flags); + next = GetNext(curr, high, flags); + if (next == prior) break; + + // flag for removal the smaller of adjacent 'distances' + if (distSqr[next] < distSqr[curr]) + { + prior2 = prior; + prior = curr; + curr = next; + next = GetNext(next, high, flags); + } + else + prior2 = GetPrior(prior, high, flags); + + flags[curr] = true; + curr = next; + next = GetNext(next, high, flags); + + if (isClosedPath || ((curr != high) && (curr != 0))) + distSqr[curr] = PerpendicDistFromLineSqrd(path[curr], path[prior], path[next]); + if (isClosedPath || ((prior != 0) && (prior != high))) + distSqr[prior] = PerpendicDistFromLineSqrd(path[prior], path[prior2], path[curr]); + } + Path result; + result.reserve(len); + for (typename Path::size_type i = 0; i < len; ++i) + if (!flags[i]) result.push_back(path[i]); + return result; + } + + template + inline Paths SimplifyPaths(const Paths &paths, + double epsilon, bool isClosedPath = true) + { + Paths result; + result.reserve(paths.size()); + for (const auto& path : paths) + result.push_back(SimplifyPath(path, epsilon, isClosedPath)); + return result; + } + + template + inline void RDP(const Path path, std::size_t begin, + std::size_t end, double epsSqrd, std::vector& flags) + { + typename Path::size_type idx = 0; + double max_d = 0; + while (end > begin && path[begin] == path[end]) flags[end--] = false; + for (typename Path::size_type i = begin + 1; i < end; ++i) + { + // PerpendicDistFromLineSqrd - avoids expensive Sqrt() + double d = PerpendicDistFromLineSqrd(path[i], path[begin], path[end]); + if (d <= max_d) continue; + max_d = d; + idx = i; + } + if (max_d <= epsSqrd) return; + flags[idx] = true; + if (idx > begin + 1) RDP(path, begin, idx, epsSqrd, flags); + if (idx < end - 1) RDP(path, idx, end, epsSqrd, flags); + } + + template + inline Path RamerDouglasPeucker(const Path& path, double epsilon) + { + const typename Path::size_type len = path.size(); + if (len < 5) return Path(path); + std::vector flags(len); + flags[0] = true; + flags[len - 1] = true; + RDP(path, 0, len - 1, Sqr(epsilon), flags); + Path result; + result.reserve(len); + for (typename Path::size_type i = 0; i < len; ++i) + if (flags[i]) + result.push_back(path[i]); + return result; + } + + template + inline Paths RamerDouglasPeucker(const Paths& paths, double epsilon) + { + Paths result; + result.reserve(paths.size()); + std::transform(paths.begin(), paths.end(), back_inserter(result), + [epsilon](const auto& path) + { return RamerDouglasPeucker(path, epsilon); }); + return result; + } + +} // end Clipper2Lib namespace + +#endif // CLIPPER_H diff --git a/source/Libraries/Clipper2/clipper.minkowski.h b/source/Libraries/Clipper2/clipper.minkowski.h new file mode 100644 index 00000000..db8612c4 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.minkowski.h @@ -0,0 +1,120 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 1 November 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : Minkowski Sum and Difference * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_MINKOWSKI_H +#define CLIPPER_MINKOWSKI_H + +#include +#include +#include +#include "clipper.core.h" + +namespace Clipper2Lib +{ + + namespace detail + { + inline Paths64 Minkowski(const Path64& pattern, const Path64& path, bool isSum, bool isClosed) + { + size_t delta = isClosed ? 0 : 1; + size_t patLen = pattern.size(), pathLen = path.size(); + if (patLen == 0 || pathLen == 0) return Paths64(); + Paths64 tmp; + tmp.reserve(pathLen); + + if (isSum) + { + for (const Point64& p : path) + { + Path64 path2(pattern.size()); + std::transform(pattern.cbegin(), pattern.cend(), + path2.begin(), [p](const Point64& pt2) {return p + pt2; }); + tmp.push_back(path2); + } + } + else + { + for (const Point64& p : path) + { + Path64 path2(pattern.size()); + std::transform(pattern.cbegin(), pattern.cend(), + path2.begin(), [p](const Point64& pt2) {return p - pt2; }); + tmp.push_back(path2); + } + } + + Paths64 result; + result.reserve((pathLen - delta) * patLen); + size_t g = isClosed ? pathLen - 1 : 0; + for (size_t h = patLen - 1, i = delta; i < pathLen; ++i) + { + for (size_t j = 0; j < patLen; j++) + { + Path64 quad; + quad.reserve(4); + { + quad.push_back(tmp[g][h]); + quad.push_back(tmp[i][h]); + quad.push_back(tmp[i][j]); + quad.push_back(tmp[g][j]); + }; + if (!IsPositive(quad)) + std::reverse(quad.begin(), quad.end()); + result.push_back(quad); + h = j; + } + g = i; + } + return result; + } + + inline Paths64 Union(const Paths64& subjects, FillRule fillrule) + { + Paths64 result; + Clipper64 clipper; + clipper.AddSubject(subjects); + clipper.Execute(ClipType::Union, fillrule, result); + return result; + } + + } // namespace internal + + inline Paths64 MinkowskiSum(const Path64& pattern, const Path64& path, bool isClosed) + { + return detail::Union(detail::Minkowski(pattern, path, true, isClosed), FillRule::NonZero); + } + + inline PathsD MinkowskiSum(const PathD& pattern, const PathD& path, bool isClosed, int decimalPlaces = 2) + { + int error_code = 0; + double scale = pow(10, decimalPlaces); + Path64 pat64 = ScalePath(pattern, scale, error_code); + Path64 path64 = ScalePath(path, scale, error_code); + Paths64 tmp = detail::Union(detail::Minkowski(pat64, path64, true, isClosed), FillRule::NonZero); + return ScalePaths(tmp, 1 / scale, error_code); + } + + inline Paths64 MinkowskiDiff(const Path64& pattern, const Path64& path, bool isClosed) + { + return detail::Union(detail::Minkowski(pattern, path, false, isClosed), FillRule::NonZero); + } + + inline PathsD MinkowskiDiff(const PathD& pattern, const PathD& path, bool isClosed, int decimalPlaces = 2) + { + int error_code = 0; + double scale = pow(10, decimalPlaces); + Path64 pat64 = ScalePath(pattern, scale, error_code); + Path64 path64 = ScalePath(path, scale, error_code); + Paths64 tmp = detail::Union(detail::Minkowski(pat64, path64, false, isClosed), FillRule::NonZero); + return ScalePaths(tmp, 1 / scale, error_code); + } + +} // Clipper2Lib namespace + +#endif // CLIPPER_MINKOWSKI_H diff --git a/source/Libraries/Clipper2/clipper.offset.cpp b/source/Libraries/Clipper2/clipper.offset.cpp new file mode 100644 index 00000000..1611d021 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.offset.cpp @@ -0,0 +1,689 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 13 January 2024 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2024 * +* Purpose : Path Offset (Inflate/Shrink) * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#include +#include "clipper.h" +#include "clipper.offset.h" + +namespace Clipper2Lib { + +const double default_arc_tolerance = 0.25; +const double floating_point_tolerance = 1e-12; + +//------------------------------------------------------------------------------ +// Miscellaneous methods +//------------------------------------------------------------------------------ + +inline bool ToggleBoolIf(bool val, bool condition) +{ + return condition ? !val : val; +} + +void GetMultiBounds(const Paths64& paths, std::vector& recList) +{ + recList.reserve(paths.size()); + for (const Path64& path : paths) + { + if (path.size() < 1) + { + recList.push_back(InvalidRect64); + continue; + } + int64_t x = path[0].x, y = path[0].y; + Rect64 r = Rect64(x, y, x, y); + for (const Point64& pt : path) + { + if (pt.y > r.bottom) r.bottom = pt.y; + else if (pt.y < r.top) r.top = pt.y; + if (pt.x > r.right) r.right = pt.x; + else if (pt.x < r.left) r.left = pt.x; + } + recList.push_back(r); + } +} + +bool ValidateBounds(std::vector& recList, double delta) +{ + int64_t int_delta = static_cast(delta); + int64_t big = MAX_COORD - int_delta; + int64_t small = MIN_COORD + int_delta; + for (const Rect64& r : recList) + { + if (!r.IsValid()) continue; // ignore invalid paths + else if (r.left < small || r.right > big || + r.top < small || r.bottom > big) return false; + } + return true; +} + +int GetLowestClosedPathIdx(std::vector& boundsList) +{ + int i = -1, result = -1; + Point64 botPt = Point64(INT64_MAX, INT64_MIN); + for (const Rect64& r : boundsList) + { + ++i; + if (!r.IsValid()) continue; // ignore invalid paths + else if (r.bottom > botPt.y || (r.bottom == botPt.y && r.left < botPt.x)) + { + botPt = Point64(r.left, r.bottom); + result = static_cast(i); + } + } + return result; +} + +PointD GetUnitNormal(const Point64& pt1, const Point64& pt2) +{ + double dx, dy, inverse_hypot; + if (pt1 == pt2) return PointD(0.0, 0.0); + dx = static_cast(pt2.x - pt1.x); + dy = static_cast(pt2.y - pt1.y); + inverse_hypot = 1.0 / hypot(dx, dy); + dx *= inverse_hypot; + dy *= inverse_hypot; + return PointD(dy, -dx); +} + +inline bool AlmostZero(double value, double epsilon = 0.001) +{ + return std::fabs(value) < epsilon; +} + +inline double Hypot(double x, double y) +{ + //see https://stackoverflow.com/a/32436148/359538 + return std::sqrt(x * x + y * y); +} + +inline PointD NormalizeVector(const PointD& vec) +{ + double h = Hypot(vec.x, vec.y); + if (AlmostZero(h)) return PointD(0,0); + double inverseHypot = 1 / h; + return PointD(vec.x * inverseHypot, vec.y * inverseHypot); +} + +inline PointD GetAvgUnitVector(const PointD& vec1, const PointD& vec2) +{ + return NormalizeVector(PointD(vec1.x + vec2.x, vec1.y + vec2.y)); +} + +inline bool IsClosedPath(EndType et) +{ + return et == EndType::Polygon || et == EndType::Joined; +} + +inline Point64 GetPerpendic(const Point64& pt, const PointD& norm, double delta) +{ +#ifdef USINGZ + return Point64(pt.x + norm.x * delta, pt.y + norm.y * delta, pt.z); +#else + return Point64(pt.x + norm.x * delta, pt.y + norm.y * delta); +#endif +} + +inline PointD GetPerpendicD(const Point64& pt, const PointD& norm, double delta) +{ +#ifdef USINGZ + return PointD(pt.x + norm.x * delta, pt.y + norm.y * delta, pt.z); +#else + return PointD(pt.x + norm.x * delta, pt.y + norm.y * delta); +#endif +} + +inline void NegatePath(PathD& path) +{ + for (PointD& pt : path) + { + pt.x = -pt.x; + pt.y = -pt.y; +#ifdef USINGZ + pt.z = pt.z; +#endif + } +} + + +//------------------------------------------------------------------------------ +// ClipperOffset::Group methods +//------------------------------------------------------------------------------ + +ClipperOffset::Group::Group(const Paths64& _paths, JoinType _join_type, EndType _end_type): + paths_in(_paths), join_type(_join_type), end_type(_end_type) +{ + bool is_joined = + (end_type == EndType::Polygon) || + (end_type == EndType::Joined); + for (Path64& p: paths_in) + StripDuplicates(p, is_joined); + + // get bounds of each path --> bounds_list + GetMultiBounds(paths_in, bounds_list); + + if (end_type == EndType::Polygon) + { + is_hole_list.reserve(paths_in.size()); + for (const Path64& path : paths_in) + is_hole_list.push_back(Area(path) < 0); + lowest_path_idx = GetLowestClosedPathIdx(bounds_list); + // the lowermost path must be an outer path, so if its orientation is negative, + // then flag the whole group is 'reversed' (will negate delta etc.) + // as this is much more efficient than reversing every path. + is_reversed = (lowest_path_idx >= 0) && is_hole_list[lowest_path_idx]; + if (is_reversed) is_hole_list.flip(); + } + else + { + lowest_path_idx = -1; + is_reversed = false; + is_hole_list.resize(paths_in.size()); + } +} + + +//------------------------------------------------------------------------------ +// ClipperOffset methods +//------------------------------------------------------------------------------ + +void ClipperOffset::AddPath(const Path64& path, JoinType jt_, EndType et_) +{ + Paths64 paths; + paths.push_back(path); + AddPaths(paths, jt_, et_); +} + +void ClipperOffset::AddPaths(const Paths64 &paths, JoinType jt_, EndType et_) +{ + if (paths.size() == 0) return; + groups_.push_back(Group(paths, jt_, et_)); +} + +void ClipperOffset::BuildNormals(const Path64& path) +{ + norms.clear(); + norms.reserve(path.size()); + if (path.size() == 0) return; + Path64::const_iterator path_iter, path_stop_iter = --path.cend(); + for (path_iter = path.cbegin(); path_iter != path_stop_iter; ++path_iter) + norms.push_back(GetUnitNormal(*path_iter,*(path_iter +1))); + norms.push_back(GetUnitNormal(*path_stop_iter, *(path.cbegin()))); +} + +void ClipperOffset::DoBevel(const Path64& path, size_t j, size_t k) +{ + PointD pt1, pt2; + if (j == k) + { + double abs_delta = std::abs(group_delta_); +#ifdef USINGZ + pt1 = PointD(path[j].x - abs_delta * norms[j].x, path[j].y - abs_delta * norms[j].y, path[j].z); + pt2 = PointD(path[j].x + abs_delta * norms[j].x, path[j].y + abs_delta * norms[j].y, path[j].z); +#else + pt1 = PointD(path[j].x - abs_delta * norms[j].x, path[j].y - abs_delta * norms[j].y); + pt2 = PointD(path[j].x + abs_delta * norms[j].x, path[j].y + abs_delta * norms[j].y); +#endif + } + else + { +#ifdef USINGZ + pt1 = PointD(path[j].x + group_delta_ * norms[k].x, path[j].y + group_delta_ * norms[k].y, path[j].z); + pt2 = PointD(path[j].x + group_delta_ * norms[j].x, path[j].y + group_delta_ * norms[j].y, path[j].z); +#else + pt1 = PointD(path[j].x + group_delta_ * norms[k].x, path[j].y + group_delta_ * norms[k].y); + pt2 = PointD(path[j].x + group_delta_ * norms[j].x, path[j].y + group_delta_ * norms[j].y); +#endif + } + path_out.push_back(Point64(pt1)); + path_out.push_back(Point64(pt2)); +} + +void ClipperOffset::DoSquare(const Path64& path, size_t j, size_t k) +{ + PointD vec; + if (j == k) + vec = PointD(norms[j].y, -norms[j].x); + else + vec = GetAvgUnitVector( + PointD(-norms[k].y, norms[k].x), + PointD(norms[j].y, -norms[j].x)); + + double abs_delta = std::abs(group_delta_); + + // now offset the original vertex delta units along unit vector + PointD ptQ = PointD(path[j]); + ptQ = TranslatePoint(ptQ, abs_delta * vec.x, abs_delta * vec.y); + // get perpendicular vertices + PointD pt1 = TranslatePoint(ptQ, group_delta_ * vec.y, group_delta_ * -vec.x); + PointD pt2 = TranslatePoint(ptQ, group_delta_ * -vec.y, group_delta_ * vec.x); + // get 2 vertices along one edge offset + PointD pt3 = GetPerpendicD(path[k], norms[k], group_delta_); + if (j == k) + { + PointD pt4 = PointD(pt3.x + vec.x * group_delta_, pt3.y + vec.y * group_delta_); + PointD pt = ptQ; + GetIntersectPoint(pt1, pt2, pt3, pt4, pt); + //get the second intersect point through reflecion + path_out.push_back(Point64(ReflectPoint(pt, ptQ))); + path_out.push_back(Point64(pt)); + } + else + { + PointD pt4 = GetPerpendicD(path[j], norms[k], group_delta_); + PointD pt = ptQ; + GetIntersectPoint(pt1, pt2, pt3, pt4, pt); + path_out.push_back(Point64(pt)); + //get the second intersect point through reflecion + path_out.push_back(Point64(ReflectPoint(pt, ptQ))); + } +} + +void ClipperOffset::DoMiter(const Path64& path, size_t j, size_t k, double cos_a) +{ + double q = group_delta_ / (cos_a + 1); +#ifdef USINGZ + path_out.push_back(Point64( + path[j].x + (norms[k].x + norms[j].x) * q, + path[j].y + (norms[k].y + norms[j].y) * q, + path[j].z)); +#else + path_out.push_back(Point64( + path[j].x + (norms[k].x + norms[j].x) * q, + path[j].y + (norms[k].y + norms[j].y) * q)); +#endif +} + +void ClipperOffset::DoRound(const Path64& path, size_t j, size_t k, double angle) +{ + if (deltaCallback64_) { + // when deltaCallback64_ is assigned, group_delta_ won't be constant, + // so we'll need to do the following calculations for *every* vertex. + double abs_delta = std::fabs(group_delta_); + double arcTol = (arc_tolerance_ > floating_point_tolerance ? + std::min(abs_delta, arc_tolerance_) : + std::log10(2 + abs_delta) * default_arc_tolerance); + double steps_per_360 = std::min(PI / std::acos(1 - arcTol / abs_delta), abs_delta * PI); + step_sin_ = std::sin(2 * PI / steps_per_360); + step_cos_ = std::cos(2 * PI / steps_per_360); + if (group_delta_ < 0.0) step_sin_ = -step_sin_; + steps_per_rad_ = steps_per_360 / (2 * PI); + } + + Point64 pt = path[j]; + PointD offsetVec = PointD(norms[k].x * group_delta_, norms[k].y * group_delta_); + + if (j == k) offsetVec.Negate(); +#ifdef USINGZ + path_out.push_back(Point64(pt.x + offsetVec.x, pt.y + offsetVec.y, pt.z)); +#else + path_out.push_back(Point64(pt.x + offsetVec.x, pt.y + offsetVec.y)); +#endif + int steps = static_cast(std::ceil(steps_per_rad_ * std::abs(angle))); // #448, #456 + for (int i = 1; i < steps; ++i) // ie 1 less than steps + { + offsetVec = PointD(offsetVec.x * step_cos_ - step_sin_ * offsetVec.y, + offsetVec.x * step_sin_ + offsetVec.y * step_cos_); +#ifdef USINGZ + path_out.push_back(Point64(pt.x + offsetVec.x, pt.y + offsetVec.y, pt.z)); +#else + path_out.push_back(Point64(pt.x + offsetVec.x, pt.y + offsetVec.y)); +#endif + } + path_out.push_back(GetPerpendic(path[j], norms[j], group_delta_)); +} + +void ClipperOffset::OffsetPoint(Group& group, const Path64& path, size_t j, size_t k) +{ + // Let A = change in angle where edges join + // A == 0: ie no change in angle (flat join) + // A == PI: edges 'spike' + // sin(A) < 0: right turning + // cos(A) < 0: change in angle is more than 90 degree + + if (path[j] == path[k]) { k = j; return; } + + double sin_a = CrossProduct(norms[j], norms[k]); + double cos_a = DotProduct(norms[j], norms[k]); + if (sin_a > 1.0) sin_a = 1.0; + else if (sin_a < -1.0) sin_a = -1.0; + + if (deltaCallback64_) { + group_delta_ = deltaCallback64_(path, norms, j, k); + if (group.is_reversed) group_delta_ = -group_delta_; + } + if (std::fabs(group_delta_) <= floating_point_tolerance) + { + path_out.push_back(path[j]); + return; + } + + if (cos_a > -0.99 && (sin_a * group_delta_ < 0)) // test for concavity first (#593) + { + // is concave + path_out.push_back(GetPerpendic(path[j], norms[k], group_delta_)); + // this extra point is the only (simple) way to ensure that + // path reversals are fully cleaned with the trailing clipper + path_out.push_back(path[j]); // (#405) + path_out.push_back(GetPerpendic(path[j], norms[j], group_delta_)); + } + else if (cos_a > 0.999 && join_type_ != JoinType::Round) + { + // almost straight - less than 2.5 degree (#424, #482, #526 & #724) + DoMiter(path, j, k, cos_a); + } + else if (join_type_ == JoinType::Miter) + { + // miter unless the angle is sufficiently acute to exceed ML + if (cos_a > temp_lim_ - 1) DoMiter(path, j, k, cos_a); + else DoSquare(path, j, k); + } + else if (join_type_ == JoinType::Round) + DoRound(path, j, k, std::atan2(sin_a, cos_a)); + else if ( join_type_ == JoinType::Bevel) + DoBevel(path, j, k); + else + DoSquare(path, j, k); +} + +void ClipperOffset::OffsetPolygon(Group& group, const Path64& path) +{ + path_out.clear(); + for (Path64::size_type j = 0, k = path.size() -1; j < path.size(); k = j, ++j) + OffsetPoint(group, path, j, k); + solution.push_back(path_out); +} + +void ClipperOffset::OffsetOpenJoined(Group& group, const Path64& path) +{ + OffsetPolygon(group, path); + Path64 reverse_path(path); + std::reverse(reverse_path.begin(), reverse_path.end()); + + //rebuild normals // BuildNormals(path); + std::reverse(norms.begin(), norms.end()); + norms.push_back(norms[0]); + norms.erase(norms.begin()); + NegatePath(norms); + + OffsetPolygon(group, reverse_path); +} + +void ClipperOffset::OffsetOpenPath(Group& group, const Path64& path) +{ + // do the line start cap + if (deltaCallback64_) group_delta_ = deltaCallback64_(path, norms, 0, 0); + + if (std::fabs(group_delta_) <= floating_point_tolerance) + path_out.push_back(path[0]); + else + { + switch (end_type_) + { + case EndType::Butt: + DoBevel(path, 0, 0); + break; + case EndType::Round: + DoRound(path, 0, 0, PI); + break; + default: + DoSquare(path, 0, 0); + break; + } + } + + size_t highI = path.size() - 1; + // offset the left side going forward + for (Path64::size_type j = 1, k = 0; j < highI; k = j, ++j) + OffsetPoint(group, path, j, k); + + // reverse normals + for (size_t i = highI; i > 0; --i) + norms[i] = PointD(-norms[i - 1].x, -norms[i - 1].y); + norms[0] = norms[highI]; + + // do the line end cap + if (deltaCallback64_) + group_delta_ = deltaCallback64_(path, norms, highI, highI); + + if (std::fabs(group_delta_) <= floating_point_tolerance) + path_out.push_back(path[highI]); + else + { + switch (end_type_) + { + case EndType::Butt: + DoBevel(path, highI, highI); + break; + case EndType::Round: + DoRound(path, highI, highI, PI); + break; + default: + DoSquare(path, highI, highI); + break; + } + } + + for (size_t j = highI, k = 0; j > 0; k = j, --j) + OffsetPoint(group, path, j, k); + solution.push_back(path_out); +} + +void ClipperOffset::DoGroupOffset(Group& group) +{ + if (group.end_type == EndType::Polygon) + { + // a straight path (2 points) can now also be 'polygon' offset + // where the ends will be treated as (180 deg.) joins + if (group.lowest_path_idx < 0) delta_ = std::abs(delta_); + group_delta_ = (group.is_reversed) ? -delta_ : delta_; + } + else + group_delta_ = std::abs(delta_);// *0.5; + + double abs_delta = std::fabs(group_delta_); + if (!ValidateBounds(group.bounds_list, abs_delta)) + { + DoError(range_error_i); + error_code_ |= range_error_i; + return; + } + + join_type_ = group.join_type; + end_type_ = group.end_type; + + if (group.join_type == JoinType::Round || group.end_type == EndType::Round) + { + // calculate a sensible number of steps (for 360 deg for the given offset) + // arcTol - when arc_tolerance_ is undefined (0), the amount of + // curve imprecision that's allowed is based on the size of the + // offset (delta). Obviously very large offsets will almost always + // require much less precision. See also offset_triginometry2.svg + double arcTol = (arc_tolerance_ > floating_point_tolerance ? + std::min(abs_delta, arc_tolerance_) : + std::log10(2 + abs_delta) * default_arc_tolerance); + + double steps_per_360 = std::min(PI / std::acos(1 - arcTol / abs_delta), abs_delta * PI); + step_sin_ = std::sin(2 * PI / steps_per_360); + step_cos_ = std::cos(2 * PI / steps_per_360); + if (group_delta_ < 0.0) step_sin_ = -step_sin_; + steps_per_rad_ = steps_per_360 / (2 * PI); + } + + std::vector::const_iterator path_rect_it = group.bounds_list.cbegin(); + std::vector::const_iterator is_hole_it = group.is_hole_list.cbegin(); + Paths64::const_iterator path_in_it = group.paths_in.cbegin(); + for ( ; path_in_it != group.paths_in.cend(); ++path_in_it, ++path_rect_it, ++is_hole_it) + { + if (!path_rect_it->IsValid()) continue; + Path64::size_type pathLen = path_in_it->size(); + path_out.clear(); + + if (pathLen == 1) // single point + { + if (deltaCallback64_) + { + group_delta_ = deltaCallback64_(*path_in_it, norms, 0, 0); + if (group.is_reversed) group_delta_ = -group_delta_; + abs_delta = std::fabs(group_delta_); + } + + if (group_delta_ < 1) continue; + const Point64& pt = (*path_in_it)[0]; + //single vertex so build a circle or square ... + if (group.join_type == JoinType::Round) + { + double radius = abs_delta; + int steps = static_cast(std::ceil(steps_per_rad_ * 2 * PI)); //#617 + path_out = Ellipse(pt, radius, radius, steps); +#ifdef USINGZ + for (auto& p : path_out) p.z = pt.z; +#endif + } + else + { + int d = (int)std::ceil(abs_delta); + Rect64 r = Rect64(pt.x - d, pt.y - d, pt.x + d, pt.y + d); + path_out = r.AsPath(); +#ifdef USINGZ + for (auto& p : path_out) p.z = pt.z; +#endif + } + solution.push_back(path_out); + continue; + } // end of offsetting a single point + + // when shrinking outer paths, make sure they can shrink this far (#593) + // also when shrinking holes, make sure they too can shrink this far (#715) + if ((group_delta_ > 0) == ToggleBoolIf(*is_hole_it, group.is_reversed) && + (std::min(path_rect_it->Width(), path_rect_it->Height()) <= -group_delta_ * 2) ) + continue; + + if ((pathLen == 2) && (group.end_type == EndType::Joined)) + end_type_ = (group.join_type == JoinType::Round) ? + EndType::Round : + EndType::Square; + + BuildNormals(*path_in_it); + if (end_type_ == EndType::Polygon) OffsetPolygon(group, *path_in_it); + else if (end_type_ == EndType::Joined) OffsetOpenJoined(group, *path_in_it); + else OffsetOpenPath(group, *path_in_it); + } +} + + +size_t ClipperOffset::CalcSolutionCapacity() +{ + size_t result = 0; + for (const Group& g : groups_) + result += (g.end_type == EndType::Joined) ? g.paths_in.size() * 2 : g.paths_in.size(); + return result; +} + +bool ClipperOffset::CheckReverseOrientation() +{ + // nb: this assumes there's consistency in orientation between groups + bool is_reversed_orientation = false; + for (const Group& g : groups_) + if (g.end_type == EndType::Polygon) + { + is_reversed_orientation = g.is_reversed; + break; + } + return is_reversed_orientation; +} + +void ClipperOffset::ExecuteInternal(double delta) +{ + error_code_ = 0; + solution.clear(); + if (groups_.size() == 0) return; + solution.reserve(CalcSolutionCapacity()); + + if (std::abs(delta) < 0.5) // ie: offset is insignificant + { + Paths64::size_type sol_size = 0; + for (const Group& group : groups_) sol_size += group.paths_in.size(); + solution.reserve(sol_size); + for (const Group& group : groups_) + copy(group.paths_in.begin(), group.paths_in.end(), back_inserter(solution)); + return; + } + + temp_lim_ = (miter_limit_ <= 1) ? + 2.0 : + 2.0 / (miter_limit_ * miter_limit_); + + delta_ = delta; + std::vector::iterator git; + for (git = groups_.begin(); git != groups_.end(); ++git) + { + DoGroupOffset(*git); + if (!error_code_) continue; // all OK + solution.clear(); + } +} + +void ClipperOffset::Execute(double delta, Paths64& paths) +{ + paths.clear(); + + ExecuteInternal(delta); + if (!solution.size()) return; + + bool paths_reversed = CheckReverseOrientation(); + //clean up self-intersections ... + Clipper64 c; + c.PreserveCollinear(false); + //the solution should retain the orientation of the input + c.ReverseSolution(reverse_solution_ != paths_reversed); +#ifdef USINGZ + if (zCallback64_) { c.SetZCallback(zCallback64_); } +#endif + c.AddSubject(solution); + if (paths_reversed) + c.Execute(ClipType::Union, FillRule::Negative, paths); + else + c.Execute(ClipType::Union, FillRule::Positive, paths); +} + + +void ClipperOffset::Execute(double delta, PolyTree64& polytree) +{ + polytree.Clear(); + + ExecuteInternal(delta); + if (!solution.size()) return; + + bool paths_reversed = CheckReverseOrientation(); + //clean up self-intersections ... + Clipper64 c; + c.PreserveCollinear(false); + //the solution should retain the orientation of the input + c.ReverseSolution (reverse_solution_ != paths_reversed); +#ifdef USINGZ + if (zCallback64_) { + c.SetZCallback(zCallback64_); + } +#endif + c.AddSubject(solution); + + + if (paths_reversed) + c.Execute(ClipType::Union, FillRule::Negative, polytree); + else + c.Execute(ClipType::Union, FillRule::Positive, polytree); +} + +void ClipperOffset::Execute(DeltaCallback64 delta_cb, Paths64& paths) +{ + deltaCallback64_ = delta_cb; + Execute(1.0, paths); +} + +} // namespace diff --git a/source/Libraries/Clipper2/clipper.offset.h b/source/Libraries/Clipper2/clipper.offset.h new file mode 100644 index 00000000..48a30fa6 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.offset.h @@ -0,0 +1,124 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 19 November 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : Path Offset (Inflate/Shrink) * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_OFFSET_H_ +#define CLIPPER_OFFSET_H_ + +#include "clipper.core.h" +#include "clipper.engine.h" + +namespace Clipper2Lib { + +enum class JoinType { Square, Bevel, Round, Miter }; +//Square : Joins are 'squared' at exactly the offset distance (more complex code) +//Bevel : Similar to Square, but the offset distance varies with angle (simple code & faster) + +enum class EndType {Polygon, Joined, Butt, Square, Round}; +//Butt : offsets both sides of a path, with square blunt ends +//Square : offsets both sides of a path, with square extended ends +//Round : offsets both sides of a path, with round extended ends +//Joined : offsets both sides of a path, with joined ends +//Polygon: offsets only one side of a closed path + +typedef std::function DeltaCallback64; + +class ClipperOffset { +private: + + class Group { + public: + Paths64 paths_in; + std::vector is_hole_list; + std::vector bounds_list; + int lowest_path_idx = -1; + bool is_reversed = false; + JoinType join_type; + EndType end_type; + Group(const Paths64& _paths, JoinType _join_type, EndType _end_type); + }; + + int error_code_ = 0; + double delta_ = 0.0; + double group_delta_ = 0.0; + double temp_lim_ = 0.0; + double steps_per_rad_ = 0.0; + double step_sin_ = 0.0; + double step_cos_ = 0.0; + PathD norms; + Path64 path_out; + Paths64 solution; + std::vector groups_; + JoinType join_type_ = JoinType::Bevel; + EndType end_type_ = EndType::Polygon; + + double miter_limit_ = 0.0; + double arc_tolerance_ = 0.0; + bool preserve_collinear_ = false; + bool reverse_solution_ = false; + +#ifdef USINGZ + ZCallback64 zCallback64_ = nullptr; +#endif + DeltaCallback64 deltaCallback64_ = nullptr; + + size_t CalcSolutionCapacity(); + bool CheckReverseOrientation(); + void DoBevel(const Path64& path, size_t j, size_t k); + void DoSquare(const Path64& path, size_t j, size_t k); + void DoMiter(const Path64& path, size_t j, size_t k, double cos_a); + void DoRound(const Path64& path, size_t j, size_t k, double angle); + void BuildNormals(const Path64& path); + void OffsetPolygon(Group& group, const Path64& path); + void OffsetOpenJoined(Group& group, const Path64& path); + void OffsetOpenPath(Group& group, const Path64& path); + void OffsetPoint(Group& group, const Path64& path, size_t j, size_t k); + void DoGroupOffset(Group &group); + void ExecuteInternal(double delta); +public: + explicit ClipperOffset(double miter_limit = 2.0, + double arc_tolerance = 0.0, + bool preserve_collinear = false, + bool reverse_solution = false) : + miter_limit_(miter_limit), arc_tolerance_(arc_tolerance), + preserve_collinear_(preserve_collinear), + reverse_solution_(reverse_solution) { }; + + ~ClipperOffset() { Clear(); }; + + int ErrorCode() { return error_code_; }; + void AddPath(const Path64& path, JoinType jt_, EndType et_); + void AddPaths(const Paths64& paths, JoinType jt_, EndType et_); + void Clear() { groups_.clear(); norms.clear(); }; + + void Execute(double delta, Paths64& paths); + void Execute(double delta, PolyTree64& polytree); + void Execute(DeltaCallback64 delta_cb, Paths64& paths); + + double MiterLimit() const { return miter_limit_; } + void MiterLimit(double miter_limit) { miter_limit_ = miter_limit; } + + //ArcTolerance: needed for rounded offsets (See offset_triginometry2.svg) + double ArcTolerance() const { return arc_tolerance_; } + void ArcTolerance(double arc_tolerance) { arc_tolerance_ = arc_tolerance; } + + bool PreserveCollinear() const { return preserve_collinear_; } + void PreserveCollinear(bool preserve_collinear){preserve_collinear_ = preserve_collinear;} + + bool ReverseSolution() const { return reverse_solution_; } + void ReverseSolution(bool reverse_solution) {reverse_solution_ = reverse_solution;} + +#ifdef USINGZ + void SetZCallback(ZCallback64 cb) { zCallback64_ = cb; } +#endif + void SetDeltaCallback(DeltaCallback64 cb) { deltaCallback64_ = cb; } + +}; + +} +#endif /* CLIPPER_OFFSET_H_ */ diff --git a/source/Libraries/Clipper2/clipper.rectclip.cpp b/source/Libraries/Clipper2/clipper.rectclip.cpp new file mode 100644 index 00000000..92f36f0e --- /dev/null +++ b/source/Libraries/Clipper2/clipper.rectclip.cpp @@ -0,0 +1,1005 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 8 September 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : FAST rectangular clipping * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#include +#include "clipper.h" +#include "clipper.rectclip.h" + +namespace Clipper2Lib { + + //------------------------------------------------------------------------------ + // Miscellaneous methods + //------------------------------------------------------------------------------ + + inline bool Path1ContainsPath2(const Path64& path1, const Path64& path2) + { + int io_count = 0; + // precondition: no (significant) overlap + for (const Point64& pt : path2) + { + PointInPolygonResult pip = PointInPolygon(pt, path1); + switch (pip) + { + case PointInPolygonResult::IsOutside: ++io_count; break; + case PointInPolygonResult::IsInside: --io_count; break; + default: continue; + } + if (std::abs(io_count) > 1) break; + } + return io_count <= 0; + } + + inline bool GetLocation(const Rect64& rec, + const Point64& pt, Location& loc) + { + if (pt.x == rec.left && pt.y >= rec.top && pt.y <= rec.bottom) + { + loc = Location::Left; + return false; + } + else if (pt.x == rec.right && pt.y >= rec.top && pt.y <= rec.bottom) + { + loc = Location::Right; + return false; + } + else if (pt.y == rec.top && pt.x >= rec.left && pt.x <= rec.right) + { + loc = Location::Top; + return false; + } + else if (pt.y == rec.bottom && pt.x >= rec.left && pt.x <= rec.right) + { + loc = Location::Bottom; + return false; + } + else if (pt.x < rec.left) loc = Location::Left; + else if (pt.x > rec.right) loc = Location::Right; + else if (pt.y < rec.top) loc = Location::Top; + else if (pt.y > rec.bottom) loc = Location::Bottom; + else loc = Location::Inside; + return true; + } + + inline bool IsHorizontal(const Point64& pt1, const Point64& pt2) + { + return pt1.y == pt2.y; + } + + bool GetSegmentIntersection(const Point64& p1, + const Point64& p2, const Point64& p3, const Point64& p4, Point64& ip) + { + double res1 = CrossProduct(p1, p3, p4); + double res2 = CrossProduct(p2, p3, p4); + if (res1 == 0) + { + ip = p1; + if (res2 == 0) return false; // segments are collinear + else if (p1 == p3 || p1 == p4) return true; + //else if (p2 == p3 || p2 == p4) { ip = p2; return true; } + else if (IsHorizontal(p3, p4)) return ((p1.x > p3.x) == (p1.x < p4.x)); + else return ((p1.y > p3.y) == (p1.y < p4.y)); + } + else if (res2 == 0) + { + ip = p2; + if (p2 == p3 || p2 == p4) return true; + else if (IsHorizontal(p3, p4)) return ((p2.x > p3.x) == (p2.x < p4.x)); + else return ((p2.y > p3.y) == (p2.y < p4.y)); + } + if ((res1 > 0) == (res2 > 0)) return false; + + double res3 = CrossProduct(p3, p1, p2); + double res4 = CrossProduct(p4, p1, p2); + if (res3 == 0) + { + ip = p3; + if (p3 == p1 || p3 == p2) return true; + else if (IsHorizontal(p1, p2)) return ((p3.x > p1.x) == (p3.x < p2.x)); + else return ((p3.y > p1.y) == (p3.y < p2.y)); + } + else if (res4 == 0) + { + ip = p4; + if (p4 == p1 || p4 == p2) return true; + else if (IsHorizontal(p1, p2)) return ((p4.x > p1.x) == (p4.x < p2.x)); + else return ((p4.y > p1.y) == (p4.y < p2.y)); + } + if ((res3 > 0) == (res4 > 0)) return false; + + // segments must intersect to get here + return GetIntersectPoint(p1, p2, p3, p4, ip); + } + + inline bool GetIntersection(const Path64& rectPath, + const Point64& p, const Point64& p2, Location& loc, Point64& ip) + { + // gets the intersection closest to 'p' + // when Result = false, loc will remain unchanged + switch (loc) + { + case Location::Left: + if (GetSegmentIntersection(p, p2, rectPath[0], rectPath[3], ip)) return true; + else if ((p.y < rectPath[0].y) && GetSegmentIntersection(p, p2, rectPath[0], rectPath[1], ip)) + { + loc = Location::Top; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[2], rectPath[3], ip)) + { + loc = Location::Bottom; + return true; + } + else return false; + + case Location::Top: + if (GetSegmentIntersection(p, p2, rectPath[0], rectPath[1], ip)) return true; + else if ((p.x < rectPath[0].x) && GetSegmentIntersection(p, p2, rectPath[0], rectPath[3], ip)) + { + loc = Location::Left; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[1], rectPath[2], ip)) + { + loc = Location::Right; + return true; + } + else return false; + + case Location::Right: + if (GetSegmentIntersection(p, p2, rectPath[1], rectPath[2], ip)) return true; + else if ((p.y < rectPath[1].y) && GetSegmentIntersection(p, p2, rectPath[0], rectPath[1], ip)) + { + loc = Location::Top; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[2], rectPath[3], ip)) + { + loc = Location::Bottom; + return true; + } + else return false; + + case Location::Bottom: + if (GetSegmentIntersection(p, p2, rectPath[2], rectPath[3], ip)) return true; + else if ((p.x < rectPath[3].x) && GetSegmentIntersection(p, p2, rectPath[0], rectPath[3], ip)) + { + loc = Location::Left; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[1], rectPath[2], ip)) + { + loc = Location::Right; + return true; + } + else return false; + + default: // loc == rInside + if (GetSegmentIntersection(p, p2, rectPath[0], rectPath[3], ip)) + { + loc = Location::Left; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[0], rectPath[1], ip)) + { + loc = Location::Top; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[1], rectPath[2], ip)) + { + loc = Location::Right; + return true; + } + else if (GetSegmentIntersection(p, p2, rectPath[2], rectPath[3], ip)) + { + loc = Location::Bottom; + return true; + } + else return false; + } + } + + inline Location GetAdjacentLocation(Location loc, bool isClockwise) + { + int delta = (isClockwise) ? 1 : 3; + return static_cast((static_cast(loc) + delta) % 4); + } + + inline bool HeadingClockwise(Location prev, Location curr) + { + return (static_cast(prev) + 1) % 4 == static_cast(curr); + } + + inline bool AreOpposites(Location prev, Location curr) + { + return abs(static_cast(prev) - static_cast(curr)) == 2; + } + + inline bool IsClockwise(Location prev, Location curr, + const Point64& prev_pt, const Point64& curr_pt, const Point64& rect_mp) + { + if (AreOpposites(prev, curr)) + return CrossProduct(prev_pt, rect_mp, curr_pt) < 0; + else + return HeadingClockwise(prev, curr); + } + + inline OutPt2* UnlinkOp(OutPt2* op) + { + if (op->next == op) return nullptr; + op->prev->next = op->next; + op->next->prev = op->prev; + return op->next; + } + + inline OutPt2* UnlinkOpBack(OutPt2* op) + { + if (op->next == op) return nullptr; + op->prev->next = op->next; + op->next->prev = op->prev; + return op->prev; + } + + inline uint32_t GetEdgesForPt(const Point64& pt, const Rect64& rec) + { + uint32_t result = 0; + if (pt.x == rec.left) result = 1; + else if (pt.x == rec.right) result = 4; + if (pt.y == rec.top) result += 2; + else if (pt.y == rec.bottom) result += 8; + return result; + } + + inline bool IsHeadingClockwise(const Point64& pt1, const Point64& pt2, int edgeIdx) + { + switch (edgeIdx) + { + case 0: return pt2.y < pt1.y; + case 1: return pt2.x > pt1.x; + case 2: return pt2.y > pt1.y; + default: return pt2.x < pt1.x; + } + } + + inline bool HasHorzOverlap(const Point64& left1, const Point64& right1, + const Point64& left2, const Point64& right2) + { + return (left1.x < right2.x) && (right1.x > left2.x); + } + + inline bool HasVertOverlap(const Point64& top1, const Point64& bottom1, + const Point64& top2, const Point64& bottom2) + { + return (top1.y < bottom2.y) && (bottom1.y > top2.y); + } + + inline void AddToEdge(OutPt2List& edge, OutPt2* op) + { + if (op->edge) return; + op->edge = &edge; + edge.push_back(op); + } + + inline void UncoupleEdge(OutPt2* op) + { + if (!op->edge) return; + for (size_t i = 0; i < op->edge->size(); ++i) + { + OutPt2* op2 = (*op->edge)[i]; + if (op2 == op) + { + (*op->edge)[i] = nullptr; + break; + } + } + op->edge = nullptr; + } + + inline void SetNewOwner(OutPt2* op, size_t new_idx) + { + op->owner_idx = new_idx; + OutPt2* op2 = op->next; + while (op2 != op) + { + op2->owner_idx = new_idx; + op2 = op2->next; + } + } + + //---------------------------------------------------------------------------- + // RectClip64 + //---------------------------------------------------------------------------- + + OutPt2* RectClip64::Add(Point64 pt, bool start_new) + { + // this method is only called by InternalExecute. + // Later splitting & rejoining won't create additional op's, + // though they will change the (non-storage) results_ count. + int curr_idx = static_cast(results_.size()) - 1; + OutPt2* result; + if (curr_idx < 0 || start_new) + { + result = &op_container_.emplace_back(OutPt2()); + result->pt = pt; + result->next = result; + result->prev = result; + results_.push_back(result); + } + else + { + OutPt2* prevOp = results_[curr_idx]; + if (prevOp->pt == pt) return prevOp; + result = &op_container_.emplace_back(OutPt2()); + result->owner_idx = curr_idx; + result->pt = pt; + result->next = prevOp->next; + prevOp->next->prev = result; + prevOp->next = result; + result->prev = prevOp; + results_[curr_idx] = result; + } + return result; + } + + void RectClip64::AddCorner(Location prev, Location curr) + { + if (HeadingClockwise(prev, curr)) + Add(rect_as_path_[static_cast(prev)]); + else + Add(rect_as_path_[static_cast(curr)]); + } + + void RectClip64::AddCorner(Location& loc, bool isClockwise) + { + if (isClockwise) + { + Add(rect_as_path_[static_cast(loc)]); + loc = GetAdjacentLocation(loc, true); + } + else + { + loc = GetAdjacentLocation(loc, false); + Add(rect_as_path_[static_cast(loc)]); + } + } + + void RectClip64::GetNextLocation(const Path64& path, + Location& loc, int& i, int highI) + { + switch (loc) + { + case Location::Left: + while (i <= highI && path[i].x <= rect_.left) ++i; + if (i > highI) break; + else if (path[i].x >= rect_.right) loc = Location::Right; + else if (path[i].y <= rect_.top) loc = Location::Top; + else if (path[i].y >= rect_.bottom) loc = Location::Bottom; + else loc = Location::Inside; + break; + + case Location::Top: + while (i <= highI && path[i].y <= rect_.top) ++i; + if (i > highI) break; + else if (path[i].y >= rect_.bottom) loc = Location::Bottom; + else if (path[i].x <= rect_.left) loc = Location::Left; + else if (path[i].x >= rect_.right) loc = Location::Right; + else loc = Location::Inside; + break; + + case Location::Right: + while (i <= highI && path[i].x >= rect_.right) ++i; + if (i > highI) break; + else if (path[i].x <= rect_.left) loc = Location::Left; + else if (path[i].y <= rect_.top) loc = Location::Top; + else if (path[i].y >= rect_.bottom) loc = Location::Bottom; + else loc = Location::Inside; + break; + + case Location::Bottom: + while (i <= highI && path[i].y >= rect_.bottom) ++i; + if (i > highI) break; + else if (path[i].y <= rect_.top) loc = Location::Top; + else if (path[i].x <= rect_.left) loc = Location::Left; + else if (path[i].x >= rect_.right) loc = Location::Right; + else loc = Location::Inside; + break; + + case Location::Inside: + while (i <= highI) + { + if (path[i].x < rect_.left) loc = Location::Left; + else if (path[i].x > rect_.right) loc = Location::Right; + else if (path[i].y > rect_.bottom) loc = Location::Bottom; + else if (path[i].y < rect_.top) loc = Location::Top; + else { Add(path[i]); ++i; continue; } + break; //inner loop + } + break; + } //switch + } + + void RectClip64::ExecuteInternal(const Path64& path) + { + int i = 0, highI = static_cast(path.size()) - 1; + Location prev = Location::Inside, loc; + Location crossing_loc = Location::Inside; + Location first_cross_ = Location::Inside; + if (!GetLocation(rect_, path[highI], loc)) + { + i = highI - 1; + while (i >= 0 && !GetLocation(rect_, path[i], prev)) --i; + if (i < 0) + { + // all of path must be inside fRect + for (const auto& pt : path) Add(pt); + return; + } + if (prev == Location::Inside) loc = Location::Inside; + i = 0; + } + Location startingLoc = loc; + + /////////////////////////////////////////////////// + while (i <= highI) + { + prev = loc; + Location crossing_prev = crossing_loc; + + GetNextLocation(path, loc, i, highI); + + if (i > highI) break; + Point64 ip, ip2; + Point64 prev_pt = (i) ? + path[static_cast(i - 1)] : + path[highI]; + + crossing_loc = loc; + if (!GetIntersection(rect_as_path_, + path[i], prev_pt, crossing_loc, ip)) + { + // ie remaining outside + if (crossing_prev == Location::Inside) + { + bool isClockw = IsClockwise(prev, loc, prev_pt, path[i], rect_mp_); + do { + start_locs_.push_back(prev); + prev = GetAdjacentLocation(prev, isClockw); + } while (prev != loc); + crossing_loc = crossing_prev; // still not crossed + } + else if (prev != Location::Inside && prev != loc) + { + bool isClockw = IsClockwise(prev, loc, prev_pt, path[i], rect_mp_); + do { + AddCorner(prev, isClockw); + } while (prev != loc); + } + ++i; + continue; + } + + //////////////////////////////////////////////////// + // we must be crossing the rect boundary to get here + //////////////////////////////////////////////////// + + if (loc == Location::Inside) // path must be entering rect + { + if (first_cross_ == Location::Inside) + { + first_cross_ = crossing_loc; + start_locs_.push_back(prev); + } + else if (prev != crossing_loc) + { + bool isClockw = IsClockwise(prev, crossing_loc, prev_pt, path[i], rect_mp_); + do { + AddCorner(prev, isClockw); + } while (prev != crossing_loc); + } + } + else if (prev != Location::Inside) + { + // passing right through rect. 'ip' here will be the second + // intersect pt but we'll also need the first intersect pt (ip2) + loc = prev; + GetIntersection(rect_as_path_, prev_pt, path[i], loc, ip2); + if (crossing_prev != Location::Inside && crossing_prev != loc) //579 + AddCorner(crossing_prev, loc); + + if (first_cross_ == Location::Inside) + { + first_cross_ = loc; + start_locs_.push_back(prev); + } + + loc = crossing_loc; + Add(ip2); + if (ip == ip2) + { + // it's very likely that path[i] is on rect + GetLocation(rect_, path[i], loc); + AddCorner(crossing_loc, loc); + crossing_loc = loc; + continue; + } + } + else // path must be exiting rect + { + loc = crossing_loc; + if (first_cross_ == Location::Inside) + first_cross_ = crossing_loc; + } + + Add(ip); + + } //while i <= highI + /////////////////////////////////////////////////// + + if (first_cross_ == Location::Inside) + { + // path never intersects + if (startingLoc != Location::Inside) + { + // path is outside rect + // but being outside, it still may not contain rect + if (path_bounds_.Contains(rect_) && + Path1ContainsPath2(path, rect_as_path_)) + { + // yep, the path does fully contain rect + // so add rect to the solution + for (size_t j = 0; j < 4; ++j) + { + Add(rect_as_path_[j]); + // we may well need to do some splitting later, so + AddToEdge(edges_[j * 2], results_[0]); + } + } + } + } + else if (loc != Location::Inside && + (loc != first_cross_ || start_locs_.size() > 2)) + { + if (start_locs_.size() > 0) + { + prev = loc; + for (auto loc2 : start_locs_) + { + if (prev == loc2) continue; + AddCorner(prev, HeadingClockwise(prev, loc2)); + prev = loc2; + } + loc = prev; + } + if (loc != first_cross_) + AddCorner(loc, HeadingClockwise(loc, first_cross_)); + } + } + + void RectClip64::CheckEdges() + { + for (size_t i = 0; i < results_.size(); ++i) + { + OutPt2* op = results_[i]; + if (!op) continue; + OutPt2* op2 = op; + do + { + if (!CrossProduct(op2->prev->pt, + op2->pt, op2->next->pt)) + { + if (op2 == op) + { + op2 = UnlinkOpBack(op2); + if (!op2) break; + op = op2->prev; + } + else + { + op2 = UnlinkOpBack(op2); + if (!op2) break; + } + } + else + op2 = op2->next; + } while (op2 != op); + + if (!op2) + { + results_[i] = nullptr; + continue; + } + results_[i] = op; // safety first + + uint32_t edgeSet1 = GetEdgesForPt(op->prev->pt, rect_); + op2 = op; + do + { + uint32_t edgeSet2 = GetEdgesForPt(op2->pt, rect_); + if (edgeSet2 && !op2->edge) + { + uint32_t combinedSet = (edgeSet1 & edgeSet2); + for (int j = 0; j < 4; ++j) + { + if (combinedSet & (1 << j)) + { + if (IsHeadingClockwise(op2->prev->pt, op2->pt, j)) + AddToEdge(edges_[j * 2], op2); + else + AddToEdge(edges_[j * 2 + 1], op2); + } + } + } + edgeSet1 = edgeSet2; + op2 = op2->next; + } while (op2 != op); + } + } + + void RectClip64::TidyEdges(int idx, OutPt2List& cw, OutPt2List& ccw) + { + if (ccw.empty()) return; + bool isHorz = ((idx == 1) || (idx == 3)); + bool cwIsTowardLarger = ((idx == 1) || (idx == 2)); + size_t i = 0, j = 0; + OutPt2* p1, * p2, * p1a, * p2a, * op, * op2; + + while (i < cw.size()) + { + p1 = cw[i]; + if (!p1 || p1->next == p1->prev) + { + cw[i++] = nullptr; + j = 0; + continue; + } + + size_t jLim = ccw.size(); + while (j < jLim && + (!ccw[j] || ccw[j]->next == ccw[j]->prev)) ++j; + + if (j == jLim) + { + ++i; + j = 0; + continue; + } + + if (cwIsTowardLarger) + { + // p1 >>>> p1a; + // p2 <<<< p2a; + p1 = cw[i]->prev; + p1a = cw[i]; + p2 = ccw[j]; + p2a = ccw[j]->prev; + } + else + { + // p1 <<<< p1a; + // p2 >>>> p2a; + p1 = cw[i]; + p1a = cw[i]->prev; + p2 = ccw[j]->prev; + p2a = ccw[j]; + } + + if ((isHorz && !HasHorzOverlap(p1->pt, p1a->pt, p2->pt, p2a->pt)) || + (!isHorz && !HasVertOverlap(p1->pt, p1a->pt, p2->pt, p2a->pt))) + { + ++j; + continue; + } + + // to get here we're either splitting or rejoining + bool isRejoining = cw[i]->owner_idx != ccw[j]->owner_idx; + + if (isRejoining) + { + results_[p2->owner_idx] = nullptr; + SetNewOwner(p2, p1->owner_idx); + } + + // do the split or re-join + if (cwIsTowardLarger) + { + // p1 >> | >> p1a; + // p2 << | << p2a; + p1->next = p2; + p2->prev = p1; + p1a->prev = p2a; + p2a->next = p1a; + } + else + { + // p1 << | << p1a; + // p2 >> | >> p2a; + p1->prev = p2; + p2->next = p1; + p1a->next = p2a; + p2a->prev = p1a; + } + + if (!isRejoining) + { + size_t new_idx = results_.size(); + results_.push_back(p1a); + SetNewOwner(p1a, new_idx); + } + + if (cwIsTowardLarger) + { + op = p2; + op2 = p1a; + } + else + { + op = p1; + op2 = p2a; + } + results_[op->owner_idx] = op; + results_[op2->owner_idx] = op2; + + // and now lots of work to get ready for the next loop + + bool opIsLarger, op2IsLarger; + if (isHorz) // X + { + opIsLarger = op->pt.x > op->prev->pt.x; + op2IsLarger = op2->pt.x > op2->prev->pt.x; + } + else // Y + { + opIsLarger = op->pt.y > op->prev->pt.y; + op2IsLarger = op2->pt.y > op2->prev->pt.y; + } + + if ((op->next == op->prev) || + (op->pt == op->prev->pt)) + { + if (op2IsLarger == cwIsTowardLarger) + { + cw[i] = op2; + ccw[j++] = nullptr; + } + else + { + ccw[j] = op2; + cw[i++] = nullptr; + } + } + else if ((op2->next == op2->prev) || + (op2->pt == op2->prev->pt)) + { + if (opIsLarger == cwIsTowardLarger) + { + cw[i] = op; + ccw[j++] = nullptr; + } + else + { + ccw[j] = op; + cw[i++] = nullptr; + } + } + else if (opIsLarger == op2IsLarger) + { + if (opIsLarger == cwIsTowardLarger) + { + cw[i] = op; + UncoupleEdge(op2); + AddToEdge(cw, op2); + ccw[j++] = nullptr; + } + else + { + cw[i++] = nullptr; + ccw[j] = op2; + UncoupleEdge(op); + AddToEdge(ccw, op); + j = 0; + } + } + else + { + if (opIsLarger == cwIsTowardLarger) + cw[i] = op; + else + ccw[j] = op; + if (op2IsLarger == cwIsTowardLarger) + cw[i] = op2; + else + ccw[j] = op2; + } + } + } + + Path64 RectClip64::GetPath(OutPt2*& op) + { + if (!op || op->next == op->prev) return Path64(); + + OutPt2* op2 = op->next; + while (op2 && op2 != op) + { + if (CrossProduct(op2->prev->pt, + op2->pt, op2->next->pt) == 0) + { + op = op2->prev; + op2 = UnlinkOp(op2); + } + else + op2 = op2->next; + } + op = op2; // needed for op cleanup + if (!op2) return Path64(); + + Path64 result; + result.push_back(op->pt); + op2 = op->next; + while (op2 != op) + { + result.push_back(op2->pt); + op2 = op2->next; + } + return result; + } + + Paths64 RectClip64::Execute(const Paths64& paths) + { + Paths64 result; + if (rect_.IsEmpty()) return result; + + for (const Path64& path : paths) + { + if (path.size() < 3) continue; + path_bounds_ = GetBounds(path); + if (!rect_.Intersects(path_bounds_)) + continue; // the path must be completely outside rect_ + else if (rect_.Contains(path_bounds_)) + { + // the path must be completely inside rect_ + result.push_back(path); + continue; + } + + ExecuteInternal(path); + CheckEdges(); + for (int i = 0; i < 4; ++i) + TidyEdges(i, edges_[i * 2], edges_[i * 2 + 1]); + + for (OutPt2*& op : results_) + { + Path64 tmp = GetPath(op); + if (!tmp.empty()) + result.emplace_back(tmp); + } + + //clean up after every loop + op_container_ = std::deque(); + results_.clear(); + for (OutPt2List &edge : edges_) edge.clear(); + start_locs_.clear(); + } + return result; + } + + //------------------------------------------------------------------------------ + // RectClipLines64 + //------------------------------------------------------------------------------ + + Paths64 RectClipLines64::Execute(const Paths64& paths) + { + Paths64 result; + if (rect_.IsEmpty()) return result; + + for (const auto& path : paths) + { + Rect64 pathrec = GetBounds(path); + if (!rect_.Intersects(pathrec)) continue; + + ExecuteInternal(path); + + for (OutPt2*& op : results_) + { + Path64 tmp = GetPath(op); + if (!tmp.empty()) + result.emplace_back(tmp); + } + results_.clear(); + + op_container_ = std::deque(); + start_locs_.clear(); + } + return result; + } + + void RectClipLines64::ExecuteInternal(const Path64& path) + { + if (rect_.IsEmpty() || path.size() < 2) return; + + results_.clear(); + op_container_ = std::deque(); + start_locs_.clear(); + + int i = 1, highI = static_cast(path.size()) - 1; + + Location prev = Location::Inside, loc; + Location crossing_loc; + if (!GetLocation(rect_, path[0], loc)) + { + while (i <= highI && !GetLocation(rect_, path[i], prev)) ++i; + if (i > highI) + { + // all of path must be inside fRect + for (const auto& pt : path) Add(pt); + return; + } + if (prev == Location::Inside) loc = Location::Inside; + i = 1; + } + if (loc == Location::Inside) Add(path[0]); + + /////////////////////////////////////////////////// + while (i <= highI) + { + prev = loc; + GetNextLocation(path, loc, i, highI); + if (i > highI) break; + Point64 ip, ip2; + Point64 prev_pt = path[static_cast(i - 1)]; + + crossing_loc = loc; + if (!GetIntersection(rect_as_path_, + path[i], prev_pt, crossing_loc, ip)) + { + // ie remaining outside + ++i; + continue; + } + + //////////////////////////////////////////////////// + // we must be crossing the rect boundary to get here + //////////////////////////////////////////////////// + + if (loc == Location::Inside) // path must be entering rect + { + Add(ip, true); + } + else if (prev != Location::Inside) + { + // passing right through rect. 'ip' here will be the second + // intersect pt but we'll also need the first intersect pt (ip2) + crossing_loc = prev; + GetIntersection(rect_as_path_, + prev_pt, path[i], crossing_loc, ip2); + Add(ip2, true); + Add(ip); + } + else // path must be exiting rect + { + Add(ip); + } + } //while i <= highI + /////////////////////////////////////////////////// + } + + Path64 RectClipLines64::GetPath(OutPt2*& op) + { + Path64 result; + if (!op || op == op->next) return result; + op = op->next; // starting at path beginning + result.push_back(op->pt); + OutPt2 *op2 = op->next; + while (op2 != op) + { + result.push_back(op2->pt); + op2 = op2->next; + } + return result; + } + +} // namespace diff --git a/source/Libraries/Clipper2/clipper.rectclip.h b/source/Libraries/Clipper2/clipper.rectclip.h new file mode 100644 index 00000000..e8b0a3f1 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.rectclip.h @@ -0,0 +1,81 @@ +/******************************************************************************* +* Author : Angus Johnson * +* Date : 1 November 2023 * +* Website : http://www.angusj.com * +* Copyright : Angus Johnson 2010-2023 * +* Purpose : FAST rectangular clipping * +* License : http://www.boost.org/LICENSE_1_0.txt * +*******************************************************************************/ + +#ifndef CLIPPER_RECTCLIP_H +#define CLIPPER_RECTCLIP_H + +#include +#include +#include +#include "clipper.core.h" + +namespace Clipper2Lib +{ + + enum class Location { Left, Top, Right, Bottom, Inside }; + + class OutPt2; + typedef std::vector OutPt2List; + + class OutPt2 { + public: + Point64 pt; + size_t owner_idx; + OutPt2List* edge; + OutPt2* next; + OutPt2* prev; + }; + + //------------------------------------------------------------------------------ + // RectClip64 + //------------------------------------------------------------------------------ + + class RectClip64 { + private: + void ExecuteInternal(const Path64& path); + Path64 GetPath(OutPt2*& op); + protected: + const Rect64 rect_; + const Path64 rect_as_path_; + const Point64 rect_mp_; + Rect64 path_bounds_; + std::deque op_container_; + OutPt2List results_; // each path can be broken into multiples + OutPt2List edges_[8]; // clockwise and counter-clockwise + std::vector start_locs_; + void CheckEdges(); + void TidyEdges(int idx, OutPt2List& cw, OutPt2List& ccw); + void GetNextLocation(const Path64& path, + Location& loc, int& i, int highI); + OutPt2* Add(Point64 pt, bool start_new = false); + void AddCorner(Location prev, Location curr); + void AddCorner(Location& loc, bool isClockwise); + public: + explicit RectClip64(const Rect64& rect) : + rect_(rect), + rect_as_path_(rect.AsPath()), + rect_mp_(rect.MidPoint()) {} + Paths64 Execute(const Paths64& paths); + }; + + //------------------------------------------------------------------------------ + // RectClipLines64 + //------------------------------------------------------------------------------ + + class RectClipLines64 : public RectClip64 { + private: + void ExecuteInternal(const Path64& path); + Path64 GetPath(OutPt2*& op); + public: + explicit RectClipLines64(const Rect64& rect) : RectClip64(rect) {}; + Paths64 Execute(const Paths64& paths); + }; + +} // Clipper2Lib namespace +#endif // CLIPPER_RECTCLIP_H diff --git a/source/Libraries/Clipper2/clipper.version.h b/source/Libraries/Clipper2/clipper.version.h new file mode 100644 index 00000000..d7644067 --- /dev/null +++ b/source/Libraries/Clipper2/clipper.version.h @@ -0,0 +1,6 @@ +#ifndef CLIPPER_VERSION_H +#define CLIPPER_VERSION_H + +constexpr auto CLIPPER2_VERSION = "1.3.0"; + +#endif // CLIPPER_VERSION_H diff --git a/source/Libraries/poly2tri/common/dll_symbol.h b/source/Libraries/poly2tri/common/dll_symbol.h new file mode 100644 index 00000000..998764c0 --- /dev/null +++ b/source/Libraries/poly2tri/common/dll_symbol.h @@ -0,0 +1,53 @@ +/* + * Poly2Tri Copyright (c) 2009-2022, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#if 0 +# define P2T_COMPILER_DLLEXPORT __declspec(dllexport) +# define P2T_COMPILER_DLLIMPORT __declspec(dllimport) +#elif defined(__GNUC__) +# define P2T_COMPILER_DLLEXPORT __attribute__ ((visibility ("default"))) +# define P2T_COMPILER_DLLIMPORT __attribute__ ((visibility ("default"))) +#else +# define P2T_COMPILER_DLLEXPORT +# define P2T_COMPILER_DLLIMPORT +#endif + +#ifndef P2T_DLL_SYMBOL +# if defined(P2T_STATIC_EXPORTS) +# define P2T_DLL_SYMBOL +# elif defined(P2T_SHARED_EXPORTS) +# define P2T_DLL_SYMBOL P2T_COMPILER_DLLEXPORT +# else +# define P2T_DLL_SYMBOL P2T_COMPILER_DLLIMPORT +# endif +#endif diff --git a/source/Libraries/poly2tri/common/shapes.cpp b/source/Libraries/poly2tri/common/shapes.cpp new file mode 100644 index 00000000..359ef758 --- /dev/null +++ b/source/Libraries/poly2tri/common/shapes.cpp @@ -0,0 +1,411 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "shapes.h" + +#include +#include + +namespace p2t { + +Point::Point(double x, double y) : x(x), y(y) +{ +} + +std::ostream& operator<<(std::ostream& out, const Point& point) { + return out << point.x << "," << point.y; +} + +Triangle::Triangle(Point& a, Point& b, Point& c) +{ + points_[0] = &a; points_[1] = &b; points_[2] = &c; + neighbors_[0] = nullptr; neighbors_[1] = nullptr; neighbors_[2] = nullptr; + constrained_edge[0] = constrained_edge[1] = constrained_edge[2] = false; + delaunay_edge[0] = delaunay_edge[1] = delaunay_edge[2] = false; + interior_ = false; +} + +// Update neighbor pointers +void Triangle::MarkNeighbor(Point* p1, Point* p2, Triangle* t) +{ + if ((p1 == points_[2] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[2])) + neighbors_[0] = t; + else if ((p1 == points_[0] && p2 == points_[2]) || (p1 == points_[2] && p2 == points_[0])) + neighbors_[1] = t; + else if ((p1 == points_[0] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[0])) + neighbors_[2] = t; + else + assert(0); +} + +// Exhaustive search to update neighbor pointers +void Triangle::MarkNeighbor(Triangle& t) +{ + if (t.Contains(points_[1], points_[2])) { + neighbors_[0] = &t; + t.MarkNeighbor(points_[1], points_[2], this); + } else if (t.Contains(points_[0], points_[2])) { + neighbors_[1] = &t; + t.MarkNeighbor(points_[0], points_[2], this); + } else if (t.Contains(points_[0], points_[1])) { + neighbors_[2] = &t; + t.MarkNeighbor(points_[0], points_[1], this); + } +} + +/** + * Clears all references to all other triangles and points + */ +void Triangle::Clear() +{ + Triangle *t; + for (auto& neighbor : neighbors_) { + t = neighbor; + if (t != nullptr) { + t->ClearNeighbor(this); + } + } + ClearNeighbors(); + points_[0]=points_[1]=points_[2] = nullptr; +} + +void Triangle::ClearNeighbor(const Triangle *triangle ) +{ + if( neighbors_[0] == triangle ) + { + neighbors_[0] = nullptr; + } + else if( neighbors_[1] == triangle ) + { + neighbors_[1] = nullptr; + } + else + { + neighbors_[2] = nullptr; + } +} + +void Triangle::ClearNeighbors() +{ + neighbors_[0] = nullptr; + neighbors_[1] = nullptr; + neighbors_[2] = nullptr; +} + +void Triangle::ClearDelunayEdges() +{ + delaunay_edge[0] = delaunay_edge[1] = delaunay_edge[2] = false; +} + +Point* Triangle::OppositePoint(Triangle& t, const Point& p) +{ + Point *cw = t.PointCW(p); + return PointCW(*cw); +} + +// Legalized triangle by rotating clockwise around point(0) +void Triangle::Legalize(Point& point) +{ + points_[1] = points_[0]; + points_[0] = points_[2]; + points_[2] = &point; +} + +// Legalize triagnle by rotating clockwise around oPoint +void Triangle::Legalize(Point& opoint, Point& npoint) +{ + if (&opoint == points_[0]) { + points_[1] = points_[0]; + points_[0] = points_[2]; + points_[2] = &npoint; + } else if (&opoint == points_[1]) { + points_[2] = points_[1]; + points_[1] = points_[0]; + points_[0] = &npoint; + } else if (&opoint == points_[2]) { + points_[0] = points_[2]; + points_[2] = points_[1]; + points_[1] = &npoint; + } else { + assert(0); + } +} + +int Triangle::Index(const Point* p) +{ + if (p == points_[0]) { + return 0; + } else if (p == points_[1]) { + return 1; + } else if (p == points_[2]) { + return 2; + } + assert(0); + return -1; +} + +int Triangle::EdgeIndex(const Point* p1, const Point* p2) +{ + if (points_[0] == p1) { + if (points_[1] == p2) { + return 2; + } else if (points_[2] == p2) { + return 1; + } + } else if (points_[1] == p1) { + if (points_[2] == p2) { + return 0; + } else if (points_[0] == p2) { + return 2; + } + } else if (points_[2] == p1) { + if (points_[0] == p2) { + return 1; + } else if (points_[1] == p2) { + return 0; + } + } + return -1; +} + +void Triangle::MarkConstrainedEdge(int index) +{ + constrained_edge[index] = true; +} + +void Triangle::MarkConstrainedEdge(Edge& edge) +{ + MarkConstrainedEdge(edge.p, edge.q); +} + +// Mark edge as constrained +void Triangle::MarkConstrainedEdge(Point* p, Point* q) +{ + if ((q == points_[0] && p == points_[1]) || (q == points_[1] && p == points_[0])) { + constrained_edge[2] = true; + } else if ((q == points_[0] && p == points_[2]) || (q == points_[2] && p == points_[0])) { + constrained_edge[1] = true; + } else if ((q == points_[1] && p == points_[2]) || (q == points_[2] && p == points_[1])) { + constrained_edge[0] = true; + } +} + +// The point counter-clockwise to given point +Point* Triangle::PointCW(const Point& point) +{ + if (&point == points_[0]) { + return points_[2]; + } else if (&point == points_[1]) { + return points_[0]; + } else if (&point == points_[2]) { + return points_[1]; + } + assert(0); + return nullptr; +} + +// The point counter-clockwise to given point +Point* Triangle::PointCCW(const Point& point) +{ + if (&point == points_[0]) { + return points_[1]; + } else if (&point == points_[1]) { + return points_[2]; + } else if (&point == points_[2]) { + return points_[0]; + } + assert(0); + return nullptr; +} + +// The neighbor across to given point +Triangle* Triangle::NeighborAcross(const Point& point) +{ + if (&point == points_[0]) { + return neighbors_[0]; + } else if (&point == points_[1]) { + return neighbors_[1]; + } + return neighbors_[2]; +} + +// The neighbor clockwise to given point +Triangle* Triangle::NeighborCW(const Point& point) +{ + if (&point == points_[0]) { + return neighbors_[1]; + } else if (&point == points_[1]) { + return neighbors_[2]; + } + return neighbors_[0]; +} + +// The neighbor counter-clockwise to given point +Triangle* Triangle::NeighborCCW(const Point& point) +{ + if (&point == points_[0]) { + return neighbors_[2]; + } else if (&point == points_[1]) { + return neighbors_[0]; + } + return neighbors_[1]; +} + +bool Triangle::GetConstrainedEdgeCCW(const Point& p) +{ + if (&p == points_[0]) { + return constrained_edge[2]; + } else if (&p == points_[1]) { + return constrained_edge[0]; + } + return constrained_edge[1]; +} + +bool Triangle::GetConstrainedEdgeCW(const Point& p) +{ + if (&p == points_[0]) { + return constrained_edge[1]; + } else if (&p == points_[1]) { + return constrained_edge[2]; + } + return constrained_edge[0]; +} + +void Triangle::SetConstrainedEdgeCCW(const Point& p, bool ce) +{ + if (&p == points_[0]) { + constrained_edge[2] = ce; + } else if (&p == points_[1]) { + constrained_edge[0] = ce; + } else { + constrained_edge[1] = ce; + } +} + +void Triangle::SetConstrainedEdgeCW(const Point& p, bool ce) +{ + if (&p == points_[0]) { + constrained_edge[1] = ce; + } else if (&p == points_[1]) { + constrained_edge[2] = ce; + } else { + constrained_edge[0] = ce; + } +} + +bool Triangle::GetDelunayEdgeCCW(const Point& p) +{ + if (&p == points_[0]) { + return delaunay_edge[2]; + } else if (&p == points_[1]) { + return delaunay_edge[0]; + } + return delaunay_edge[1]; +} + +bool Triangle::GetDelunayEdgeCW(const Point& p) +{ + if (&p == points_[0]) { + return delaunay_edge[1]; + } else if (&p == points_[1]) { + return delaunay_edge[2]; + } + return delaunay_edge[0]; +} + +void Triangle::SetDelunayEdgeCCW(const Point& p, bool e) +{ + if (&p == points_[0]) { + delaunay_edge[2] = e; + } else if (&p == points_[1]) { + delaunay_edge[0] = e; + } else { + delaunay_edge[1] = e; + } +} + +void Triangle::SetDelunayEdgeCW(const Point& p, bool e) +{ + if (&p == points_[0]) { + delaunay_edge[1] = e; + } else if (&p == points_[1]) { + delaunay_edge[2] = e; + } else { + delaunay_edge[0] = e; + } +} + +void Triangle::DebugPrint() +{ + std::cout << *points_[0] << " " << *points_[1] << " " << *points_[2] << std::endl; +} + +bool Triangle::CircumcicleContains(const Point& point) const +{ + assert(IsCounterClockwise()); + const double dx = points_[0]->x - point.x; + const double dy = points_[0]->y - point.y; + const double ex = points_[1]->x - point.x; + const double ey = points_[1]->y - point.y; + const double fx = points_[2]->x - point.x; + const double fy = points_[2]->y - point.y; + + const double ap = dx * dx + dy * dy; + const double bp = ex * ex + ey * ey; + const double cp = fx * fx + fy * fy; + + return (dx * (fy * bp - cp * ey) - dy * (fx * bp - cp * ex) + ap * (fx * ey - fy * ex)) < 0; +} + +bool Triangle::IsCounterClockwise() const +{ + return (points_[1]->x - points_[0]->x) * (points_[2]->y - points_[0]->y) - + (points_[2]->x - points_[0]->x) * (points_[1]->y - points_[0]->y) > + 0; +} + +bool IsDelaunay(const std::vector& triangles) +{ + for (const auto triangle : triangles) { + for (const auto other : triangles) { + if (triangle == other) { + continue; + } + for (int i = 0; i < 3; ++i) { + if (triangle->CircumcicleContains(*other->GetPoint(i))) { + return false; + } + } + } + } + return true; +} + +} // namespace p2t diff --git a/source/Libraries/poly2tri/common/shapes.h b/source/Libraries/poly2tri/common/shapes.h new file mode 100644 index 00000000..d78aa876 --- /dev/null +++ b/source/Libraries/poly2tri/common/shapes.h @@ -0,0 +1,329 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "dll_symbol.h" + +#include +#include +#include +#include + +namespace p2t { + +struct Edge; + +struct P2T_DLL_SYMBOL Point { + + double x, y; + + /// Default constructor does nothing (for performance). + Point() + { + x = 0.0; + y = 0.0; + } + + /// The edges this point constitutes an upper ending point + std::vector edge_list; + + /// Construct using coordinates. + Point(double x, double y); + + /// Set this point to all zeros. + void set_zero() + { + x = 0.0; + y = 0.0; + } + + /// Set this point to some specified coordinates. + void set(double x_, double y_) + { + x = x_; + y = y_; + } + + /// Negate this point. + Point operator -() const + { + Point v; + v.set(-x, -y); + return v; + } + + /// Add a point to this point. + void operator +=(const Point& v) + { + x += v.x; + y += v.y; + } + + /// Subtract a point from this point. + void operator -=(const Point& v) + { + x -= v.x; + y -= v.y; + } + + /// Multiply this point by a scalar. + void operator *=(double a) + { + x *= a; + y *= a; + } + + /// Get the length of this point (the norm). + double Length() const + { + return sqrt(x * x + y * y); + } + + /// Convert this point into a unit point. Returns the Length. + double Normalize() + { + const double len = Length(); + x /= len; + y /= len; + return len; + } + +}; + +P2T_DLL_SYMBOL std::ostream& operator<<(std::ostream&, const Point&); + +// Represents a simple polygon's edge +struct P2T_DLL_SYMBOL Edge { + + Point* p, *q; + + /// Constructor + Edge(Point& p1, Point& p2) : p(&p1), q(&p2) + { + if (p1.y > p2.y) { + q = &p1; + p = &p2; + } else if (p1.y == p2.y) { + if (p1.x > p2.x) { + q = &p1; + p = &p2; + } else if (p1.x == p2.x) { + // Repeat points + throw std::runtime_error("Edge::Edge: p1 == p2"); + } + } + + q->edge_list.push_back(this); + } +}; + +// Triangle-based data structures are know to have better performance than quad-edge structures +// See: J. Shewchuk, "Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Triangulator" +// "Triangulations in CGAL" +class P2T_DLL_SYMBOL Triangle { +public: + +/// Constructor +Triangle(Point& a, Point& b, Point& c); + +/// Flags to determine if an edge is a Constrained edge +bool constrained_edge[3]; +/// Flags to determine if an edge is a Delauney edge +bool delaunay_edge[3]; + +Point* GetPoint(int index); +Point* PointCW(const Point& point); +Point* PointCCW(const Point& point); +Point* OppositePoint(Triangle& t, const Point& p); + +Triangle* GetNeighbor(int index); +void MarkNeighbor(Point* p1, Point* p2, Triangle* t); +void MarkNeighbor(Triangle& t); + +void MarkConstrainedEdge(int index); +void MarkConstrainedEdge(Edge& edge); +void MarkConstrainedEdge(Point* p, Point* q); + +int Index(const Point* p); +int EdgeIndex(const Point* p1, const Point* p2); + +Triangle* NeighborAcross(const Point& point); +Triangle* NeighborCW(const Point& point); +Triangle* NeighborCCW(const Point& point); +bool GetConstrainedEdgeCCW(const Point& p); +bool GetConstrainedEdgeCW(const Point& p); +void SetConstrainedEdgeCCW(const Point& p, bool ce); +void SetConstrainedEdgeCW(const Point& p, bool ce); +bool GetDelunayEdgeCCW(const Point& p); +bool GetDelunayEdgeCW(const Point& p); +void SetDelunayEdgeCCW(const Point& p, bool e); +void SetDelunayEdgeCW(const Point& p, bool e); + +bool Contains(const Point* p); +bool Contains(const Edge& e); +bool Contains(const Point* p, const Point* q); +void Legalize(Point& point); +void Legalize(Point& opoint, Point& npoint); +/** + * Clears all references to all other triangles and points + */ +void Clear(); +void ClearNeighbor(const Triangle *triangle); +void ClearNeighbors(); +void ClearDelunayEdges(); + +inline bool IsInterior(); +inline void IsInterior(bool b); + +void DebugPrint(); + +bool CircumcicleContains(const Point&) const; + +private: + +bool IsCounterClockwise() const; + +/// Triangle points +Point* points_[3]; +/// Neighbor list +Triangle* neighbors_[3]; + +/// Has this triangle been marked as an interior triangle? +bool interior_; +}; + +inline bool cmp(const Point* a, const Point* b) +{ + if (a->y < b->y) { + return true; + } else if (a->y == b->y) { + // Make sure q is point with greater x value + if (a->x < b->x) { + return true; + } + } + return false; +} + +/// Add two points_ component-wise. +inline Point operator +(const Point& a, const Point& b) +{ + return Point(a.x + b.x, a.y + b.y); +} + +/// Subtract two points_ component-wise. +inline Point operator -(const Point& a, const Point& b) +{ + return Point(a.x - b.x, a.y - b.y); +} + +/// Multiply point by scalar +inline Point operator *(double s, const Point& a) +{ + return Point(s * a.x, s * a.y); +} + +inline bool operator ==(const Point& a, const Point& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator !=(const Point& a, const Point& b) +{ + return !(a.x == b.x) || !(a.y == b.y); +} + +/// Peform the dot product on two vectors. +inline double Dot(const Point& a, const Point& b) +{ + return a.x * b.x + a.y * b.y; +} + +/// Perform the cross product on two vectors. In 2D this produces a scalar. +inline double Cross(const Point& a, const Point& b) +{ + return a.x * b.y - a.y * b.x; +} + +/// Perform the cross product on a point and a scalar. In 2D this produces +/// a point. +inline Point Cross(const Point& a, double s) +{ + return Point(s * a.y, -s * a.x); +} + +/// Perform the cross product on a scalar and a point. In 2D this produces +/// a point. +inline Point Cross(double s, const Point& a) +{ + return Point(-s * a.y, s * a.x); +} + +inline Point* Triangle::GetPoint(int index) +{ + return points_[index]; +} + +inline Triangle* Triangle::GetNeighbor(int index) +{ + return neighbors_[index]; +} + +inline bool Triangle::Contains(const Point* p) +{ + return p == points_[0] || p == points_[1] || p == points_[2]; +} + +inline bool Triangle::Contains(const Edge& e) +{ + return Contains(e.p) && Contains(e.q); +} + +inline bool Triangle::Contains(const Point* p, const Point* q) +{ + return Contains(p) && Contains(q); +} + +inline bool Triangle::IsInterior() +{ + return interior_; +} + +inline void Triangle::IsInterior(bool b) +{ + interior_ = b; +} + +/// Is this set a valid delaunay triangulation? +P2T_DLL_SYMBOL bool IsDelaunay(const std::vector&); + +} diff --git a/source/Libraries/poly2tri/common/utils.h b/source/Libraries/poly2tri/common/utils.h new file mode 100644 index 00000000..c9f1c23c --- /dev/null +++ b/source/Libraries/poly2tri/common/utils.h @@ -0,0 +1,130 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +// Otherwise #defines like M_PI are undeclared under Visual Studio +#define _USE_MATH_DEFINES + +#include "shapes.h" + +#include +#include + +// C99 removes M_PI from math.h +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327 +#endif + +namespace p2t { + +const double PI_3div4 = 3 * M_PI / 4; +const double PI_div2 = 1.57079632679489661923; +const double EPSILON = 1e-12; + +enum Orientation { CW, CCW, COLLINEAR }; + +/** + * Forumla to calculate signed area
      + * Positive if CCW
      + * Negative if CW
      + * 0 if collinear
      + *

      + * A[P1,P2,P3]  =  (x1*y2 - y1*x2) + (x2*y3 - y2*x3) + (x3*y1 - y3*x1)
      + *              =  (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
      + * 
      + */ +Orientation Orient2d(const Point& pa, const Point& pb, const Point& pc) +{ + double detleft = (pa.x - pc.x) * (pb.y - pc.y); + double detright = (pa.y - pc.y) * (pb.x - pc.x); + double val = detleft - detright; + +// Using a tolerance here fails on concave-by-subepsilon boundaries +// if (val > -EPSILON && val < EPSILON) { +// Using == on double makes -Wfloat-equal warnings yell at us + if (std::fpclassify(val) == FP_ZERO) { + return COLLINEAR; + } else if (val > 0) { + return CCW; + } + return CW; +} + +/* +bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd) +{ + double pdx = pd.x; + double pdy = pd.y; + double adx = pa.x - pdx; + double ady = pa.y - pdy; + double bdx = pb.x - pdx; + double bdy = pb.y - pdy; + + double adxbdy = adx * bdy; + double bdxady = bdx * ady; + double oabd = adxbdy - bdxady; + + if (oabd <= EPSILON) { + return false; + } + + double cdx = pc.x - pdx; + double cdy = pc.y - pdy; + + double cdxady = cdx * ady; + double adxcdy = adx * cdy; + double ocad = cdxady - adxcdy; + + if (ocad <= EPSILON) { + return false; + } + + return true; +} + +*/ + +bool InScanArea(const Point& pa, const Point& pb, const Point& pc, const Point& pd) +{ + double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y); + if (oadb >= -EPSILON) { + return false; + } + + double oadc = (pa.x - pc.x)*(pd.y - pc.y) - (pd.x - pc.x)*(pa.y - pc.y); + if (oadc <= EPSILON) { + return false; + } + return true; +} + +} diff --git a/source/Libraries/poly2tri/poly2tri.h b/source/Libraries/poly2tri/poly2tri.h new file mode 100644 index 00000000..3d40373b --- /dev/null +++ b/source/Libraries/poly2tri/poly2tri.h @@ -0,0 +1,35 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "common/shapes.h" +#include "sweep/cdt.h" diff --git a/source/Libraries/poly2tri/sweep/advancing_front.cpp b/source/Libraries/poly2tri/sweep/advancing_front.cpp new file mode 100644 index 00000000..e981bad2 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/advancing_front.cpp @@ -0,0 +1,110 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "advancing_front.h" + +#include + +namespace p2t { + +AdvancingFront::AdvancingFront(Node& head, Node& tail) +{ + head_ = &head; + tail_ = &tail; + search_node_ = &head; +} + +Node* AdvancingFront::LocateNode(double x) +{ + Node* node = search_node_; + + if (x < node->value) { + while ((node = node->prev) != nullptr) { + if (x >= node->value) { + search_node_ = node; + return node; + } + } + } else { + while ((node = node->next) != nullptr) { + if (x < node->value) { + search_node_ = node->prev; + return node->prev; + } + } + } + return nullptr; +} + +Node* AdvancingFront::FindSearchNode(double x) +{ + (void)x; // suppress compiler warnings "unused parameter 'x'" + // TODO: implement BST index + return search_node_; +} + +Node* AdvancingFront::LocatePoint(const Point* point) +{ + const double px = point->x; + Node* node = FindSearchNode(px); + const double nx = node->point->x; + + if (px == nx) { + if (point != node->point) { + // We might have two nodes with same x value for a short time + if (point == node->prev->point) { + node = node->prev; + } else if (point == node->next->point) { + node = node->next; + } else { + assert(0); + } + } + } else if (px < nx) { + while ((node = node->prev) != nullptr) { + if (point == node->point) { + break; + } + } + } else { + while ((node = node->next) != nullptr) { + if (point == node->point) + break; + } + } + if(node) search_node_ = node; + return node; +} + +AdvancingFront::~AdvancingFront() +{ +} + +} // namespace p2t diff --git a/source/Libraries/poly2tri/sweep/advancing_front.h b/source/Libraries/poly2tri/sweep/advancing_front.h new file mode 100644 index 00000000..ffd3fe71 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/advancing_front.h @@ -0,0 +1,115 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "../common/shapes.h" + +namespace p2t { + +struct Node; + +// Advancing front node +struct Node { + Point* point; + Triangle* triangle; + + Node* next; + Node* prev; + + double value; + + Node(Point& p) : point(&p), triangle(NULL), next(NULL), prev(NULL), value(p.x) + { + } + + Node(Point& p, Triangle& t) : point(&p), triangle(&t), next(NULL), prev(NULL), value(p.x) + { + } + +}; + +// Advancing front +class AdvancingFront { +public: + +AdvancingFront(Node& head, Node& tail); +// Destructor +~AdvancingFront(); + +Node* head(); +void set_head(Node* node); +Node* tail(); +void set_tail(Node* node); +Node* search(); +void set_search(Node* node); + +/// Locate insertion point along advancing front +Node* LocateNode(double x); + +Node* LocatePoint(const Point* point); + +private: + +Node* head_, *tail_, *search_node_; + +Node* FindSearchNode(double x); +}; + +inline Node* AdvancingFront::head() +{ + return head_; +} +inline void AdvancingFront::set_head(Node* node) +{ + head_ = node; +} + +inline Node* AdvancingFront::tail() +{ + return tail_; +} +inline void AdvancingFront::set_tail(Node* node) +{ + tail_ = node; +} + +inline Node* AdvancingFront::search() +{ + return search_node_; +} + +inline void AdvancingFront::set_search(Node* node) +{ + search_node_ = node; +} + +} diff --git a/source/Libraries/poly2tri/sweep/cdt.cpp b/source/Libraries/poly2tri/sweep/cdt.cpp new file mode 100644 index 00000000..4dfe6a64 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/cdt.cpp @@ -0,0 +1,71 @@ +/* + * Poly2Tri Copyright (c) 2009-2021, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "cdt.h" + +namespace p2t { + +CDT::CDT(const std::vector& polyline) +{ + sweep_context_ = new SweepContext(polyline); + sweep_ = new Sweep; +} + +void CDT::AddHole(const std::vector& polyline) +{ + sweep_context_->AddHole(polyline); +} + +void CDT::AddPoint(Point* point) { + sweep_context_->AddPoint(point); +} + +void CDT::Triangulate() +{ + sweep_->Triangulate(*sweep_context_); +} + +std::vector CDT::GetTriangles() +{ + return sweep_context_->GetTriangles(); +} + +std::list CDT::GetMap() +{ + return sweep_context_->GetMap(); +} + +CDT::~CDT() +{ + delete sweep_context_; + delete sweep_; +} + +} // namespace p2t diff --git a/source/Libraries/poly2tri/sweep/cdt.h b/source/Libraries/poly2tri/sweep/cdt.h new file mode 100644 index 00000000..7c54ea97 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/cdt.h @@ -0,0 +1,104 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "advancing_front.h" +#include "sweep_context.h" +#include "sweep.h" + +#include "../common/dll_symbol.h" + +/** + * + * @author Mason Green + * + */ + +namespace p2t { + +class P2T_DLL_SYMBOL CDT +{ +public: + + /** + * Constructor - add polyline with non repeating points + * + * @param polyline + */ + CDT(const std::vector& polyline); + + /** + * Destructor - clean up memory + */ + ~CDT(); + + /** + * Add a hole + * + * @param polyline + */ + void AddHole(const std::vector& polyline); + + /** + * Add a steiner point + * + * @param point + */ + void AddPoint(Point* point); + + /** + * Triangulate - do this AFTER you've added the polyline, holes, and Steiner points + */ + void Triangulate(); + + /** + * Get CDT triangles + */ + std::vector GetTriangles(); + + /** + * Get triangle map + */ + std::list GetMap(); + + private: + + /** + * Internals + */ + + SweepContext* sweep_context_; + Sweep* sweep_; + +}; + +} diff --git a/source/Libraries/poly2tri/sweep/sweep.cpp b/source/Libraries/poly2tri/sweep/sweep.cpp new file mode 100644 index 00000000..48e8bee8 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/sweep.cpp @@ -0,0 +1,860 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "sweep.h" +#include "sweep_context.h" +#include "advancing_front.h" +#include "../common/utils.h" + +#include +#include + +namespace p2t { + +// Triangulate simple polygon with holes +void Sweep::Triangulate(SweepContext& tcx) +{ + tcx.InitTriangulation(); + tcx.CreateAdvancingFront(); + // Sweep points; build mesh + SweepPoints(tcx); + // Clean up + FinalizationPolygon(tcx); +} + +void Sweep::SweepPoints(SweepContext& tcx) +{ + for (size_t i = 1; i < tcx.point_count(); i++) { + Point& point = *tcx.GetPoint(i); + Node* node = &PointEvent(tcx, point); + for (auto& j : point.edge_list) { + EdgeEvent(tcx, j, node); + } + } +} + +void Sweep::FinalizationPolygon(SweepContext& tcx) +{ + // Get an Internal triangle to start with + Triangle* t = tcx.front()->head()->next->triangle; + Point* p = tcx.front()->head()->next->point; + while (t && !t->GetConstrainedEdgeCW(*p)) { + t = t->NeighborCCW(*p); + } + + // Collect interior triangles constrained by edges + if (t) { + tcx.MeshClean(*t); + } +} + +Node& Sweep::PointEvent(SweepContext& tcx, Point& point) +{ + Node* node_ptr = tcx.LocateNode(point); + if (!node_ptr || !node_ptr->point || !node_ptr->next || !node_ptr->next->point) + { + throw std::runtime_error("PointEvent - null node"); + } + + Node& node = *node_ptr; + Node& new_node = NewFrontTriangle(tcx, point, node); + + // Only need to check +epsilon since point never have smaller + // x value than node due to how we fetch nodes from the front + if (point.x <= node.point->x + EPSILON) { + Fill(tcx, node); + } + + //tcx.AddNode(new_node); + + FillAdvancingFront(tcx, new_node); + return new_node; +} + +void Sweep::EdgeEvent(SweepContext& tcx, Edge* edge, Node* node) +{ + tcx.edge_event.constrained_edge = edge; + tcx.edge_event.right = (edge->p->x > edge->q->x); + + if (IsEdgeSideOfTriangle(*node->triangle, *edge->p, *edge->q)) { + return; + } + + // For now we will do all needed filling + // TODO: integrate with flip process might give some better performance + // but for now this avoid the issue with cases that needs both flips and fills + FillEdgeEvent(tcx, edge, node); + EdgeEvent(tcx, *edge->p, *edge->q, node->triangle, *edge->q); +} + +void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point) +{ + if (triangle == nullptr) { + throw std::runtime_error("EdgeEvent - null triangle"); + } + if (IsEdgeSideOfTriangle(*triangle, ep, eq)) { + return; + } + + Point* p1 = triangle->PointCCW(point); + Orientation o1 = Orient2d(eq, *p1, ep); + if (o1 == COLLINEAR) { + if (triangle->Contains(&eq, p1)) { + triangle->MarkConstrainedEdge(&eq, p1); + // We are modifying the constraint maybe it would be better to + // not change the given constraint and just keep a variable for the new constraint + tcx.edge_event.constrained_edge->q = p1; + triangle = triangle->NeighborAcross(point); + EdgeEvent(tcx, ep, *p1, triangle, *p1); + } else { + throw std::runtime_error("EdgeEvent - collinear points not supported"); + } + return; + } + + Point* p2 = triangle->PointCW(point); + Orientation o2 = Orient2d(eq, *p2, ep); + if (o2 == COLLINEAR) { + if (triangle->Contains(&eq, p2)) { + triangle->MarkConstrainedEdge(&eq, p2); + // We are modifying the constraint maybe it would be better to + // not change the given constraint and just keep a variable for the new constraint + tcx.edge_event.constrained_edge->q = p2; + triangle = triangle->NeighborAcross(point); + EdgeEvent(tcx, ep, *p2, triangle, *p2); + } else { + throw std::runtime_error("EdgeEvent - collinear points not supported"); + } + return; + } + + if (o1 == o2) { + // Need to decide if we are rotating CW or CCW to get to a triangle + // that will cross edge + if (o1 == CW) { + triangle = triangle->NeighborCCW(point); + } else { + triangle = triangle->NeighborCW(point); + } + EdgeEvent(tcx, ep, eq, triangle, point); + } else { + // This triangle crosses constraint so lets flippin start! + assert(triangle); + FlipEdgeEvent(tcx, ep, eq, triangle, point); + } +} + +bool Sweep::IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq) +{ + const int index = triangle.EdgeIndex(&ep, &eq); + + if (index != -1) { + triangle.MarkConstrainedEdge(index); + Triangle* t = triangle.GetNeighbor(index); + if (t) { + t->MarkConstrainedEdge(&ep, &eq); + } + return true; + } + return false; +} + +Node& Sweep::NewFrontTriangle(SweepContext& tcx, Point& point, Node& node) +{ + Triangle* triangle = new Triangle(point, *node.point, *node.next->point); + + triangle->MarkNeighbor(*node.triangle); + tcx.AddToMap(triangle); + + Node* new_node = new Node(point); + nodes_.push_back(new_node); + + new_node->next = node.next; + new_node->prev = &node; + node.next->prev = new_node; + node.next = new_node; + + if (!Legalize(tcx, *triangle)) { + tcx.MapTriangleToNodes(*triangle); + } + + return *new_node; +} + +void Sweep::Fill(SweepContext& tcx, Node& node) +{ + Triangle* triangle = new Triangle(*node.prev->point, *node.point, *node.next->point); + + // TODO: should copy the constrained_edge value from neighbor triangles + // for now constrained_edge values are copied during the legalize + triangle->MarkNeighbor(*node.prev->triangle); + triangle->MarkNeighbor(*node.triangle); + + tcx.AddToMap(triangle); + + // Update the advancing front + node.prev->next = node.next; + node.next->prev = node.prev; + + // If it was legalized the triangle has already been mapped + if (!Legalize(tcx, *triangle)) { + tcx.MapTriangleToNodes(*triangle); + } +} + +void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n) +{ + + // Fill right holes + Node* node = n.next; + + while (node && node->next) { + // if HoleAngle exceeds 90 degrees then break. + if (LargeHole_DontFill(node)) break; + Fill(tcx, *node); + node = node->next; + } + + // Fill left holes + node = n.prev; + + while (node && node->prev) { + // if HoleAngle exceeds 90 degrees then break. + if (LargeHole_DontFill(node)) break; + Fill(tcx, *node); + node = node->prev; + } + + // Fill right basins + if (n.next && n.next->next) { + const double angle = BasinAngle(n); + if (angle < PI_3div4) { + FillBasin(tcx, n); + } + } +} + +// True if HoleAngle exceeds 90 degrees. +// LargeHole_DontFill checks if the advancing front has a large hole. +// A "Large hole" is a triangle formed by a sequence of points in the advancing +// front where three neighbor points form a triangle. +// And angle between left-top, bottom, and right-top points is more than 90 degrees. +// The first part of the algorithm reviews only three neighbor points, e.g. named A, B, C. +// Additional part of this logic reviews a sequence of 5 points - +// additionally reviews one point before and one after the sequence of three (A, B, C), +// e.g. named X and Y. +// In this case, angles are XBC and ABY and this if angles are negative or more +// than 90 degrees LargeHole_DontFill returns true. +// But there is a configuration when ABC has a negative angle but XBC or ABY is less +// than 90 degrees and positive. +// Then function LargeHole_DontFill return false and initiates filling. +// This filling creates a triangle ABC and adds it to the advancing front. +// But in the case when angle ABC is negative this triangle goes inside the advancing front +// and can intersect previously created triangles. +// This triangle leads to making wrong advancing front and problems in triangulation in the future. +// Looks like such a triangle should not be created. +// The simplest way to check and fix it is to check an angle ABC. +// If it is negative LargeHole_DontFill should return true and +// not initiate creating the ABC triangle in the advancing front. +// X______A Y +// \ / +// \ / +// \ B / +// | / +// | / +// |/ +// C +bool Sweep::LargeHole_DontFill(const Node* node) const { + + const Node* nextNode = node->next; + const Node* prevNode = node->prev; + if (!AngleExceeds90Degrees(node->point, nextNode->point, prevNode->point)) + return false; + + if (AngleIsNegative(node->point, nextNode->point, prevNode->point)) + return true; + + // Check additional points on front. + const Node* next2Node = nextNode->next; + // "..Plus.." because only want angles on same side as point being added. + if ((next2Node != nullptr) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, next2Node->point, prevNode->point)) + return false; + + const Node* prev2Node = prevNode->prev; + // "..Plus.." because only want angles on same side as point being added. + if ((prev2Node != nullptr) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, nextNode->point, prev2Node->point)) + return false; + + return true; +} + +bool Sweep::AngleIsNegative(const Point* origin, const Point* pa, const Point* pb) const { + const double angle = Angle(origin, pa, pb); + return angle < 0; +} + +bool Sweep::AngleExceeds90Degrees(const Point* origin, const Point* pa, const Point* pb) const { + const double angle = Angle(origin, pa, pb); + return ((angle > PI_div2) || (angle < -PI_div2)); +} + +bool Sweep::AngleExceedsPlus90DegreesOrIsNegative(const Point* origin, const Point* pa, const Point* pb) const { + const double angle = Angle(origin, pa, pb); + return (angle > PI_div2) || (angle < 0); +} + +double Sweep::Angle(const Point* origin, const Point* pa, const Point* pb) const { + /* Complex plane + * ab = cosA +i*sinA + * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) + * atan2(y,x) computes the principal value of the argument function + * applied to the complex number x+iy + * Where x = ax*bx + ay*by + * y = ax*by - ay*bx + */ + const double px = origin->x; + const double py = origin->y; + const double ax = pa->x - px; + const double ay = pa->y - py; + const double bx = pb->x - px; + const double by = pb->y - py; + const double x = ax * by - ay * bx; + const double y = ax * bx + ay * by; + return atan2(x, y); +} + +double Sweep::BasinAngle(const Node& node) const +{ + const double ax = node.point->x - node.next->next->point->x; + const double ay = node.point->y - node.next->next->point->y; + return atan2(ay, ax); +} + +double Sweep::HoleAngle(const Node& node) const +{ + /* Complex plane + * ab = cosA +i*sinA + * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) + * atan2(y,x) computes the principal value of the argument function + * applied to the complex number x+iy + * Where x = ax*bx + ay*by + * y = ax*by - ay*bx + */ + const double ax = node.next->point->x - node.point->x; + const double ay = node.next->point->y - node.point->y; + const double bx = node.prev->point->x - node.point->x; + const double by = node.prev->point->y - node.point->y; + return atan2(ax * by - ay * bx, ax * bx + ay * by); +} + +bool Sweep::Legalize(SweepContext& tcx, Triangle& t) +{ + // To legalize a triangle we start by finding if any of the three edges + // violate the Delaunay condition + for (int i = 0; i < 3; i++) { + if (t.delaunay_edge[i]) + continue; + + Triangle* ot = t.GetNeighbor(i); + + if (ot) { + Point* p = t.GetPoint(i); + Point* op = ot->OppositePoint(t, *p); + int oi = ot->Index(op); + + // If this is a Constrained Edge or a Delaunay Edge(only during recursive legalization) + // then we should not try to legalize + if (ot->constrained_edge[oi] || ot->delaunay_edge[oi]) { + t.constrained_edge[i] = ot->constrained_edge[oi]; + continue; + } + + bool inside = Incircle(*p, *t.PointCCW(*p), *t.PointCW(*p), *op); + + if (inside) { + // Lets mark this shared edge as Delaunay + t.delaunay_edge[i] = true; + ot->delaunay_edge[oi] = true; + + // Lets rotate shared edge one vertex CW to legalize it + RotateTrianglePair(t, *p, *ot, *op); + + // We now got one valid Delaunay Edge shared by two triangles + // This gives us 4 new edges to check for Delaunay + + // Make sure that triangle to node mapping is done only one time for a specific triangle + bool not_legalized = !Legalize(tcx, t); + if (not_legalized) { + tcx.MapTriangleToNodes(t); + } + + not_legalized = !Legalize(tcx, *ot); + if (not_legalized) + tcx.MapTriangleToNodes(*ot); + + // Reset the Delaunay edges, since they only are valid Delaunay edges + // until we add a new triangle or point. + // XXX: need to think about this. Can these edges be tried after we + // return to previous recursive level? + t.delaunay_edge[i] = false; + ot->delaunay_edge[oi] = false; + + // If triangle have been legalized no need to check the other edges since + // the recursive legalization will handles those so we can end here. + return true; + } + } + } + return false; +} + +bool Sweep::Incircle(const Point& pa, const Point& pb, const Point& pc, const Point& pd) const +{ + const double adx = pa.x - pd.x; + const double ady = pa.y - pd.y; + const double bdx = pb.x - pd.x; + const double bdy = pb.y - pd.y; + + const double adxbdy = adx * bdy; + const double bdxady = bdx * ady; + const double oabd = adxbdy - bdxady; + + if (oabd <= 0) + return false; + + const double cdx = pc.x - pd.x; + const double cdy = pc.y - pd.y; + + const double cdxady = cdx * ady; + const double adxcdy = adx * cdy; + const double ocad = cdxady - adxcdy; + + if (ocad <= 0) + return false; + + const double bdxcdy = bdx * cdy; + const double cdxbdy = cdx * bdy; + + const double alift = adx * adx + ady * ady; + const double blift = bdx * bdx + bdy * bdy; + const double clift = cdx * cdx + cdy * cdy; + + const double det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd; + + return det > 0; +} + +void Sweep::RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op) const +{ + Triangle* n1, *n2, *n3, *n4; + n1 = t.NeighborCCW(p); + n2 = t.NeighborCW(p); + n3 = ot.NeighborCCW(op); + n4 = ot.NeighborCW(op); + + bool ce1, ce2, ce3, ce4; + ce1 = t.GetConstrainedEdgeCCW(p); + ce2 = t.GetConstrainedEdgeCW(p); + ce3 = ot.GetConstrainedEdgeCCW(op); + ce4 = ot.GetConstrainedEdgeCW(op); + + bool de1, de2, de3, de4; + de1 = t.GetDelunayEdgeCCW(p); + de2 = t.GetDelunayEdgeCW(p); + de3 = ot.GetDelunayEdgeCCW(op); + de4 = ot.GetDelunayEdgeCW(op); + + t.Legalize(p, op); + ot.Legalize(op, p); + + // Remap delaunay_edge + ot.SetDelunayEdgeCCW(p, de1); + t.SetDelunayEdgeCW(p, de2); + t.SetDelunayEdgeCCW(op, de3); + ot.SetDelunayEdgeCW(op, de4); + + // Remap constrained_edge + ot.SetConstrainedEdgeCCW(p, ce1); + t.SetConstrainedEdgeCW(p, ce2); + t.SetConstrainedEdgeCCW(op, ce3); + ot.SetConstrainedEdgeCW(op, ce4); + + // Remap neighbors + // XXX: might optimize the markNeighbor by keeping track of + // what side should be assigned to what neighbor after the + // rotation. Now mark neighbor does lots of testing to find + // the right side. + t.ClearNeighbors(); + ot.ClearNeighbors(); + if (n1) ot.MarkNeighbor(*n1); + if (n2) t.MarkNeighbor(*n2); + if (n3) t.MarkNeighbor(*n3); + if (n4) ot.MarkNeighbor(*n4); + t.MarkNeighbor(ot); +} + +void Sweep::FillBasin(SweepContext& tcx, Node& node) +{ + if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) { + tcx.basin.left_node = node.next->next; + } else { + tcx.basin.left_node = node.next; + } + + // Find the bottom and right node + tcx.basin.bottom_node = tcx.basin.left_node; + while (tcx.basin.bottom_node->next + && tcx.basin.bottom_node->point->y >= tcx.basin.bottom_node->next->point->y) { + tcx.basin.bottom_node = tcx.basin.bottom_node->next; + } + if (tcx.basin.bottom_node == tcx.basin.left_node) { + // No valid basin + return; + } + + tcx.basin.right_node = tcx.basin.bottom_node; + while (tcx.basin.right_node->next + && tcx.basin.right_node->point->y < tcx.basin.right_node->next->point->y) { + tcx.basin.right_node = tcx.basin.right_node->next; + } + if (tcx.basin.right_node == tcx.basin.bottom_node) { + // No valid basins + return; + } + + tcx.basin.width = tcx.basin.right_node->point->x - tcx.basin.left_node->point->x; + tcx.basin.left_highest = tcx.basin.left_node->point->y > tcx.basin.right_node->point->y; + + FillBasinReq(tcx, tcx.basin.bottom_node); +} + +void Sweep::FillBasinReq(SweepContext& tcx, Node* node) +{ + // if shallow stop filling + if (IsShallow(tcx, *node)) { + return; + } + + Fill(tcx, *node); + + if (node->prev == tcx.basin.left_node && node->next == tcx.basin.right_node) { + return; + } else if (node->prev == tcx.basin.left_node) { + Orientation o = Orient2d(*node->point, *node->next->point, *node->next->next->point); + if (o == CW) { + return; + } + node = node->next; + } else if (node->next == tcx.basin.right_node) { + Orientation o = Orient2d(*node->point, *node->prev->point, *node->prev->prev->point); + if (o == CCW) { + return; + } + node = node->prev; + } else { + // Continue with the neighbor node with lowest Y value + if (node->prev->point->y < node->next->point->y) { + node = node->prev; + } else { + node = node->next; + } + } + + FillBasinReq(tcx, node); +} + +bool Sweep::IsShallow(SweepContext& tcx, Node& node) +{ + double height; + + if (tcx.basin.left_highest) { + height = tcx.basin.left_node->point->y - node.point->y; + } else { + height = tcx.basin.right_node->point->y - node.point->y; + } + + // if shallow stop filling + if (tcx.basin.width > height) { + return true; + } + return false; +} + +void Sweep::FillEdgeEvent(SweepContext& tcx, Edge* edge, Node* node) +{ + if (tcx.edge_event.right) { + FillRightAboveEdgeEvent(tcx, edge, node); + } else { + FillLeftAboveEdgeEvent(tcx, edge, node); + } +} + +void Sweep::FillRightAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node) +{ + while (node->next->point->x < edge->p->x) { + // Check if next node is below the edge + if (Orient2d(*edge->q, *node->next->point, *edge->p) == CCW) { + FillRightBelowEdgeEvent(tcx, edge, *node); + } else { + node = node->next; + } + } +} + +void Sweep::FillRightBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + if (node.point->x < edge->p->x) { + if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) { + // Concave + FillRightConcaveEdgeEvent(tcx, edge, node); + } else { + // Convex + FillRightConvexEdgeEvent(tcx, edge, node); + // Retry this one + FillRightBelowEdgeEvent(tcx, edge, node); + } + } +} + +void Sweep::FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + Fill(tcx, *node.next); + if (node.next->point != edge->p) { + // Next above or below edge? + if (Orient2d(*edge->q, *node.next->point, *edge->p) == CCW) { + // Below + if (Orient2d(*node.point, *node.next->point, *node.next->next->point) == CCW) { + // Next is concave + FillRightConcaveEdgeEvent(tcx, edge, node); + } else { + // Next is convex + } + } + } +} + +void Sweep::FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + // Next concave or convex? + if (Orient2d(*node.next->point, *node.next->next->point, *node.next->next->next->point) == CCW) { + // Concave + FillRightConcaveEdgeEvent(tcx, edge, *node.next); + } else { + // Convex + // Next above or below edge? + if (Orient2d(*edge->q, *node.next->next->point, *edge->p) == CCW) { + // Below + FillRightConvexEdgeEvent(tcx, edge, *node.next); + } else { + // Above + } + } +} + +void Sweep::FillLeftAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node) +{ + while (node->prev->point->x > edge->p->x) { + // Check if next node is below the edge + if (Orient2d(*edge->q, *node->prev->point, *edge->p) == CW) { + FillLeftBelowEdgeEvent(tcx, edge, *node); + } else { + node = node->prev; + } + } +} + +void Sweep::FillLeftBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + if (node.point->x > edge->p->x) { + if (Orient2d(*node.point, *node.prev->point, *node.prev->prev->point) == CW) { + // Concave + FillLeftConcaveEdgeEvent(tcx, edge, node); + } else { + // Convex + FillLeftConvexEdgeEvent(tcx, edge, node); + // Retry this one + FillLeftBelowEdgeEvent(tcx, edge, node); + } + } +} + +void Sweep::FillLeftConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + // Next concave or convex? + if (Orient2d(*node.prev->point, *node.prev->prev->point, *node.prev->prev->prev->point) == CW) { + // Concave + FillLeftConcaveEdgeEvent(tcx, edge, *node.prev); + } else { + // Convex + // Next above or below edge? + if (Orient2d(*edge->q, *node.prev->prev->point, *edge->p) == CW) { + // Below + FillLeftConvexEdgeEvent(tcx, edge, *node.prev); + } else { + // Above + } + } +} + +void Sweep::FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node) +{ + Fill(tcx, *node.prev); + if (node.prev->point != edge->p) { + // Next above or below edge? + if (Orient2d(*edge->q, *node.prev->point, *edge->p) == CW) { + // Below + if (Orient2d(*node.point, *node.prev->point, *node.prev->prev->point) == CW) { + // Next is concave + FillLeftConcaveEdgeEvent(tcx, edge, node); + } else { + // Next is convex + } + } + } +} + +void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p) +{ + assert(t); + Triangle* ot_ptr = t->NeighborAcross(p); + if (ot_ptr == nullptr) + { + throw std::runtime_error("FlipEdgeEvent - null neighbor across"); + } + Triangle& ot = *ot_ptr; + Point& op = *ot.OppositePoint(*t, p); + + if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) { + // Lets rotate shared edge one vertex CW + RotateTrianglePair(*t, p, ot, op); + tcx.MapTriangleToNodes(*t); + tcx.MapTriangleToNodes(ot); + + if (p == eq && op == ep) { + if (eq == *tcx.edge_event.constrained_edge->q && ep == *tcx.edge_event.constrained_edge->p) { + t->MarkConstrainedEdge(&ep, &eq); + ot.MarkConstrainedEdge(&ep, &eq); + Legalize(tcx, *t); + Legalize(tcx, ot); + } else { + // XXX: I think one of the triangles should be legalized here? + } + } else { + Orientation o = Orient2d(eq, op, ep); + t = &NextFlipTriangle(tcx, (int)o, *t, ot, p, op); + FlipEdgeEvent(tcx, ep, eq, t, p); + } + } else { + Point& newP = NextFlipPoint(ep, eq, ot, op); + FlipScanEdgeEvent(tcx, ep, eq, *t, ot, newP); + EdgeEvent(tcx, ep, eq, t, p); + } +} + +Triangle& Sweep::NextFlipTriangle(SweepContext& tcx, int o, Triangle& t, Triangle& ot, Point& p, Point& op) +{ + if (o == CCW) { + // ot is not crossing edge after flip + int edge_index = ot.EdgeIndex(&p, &op); + ot.delaunay_edge[edge_index] = true; + Legalize(tcx, ot); + ot.ClearDelunayEdges(); + return t; + } + + // t is not crossing edge after flip + int edge_index = t.EdgeIndex(&p, &op); + + t.delaunay_edge[edge_index] = true; + Legalize(tcx, t); + t.ClearDelunayEdges(); + return ot; +} + +Point& Sweep::NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op) +{ + Orientation o2d = Orient2d(eq, op, ep); + if (o2d == CW) { + // Right + return *ot.PointCCW(op); + } else if (o2d == CCW) { + // Left + return *ot.PointCW(op); + } + throw std::runtime_error("[Unsupported] Opposing point on constrained edge"); +} + +void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_triangle, + Triangle& t, Point& p) +{ + Triangle* ot_ptr = t.NeighborAcross(p); + if (ot_ptr == nullptr) { + throw std::runtime_error("FlipScanEdgeEvent - null neighbor across"); + } + + Point* op_ptr = ot_ptr->OppositePoint(t, p); + if (op_ptr == nullptr) { + throw std::runtime_error("FlipScanEdgeEvent - null opposing point"); + } + + Point* p1 = flip_triangle.PointCCW(eq); + Point* p2 = flip_triangle.PointCW(eq); + if (p1 == nullptr || p2 == nullptr) { + throw std::runtime_error("FlipScanEdgeEvent - null on either of points"); + } + + Triangle& ot = *ot_ptr; + Point& op = *op_ptr; + + if (InScanArea(eq, *p1, *p2, op)) { + // flip with new edge op->eq + FlipEdgeEvent(tcx, eq, op, &ot, op); + // TODO: Actually I just figured out that it should be possible to + // improve this by getting the next ot and op before the the above + // flip and continue the flipScanEdgeEvent here + // set new ot and op here and loop back to inScanArea test + // also need to set a new flip_triangle first + // Turns out at first glance that this is somewhat complicated + // so it will have to wait. + } else { + Point& newP = NextFlipPoint(ep, eq, ot, op); + FlipScanEdgeEvent(tcx, ep, eq, flip_triangle, ot, newP); + } +} + +Sweep::~Sweep() { + + // Clean up memory + for (auto& node : nodes_) { + delete node; + } +} + +} // namespace p2t diff --git a/source/Libraries/poly2tri/sweep/sweep.h b/source/Libraries/poly2tri/sweep/sweep.h new file mode 100644 index 00000000..ad43f2e4 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/sweep.h @@ -0,0 +1,283 @@ +/* + * Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V. and + * Zalik, B.(2008)'Sweep-line algorithm for constrained Delaunay triangulation', + * International Journal of Geographical Information Science + * + * "FlipScan" Constrained Edge Algorithm invented by Thomas Åhlén, thahlen@gmail.com + */ + +#pragma once + +#include + +namespace p2t { + +class SweepContext; +struct Node; +struct Point; +struct Edge; +class Triangle; + +class Sweep +{ +public: + + /** + * Triangulate + * + * @param tcx + */ + void Triangulate(SweepContext& tcx); + + /** + * Destructor - clean up memory + */ + ~Sweep(); + +private: + + /** + * Start sweeping the Y-sorted point set from bottom to top + * + * @param tcx + */ + void SweepPoints(SweepContext& tcx); + + /** + * Find closes node to the left of the new point and + * create a new triangle. If needed new holes and basins + * will be filled to. + * + * @param tcx + * @param point + * @return + */ + Node& PointEvent(SweepContext& tcx, Point& point); + + /** + * + * + * @param tcx + * @param edge + * @param node + */ + void EdgeEvent(SweepContext& tcx, Edge* edge, Node* node); + + void EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangle, Point& point); + + /** + * Creates a new front triangle and legalize it + * + * @param tcx + * @param point + * @param node + * @return + */ + Node& NewFrontTriangle(SweepContext& tcx, Point& point, Node& node); + + /** + * Adds a triangle to the advancing front to fill a hole. + * @param tcx + * @param node - middle node, that is the bottom of the hole + */ + void Fill(SweepContext& tcx, Node& node); + + /** + * Returns true if triangle was legalized + */ + bool Legalize(SweepContext& tcx, Triangle& t); + + /** + * Requirement:
      + * 1. a,b and c form a triangle.
      + * 2. a and d is know to be on opposite side of bc
      + *
      +   *                a
      +   *                +
      +   *               / \
      +   *              /   \
      +   *            b/     \c
      +   *            +-------+
      +   *           /    d    \
      +   *          /           \
      +   * 
      + * Fact: d has to be in area B to have a chance to be inside the circle formed by + * a,b and c
      + * d is outside B if orient2d(a,b,d) or orient2d(c,a,d) is CW
      + * This preknowledge gives us a way to optimize the incircle test + * @param a - triangle point, opposite d + * @param b - triangle point + * @param c - triangle point + * @param d - point opposite a + * @return true if d is inside circle, false if on circle edge + */ + bool Incircle(const Point& pa, const Point& pb, const Point& pc, const Point& pd) const; + + /** + * Rotates a triangle pair one vertex CW + *
      +   *       n2                    n2
      +   *  P +-----+             P +-----+
      +   *    | t  /|               |\  t |
      +   *    |   / |               | \   |
      +   *  n1|  /  |n3           n1|  \  |n3
      +   *    | /   |    after CW   |   \ |
      +   *    |/ oT |               | oT \|
      +   *    +-----+ oP            +-----+
      +   *       n4                    n4
      +   * 
      + */ + void RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op) const; + + /** + * Fills holes in the Advancing Front + * + * + * @param tcx + * @param n + */ + void FillAdvancingFront(SweepContext& tcx, Node& n); + + // Decision-making about when to Fill hole. + // Contributed by ToolmakerSteve2 + bool LargeHole_DontFill(const Node* node) const; + bool AngleIsNegative(const Point* origin, const Point* pa, const Point* pb) const; + bool AngleExceeds90Degrees(const Point* origin, const Point* pa, const Point* pb) const; + bool AngleExceedsPlus90DegreesOrIsNegative(const Point* origin, const Point* pa, const Point* pb) const; + double Angle(const Point* origin, const Point* pa, const Point* pb) const; + + /** + * + * @param node - middle node + * @return the angle between 3 front nodes + */ + double HoleAngle(const Node& node) const; + + /** + * The basin angle is decided against the horizontal line [1,0] + */ + double BasinAngle(const Node& node) const; + + /** + * Fills a basin that has formed on the Advancing Front to the right + * of given node.
      + * First we decide a left,bottom and right node that forms the + * boundaries of the basin. Then we do a reqursive fill. + * + * @param tcx + * @param node - starting node, this or next node will be left node + */ + void FillBasin(SweepContext& tcx, Node& node); + + /** + * Recursive algorithm to fill a Basin with triangles + * + * @param tcx + * @param node - bottom_node + * @param cnt - counter used to alternate on even and odd numbers + */ + void FillBasinReq(SweepContext& tcx, Node* node); + + bool IsShallow(SweepContext& tcx, Node& node); + + bool IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq); + + void FillEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); + + void FillRightAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); + + void FillRightBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FillRightConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FillRightConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FillLeftAboveEdgeEvent(SweepContext& tcx, Edge* edge, Node* node); + + void FillLeftBelowEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FillLeftConcaveEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FillLeftConvexEdgeEvent(SweepContext& tcx, Edge* edge, Node& node); + + void FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& p); + + /** + * After a flip we have two triangles and know that only one will still be + * intersecting the edge. So decide which to contiune with and legalize the other + * + * @param tcx + * @param o - should be the result of an orient2d( eq, op, ep ) + * @param t - triangle 1 + * @param ot - triangle 2 + * @param p - a point shared by both triangles + * @param op - another point shared by both triangles + * @return returns the triangle still intersecting the edge + */ + Triangle& NextFlipTriangle(SweepContext& tcx, int o, Triangle& t, Triangle& ot, Point& p, Point& op); + + /** + * When we need to traverse from one triangle to the next we need + * the point in current triangle that is the opposite point to the next + * triangle. + * + * @param ep + * @param eq + * @param ot + * @param op + * @return + */ + Point& NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op); + + /** + * Scan part of the FlipScan algorithm
      + * When a triangle pair isn't flippable we will scan for the next + * point that is inside the flip triangle scan area. When found + * we generate a new flipEdgeEvent + * + * @param tcx + * @param ep - last point on the edge we are traversing + * @param eq - first point on the edge we are traversing + * @param flipTriangle - the current triangle sharing the point eq with edge + * @param t + * @param p + */ + void FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_triangle, Triangle& t, Point& p); + + void FinalizationPolygon(SweepContext& tcx); + + std::vector nodes_; + +}; + +} diff --git a/source/Libraries/poly2tri/sweep/sweep_context.cpp b/source/Libraries/poly2tri/sweep/sweep_context.cpp new file mode 100644 index 00000000..7b9432fe --- /dev/null +++ b/source/Libraries/poly2tri/sweep/sweep_context.cpp @@ -0,0 +1,206 @@ +/* + * Poly2Tri Copyright (c) 2009-2022, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "sweep_context.h" +#include +#include "advancing_front.h" + +namespace p2t { + +SweepContext::SweepContext(std::vector polyline) : points_(std::move(polyline)), + front_(nullptr), + head_(nullptr), + tail_(nullptr), + af_head_(nullptr), + af_middle_(nullptr), + af_tail_(nullptr) +{ + InitEdges(points_); +} + +void SweepContext::AddHole(const std::vector& polyline) +{ + InitEdges(polyline); + for (auto i : polyline) { + points_.push_back(i); + } +} + +void SweepContext::AddPoint(Point* point) { + points_.push_back(point); +} + +std::vector &SweepContext::GetTriangles() +{ + return triangles_; +} + +std::list &SweepContext::GetMap() +{ + return map_; +} + +void SweepContext::InitTriangulation() +{ + double xmax(points_[0]->x), xmin(points_[0]->x); + double ymax(points_[0]->y), ymin(points_[0]->y); + + // Calculate bounds. + for (auto& point : points_) { + Point& p = *point; + if (p.x > xmax) + xmax = p.x; + if (p.x < xmin) + xmin = p.x; + if (p.y > ymax) + ymax = p.y; + if (p.y < ymin) + ymin = p.y; + } + + double dx = kAlpha * (xmax - xmin); + double dy = kAlpha * (ymax - ymin); + head_ = new Point(xmin - dx, ymin - dy); + tail_ = new Point(xmax + dx, ymin - dy); + + // Sort points along y-axis + std::sort(points_.begin(), points_.end(), cmp); + +} + +void SweepContext::InitEdges(const std::vector& polyline) +{ + size_t num_points = polyline.size(); + for (size_t i = 0; i < num_points; i++) { + size_t j = i < num_points - 1 ? i + 1 : 0; + edge_list.push_back(new Edge(*polyline[i], *polyline[j])); + } +} + +Point* SweepContext::GetPoint(size_t index) +{ + return points_[index]; +} + +void SweepContext::AddToMap(Triangle* triangle) +{ + map_.push_back(triangle); +} + +Node* SweepContext::LocateNode(const Point& point) +{ + // TODO implement search tree + return front_->LocateNode(point.x); +} + +void SweepContext::CreateAdvancingFront() +{ + + // Initial triangle + Triangle* triangle = new Triangle(*points_[0], *head_, *tail_); + + map_.push_back(triangle); + + af_head_ = new Node(*triangle->GetPoint(1), *triangle); + af_middle_ = new Node(*triangle->GetPoint(0), *triangle); + af_tail_ = new Node(*triangle->GetPoint(2)); + front_ = new AdvancingFront(*af_head_, *af_tail_); + + // TODO: More intuitive if head is middles next and not previous? + // so swap head and tail + af_head_->next = af_middle_; + af_middle_->next = af_tail_; + af_middle_->prev = af_head_; + af_tail_->prev = af_middle_; +} + +void SweepContext::RemoveNode(Node* node) +{ + delete node; +} + +void SweepContext::MapTriangleToNodes(Triangle& t) +{ + for (int i = 0; i < 3; i++) { + if (!t.GetNeighbor(i)) { + Node* n = front_->LocatePoint(t.PointCW(*t.GetPoint(i))); + if (n) + n->triangle = &t; + } + } +} + +void SweepContext::RemoveFromMap(Triangle* triangle) +{ + map_.remove(triangle); +} + +void SweepContext::MeshClean(Triangle& triangle) +{ + std::vector triangles; + triangles.push_back(&triangle); + + while(!triangles.empty()){ + Triangle *t = triangles.back(); + triangles.pop_back(); + + if (t != nullptr && !t->IsInterior()) { + t->IsInterior(true); + triangles_.push_back(t); + for (int i = 0; i < 3; i++) { + if (!t->constrained_edge[i]) + triangles.push_back(t->GetNeighbor(i)); + } + } + } +} + +SweepContext::~SweepContext() +{ + + // Clean up memory + + delete head_; + delete tail_; + delete front_; + delete af_head_; + delete af_middle_; + delete af_tail_; + + for (auto ptr : map_) { + delete ptr; + } + + for (auto& i : edge_list) { + delete i; + } +} + +} // namespace p2t diff --git a/source/Libraries/poly2tri/sweep/sweep_context.h b/source/Libraries/poly2tri/sweep/sweep_context.h new file mode 100644 index 00000000..11d57394 --- /dev/null +++ b/source/Libraries/poly2tri/sweep/sweep_context.h @@ -0,0 +1,184 @@ +/* + * Poly2Tri Copyright (c) 2009-2022, Poly2Tri Contributors + * https://github.com/jhasse/poly2tri + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Poly2Tri nor the names of its contributors may be + * used to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include +#include +#include + +namespace p2t { + +// Inital triangle factor, seed triangle will extend 30% of +// PointSet width to both left and right. +const double kAlpha = 0.3; + +struct Point; +class Triangle; +struct Node; +struct Edge; +class AdvancingFront; + +class SweepContext { +public: + +/// Constructor +explicit SweepContext(std::vector polyline); +/// Destructor +~SweepContext(); + +void set_head(Point* p1); + +Point* head() const; + +void set_tail(Point* p1); + +Point* tail() const; + +size_t point_count() const; + +Node* LocateNode(const Point& point); + +void RemoveNode(Node* node); + +void CreateAdvancingFront(); + +/// Try to map a node to all sides of this triangle that don't have a neighbor +void MapTriangleToNodes(Triangle& t); + +void AddToMap(Triangle* triangle); + +Point* GetPoint(size_t index); + +Point* GetPoints(); + +void RemoveFromMap(Triangle* triangle); + +void AddHole(const std::vector& polyline); + +void AddPoint(Point* point); + +AdvancingFront* front() const; + +void MeshClean(Triangle& triangle); + +std::vector &GetTriangles(); +std::list &GetMap(); + +std::vector edge_list; + +struct Basin { + Node* left_node; + Node* bottom_node; + Node* right_node; + double width; + bool left_highest; + + Basin() + : left_node(nullptr), bottom_node(nullptr), right_node(nullptr), width(0.0), left_highest(false) + { + } + + void Clear() + { + left_node = nullptr; + bottom_node = nullptr; + right_node = nullptr; + width = 0.0; + left_highest = false; + } +}; + +struct EdgeEvent { + Edge* constrained_edge; + bool right; + + EdgeEvent() : constrained_edge(NULL), right(false) + { + } +}; + +Basin basin; +EdgeEvent edge_event; + +private: + +friend class Sweep; + +std::vector triangles_; +std::list map_; +std::vector points_; + +// Advancing front +AdvancingFront* front_; +// head point used with advancing front +Point* head_; +// tail point used with advancing front +Point* tail_; + +Node *af_head_, *af_middle_, *af_tail_; + +void InitTriangulation(); +void InitEdges(const std::vector& polyline); + +}; + +inline AdvancingFront* SweepContext::front() const +{ + return front_; +} + +inline size_t SweepContext::point_count() const +{ + return points_.size(); +} + +inline void SweepContext::set_head(Point* p1) +{ + head_ = p1; +} + +inline Point* SweepContext::head() const +{ + return head_; +} + +inline void SweepContext::set_tail(Point* p1) +{ + tail_ = p1; +} + +inline Point* SweepContext::tail() const +{ + return tail_; +} + +} diff --git a/tools/makeheaders b/tools/makeheaders old mode 100644 new mode 100755