mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-03 08:40:26 +02:00
Compare commits
83 Commits
Author | SHA1 | Date | |
---|---|---|---|
2bbfa178ea | |||
61682104df | |||
46542793d6 | |||
9f2d13a2b6 | |||
602a4050b5 | |||
54de743641 | |||
3e8d8440e3 | |||
8189b2338a | |||
0a77ef5dc2 | |||
19f0f707a6 | |||
83998f7471 | |||
b7bb4b5958 | |||
f28e442bfa | |||
4cd5c3489e | |||
52e4d72ae2 | |||
7241a49566 | |||
2db8c8728e | |||
270b2bec6e | |||
c83f28431b | |||
e60921f0cb | |||
92252f70d2 | |||
4e9d0db4be | |||
2bb2d3fe01 | |||
45ace61007 | |||
89d0717779 | |||
19819bd23a | |||
2894d9ab03 | |||
e56605d7ce | |||
f91be59811 | |||
0069837920 | |||
ad96fabe4a | |||
6ba6118b8c | |||
7f11d2f950 | |||
fe3e41e7ea | |||
4478b1f1ec | |||
3992129735 | |||
0dab737d60 | |||
330150854b | |||
6779ac83f9 | |||
f1504093d1 | |||
8482cc3db8 | |||
a4f94b7656 | |||
4299ee21d8 | |||
5b81694b1d | |||
66786d0059 | |||
9df2f0b944 | |||
c3571261ca | |||
bdcd27ab5b | |||
345285786f | |||
dda9b23c3d | |||
b349266855 | |||
ee2467d622 | |||
88ca26c418 | |||
8f44270e4a | |||
edc678f995 | |||
0faeea33c3 | |||
f86b9b93e8 | |||
a3ec3a88e8 | |||
7df45b4cf3 | |||
a2b6244f54 | |||
3983c29645 | |||
73e62f8676 | |||
fb4ee6ac93 | |||
91e4129615 | |||
54b82aad26 | |||
03dd8b0336 | |||
6e6b4a6f3c | |||
0110826ce9 | |||
4e52d547b2 | |||
9a439a3646 | |||
854e97f57c | |||
22f2c37322 | |||
94cb0cc19d | |||
9b52d6fb0d | |||
16a99c2079 | |||
bb7c06d32a | |||
a2884e4000 | |||
b284ea076b | |||
85081d6fe0 | |||
eafc282efd | |||
8c2ad025b1 | |||
a07cfc0f7a | |||
f725b68c57 |
156
.github/workflows/build.yml
vendored
156
.github/workflows/build.yml
vendored
@ -8,47 +8,46 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
linux-gl:
|
linux-gl:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
container:
|
|
||||||
image: ubuntu:bionic
|
|
||||||
env: { LANG: "C.UTF-8" }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
sudo apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake .
|
cmake . -DUSE_SDL2=OFF
|
||||||
make VERBOSE=1 -j2
|
make VERBOSE=1 -j2
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
ctest --output-on-failure
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
make DESTDIR=$PWD/_install install
|
make DESTDIR=$PWD/_install install
|
||||||
tar -c -I "gzip -9" -f irrlicht-linux.tar.gz -C ./_install/usr/local .
|
tar -c -I "gzip -9" -f irrlicht-linux.tar.gz -C ./_install/usr/local .
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: irrlicht-linux
|
name: irrlicht-linux
|
||||||
path: ./irrlicht-linux.tar.gz
|
path: ./irrlicht-linux.tar.gz
|
||||||
|
|
||||||
linux-gles:
|
linux-gles:
|
||||||
runs-on: ubuntu-latest
|
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||||
container:
|
runs-on: ubuntu-22.04
|
||||||
image: ubuntu:bionic
|
|
||||||
env: { LANG: "C.UTF-8" }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
sudo apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake . -DBUILD_EXAMPLES=1 -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON
|
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=OFF -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON
|
||||||
make -j2
|
make -j2
|
||||||
|
|
||||||
- name: Test (headless)
|
- name: Test (headless)
|
||||||
@ -62,20 +61,18 @@ jobs:
|
|||||||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
|
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
|
||||||
|
|
||||||
linux-sdl:
|
linux-sdl:
|
||||||
runs-on: ubuntu-latest
|
# something is wrong with the SDL cmake files on 20.04
|
||||||
container:
|
runs-on: ubuntu-22.04
|
||||||
image: ubuntu:jammy
|
|
||||||
env: { LANG: "C.UTF-8" }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=ON
|
cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=ON -DCMAKE_BUILD_TYPE=Debug
|
||||||
make -j2
|
make -j2
|
||||||
|
|
||||||
- name: Test (headless)
|
- name: Test (headless)
|
||||||
@ -84,16 +81,14 @@ jobs:
|
|||||||
./AutomatedTest null
|
./AutomatedTest null
|
||||||
|
|
||||||
linux-sdl-gl3:
|
linux-sdl-gl3:
|
||||||
runs-on: ubuntu-latest
|
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||||
container:
|
runs-on: ubuntu-22.04
|
||||||
image: ubuntu:jammy
|
|
||||||
env: { LANG: "C.UTF-8" }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@ -111,16 +106,14 @@ jobs:
|
|||||||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest opengl3
|
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest opengl3
|
||||||
|
|
||||||
linux-sdl-gles2:
|
linux-sdl-gles2:
|
||||||
runs-on: ubuntu-latest
|
# something is wrong with the SDL cmake files on 20.04
|
||||||
container:
|
runs-on: ubuntu-22.04
|
||||||
image: ubuntu:jammy
|
|
||||||
env: { LANG: "C.UTF-8" }
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
sudo apt-get update
|
||||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@ -139,7 +132,7 @@ jobs:
|
|||||||
|
|
||||||
mingw:
|
mingw:
|
||||||
name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
|
name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -149,22 +142,21 @@ jobs:
|
|||||||
- {variant: win32, arch: i686, extras: "-sdl"}
|
- {variant: win32, arch: i686, extras: "-sdl"}
|
||||||
- {variant: win64, arch: x86_64, extras: "-sdl"}
|
- {variant: win64, arch: x86_64, extras: "-sdl"}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install compiler
|
- name: Install compiler
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install cmake -qyy
|
sudo apt-get update && sudo apt-get install cmake -qyy
|
||||||
wget http://minetest.kitsunemimi.pw/mingw-w64-${{matrix.config.arch}}_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
|
./scripts/ci-get-mingw.sh
|
||||||
sudo tar -xaf mingw.tar.xz -C /usr
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
./scripts/ci-build-mingw.sh package
|
./scripts/ci-build-mingw.sh package
|
||||||
env:
|
env:
|
||||||
CC: ${{matrix.config.arch}}-w64-mingw32-gcc
|
CC: ${{matrix.config.arch}}-w64-mingw32-clang
|
||||||
CXX: ${{matrix.config.arch}}-w64-mingw32-g++
|
CXX: ${{matrix.config.arch}}-w64-mingw32-clang++
|
||||||
extras: ${{matrix.config.extras}}
|
extras: ${{matrix.config.extras}}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}
|
name: irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}
|
||||||
path: ./irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}.zip
|
path: ./irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}.zip
|
||||||
@ -172,7 +164,7 @@ jobs:
|
|||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
brew update
|
brew update
|
||||||
@ -187,13 +179,27 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
./bin/OSX/AutomatedTest null
|
./bin/OSX/AutomatedTest null
|
||||||
|
|
||||||
|
macos-sdl:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install cmake libpng jpeg sdl2
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1 -DUSE_SDL2=1
|
||||||
|
make -j3
|
||||||
|
|
||||||
msvc:
|
msvc:
|
||||||
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
|
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
env:
|
env:
|
||||||
VCPKG_VERSION: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44
|
VCPKG_VERSION: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50
|
||||||
# 2022.05.10
|
# 2023.10.19
|
||||||
vcpkg_packages: zlib libpng libjpeg-turbo opengl-registry
|
vcpkg_packages: zlib libpng libjpeg-turbo
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -210,6 +216,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
use: FALSE
|
use: FALSE
|
||||||
label: '(no SDL)'
|
label: '(no SDL)'
|
||||||
|
vcpkg_packages: opengl-registry
|
||||||
-
|
-
|
||||||
use: TRUE
|
use: TRUE
|
||||||
label: '(with SDL)'
|
label: '(with SDL)'
|
||||||
@ -217,7 +224,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Restore from cache and run vcpkg
|
- name: Restore from cache and run vcpkg
|
||||||
uses: lukka/run-vcpkg@v7
|
uses: lukka/run-vcpkg@v7
|
||||||
@ -250,7 +257,50 @@ jobs:
|
|||||||
run: move include artifact/
|
run: move include artifact/
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: msvc-${{ matrix.config.arch }}
|
name: msvc-${{ matrix.config.arch }}-${{matrix.sdl.use}}
|
||||||
path: artifact/
|
path: artifact/
|
||||||
|
|
||||||
|
android:
|
||||||
|
name: Android ${{ matrix.arch }}
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
env:
|
||||||
|
ndk_version: "r25c"
|
||||||
|
ANDROID_NDK: ${{ github.workspace }}/android-ndk
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
sudo rm /var/lib/man-db/auto-update
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -qyy wget unzip zip gcc-multilib make cmake
|
||||||
|
|
||||||
|
- name: Cache NDK
|
||||||
|
id: cache-ndk
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: android-ndk-${{ env.ndk_version }}-linux
|
||||||
|
path: ${{ env.ANDROID_NDK }}
|
||||||
|
|
||||||
|
- name: Install NDK
|
||||||
|
run: |
|
||||||
|
wget --progress=bar:force "http://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip"
|
||||||
|
unzip -q "android-ndk-${ndk_version}-linux.zip"
|
||||||
|
rm "android-ndk-${ndk_version}-linux.zip"
|
||||||
|
mv "android-ndk-${ndk_version}" "${ANDROID_NDK}"
|
||||||
|
if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./scripts/ci-build-android.sh ${{ matrix.arch }}
|
||||||
|
|
||||||
|
#- name: Upload Artifact
|
||||||
|
# uses: actions/upload-artifact@v4
|
||||||
|
# with:
|
||||||
|
# name: irrlicht-android-${{ matrix.arch }}
|
||||||
|
# path: ${{ runner.temp }}/pkg/${{ matrix.arch }}
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,6 +5,7 @@ install_manifest.txt
|
|||||||
IrrlichtMtConfig.cmake
|
IrrlichtMtConfig.cmake
|
||||||
IrrlichtMtConfigVersion.cmake
|
IrrlichtMtConfigVersion.cmake
|
||||||
IrrlichtMtTargets.cmake
|
IrrlichtMtTargets.cmake
|
||||||
|
CTestTestfile.cmake
|
||||||
Makefile
|
Makefile
|
||||||
libs/*
|
libs/*
|
||||||
*.so*
|
*.so*
|
||||||
@ -21,4 +22,4 @@ scripts/glext.h
|
|||||||
*visualstudio/
|
*visualstudio/
|
||||||
|
|
||||||
# vscode cmake plugin
|
# vscode cmake plugin
|
||||||
build/*
|
build/*
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
# >=3.9 enables IPO; >=3.11 prefers GLVND
|
set(IRRLICHTMT_REVISION 15)
|
||||||
if(${CMAKE_VERSION} VERSION_LESS 3.11)
|
|
||||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
|
||||||
else()
|
|
||||||
cmake_policy(VERSION 3.11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(IRRLICHTMT_REVISION 13)
|
|
||||||
|
|
||||||
project(Irrlicht
|
project(Irrlicht
|
||||||
VERSION 1.9.0.${IRRLICHTMT_REVISION}
|
VERSION 1.9.0.${IRRLICHTMT_REVISION}
|
||||||
@ -16,6 +9,9 @@ project(Irrlicht
|
|||||||
|
|
||||||
message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***")
|
message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
@ -38,7 +34,9 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
enable_testing()
|
||||||
add_subdirectory(source/Irrlicht)
|
add_subdirectory(source/Irrlicht)
|
||||||
|
add_subdirectory(test)
|
||||||
|
|
||||||
option(BUILD_EXAMPLES "Build example applications" FALSE)
|
option(BUILD_EXAMPLES "Build example applications" FALSE)
|
||||||
if(BUILD_EXAMPLES)
|
if(BUILD_EXAMPLES)
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
if(NOT TARGET IrrlichtMt::IrrlichtMt)
|
if(NOT TARGET IrrlichtMt::IrrlichtMt)
|
||||||
|
# private dependency only explicitly needed with static libs
|
||||||
|
if(@USE_SDL2@ AND NOT @BUILD_SHARED_LIBS@)
|
||||||
|
find_dependency(SDL2)
|
||||||
|
endif()
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
@ -15,6 +15,7 @@ The following libraries are required to be installed:
|
|||||||
* OpenGL
|
* OpenGL
|
||||||
* or on mobile: OpenGL ES (can be optionally enabled on desktop too)
|
* or on mobile: OpenGL ES (can be optionally enabled on desktop too)
|
||||||
* on Unix: X11
|
* on Unix: X11
|
||||||
|
* SDL2 (see below)
|
||||||
|
|
||||||
Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the following options are available:
|
Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the following options are available:
|
||||||
* `BUILD_SHARED_LIBS` (default: `ON`) - Build IrrlichtMt as a shared library
|
* `BUILD_SHARED_LIBS` (default: `ON`) - Build IrrlichtMt as a shared library
|
||||||
@ -23,7 +24,7 @@ Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the
|
|||||||
* `ENABLE_OPENGL3` (default: `OFF`) - Enable OpenGL 3+ driver
|
* `ENABLE_OPENGL3` (default: `OFF`) - Enable OpenGL 3+ driver
|
||||||
* `ENABLE_GLES1` - Enable OpenGL ES driver, legacy
|
* `ENABLE_GLES1` - Enable OpenGL ES driver, legacy
|
||||||
* `ENABLE_GLES2` - Enable OpenGL ES 2+ driver
|
* `ENABLE_GLES2` - Enable OpenGL ES 2+ driver
|
||||||
* `USE_SDL2` (default: `OFF`) - Use SDL2 instead of native platform device
|
* `USE_SDL2` (default: platform-dependent, usually `ON`) - Use SDL2 instead of older native device code
|
||||||
|
|
||||||
e.g. on a Linux system you might want to build for local use like this:
|
e.g. on a Linux system you might want to build for local use like this:
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ It is highly recommended to use vcpkg as package manager.
|
|||||||
|
|
||||||
After you successfully built vcpkg you can easily install the required libraries:
|
After you successfully built vcpkg you can easily install the required libraries:
|
||||||
|
|
||||||
vcpkg install zlib libjpeg-turbo libpng opengl-registry --triplet x64-windows
|
vcpkg install zlib libjpeg-turbo libpng sdl2 --triplet x64-windows
|
||||||
|
|
||||||
Run the following script in PowerShell:
|
Run the following script in PowerShell:
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
set(IRREXAMPLES
|
set(IRREXAMPLES
|
||||||
# removed
|
# removed
|
||||||
)
|
)
|
||||||
|
@ -206,37 +206,6 @@ namespace scene
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Append the meshbuffer to the current buffer
|
|
||||||
/** Only works for compatible types, i.e. either the same type
|
|
||||||
or the main buffer is of standard type. Otherwise, behavior is
|
|
||||||
undefined.
|
|
||||||
\param other Meshbuffer to be appended to this one.
|
|
||||||
*/
|
|
||||||
void append(const IMeshBuffer* const other) override
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (this==other)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const u32 vertexCount = getVertexCount();
|
|
||||||
u32 i;
|
|
||||||
|
|
||||||
Vertices.reallocate(vertexCount+other->getVertexCount());
|
|
||||||
for (i=0; i<other->getVertexCount(); ++i)
|
|
||||||
{
|
|
||||||
Vertices.push_back(reinterpret_cast<const T*>(other->getVertices())[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Indices.reallocate(getIndexCount()+other->getIndexCount());
|
|
||||||
for (i=0; i<other->getIndexCount(); ++i)
|
|
||||||
{
|
|
||||||
Indices.push_back(other->getIndices()[i]+vertexCount);
|
|
||||||
}
|
|
||||||
BoundingBox.addInternalBox(other->getBoundingBox());
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! get the current hardware mapping hint
|
//! get the current hardware mapping hint
|
||||||
E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
|
E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
|
||||||
{
|
{
|
||||||
|
@ -19,75 +19,9 @@ enum E_ATTRIBUTE_TYPE
|
|||||||
// float attribute
|
// float attribute
|
||||||
EAT_FLOAT,
|
EAT_FLOAT,
|
||||||
|
|
||||||
// string attribute
|
|
||||||
EAT_STRING,
|
|
||||||
|
|
||||||
// boolean attribute
|
// boolean attribute
|
||||||
EAT_BOOL,
|
EAT_BOOL,
|
||||||
|
|
||||||
// enumeration attribute
|
|
||||||
EAT_ENUM,
|
|
||||||
|
|
||||||
// color attribute
|
|
||||||
EAT_COLOR,
|
|
||||||
|
|
||||||
// floating point color attribute
|
|
||||||
EAT_COLORF,
|
|
||||||
|
|
||||||
// 3d vector attribute
|
|
||||||
EAT_VECTOR3D,
|
|
||||||
|
|
||||||
// 2d position attribute
|
|
||||||
EAT_POSITION2D,
|
|
||||||
|
|
||||||
// vector 2d attribute
|
|
||||||
EAT_VECTOR2D,
|
|
||||||
|
|
||||||
// rectangle attribute
|
|
||||||
EAT_RECT,
|
|
||||||
|
|
||||||
// matrix attribute
|
|
||||||
EAT_MATRIX,
|
|
||||||
|
|
||||||
// quaternion attribute
|
|
||||||
EAT_QUATERNION,
|
|
||||||
|
|
||||||
// 3d bounding box
|
|
||||||
EAT_BBOX,
|
|
||||||
|
|
||||||
// plane
|
|
||||||
EAT_PLANE,
|
|
||||||
|
|
||||||
// 3d triangle
|
|
||||||
EAT_TRIANGLE3D,
|
|
||||||
|
|
||||||
// line 2d
|
|
||||||
EAT_LINE2D,
|
|
||||||
|
|
||||||
// line 3d
|
|
||||||
EAT_LINE3D,
|
|
||||||
|
|
||||||
// array of stringws attribute
|
|
||||||
EAT_STRINGWARRAY,
|
|
||||||
|
|
||||||
// array of float
|
|
||||||
EAT_FLOATARRAY,
|
|
||||||
|
|
||||||
// array of int
|
|
||||||
EAT_INTARRAY,
|
|
||||||
|
|
||||||
// binary data attribute
|
|
||||||
EAT_BINARY,
|
|
||||||
|
|
||||||
// texture reference attribute
|
|
||||||
EAT_TEXTURE,
|
|
||||||
|
|
||||||
// user pointer void*
|
|
||||||
EAT_USER_POINTER,
|
|
||||||
|
|
||||||
// dimension attribute
|
|
||||||
EAT_DIMENSION2D,
|
|
||||||
|
|
||||||
// known attribute type count
|
// known attribute type count
|
||||||
EAT_COUNT,
|
EAT_COUNT,
|
||||||
|
|
||||||
|
@ -121,21 +121,6 @@ namespace video
|
|||||||
//! Support for texture coord transformation via texture matrix
|
//! Support for texture coord transformation via texture matrix
|
||||||
EVDF_TEXTURE_MATRIX,
|
EVDF_TEXTURE_MATRIX,
|
||||||
|
|
||||||
//! Support for DXTn compressed textures.
|
|
||||||
EVDF_TEXTURE_COMPRESSED_DXT,
|
|
||||||
|
|
||||||
//! Support for PVRTC compressed textures.
|
|
||||||
EVDF_TEXTURE_COMPRESSED_PVRTC,
|
|
||||||
|
|
||||||
//! Support for PVRTC2 compressed textures.
|
|
||||||
EVDF_TEXTURE_COMPRESSED_PVRTC2,
|
|
||||||
|
|
||||||
//! Support for ETC1 compressed textures.
|
|
||||||
EVDF_TEXTURE_COMPRESSED_ETC1,
|
|
||||||
|
|
||||||
//! Support for ETC2 compressed textures.
|
|
||||||
EVDF_TEXTURE_COMPRESSED_ETC2,
|
|
||||||
|
|
||||||
//! Support for cube map textures.
|
//! Support for cube map textures.
|
||||||
EVDF_TEXTURE_CUBEMAP,
|
EVDF_TEXTURE_CUBEMAP,
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#ifndef __E_MATERIAL_TYPES_H_INCLUDED__
|
#ifndef __E_MATERIAL_TYPES_H_INCLUDED__
|
||||||
#define __E_MATERIAL_TYPES_H_INCLUDED__
|
#define __E_MATERIAL_TYPES_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "irrTypes.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace video
|
namespace video
|
||||||
@ -67,6 +69,9 @@ namespace video
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr u32 numBuiltInMaterials =
|
||||||
|
sizeof(sBuiltInMaterialTypeNames) / sizeof(char*) - 1;
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
||||||
|
@ -6,25 +6,10 @@
|
|||||||
#define __I_ATTRIBUTES_H_INCLUDED__
|
#define __I_ATTRIBUTES_H_INCLUDED__
|
||||||
|
|
||||||
#include "IReferenceCounted.h"
|
#include "IReferenceCounted.h"
|
||||||
#include "SColor.h"
|
|
||||||
#include "vector3d.h"
|
|
||||||
#include "vector2d.h"
|
|
||||||
#include "line2d.h"
|
|
||||||
#include "line3d.h"
|
|
||||||
#include "triangle3d.h"
|
|
||||||
#include "position2d.h"
|
|
||||||
#include "rect.h"
|
|
||||||
#include "dimension2d.h"
|
|
||||||
#include "matrix4.h"
|
|
||||||
#include "quaternion.h"
|
|
||||||
#include "plane3d.h"
|
|
||||||
#include "triangle3d.h"
|
|
||||||
#include "line2d.h"
|
|
||||||
#include "line3d.h"
|
|
||||||
#include "irrString.h"
|
|
||||||
#include "irrArray.h"
|
|
||||||
#include "EAttributes.h"
|
#include "EAttributes.h"
|
||||||
#include "path.h"
|
|
||||||
|
// not needed here but I can't be bothered to clean the transitive includes up.
|
||||||
|
#include "quaternion.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -55,16 +40,6 @@ public:
|
|||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||||
virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) const = 0;
|
virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) const = 0;
|
||||||
|
|
||||||
//! Returns the type string of the attribute
|
|
||||||
//! \param attributeName: String for the attribute type
|
|
||||||
//! \param defaultNotFound Value returned when attributeName was not found
|
|
||||||
virtual const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const = 0;
|
|
||||||
|
|
||||||
//! Returns the type string of the attribute by index.
|
|
||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
|
||||||
//! \param defaultNotFound Value returned for an invalid index
|
|
||||||
virtual const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const = 0;
|
|
||||||
|
|
||||||
//! Returns if an attribute with a name exists
|
//! Returns if an attribute with a name exists
|
||||||
virtual bool existsAttribute(const c8* attributeName) const = 0;
|
virtual bool existsAttribute(const c8* attributeName) const = 0;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public:
|
|||||||
callback, baseMaterial, userData);
|
callback, baseMaterial, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
|
//! Like addHighLevelShaderMaterial(), but loads from files.
|
||||||
/** \param vertexShaderProgramFileName Text file containing the source
|
/** \param vertexShaderProgramFileName Text file containing the source
|
||||||
of the vertex shader program. Set to empty string if no vertex shader
|
of the vertex shader program. Set to empty string if no vertex shader
|
||||||
shall be created.
|
shall be created.
|
||||||
@ -279,7 +279,7 @@ public:
|
|||||||
callback, baseMaterial, userData);
|
callback, baseMaterial, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
|
//! Like addHighLevelShaderMaterial(), but loads from files.
|
||||||
/** \param vertexShaderProgram Text file handle containing the source
|
/** \param vertexShaderProgram Text file handle containing the source
|
||||||
of the vertex shader program. Set to 0 if no vertex shader shall be
|
of the vertex shader program. Set to 0 if no vertex shader shall be
|
||||||
created.
|
created.
|
||||||
@ -357,94 +357,14 @@ public:
|
|||||||
callback, baseMaterial, userData);
|
callback, baseMaterial, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Adds a new ASM shader material renderer to the VideoDriver
|
//! Delete a shader material and associated data.
|
||||||
/** Note that it is a good idea to call IVideoDriver::queryFeature() in
|
/**
|
||||||
advance to check if the IVideoDriver supports the vertex and/or pixel
|
After you have deleted a material it is invalid to still use and doing
|
||||||
shader version your are using.
|
so might result in a crash. The ID may be reused in the future when new
|
||||||
|
materials are added.
|
||||||
The material is added to the VideoDriver like with
|
\param material Number of the material type. Must not be a built-in
|
||||||
IVideoDriver::addMaterialRenderer() and can be used like it had been
|
material. */
|
||||||
added with that method.
|
virtual void deleteShaderMaterial(s32 material) = 0;
|
||||||
\param vertexShaderProgram String containing the source of the vertex
|
|
||||||
shader program. This can be 0 if no vertex program shall be used.
|
|
||||||
|
|
||||||
For DX8 programs, the will always input registers look like this: v0:
|
|
||||||
position, v1: normal, v2: color, v3: texture coordinates, v4: texture
|
|
||||||
coordinates 2 if available.
|
|
||||||
|
|
||||||
For DX9 programs, you can manually set the registers using the dcl_
|
|
||||||
statements.
|
|
||||||
\param pixelShaderProgram String containing the source of the pixel
|
|
||||||
shader program. This can be 0 if you don't want to use a pixel shader.
|
|
||||||
\param callback Pointer to an implementation of
|
|
||||||
IShaderConstantSetCallBack in which you can set the needed vertex and
|
|
||||||
pixel shader program constants. Set this to 0 if you don't need this.
|
|
||||||
\param baseMaterial Base material which renderstates will be used to
|
|
||||||
shade the material.
|
|
||||||
\param userData a user data int. This int can be set to any value and
|
|
||||||
will be set as parameter in the callback method when calling
|
|
||||||
OnSetConstants(). In this way it is easily possible to use the same
|
|
||||||
callback method for multiple materials and distinguish between them
|
|
||||||
during the call.
|
|
||||||
\return Returns the number of the material type which can be set in
|
|
||||||
SMaterial::MaterialType to use the renderer. -1 is returned if an
|
|
||||||
error occurred. -1 is returned for example if a vertex or pixel shader
|
|
||||||
program could not be compiled, the error strings are then printed out
|
|
||||||
into the error log, and can be caught with a custom event receiver. */
|
|
||||||
virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
|
|
||||||
const c8* pixelShaderProgram = 0,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData = 0) = 0;
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
|
|
||||||
/** \param vertexShaderProgram Text file containing the source of the
|
|
||||||
vertex shader program. Set to 0 if no shader shall be created.
|
|
||||||
\param pixelShaderProgram Text file containing the source of the pixel
|
|
||||||
shader program. Set to 0 if no shader shall be created.
|
|
||||||
\param callback Pointer to an IShaderConstantSetCallback object to
|
|
||||||
which the OnSetConstants function is called.
|
|
||||||
\param baseMaterial baseMaterial
|
|
||||||
\param userData a user data int. This int can be set to any value and
|
|
||||||
will be set as parameter in the callback method when calling
|
|
||||||
OnSetConstants(). In this way it is easily possible to use the same
|
|
||||||
callback method for multiple materials and distinguish between them
|
|
||||||
during the call.
|
|
||||||
\return Returns the number of the material type which can be set in
|
|
||||||
SMaterial::MaterialType to use the renderer. -1 is returned if an
|
|
||||||
error occurred. -1 is returned for example if a vertex or pixel shader
|
|
||||||
program could not be compiled, the error strings are then printed out
|
|
||||||
into the error log, and can be caught with a custom event receiver. */
|
|
||||||
virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
|
|
||||||
io::IReadFile* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData = 0) = 0;
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
|
|
||||||
/** \param vertexShaderProgramFileName Text file name containing the
|
|
||||||
source of the vertex shader program. Set to 0 if no shader shall be
|
|
||||||
created.
|
|
||||||
\param pixelShaderProgramFileName Text file name containing the source
|
|
||||||
of the pixel shader program. Set to 0 if no shader shall be created.
|
|
||||||
\param callback Pointer to an IShaderConstantSetCallback object on
|
|
||||||
which the OnSetConstants function is called.
|
|
||||||
\param baseMaterial baseMaterial
|
|
||||||
\param userData a user data int. This int can be set to any value and
|
|
||||||
will be set as parameter in the callback method when calling
|
|
||||||
OnSetConstants(). In this way it is easily possible to use the same
|
|
||||||
callback method for multiple materials and distinguish between them
|
|
||||||
during the call.
|
|
||||||
\return Returns the number of the material type which can be set in
|
|
||||||
SMaterial::MaterialType to use the renderer. -1 is returned if an
|
|
||||||
error occurred. -1 is returned for example if a vertex or pixel shader
|
|
||||||
program could not be compiled, the error strings are then printed out
|
|
||||||
into the error log, and can be caught with a custom event receiver. */
|
|
||||||
virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
|
|
||||||
const io::path& pixelShaderProgramFileName,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData = 0) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
103
include/IImage.h
103
include/IImage.h
@ -362,28 +362,6 @@ public:
|
|||||||
return 24;
|
return 24;
|
||||||
case ECF_A8R8G8B8:
|
case ECF_A8R8G8B8:
|
||||||
return 32;
|
return 32;
|
||||||
case ECF_DXT1:
|
|
||||||
return 16;
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
return 32;
|
|
||||||
case ECF_PVRTC_RGB2:
|
|
||||||
return 12;
|
|
||||||
case ECF_PVRTC_ARGB2:
|
|
||||||
case ECF_PVRTC2_ARGB2:
|
|
||||||
return 16;
|
|
||||||
case ECF_PVRTC_RGB4:
|
|
||||||
return 24;
|
|
||||||
case ECF_PVRTC_ARGB4:
|
|
||||||
case ECF_PVRTC2_ARGB4:
|
|
||||||
return 32;
|
|
||||||
case ECF_ETC1:
|
|
||||||
case ECF_ETC2_RGB:
|
|
||||||
return 24;
|
|
||||||
case ECF_ETC2_ARGB:
|
|
||||||
return 32;
|
|
||||||
case ECF_D16:
|
case ECF_D16:
|
||||||
return 16;
|
return 16;
|
||||||
case ECF_D32:
|
case ECF_D32:
|
||||||
@ -418,74 +396,17 @@ public:
|
|||||||
//! calculate image data size in bytes for selected format, width and height.
|
//! calculate image data size in bytes for selected format, width and height.
|
||||||
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
|
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
|
||||||
{
|
{
|
||||||
u32 imageSize = 0;
|
// non-compressed formats
|
||||||
|
u32 imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
|
||||||
switch (format)
|
imageSize *= height;
|
||||||
{
|
|
||||||
case ECF_DXT1:
|
|
||||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 8;
|
|
||||||
break;
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 16;
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC_RGB2:
|
|
||||||
case ECF_PVRTC_ARGB2:
|
|
||||||
imageSize = (core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC_RGB4:
|
|
||||||
case ECF_PVRTC_ARGB4:
|
|
||||||
imageSize = (core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC2_ARGB2:
|
|
||||||
imageSize = core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC2_ARGB4:
|
|
||||||
case ECF_ETC1:
|
|
||||||
case ECF_ETC2_RGB:
|
|
||||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
|
|
||||||
break;
|
|
||||||
case ECF_ETC2_ARGB:
|
|
||||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
|
|
||||||
break;
|
|
||||||
default: // uncompressed formats
|
|
||||||
imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
|
|
||||||
imageSize *= height;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return imageSize;
|
return imageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define to check for all compressed image formats cases in a switch
|
|
||||||
#define IRR_CASE_IIMAGE_COMPRESSED_FORMAT\
|
|
||||||
case ECF_DXT1:\
|
|
||||||
case ECF_DXT2:\
|
|
||||||
case ECF_DXT3:\
|
|
||||||
case ECF_DXT4:\
|
|
||||||
case ECF_DXT5:\
|
|
||||||
case ECF_PVRTC_RGB2:\
|
|
||||||
case ECF_PVRTC_ARGB2:\
|
|
||||||
case ECF_PVRTC2_ARGB2:\
|
|
||||||
case ECF_PVRTC_RGB4:\
|
|
||||||
case ECF_PVRTC_ARGB4:\
|
|
||||||
case ECF_PVRTC2_ARGB4:\
|
|
||||||
case ECF_ETC1:\
|
|
||||||
case ECF_ETC2_RGB:\
|
|
||||||
case ECF_ETC2_ARGB:
|
|
||||||
|
|
||||||
//! check if this is compressed color format
|
//! check if this is compressed color format
|
||||||
static bool isCompressedFormat(const ECOLOR_FORMAT format)
|
static bool isCompressedFormat(const ECOLOR_FORMAT format)
|
||||||
{
|
{
|
||||||
switch(format)
|
return false;
|
||||||
{
|
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! check if the color format is only viable for depth/stencil textures
|
//! check if the color format is only viable for depth/stencil textures
|
||||||
@ -523,22 +444,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
|
|
||||||
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
|
|
||||||
{
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case ECF_A1R5G5B5:
|
|
||||||
case ECF_R5G6B5:
|
|
||||||
case ECF_R8G8B8:
|
|
||||||
case ECF_A8R8G8B8:
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ECOLOR_FORMAT Format;
|
ECOLOR_FORMAT Format;
|
||||||
core::dimension2d<u32> Size;
|
core::dimension2d<u32> Size;
|
||||||
|
@ -73,27 +73,6 @@ public:
|
|||||||
filtered with these levels. If you want to be a text displayed,
|
filtered with these levels. If you want to be a text displayed,
|
||||||
independent on what level filter is set, use ELL_NONE. */
|
independent on what level filter is set, use ELL_NONE. */
|
||||||
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
||||||
virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
/** \param text: Text to print out.
|
|
||||||
\param hint: Additional info. This string is added after a " :" to the
|
|
||||||
string.
|
|
||||||
\param ll: Log level of the text. If the text is an error, set
|
|
||||||
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
|
|
||||||
is just an informational text, set it to ELL_INFORMATION. Texts are
|
|
||||||
filtered with these levels. If you want to be a text displayed,
|
|
||||||
independent on what level filter is set, use ELL_NONE. */
|
|
||||||
virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
/** \param text: Text to print out.
|
|
||||||
\param ll: Log level of the text. If the text is an error, set
|
|
||||||
it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it
|
|
||||||
is just an informational text, set it to ELL_INFORMATION. Texts are
|
|
||||||
filtered with these levels. If you want to be a text displayed,
|
|
||||||
independent on what level filter is set, use ELL_NONE. */
|
|
||||||
virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
@ -53,19 +53,8 @@ public:
|
|||||||
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) = 0;
|
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) = 0;
|
||||||
|
|
||||||
//! Uint interface for the above.
|
//! Uint interface for the above.
|
||||||
/* NOTE: UINT only works with GLSL, not supported for other shaders.
|
|
||||||
Also GLES drivers in Irrlicht do not support it as this needs at least GLES 3.0.
|
|
||||||
*/
|
|
||||||
virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) = 0;
|
virtual bool setVertexShaderConstant(s32 index, const u32* ints, int count) = 0;
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
/** Can be used if you created a shader using pixel/vertex shader
|
|
||||||
assembler or ARB_fragment_program or ARB_vertex_program.
|
|
||||||
\param data: Data to be set in the constants
|
|
||||||
\param startRegister: First register to be set
|
|
||||||
\param constantAmount: Amount of registers to be set. One register consists of 4 floats. */
|
|
||||||
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
|
|
||||||
|
|
||||||
//! Return an index constant for the pixel shader for the given uniform variable name
|
//! Return an index constant for the pixel shader for the given uniform variable name
|
||||||
virtual s32 getPixelShaderConstantID(const c8* name) = 0;
|
virtual s32 getPixelShaderConstantID(const c8* name) = 0;
|
||||||
|
|
||||||
@ -83,19 +72,8 @@ public:
|
|||||||
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) = 0;
|
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) = 0;
|
||||||
|
|
||||||
//! Uint interface for the above.
|
//! Uint interface for the above.
|
||||||
/* NOTE: UINT only works with GLSL, not supported for other shaders.
|
|
||||||
Also GLES drivers in Irrlicht do not support it as this needs at least GLES 3.0.
|
|
||||||
*/
|
|
||||||
virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) = 0;
|
virtual bool setPixelShaderConstant(s32 index, const u32* ints, int count) = 0;
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
/** Can be used if you created a shader using pixel/vertex shader
|
|
||||||
assembler or ARB_fragment_program or ARB_vertex_program.
|
|
||||||
\param data Data to be set in the constants
|
|
||||||
\param startRegister First register to be set.
|
|
||||||
\param constantAmount Amount of registers to be set. One register consists of 4 floats. */
|
|
||||||
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
|
|
||||||
|
|
||||||
//! Get pointer to the IVideoDriver interface
|
//! Get pointer to the IVideoDriver interface
|
||||||
/** \return Pointer to the IVideoDriver interface */
|
/** \return Pointer to the IVideoDriver interface */
|
||||||
virtual IVideoDriver* getVideoDriver() = 0;
|
virtual IVideoDriver* getVideoDriver() = 0;
|
||||||
|
@ -120,11 +120,6 @@ namespace scene
|
|||||||
\param numIndices Number of indices in array. */
|
\param numIndices Number of indices in array. */
|
||||||
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
|
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) = 0;
|
||||||
|
|
||||||
//! Append the meshbuffer to the current buffer
|
|
||||||
/** Only works for compatible vertex types
|
|
||||||
\param other Buffer to append to this one. */
|
|
||||||
virtual void append(const IMeshBuffer* const other) = 0;
|
|
||||||
|
|
||||||
//! get the current hardware mapping hint
|
//! get the current hardware mapping hint
|
||||||
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const = 0;
|
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const = 0;
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
#include "aabbox3d.h"
|
#include "aabbox3d.h"
|
||||||
#include "matrix4.h"
|
#include "matrix4.h"
|
||||||
#include "IAttributes.h"
|
#include "IAttributes.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -116,23 +118,14 @@ namespace scene
|
|||||||
|
|
||||||
//! Returns the name of the node.
|
//! Returns the name of the node.
|
||||||
/** \return Name as character string. */
|
/** \return Name as character string. */
|
||||||
virtual const c8* getName() const
|
virtual const std::optional<std::string> &getName() const
|
||||||
{
|
{
|
||||||
return Name.c_str();
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Sets the name of the node.
|
//! Sets the name of the node.
|
||||||
/** \param name New name of the scene node. */
|
/** \param name New name of the scene node. */
|
||||||
virtual void setName(const c8* name)
|
virtual void setName(const std::optional<std::string> &name)
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Sets the name of the node.
|
|
||||||
/** \param name New name of the scene node. */
|
|
||||||
virtual void setName(const core::stringc& name)
|
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
@ -275,31 +268,31 @@ namespace scene
|
|||||||
|
|
||||||
child->grab();
|
child->grab();
|
||||||
child->remove(); // remove from old parent
|
child->remove(); // remove from old parent
|
||||||
Children.push_back(child);
|
// Note: This iterator is not invalidated until we erase it.
|
||||||
|
child->ThisIterator = Children.insert(Children.end(), child);
|
||||||
child->Parent = this;
|
child->Parent = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Removes a child from this scene node.
|
//! Removes a child from this scene node.
|
||||||
/** If found in the children list, the child pointer is also
|
/**
|
||||||
dropped and might be deleted if no other grab exists.
|
|
||||||
\param child A pointer to the child which shall be removed.
|
\param child A pointer to the child which shall be removed.
|
||||||
\return True if the child was removed, and false if not,
|
\return True if the child was removed, and false if not,
|
||||||
e.g. because it couldn't be found in the children list. */
|
e.g. because it belongs to a different parent or no parent. */
|
||||||
virtual bool removeChild(ISceneNode* child)
|
virtual bool removeChild(ISceneNode* child)
|
||||||
{
|
{
|
||||||
ISceneNodeList::iterator it = Children.begin();
|
if (child->Parent != this)
|
||||||
for (; it != Children.end(); ++it)
|
return false;
|
||||||
if ((*it) == child)
|
|
||||||
{
|
|
||||||
(*it)->Parent = 0;
|
|
||||||
(*it)->drop();
|
|
||||||
Children.erase(it);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
// The iterator must be set since the parent is not null.
|
||||||
|
_IRR_DEBUG_BREAK_IF(!child->ThisIterator.has_value());
|
||||||
|
auto it = *child->ThisIterator;
|
||||||
|
child->ThisIterator = std::nullopt;
|
||||||
|
child->Parent = nullptr;
|
||||||
|
child->drop();
|
||||||
|
Children.erase(it);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -309,13 +302,11 @@ namespace scene
|
|||||||
*/
|
*/
|
||||||
virtual void removeAll()
|
virtual void removeAll()
|
||||||
{
|
{
|
||||||
ISceneNodeList::iterator it = Children.begin();
|
for (auto &child : Children) {
|
||||||
for (; it != Children.end(); ++it)
|
child->Parent = nullptr;
|
||||||
{
|
child->ThisIterator = std::nullopt;
|
||||||
(*it)->Parent = 0;
|
child->drop();
|
||||||
(*it)->drop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Children.clear();
|
Children.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,10 +499,8 @@ namespace scene
|
|||||||
grab();
|
grab();
|
||||||
remove();
|
remove();
|
||||||
|
|
||||||
Parent = newParent;
|
if (newParent)
|
||||||
|
newParent->addChild(this);
|
||||||
if (Parent)
|
|
||||||
Parent->addChild(this);
|
|
||||||
|
|
||||||
drop();
|
drop();
|
||||||
}
|
}
|
||||||
@ -604,7 +593,7 @@ namespace scene
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Name of the scene node.
|
//! Name of the scene node.
|
||||||
core::stringc Name;
|
std::optional<std::string> Name;
|
||||||
|
|
||||||
//! Absolute transformation of the node.
|
//! Absolute transformation of the node.
|
||||||
core::matrix4 AbsoluteTransformation;
|
core::matrix4 AbsoluteTransformation;
|
||||||
@ -618,12 +607,15 @@ namespace scene
|
|||||||
//! Relative scale of the scene node.
|
//! Relative scale of the scene node.
|
||||||
core::vector3df RelativeScale;
|
core::vector3df RelativeScale;
|
||||||
|
|
||||||
//! Pointer to the parent
|
|
||||||
ISceneNode* Parent;
|
|
||||||
|
|
||||||
//! List of all children of this node
|
//! List of all children of this node
|
||||||
std::list<ISceneNode*> Children;
|
std::list<ISceneNode*> Children;
|
||||||
|
|
||||||
|
//! Iterator pointing to this node in the parent's child list.
|
||||||
|
std::optional<ISceneNodeList::iterator> ThisIterator;
|
||||||
|
|
||||||
|
//! Pointer to the parent
|
||||||
|
ISceneNode* Parent;
|
||||||
|
|
||||||
//! Pointer to the scene manager
|
//! Pointer to the scene manager
|
||||||
ISceneManager* SceneManager;
|
ISceneManager* SceneManager;
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include "IAnimatedMesh.h"
|
#include "IAnimatedMesh.h"
|
||||||
#include "SSkinMeshBuffer.h"
|
#include "SSkinMeshBuffer.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace scene
|
namespace scene
|
||||||
@ -41,12 +43,12 @@ namespace scene
|
|||||||
/** \param number: Zero based index of joint. The last joint
|
/** \param number: Zero based index of joint. The last joint
|
||||||
has the number getJointCount()-1;
|
has the number getJointCount()-1;
|
||||||
\return Name of joint and null if an error happened. */
|
\return Name of joint and null if an error happened. */
|
||||||
virtual const c8* getJointName(u32 number) const = 0;
|
virtual const std::optional<std::string> &getJointName(u32 number) const = 0;
|
||||||
|
|
||||||
//! Gets a joint number from its name
|
//! Gets a joint number from its name
|
||||||
/** \param name: Name of the joint.
|
/** \param name: Name of the joint.
|
||||||
\return Number of the joint or -1 if not found. */
|
\return Number of the joint or std::nullopt if not found. */
|
||||||
virtual s32 getJointNumber(const c8* name) const = 0;
|
virtual std::optional<u32> getJointNumber(const std::string &name) const = 0;
|
||||||
|
|
||||||
//! Use animation from another mesh
|
//! Use animation from another mesh
|
||||||
/** The animation is linked (not copied) based on joint names
|
/** The animation is linked (not copied) based on joint names
|
||||||
@ -136,7 +138,7 @@ namespace scene
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! The name of this joint
|
//! The name of this joint
|
||||||
core::stringc Name;
|
std::optional<std::string> Name;
|
||||||
|
|
||||||
//! Local matrix of this joint
|
//! Local matrix of this joint
|
||||||
core::matrix4 LocalMatrix;
|
core::matrix4 LocalMatrix;
|
||||||
|
@ -292,11 +292,6 @@ public:
|
|||||||
{
|
{
|
||||||
case ECF_A8R8G8B8:
|
case ECF_A8R8G8B8:
|
||||||
case ECF_A1R5G5B5:
|
case ECF_A1R5G5B5:
|
||||||
case ECF_DXT1:
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
case ECF_A16B16G16R16F:
|
case ECF_A16B16G16R16F:
|
||||||
case ECF_A32B32G32R32F:
|
case ECF_A32B32G32R32F:
|
||||||
status = true;
|
status = true;
|
||||||
|
@ -869,7 +869,7 @@ namespace video
|
|||||||
//! Gets name of this video driver.
|
//! Gets name of this video driver.
|
||||||
/** \return Returns the name of the video driver, e.g. in case
|
/** \return Returns the name of the video driver, e.g. in case
|
||||||
of the Direct3D8 driver, it would return "Direct3D 8.1". */
|
of the Direct3D8 driver, it would return "Direct3D 8.1". */
|
||||||
virtual const wchar_t* getName() const =0;
|
virtual const char* getName() const =0;
|
||||||
|
|
||||||
//! Adds an external image loader to the engine.
|
//! Adds an external image loader to the engine.
|
||||||
/** This is useful if the Irrlicht Engine should be able to load
|
/** This is useful if the Irrlicht Engine should be able to load
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//! Identifies the IrrlichtMt fork customized for the Minetest engine
|
//! Identifies the IrrlichtMt fork customized for the Minetest engine
|
||||||
#define IRRLICHT_VERSION_MT_REVISION 13
|
#define IRRLICHT_VERSION_MT_REVISION 15
|
||||||
#define IRRLICHT_VERSION_MT "mt13"
|
#define IRRLICHT_VERSION_MT "mt15"
|
||||||
|
|
||||||
//! Irrlicht SDK Version
|
//! Irrlicht SDK Version
|
||||||
#define IRRLICHT_VERSION_MAJOR 1
|
#define IRRLICHT_VERSION_MAJOR 1
|
||||||
|
@ -177,6 +177,13 @@ namespace irr
|
|||||||
/** \return True if window is fullscreen. */
|
/** \return True if window is fullscreen. */
|
||||||
virtual bool isFullscreen() const = 0;
|
virtual bool isFullscreen() const = 0;
|
||||||
|
|
||||||
|
//! Checks if the window could possibly be visible.
|
||||||
|
//! Currently, this only returns false when the activity is stopped on
|
||||||
|
//! Android. Note that for Android activities, "stopped" means something
|
||||||
|
//! different than you might expect (and also something different than
|
||||||
|
//! "paused"). Read the Android lifecycle documentation.
|
||||||
|
virtual bool isWindowVisible() const { return true; };
|
||||||
|
|
||||||
//! Get the current color format of the window
|
//! Get the current color format of the window
|
||||||
/** \return Color format of the window. */
|
/** \return Color format of the window. */
|
||||||
virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
|
virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
|
||||||
|
@ -37,50 +37,6 @@ namespace video
|
|||||||
//! Warning: This tends to be BGRA in memory (it's ARGB on file, but with usual big-endian memory it's flipped)
|
//! Warning: This tends to be BGRA in memory (it's ARGB on file, but with usual big-endian memory it's flipped)
|
||||||
ECF_A8R8G8B8,
|
ECF_A8R8G8B8,
|
||||||
|
|
||||||
/** Compressed image formats. **/
|
|
||||||
|
|
||||||
//! DXT1 color format.
|
|
||||||
ECF_DXT1,
|
|
||||||
|
|
||||||
//! DXT2 color format.
|
|
||||||
ECF_DXT2,
|
|
||||||
|
|
||||||
//! DXT3 color format.
|
|
||||||
ECF_DXT3,
|
|
||||||
|
|
||||||
//! DXT4 color format.
|
|
||||||
ECF_DXT4,
|
|
||||||
|
|
||||||
//! DXT5 color format.
|
|
||||||
ECF_DXT5,
|
|
||||||
|
|
||||||
//! PVRTC RGB 2bpp.
|
|
||||||
ECF_PVRTC_RGB2,
|
|
||||||
|
|
||||||
//! PVRTC ARGB 2bpp.
|
|
||||||
ECF_PVRTC_ARGB2,
|
|
||||||
|
|
||||||
//! PVRTC RGB 4bpp.
|
|
||||||
ECF_PVRTC_RGB4,
|
|
||||||
|
|
||||||
//! PVRTC ARGB 4bpp.
|
|
||||||
ECF_PVRTC_ARGB4,
|
|
||||||
|
|
||||||
//! PVRTC2 ARGB 2bpp.
|
|
||||||
ECF_PVRTC2_ARGB2,
|
|
||||||
|
|
||||||
//! PVRTC2 ARGB 4bpp.
|
|
||||||
ECF_PVRTC2_ARGB4,
|
|
||||||
|
|
||||||
//! ETC1 RGB.
|
|
||||||
ECF_ETC1,
|
|
||||||
|
|
||||||
//! ETC2 RGB.
|
|
||||||
ECF_ETC2_RGB,
|
|
||||||
|
|
||||||
//! ETC2 ARGB.
|
|
||||||
ECF_ETC2_ARGB,
|
|
||||||
|
|
||||||
/** The following formats may only be used for render target textures. */
|
/** The following formats may only be used for render target textures. */
|
||||||
|
|
||||||
/** Floating point formats. */
|
/** Floating point formats. */
|
||||||
@ -139,20 +95,6 @@ namespace video
|
|||||||
"R5G6B5",
|
"R5G6B5",
|
||||||
"R8G8B8",
|
"R8G8B8",
|
||||||
"A8R8G8B8",
|
"A8R8G8B8",
|
||||||
"DXT1",
|
|
||||||
"DXT2",
|
|
||||||
"DXT3",
|
|
||||||
"DXT4",
|
|
||||||
"DXT5",
|
|
||||||
"PVRTC_RGB2",
|
|
||||||
"PVRTC_ARGB2",
|
|
||||||
"PVRTC_RGB4",
|
|
||||||
"PVRTC_ARGB4",
|
|
||||||
"PVRTC2_ARGB2",
|
|
||||||
"PVRTC2_ARGB4",
|
|
||||||
"ETC1",
|
|
||||||
"ETC2_RGB",
|
|
||||||
"ETC2_ARGB",
|
|
||||||
"R16F",
|
"R16F",
|
||||||
"G16R16F",
|
"G16R16F",
|
||||||
"A16B16G16R16F",
|
"A16B16G16R16F",
|
||||||
|
@ -193,16 +193,9 @@ namespace video
|
|||||||
EAAM_SIMPLE=1,
|
EAAM_SIMPLE=1,
|
||||||
//! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode
|
//! High-quality anti-aliasing, not always supported, automatically enables SIMPLE mode
|
||||||
EAAM_QUALITY=3,
|
EAAM_QUALITY=3,
|
||||||
//! Line smoothing
|
|
||||||
//! Careful, enabling this can lead to software emulation under OpenGL
|
|
||||||
EAAM_LINE_SMOOTH=4,
|
|
||||||
//! point smoothing, often in software and slow, only with OpenGL
|
|
||||||
EAAM_POINT_SMOOTH=8,
|
|
||||||
//! All typical anti-alias and smooth modes
|
|
||||||
EAAM_FULL_BASIC=15,
|
|
||||||
//! Enhanced anti-aliasing for transparent materials
|
//! Enhanced anti-aliasing for transparent materials
|
||||||
/** Usually used with EMT_TRANSPARENT_ALPHA_CHANNEL_REF and multisampling. */
|
/** Usually used with EMT_TRANSPARENT_ALPHA_CHANNEL_REF and multisampling. */
|
||||||
EAAM_ALPHA_TO_COVERAGE=16
|
EAAM_ALPHA_TO_COVERAGE=4
|
||||||
};
|
};
|
||||||
|
|
||||||
//! These flags allow to define the interpretation of vertex color when lighting is enabled
|
//! These flags allow to define the interpretation of vertex color when lighting is enabled
|
||||||
|
@ -330,9 +330,6 @@ struct SSkinMeshBuffer : public IMeshBuffer
|
|||||||
//! append the vertices and indices to the current buffer
|
//! append the vertices and indices to the current buffer
|
||||||
void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) override {}
|
void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) override {}
|
||||||
|
|
||||||
//! append the meshbuffer to the current buffer
|
|
||||||
void append(const IMeshBuffer* const other) override {}
|
|
||||||
|
|
||||||
//! get the current hardware mapping hint for vertex buffers
|
//! get the current hardware mapping hint for vertex buffers
|
||||||
E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
|
E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,7 @@ public:
|
|||||||
/** \return Size of elements in the array which are actually occupied. */
|
/** \return Size of elements in the array which are actually occupied. */
|
||||||
u32 size() const
|
u32 size() const
|
||||||
{
|
{
|
||||||
return m_data.size();
|
return static_cast<u32>(m_data.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ public:
|
|||||||
// *it = first element in [first, last) that is >= element, or last if not found.
|
// *it = first element in [first, last) that is >= element, or last if not found.
|
||||||
if (*it < element || element < *it)
|
if (*it < element || element < *it)
|
||||||
return -1;
|
return -1;
|
||||||
return it - m_data.begin();
|
return static_cast<u32>(it - m_data.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -335,8 +335,8 @@ public:
|
|||||||
auto iters = std::equal_range(m_data.begin(), m_data.end(), element);
|
auto iters = std::equal_range(m_data.begin(), m_data.end(), element);
|
||||||
if (iters.first == iters.second)
|
if (iters.first == iters.second)
|
||||||
return -1;
|
return -1;
|
||||||
last = (iters.second - m_data.begin()) - 1;
|
last = static_cast<s32>((iters.second - m_data.begin()) - 1);
|
||||||
return iters.first - m_data.begin();
|
return static_cast<s32>(iters.first - m_data.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ public:
|
|||||||
auto it = std::find(m_data.begin(), m_data.end(), element);
|
auto it = std::find(m_data.begin(), m_data.end(), element);
|
||||||
if (it == m_data.end())
|
if (it == m_data.end())
|
||||||
return -1;
|
return -1;
|
||||||
return it - m_data.begin();
|
return static_cast<u32>(it - m_data.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "irrTypes.h"
|
#include "irrTypes.h"
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <stdlib.h> // for abs() etc.
|
#include <cstdlib> // for abs() etc.
|
||||||
#include <limits.h> // For INT_MAX / UINT_MAX
|
#include <limits.h> // For INT_MAX / UINT_MAX
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -17,9 +18,6 @@ namespace core
|
|||||||
|
|
||||||
//! Rounding error constant often used when comparing f32 values.
|
//! Rounding error constant often used when comparing f32 values.
|
||||||
|
|
||||||
const s32 ROUNDING_ERROR_S32 = 0;
|
|
||||||
|
|
||||||
const s64 ROUNDING_ERROR_S64 = 0;
|
|
||||||
const f32 ROUNDING_ERROR_f32 = 0.000001f;
|
const f32 ROUNDING_ERROR_f32 = 0.000001f;
|
||||||
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||||
|
|
||||||
@ -170,30 +168,6 @@ namespace core
|
|||||||
return ROUNDING_ERROR_f64;
|
return ROUNDING_ERROR_f64;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
|
||||||
inline s32 roundingError()
|
|
||||||
{
|
|
||||||
return ROUNDING_ERROR_S32;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline u32 roundingError()
|
|
||||||
{
|
|
||||||
return ROUNDING_ERROR_S32;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline s64 roundingError()
|
|
||||||
{
|
|
||||||
return ROUNDING_ERROR_S64;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline u64 roundingError()
|
|
||||||
{
|
|
||||||
return ROUNDING_ERROR_S64;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T relativeErrorFactor()
|
inline T relativeErrorFactor()
|
||||||
{
|
{
|
||||||
@ -212,13 +186,19 @@ namespace core
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! returns if a equals b, taking possible rounding errors into account
|
//! returns if a equals b, for types without rounding errors
|
||||||
template <class T>
|
template <class T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
|
||||||
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
|
inline bool equals(const T a, const T b)
|
||||||
{
|
{
|
||||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
return a == b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! returns if a equals b, taking possible rounding errors into account
|
||||||
|
template <class T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
|
||||||
|
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
|
||||||
|
{
|
||||||
|
return std::abs(a - b) <= tolerance;
|
||||||
|
}
|
||||||
|
|
||||||
//! returns if a equals b, taking relative error in form of factor
|
//! returns if a equals b, taking relative error in form of factor
|
||||||
//! this particular function does not involve any division.
|
//! this particular function does not involve any division.
|
||||||
|
@ -266,7 +266,7 @@ public:
|
|||||||
the trailing NUL. */
|
the trailing NUL. */
|
||||||
u32 size() const
|
u32 size() const
|
||||||
{
|
{
|
||||||
return str.size();
|
return static_cast<u32>(str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Informs if the string is empty or not.
|
//! Informs if the string is empty or not.
|
||||||
@ -834,7 +834,7 @@ public:
|
|||||||
if (!delimiter)
|
if (!delimiter)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const u32 oldSize=ret.size();
|
const u32 oldSize=static_cast<u32>(ret.size());
|
||||||
|
|
||||||
u32 tokenStartIdx = 0;
|
u32 tokenStartIdx = 0;
|
||||||
for (u32 i=0; i<size()+1; ++i)
|
for (u32 i=0; i<size()+1; ++i)
|
||||||
@ -862,7 +862,7 @@ public:
|
|||||||
else if (!ignoreEmptyTokens)
|
else if (!ignoreEmptyTokens)
|
||||||
ret.push_back(string<T>());
|
ret.push_back(string<T>());
|
||||||
|
|
||||||
return ret.size()-oldSize;
|
return static_cast<u32>(ret.size()-oldSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function should not be used and is only kept for "CGUIFileOpenDialog::pathToStringW".
|
// This function should not be used and is only kept for "CGUIFileOpenDialog::pathToStringW".
|
||||||
@ -888,10 +888,10 @@ private:
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
static inline u32 calclen(const char* p) {
|
static inline u32 calclen(const char* p) {
|
||||||
return strlen(p);
|
return static_cast<u32>(strlen(p));
|
||||||
}
|
}
|
||||||
static inline u32 calclen(const wchar_t* p) {
|
static inline u32 calclen(const wchar_t* p) {
|
||||||
return wcslen(p);
|
return static_cast<u32>(wcslen(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
//! strcmp wrapper
|
//! strcmp wrapper
|
||||||
|
3611
include/irrUString.h
3611
include/irrUString.h
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@
|
|||||||
#include <KHR/khrplatform.h>
|
#include <KHR/khrplatform.h>
|
||||||
|
|
||||||
#ifndef APIENTRY
|
#ifndef APIENTRY
|
||||||
#define APIENTRY
|
#define APIENTRY KHRONOS_APIENTRY
|
||||||
#endif
|
#endif
|
||||||
#ifndef APIENTRYP
|
#ifndef APIENTRYP
|
||||||
#define APIENTRYP APIENTRY *
|
#define APIENTRYP APIENTRY *
|
||||||
@ -705,7 +705,6 @@ private:
|
|||||||
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT) (GLenum mode, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
|
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT) (GLenum mode, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
|
||||||
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT) (GLenum mode, GLenum type, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
|
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT) (GLenum mode, GLenum type, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
|
||||||
typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC_MT) (GLfloat factor, GLfloat units, GLfloat clamp);
|
typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC_MT) (GLfloat factor, GLfloat units, GLfloat clamp);
|
||||||
typedef void (APIENTRYP PFNGLGENPERFMONITORSEXPROC_MT) (GLsizei n, GLuint * monitors);
|
|
||||||
typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC_MT) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
|
typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC_MT) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
|
||||||
typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEPROC_MT) (GLuint texture);
|
typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEPROC_MT) (GLuint texture);
|
||||||
typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEPROC_MT) (GLuint texture, GLuint sampler);
|
typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEPROC_MT) (GLuint texture, GLuint sampler);
|
||||||
@ -781,9 +780,9 @@ public:
|
|||||||
// Call this once after creating the context.
|
// Call this once after creating the context.
|
||||||
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
||||||
// Check if an extension is supported.
|
// Check if an extension is supported.
|
||||||
inline bool IsExtensionPresent(const std::string &ext)
|
inline bool IsExtensionPresent(const std::string &ext) const
|
||||||
{
|
{
|
||||||
return extensions.find(ext) != extensions.end();
|
return extensions.count(ext) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PFNGLCULLFACEPROC_MT CullFace = NULL;
|
PFNGLCULLFACEPROC_MT CullFace = NULL;
|
||||||
@ -1436,7 +1435,6 @@ public:
|
|||||||
PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT MultiDrawArraysIndirectCount = NULL;
|
PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT MultiDrawArraysIndirectCount = NULL;
|
||||||
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT MultiDrawElementsIndirectCount = NULL;
|
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT MultiDrawElementsIndirectCount = NULL;
|
||||||
PFNGLPOLYGONOFFSETCLAMPPROC_MT PolygonOffsetClamp = NULL;
|
PFNGLPOLYGONOFFSETCLAMPPROC_MT PolygonOffsetClamp = NULL;
|
||||||
PFNGLGENPERFMONITORSEXPROC_MT GenPerfMonitorsEX = NULL;
|
|
||||||
PFNGLPRIMITIVEBOUNDINGBOXPROC_MT PrimitiveBoundingBox = NULL;
|
PFNGLPRIMITIVEBOUNDINGBOXPROC_MT PrimitiveBoundingBox = NULL;
|
||||||
PFNGLGETTEXTUREHANDLEPROC_MT GetTextureHandle = NULL;
|
PFNGLGETTEXTUREHANDLEPROC_MT GetTextureHandle = NULL;
|
||||||
PFNGLGETTEXTURESAMPLERHANDLEPROC_MT GetTextureSamplerHandle = NULL;
|
PFNGLGETTEXTURESAMPLERHANDLEPROC_MT GetTextureSamplerHandle = NULL;
|
||||||
@ -3020,6 +3018,16 @@ public:
|
|||||||
static constexpr const GLenum TEXTURE_SRGB_DECODE = 0x8A48;
|
static constexpr const GLenum TEXTURE_SRGB_DECODE = 0x8A48;
|
||||||
static constexpr const GLenum DECODE = 0x8A49;
|
static constexpr const GLenum DECODE = 0x8A49;
|
||||||
static constexpr const GLenum SKIP_DECODE = 0x8A4A;
|
static constexpr const GLenum SKIP_DECODE = 0x8A4A;
|
||||||
|
static constexpr const GLenum ALPHA8 = 0x803C;
|
||||||
|
static constexpr const GLenum LUMINANCE8 = 0x8040;
|
||||||
|
static constexpr const GLenum LUMINANCE8_ALPHA8 = 0x8045;
|
||||||
|
static constexpr const GLenum ALPHA32F = 0x8816;
|
||||||
|
static constexpr const GLenum LUMINANCE32F = 0x8818;
|
||||||
|
static constexpr const GLenum LUMINANCE_ALPHA32F = 0x8819;
|
||||||
|
static constexpr const GLenum ALPHA16F = 0x881C;
|
||||||
|
static constexpr const GLenum LUMINANCE16F = 0x881E;
|
||||||
|
static constexpr const GLenum LUMINANCE_ALPHA16F = 0x881F;
|
||||||
|
static constexpr const GLenum BGRA8 = 0x93A1;
|
||||||
static constexpr const GLenum INCLUSIVE = 0x8F10;
|
static constexpr const GLenum INCLUSIVE = 0x8F10;
|
||||||
static constexpr const GLenum EXCLUSIVE = 0x8F11;
|
static constexpr const GLenum EXCLUSIVE = 0x8F11;
|
||||||
static constexpr const GLenum WINDOW_RECTANGLE = 0x8F12;
|
static constexpr const GLenum WINDOW_RECTANGLE = 0x8F12;
|
||||||
@ -3044,10 +3052,7 @@ public:
|
|||||||
static constexpr const GLenum GEOMETRY_LINKED_VERTICES_OUT = 0x8916;
|
static constexpr const GLenum GEOMETRY_LINKED_VERTICES_OUT = 0x8916;
|
||||||
static constexpr const GLenum GEOMETRY_LINKED_INPUT_TYPE = 0x8917;
|
static constexpr const GLenum GEOMETRY_LINKED_INPUT_TYPE = 0x8917;
|
||||||
static constexpr const GLenum GEOMETRY_LINKED_OUTPUT_TYPE = 0x8918;
|
static constexpr const GLenum GEOMETRY_LINKED_OUTPUT_TYPE = 0x8918;
|
||||||
static constexpr const GLenum ALPHA8 = 0x803C;
|
|
||||||
static constexpr const GLenum LUMINANCE4_ALPHA4 = 0x8043;
|
static constexpr const GLenum LUMINANCE4_ALPHA4 = 0x8043;
|
||||||
static constexpr const GLenum LUMINANCE8_ALPHA8 = 0x8045;
|
|
||||||
static constexpr const GLenum LUMINANCE8 = 0x8040;
|
|
||||||
static constexpr const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET = 0x8CD4;
|
static constexpr const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET = 0x8CD4;
|
||||||
static constexpr const GLenum COMPRESSED_RGBA_ASTC_3x3x3 = 0x93C0;
|
static constexpr const GLenum COMPRESSED_RGBA_ASTC_3x3x3 = 0x93C0;
|
||||||
static constexpr const GLenum COMPRESSED_RGBA_ASTC_4x3x3 = 0x93C1;
|
static constexpr const GLenum COMPRESSED_RGBA_ASTC_4x3x3 = 0x93C1;
|
||||||
@ -3070,7 +3075,6 @@ public:
|
|||||||
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5 = 0x93E8;
|
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5 = 0x93E8;
|
||||||
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6 = 0x93E9;
|
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6 = 0x93E9;
|
||||||
static constexpr const GLenum INT_10_10_10_2 = 0x8DF7;
|
static constexpr const GLenum INT_10_10_10_2 = 0x8DF7;
|
||||||
static constexpr const GLenum BGRA8 = 0x93A1;
|
|
||||||
static constexpr const GLenum MALI_PROGRAM_BINARY_ARM = 0x8F61;
|
static constexpr const GLenum MALI_PROGRAM_BINARY_ARM = 0x8F61;
|
||||||
static constexpr const GLenum MALI_SHADER_BINARY_ARM = 0x8F60;
|
static constexpr const GLenum MALI_SHADER_BINARY_ARM = 0x8F60;
|
||||||
static constexpr const GLenum FETCH_PER_SAMPLE_ARM = 0x8F65;
|
static constexpr const GLenum FETCH_PER_SAMPLE_ARM = 0x8F65;
|
||||||
@ -3080,8 +3084,37 @@ public:
|
|||||||
static constexpr const GLenum SMAPHS_PROGRAM_BINARY_DMP = 0x9252;
|
static constexpr const GLenum SMAPHS_PROGRAM_BINARY_DMP = 0x9252;
|
||||||
static constexpr const GLenum DMP_PROGRAM_BINARY_DMP = 0x9253;
|
static constexpr const GLenum DMP_PROGRAM_BINARY_DMP = 0x9253;
|
||||||
static constexpr const GLenum SHADER_BINARY_DMP = 0x9250;
|
static constexpr const GLenum SHADER_BINARY_DMP = 0x9250;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION = 0x96C0;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_NONE = 0x96C1;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_DEFAULT = 0x96C2;
|
||||||
static constexpr const GLenum SAMPLER_EXTERNAL_2D_Y2Y = 0x8BE7;
|
static constexpr const GLenum SAMPLER_EXTERNAL_2D_Y2Y = 0x8BE7;
|
||||||
static constexpr const GLenum GPU_DISJOINT = 0x8FBB;
|
static constexpr const GLenum GPU_DISJOINT = 0x8FBB;
|
||||||
|
static constexpr const GLenum SHADING_RATE_1X1_PIXELS = 0x96A6;
|
||||||
|
static constexpr const GLenum SHADING_RATE_1X2_PIXELS = 0x96A7;
|
||||||
|
static constexpr const GLenum SHADING_RATE_2X1_PIXELS = 0x96A8;
|
||||||
|
static constexpr const GLenum SHADING_RATE_2X2_PIXELS = 0x96A9;
|
||||||
|
static constexpr const GLenum SHADING_RATE_1X4_PIXELS = 0x96AA;
|
||||||
|
static constexpr const GLenum SHADING_RATE_4X1_PIXELS = 0x96AB;
|
||||||
|
static constexpr const GLenum SHADING_RATE_4X2_PIXELS = 0x96AC;
|
||||||
|
static constexpr const GLenum SHADING_RATE_2X4_PIXELS = 0x96AD;
|
||||||
|
static constexpr const GLenum SHADING_RATE_4X4_PIXELS = 0x96AE;
|
||||||
|
static constexpr const GLenum SHADING_RATE = 0x96D0;
|
||||||
|
static constexpr const GLenum SHADING_RATE_ATTACHMENT = 0x96D1;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP = 0x96D2;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE = 0x96D3;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MIN = 0x96D4;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MAX = 0x96D5;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MUL = 0x96D6;
|
||||||
|
static constexpr const GLenum MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH = 0x96D7;
|
||||||
|
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH = 0x96D8;
|
||||||
|
static constexpr const GLenum MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT = 0x96D9;
|
||||||
|
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT = 0x96DA;
|
||||||
|
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_ASPECT_RATIO = 0x96DB;
|
||||||
|
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_LAYERS = 0x96DC;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_WITH_SHADER_DEPTH_STENCIL_WRITES_SUPPORTED = 0x96DD;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_WITH_SAMPLE_MASK_SUPPORTED = 0x96DE;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_ATTACHMENT_WITH_DEFAULT_FRAMEBUFFER_SUPPORTED = 0x96DF;
|
||||||
|
static constexpr const GLenum FRAGMENT_SHADING_RATE_NON_TRIVIAL_COMBINERS_SUPPORTED = 0x8F6F;
|
||||||
static constexpr const GLenum TEXTURE_TILING = 0x9580;
|
static constexpr const GLenum TEXTURE_TILING = 0x9580;
|
||||||
static constexpr const GLenum DEDICATED_MEMORY_OBJECT = 0x9581;
|
static constexpr const GLenum DEDICATED_MEMORY_OBJECT = 0x9581;
|
||||||
static constexpr const GLenum PROTECTED_MEMORY_OBJECT = 0x959B;
|
static constexpr const GLenum PROTECTED_MEMORY_OBJECT = 0x959B;
|
||||||
@ -3136,12 +3169,19 @@ public:
|
|||||||
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E;
|
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E;
|
||||||
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F;
|
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F;
|
||||||
static constexpr const GLenum TEXTURE_FORMAT_SRGB_OVERRIDE = 0x8FBF;
|
static constexpr const GLenum TEXTURE_FORMAT_SRGB_OVERRIDE = 0x8FBF;
|
||||||
static constexpr const GLenum ALPHA32F = 0x8816;
|
static constexpr const GLenum NUM_SURFACE_COMPRESSION_FIXED_RATES = 0x8F6E;
|
||||||
static constexpr const GLenum LUMINANCE32F = 0x8818;
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_1BPC = 0x96C4;
|
||||||
static constexpr const GLenum LUMINANCE_ALPHA32F = 0x8819;
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_2BPC = 0x96C5;
|
||||||
static constexpr const GLenum ALPHA16F = 0x881C;
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_3BPC = 0x96C6;
|
||||||
static constexpr const GLenum LUMINANCE16F = 0x881E;
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_4BPC = 0x96C7;
|
||||||
static constexpr const GLenum LUMINANCE_ALPHA16F = 0x881F;
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_5BPC = 0x96C8;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_6BPC = 0x96C9;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_7BPC = 0x96CA;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_8BPC = 0x96CB;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_9BPC = 0x96CC;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_10BPC = 0x96CD;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_11BPC = 0x96CE;
|
||||||
|
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_12BPC = 0x96CF;
|
||||||
static constexpr const GLenum GCCSO_SHADER_BINARY_FJ = 0x9260;
|
static constexpr const GLenum GCCSO_SHADER_BINARY_FJ = 0x9260;
|
||||||
static constexpr const GLenum STATE_RESTORE = 0x8BDC;
|
static constexpr const GLenum STATE_RESTORE = 0x8BDC;
|
||||||
static constexpr const GLenum SHADER_BINARY_VIV = 0x8FC4;
|
static constexpr const GLenum SHADER_BINARY_VIV = 0x8FC4;
|
||||||
@ -3151,5 +3191,5 @@ public:
|
|||||||
static constexpr const GLenum NONE = 0;
|
static constexpr const GLenum NONE = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Global GL procedures object.
|
// Global GL procedures object.
|
||||||
IRRLICHT_API extern OpenGLProcedures GL;
|
IRRLICHT_API extern OpenGLProcedures GL;
|
||||||
|
@ -17,6 +17,9 @@ namespace io
|
|||||||
*/
|
*/
|
||||||
typedef core::string<fschar_t> path;
|
typedef core::string<fschar_t> path;
|
||||||
|
|
||||||
|
// Type only exists for historcal reasons, paths are always char now.
|
||||||
|
static_assert(sizeof(fschar_t) == sizeof(char));
|
||||||
|
|
||||||
//! Used in places where we identify objects by a filename, but don't actually work with the real filename
|
//! Used in places where we identify objects by a filename, but don't actually work with the real filename
|
||||||
/** Irrlicht is internally not case-sensitive when it comes to names.
|
/** Irrlicht is internally not case-sensitive when it comes to names.
|
||||||
Also this class is a first step towards support for correctly serializing renamed objects.
|
Also this class is a first step towards support for correctly serializing renamed objects.
|
||||||
@ -62,11 +65,6 @@ struct SNamedPath
|
|||||||
{
|
{
|
||||||
return core::stringc(getPath());
|
return core::stringc(getPath());
|
||||||
}
|
}
|
||||||
//! Implicit cast to io::path
|
|
||||||
operator core::stringw() const
|
|
||||||
{
|
|
||||||
return core::stringw(getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// convert the given path string to a name string.
|
// convert the given path string to a name string.
|
||||||
|
@ -75,47 +75,47 @@ public:
|
|||||||
return *(&X+index);
|
return *(&X+index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y. Equality with rounding tolerance.
|
//! sort in order X, Y.
|
||||||
bool operator<=(const vector2d<T>&other) const
|
bool operator<=(const vector2d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X<other.X || core::equals(X, other.X)) ||
|
return !(*this > other);
|
||||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y. Equality with rounding tolerance.
|
//! sort in order X, Y.
|
||||||
bool operator>=(const vector2d<T>&other) const
|
bool operator>=(const vector2d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X>other.X || core::equals(X, other.X)) ||
|
return !(*this < other);
|
||||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
//! sort in order X, Y.
|
||||||
bool operator<(const vector2d<T>&other) const
|
bool operator<(const vector2d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X<other.X && !core::equals(X, other.X)) ||
|
return X < other.X || (X == other.X && Y < other.Y);
|
||||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
//! sort in order X, Y.
|
||||||
bool operator>(const vector2d<T>&other) const
|
bool operator>(const vector2d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X>other.X && !core::equals(X, other.X)) ||
|
return X > other.X || (X == other.X && Y > other.Y);
|
||||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const vector2d<T>& other) const { return equals(other); }
|
bool operator==(const vector2d<T>& other) const {
|
||||||
bool operator!=(const vector2d<T>& other) const { return !equals(other); }
|
return X == other.X && Y == other.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const vector2d<T>& other) const {
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
//! Checks if this vector equals the other one.
|
//! Checks if this vector equals the other one.
|
||||||
/** Takes floating point rounding errors into account.
|
/** Takes floating point rounding errors into account.
|
||||||
\param other Vector to compare with.
|
\param other Vector to compare with.
|
||||||
\param tolerance Epsilon value for both - comparing X and Y.
|
|
||||||
\return True if the two vector are (almost) equal, else false. */
|
\return True if the two vector are (almost) equal, else false. */
|
||||||
bool equals(const vector2d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
|
bool equals(const vector2d<T>& other) const
|
||||||
{
|
{
|
||||||
return core::equals(X, other.X, tolerance) && core::equals(Y, other.Y, tolerance);
|
return core::equals(X, other.X) && core::equals(Y, other.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }
|
vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }
|
||||||
|
@ -68,57 +68,51 @@ namespace core
|
|||||||
return *(&X+index);
|
return *(&X+index);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
//! sort in order X, Y, Z.
|
||||||
bool operator<=(const vector3d<T>&other) const
|
bool operator<=(const vector3d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X<other.X || core::equals(X, other.X)) ||
|
return !(*this > other);
|
||||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y))) ||
|
|
||||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z<other.Z || core::equals(Z, other.Z)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
//! sort in order X, Y, Z.
|
||||||
bool operator>=(const vector3d<T>&other) const
|
bool operator>=(const vector3d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X>other.X || core::equals(X, other.X)) ||
|
return !(*this < other);
|
||||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y))) ||
|
|
||||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z>other.Z || core::equals(Z, other.Z)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
//! sort in order X, Y, Z.
|
||||||
bool operator<(const vector3d<T>&other) const
|
bool operator<(const vector3d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X<other.X && !core::equals(X, other.X)) ||
|
return X < other.X || (X == other.X && Y < other.Y) ||
|
||||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y)) ||
|
(X == other.X && Y == other.Y && Z < other.Z);
|
||||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z<other.Z && !core::equals(Z, other.Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
//! sort in order X, Y, Z.
|
||||||
bool operator>(const vector3d<T>&other) const
|
bool operator>(const vector3d<T>&other) const
|
||||||
{
|
{
|
||||||
return (X>other.X && !core::equals(X, other.X)) ||
|
return X > other.X || (X == other.X && Y > other.Y) ||
|
||||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y)) ||
|
(X == other.X && Y == other.Y && Z > other.Z);
|
||||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z>other.Z && !core::equals(Z, other.Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! use weak float compare
|
|
||||||
bool operator==(const vector3d<T>& other) const
|
bool operator==(const vector3d<T>& other) const
|
||||||
{
|
{
|
||||||
return this->equals(other);
|
return X == other.X && Y == other.Y && Z == other.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const vector3d<T>& other) const
|
bool operator!=(const vector3d<T>& other) const
|
||||||
{
|
{
|
||||||
return !this->equals(other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
|
|
||||||
//! returns if this vector equals the other one, taking floating point rounding errors into account
|
//! Checks if this vector equals the other one.
|
||||||
bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
|
/** Takes floating point rounding errors into account.
|
||||||
|
\param other Vector to compare with.
|
||||||
|
\return True if the two vector are (almost) equal, else false. */
|
||||||
|
bool equals(const vector3d<T>& other) const
|
||||||
{
|
{
|
||||||
return core::equals(X, other.X, tolerance) &&
|
return core::equals(X, other.X) && core::equals(Y, other.Y) && core::equals(Z, other.Z);
|
||||||
core::equals(Y, other.Y, tolerance) &&
|
|
||||||
core::equals(Z, other.Z, tolerance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vector3d<T>& set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; return *this;}
|
vector3d<T>& set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; return *this;}
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform int uTextureUsage0;
|
|
||||||
uniform sampler2D uTextureUnit0;
|
|
||||||
uniform int uBlendType;
|
|
||||||
uniform int uFogEnable;
|
|
||||||
uniform int uFogType;
|
|
||||||
uniform vec4 uFogColor;
|
|
||||||
uniform float uFogStart;
|
|
||||||
uniform float uFogEnd;
|
|
||||||
uniform float uFogDensity;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
float computeFog()
|
|
||||||
{
|
|
||||||
const float LOG2 = 1.442695;
|
|
||||||
float FogFactor = 0.0;
|
|
||||||
|
|
||||||
if (uFogType == 0) // Exp
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
else if (uFogType == 1) // Linear
|
|
||||||
{
|
|
||||||
float Scale = 1.0 / (uFogEnd - uFogStart);
|
|
||||||
FogFactor = (uFogEnd - vFogCoord) * Scale;
|
|
||||||
}
|
|
||||||
else if (uFogType == 2) // Exp2
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
|
|
||||||
FogFactor = clamp(FogFactor, 0.0, 1.0);
|
|
||||||
|
|
||||||
return FogFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color0 = vVertexColor;
|
|
||||||
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
|
|
||||||
|
|
||||||
if (bool(uTextureUsage0))
|
|
||||||
Color1 = texture2D(uTextureUnit0, vTextureCoord0);
|
|
||||||
|
|
||||||
vec4 FinalColor = Color0 * Color1;
|
|
||||||
FinalColor += vSpecularColor;
|
|
||||||
|
|
||||||
if (uBlendType == 1)
|
|
||||||
{
|
|
||||||
FinalColor.w = Color0.w;
|
|
||||||
}
|
|
||||||
else if (uBlendType == 2)
|
|
||||||
{
|
|
||||||
FinalColor.w = Color1.w;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bool(uFogEnable))
|
|
||||||
{
|
|
||||||
float FogFactor = computeFog();
|
|
||||||
vec4 FogColor = uFogColor;
|
|
||||||
FogColor.a = 1.0;
|
|
||||||
FinalColor = mix(FogColor, FinalColor, FogFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = FinalColor;
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform int uTextureUsage;
|
|
||||||
uniform sampler2D uTextureUnit;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color = vVertexColor;
|
|
||||||
|
|
||||||
if (bool(uTextureUsage))
|
|
||||||
Color *= texture2D(uTextureUnit, vTextureCoord);
|
|
||||||
|
|
||||||
gl_FragColor = Color;
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/* Attributes */
|
|
||||||
|
|
||||||
attribute vec4 inVertexPosition;
|
|
||||||
attribute vec4 inVertexColor;
|
|
||||||
attribute vec2 inTexCoord0;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform float uThickness;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_Position = inVertexPosition;
|
|
||||||
gl_PointSize = uThickness;
|
|
||||||
vTextureCoord = inTexCoord0;
|
|
||||||
vVertexColor = inVertexColor.bgra;
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = vVertexColor;
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform int uTextureUsage0;
|
|
||||||
uniform sampler2D uTextureUnit0;
|
|
||||||
uniform int uFogEnable;
|
|
||||||
uniform int uFogType;
|
|
||||||
uniform vec4 uFogColor;
|
|
||||||
uniform float uFogStart;
|
|
||||||
uniform float uFogEnd;
|
|
||||||
uniform float uFogDensity;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
float computeFog()
|
|
||||||
{
|
|
||||||
const float LOG2 = 1.442695;
|
|
||||||
float FogFactor = 0.0;
|
|
||||||
|
|
||||||
if (uFogType == 0) // Exp
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
else if (uFogType == 1) // Linear
|
|
||||||
{
|
|
||||||
float Scale = 1.0 / (uFogEnd - uFogStart);
|
|
||||||
FogFactor = (uFogEnd - vFogCoord) * Scale;
|
|
||||||
}
|
|
||||||
else if (uFogType == 2) // Exp2
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
|
|
||||||
FogFactor = clamp(FogFactor, 0.0, 1.0);
|
|
||||||
|
|
||||||
return FogFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color = vVertexColor;
|
|
||||||
|
|
||||||
if (bool(uTextureUsage0))
|
|
||||||
Color *= texture2D(uTextureUnit0, vTextureCoord0);
|
|
||||||
Color += vSpecularColor;
|
|
||||||
|
|
||||||
if (bool(uFogEnable))
|
|
||||||
{
|
|
||||||
float FogFactor = computeFog();
|
|
||||||
vec4 FogColor = uFogColor;
|
|
||||||
FogColor.a = 1.0;
|
|
||||||
Color = mix(FogColor, Color, FogFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = Color;
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/* Attributes */
|
|
||||||
|
|
||||||
attribute vec3 inVertexPosition;
|
|
||||||
attribute vec3 inVertexNormal;
|
|
||||||
attribute vec4 inVertexColor;
|
|
||||||
attribute vec2 inTexCoord0;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform mat4 uWVPMatrix;
|
|
||||||
uniform mat4 uWVMatrix;
|
|
||||||
uniform mat4 uNMatrix;
|
|
||||||
uniform mat4 uTMatrix0;
|
|
||||||
|
|
||||||
uniform vec4 uGlobalAmbient;
|
|
||||||
uniform vec4 uMaterialAmbient;
|
|
||||||
uniform vec4 uMaterialDiffuse;
|
|
||||||
uniform vec4 uMaterialEmissive;
|
|
||||||
uniform vec4 uMaterialSpecular;
|
|
||||||
uniform float uMaterialShininess;
|
|
||||||
|
|
||||||
uniform float uThickness;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
|
|
||||||
gl_PointSize = uThickness;
|
|
||||||
|
|
||||||
vec4 TextureCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 1.0, 1.0);
|
|
||||||
vTextureCoord0 = vec4(uTMatrix0 * TextureCoord0).xy;
|
|
||||||
|
|
||||||
vVertexColor = inVertexColor.bgra;
|
|
||||||
vSpecularColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
vec3 Position = (uWVMatrix * vec4(inVertexPosition, 1.0)).xyz;
|
|
||||||
|
|
||||||
vFogCoord = length(Position);
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform float uAlphaRef;
|
|
||||||
uniform int uTextureUsage0;
|
|
||||||
uniform sampler2D uTextureUnit0;
|
|
||||||
uniform int uFogEnable;
|
|
||||||
uniform int uFogType;
|
|
||||||
uniform vec4 uFogColor;
|
|
||||||
uniform float uFogStart;
|
|
||||||
uniform float uFogEnd;
|
|
||||||
uniform float uFogDensity;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
float computeFog()
|
|
||||||
{
|
|
||||||
const float LOG2 = 1.442695;
|
|
||||||
float FogFactor = 0.0;
|
|
||||||
|
|
||||||
if (uFogType == 0) // Exp
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
else if (uFogType == 1) // Linear
|
|
||||||
{
|
|
||||||
float Scale = 1.0 / (uFogEnd - uFogStart);
|
|
||||||
FogFactor = (uFogEnd - vFogCoord) * Scale;
|
|
||||||
}
|
|
||||||
else if (uFogType == 2) // Exp2
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
|
|
||||||
FogFactor = clamp(FogFactor, 0.0, 1.0);
|
|
||||||
|
|
||||||
return FogFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color = vVertexColor;
|
|
||||||
|
|
||||||
if (bool(uTextureUsage0))
|
|
||||||
{
|
|
||||||
Color *= texture2D(uTextureUnit0, vTextureCoord0);
|
|
||||||
|
|
||||||
// TODO: uAlphaRef should rather control sharpness of alpha, don't know how to do that right now and this works in most cases.
|
|
||||||
if (Color.a < uAlphaRef)
|
|
||||||
discard;
|
|
||||||
}
|
|
||||||
Color += vSpecularColor;
|
|
||||||
|
|
||||||
if (bool(uFogEnable))
|
|
||||||
{
|
|
||||||
float FogFactor = computeFog();
|
|
||||||
vec4 FogColor = uFogColor;
|
|
||||||
FogColor.a = 1.0;
|
|
||||||
Color = mix(FogColor, Color, FogFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = Color;
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform float uAlphaRef;
|
|
||||||
uniform int uTextureUsage0;
|
|
||||||
uniform sampler2D uTextureUnit0;
|
|
||||||
uniform int uFogEnable;
|
|
||||||
uniform int uFogType;
|
|
||||||
uniform vec4 uFogColor;
|
|
||||||
uniform float uFogStart;
|
|
||||||
uniform float uFogEnd;
|
|
||||||
uniform float uFogDensity;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
float computeFog()
|
|
||||||
{
|
|
||||||
const float LOG2 = 1.442695;
|
|
||||||
float FogFactor = 0.0;
|
|
||||||
|
|
||||||
if (uFogType == 0) // Exp
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
else if (uFogType == 1) // Linear
|
|
||||||
{
|
|
||||||
float Scale = 1.0 / (uFogEnd - uFogStart);
|
|
||||||
FogFactor = (uFogEnd - vFogCoord) * Scale;
|
|
||||||
}
|
|
||||||
else if (uFogType == 2) // Exp2
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
|
|
||||||
FogFactor = clamp(FogFactor, 0.0, 1.0);
|
|
||||||
|
|
||||||
return FogFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color = vVertexColor;
|
|
||||||
|
|
||||||
if (bool(uTextureUsage0))
|
|
||||||
Color *= texture2D(uTextureUnit0, vTextureCoord0);
|
|
||||||
|
|
||||||
if (Color.a < uAlphaRef)
|
|
||||||
discard;
|
|
||||||
|
|
||||||
Color += vSpecularColor;
|
|
||||||
|
|
||||||
if (bool(uFogEnable))
|
|
||||||
{
|
|
||||||
float FogFactor = computeFog();
|
|
||||||
vec4 FogColor = uFogColor;
|
|
||||||
FogColor.a = 1.0;
|
|
||||||
Color = mix(FogColor, Color, FogFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = Color;
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
precision mediump float;
|
|
||||||
|
|
||||||
/* Uniforms */
|
|
||||||
|
|
||||||
uniform int uTextureUsage0;
|
|
||||||
uniform sampler2D uTextureUnit0;
|
|
||||||
uniform int uFogEnable;
|
|
||||||
uniform int uFogType;
|
|
||||||
uniform vec4 uFogColor;
|
|
||||||
uniform float uFogStart;
|
|
||||||
uniform float uFogEnd;
|
|
||||||
uniform float uFogDensity;
|
|
||||||
|
|
||||||
/* Varyings */
|
|
||||||
|
|
||||||
varying vec2 vTextureCoord0;
|
|
||||||
varying vec4 vVertexColor;
|
|
||||||
varying vec4 vSpecularColor;
|
|
||||||
varying float vFogCoord;
|
|
||||||
|
|
||||||
float computeFog()
|
|
||||||
{
|
|
||||||
const float LOG2 = 1.442695;
|
|
||||||
float FogFactor = 0.0;
|
|
||||||
|
|
||||||
if (uFogType == 0) // Exp
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
else if (uFogType == 1) // Linear
|
|
||||||
{
|
|
||||||
float Scale = 1.0 / (uFogEnd - uFogStart);
|
|
||||||
FogFactor = (uFogEnd - vFogCoord) * Scale;
|
|
||||||
}
|
|
||||||
else if (uFogType == 2) // Exp2
|
|
||||||
{
|
|
||||||
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
|
|
||||||
}
|
|
||||||
|
|
||||||
FogFactor = clamp(FogFactor, 0.0, 1.0);
|
|
||||||
|
|
||||||
return FogFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 Color = vVertexColor;
|
|
||||||
|
|
||||||
if (bool(uTextureUsage0))
|
|
||||||
Color *= texture2D(uTextureUnit0, vTextureCoord0);
|
|
||||||
Color += vSpecularColor;
|
|
||||||
|
|
||||||
if (bool(uFogEnable))
|
|
||||||
{
|
|
||||||
float FogFactor = computeFog();
|
|
||||||
vec4 FogColor = uFogColor;
|
|
||||||
FogColor.a = 1.0;
|
|
||||||
Color = mix(FogColor, Color, FogFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = Color;
|
|
||||||
}
|
|
@ -355,7 +355,7 @@ f:write[[
|
|||||||
#include <KHR/khrplatform.h>
|
#include <KHR/khrplatform.h>
|
||||||
|
|
||||||
#ifndef APIENTRY
|
#ifndef APIENTRY
|
||||||
#define APIENTRY
|
#define APIENTRY KHRONOS_APIENTRY
|
||||||
#endif
|
#endif
|
||||||
#ifndef APIENTRYP
|
#ifndef APIENTRYP
|
||||||
#define APIENTRYP APIENTRY *
|
#define APIENTRYP APIENTRY *
|
||||||
@ -387,9 +387,9 @@ public:
|
|||||||
// Call this once after creating the context.
|
// Call this once after creating the context.
|
||||||
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
||||||
// Check if an extension is supported.
|
// Check if an extension is supported.
|
||||||
inline bool IsExtensionPresent(const std::string &ext)
|
inline bool IsExtensionPresent(const std::string &ext) const
|
||||||
{
|
{
|
||||||
return extensions.find(ext) != extensions.end();
|
return extensions.count(ext) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
]];
|
]];
|
||||||
@ -403,13 +403,16 @@ f:write[[
|
|||||||
static constexpr const GLenum NONE = 0;
|
static constexpr const GLenum NONE = 0;
|
||||||
]];
|
]];
|
||||||
f:write( "};\n" );
|
f:write( "};\n" );
|
||||||
f:write( "\n//Global GL procedures object.\n" );
|
f:write( "\n// Global GL procedures object.\n" );
|
||||||
f:write( "IRRLICHT_API extern OpenGLProcedures GL;\n" );
|
f:write( "IRRLICHT_API extern OpenGLProcedures GL;\n" );
|
||||||
f:close();
|
f:close();
|
||||||
|
|
||||||
-- Write loader implementation
|
-- Write loader implementation
|
||||||
f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" );
|
f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" );
|
||||||
f:write[[
|
f:write[[
|
||||||
|
// This code was generated by scripts/BindingGenerator.lua
|
||||||
|
// Do not modify it, modify and run the generator instead.
|
||||||
|
|
||||||
#include "mt_opengl.h"
|
#include "mt_opengl.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -423,9 +426,24 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
|
|||||||
f:write( loader:Concat() );
|
f:write( loader:Concat() );
|
||||||
f:write[[
|
f:write[[
|
||||||
|
|
||||||
|
// OpenGL 3 way to enumerate extensions
|
||||||
|
GLint ext_count = 0;
|
||||||
|
GetIntegerv(NUM_EXTENSIONS, &ext_count);
|
||||||
|
extensions.reserve(ext_count);
|
||||||
|
for (GLint k = 0; k < ext_count; k++) {
|
||||||
|
auto tmp = GetStringi(EXTENSIONS, k);
|
||||||
|
if (tmp)
|
||||||
|
extensions.emplace((char*)tmp);
|
||||||
|
}
|
||||||
|
if (!extensions.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// OpenGL 2 / ES 2 way to enumerate extensions
|
||||||
|
auto ext_str = GetString(EXTENSIONS);
|
||||||
|
if (!ext_str)
|
||||||
|
return;
|
||||||
// get the extension string, chop it up
|
// get the extension string, chop it up
|
||||||
std::string ext_string = std::string((char*)GetString(EXTENSIONS));
|
std::stringstream ext_ss((char*)ext_str);
|
||||||
std::stringstream ext_ss(ext_string);
|
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
while (std::getline(ext_ss, tmp, ' '))
|
while (std::getline(ext_ss, tmp, ' '))
|
||||||
extensions.emplace(tmp);
|
extensions.emplace(tmp);
|
||||||
|
123
scripts/ci-build-android.sh
Executable file
123
scripts/ci-build-android.sh
Executable file
@ -0,0 +1,123 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# NOTE: this code is mostly copied from minetest_android_deps
|
||||||
|
# <https://github.com/minetest/minetest_android_deps>
|
||||||
|
|
||||||
|
png_ver=1.6.40
|
||||||
|
jpeg_ver=3.0.1
|
||||||
|
|
||||||
|
download () {
|
||||||
|
get_tar_archive libpng "https://download.sourceforge.net/libpng/libpng-${png_ver}.tar.gz"
|
||||||
|
get_tar_archive libjpeg "https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-${jpeg_ver}.tar.gz"
|
||||||
|
}
|
||||||
|
|
||||||
|
build () {
|
||||||
|
# Build libjpg and libpng first because Irrlicht needs them
|
||||||
|
mkdir -p libpng
|
||||||
|
pushd libpng
|
||||||
|
$srcdir/libpng/configure --host=$CROSS_PREFIX
|
||||||
|
make && make DESTDIR=$PWD install
|
||||||
|
popd
|
||||||
|
|
||||||
|
mkdir -p libjpeg
|
||||||
|
pushd libjpeg
|
||||||
|
cmake $srcdir/libjpeg "${CMAKE_FLAGS[@]}" -DENABLE_SHARED=OFF
|
||||||
|
make && make DESTDIR=$PWD install
|
||||||
|
popd
|
||||||
|
|
||||||
|
local libpng=$PWD/libpng/usr/local/lib/libpng.a
|
||||||
|
local libjpeg=$(echo $PWD/libjpeg/opt/libjpeg-turbo/lib*/libjpeg.a)
|
||||||
|
cmake $srcdir/irrlicht "${CMAKE_FLAGS[@]}" \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DPNG_LIBRARY=$libpng \
|
||||||
|
-DPNG_PNG_INCLUDE_DIR=$(dirname "$libpng")/../include \
|
||||||
|
-DJPEG_LIBRARY=$libjpeg \
|
||||||
|
-DJPEG_INCLUDE_DIR=$(dirname "$libjpeg")/../include
|
||||||
|
make
|
||||||
|
|
||||||
|
cp -p lib/Android/libIrrlichtMt.a $libpng $libjpeg $pkgdir/
|
||||||
|
cp -a $srcdir/irrlicht/include $pkgdir/include
|
||||||
|
cp -a $srcdir/irrlicht/media/Shaders $pkgdir/Shaders
|
||||||
|
}
|
||||||
|
|
||||||
|
get_tar_archive () {
|
||||||
|
# $1: folder to extract to, $2: URL
|
||||||
|
local filename="${2##*/}"
|
||||||
|
[ -d "$1" ] && return 0
|
||||||
|
wget -c "$2" -O "$filename"
|
||||||
|
mkdir -p "$1"
|
||||||
|
tar -xaf "$filename" -C "$1" --strip-components=1
|
||||||
|
rm "$filename"
|
||||||
|
}
|
||||||
|
|
||||||
|
_setup_toolchain () {
|
||||||
|
local toolchain=$(echo "$ANDROID_NDK"/toolchains/llvm/prebuilt/*)
|
||||||
|
if [ ! -d "$toolchain" ]; then
|
||||||
|
echo "Android NDK path not specified or incorrect"; return 1
|
||||||
|
fi
|
||||||
|
export PATH="$toolchain/bin:$ANDROID_NDK:$PATH"
|
||||||
|
|
||||||
|
unset CFLAGS CPPFLAGS CXXFLAGS
|
||||||
|
|
||||||
|
TARGET_ABI="$1"
|
||||||
|
API=21
|
||||||
|
if [ "$TARGET_ABI" == armeabi-v7a ]; then
|
||||||
|
CROSS_PREFIX=armv7a-linux-androideabi
|
||||||
|
CFLAGS="-mthumb"
|
||||||
|
CXXFLAGS="-mthumb"
|
||||||
|
elif [ "$TARGET_ABI" == arm64-v8a ]; then
|
||||||
|
CROSS_PREFIX=aarch64-linux-android
|
||||||
|
elif [ "$TARGET_ABI" == x86 ]; then
|
||||||
|
CROSS_PREFIX=i686-linux-android
|
||||||
|
CFLAGS="-mssse3 -mfpmath=sse"
|
||||||
|
CXXFLAGS="-mssse3 -mfpmath=sse"
|
||||||
|
elif [ "$TARGET_ABI" == x86_64 ]; then
|
||||||
|
CROSS_PREFIX=x86_64-linux-android
|
||||||
|
else
|
||||||
|
echo "Invalid ABI given"; return 1
|
||||||
|
fi
|
||||||
|
export CC=$CROSS_PREFIX$API-clang
|
||||||
|
export CXX=$CROSS_PREFIX$API-clang++
|
||||||
|
export AR=llvm-ar
|
||||||
|
export RANLIB=llvm-ranlib
|
||||||
|
export CFLAGS="-fPIC ${CFLAGS}"
|
||||||
|
export CXXFLAGS="-fPIC ${CXXFLAGS}"
|
||||||
|
|
||||||
|
CMAKE_FLAGS=(
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake"
|
||||||
|
"-DANDROID_ABI=$TARGET_ABI" "-DANDROID_NATIVE_API_LEVEL=$API"
|
||||||
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
|
)
|
||||||
|
|
||||||
|
# make sure pkg-config doesn't interfere
|
||||||
|
export PKG_CONFIG=/bin/false
|
||||||
|
|
||||||
|
export MAKEFLAGS="-j$(nproc)"
|
||||||
|
}
|
||||||
|
|
||||||
|
_run_build () {
|
||||||
|
local abi=$1
|
||||||
|
irrdir=$PWD
|
||||||
|
|
||||||
|
mkdir -p $RUNNER_TEMP/src
|
||||||
|
cd $RUNNER_TEMP/src
|
||||||
|
srcdir=$PWD
|
||||||
|
[ -d irrlicht ] || ln -s $irrdir irrlicht
|
||||||
|
download
|
||||||
|
|
||||||
|
builddir=$RUNNER_TEMP/build/irrlicht-$abi
|
||||||
|
pkgdir=$RUNNER_TEMP/pkg/$abi/Irrlicht
|
||||||
|
rm -rf "$pkgdir"
|
||||||
|
mkdir -p "$builddir" "$pkgdir"
|
||||||
|
|
||||||
|
cd "$builddir"
|
||||||
|
build
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Usage: ci-build-android.sh <ABI>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_setup_toolchain $1
|
||||||
|
_run_build $1
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
[[ -z "$CC" || -z "$CXX" ]] && exit 255
|
[[ -z "$CC" || -z "$CXX" ]] && exit 255
|
||||||
|
|
||||||
variant=win32
|
variant=win32
|
||||||
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
|
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
|
||||||
with_sdl=0
|
with_sdl=0
|
||||||
@ -9,26 +9,30 @@ with_sdl=0
|
|||||||
#with_gl3=0
|
#with_gl3=0
|
||||||
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
|
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
|
||||||
|
|
||||||
libjpeg_version=2.1.5.1
|
libjpeg_version=3.0.1
|
||||||
libpng_version=1.6.39
|
libpng_version=1.6.40
|
||||||
sdl2_version=2.28.1
|
sdl2_version=2.28.5
|
||||||
zlib_version=1.2.13
|
zlib_version=1.3.1
|
||||||
|
|
||||||
|
download () {
|
||||||
|
local url=$1
|
||||||
|
local filename=${url##*/}
|
||||||
|
local foldername=${filename%%[.-]*}
|
||||||
|
|
||||||
|
[ -d "./$foldername" ] && return 0
|
||||||
|
[ -e "$filename" ] || wget "$url" -O "$filename"
|
||||||
|
sha256sum -w -c <(grep -F "$filename" "$topdir/sha256sums.txt")
|
||||||
|
unzip -o "$filename" -d "$foldername"
|
||||||
|
}
|
||||||
|
|
||||||
|
libs=$PWD/libs
|
||||||
mkdir -p libs
|
mkdir -p libs
|
||||||
pushd libs
|
pushd libs
|
||||||
libs=$PWD
|
libhost="http://minetest.kitsunemimi.pw"
|
||||||
[ -e libjpeg.zip ] || \
|
download "$libhost/llvm/libjpeg-$libjpeg_version-$variant.zip"
|
||||||
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
|
download "$libhost/llvm/libpng-$libpng_version-$variant.zip"
|
||||||
[ -e libpng.zip ] || \
|
[ $with_sdl -eq 1 ] && download "$libhost/llvm/sdl2-$sdl2_version-$variant.zip"
|
||||||
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
|
download "$libhost/llvm/zlib-$zlib_version-$variant.zip"
|
||||||
[[ $with_sdl -eq 0 || -e sdl2.zip ]] || \
|
|
||||||
wget "http://minetest.kitsunemimi.pw/sdl2-$sdl2_version-$variant.zip" -O sdl2.zip
|
|
||||||
[ -e zlib.zip ] || \
|
|
||||||
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
|
|
||||||
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
|
|
||||||
[ -d libpng ] || unzip -o libpng.zip -d libpng
|
|
||||||
[[ $with_sdl -eq 0 || -d sdl2 ]] || unzip -o sdl2.zip -d sdl2
|
|
||||||
[ -d zlib ] || unzip -o zlib.zip -d zlib
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
tmp=(
|
tmp=(
|
||||||
@ -40,10 +44,14 @@ tmp=(
|
|||||||
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
|
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
|
||||||
-DZLIB_INCLUDE_DIR=$libs/zlib/include
|
-DZLIB_INCLUDE_DIR=$libs/zlib/include
|
||||||
)
|
)
|
||||||
[ $with_sdl -eq 1 ] && tmp+=(
|
if [ $with_sdl -eq 1 ]; then
|
||||||
-DUSE_SDL2=ON
|
tmp+=(
|
||||||
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
|
-DUSE_SDL2=ON
|
||||||
)
|
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
|
||||||
|
)
|
||||||
|
else
|
||||||
|
tmp+=(-DUSE_SDL2=OFF)
|
||||||
|
fi
|
||||||
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
|
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
|
||||||
|
|
||||||
cmake . "${tmp[@]}"
|
cmake . "${tmp[@]}"
|
||||||
|
9
scripts/ci-get-mingw.sh
Executable file
9
scripts/ci-get-mingw.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
name=llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
|
||||||
|
wget "https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/$name" -O "$name"
|
||||||
|
sha256sum -w -c <(grep -F "$name" "$topdir/sha256sums.txt")
|
||||||
|
sudo tar -xaf "$name" -C /usr --strip-components=1
|
||||||
|
rm -f "$name"
|
9
scripts/sha256sums.txt
Normal file
9
scripts/sha256sums.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
0f21ff3be90311092fe32e0e30878ef3ae9d9437b8d9ac25ef279e0d84e9bb8e llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz
|
||||||
|
53dfd31285f470fcf0dca88217c5cf9c557729af6d103afae5936e72ddc38d3c libjpeg-3.0.1-win32.zip
|
||||||
|
3d44e0740914e6878300e30653aad39e974821b5d7f6c2567e246b4eb04a5324 libjpeg-3.0.1-win64.zip
|
||||||
|
6baf4e819bfb3573760524b5dc9a04b5e479090d6d2046b86cf39a3107c0071f libpng-1.6.40-win32.zip
|
||||||
|
c02e029f01fce44baea7f4aecfd2564bd8a03507c0c6af8b03339ae0452c8b7d libpng-1.6.40-win64.zip
|
||||||
|
f9f890af960e92fd3f532f2e9ac00681c33bc67a722e000dfdaeb41b0064f1a0 sdl2-2.28.5-win32.zip
|
||||||
|
8dde2c6963544b7d8a2e87c128ebbdf51ad0e70c7e2df986ff4e963ce9996d9b sdl2-2.28.5-win64.zip
|
||||||
|
8af10515d57dbfee5d2106cd66cafa2adeb4270d4c6047ccbf7e8b5d2d50681c zlib-1.3.1-win32.zip
|
||||||
|
ad43f5d23052590c65633530743e5d622cc76b33c109072e6fd7b487aff56bca zlib-1.3.1-win64.zip
|
@ -31,7 +31,8 @@ namespace irr
|
|||||||
{
|
{
|
||||||
|
|
||||||
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
||||||
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Focused(false), Initialized(false), Paused(true), JNIEnvAttachedToVM(0)
|
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Initialized(false),
|
||||||
|
Stopped(true), Paused(true), Focused(false), JNIEnvAttachedToVM(0)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CIrrDeviceAndroid");
|
setDebugName("CIrrDeviceAndroid");
|
||||||
@ -64,7 +65,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
|||||||
s32 Events = 0;
|
s32 Events = 0;
|
||||||
android_poll_source* Source = 0;
|
android_poll_source* Source = 0;
|
||||||
|
|
||||||
while ((ALooper_pollAll(((Focused && !Paused) || !Initialized) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
|
while ((ALooper_pollAll((!Initialized || isWindowActive()) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
|
||||||
{
|
{
|
||||||
if(Source)
|
if(Source)
|
||||||
Source->process(Android, Source);
|
Source->process(Android, Source);
|
||||||
@ -106,7 +107,7 @@ bool CIrrDeviceAndroid::run()
|
|||||||
s32 Events = 0;
|
s32 Events = 0;
|
||||||
android_poll_source* Source = 0;
|
android_poll_source* Source = 0;
|
||||||
|
|
||||||
while ((id = ALooper_pollAll(((Focused && !Paused) || !Initialized) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
|
while ((id = ALooper_pollAll(0, 0, &Events, (void**)&Source)) >= 0)
|
||||||
{
|
{
|
||||||
if(Source)
|
if(Source)
|
||||||
Source->process(Android, Source);
|
Source->process(Android, Source);
|
||||||
@ -180,7 +181,7 @@ void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
|
|||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowActive() const
|
bool CIrrDeviceAndroid::isWindowActive() const
|
||||||
{
|
{
|
||||||
return (Focused && !Paused);
|
return (Focused && !Paused && !Stopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIrrDeviceAndroid::isWindowFocused() const
|
bool CIrrDeviceAndroid::isWindowFocused() const
|
||||||
@ -193,6 +194,11 @@ bool CIrrDeviceAndroid::isWindowMinimized() const
|
|||||||
return !Focused;
|
return !Focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CIrrDeviceAndroid::isWindowVisible() const
|
||||||
|
{
|
||||||
|
return !Stopped;
|
||||||
|
}
|
||||||
|
|
||||||
void CIrrDeviceAndroid::closeDevice()
|
void CIrrDeviceAndroid::closeDevice()
|
||||||
{
|
{
|
||||||
ANativeActivity_finish(Android->activity);
|
ANativeActivity_finish(Android->activity);
|
||||||
@ -260,6 +266,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
|
|||||||
break;
|
break;
|
||||||
case APP_CMD_START:
|
case APP_CMD_START:
|
||||||
os::Printer::log("Android command APP_CMD_START", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_START", ELL_DEBUG);
|
||||||
|
device->Stopped = false;
|
||||||
break;
|
break;
|
||||||
case APP_CMD_INIT_WINDOW:
|
case APP_CMD_INIT_WINDOW:
|
||||||
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
|
||||||
@ -317,6 +324,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
|
|||||||
break;
|
break;
|
||||||
case APP_CMD_STOP:
|
case APP_CMD_STOP:
|
||||||
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
|
||||||
|
device->Stopped = true;
|
||||||
break;
|
break;
|
||||||
case APP_CMD_RESUME:
|
case APP_CMD_RESUME:
|
||||||
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);
|
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);
|
||||||
|
@ -36,6 +36,8 @@ namespace irr
|
|||||||
|
|
||||||
virtual bool isWindowMinimized() const;
|
virtual bool isWindowMinimized() const;
|
||||||
|
|
||||||
|
virtual bool isWindowVisible() const;
|
||||||
|
|
||||||
virtual void closeDevice();
|
virtual void closeDevice();
|
||||||
|
|
||||||
virtual void setResizable(bool resize = false);
|
virtual void setResizable(bool resize = false);
|
||||||
@ -84,9 +86,10 @@ namespace irr
|
|||||||
const ASensor* Accelerometer;
|
const ASensor* Accelerometer;
|
||||||
const ASensor* Gyroscope;
|
const ASensor* Gyroscope;
|
||||||
|
|
||||||
bool Focused;
|
|
||||||
bool Initialized;
|
bool Initialized;
|
||||||
|
bool Stopped;
|
||||||
bool Paused;
|
bool Paused;
|
||||||
|
bool Focused;
|
||||||
|
|
||||||
JNIEnv* JNIEnvAttachedToVM;
|
JNIEnv* JNIEnvAttachedToVM;
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
|
|||||||
{
|
{
|
||||||
if (LoopCallBack)
|
if (LoopCallBack)
|
||||||
LoopCallBack->drop();
|
LoopCallBack->drop();
|
||||||
|
if (Mesh)
|
||||||
|
Mesh->drop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -469,21 +471,21 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
|
|||||||
|
|
||||||
ISkinnedMesh *skinnedMesh=(ISkinnedMesh*)Mesh;
|
ISkinnedMesh *skinnedMesh=(ISkinnedMesh*)Mesh;
|
||||||
|
|
||||||
const s32 number = skinnedMesh->getJointNumber(jointName);
|
const std::optional<u32> number = skinnedMesh->getJointNumber(jointName);
|
||||||
|
|
||||||
if (number == -1)
|
if (!number.has_value())
|
||||||
{
|
{
|
||||||
os::Printer::log("Joint with specified name not found in skinned mesh", jointName, ELL_DEBUG);
|
os::Printer::log("Joint with specified name not found in skinned mesh", jointName, ELL_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s32)JointChildSceneNodes.size() <= number)
|
if (JointChildSceneNodes.size() <= *number)
|
||||||
{
|
{
|
||||||
os::Printer::log("Joint was found in mesh, but is not loaded into node", jointName, ELL_WARNING);
|
os::Printer::log("Joint was found in mesh, but is not loaded into node", jointName, ELL_WARNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return JointChildSceneNodes[number];
|
return JointChildSceneNodes[*number];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,11 +62,6 @@ public:
|
|||||||
return EAT_BOOL;
|
return EAT_BOOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* getTypeString() const override
|
|
||||||
{
|
|
||||||
return L"bool";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BoolValue;
|
bool BoolValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -106,11 +101,6 @@ public:
|
|||||||
return EAT_INT;
|
return EAT_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* getTypeString() const override
|
|
||||||
{
|
|
||||||
return L"int";
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 Value;
|
s32 Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -150,11 +140,6 @@ public:
|
|||||||
return EAT_FLOAT;
|
return EAT_FLOAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t* getTypeString() const override
|
|
||||||
{
|
|
||||||
return L"float";
|
|
||||||
}
|
|
||||||
|
|
||||||
f32 Value;
|
f32 Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -172,26 +172,6 @@ E_ATTRIBUTE_TYPE CAttributes::getAttributeType(s32 index) const
|
|||||||
return Attributes[index]->getType();
|
return Attributes[index]->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the type of an attribute
|
|
||||||
const wchar_t* CAttributes::getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound) const
|
|
||||||
{
|
|
||||||
const IAttribute* att = getAttributeP(attributeName);
|
|
||||||
if (att)
|
|
||||||
return att->getTypeString();
|
|
||||||
else
|
|
||||||
return defaultNotFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Returns attribute type string by index.
|
|
||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
|
||||||
const wchar_t* CAttributes::getAttributeTypeString(s32 index, const wchar_t* defaultNotFound) const
|
|
||||||
{
|
|
||||||
if ((u32)index >= Attributes.size())
|
|
||||||
return defaultNotFound;
|
|
||||||
|
|
||||||
return Attributes[index]->getTypeString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Gets an attribute as integer value
|
//! Gets an attribute as integer value
|
||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||||
s32 CAttributes::getAttributeAsInt(s32 index) const
|
s32 CAttributes::getAttributeAsInt(s32 index) const
|
||||||
|
@ -41,15 +41,6 @@ public:
|
|||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
||||||
E_ATTRIBUTE_TYPE getAttributeType(s32 index) const override;
|
E_ATTRIBUTE_TYPE getAttributeType(s32 index) const override;
|
||||||
|
|
||||||
//! Returns the type string of the attribute
|
|
||||||
//! \param attributeName: String for the attribute type
|
|
||||||
//! \param defaultNotFound Value returned when attributeName was not found
|
|
||||||
const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const override;
|
|
||||||
|
|
||||||
//! Returns the type string of the attribute by index.
|
|
||||||
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
|
|
||||||
const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const override;
|
|
||||||
|
|
||||||
//! Returns if an attribute with a name exists
|
//! Returns if an attribute with a name exists
|
||||||
bool existsAttribute(const c8* attributeName) const override;
|
bool existsAttribute(const c8* attributeName) const override;
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include "IFileSystem.h"
|
#include "IFileSystem.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define _B3D_READER_DEBUG
|
#define _B3D_READER_DEBUG
|
||||||
#endif
|
#endif
|
||||||
@ -149,14 +151,14 @@ bool CB3DMeshFileLoader::load()
|
|||||||
bool CB3DMeshFileLoader::readChunkNODE(CSkinnedMesh::SJoint *inJoint)
|
bool CB3DMeshFileLoader::readChunkNODE(CSkinnedMesh::SJoint *inJoint)
|
||||||
{
|
{
|
||||||
CSkinnedMesh::SJoint *joint = AnimatedMesh->addJoint(inJoint);
|
CSkinnedMesh::SJoint *joint = AnimatedMesh->addJoint(inJoint);
|
||||||
readString(joint->Name);
|
joint->Name = readString();
|
||||||
|
|
||||||
#ifdef _B3D_READER_DEBUG
|
#ifdef _B3D_READER_DEBUG
|
||||||
core::stringc logStr;
|
core::stringc logStr;
|
||||||
for ( u32 i=1; i < B3dStack.size(); ++i )
|
for ( u32 i=1; i < B3dStack.size(); ++i )
|
||||||
logStr += "-";
|
logStr += "-";
|
||||||
logStr += "read ChunkNODE";
|
logStr += "read ChunkNODE";
|
||||||
os::Printer::log(logStr.c_str(), joint->Name.c_str(), ELL_DEBUG);
|
os::Printer::log(logStr.c_str(), joint->Name.value_or("").c_str(), ELL_DEBUG);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
f32 position[3], scale[3], rotation[4];
|
f32 position[3], scale[3], rotation[4];
|
||||||
@ -818,8 +820,8 @@ bool CB3DMeshFileLoader::readChunkTEXS()
|
|||||||
Textures.push_back(SB3dTexture());
|
Textures.push_back(SB3dTexture());
|
||||||
SB3dTexture& B3dTexture = Textures.getLast();
|
SB3dTexture& B3dTexture = Textures.getLast();
|
||||||
|
|
||||||
readString(B3dTexture.TextureName);
|
B3dTexture.TextureName = readString();
|
||||||
B3dTexture.TextureName.replace('\\','/');
|
std::replace(B3dTexture.TextureName.begin(), B3dTexture.TextureName.end(), '\\', '/');
|
||||||
#ifdef _B3D_READER_DEBUG
|
#ifdef _B3D_READER_DEBUG
|
||||||
os::Printer::log("read Texture", B3dTexture.TextureName.c_str(), ELL_DEBUG);
|
os::Printer::log("read Texture", B3dTexture.TextureName.c_str(), ELL_DEBUG);
|
||||||
#endif
|
#endif
|
||||||
@ -872,10 +874,9 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||||||
{
|
{
|
||||||
// This is what blitz basic calls a brush, like a Irrlicht Material
|
// This is what blitz basic calls a brush, like a Irrlicht Material
|
||||||
|
|
||||||
core::stringc name;
|
auto name = readString();
|
||||||
readString(name);
|
|
||||||
#ifdef _B3D_READER_DEBUG
|
#ifdef _B3D_READER_DEBUG
|
||||||
os::Printer::log("read Material", name, ELL_DEBUG);
|
os::Printer::log("read Material", name.c_str(), ELL_DEBUG);
|
||||||
#endif
|
#endif
|
||||||
Materials.push_back(SB3dMaterial());
|
Materials.push_back(SB3dMaterial());
|
||||||
SB3dMaterial& B3dMaterial=Materials.getLast();
|
SB3dMaterial& B3dMaterial=Materials.getLast();
|
||||||
@ -1031,18 +1032,19 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CB3DMeshFileLoader::readString(core::stringc& newstring)
|
std::string CB3DMeshFileLoader::readString()
|
||||||
{
|
{
|
||||||
newstring="";
|
std::string newstring = "";
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
c8 character;
|
c8 character;
|
||||||
if (B3DFile->read(&character, sizeof(character)) == 0)
|
if (B3DFile->read(&character, sizeof(character)) == 0)
|
||||||
return; // eof
|
break; // eof
|
||||||
if (character==0)
|
if (character==0)
|
||||||
return;
|
break;
|
||||||
newstring.append(character);
|
newstring.push_back(character);
|
||||||
}
|
}
|
||||||
|
return newstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ private:
|
|||||||
bool readChunkTEXS();
|
bool readChunkTEXS();
|
||||||
bool readChunkBRUS();
|
bool readChunkBRUS();
|
||||||
|
|
||||||
void readString(core::stringc& newstring);
|
std::string readString();
|
||||||
void readFloats(f32* vec, u32 count);
|
void readFloats(f32* vec, u32 count);
|
||||||
|
|
||||||
core::array<SB3dChunk> B3dStack;
|
core::array<SB3dChunk> B3dStack;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "CBoneSceneNode.h"
|
#include "CBoneSceneNode.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace scene
|
namespace scene
|
||||||
@ -11,7 +13,7 @@ namespace scene
|
|||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CBoneSceneNode::CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
CBoneSceneNode::CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||||
u32 boneIndex, const c8* boneName)
|
u32 boneIndex, const std::optional<std::string> &boneName)
|
||||||
: IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex),
|
: IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex),
|
||||||
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
|
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "IBoneSceneNode.h"
|
#include "IBoneSceneNode.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace scene
|
namespace scene
|
||||||
@ -19,7 +21,8 @@ namespace scene
|
|||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr,
|
CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr,
|
||||||
s32 id=-1, u32 boneIndex=0, const c8* boneName=0);
|
s32 id=-1, u32 boneIndex=0,
|
||||||
|
const std::optional<std::string> &boneName = std::nullopt);
|
||||||
|
|
||||||
//! Returns the index of the bone
|
//! Returns the index of the bone
|
||||||
u32 getBoneIndex() const override;
|
u32 getBoneIndex() const override;
|
||||||
|
@ -757,9 +757,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||||||
case ECF_R8G8B8:
|
case ECF_R8G8B8:
|
||||||
convert_A1R5G5B5toR8G8B8(sP, sN, dP);
|
convert_A1R5G5B5toR8G8B8(sP, sN, dP);
|
||||||
break;
|
break;
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -780,9 +777,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||||||
case ECF_R8G8B8:
|
case ECF_R8G8B8:
|
||||||
convert_R5G6B5toR8G8B8(sP, sN, dP);
|
convert_R5G6B5toR8G8B8(sP, sN, dP);
|
||||||
break;
|
break;
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -803,9 +797,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||||||
case ECF_R8G8B8:
|
case ECF_R8G8B8:
|
||||||
convert_A8R8G8B8toR8G8B8(sP, sN, dP);
|
convert_A8R8G8B8toR8G8B8(sP, sN, dP);
|
||||||
break;
|
break;
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -826,17 +817,11 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||||||
case ECF_R8G8B8:
|
case ECF_R8G8B8:
|
||||||
convert_R8G8B8toR8G8B8(sP, sN, dP);
|
convert_R8G8B8toR8G8B8(sP, sN, dP);
|
||||||
break;
|
break;
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -745,15 +745,10 @@ IFileList* CFileSystem::createFileList()
|
|||||||
|
|
||||||
r = new CFileList(Path, true, false);
|
r = new CFileList(Path, true, false);
|
||||||
|
|
||||||
// TODO: Should be unified once mingw adapts the proper types
|
// intptr_t is optional but supported by MinGW since 2007 or earlier.
|
||||||
#if defined(__GNUC__)
|
|
||||||
long hFile; //mingw return type declaration
|
|
||||||
#else
|
|
||||||
intptr_t hFile;
|
intptr_t hFile;
|
||||||
#endif
|
|
||||||
|
|
||||||
struct _tfinddata_t c_file;
|
struct _tfinddata_t c_file;
|
||||||
if( (hFile = _tfindfirst( _T("*"), &c_file )) != -1L )
|
if( (hFile = _tfindfirst( _T("*"), &c_file )) != (intptr_t)(-1L) )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -8,19 +8,12 @@
|
|||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
#define GL_GLEXT_LEGACY 1
|
||||||
#define GL_GLEXT_LEGACY 1
|
#define GLX_GLXEXT_LEGACY 1
|
||||||
#define GLX_GLXEXT_LEGACY 1
|
|
||||||
#else
|
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
|
||||||
#define GLX_GLXEXT_PROTOTYPES 1
|
|
||||||
#endif
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#include <GL/glxext.h>
|
#include <GL/glxext.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -45,11 +38,7 @@ CGLXManager::CGLXManager(const SIrrlichtCreationParameters& params, const SExpos
|
|||||||
#if defined(GLX_VERSION_1_3)
|
#if defined(GLX_VERSION_1_3)
|
||||||
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||||
|
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
PFNGLXCHOOSEFBCONFIGPROC glxChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXChooseFBConfig"));
|
PFNGLXCHOOSEFBCONFIGPROC glxChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXChooseFBConfig"));
|
||||||
#else
|
|
||||||
PFNGLXCHOOSEFBCONFIGPROC glxChooseFBConfig=glXChooseFBConfig;
|
|
||||||
#endif
|
|
||||||
if (major==1 && minor>2 && glxChooseFBConfig)
|
if (major==1 && minor>2 && glxChooseFBConfig)
|
||||||
{
|
{
|
||||||
os::Printer::log("GLX >= 1.3", ELL_DEBUG);
|
os::Printer::log("GLX >= 1.3", ELL_DEBUG);
|
||||||
@ -196,14 +185,10 @@ os::Printer::log("GLX >= 1.3", ELL_DEBUG);
|
|||||||
{
|
{
|
||||||
glxFBConfig=configList[0];
|
glxFBConfig=configList[0];
|
||||||
XFree(configList);
|
XFree(configList);
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
||||||
PFNGLXGETVISUALFROMFBCONFIGPROC glxGetVisualFromFBConfig= (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXGetVisualFromFBConfig"));
|
PFNGLXGETVISUALFROMFBCONFIGPROC glxGetVisualFromFBConfig= (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXGetVisualFromFBConfig"));
|
||||||
if (glxGetVisualFromFBConfig)
|
if (glxGetVisualFromFBConfig)
|
||||||
VisualInfo = glxGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
|
VisualInfo = glxGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
|
||||||
#else
|
|
||||||
VisualInfo = glXGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -328,11 +313,7 @@ bool CGLXManager::generateContext()
|
|||||||
{
|
{
|
||||||
#if defined(GLX_ARB_create_context)
|
#if defined(GLX_ARB_create_context)
|
||||||
|
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glxCreateContextAttribsARB=(PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB"));
|
PFNGLXCREATECONTEXTATTRIBSARBPROC glxCreateContextAttribsARB=(PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB"));
|
||||||
#else
|
|
||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glxCreateContextAttribsARB=glXCreateContextAttribsARB;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (glxCreateContextAttribsARB)
|
if (glxCreateContextAttribsARB)
|
||||||
{
|
{
|
||||||
|
@ -75,10 +75,6 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
|
|||||||
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
|
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case ECF_UNKNOWN:
|
case ECF_UNKNOWN:
|
||||||
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
|
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
|
||||||
return;
|
return;
|
||||||
@ -109,10 +105,6 @@ SColor CImage::getPixel(u32 x, u32 y) const
|
|||||||
return SColor(255,p[0],p[1],p[2]);
|
return SColor(255,p[0],p[1],p[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
|
||||||
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ECF_UNKNOWN:
|
case ECF_UNKNOWN:
|
||||||
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
|
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
|
||||||
break;
|
break;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "CImage.h"
|
#include "CImage.h"
|
||||||
#include "irrString.h"
|
#include "irrString.h"
|
||||||
|
|
||||||
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -46,7 +47,7 @@ u8 *CImageLoaderTGA::loadCompressedImage(io::IReadFile *file, const STGAHeader&
|
|||||||
chunkheader++; // Add 1 To The Value To Get Total Number Of Raw Pixels
|
chunkheader++; // Add 1 To The Value To Get Total Number Of Raw Pixels
|
||||||
|
|
||||||
const u32 bytesToRead = bytesPerPixel * chunkheader;
|
const u32 bytesToRead = bytesPerPixel * chunkheader;
|
||||||
if ( currentByte+bytesToRead < imageSize )
|
if ( currentByte+bytesToRead <= imageSize )
|
||||||
{
|
{
|
||||||
file->read(&data[currentByte], bytesToRead);
|
file->read(&data[currentByte], bytesToRead);
|
||||||
currentByte += bytesToRead;
|
currentByte += bytesToRead;
|
||||||
@ -138,7 +139,8 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const
|
|||||||
if (header.ColorMapType)
|
if (header.ColorMapType)
|
||||||
{
|
{
|
||||||
// Create 32 bit palette
|
// Create 32 bit palette
|
||||||
const irr::u16 paletteSize = core::max_((u16)256, header.ColorMapLength); // ColorMapLength can lie, but so far we only use palette for 8-bit, so ensure it has 256 entries
|
// `core::max_()` is not used here because it takes its inputs as references. Since `header` is packed, use the macro `MAX()` instead:
|
||||||
|
const irr::u16 paletteSize = MAX((u16)256u, header.ColorMapLength); // ColorMapLength can lie, but so far we only use palette for 8-bit, so ensure it has 256 entries
|
||||||
palette = new u32[paletteSize];
|
palette = new u32[paletteSize];
|
||||||
|
|
||||||
if( paletteSize > header.ColorMapLength )
|
if( paletteSize > header.ColorMapLength )
|
||||||
|
@ -147,6 +147,11 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
|||||||
// create keymap
|
// create keymap
|
||||||
createKeyMap();
|
createKeyMap();
|
||||||
|
|
||||||
|
// initialize X11 thread safety
|
||||||
|
// libX11 1.8+ has this on by default
|
||||||
|
// without it, multi-threaded GL drivers may crash
|
||||||
|
XInitThreads();
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
if (CreationParams.DriverType != video::EDT_NULL)
|
if (CreationParams.DriverType != video::EDT_NULL)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,18 @@ bool CIrrDeviceSDL::keyIsKnownSpecial(EKEY_CODE key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) {
|
int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key)
|
||||||
|
{
|
||||||
|
// special cases that always return a char regardless of how the SDL keycode
|
||||||
|
// looks
|
||||||
|
switch (key) {
|
||||||
|
case KEY_RETURN:
|
||||||
|
case KEY_ESCAPE:
|
||||||
|
return (int)key;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// SDL in-place ORs values with no character representation with 1<<30
|
// SDL in-place ORs values with no character representation with 1<<30
|
||||||
// https://wiki.libsdl.org/SDL2/SDLKeycodeLookup
|
// https://wiki.libsdl.org/SDL2/SDLKeycodeLookup
|
||||||
if (assumedChar & (1<<30))
|
if (assumedChar & (1<<30))
|
||||||
@ -218,9 +229,28 @@ int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) {
|
|||||||
void CIrrDeviceSDL::resetReceiveTextInputEvents() {
|
void CIrrDeviceSDL::resetReceiveTextInputEvents() {
|
||||||
gui::IGUIElement *elem = GUIEnvironment->getFocus();
|
gui::IGUIElement *elem = GUIEnvironment->getFocus();
|
||||||
if (elem && elem->acceptsIME())
|
if (elem && elem->acceptsIME())
|
||||||
SDL_StartTextInput();
|
{
|
||||||
|
// IBus seems to have an issue where dead keys and compose keys do not
|
||||||
|
// work (specifically, the individual characters in the sequence are
|
||||||
|
// sent as text input events instead of the result) when
|
||||||
|
// SDL_StartTextInput() is called on the same input box.
|
||||||
|
core::rect<s32> pos = elem->getAbsolutePosition();
|
||||||
|
if (!SDL_IsTextInputActive() || lastElemPos != pos)
|
||||||
|
{
|
||||||
|
lastElemPos = pos;
|
||||||
|
SDL_Rect rect;
|
||||||
|
rect.x = pos.UpperLeftCorner.X;
|
||||||
|
rect.y = pos.UpperLeftCorner.Y;
|
||||||
|
rect.w = pos.getWidth();
|
||||||
|
rect.h = pos.getHeight();
|
||||||
|
SDL_SetTextInputRect(&rect);
|
||||||
|
SDL_StartTextInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
@ -229,7 +259,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||||||
Window((SDL_Window*)param.WindowId), SDL_Flags(0),
|
Window((SDL_Window*)param.WindowId), SDL_Flags(0),
|
||||||
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
|
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
|
||||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||||
Resizable(param.WindowResizable == 1 ? true : false)
|
Resizable(param.WindowResizable == 1 ? true : false), CurrentTouchCount(0)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CIrrDeviceSDL");
|
setDebugName("CIrrDeviceSDL");
|
||||||
@ -254,14 +284,21 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Minetest has its own code to synthesize mouse events from touch events,
|
||||||
|
// so we prevent SDL from doing it.
|
||||||
|
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||||
|
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
|
||||||
|
|
||||||
// create keymap
|
// create keymap
|
||||||
createKeyMap();
|
createKeyMap();
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
if (CreationParams.DriverType != video::EDT_NULL)
|
if (CreationParams.DriverType != video::EDT_NULL)
|
||||||
{
|
{
|
||||||
// create the window, only if we do not use the null device
|
if (!createWindow()) {
|
||||||
createWindow();
|
Close = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -555,7 +592,11 @@ bool CIrrDeviceSDL::run()
|
|||||||
|
|
||||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
|
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||||
irrevent.MouseInput.Wheel = SDL_event.wheel.preciseY;
|
irrevent.MouseInput.Wheel = SDL_event.wheel.preciseY;
|
||||||
|
#else
|
||||||
|
irrevent.MouseInput.Wheel = SDL_event.wheel.y;
|
||||||
|
#endif
|
||||||
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||||
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||||
irrevent.MouseInput.X = MouseX;
|
irrevent.MouseInput.X = MouseX;
|
||||||
@ -693,18 +734,13 @@ bool CIrrDeviceSDL::run()
|
|||||||
else
|
else
|
||||||
key = (EKEY_CODE)KeyMap[idx].Win32Key;
|
key = (EKEY_CODE)KeyMap[idx].Win32Key;
|
||||||
|
|
||||||
|
if (key == (EKEY_CODE)0)
|
||||||
|
os::Printer::log("keycode not mapped", core::stringc(mp.SDLKey), ELL_DEBUG);
|
||||||
|
|
||||||
// Make sure to only input special characters if something is in focus, as SDL_TEXTINPUT handles normal unicode already
|
// Make sure to only input special characters if something is in focus, as SDL_TEXTINPUT handles normal unicode already
|
||||||
if (SDL_IsTextInputActive() && !keyIsKnownSpecial(key) && (SDL_event.key.keysym.mod & KMOD_CTRL) == 0)
|
if (SDL_IsTextInputActive() && !keyIsKnownSpecial(key) && (SDL_event.key.keysym.mod & KMOD_CTRL) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef _IRR_WINDOWS_API_
|
|
||||||
// handle alt+f4 in Windows, because SDL seems not to
|
|
||||||
if ( (SDL_event.key.keysym.mod & KMOD_LALT) && key == KEY_F4)
|
|
||||||
{
|
|
||||||
Close = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
|
||||||
irrevent.KeyInput.Key = key;
|
irrevent.KeyInput.Key = key;
|
||||||
irrevent.KeyInput.PressedDown = (SDL_event.type == SDL_KEYDOWN);
|
irrevent.KeyInput.PressedDown = (SDL_event.type == SDL_KEYDOWN);
|
||||||
@ -741,6 +777,45 @@ bool CIrrDeviceSDL::run()
|
|||||||
postEventFromUser(irrevent);
|
postEventFromUser(irrevent);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL_FINGERDOWN:
|
||||||
|
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||||
|
irrevent.TouchInput.Event = ETIE_PRESSED_DOWN;
|
||||||
|
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||||
|
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||||
|
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||||
|
CurrentTouchCount++;
|
||||||
|
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||||
|
|
||||||
|
postEventFromUser(irrevent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_FINGERMOTION:
|
||||||
|
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||||
|
irrevent.TouchInput.Event = ETIE_MOVED;
|
||||||
|
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||||
|
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||||
|
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||||
|
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||||
|
|
||||||
|
postEventFromUser(irrevent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_FINGERUP:
|
||||||
|
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||||
|
irrevent.TouchInput.Event = ETIE_LEFT_UP;
|
||||||
|
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||||
|
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||||
|
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||||
|
// To match Android behavior, still count the pointer that was
|
||||||
|
// just released.
|
||||||
|
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||||
|
if (CurrentTouchCount > 0) {
|
||||||
|
CurrentTouchCount--;
|
||||||
|
}
|
||||||
|
|
||||||
|
postEventFromUser(irrevent);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
@ -1200,7 +1275,7 @@ void CIrrDeviceSDL::createKeyMap()
|
|||||||
KeyMap.push_back(SKeyMap(SDLK_KP_9, KEY_NUMPAD9));
|
KeyMap.push_back(SKeyMap(SDLK_KP_9, KEY_NUMPAD9));
|
||||||
KeyMap.push_back(SKeyMap(SDLK_KP_MULTIPLY, KEY_MULTIPLY));
|
KeyMap.push_back(SKeyMap(SDLK_KP_MULTIPLY, KEY_MULTIPLY));
|
||||||
KeyMap.push_back(SKeyMap(SDLK_KP_PLUS, KEY_ADD));
|
KeyMap.push_back(SKeyMap(SDLK_KP_PLUS, KEY_ADD));
|
||||||
// KeyMap.push_back(SKeyMap(SDLK_KP_, KEY_SEPARATOR));
|
KeyMap.push_back(SKeyMap(SDLK_KP_ENTER, KEY_RETURN));
|
||||||
KeyMap.push_back(SKeyMap(SDLK_KP_MINUS, KEY_SUBTRACT));
|
KeyMap.push_back(SKeyMap(SDLK_KP_MINUS, KEY_SUBTRACT));
|
||||||
KeyMap.push_back(SKeyMap(SDLK_KP_PERIOD, KEY_DECIMAL));
|
KeyMap.push_back(SKeyMap(SDLK_KP_PERIOD, KEY_DECIMAL));
|
||||||
KeyMap.push_back(SKeyMap(SDLK_KP_DIVIDE, KEY_DIVIDE));
|
KeyMap.push_back(SKeyMap(SDLK_KP_DIVIDE, KEY_DIVIDE));
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
// DirectFB is removed in SDL3, thou distribution as Alpine currently ships SDL2
|
||||||
|
// with enabled DirectFB, but requiring another fix at a top of SDL2.
|
||||||
|
// We don't need DirectFB in Irrlicht/Minetest, so simply disable it here to prevent issues.
|
||||||
|
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -256,7 +260,7 @@ namespace irr
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::vector<std::unique_ptr<SDL_Cursor, CursorDeleter>> Cursors;
|
std::vector<std::unique_ptr<SDL_Cursor, CursorDeleter>> Cursors;
|
||||||
gui::ECURSOR_ICON ActiveIcon;
|
gui::ECURSOR_ICON ActiveIcon = gui::ECURSOR_ICON::ECI_NORMAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -299,6 +303,8 @@ namespace irr
|
|||||||
|
|
||||||
bool Resizable;
|
bool Resizable;
|
||||||
|
|
||||||
|
core::rect<s32> lastElemPos;
|
||||||
|
|
||||||
struct SKeyMap
|
struct SKeyMap
|
||||||
{
|
{
|
||||||
SKeyMap() {}
|
SKeyMap() {}
|
||||||
@ -318,6 +324,8 @@ namespace irr
|
|||||||
|
|
||||||
core::array<SKeyMap> KeyMap;
|
core::array<SKeyMap> KeyMap;
|
||||||
SDL_SysWMinfo Info;
|
SDL_SysWMinfo Info;
|
||||||
|
|
||||||
|
s32 CurrentTouchCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
@ -59,38 +59,6 @@ namespace irr
|
|||||||
log (s.c_str(), ll);
|
log (s.c_str(), ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void CLogger::log(const wchar_t* text, ELOG_LEVEL ll)
|
|
||||||
{
|
|
||||||
if (ll < LogLevel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
core::stringc s = text;
|
|
||||||
log(s.c_str(), ll);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void CLogger::log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll)
|
|
||||||
{
|
|
||||||
if (ll < LogLevel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
core::stringc s1 = text;
|
|
||||||
core::stringc s2 = hint;
|
|
||||||
log(s1.c_str(), s2.c_str(), ll);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void CLogger::log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll)
|
|
||||||
{
|
|
||||||
if (ll < LogLevel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
core::stringc s2 = hint;
|
|
||||||
log( text, s2.c_str(), ll);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets a new event receiver
|
//! Sets a new event receiver
|
||||||
void CLogger::setReceiver(IEventReceiver* r)
|
void CLogger::setReceiver(IEventReceiver* r)
|
||||||
{
|
{
|
||||||
|
@ -28,18 +28,9 @@ public:
|
|||||||
//! Prints out a text into the log
|
//! Prints out a text into the log
|
||||||
void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
//! Prints out a text into the log
|
||||||
void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
|
||||||
|
|
||||||
//! Prints out a text into the log
|
|
||||||
void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) override;
|
|
||||||
|
|
||||||
//! Sets a new event receiver
|
//! Sets a new event receiver
|
||||||
void setReceiver(IEventReceiver* r);
|
void setReceiver(IEventReceiver* r);
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
if(NOT ANDROID AND NOT APPLE)
|
||||||
|
set(DEFAULT_SDL2 ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
|
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
|
||||||
option(USE_SDL2 "Use the SDL2 backend" FALSE)
|
option(USE_SDL2 "Use the SDL2 backend" ${DEFAULT_SDL2})
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
|
|
||||||
@ -20,14 +24,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||||||
add_definitions(-D_DEBUG)
|
add_definitions(-D_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||||
|
|
||||||
add_compile_options(-Wall -pipe -fno-exceptions -fno-rtti)
|
add_compile_options(-Wall -pipe -fno-exceptions)
|
||||||
|
|
||||||
# Enable SSE for floating point math on 32-bit x86 by default
|
# Enable SSE for floating point math on 32-bit x86 by default
|
||||||
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
||||||
@ -174,7 +176,8 @@ else()
|
|||||||
set(DEFAULT_WEBGL1 TRUE)
|
set(DEFAULT_WEBGL1 TRUE)
|
||||||
endif()
|
endif()
|
||||||
option(ENABLE_GLES2 "Enable OpenGL ES 2+" ${DEFAULT_GLES2})
|
option(ENABLE_GLES2 "Enable OpenGL ES 2+" ${DEFAULT_GLES2})
|
||||||
option(ENABLE_WEBGL1 "Enable WebGL (requires GLES2)" ${DEFAULT_WEBGL1})
|
#option(ENABLE_WEBGL1 "Enable WebGL (requires GLES2)" ${DEFAULT_WEBGL1})
|
||||||
|
set(ENABLE_WEBGL1 FALSE) # not working currently
|
||||||
if(ENABLE_WEBGL1)
|
if(ENABLE_WEBGL1)
|
||||||
set(ENABLE_GLES2 TRUE)
|
set(ENABLE_GLES2 TRUE)
|
||||||
endif()
|
endif()
|
||||||
@ -182,14 +185,13 @@ endif()
|
|||||||
|
|
||||||
if(ENABLE_OPENGL)
|
if(ENABLE_OPENGL)
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
|
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
|
||||||
|
set(OPENGL_DIRECT_LINK TRUE) # driver relies on this
|
||||||
if(DEVICE STREQUAL "WINDOWS")
|
if(DEVICE STREQUAL "WINDOWS")
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
|
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_)
|
||||||
elseif(DEVICE STREQUAL "X11")
|
elseif(DEVICE STREQUAL "X11")
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_GLX_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
|
add_definitions(-D_IRR_COMPILE_WITH_GLX_MANAGER_)
|
||||||
elseif(DEVICE STREQUAL "OSX")
|
elseif(DEVICE STREQUAL "OSX")
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_NSOGL_MANAGER_)
|
add_definitions(-D_IRR_COMPILE_WITH_NSOGL_MANAGER_)
|
||||||
elseif(DEVICE STREQUAL "SDL")
|
|
||||||
add_definitions(-D_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -197,8 +199,6 @@ if(ENABLE_OPENGL3)
|
|||||||
if (NOT USE_SDL2)
|
if (NOT USE_SDL2)
|
||||||
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
||||||
endif()
|
endif()
|
||||||
set(USE_SDLGL ON)
|
|
||||||
set(USE_SDLGL3 ON)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_GLES1)
|
if(ENABLE_GLES1)
|
||||||
@ -206,18 +206,16 @@ if(ENABLE_GLES1)
|
|||||||
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
|
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
|
||||||
endif()
|
endif()
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
||||||
|
set(OPENGLES_DIRECT_LINK TRUE)
|
||||||
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
|
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_GLES2)
|
if(ENABLE_GLES2)
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
|
||||||
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
|
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
|
||||||
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
||||||
elseif(DEVICE STREQUAL "SDL")
|
|
||||||
set(USE_SDLGL ON)
|
|
||||||
set(USE_SDLGLES2 ON)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -239,14 +237,12 @@ message(STATUS "Device: ${DEVICE}")
|
|||||||
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
|
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
|
||||||
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
|
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
|
||||||
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
||||||
if (USE_SDLGLES2)
|
if (ENABLE_GLES2)
|
||||||
message(STATUS "OpenGL ES 2: ON (unified)")
|
message(STATUS "OpenGL ES 2: ON (unified)")
|
||||||
elseif (ENABLE_GLES2)
|
|
||||||
message(STATUS "OpenGL ES 2: ON (legacy)")
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "OpenGL ES 2: OFF")
|
message(STATUS "OpenGL ES 2: OFF")
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
#message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
||||||
|
|
||||||
# Required libs
|
# Required libs
|
||||||
|
|
||||||
@ -269,10 +265,28 @@ if(ENABLE_OPENGL OR ENABLE_OPENGL3)
|
|||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
if(USE_SDL2)
|
if(USE_SDL2)
|
||||||
find_package(SDL2 CONFIG REQUIRED)
|
find_package(SDL2 2.0.10 CONFIG REQUIRED)
|
||||||
message(STATUS "Found SDL2: ${SDL2_LIBRARIES}")
|
message(STATUS "Found SDL2: ${SDL2_LIBRARIES}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# More special config
|
||||||
|
|
||||||
|
if(ENABLE_OPENGL AND DEVICE STREQUAL "SDL")
|
||||||
|
# The legacy GL driver requires some symbols from GL 4.5 to compile,
|
||||||
|
# which SDL only provides since 2.26.0 (Nov 2022).
|
||||||
|
# We have a fallback in case this isn't satisfied so test for it.
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${SDL2_INCLUDE_DIRS})
|
||||||
|
unset(CHECK_GL_VERSION_4_5 CACHE)
|
||||||
|
check_cxx_source_compiles("#include <SDL_opengl.h>\n\
|
||||||
|
#ifndef GL_VERSION_4_5\n\
|
||||||
|
#error\n\
|
||||||
|
#endif\n\
|
||||||
|
int main() {}" CHECK_GL_VERSION_4_5)
|
||||||
|
if(CHECK_GL_VERSION_4_5)
|
||||||
|
add_definitions(-DIRR_PREFER_SDL_GL_HEADER)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Platform-specific libs
|
# Platform-specific libs
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
@ -307,26 +321,6 @@ set(link_includes
|
|||||||
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
|
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(link_libs
|
|
||||||
"${ZLIB_LIBRARY}"
|
|
||||||
"${JPEG_LIBRARY}"
|
|
||||||
"${PNG_LIBRARY}"
|
|
||||||
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
|
|
||||||
|
|
||||||
${OPENGL_LIBRARIES}
|
|
||||||
${OPENGLES_LIBRARY}
|
|
||||||
${OPENGLES2_LIBRARIES}
|
|
||||||
${EGL_LIBRARY}
|
|
||||||
|
|
||||||
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
|
|
||||||
${COCOA_LIB}
|
|
||||||
${IOKIT_LIB}
|
|
||||||
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
|
||||||
"$<$<PLATFORM_ID:Windows>:winmm>"
|
|
||||||
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
|
||||||
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
|
|
||||||
set(IRRMESHLOADER
|
set(IRRMESHLOADER
|
||||||
@ -363,12 +357,13 @@ set(IRRDRVROBJ
|
|||||||
mt_opengl_loader.cpp
|
mt_opengl_loader.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# the two legacy drivers
|
||||||
|
|
||||||
if(ENABLE_OPENGL)
|
if(ENABLE_OPENGL)
|
||||||
set(IRRDRVROBJ
|
set(IRRDRVROBJ
|
||||||
${IRRDRVROBJ}
|
${IRRDRVROBJ}
|
||||||
COpenGLCacheHandler.cpp
|
COpenGLCacheHandler.cpp
|
||||||
COpenGLDriver.cpp
|
COpenGLDriver.cpp
|
||||||
COpenGLShaderMaterialRenderer.cpp
|
|
||||||
COpenGLSLMaterialRenderer.cpp
|
COpenGLSLMaterialRenderer.cpp
|
||||||
COpenGLExtensionHandler.cpp
|
COpenGLExtensionHandler.cpp
|
||||||
)
|
)
|
||||||
@ -382,6 +377,33 @@ if(ENABLE_GLES1)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# the unified drivers
|
||||||
|
|
||||||
|
if(ENABLE_OPENGL3 OR ENABLE_GLES2)
|
||||||
|
set(IRRDRVROBJ
|
||||||
|
${IRRDRVROBJ}
|
||||||
|
OpenGL/Driver.cpp
|
||||||
|
OpenGL/ExtensionHandler.cpp
|
||||||
|
OpenGL/FixedPipelineRenderer.cpp
|
||||||
|
OpenGL/MaterialRenderer.cpp
|
||||||
|
OpenGL/Renderer2D.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_OPENGL3)
|
||||||
|
set(IRRDRVROBJ
|
||||||
|
${IRRDRVROBJ}
|
||||||
|
OpenGL3/Driver.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_GLES2)
|
||||||
|
set(IRRDRVROBJ
|
||||||
|
${IRRDRVROBJ}
|
||||||
|
OpenGLES2/Driver.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(IRRIMAGEOBJ
|
set(IRRIMAGEOBJ
|
||||||
CColorConverter.cpp
|
CColorConverter.cpp
|
||||||
CImage.cpp
|
CImage.cpp
|
||||||
@ -399,37 +421,6 @@ add_library(IRRVIDEOOBJ OBJECT
|
|||||||
${IRRIMAGEOBJ}
|
${IRRIMAGEOBJ}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(USE_SDLGL)
|
|
||||||
target_sources(IRRVIDEOOBJ PRIVATE
|
|
||||||
OpenGL/Driver.cpp
|
|
||||||
OpenGL/ExtensionHandler.cpp
|
|
||||||
OpenGL/FixedPipelineRenderer.cpp
|
|
||||||
OpenGL/MaterialRenderer.cpp
|
|
||||||
OpenGL/Renderer2D.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(USE_SDLGL3)
|
|
||||||
target_sources(IRRVIDEOOBJ PRIVATE
|
|
||||||
OpenGL3/Driver.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(USE_SDLGLES2)
|
|
||||||
target_sources(IRRVIDEOOBJ PRIVATE
|
|
||||||
OpenGLES2/Driver.cpp
|
|
||||||
)
|
|
||||||
elseif(ENABLE_GLES2)
|
|
||||||
target_sources(IRRVIDEOOBJ PRIVATE
|
|
||||||
COGLES2Driver.cpp
|
|
||||||
COGLES2ExtensionHandler.cpp
|
|
||||||
COGLES2FixedPipelineRenderer.cpp
|
|
||||||
COGLES2MaterialRenderer.cpp
|
|
||||||
COGLES2Renderer2D.cpp
|
|
||||||
CWebGL1Driver.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(IRRIOOBJ OBJECT
|
add_library(IRRIOOBJ OBJECT
|
||||||
CFileList.cpp
|
CFileList.cpp
|
||||||
CFileSystem.cpp
|
CFileSystem.cpp
|
||||||
@ -526,7 +517,26 @@ target_include_directories(IrrlichtMt
|
|||||||
${link_includes}
|
${link_includes}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
|
# this needs to be here and not in a variable (like link_includes) due to issues
|
||||||
|
# with the generator expressions on at least CMake 3.22, but not 3.28 or later
|
||||||
|
target_link_libraries(IrrlichtMt PRIVATE
|
||||||
|
${ZLIB_LIBRARY}
|
||||||
|
${JPEG_LIBRARY}
|
||||||
|
${PNG_LIBRARY}
|
||||||
|
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>"
|
||||||
|
|
||||||
|
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
|
||||||
|
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
|
||||||
|
${EGL_LIBRARY}
|
||||||
|
|
||||||
|
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
|
||||||
|
${COCOA_LIB}
|
||||||
|
${IOKIT_LIB}
|
||||||
|
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
||||||
|
"$<$<PLATFORM_ID:Windows>:winmm>"
|
||||||
|
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
||||||
|
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
|
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
|
||||||
|
@ -41,6 +41,14 @@ IImageWriter* createImageWriterJPG();
|
|||||||
//! creates a writer which is able to save png images
|
//! creates a writer which is able to save png images
|
||||||
IImageWriter* createImageWriterPNG();
|
IImageWriter* createImageWriterPNG();
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
//! no-op material renderer
|
||||||
|
class CDummyMaterialRenderer : public IMaterialRenderer {
|
||||||
|
public:
|
||||||
|
CDummyMaterialRenderer() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)
|
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)
|
||||||
@ -839,9 +847,9 @@ const SColorf& CNullDriver::getAmbientLight() const
|
|||||||
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
||||||
//! driver, it would return "Direct3D8".
|
//! driver, it would return "Direct3D8".
|
||||||
|
|
||||||
const wchar_t* CNullDriver::getName() const
|
const char* CNullDriver::getName() const
|
||||||
{
|
{
|
||||||
return L"Irrlicht NullDevice";
|
return "Irrlicht NullDevice";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1001,68 +1009,6 @@ bool CNullDriver::checkPrimitiveCount(u32 prmCount) const
|
|||||||
|
|
||||||
bool CNullDriver::checkImage(IImage *image) const
|
bool CNullDriver::checkImage(IImage *image) const
|
||||||
{
|
{
|
||||||
ECOLOR_FORMAT format = image->getColorFormat();
|
|
||||||
core::dimension2d<u32> size = image->getDimension();
|
|
||||||
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case ECF_DXT1:
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
|
|
||||||
{
|
|
||||||
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (size.getOptimalSize(true, false) != size)
|
|
||||||
{
|
|
||||||
os::Printer::log("Invalid size of image for DXT texture, size of image must be power of two.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC_RGB2:
|
|
||||||
case ECF_PVRTC_ARGB2:
|
|
||||||
case ECF_PVRTC_RGB4:
|
|
||||||
case ECF_PVRTC_ARGB4:
|
|
||||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC))
|
|
||||||
{
|
|
||||||
os::Printer::log("PVRTC texture compression not available.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (size.getOptimalSize(true, false) != size)
|
|
||||||
{
|
|
||||||
os::Printer::log("Invalid size of image for PVRTC compressed texture, size of image must be power of two and squared.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ECF_PVRTC2_ARGB2:
|
|
||||||
case ECF_PVRTC2_ARGB4:
|
|
||||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC2))
|
|
||||||
{
|
|
||||||
os::Printer::log("PVRTC2 texture compression not available.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ECF_ETC1:
|
|
||||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC1))
|
|
||||||
{
|
|
||||||
os::Printer::log("ETC1 texture compression not available.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ECF_ETC2_RGB:
|
|
||||||
case ECF_ETC2_ARGB:
|
|
||||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC2))
|
|
||||||
{
|
|
||||||
os::Printer::log("ETC2 texture compression not available.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1587,7 +1533,7 @@ s32 CNullDriver::addMaterialRenderer(IMaterialRenderer* renderer, const char* na
|
|||||||
r.Renderer = renderer;
|
r.Renderer = renderer;
|
||||||
r.Name = name;
|
r.Name = name;
|
||||||
|
|
||||||
if (name == 0 && (MaterialRenderers.size() < (sizeof(sBuiltInMaterialTypeNames) / sizeof(char*))-1 ))
|
if (name == 0 && MaterialRenderers.size() < numBuiltInMaterials)
|
||||||
{
|
{
|
||||||
// set name of built in renderer so that we don't have to implement name
|
// set name of built in renderer so that we don't have to implement name
|
||||||
// setting in all available renderers.
|
// setting in all available renderers.
|
||||||
@ -1604,8 +1550,7 @@ s32 CNullDriver::addMaterialRenderer(IMaterialRenderer* renderer, const char* na
|
|||||||
//! Sets the name of a material renderer.
|
//! Sets the name of a material renderer.
|
||||||
void CNullDriver::setMaterialRendererName(u32 idx, const char* name)
|
void CNullDriver::setMaterialRendererName(u32 idx, const char* name)
|
||||||
{
|
{
|
||||||
if (idx < (sizeof(sBuiltInMaterialTypeNames) / sizeof(char*))-1 ||
|
if (idx < numBuiltInMaterials || idx >= MaterialRenderers.size())
|
||||||
idx >= MaterialRenderers.size())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MaterialRenderers[idx].Name = name;
|
MaterialRenderers[idx].Name = name;
|
||||||
@ -1704,8 +1649,6 @@ s32 CNullDriver::addHighLevelShaderMaterial(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
||||||
//! but tries to load the programs from files.
|
|
||||||
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
||||||
const io::path& vertexShaderProgramFileName,
|
const io::path& vertexShaderProgramFileName,
|
||||||
const c8* vertexShaderEntryPointName,
|
const c8* vertexShaderEntryPointName,
|
||||||
@ -1776,8 +1719,6 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
||||||
//! but tries to load the programs from files.
|
|
||||||
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
||||||
io::IReadFile* vertexShaderProgram,
|
io::IReadFile* vertexShaderProgram,
|
||||||
const c8* vertexShaderEntryPointName,
|
const c8* vertexShaderEntryPointName,
|
||||||
@ -1852,107 +1793,25 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNullDriver::deleteShaderMaterial(s32 material)
|
||||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
|
||||||
//! vertex shaders to render geometry.
|
|
||||||
s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial,
|
|
||||||
s32 userData)
|
|
||||||
{
|
{
|
||||||
os::Printer::log("Shader materials not implemented yet in this driver, sorry.");
|
const u32 idx = (u32)material;
|
||||||
return -1;
|
if (idx < numBuiltInMaterials || idx >= MaterialRenderers.size())
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
// if this is the last material we can drop it without consequence
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
if (idx == MaterialRenderers.size() - 1) {
|
||||||
//! programs from files.
|
if (MaterialRenderers[idx].Renderer)
|
||||||
s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram,
|
MaterialRenderers[idx].Renderer->drop();
|
||||||
io::IReadFile* pixelShaderProgram,
|
MaterialRenderers.erase(idx);
|
||||||
IShaderConstantSetCallBack* callback,
|
return;
|
||||||
E_MATERIAL_TYPE baseMaterial,
|
|
||||||
s32 userData)
|
|
||||||
{
|
|
||||||
c8* vs = 0;
|
|
||||||
c8* ps = 0;
|
|
||||||
|
|
||||||
if (vertexShaderProgram)
|
|
||||||
{
|
|
||||||
const long size = vertexShaderProgram->getSize();
|
|
||||||
if (size)
|
|
||||||
{
|
|
||||||
vs = new c8[size+1];
|
|
||||||
vertexShaderProgram->read(vs, size);
|
|
||||||
vs[size] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// otherwise replace with a dummy renderer, we have to preserve the IDs
|
||||||
if (pixelShaderProgram)
|
auto &ref = MaterialRenderers[idx];
|
||||||
{
|
if (ref.Renderer)
|
||||||
const long size = pixelShaderProgram->getSize();
|
ref.Renderer->drop();
|
||||||
if (size)
|
ref.Renderer = new CDummyMaterialRenderer();
|
||||||
{
|
ref.Name.clear();
|
||||||
ps = new c8[size+1];
|
|
||||||
pixelShaderProgram->read(ps, size);
|
|
||||||
ps[size] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 result = addShaderMaterial(vs, ps, callback, baseMaterial, userData);
|
|
||||||
|
|
||||||
delete [] vs;
|
|
||||||
delete [] ps;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
|
||||||
//! programs from files.
|
|
||||||
s32 CNullDriver::addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
|
|
||||||
const io::path& pixelShaderProgramFileName,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial,
|
|
||||||
s32 userData)
|
|
||||||
{
|
|
||||||
io::IReadFile* vsfile = 0;
|
|
||||||
io::IReadFile* psfile = 0;
|
|
||||||
|
|
||||||
if (vertexShaderProgramFileName.size())
|
|
||||||
{
|
|
||||||
vsfile = FileSystem->createAndOpenFile(vertexShaderProgramFileName);
|
|
||||||
if (!vsfile)
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not open vertex shader program file",
|
|
||||||
vertexShaderProgramFileName, ELL_WARNING);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pixelShaderProgramFileName.size())
|
|
||||||
{
|
|
||||||
psfile = FileSystem->createAndOpenFile(pixelShaderProgramFileName);
|
|
||||||
if (!psfile)
|
|
||||||
{
|
|
||||||
os::Printer::log("Could not open pixel shader program file",
|
|
||||||
pixelShaderProgramFileName, ELL_WARNING);
|
|
||||||
if (vsfile)
|
|
||||||
vsfile->drop();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 result = addShaderMaterialFromFiles(vsfile, psfile, callback,
|
|
||||||
baseMaterial, userData);
|
|
||||||
|
|
||||||
if (psfile)
|
|
||||||
psfile->drop();
|
|
||||||
|
|
||||||
if (vsfile)
|
|
||||||
vsfile->drop();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1991,7 +1850,7 @@ IImage* CNullDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_REND
|
|||||||
// prints renderer version
|
// prints renderer version
|
||||||
void CNullDriver::printVersion()
|
void CNullDriver::printVersion()
|
||||||
{
|
{
|
||||||
core::stringw namePrint = L"Using renderer: ";
|
core::stringc namePrint = "Using renderer: ";
|
||||||
namePrint += getName();
|
namePrint += getName();
|
||||||
os::Printer::log(namePrint.c_str(), ELL_INFORMATION);
|
os::Printer::log(namePrint.c_str(), ELL_INFORMATION);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ namespace video
|
|||||||
|
|
||||||
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
|
||||||
//! driver, it would return "Direct3D8.1".
|
//! driver, it would return "Direct3D8.1".
|
||||||
const wchar_t* getName() const override;
|
const char* getName() const override;
|
||||||
|
|
||||||
//! Sets the dynamic ambient light color. The default color is
|
//! Sets the dynamic ambient light color. The default color is
|
||||||
//! (0,0,0,0) which means it is dark.
|
//! (0,0,0,0) which means it is dark.
|
||||||
@ -464,30 +464,6 @@ namespace video
|
|||||||
//! Returns pointer to the IGPUProgrammingServices interface.
|
//! Returns pointer to the IGPUProgrammingServices interface.
|
||||||
IGPUProgrammingServices* getGPUProgrammingServices() override;
|
IGPUProgrammingServices* getGPUProgrammingServices() override;
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
|
||||||
//! vertex shaders to render geometry.
|
|
||||||
virtual s32 addShaderMaterial(const c8* vertexShaderProgram = 0,
|
|
||||||
const c8* pixelShaderProgram = 0,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData=0) override;
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
|
||||||
//! programs from files.
|
|
||||||
virtual s32 addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram = 0,
|
|
||||||
io::IReadFile* pixelShaderProgram = 0,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData=0) override;
|
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the
|
|
||||||
//! programs from files.
|
|
||||||
virtual s32 addShaderMaterialFromFiles(const io::path& vertexShaderProgramFileName,
|
|
||||||
const io::path& pixelShaderProgramFileName,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData=0) override;
|
|
||||||
|
|
||||||
//! Returns pointer to material renderer or null
|
//! Returns pointer to material renderer or null
|
||||||
IMaterialRenderer* getMaterialRenderer(u32 idx) const override;
|
IMaterialRenderer* getMaterialRenderer(u32 idx) const override;
|
||||||
|
|
||||||
@ -497,8 +473,7 @@ namespace video
|
|||||||
//! Returns name of the material renderer
|
//! Returns name of the material renderer
|
||||||
const char* getMaterialRendererName(u32 idx) const override;
|
const char* getMaterialRendererName(u32 idx) const override;
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, based on a high level shading
|
//! Adds a new material renderer to the VideoDriver, based on a high level shading language.
|
||||||
//! language. Currently only HLSL in D3D9 is supported.
|
|
||||||
virtual s32 addHighLevelShaderMaterial(
|
virtual s32 addHighLevelShaderMaterial(
|
||||||
const c8* vertexShaderProgram,
|
const c8* vertexShaderProgram,
|
||||||
const c8* vertexShaderEntryPointName = 0,
|
const c8* vertexShaderEntryPointName = 0,
|
||||||
@ -516,8 +491,6 @@ namespace video
|
|||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
||||||
s32 userData = 0) override;
|
s32 userData = 0) override;
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
||||||
//! but tries to load the programs from files.
|
|
||||||
virtual s32 addHighLevelShaderMaterialFromFiles(
|
virtual s32 addHighLevelShaderMaterialFromFiles(
|
||||||
const io::path& vertexShaderProgramFile,
|
const io::path& vertexShaderProgramFile,
|
||||||
const c8* vertexShaderEntryPointName = "main",
|
const c8* vertexShaderEntryPointName = "main",
|
||||||
@ -535,8 +508,6 @@ namespace video
|
|||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
||||||
s32 userData = 0) override;
|
s32 userData = 0) override;
|
||||||
|
|
||||||
//! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description),
|
|
||||||
//! but tries to load the programs from files.
|
|
||||||
virtual s32 addHighLevelShaderMaterialFromFiles(
|
virtual s32 addHighLevelShaderMaterialFromFiles(
|
||||||
io::IReadFile* vertexShaderProgram,
|
io::IReadFile* vertexShaderProgram,
|
||||||
const c8* vertexShaderEntryPointName = "main",
|
const c8* vertexShaderEntryPointName = "main",
|
||||||
@ -554,6 +525,8 @@ namespace video
|
|||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
||||||
s32 userData = 0) override;
|
s32 userData = 0) override;
|
||||||
|
|
||||||
|
virtual void deleteShaderMaterial(s32 material) override;
|
||||||
|
|
||||||
//! Returns a pointer to the mesh manipulator.
|
//! Returns a pointer to the mesh manipulator.
|
||||||
scene::IMeshManipulator* getMeshManipulator() override;
|
scene::IMeshManipulator* getMeshManipulator() override;
|
||||||
|
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
// Copyright (C) 2015 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_)
|
|
||||||
#include <OpenGLES/ES2/gl.h>
|
|
||||||
#include <OpenGLES/ES2/glext.h>
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#include <GLES2/gl2ext.h>
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
#elif defined(_IRR_EMSCRIPTEN_PLATFORM_)
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#include <GLES2/gl2ext.h>
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
#else
|
|
||||||
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
|
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
|
||||||
#define GLX_GLXEXT_PROTOTYPES 1
|
|
||||||
#endif
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#include <EGL/eglplatform.h>
|
|
||||||
typedef char GLchar;
|
|
||||||
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
|
|
||||||
#include <GLES2/gl2ext.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_BGRA
|
|
||||||
#define GL_BGRA 0x80E1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FBO definitions.
|
|
||||||
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 1
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 2
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 3
|
|
||||||
|
|
||||||
// to check if this header is in the current compile unit (different GL implementation used different "GLCommon" headers in Irrlicht
|
|
||||||
#define IRR_COMPILE_GLES2_COMMON
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declarations.
|
|
||||||
|
|
||||||
class COpenGLCoreFeature;
|
|
||||||
|
|
||||||
template <class TOpenGLDriver>
|
|
||||||
class COpenGLCoreTexture;
|
|
||||||
|
|
||||||
template <class TOpenGLDriver, class TOpenGLTexture>
|
|
||||||
class COpenGLCoreRenderTarget;
|
|
||||||
|
|
||||||
template <class TOpenGLDriver, class TOpenGLTexture>
|
|
||||||
class COpenGLCoreCacheHandler;
|
|
||||||
|
|
||||||
class COGLES2Driver;
|
|
||||||
typedef COpenGLCoreTexture<COGLES2Driver> COGLES2Texture;
|
|
||||||
typedef COpenGLCoreRenderTarget<COGLES2Driver, COGLES2Texture> COGLES2RenderTarget;
|
|
||||||
typedef COpenGLCoreCacheHandler<COGLES2Driver, COGLES2Texture> COGLES2CacheHandler;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
@ -1,405 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// Copyright (C) 2009-2010 Amundis
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "SIrrCreationParameters.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "CNullDriver.h"
|
|
||||||
#include "IMaterialRendererServices.h"
|
|
||||||
#include "EDriverFeatures.h"
|
|
||||||
#include "fast_atof.h"
|
|
||||||
#include "COGLES2ExtensionHandler.h"
|
|
||||||
#include "IContextManager.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COGLES2FixedPipelineRenderer;
|
|
||||||
class COGLES2Renderer2D;
|
|
||||||
|
|
||||||
class COGLES2Driver : public CNullDriver, public IMaterialRendererServices, public COGLES2ExtensionHandler
|
|
||||||
{
|
|
||||||
friend class COpenGLCoreTexture<COGLES2Driver>;
|
|
||||||
friend IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! constructor (use createOGLES2Driver instead)
|
|
||||||
COGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! destructor
|
|
||||||
virtual ~COGLES2Driver();
|
|
||||||
|
|
||||||
virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0), f32 clearDepth = 1.f, u8 clearStencil = 0,
|
|
||||||
const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0) override;
|
|
||||||
|
|
||||||
bool endScene() override;
|
|
||||||
|
|
||||||
//! sets transformation
|
|
||||||
void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) override;
|
|
||||||
|
|
||||||
struct SHWBufferLink_opengl : public SHWBufferLink
|
|
||||||
{
|
|
||||||
SHWBufferLink_opengl(const scene::IMeshBuffer *meshBuffer)
|
|
||||||
: SHWBufferLink(meshBuffer), vbo_verticesID(0), vbo_indicesID(0)
|
|
||||||
, vbo_verticesSize(0), vbo_indicesSize(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
u32 vbo_verticesID; //tmp
|
|
||||||
u32 vbo_indicesID; //tmp
|
|
||||||
|
|
||||||
u32 vbo_verticesSize; //tmp
|
|
||||||
u32 vbo_indicesSize; //tmp
|
|
||||||
};
|
|
||||||
|
|
||||||
bool updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);
|
|
||||||
bool updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer);
|
|
||||||
|
|
||||||
//! updates hardware buffer if needed
|
|
||||||
bool updateHardwareBuffer(SHWBufferLink *HWBuffer) override;
|
|
||||||
|
|
||||||
//! Create hardware buffer from mesh
|
|
||||||
SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer* mb) override;
|
|
||||||
|
|
||||||
//! Delete hardware buffer (only some drivers can)
|
|
||||||
void deleteHardwareBuffer(SHWBufferLink *HWBuffer) override;
|
|
||||||
|
|
||||||
//! Draw hardware buffer
|
|
||||||
void drawHardwareBuffer(SHWBufferLink *HWBuffer) override;
|
|
||||||
|
|
||||||
IRenderTarget* addRenderTarget() override;
|
|
||||||
|
|
||||||
//! draws a vertex primitive list
|
|
||||||
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
|
||||||
const void* indexList, u32 primitiveCount,
|
|
||||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) override;
|
|
||||||
|
|
||||||
//! queries the features of the driver, returns true if feature is available
|
|
||||||
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override
|
|
||||||
{
|
|
||||||
return FeatureEnabled[feature] && COGLES2ExtensionHandler::queryFeature(feature);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets a material.
|
|
||||||
void setMaterial(const SMaterial& material) override;
|
|
||||||
|
|
||||||
virtual void draw2DImage(const video::ITexture* texture,
|
|
||||||
const core::position2d<s32>& destPos,
|
|
||||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
|
|
||||||
SColor color = SColor(255, 255, 255, 255), bool useAlphaChannelOfTexture = false) override;
|
|
||||||
|
|
||||||
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
|
||||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
|
|
||||||
const video::SColor* const colors = 0, bool useAlphaChannelOfTexture = false) override;
|
|
||||||
|
|
||||||
// internally used
|
|
||||||
virtual void draw2DImage(const video::ITexture* texture, u32 layer, bool flip);
|
|
||||||
|
|
||||||
//! draws a set of 2d images
|
|
||||||
virtual void draw2DImageBatch(const video::ITexture* texture,
|
|
||||||
const core::position2d<s32>& pos,
|
|
||||||
const core::array<core::rect<s32> >& sourceRects,
|
|
||||||
const core::array<s32>& indices, s32 kerningWidth = 0,
|
|
||||||
const core::rect<s32>* clipRect = 0,
|
|
||||||
SColor color = SColor(255, 255, 255, 255),
|
|
||||||
bool useAlphaChannelOfTexture = false) override;
|
|
||||||
|
|
||||||
void draw2DImageBatch(const video::ITexture* texture,
|
|
||||||
const core::array<core::position2d<s32> >& positions,
|
|
||||||
const core::array<core::rect<s32> >& sourceRects,
|
|
||||||
const core::rect<s32>* clipRect,
|
|
||||||
SColor color,
|
|
||||||
bool useAlphaChannelOfTexture) override;
|
|
||||||
|
|
||||||
//! draw an 2d rectangle
|
|
||||||
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
|
|
||||||
const core::rect<s32>* clip = 0) override;
|
|
||||||
|
|
||||||
//!Draws an 2d rectangle with a gradient.
|
|
||||||
virtual void draw2DRectangle(const core::rect<s32>& pos,
|
|
||||||
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
|
|
||||||
const core::rect<s32>* clip = 0) override;
|
|
||||||
|
|
||||||
//! Draws a 2d line.
|
|
||||||
virtual void draw2DLine(const core::position2d<s32>& start,
|
|
||||||
const core::position2d<s32>& end,
|
|
||||||
SColor color = SColor(255, 255, 255, 255)) override;
|
|
||||||
|
|
||||||
//! Draws a single pixel
|
|
||||||
void drawPixel(u32 x, u32 y, const SColor & color) override;
|
|
||||||
|
|
||||||
//! Draws a 3d line.
|
|
||||||
virtual void draw3DLine(const core::vector3df& start,
|
|
||||||
const core::vector3df& end,
|
|
||||||
SColor color = SColor(255, 255, 255, 255)) override;
|
|
||||||
|
|
||||||
//! Draws a pixel
|
|
||||||
// virtual void drawPixel(u32 x, u32 y, const SColor & color);
|
|
||||||
|
|
||||||
//! Returns the name of the video driver.
|
|
||||||
const wchar_t* getName() const override;
|
|
||||||
|
|
||||||
//! Returns the maximum texture size supported.
|
|
||||||
core::dimension2du getMaxTextureSize() const override;
|
|
||||||
|
|
||||||
//! Draws a shadow volume into the stencil buffer.
|
|
||||||
void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible=0) override;
|
|
||||||
|
|
||||||
//! Fills the stencil shadow with color.
|
|
||||||
virtual void drawStencilShadow(bool clearStencilBuffer=false,
|
|
||||||
video::SColor leftUpEdge = video::SColor(0,0,0,0),
|
|
||||||
video::SColor rightUpEdge = video::SColor(0,0,0,0),
|
|
||||||
video::SColor leftDownEdge = video::SColor(0,0,0,0),
|
|
||||||
video::SColor rightDownEdge = video::SColor(0,0,0,0)) override;
|
|
||||||
|
|
||||||
//! sets a viewport
|
|
||||||
void setViewPort(const core::rect<s32>& area) override;
|
|
||||||
|
|
||||||
//! Only used internally by the engine
|
|
||||||
void OnResize(const core::dimension2d<u32>& size) override;
|
|
||||||
|
|
||||||
//! Returns type of video driver
|
|
||||||
E_DRIVER_TYPE getDriverType() const override;
|
|
||||||
|
|
||||||
//! get color format of the current color buffer
|
|
||||||
ECOLOR_FORMAT getColorFormat() const override;
|
|
||||||
|
|
||||||
//! Returns the transformation set by setTransform
|
|
||||||
const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const override;
|
|
||||||
|
|
||||||
//! Can be called by an IMaterialRenderer to make its work easier.
|
|
||||||
void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, bool resetAllRenderstates) override;
|
|
||||||
|
|
||||||
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
|
||||||
void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates);
|
|
||||||
|
|
||||||
//! Get a vertex shader constant index.
|
|
||||||
s32 getVertexShaderConstantID(const c8* name) override;
|
|
||||||
|
|
||||||
//! Get a pixel shader constant index.
|
|
||||||
s32 getPixelShaderConstantID(const c8* name) override;
|
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount = 1) override;
|
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount = 1) override;
|
|
||||||
|
|
||||||
//! Sets a constant for the vertex shader based on an index.
|
|
||||||
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
|
||||||
|
|
||||||
//! Int interface for the above.
|
|
||||||
bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
|
|
||||||
|
|
||||||
//! Uint interface for the above.
|
|
||||||
bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
|
|
||||||
|
|
||||||
//! Sets a constant for the pixel shader based on an index.
|
|
||||||
bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;
|
|
||||||
|
|
||||||
//! Int interface for the above.
|
|
||||||
bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;
|
|
||||||
|
|
||||||
//! Uint interface for the above.
|
|
||||||
bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver
|
|
||||||
virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData) override;
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver
|
|
||||||
virtual s32 addHighLevelShaderMaterial(
|
|
||||||
const c8* vertexShaderProgram,
|
|
||||||
const c8* vertexShaderEntryPointName = 0,
|
|
||||||
E_VERTEX_SHADER_TYPE vsCompileTarget = EVST_VS_1_1,
|
|
||||||
const c8* pixelShaderProgram = 0,
|
|
||||||
const c8* pixelShaderEntryPointName = 0,
|
|
||||||
E_PIXEL_SHADER_TYPE psCompileTarget = EPST_PS_1_1,
|
|
||||||
const c8* geometryShaderProgram = 0,
|
|
||||||
const c8* geometryShaderEntryPointName = "main",
|
|
||||||
E_GEOMETRY_SHADER_TYPE gsCompileTarget = EGST_GS_4_0,
|
|
||||||
scene::E_PRIMITIVE_TYPE inType = scene::EPT_TRIANGLES,
|
|
||||||
scene::E_PRIMITIVE_TYPE outType = scene::EPT_TRIANGLE_STRIP,
|
|
||||||
u32 verticesOut = 0,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID,
|
|
||||||
s32 userData=0) override;
|
|
||||||
|
|
||||||
//! Returns pointer to the IGPUProgrammingServices interface.
|
|
||||||
IGPUProgrammingServices* getGPUProgrammingServices() override;
|
|
||||||
|
|
||||||
//! Returns a pointer to the IVideoDriver interface.
|
|
||||||
IVideoDriver* getVideoDriver() override;
|
|
||||||
|
|
||||||
//! Returns the maximum amount of primitives
|
|
||||||
u32 getMaximalPrimitiveCount() const override;
|
|
||||||
|
|
||||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
|
||||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) override;
|
|
||||||
|
|
||||||
//! Creates a render target texture for a cubemap
|
|
||||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
|
||||||
const io::path& name, const ECOLOR_FORMAT format) override;
|
|
||||||
|
|
||||||
virtual bool setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SColor clearColor = SColor(255, 0, 0, 0),
|
|
||||||
f32 clearDepth = 1.f, u8 clearStencil = 0) override;
|
|
||||||
|
|
||||||
void clearBuffers(u16 flag, SColor color = SColor(255, 0, 0, 0), f32 depth = 1.f, u8 stencil = 0) override;
|
|
||||||
|
|
||||||
//! Returns an image created from the last rendered frame.
|
|
||||||
IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER) override;
|
|
||||||
|
|
||||||
//! checks if an OpenGL error has happened and prints it (+ some internal code which is usually the line number)
|
|
||||||
bool testGLError(int code=0);
|
|
||||||
|
|
||||||
//! checks if an OGLES1 error has happened and prints it
|
|
||||||
bool testEGLError();
|
|
||||||
|
|
||||||
//! Set/unset a clipping plane.
|
|
||||||
bool setClipPlane(u32 index, const core::plane3df& plane, bool enable = false) override;
|
|
||||||
|
|
||||||
//! returns the current amount of user clip planes set.
|
|
||||||
u32 getClipPlaneCount() const;
|
|
||||||
|
|
||||||
//! returns the 0 indexed Plane
|
|
||||||
const core::plane3df& getClipPlane(u32 index) const;
|
|
||||||
|
|
||||||
//! Enable/disable a clipping plane.
|
|
||||||
void enableClipPlane(u32 index, bool enable) override;
|
|
||||||
|
|
||||||
//! Returns the graphics card vendor name.
|
|
||||||
core::stringc getVendorInfo() override
|
|
||||||
{
|
|
||||||
return VendorName;
|
|
||||||
};
|
|
||||||
|
|
||||||
void removeTexture(ITexture* texture) override;
|
|
||||||
|
|
||||||
//! Check if the driver supports creating textures with the given color format
|
|
||||||
bool queryTextureFormat(ECOLOR_FORMAT format) const override;
|
|
||||||
|
|
||||||
//! Used by some SceneNodes to check if a material should be rendered in the transparent render pass
|
|
||||||
bool needsTransparentRenderPass(const irr::video::SMaterial& material) const override;
|
|
||||||
|
|
||||||
//! Convert E_BLEND_FACTOR to OpenGL equivalent
|
|
||||||
GLenum getGLBlend(E_BLEND_FACTOR factor) const;
|
|
||||||
|
|
||||||
//! Get ZBuffer bits.
|
|
||||||
virtual GLenum getZBufferBits() const;
|
|
||||||
|
|
||||||
virtual bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
|
||||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;
|
|
||||||
|
|
||||||
//! Get current material.
|
|
||||||
const SMaterial& getCurrentMaterial() const;
|
|
||||||
|
|
||||||
COGLES2CacheHandler* getCacheHandler() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! inits the opengl-es driver
|
|
||||||
virtual bool genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer);
|
|
||||||
|
|
||||||
void chooseMaterial2D();
|
|
||||||
|
|
||||||
ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) override;
|
|
||||||
|
|
||||||
ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image) override;
|
|
||||||
|
|
||||||
//! Map Irrlicht wrap mode to OpenGL enum
|
|
||||||
GLint getTextureWrapMode(u8 clamp) const;
|
|
||||||
|
|
||||||
//! sets the needed renderstates
|
|
||||||
void setRenderStates3DMode();
|
|
||||||
|
|
||||||
//! sets the needed renderstates
|
|
||||||
void setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel);
|
|
||||||
|
|
||||||
//! Prevent setRenderStateMode calls to do anything.
|
|
||||||
// hack to allow drawing meshbuffers in 2D mode.
|
|
||||||
// Better solution would be passing this flag through meshbuffers,
|
|
||||||
// but the way this is currently implemented in Irrlicht makes this tricky to implement
|
|
||||||
void lockRenderStateMode()
|
|
||||||
{
|
|
||||||
LockRenderStateMode = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Allow setRenderStateMode calls to work again
|
|
||||||
void unlockRenderStateMode()
|
|
||||||
{
|
|
||||||
LockRenderStateMode = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw2D3DVertexPrimitiveList(const void* vertices,
|
|
||||||
u32 vertexCount, const void* indexList, u32 primitiveCount,
|
|
||||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType,
|
|
||||||
E_INDEX_TYPE iType, bool is3D);
|
|
||||||
|
|
||||||
void createMaterialRenderers();
|
|
||||||
|
|
||||||
void loadShaderData(const io::path& vertexShaderName, const io::path& fragmentShaderName, c8** vertexShaderData, c8** fragmentShaderData);
|
|
||||||
|
|
||||||
bool setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture);
|
|
||||||
|
|
||||||
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
|
|
||||||
virtual void setViewPortRaw(u32 width, u32 height);
|
|
||||||
|
|
||||||
COGLES2CacheHandler* CacheHandler;
|
|
||||||
core::stringw Name;
|
|
||||||
core::stringc VendorName;
|
|
||||||
SIrrlichtCreationParameters Params;
|
|
||||||
|
|
||||||
//! bool to make all renderstates reset if set to true.
|
|
||||||
bool ResetRenderStates;
|
|
||||||
bool LockRenderStateMode;
|
|
||||||
u8 AntiAlias;
|
|
||||||
|
|
||||||
struct SUserClipPlane
|
|
||||||
{
|
|
||||||
core::plane3df Plane;
|
|
||||||
bool Enabled;
|
|
||||||
};
|
|
||||||
|
|
||||||
core::array<SUserClipPlane> UserClipPlane;
|
|
||||||
|
|
||||||
core::matrix4 TextureFlipMatrix;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
COGLES2Renderer2D* MaterialRenderer2DActive;
|
|
||||||
COGLES2Renderer2D* MaterialRenderer2DTexture;
|
|
||||||
COGLES2Renderer2D* MaterialRenderer2DNoTexture;
|
|
||||||
|
|
||||||
core::matrix4 Matrices[ETS_COUNT];
|
|
||||||
|
|
||||||
//! enumeration for rendering modes such as 2d and 3d for minimizing the switching of renderStates.
|
|
||||||
enum E_RENDER_MODE
|
|
||||||
{
|
|
||||||
ERM_NONE = 0, // no render state has been set yet.
|
|
||||||
ERM_2D, // 2d drawing rendermode
|
|
||||||
ERM_3D // 3d rendering mode
|
|
||||||
};
|
|
||||||
|
|
||||||
E_RENDER_MODE CurrentRenderMode;
|
|
||||||
bool Transformation3DChanged;
|
|
||||||
irr::io::path OGLES2ShaderPath;
|
|
||||||
|
|
||||||
SMaterial Material, LastMaterial;
|
|
||||||
|
|
||||||
//! Color buffer format
|
|
||||||
ECOLOR_FORMAT ColorFormat;
|
|
||||||
|
|
||||||
IContextManager* ContextManager;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace video
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
|
@ -1,57 +0,0 @@
|
|||||||
// Copyright (C) 2015 Patryk Nadrowski
|
|
||||||
// Copyright (C) 2009-2010 Amundis
|
|
||||||
// 2017 modified by Michael Zeilfelder (unifying extension handlers)
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#include "COGLES2ExtensionHandler.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "irrString.h"
|
|
||||||
#include "SMaterial.h"
|
|
||||||
#include "fast_atof.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
void COGLES2ExtensionHandler::initExtensions()
|
|
||||||
{
|
|
||||||
getGLVersion();
|
|
||||||
|
|
||||||
getGLExtensions();
|
|
||||||
|
|
||||||
GLint val=0;
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &val);
|
|
||||||
Feature.MaxTextureUnits = static_cast<u8>(val);
|
|
||||||
|
|
||||||
#ifdef GL_EXT_texture_filter_anisotropic
|
|
||||||
if (FeatureAvailable[IRR_GL_EXT_texture_filter_anisotropic])
|
|
||||||
{
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &val);
|
|
||||||
MaxAnisotropy = static_cast<u8>(val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef GL_MAX_ELEMENTS_INDICES
|
|
||||||
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &val);
|
|
||||||
MaxIndices=val;
|
|
||||||
#endif
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val);
|
|
||||||
MaxTextureSize=static_cast<u32>(val);
|
|
||||||
#ifdef GL_EXT_texture_lod_bias
|
|
||||||
if (FeatureAvailable[IRR_EXT_texture_lod_bias])
|
|
||||||
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &MaxTextureLODBias);
|
|
||||||
#endif
|
|
||||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, DimAliasedLine);
|
|
||||||
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, DimAliasedPoint);
|
|
||||||
|
|
||||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
|
||||||
Feature.ColorAttachment = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace video
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
|
@ -1,190 +0,0 @@
|
|||||||
// Copyright (C) 2015 Patryk Nadrowski
|
|
||||||
// Copyright (C) 2009-2010 Amundis
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "EDriverFeatures.h"
|
|
||||||
#include "irrTypes.h"
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
#include "COGLES2Common.h"
|
|
||||||
|
|
||||||
#include "COGLESCoreExtensionHandler.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COGLES2ExtensionHandler : public COGLESCoreExtensionHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
COGLES2ExtensionHandler() : COGLESCoreExtensionHandler() {}
|
|
||||||
|
|
||||||
void initExtensions();
|
|
||||||
|
|
||||||
bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
|
|
||||||
{
|
|
||||||
switch (feature)
|
|
||||||
{
|
|
||||||
case EVDF_RENDER_TO_TARGET:
|
|
||||||
case EVDF_HARDWARE_TL:
|
|
||||||
case EVDF_MULTITEXTURE:
|
|
||||||
case EVDF_BILINEAR_FILTER:
|
|
||||||
case EVDF_MIP_MAP:
|
|
||||||
case EVDF_MIP_MAP_AUTO_UPDATE:
|
|
||||||
case EVDF_VERTEX_SHADER_1_1:
|
|
||||||
case EVDF_PIXEL_SHADER_1_1:
|
|
||||||
case EVDF_PIXEL_SHADER_1_2:
|
|
||||||
case EVDF_PIXEL_SHADER_2_0:
|
|
||||||
case EVDF_VERTEX_SHADER_2_0:
|
|
||||||
case EVDF_ARB_GLSL:
|
|
||||||
case EVDF_TEXTURE_NSQUARE:
|
|
||||||
case EVDF_TEXTURE_NPOT:
|
|
||||||
case EVDF_FRAMEBUFFER_OBJECT:
|
|
||||||
case EVDF_VERTEX_BUFFER_OBJECT:
|
|
||||||
case EVDF_COLOR_MASK:
|
|
||||||
case EVDF_ALPHA_TO_COVERAGE:
|
|
||||||
case EVDF_POLYGON_OFFSET:
|
|
||||||
case EVDF_BLEND_OPERATIONS:
|
|
||||||
case EVDF_BLEND_SEPARATE:
|
|
||||||
case EVDF_TEXTURE_MATRIX:
|
|
||||||
case EVDF_TEXTURE_CUBEMAP:
|
|
||||||
return true;
|
|
||||||
case EVDF_ARB_VERTEX_PROGRAM_1:
|
|
||||||
case EVDF_ARB_FRAGMENT_PROGRAM_1:
|
|
||||||
case EVDF_GEOMETRY_SHADER:
|
|
||||||
case EVDF_MULTIPLE_RENDER_TARGETS:
|
|
||||||
case EVDF_MRT_BLEND:
|
|
||||||
case EVDF_MRT_COLOR_MASK:
|
|
||||||
case EVDF_MRT_BLEND_FUNC:
|
|
||||||
case EVDF_OCCLUSION_QUERY:
|
|
||||||
return false;
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
|
||||||
return false; // NV Tegra need improvements here
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_PVRTC:
|
|
||||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_PVRTC2:
|
|
||||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc2];
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_ETC1:
|
|
||||||
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_ETC2:
|
|
||||||
return false;
|
|
||||||
case EVDF_STENCIL_BUFFER:
|
|
||||||
return StencilBuffer;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlActiveTexture(GLenum texture)
|
|
||||||
{
|
|
||||||
glActiveTexture(texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,
|
|
||||||
GLsizei imageSize, const void* data)
|
|
||||||
{
|
|
||||||
glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
|
|
||||||
GLenum format, GLsizei imageSize, const void* data)
|
|
||||||
{
|
|
||||||
glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlUseProgram(GLuint prog)
|
|
||||||
{
|
|
||||||
glUseProgram(prog);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
|
|
||||||
{
|
|
||||||
glBindFramebuffer(target, framebuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
|
|
||||||
{
|
|
||||||
glDeleteFramebuffers(n, framebuffers);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
|
|
||||||
{
|
|
||||||
glGenFramebuffers(n, framebuffers);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline GLenum irrGlCheckFramebufferStatus(GLenum target)
|
|
||||||
{
|
|
||||||
return glCheckFramebufferStatus(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
|
||||||
{
|
|
||||||
glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlGenerateMipmap(GLenum target)
|
|
||||||
{
|
|
||||||
glGenerateMipmap(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlActiveStencilFace(GLenum face)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlDrawBuffer(GLenum mode)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlDrawBuffers(GLsizei n, const GLenum *bufs)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
|
|
||||||
{
|
|
||||||
glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendEquation(GLenum mode)
|
|
||||||
{
|
|
||||||
glBlendEquation(mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlEnableIndexed(GLenum target, GLuint index)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlDisableIndexed(GLenum target, GLuint index)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlColorMaskIndexed(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendFuncSeparateIndexed(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendEquationIndexed(GLuint buf, GLenum mode)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void irrGlBlendEquationSeparateIndexed(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,203 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#include "COGLES2FixedPipelineRenderer.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "IVideoDriver.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
// Base callback
|
|
||||||
|
|
||||||
COGLES2MaterialBaseCB::COGLES2MaterialBaseCB() :
|
|
||||||
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1), GlobalAmbientID(-1), MaterialAmbientID(-1), MaterialDiffuseID(-1), MaterialEmissiveID(-1), MaterialSpecularID(-1), MaterialShininessID(-1),
|
|
||||||
FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-1),
|
|
||||||
FogEndID(-1), FogDensityID(-1), ThicknessID(-1), LightEnable(false), MaterialAmbient(SColorf(0.f, 0.f, 0.f)), MaterialDiffuse(SColorf(0.f, 0.f, 0.f)), MaterialEmissive(SColorf(0.f, 0.f, 0.f)), MaterialSpecular(SColorf(0.f, 0.f, 0.f)),
|
|
||||||
MaterialShininess(0.f), FogEnable(0), FogType(1), FogColor(SColorf(0.f, 0.f, 0.f, 1.f)), FogStart(0.f), FogEnd(0.f), FogDensity(0.f), Thickness(1.f)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialBaseCB::OnSetMaterial(const SMaterial& material)
|
|
||||||
{
|
|
||||||
LightEnable = material.Lighting;
|
|
||||||
MaterialAmbient = SColorf(material.AmbientColor);
|
|
||||||
MaterialDiffuse = SColorf(material.DiffuseColor);
|
|
||||||
MaterialEmissive = SColorf(material.EmissiveColor);
|
|
||||||
MaterialSpecular = SColorf(material.SpecularColor);
|
|
||||||
MaterialShininess = material.Shininess;
|
|
||||||
|
|
||||||
FogEnable = material.FogEnable ? 1 : 0;
|
|
||||||
|
|
||||||
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
|
||||||
{
|
|
||||||
IVideoDriver* driver = services->getVideoDriver();
|
|
||||||
|
|
||||||
if (FirstUpdateBase)
|
|
||||||
{
|
|
||||||
WVPMatrixID = services->getVertexShaderConstantID("uWVPMatrix");
|
|
||||||
WVMatrixID = services->getVertexShaderConstantID("uWVMatrix");
|
|
||||||
NMatrixID = services->getVertexShaderConstantID("uNMatrix");
|
|
||||||
GlobalAmbientID = services->getVertexShaderConstantID("uGlobalAmbient");
|
|
||||||
MaterialAmbientID = services->getVertexShaderConstantID("uMaterialAmbient");
|
|
||||||
MaterialDiffuseID = services->getVertexShaderConstantID("uMaterialDiffuse");
|
|
||||||
MaterialEmissiveID = services->getVertexShaderConstantID("uMaterialEmissive");
|
|
||||||
MaterialSpecularID = services->getVertexShaderConstantID("uMaterialSpecular");
|
|
||||||
MaterialShininessID = services->getVertexShaderConstantID("uMaterialShininess");
|
|
||||||
FogEnableID = services->getVertexShaderConstantID("uFogEnable");
|
|
||||||
FogTypeID = services->getVertexShaderConstantID("uFogType");
|
|
||||||
FogColorID = services->getVertexShaderConstantID("uFogColor");
|
|
||||||
FogStartID = services->getVertexShaderConstantID("uFogStart");
|
|
||||||
FogEndID = services->getVertexShaderConstantID("uFogEnd");
|
|
||||||
FogDensityID = services->getVertexShaderConstantID("uFogDensity");
|
|
||||||
ThicknessID = services->getVertexShaderConstantID("uThickness");
|
|
||||||
|
|
||||||
FirstUpdateBase = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const core::matrix4 W = driver->getTransform(ETS_WORLD);
|
|
||||||
const core::matrix4 V = driver->getTransform(ETS_VIEW);
|
|
||||||
const core::matrix4 P = driver->getTransform(ETS_PROJECTION);
|
|
||||||
|
|
||||||
core::matrix4 Matrix = P * V * W;
|
|
||||||
services->setPixelShaderConstant(WVPMatrixID, Matrix.pointer(), 16);
|
|
||||||
|
|
||||||
Matrix = V * W;
|
|
||||||
services->setPixelShaderConstant(WVMatrixID, Matrix.pointer(), 16);
|
|
||||||
|
|
||||||
Matrix.makeInverse();
|
|
||||||
services->setPixelShaderConstant(NMatrixID, Matrix.getTransposed().pointer(), 16);
|
|
||||||
|
|
||||||
services->setPixelShaderConstant(FogEnableID, &FogEnable, 1);
|
|
||||||
|
|
||||||
if (FogEnable)
|
|
||||||
{
|
|
||||||
SColor TempColor(0);
|
|
||||||
E_FOG_TYPE TempType = EFT_FOG_LINEAR;
|
|
||||||
bool TempPerFragment = false;
|
|
||||||
bool TempRange = false;
|
|
||||||
|
|
||||||
driver->getFog(TempColor, TempType, FogStart, FogEnd, FogDensity, TempPerFragment, TempRange);
|
|
||||||
|
|
||||||
FogType = (s32)TempType;
|
|
||||||
FogColor = SColorf(TempColor);
|
|
||||||
|
|
||||||
services->setPixelShaderConstant(FogTypeID, &FogType, 1);
|
|
||||||
services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32*>(&FogColor), 4);
|
|
||||||
services->setPixelShaderConstant(FogStartID, &FogStart, 1);
|
|
||||||
services->setPixelShaderConstant(FogEndID, &FogEnd, 1);
|
|
||||||
services->setPixelShaderConstant(FogDensityID, &FogDensity, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
services->setPixelShaderConstant(ThicknessID, &Thickness, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// EMT_SOLID + EMT_TRANSPARENT_ALPHA_CHANNEL + EMT_TRANSPARENT_VERTEX_ALPHA
|
|
||||||
|
|
||||||
COGLES2MaterialSolidCB::COGLES2MaterialSolidCB() :
|
|
||||||
FirstUpdate(true), TMatrix0ID(-1), AlphaRefID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), AlphaRef(0.5f), TextureUsage0(0), TextureUnit0(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialSolidCB::OnSetMaterial(const SMaterial& material)
|
|
||||||
{
|
|
||||||
COGLES2MaterialBaseCB::OnSetMaterial(material);
|
|
||||||
|
|
||||||
AlphaRef = material.MaterialTypeParam;
|
|
||||||
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
|
||||||
{
|
|
||||||
COGLES2MaterialBaseCB::OnSetConstants(services, userData);
|
|
||||||
|
|
||||||
IVideoDriver* driver = services->getVideoDriver();
|
|
||||||
|
|
||||||
if (FirstUpdate)
|
|
||||||
{
|
|
||||||
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
|
|
||||||
AlphaRefID = services->getVertexShaderConstantID("uAlphaRef");
|
|
||||||
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
|
|
||||||
TextureUnit0ID = services->getVertexShaderConstantID("uTextureUnit0");
|
|
||||||
|
|
||||||
FirstUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
|
|
||||||
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
|
|
||||||
|
|
||||||
services->setPixelShaderConstant(AlphaRefID, &AlphaRef, 1);
|
|
||||||
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
|
|
||||||
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// EMT_ONETEXTURE_BLEND
|
|
||||||
|
|
||||||
COGLES2MaterialOneTextureBlendCB::COGLES2MaterialOneTextureBlendCB() :
|
|
||||||
FirstUpdate(true), TMatrix0ID(-1), BlendTypeID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), BlendType(0), TextureUsage0(0), TextureUnit0(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
|
|
||||||
{
|
|
||||||
COGLES2MaterialBaseCB::OnSetMaterial(material);
|
|
||||||
|
|
||||||
BlendType = 0;
|
|
||||||
|
|
||||||
E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact;
|
|
||||||
E_MODULATE_FUNC modulate;
|
|
||||||
u32 alphaSource;
|
|
||||||
unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulate, alphaSource, material.MaterialTypeParam);
|
|
||||||
|
|
||||||
if (textureBlendFunc_hasAlpha(srcRGBFact) || textureBlendFunc_hasAlpha(dstRGBFact) || textureBlendFunc_hasAlpha(srcAlphaFact) || textureBlendFunc_hasAlpha(dstAlphaFact))
|
|
||||||
{
|
|
||||||
if (alphaSource == EAS_VERTEX_COLOR)
|
|
||||||
{
|
|
||||||
BlendType = 1;
|
|
||||||
}
|
|
||||||
else if (alphaSource == EAS_TEXTURE)
|
|
||||||
{
|
|
||||||
BlendType = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
|
|
||||||
{
|
|
||||||
COGLES2MaterialBaseCB::OnSetConstants(services, userData);
|
|
||||||
|
|
||||||
IVideoDriver* driver = services->getVideoDriver();
|
|
||||||
|
|
||||||
if (FirstUpdate)
|
|
||||||
{
|
|
||||||
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
|
|
||||||
BlendTypeID = services->getVertexShaderConstantID("uBlendType");
|
|
||||||
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
|
|
||||||
TextureUnit0ID = services->getVertexShaderConstantID("uTextureUnit0");
|
|
||||||
|
|
||||||
FirstUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
|
|
||||||
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
|
|
||||||
|
|
||||||
services->setPixelShaderConstant(BlendTypeID, &BlendType, 1);
|
|
||||||
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
|
|
||||||
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "IShaderConstantSetCallBack.h"
|
|
||||||
#include "IMaterialRendererServices.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COGLES2MaterialBaseCB : public IShaderConstantSetCallBack
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
COGLES2MaterialBaseCB();
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material);
|
|
||||||
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool FirstUpdateBase;
|
|
||||||
|
|
||||||
s32 WVPMatrixID;
|
|
||||||
s32 WVMatrixID;
|
|
||||||
s32 NMatrixID;
|
|
||||||
|
|
||||||
s32 GlobalAmbientID;
|
|
||||||
s32 MaterialAmbientID;
|
|
||||||
s32 MaterialDiffuseID;
|
|
||||||
s32 MaterialEmissiveID;
|
|
||||||
s32 MaterialSpecularID;
|
|
||||||
s32 MaterialShininessID;
|
|
||||||
|
|
||||||
s32 FogEnableID;
|
|
||||||
s32 FogTypeID;
|
|
||||||
s32 FogColorID;
|
|
||||||
s32 FogStartID;
|
|
||||||
s32 FogEndID;
|
|
||||||
s32 FogDensityID;
|
|
||||||
|
|
||||||
s32 ThicknessID;
|
|
||||||
|
|
||||||
bool LightEnable;
|
|
||||||
SColorf GlobalAmbient;
|
|
||||||
SColorf MaterialAmbient;
|
|
||||||
SColorf MaterialDiffuse;
|
|
||||||
SColorf MaterialEmissive;
|
|
||||||
SColorf MaterialSpecular;
|
|
||||||
f32 MaterialShininess;
|
|
||||||
|
|
||||||
s32 FogEnable;
|
|
||||||
s32 FogType;
|
|
||||||
SColorf FogColor;
|
|
||||||
f32 FogStart;
|
|
||||||
f32 FogEnd;
|
|
||||||
f32 FogDensity;
|
|
||||||
|
|
||||||
f32 Thickness;
|
|
||||||
};
|
|
||||||
|
|
||||||
class COGLES2MaterialSolidCB : public COGLES2MaterialBaseCB
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
COGLES2MaterialSolidCB();
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material);
|
|
||||||
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool FirstUpdate;
|
|
||||||
|
|
||||||
s32 TMatrix0ID;
|
|
||||||
s32 AlphaRefID;
|
|
||||||
s32 TextureUsage0ID;
|
|
||||||
s32 TextureUnit0ID;
|
|
||||||
|
|
||||||
f32 AlphaRef;
|
|
||||||
s32 TextureUsage0;
|
|
||||||
s32 TextureUnit0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class COGLES2MaterialOneTextureBlendCB : public COGLES2MaterialBaseCB
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
COGLES2MaterialOneTextureBlendCB();
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material);
|
|
||||||
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool FirstUpdate;
|
|
||||||
|
|
||||||
s32 TMatrix0ID;
|
|
||||||
s32 BlendTypeID;
|
|
||||||
s32 TextureUsage0ID;
|
|
||||||
s32 TextureUnit0ID;
|
|
||||||
|
|
||||||
s32 BlendType;
|
|
||||||
s32 TextureUsage0;
|
|
||||||
s32 TextureUnit0;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,476 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#include "COGLES2MaterialRenderer.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "EVertexAttributes.h"
|
|
||||||
#include "IGPUProgrammingServices.h"
|
|
||||||
#include "IShaderConstantSetCallBack.h"
|
|
||||||
#include "IVideoDriver.h"
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
#include "COGLES2Driver.h"
|
|
||||||
|
|
||||||
#include "COpenGLCoreTexture.h"
|
|
||||||
#include "COpenGLCoreCacheHandler.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
|
|
||||||
s32& outMaterialTypeNr,
|
|
||||||
const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial,
|
|
||||||
s32 userData)
|
|
||||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), Program(0), UserData(userData)
|
|
||||||
{
|
|
||||||
#ifdef _DEBUG
|
|
||||||
setDebugName("COGLES2MaterialRenderer");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (baseMaterial)
|
|
||||||
{
|
|
||||||
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
|
||||||
Alpha = true;
|
|
||||||
break;
|
|
||||||
case EMT_ONETEXTURE_BLEND:
|
|
||||||
Blending = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->grab();
|
|
||||||
|
|
||||||
init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
|
||||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), Program(0), UserData(userData)
|
|
||||||
{
|
|
||||||
switch (baseMaterial)
|
|
||||||
{
|
|
||||||
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
|
||||||
Alpha = true;
|
|
||||||
break;
|
|
||||||
case EMT_ONETEXTURE_BLEND:
|
|
||||||
Blending = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->grab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
COGLES2MaterialRenderer::~COGLES2MaterialRenderer()
|
|
||||||
{
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->drop();
|
|
||||||
|
|
||||||
if (Program)
|
|
||||||
{
|
|
||||||
GLuint shaders[8];
|
|
||||||
GLint count;
|
|
||||||
glGetAttachedShaders(Program, 8, &count, shaders);
|
|
||||||
|
|
||||||
count=core::min_(count,8);
|
|
||||||
for (GLint i=0; i<count; ++i)
|
|
||||||
glDeleteShader(shaders[i]);
|
|
||||||
glDeleteProgram(Program);
|
|
||||||
Program = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
UniformInfo.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint COGLES2MaterialRenderer::getProgram() const
|
|
||||||
{
|
|
||||||
return Program;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::init(s32& outMaterialTypeNr,
|
|
||||||
const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram,
|
|
||||||
bool addMaterial)
|
|
||||||
{
|
|
||||||
outMaterialTypeNr = -1;
|
|
||||||
|
|
||||||
Program = glCreateProgram();
|
|
||||||
|
|
||||||
if (!Program)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (vertexShaderProgram)
|
|
||||||
if (!createShader(GL_VERTEX_SHADER, vertexShaderProgram))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pixelShaderProgram)
|
|
||||||
if (!createShader(GL_FRAGMENT_SHADER, pixelShaderProgram))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for ( size_t i = 0; i < EVA_COUNT; ++i )
|
|
||||||
glBindAttribLocation( Program, i, sBuiltInVertexAttributeNames[i]);
|
|
||||||
|
|
||||||
if (!linkProgram())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (addMaterial)
|
|
||||||
outMaterialTypeNr = Driver->addMaterialRenderer(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
|
||||||
{
|
|
||||||
if (CallBack && Program)
|
|
||||||
CallBack->OnSetConstants(this, UserData);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::OnSetMaterial(const video::SMaterial& material,
|
|
||||||
const video::SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates,
|
|
||||||
video::IMaterialRendererServices* services)
|
|
||||||
{
|
|
||||||
COGLES2CacheHandler* cacheHandler = Driver->getCacheHandler();
|
|
||||||
|
|
||||||
cacheHandler->setProgram(Program);
|
|
||||||
|
|
||||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
|
||||||
|
|
||||||
if (Alpha)
|
|
||||||
{
|
|
||||||
cacheHandler->setBlend(true);
|
|
||||||
cacheHandler->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
}
|
|
||||||
else if (Blending)
|
|
||||||
{
|
|
||||||
E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact;
|
|
||||||
E_MODULATE_FUNC modulate;
|
|
||||||
u32 alphaSource;
|
|
||||||
unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulate, alphaSource, material.MaterialTypeParam);
|
|
||||||
|
|
||||||
cacheHandler->setBlendFuncSeparate(Driver->getGLBlend(srcRGBFact), Driver->getGLBlend(dstRGBFact),
|
|
||||||
Driver->getGLBlend(srcAlphaFact), Driver->getGLBlend(dstAlphaFact));
|
|
||||||
|
|
||||||
cacheHandler->setBlend(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->OnSetMaterial(material);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::OnUnsetMaterial()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::isTransparent() const
|
|
||||||
{
|
|
||||||
return (Alpha || Blending);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
s32 COGLES2MaterialRenderer::getRenderCapability() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::createShader(GLenum shaderType, const char* shader)
|
|
||||||
{
|
|
||||||
if (Program)
|
|
||||||
{
|
|
||||||
GLuint shaderHandle = glCreateShader(shaderType);
|
|
||||||
glShaderSource(shaderHandle, 1, &shader, NULL);
|
|
||||||
glCompileShader(shaderHandle);
|
|
||||||
|
|
||||||
GLint status = 0;
|
|
||||||
|
|
||||||
glGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &status);
|
|
||||||
|
|
||||||
if (status != GL_TRUE)
|
|
||||||
{
|
|
||||||
os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
|
|
||||||
|
|
||||||
GLint maxLength=0;
|
|
||||||
GLint length;
|
|
||||||
|
|
||||||
glGetShaderiv(shaderHandle, GL_INFO_LOG_LENGTH,
|
|
||||||
&maxLength);
|
|
||||||
|
|
||||||
if (maxLength)
|
|
||||||
{
|
|
||||||
GLchar *infoLog = new GLchar[maxLength];
|
|
||||||
glGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog);
|
|
||||||
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
|
|
||||||
delete [] infoLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
glAttachShader(Program, shaderHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::linkProgram()
|
|
||||||
{
|
|
||||||
if (Program)
|
|
||||||
{
|
|
||||||
glLinkProgram(Program);
|
|
||||||
|
|
||||||
GLint status = 0;
|
|
||||||
|
|
||||||
glGetProgramiv(Program, GL_LINK_STATUS, &status);
|
|
||||||
|
|
||||||
if (!status)
|
|
||||||
{
|
|
||||||
os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
|
|
||||||
|
|
||||||
GLint maxLength=0;
|
|
||||||
GLsizei length;
|
|
||||||
|
|
||||||
glGetProgramiv(Program, GL_INFO_LOG_LENGTH, &maxLength);
|
|
||||||
|
|
||||||
if (maxLength)
|
|
||||||
{
|
|
||||||
GLchar *infoLog = new GLchar[maxLength];
|
|
||||||
glGetProgramInfoLog(Program, maxLength, &length, infoLog);
|
|
||||||
os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
|
|
||||||
delete [] infoLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLint num = 0;
|
|
||||||
|
|
||||||
glGetProgramiv(Program, GL_ACTIVE_UNIFORMS, &num);
|
|
||||||
|
|
||||||
if (num == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
GLint maxlen = 0;
|
|
||||||
|
|
||||||
glGetProgramiv(Program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen);
|
|
||||||
|
|
||||||
if (maxlen == 0)
|
|
||||||
{
|
|
||||||
os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// seems that some implementations use an extra null terminator.
|
|
||||||
++maxlen;
|
|
||||||
c8 *buf = new c8[maxlen];
|
|
||||||
|
|
||||||
UniformInfo.clear();
|
|
||||||
UniformInfo.reallocate(num);
|
|
||||||
|
|
||||||
for (GLint i=0; i < num; ++i)
|
|
||||||
{
|
|
||||||
SUniformInfo ui;
|
|
||||||
memset(buf, 0, maxlen);
|
|
||||||
|
|
||||||
GLint size;
|
|
||||||
glGetActiveUniform(Program, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLchar*>(buf));
|
|
||||||
|
|
||||||
core::stringc name = "";
|
|
||||||
|
|
||||||
// array support, workaround for some bugged drivers.
|
|
||||||
for (s32 i = 0; i < maxlen; ++i)
|
|
||||||
{
|
|
||||||
if (buf[i] == '[' || buf[i] == '\0')
|
|
||||||
break;
|
|
||||||
|
|
||||||
name += buf[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.name = name;
|
|
||||||
ui.location = glGetUniformLocation(Program, buf);
|
|
||||||
|
|
||||||
UniformInfo.push_back(ui);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete [] buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::setBasicRenderStates(const SMaterial& material,
|
|
||||||
const SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates)
|
|
||||||
{
|
|
||||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 COGLES2MaterialRenderer::getVertexShaderConstantID(const c8* name)
|
|
||||||
{
|
|
||||||
return getPixelShaderConstantID(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 COGLES2MaterialRenderer::getPixelShaderConstantID(const c8* name)
|
|
||||||
{
|
|
||||||
for (u32 i = 0; i < UniformInfo.size(); ++i)
|
|
||||||
{
|
|
||||||
if (UniformInfo[i].name == name)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2MaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
os::Printer::log("Cannot set constant, use high level shader call.", ELL_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
|
||||||
{
|
|
||||||
return setPixelShaderConstant(index, floats, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setVertexShaderConstant(s32 index, const s32* ints, int count)
|
|
||||||
{
|
|
||||||
return setPixelShaderConstant(index, ints, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setVertexShaderConstant(s32 index, const u32* ints, int count)
|
|
||||||
{
|
|
||||||
return setPixelShaderConstant(index, ints, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const f32* floats, int count)
|
|
||||||
{
|
|
||||||
if(index < 0 || UniformInfo[index].location < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool status = true;
|
|
||||||
|
|
||||||
switch (UniformInfo[index].type)
|
|
||||||
{
|
|
||||||
case GL_FLOAT:
|
|
||||||
glUniform1fv(UniformInfo[index].location, count, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_VEC2:
|
|
||||||
glUniform2fv(UniformInfo[index].location, count/2, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_VEC3:
|
|
||||||
glUniform3fv(UniformInfo[index].location, count/3, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_VEC4:
|
|
||||||
glUniform4fv(UniformInfo[index].location, count/4, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_MAT2:
|
|
||||||
glUniformMatrix2fv(UniformInfo[index].location, count/4, false, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_MAT3:
|
|
||||||
glUniformMatrix3fv(UniformInfo[index].location, count/9, false, floats);
|
|
||||||
break;
|
|
||||||
case GL_FLOAT_MAT4:
|
|
||||||
glUniformMatrix4fv(UniformInfo[index].location, count/16, false, floats);
|
|
||||||
break;
|
|
||||||
case GL_SAMPLER_2D:
|
|
||||||
case GL_SAMPLER_CUBE:
|
|
||||||
{
|
|
||||||
if(floats)
|
|
||||||
{
|
|
||||||
const GLint id = (GLint)(*floats);
|
|
||||||
glUniform1iv(UniformInfo[index].location, 1, &id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
status = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
status = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const s32* ints, int count)
|
|
||||||
{
|
|
||||||
if(index < 0 || UniformInfo[index].location < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool status = true;
|
|
||||||
|
|
||||||
switch (UniformInfo[index].type)
|
|
||||||
{
|
|
||||||
case GL_INT:
|
|
||||||
case GL_BOOL:
|
|
||||||
glUniform1iv(UniformInfo[index].location, count, ints);
|
|
||||||
break;
|
|
||||||
case GL_INT_VEC2:
|
|
||||||
case GL_BOOL_VEC2:
|
|
||||||
glUniform2iv(UniformInfo[index].location, count/2, ints);
|
|
||||||
break;
|
|
||||||
case GL_INT_VEC3:
|
|
||||||
case GL_BOOL_VEC3:
|
|
||||||
glUniform3iv(UniformInfo[index].location, count/3, ints);
|
|
||||||
break;
|
|
||||||
case GL_INT_VEC4:
|
|
||||||
case GL_BOOL_VEC4:
|
|
||||||
glUniform4iv(UniformInfo[index].location, count/4, ints);
|
|
||||||
break;
|
|
||||||
case GL_SAMPLER_2D:
|
|
||||||
case GL_SAMPLER_CUBE:
|
|
||||||
glUniform1iv(UniformInfo[index].location, 1, ints);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
status = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2MaterialRenderer::setPixelShaderConstant(s32 index, const u32* ints, int count)
|
|
||||||
{
|
|
||||||
os::Printer::log("Unsigned int support needs at least GLES 3.0", ELL_WARNING);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IVideoDriver* COGLES2MaterialRenderer::getVideoDriver()
|
|
||||||
{
|
|
||||||
return Driver;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "EMaterialTypes.h"
|
|
||||||
#include "IMaterialRenderer.h"
|
|
||||||
#include "IMaterialRendererServices.h"
|
|
||||||
#include "IGPUProgrammingServices.h"
|
|
||||||
#include "irrArray.h"
|
|
||||||
#include "irrString.h"
|
|
||||||
|
|
||||||
#include "COGLES2Common.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COGLES2Driver;
|
|
||||||
|
|
||||||
class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
COGLES2MaterialRenderer(
|
|
||||||
COGLES2Driver* driver,
|
|
||||||
s32& outMaterialTypeNr,
|
|
||||||
const c8* vertexShaderProgram = 0,
|
|
||||||
const c8* pixelShaderProgram = 0,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
|
|
||||||
s32 userData = 0);
|
|
||||||
|
|
||||||
virtual ~COGLES2MaterialRenderer();
|
|
||||||
|
|
||||||
GLuint getProgram() const;
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
|
||||||
|
|
||||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
|
||||||
|
|
||||||
virtual void OnUnsetMaterial();
|
|
||||||
|
|
||||||
virtual bool isTransparent() const;
|
|
||||||
|
|
||||||
virtual s32 getRenderCapability() const;
|
|
||||||
|
|
||||||
void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
|
|
||||||
|
|
||||||
s32 getVertexShaderConstantID(const c8* name) override;
|
|
||||||
s32 getPixelShaderConstantID(const c8* name) override;
|
|
||||||
void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
|
||||||
bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
|
|
||||||
bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
|
|
||||||
bool setPixelShaderConstant(s32 index, const f32* floats, int count) override;
|
|
||||||
bool setPixelShaderConstant(s32 index, const s32* ints, int count) override;
|
|
||||||
bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
|
|
||||||
|
|
||||||
IVideoDriver* getVideoDriver() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
COGLES2MaterialRenderer(COGLES2Driver* driver,
|
|
||||||
IShaderConstantSetCallBack* callback = 0,
|
|
||||||
E_MATERIAL_TYPE baseMaterial = EMT_SOLID,
|
|
||||||
s32 userData = 0);
|
|
||||||
|
|
||||||
void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram, bool addMaterial = true);
|
|
||||||
|
|
||||||
bool createShader(GLenum shaderType, const char* shader);
|
|
||||||
bool linkProgram();
|
|
||||||
|
|
||||||
COGLES2Driver* Driver;
|
|
||||||
IShaderConstantSetCallBack* CallBack;
|
|
||||||
|
|
||||||
bool Alpha;
|
|
||||||
bool Blending;
|
|
||||||
|
|
||||||
struct SUniformInfo
|
|
||||||
{
|
|
||||||
core::stringc name;
|
|
||||||
GLenum type;
|
|
||||||
GLint location;
|
|
||||||
};
|
|
||||||
|
|
||||||
GLuint Program;
|
|
||||||
core::array<SUniformInfo> UniformInfo;
|
|
||||||
s32 UserData;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,87 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#include "COGLES2Renderer2D.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "IGPUProgrammingServices.h"
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
#include "COGLES2Driver.h"
|
|
||||||
|
|
||||||
#include "COpenGLCoreFeature.h"
|
|
||||||
#include "COpenGLCoreTexture.h"
|
|
||||||
#include "COpenGLCoreCacheHandler.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
COGLES2Renderer2D::COGLES2Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COGLES2Driver* driver, bool withTexture) :
|
|
||||||
COGLES2MaterialRenderer(driver, 0, EMT_SOLID),
|
|
||||||
WithTexture(withTexture)
|
|
||||||
{
|
|
||||||
#ifdef _DEBUG
|
|
||||||
setDebugName("COGLES2Renderer2D");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int Temp = 0;
|
|
||||||
|
|
||||||
init(Temp, vertexShaderProgram, pixelShaderProgram, false);
|
|
||||||
|
|
||||||
COGLES2CacheHandler* cacheHandler = Driver->getCacheHandler();
|
|
||||||
|
|
||||||
cacheHandler->setProgram(Program);
|
|
||||||
|
|
||||||
// These states don't change later.
|
|
||||||
|
|
||||||
ThicknessID = getPixelShaderConstantID("uThickness");
|
|
||||||
if ( WithTexture )
|
|
||||||
{
|
|
||||||
TextureUsageID = getPixelShaderConstantID("uTextureUsage");
|
|
||||||
s32 TextureUnitID = getPixelShaderConstantID("uTextureUnit");
|
|
||||||
|
|
||||||
s32 TextureUnit = 0;
|
|
||||||
setPixelShaderConstant(TextureUnitID, &TextureUnit, 1);
|
|
||||||
|
|
||||||
s32 TextureUsage = 0;
|
|
||||||
setPixelShaderConstant(TextureUsageID, &TextureUsage, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheHandler->setProgram(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
COGLES2Renderer2D::~COGLES2Renderer2D()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void COGLES2Renderer2D::OnSetMaterial(const video::SMaterial& material,
|
|
||||||
const video::SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates,
|
|
||||||
video::IMaterialRendererServices* services)
|
|
||||||
{
|
|
||||||
Driver->getCacheHandler()->setProgram(Program);
|
|
||||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
|
||||||
|
|
||||||
f32 Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
|
||||||
setPixelShaderConstant(ThicknessID, &Thickness, 1);
|
|
||||||
|
|
||||||
if ( WithTexture )
|
|
||||||
{
|
|
||||||
s32 TextureUsage = material.TextureLayers[0].Texture ? 1 : 0;
|
|
||||||
setPixelShaderConstant(TextureUsageID, &TextureUsage, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COGLES2Renderer2D::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,37 +0,0 @@
|
|||||||
// Copyright (C) 2014 Patryk Nadrowski
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
|
||||||
#include "COGLES2MaterialRenderer.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COGLES2Renderer2D : public COGLES2MaterialRenderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
COGLES2Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COGLES2Driver* driver, bool withTexture);
|
|
||||||
~COGLES2Renderer2D();
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
|
||||||
|
|
||||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool WithTexture;
|
|
||||||
s32 ThicknessID;
|
|
||||||
s32 TextureUsageID;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -24,316 +24,33 @@ namespace video
|
|||||||
enum EOGLESFeatures
|
enum EOGLESFeatures
|
||||||
{
|
{
|
||||||
// If you update this enum also update the corresponding OGLESFeatureStrings string-array
|
// If you update this enum also update the corresponding OGLESFeatureStrings string-array
|
||||||
// Last updated was up to (including) extension number 290 (GL_EXT_clip_control)
|
IRR_GL_APPLE_texture_2D_limited_npot,
|
||||||
IRR_GLX_ARB_context_flush_control, // 191
|
IRR_GL_APPLE_texture_format_BGRA8888,
|
||||||
IRR_GL_AMD_compressed_3DC_texture, // 39
|
IRR_GL_EXT_blend_minmax,
|
||||||
IRR_GL_AMD_compressed_ATC_texture, // 40
|
IRR_GL_EXT_read_format_bgra,
|
||||||
IRR_GL_AMD_performance_monitor, // 50
|
IRR_GL_EXT_texture_filter_anisotropic,
|
||||||
IRR_GL_AMD_program_binary_Z400, // 48
|
IRR_GL_EXT_texture_format_BGRA8888,
|
||||||
IRR_GL_ANDROID_extension_pack_es31a, // 187
|
IRR_GL_EXT_texture_lod_bias,
|
||||||
IRR_GL_ANGLE_depth_texture, // 138
|
IRR_GL_EXT_texture_rg,
|
||||||
IRR_GL_ANGLE_framebuffer_blit, // 83
|
IRR_GL_IMG_read_format,
|
||||||
IRR_GL_ANGLE_framebuffer_multisample, // 84
|
IRR_GL_IMG_texture_format_BGRA8888,
|
||||||
IRR_GL_ANGLE_instanced_arrays, // 109
|
IRR_GL_IMG_user_clip_plane,
|
||||||
IRR_GL_ANGLE_pack_reverse_row_order, // 110
|
IRR_GL_OES_blend_func_separate,
|
||||||
IRR_GL_ANGLE_program_binary, //139
|
IRR_GL_OES_blend_subtract,
|
||||||
IRR_GL_ANGLE_texture_compression_dxt1, // 111
|
IRR_GL_OES_depth_texture,
|
||||||
IRR_GL_ANGLE_texture_compression_dxt3, // 111
|
IRR_GL_OES_depth24,
|
||||||
IRR_GL_ANGLE_texture_compression_dxt5, // 111
|
IRR_GL_OES_depth32,
|
||||||
IRR_GL_ANGLE_texture_usage, // 112
|
IRR_GL_OES_element_index_uint,
|
||||||
IRR_GL_ANGLE_translated_shader_source, // 113
|
IRR_GL_OES_framebuffer_object,
|
||||||
IRR_GL_APPLE_clip_distance, // 193
|
IRR_GL_OES_packed_depth_stencil,
|
||||||
IRR_GL_APPLE_color_buffer_packed_float, // 194
|
IRR_GL_OES_point_size_array,
|
||||||
IRR_GL_APPLE_copy_texture_levels, // 123
|
IRR_GL_OES_point_sprite,
|
||||||
IRR_GL_APPLE_framebuffer_multisample, // 78
|
IRR_GL_OES_read_format,
|
||||||
IRR_GL_APPLE_rgb_422, // 76
|
IRR_GL_OES_stencil_wrap,
|
||||||
IRR_GL_APPLE_sync, // 124
|
IRR_GL_OES_texture_float,
|
||||||
IRR_GL_APPLE_texture_2D_limited_npot, // 59
|
IRR_GL_OES_texture_half_float,
|
||||||
IRR_GL_APPLE_texture_format_BGRA8888, // 79
|
IRR_GL_OES_texture_mirrored_repeat,
|
||||||
IRR_GL_APPLE_texture_max_level, // 80
|
IRR_GL_OES_texture_npot,
|
||||||
IRR_GL_APPLE_texture_packed_float, // 195
|
|
||||||
IRR_ARB_texture_env_combine, //ogl, IMG simulator
|
|
||||||
IRR_ARB_texture_env_dot3, //ogl, IMG simulator
|
|
||||||
IRR_GL_ARM_mali_program_binary, // 120
|
|
||||||
IRR_GL_ARM_mali_shader_binary, // 81
|
|
||||||
IRR_GL_ARM_rgba8, // 82
|
|
||||||
IRR_GL_ARM_shader_framebuffer_fetch, // 165
|
|
||||||
IRR_GL_ARM_shader_framebuffer_fetch_depth_stencil, // 166
|
|
||||||
IRR_GL_DMP_program_binary, // 192
|
|
||||||
IRR_GL_DMP_shader_binary, // 88
|
|
||||||
IRR_GL_EXT_EGL_image_array, // 278
|
|
||||||
IRR_GL_EXT_YUV_target, // 222
|
|
||||||
IRR_GL_EXT_base_instance, // 203
|
|
||||||
IRR_GL_EXT_blend_func_extended, // 247
|
|
||||||
IRR_GL_EXT_blend_minmax, // 65
|
|
||||||
IRR_GL_EXT_buffer_storage, // 239
|
|
||||||
IRR_GL_EXT_clear_texture, // 269
|
|
||||||
IRR_GL_EXT_clip_control, // 290
|
|
||||||
IRR_GL_EXT_clip_cull_distance, // 257
|
|
||||||
IRR_GL_EXT_color_buffer_float, // 137
|
|
||||||
IRR_GL_EXT_color_buffer_half_float, // 97
|
|
||||||
IRR_GL_EXT_compressed_ETC1_RGB8_sub_texture, // 188
|
|
||||||
IRR_GL_EXT_conservative_depth, // 268
|
|
||||||
IRR_GL_EXT_copy_image, // 175
|
|
||||||
IRR_GL_EXT_debug_label, // 98
|
|
||||||
IRR_GL_EXT_debug_marker, // 99
|
|
||||||
IRR_GL_EXT_discard_framebuffer, // 64
|
|
||||||
IRR_GL_EXT_disjoint_timer_query, // 150
|
|
||||||
IRR_GL_EXT_draw_buffers, // 151
|
|
||||||
IRR_GL_EXT_draw_buffers_indexed, // 176
|
|
||||||
IRR_GL_EXT_draw_elements_base_vertex, // 204
|
|
||||||
IRR_GL_EXT_draw_instanced, // 157
|
|
||||||
IRR_GL_EXT_draw_transform_feedback, // 272
|
|
||||||
IRR_GL_EXT_external_buffer, // 284
|
|
||||||
IRR_GL_EXT_float_blend, // 225
|
|
||||||
IRR_GL_EXT_frag_depth, // 86
|
|
||||||
IRR_GL_EXT_geometry_point_size, // 177
|
|
||||||
IRR_GL_EXT_geometry_shader, // 177
|
|
||||||
IRR_GL_EXT_gpu_shader5, // 178
|
|
||||||
IRR_GL_EXT_instanced_arrays, // 156
|
|
||||||
IRR_GL_EXT_map_buffer_range, // 121
|
|
||||||
IRR_GL_EXT_memory_object, // 280
|
|
||||||
IRR_GL_EXT_memory_object_fd, // 281
|
|
||||||
IRR_GL_EXT_memory_object_win32, // 282
|
|
||||||
IRR_GL_EXT_multi_draw_arrays, // 69
|
|
||||||
IRR_GL_EXT_multi_draw_indirect, // 205
|
|
||||||
IRR_GL_EXT_multisample_compatibility, // 248
|
|
||||||
IRR_GL_EXT_multisampled_render_to_texture, // 106
|
|
||||||
IRR_GL_EXT_multisampled_render_to_texture2, // 275
|
|
||||||
IRR_GL_EXT_multiview_draw_buffers, // 125
|
|
||||||
IRR_GL_EXT_occlusion_query_boolean, // 100
|
|
||||||
IRR_GL_EXT_polygon_offset_clamp, // 252
|
|
||||||
IRR_GL_EXT_post_depth_coverage, // 225
|
|
||||||
IRR_GL_EXT_primitive_bounding_box, // 186
|
|
||||||
IRR_GL_EXT_protected_textures, // 256
|
|
||||||
IRR_GL_EXT_pvrtc_sRGB, // 155
|
|
||||||
IRR_GL_EXT_raster_multisample, // 226
|
|
||||||
IRR_GL_EXT_read_format_bgra, // 66
|
|
||||||
IRR_GL_EXT_render_snorm, // 206
|
|
||||||
IRR_GL_EXT_robustness, // 107
|
|
||||||
IRR_GL_EXT_sRGB, // 105
|
|
||||||
IRR_GL_EXT_sRGB_write_control, // 153
|
|
||||||
IRR_GL_EXT_semaphore, // 280
|
|
||||||
IRR_GL_EXT_semaphore_fd, // 281
|
|
||||||
IRR_GL_EXT_semaphore_win32, // 282
|
|
||||||
IRR_GL_EXT_separate_shader_objects, // 101
|
|
||||||
IRR_GL_EXT_shader_framebuffer_fetch, // 122
|
|
||||||
IRR_GL_EXT_shader_group_vote, // 254
|
|
||||||
IRR_GL_EXT_shader_implicit_conversions, // 179
|
|
||||||
IRR_GL_EXT_shader_integer_mix, // 161
|
|
||||||
IRR_GL_EXT_shader_io_blocks, // 180
|
|
||||||
IRR_GL_EXT_shader_non_constant_global_initializers, // 264
|
|
||||||
IRR_GL_EXT_shader_pixel_local_storage, // 167
|
|
||||||
IRR_GL_EXT_shader_pixel_local_storage2, // 253
|
|
||||||
IRR_GL_EXT_shader_texture_lod, // 77
|
|
||||||
IRR_GL_EXT_shadow_samplers, // 102
|
|
||||||
IRR_GL_EXT_sparse_texture, // 240
|
|
||||||
IRR_GL_EXT_sparse_texture2, // 259
|
|
||||||
IRR_GL_EXT_tessellation_point_size, // 181
|
|
||||||
IRR_GL_EXT_tessellation_shader, // 181
|
|
||||||
IRR_GL_EXT_texture_border_clamp, // 182
|
|
||||||
IRR_GL_EXT_texture_buffer, // 183
|
|
||||||
IRR_GL_EXT_texture_compression_astc_decode_mode, // 276
|
|
||||||
IRR_GL_EXT_texture_compression_astc_decode_mode_rgb9e5, // 276
|
|
||||||
IRR_GL_EXT_texture_compression_bptc, // 287
|
|
||||||
IRR_GL_EXT_texture_compression_dxt1, // 49
|
|
||||||
IRR_GL_EXT_texture_compression_rgtc, // 286
|
|
||||||
IRR_GL_EXT_texture_compression_s3tc, // 154
|
|
||||||
IRR_GL_EXT_texture_compression_s3tc_srgb, // 289
|
|
||||||
IRR_GL_EXT_texture_cube_map_array, // 184
|
|
||||||
IRR_GL_EXT_texture_filter_anisotropic, // 41
|
|
||||||
IRR_GL_EXT_texture_filter_minmax, // 227
|
|
||||||
IRR_GL_EXT_texture_format_BGRA8888, // 51
|
|
||||||
IRR_GL_EXT_texture_lod_bias, // 60
|
|
||||||
IRR_GL_EXT_texture_norm16, // 207
|
|
||||||
IRR_GL_EXT_texture_rg, // 103
|
|
||||||
IRR_GL_EXT_texture_sRGB_R8, // 221
|
|
||||||
IRR_GL_EXT_texture_sRGB_RG8, // 223
|
|
||||||
IRR_GL_EXT_texture_sRGB_decode, // 152
|
|
||||||
IRR_GL_EXT_texture_storage, // 108
|
|
||||||
IRR_GL_EXT_texture_type_2_10_10_10_REV, // 42
|
|
||||||
IRR_GL_EXT_texture_view, // 185
|
|
||||||
IRR_GL_EXT_unpack_subimage, // 90
|
|
||||||
IRR_GL_EXT_win32_keyed_mutex, // 283
|
|
||||||
IRR_GL_EXT_window_rectangles, // 263
|
|
||||||
IRR_GL_FJ_shader_binary_GCCSO, // 114
|
|
||||||
IRR_GL_IMG_bindless_texture, // 270
|
|
||||||
IRR_GL_IMG_framebuffer_downsample, // 255
|
|
||||||
IRR_GL_IMG_multisampled_render_to_texture, // 74
|
|
||||||
IRR_GL_IMG_program_binary, // 67
|
|
||||||
IRR_GL_IMG_read_format, // 53
|
|
||||||
IRR_GL_IMG_shader_binary, // 68
|
|
||||||
IRR_GL_IMG_texture_compression_pvrtc, // 54
|
|
||||||
IRR_GL_IMG_texture_compression_pvrtc2, // 140
|
|
||||||
IRR_GL_IMG_texture_env_enhanced_fixed_function, // 58
|
|
||||||
IRR_GL_IMG_texture_format_BGRA8888, // replaced by EXT version
|
|
||||||
IRR_GL_IMG_texture_filter_cubic, // 251
|
|
||||||
IRR_GL_IMG_user_clip_plane, // 57, was clip_planes
|
|
||||||
IRR_GL_IMG_vertex_program, // non-standard
|
|
||||||
IRR_GL_INTEL_conservative_rasterization, // 265
|
|
||||||
IRR_GL_INTEL_framebuffer_CMAA, // 246
|
|
||||||
IRR_GL_INTEL_performance_query, // 164
|
|
||||||
IRR_GL_KHR_blend_equation_advanced, // 168
|
|
||||||
IRR_GL_KHR_blend_equation_advanced_coherent, // 168
|
|
||||||
IRR_GL_KHR_context_flush_control, // 191
|
|
||||||
IRR_GL_KHR_debug, // 118
|
|
||||||
IRR_GL_KHR_no_error, // 243
|
|
||||||
IRR_GL_KHR_parallel_shader_compile, // 288
|
|
||||||
IRR_GL_KHR_robust_buffer_access_behavior, // 189
|
|
||||||
IRR_GL_KHR_robustness, // 190
|
|
||||||
IRR_GL_KHR_texture_compression_astc_hdr, // 117
|
|
||||||
IRR_GL_KHR_texture_compression_astc_ldr, // 117
|
|
||||||
IRR_GL_KHR_texture_compression_astc_sliced_3d, // 249
|
|
||||||
IRR_GL_NVX_blend_equation_advanced_multi_draw_buffers, // 266
|
|
||||||
IRR_GL_NV_3dvision_settings, // 129
|
|
||||||
IRR_GL_NV_EGL_stream_consumer_external, // 104
|
|
||||||
IRR_GL_NV_bgr, // 135
|
|
||||||
IRR_GL_NV_bindless_texture, // 197
|
|
||||||
IRR_GL_NV_blend_equation_advanced, // 163
|
|
||||||
IRR_GL_NV_blend_equation_advanced_coherent, // 163
|
|
||||||
IRR_GL_NV_blend_minmax_factor, // 285
|
|
||||||
IRR_GL_NV_conditional_render, // 198
|
|
||||||
IRR_GL_NV_conservative_raster, // 228
|
|
||||||
IRR_GL_NV_conservative_raster_pre_snap_triangles, // 262
|
|
||||||
IRR_GL_NV_copy_buffer, // 158
|
|
||||||
IRR_GL_NV_coverage_sample, // 72
|
|
||||||
IRR_GL_NV_depth_nonlinear, // 73
|
|
||||||
IRR_GL_NV_draw_buffers, // 91
|
|
||||||
IRR_GL_NV_draw_instanced, // 141
|
|
||||||
IRR_GL_NV_draw_texture, // 126
|
|
||||||
IRR_GL_NV_draw_vulkan_image, // 274
|
|
||||||
IRR_GL_NV_explicit_attrib_location, // 159
|
|
||||||
IRR_GL_NV_fbo_color_attachments, // 92
|
|
||||||
IRR_GL_NV_fence, // 52
|
|
||||||
IRR_GL_NV_fill_rectangle, // 232
|
|
||||||
IRR_GL_NV_fragment_coverage_to_color, // 229
|
|
||||||
IRR_GL_NV_fragment_shader_interlock, // 230
|
|
||||||
IRR_GL_NV_framebuffer_blit, // 142
|
|
||||||
IRR_GL_NV_framebuffer_mixed_samples, // 231
|
|
||||||
IRR_GL_NV_framebuffer_multisample, // 143
|
|
||||||
IRR_GL_NV_generate_mipmap_sRGB, // 144
|
|
||||||
IRR_GL_NV_geometry_shader_passthrough, // 233
|
|
||||||
IRR_GL_NV_gpu_shader5, // 260
|
|
||||||
IRR_GL_NV_image_formats, // 200
|
|
||||||
IRR_GL_NV_instanced_arrays, // 145
|
|
||||||
IRR_GL_NV_internalformat_sample_query, // 196
|
|
||||||
IRR_GL_NV_non_square_matrices, // 160
|
|
||||||
IRR_GL_NV_pack_subimage, // 132
|
|
||||||
IRR_GL_NV_packed_float, // 127
|
|
||||||
IRR_GL_NV_path_rendering, // 199
|
|
||||||
IRR_GL_NV_path_rendering_shared_edge, // 234
|
|
||||||
IRR_GL_NV_pixel_buffer_object, // 134
|
|
||||||
IRR_GL_NV_platform_binary, // 131
|
|
||||||
IRR_GL_NV_polygon_mode, // 238
|
|
||||||
IRR_GL_NV_read_buffer, // 93
|
|
||||||
IRR_GL_NV_read_buffer_front, // part of 93 (non standard)
|
|
||||||
IRR_GL_NV_read_depth, // part of 94 (non standard)
|
|
||||||
IRR_GL_NV_read_depth_stencil, // 94
|
|
||||||
IRR_GL_NV_read_stencil, // part of 94 (non standard)
|
|
||||||
IRR_GL_NV_sRGB_formats, // 148
|
|
||||||
IRR_GL_NV_sample_locations, // 235
|
|
||||||
IRR_GL_NV_sample_mask_override_coverage, // 236
|
|
||||||
IRR_GL_NV_shader_atomic_fp16_vector, // 261
|
|
||||||
IRR_GL_NV_shader_noperspective_interpolation, // 201
|
|
||||||
IRR_GL_NV_shadow_samplers_array, // 146
|
|
||||||
IRR_GL_NV_shadow_samplers_cube, // 147
|
|
||||||
IRR_GL_NV_texture_array, // 133
|
|
||||||
IRR_GL_NV_texture_barrier, // 271
|
|
||||||
IRR_GL_NV_texture_border_clamp, // 149
|
|
||||||
IRR_GL_NV_texture_compression_latc, // 130
|
|
||||||
IRR_GL_NV_texture_compression_s3tc, // 128
|
|
||||||
IRR_GL_NV_texture_compression_s3tc_update, // 95
|
|
||||||
IRR_GL_NV_texture_npot_2D_mipmap, // 96
|
|
||||||
IRR_GL_NV_viewport_array, // 202
|
|
||||||
IRR_GL_NV_viewport_array2, // 237
|
|
||||||
IRR_GL_NV_viewport_swizzle, // 258
|
|
||||||
IRR_GL_OES_EGL_image, // 23
|
|
||||||
IRR_GL_OES_EGL_image_external, // 87
|
|
||||||
IRR_GL_OES_EGL_image_external_essl3, // 220
|
|
||||||
IRR_GL_OES_EGL_sync, // 75
|
|
||||||
IRR_GL_OES_blend_equation_separate, // 1
|
|
||||||
IRR_GL_OES_blend_func_separate, // 2
|
|
||||||
IRR_GL_OES_blend_subtract, // 3
|
|
||||||
IRR_GL_OES_byte_coordinates, // 4
|
|
||||||
IRR_GL_OES_compressed_ETC1_RGB8_texture, // 5
|
|
||||||
IRR_GL_OES_compressed_paletted_texture, // 6
|
|
||||||
IRR_GL_OES_copy_image, // 208
|
|
||||||
IRR_GL_OES_depth24, // 24
|
|
||||||
IRR_GL_OES_depth32, // 25
|
|
||||||
IRR_GL_OES_depth_texture, // 43
|
|
||||||
IRR_GL_OES_depth_texture_cube_map, // 136
|
|
||||||
IRR_GL_OES_draw_buffers_indexed, // 209
|
|
||||||
IRR_GL_OES_draw_elements_base_vertex, // 219
|
|
||||||
IRR_GL_OES_draw_texture, // 7
|
|
||||||
IRR_GL_OES_element_index_uint, // 26
|
|
||||||
IRR_GL_OES_extended_matrix_palette, // 8
|
|
||||||
IRR_GL_OES_fbo_render_mipmap, // 27
|
|
||||||
IRR_GL_OES_fixed_point, // 9
|
|
||||||
IRR_GL_OES_fragment_precision_high, // 28
|
|
||||||
IRR_GL_OES_framebuffer_object, // 10
|
|
||||||
IRR_GL_OES_geometry_shader, // 210
|
|
||||||
IRR_GL_OES_get_program_binary, // 47
|
|
||||||
IRR_GL_OES_gpu_shader5, // 211
|
|
||||||
IRR_GL_OES_mapbuffer, // 29
|
|
||||||
IRR_GL_OES_matrix_get, // 11
|
|
||||||
IRR_GL_OES_matrix_palette, // 12
|
|
||||||
IRR_GL_OES_packed_depth_stencil, // 44
|
|
||||||
IRR_GL_OES_point_size_array, // 14
|
|
||||||
IRR_GL_OES_point_sprite, // 15
|
|
||||||
IRR_GL_OES_primitive_bounding_box, // 212
|
|
||||||
IRR_GL_OES_query_matrix, // 16
|
|
||||||
IRR_GL_OES_read_format, // 17
|
|
||||||
IRR_GL_OES_required_internalformat, // 115
|
|
||||||
IRR_GL_OES_rgb8_rgba8, // 30
|
|
||||||
IRR_GL_OES_sample_shading, // 169
|
|
||||||
IRR_GL_OES_sample_variables, // 170
|
|
||||||
IRR_GL_OES_shader_image_atomic, // 171
|
|
||||||
IRR_GL_OES_shader_io_blocks, // 213
|
|
||||||
IRR_GL_OES_shader_multisample_interpolation, // 172
|
|
||||||
IRR_GL_OES_single_precision, // 18
|
|
||||||
IRR_GL_OES_standard_derivatives, // 45
|
|
||||||
IRR_GL_OES_stencil1, // 31
|
|
||||||
IRR_GL_OES_stencil4, // 32
|
|
||||||
IRR_GL_OES_stencil8, // 33
|
|
||||||
IRR_GL_OES_stencil_wrap, // 19
|
|
||||||
IRR_GL_OES_surfaceless_context, // 116
|
|
||||||
IRR_GL_OES_tessellation_shader, // 214
|
|
||||||
IRR_GL_OES_texture_3D, // 34
|
|
||||||
IRR_GL_OES_texture_border_clamp, // 215
|
|
||||||
IRR_GL_OES_texture_buffer, // 216
|
|
||||||
IRR_GL_OES_texture_compression_astc, // 162
|
|
||||||
IRR_GL_OES_texture_cube_map, // 20
|
|
||||||
IRR_GL_OES_texture_cube_map_array, // 217
|
|
||||||
IRR_GL_OES_texture_env_crossbar, // 21
|
|
||||||
IRR_GL_OES_texture_float, // 36
|
|
||||||
IRR_GL_OES_texture_float_linear, // 35
|
|
||||||
IRR_GL_OES_texture_half_float, // 36
|
|
||||||
IRR_GL_OES_texture_half_float_linear, // 35
|
|
||||||
IRR_GL_OES_texture_mirrored_repeat, // 22
|
|
||||||
IRR_GL_OES_texture_npot, // 37
|
|
||||||
IRR_GL_OES_texture_stencil8, // 173
|
|
||||||
IRR_GL_OES_texture_storage_multisample_2d_array, // 174
|
|
||||||
IRR_GL_OES_texture_view, // 218
|
|
||||||
IRR_GL_OES_vertex_array_object, // 71
|
|
||||||
IRR_GL_OES_vertex_half_float, // 38
|
|
||||||
IRR_GL_OES_vertex_type_10_10_10_2, // 46
|
|
||||||
IRR_GL_OES_viewport_array, // 267
|
|
||||||
IRR_GL_OVR_multiview, // 241
|
|
||||||
IRR_GL_OVR_multiview2, // 242
|
|
||||||
IRR_GL_OVR_multiview_multisampled_render_to_texture, // 250
|
|
||||||
IRR_GL_QCOM_alpha_test, // 89
|
|
||||||
IRR_GL_QCOM_binning_control, // 119
|
|
||||||
IRR_GL_QCOM_driver_control, // 55
|
|
||||||
IRR_GL_QCOM_extended_get, // 62
|
|
||||||
IRR_GL_QCOM_extended_get2, // 63
|
|
||||||
IRR_GL_QCOM_framebuffer_foveated, // 273
|
|
||||||
IRR_GL_QCOM_performance_monitor_global_mode, // 56
|
|
||||||
IRR_GL_QCOM_shader_framebuffer_fetch_noncoherent, // 277
|
|
||||||
IRR_GL_QCOM_tiled_rendering, // 70
|
|
||||||
IRR_GL_QCOM_writeonly_rendering, // 61
|
|
||||||
IRR_GL_SUN_multi_draw_arrays, // 69
|
|
||||||
IRR_GL_VIV_shader_binary, // 85
|
|
||||||
WGL_ARB_context_flush_control, // 191
|
|
||||||
|
|
||||||
IRR_OGLES_Feature_Count
|
IRR_OGLES_Feature_Count
|
||||||
};
|
};
|
||||||
@ -373,319 +90,36 @@ namespace video
|
|||||||
|
|
||||||
const char* getFeatureString(size_t index) const
|
const char* getFeatureString(size_t index) const
|
||||||
{
|
{
|
||||||
// Extension names from https://www.khronos.org/registry/OpenGL/index_es.php
|
|
||||||
// One for each EOGLESFeatures
|
// One for each EOGLESFeatures
|
||||||
static const char* const OGLESFeatureStrings[IRR_OGLES_Feature_Count] =
|
static const char* const OGLESFeatureStrings[IRR_OGLES_Feature_Count] =
|
||||||
{
|
{
|
||||||
"GLX_ARB_context_flush_control",
|
|
||||||
"GL_AMD_compressed_3DC_texture",
|
|
||||||
"GL_AMD_compressed_ATC_texture",
|
|
||||||
"GL_AMD_performance_monitor",
|
|
||||||
"GL_AMD_program_binary_Z400",
|
|
||||||
"GL_ANDROID_extension_pack_es31a",
|
|
||||||
"GL_ANGLE_depth_texture",
|
|
||||||
"GL_ANGLE_framebuffer_blit",
|
|
||||||
"GL_ANGLE_framebuffer_multisample",
|
|
||||||
"GL_ANGLE_instanced_arrays",
|
|
||||||
"GL_ANGLE_pack_reverse_row_order",
|
|
||||||
"GL_ANGLE_program_binary",
|
|
||||||
"GL_ANGLE_texture_compression_dxt1",
|
|
||||||
"GL_ANGLE_texture_compression_dxt3",
|
|
||||||
"GL_ANGLE_texture_compression_dxt5",
|
|
||||||
"GL_ANGLE_texture_usage",
|
|
||||||
"GL_ANGLE_translated_shader_source",
|
|
||||||
"GL_APPLE_clip_distance",
|
|
||||||
"GL_APPLE_color_buffer_packed_float",
|
|
||||||
"GL_APPLE_copy_texture_levels",
|
|
||||||
"GL_APPLE_framebuffer_multisample",
|
|
||||||
"GL_APPLE_rgb_422",
|
|
||||||
"GL_APPLE_sync",
|
|
||||||
"GL_APPLE_texture_2D_limited_npot",
|
"GL_APPLE_texture_2D_limited_npot",
|
||||||
"GL_APPLE_texture_format_BGRA8888",
|
"GL_APPLE_texture_format_BGRA8888",
|
||||||
"GL_APPLE_texture_max_level",
|
|
||||||
"GL_APPLE_texture_packed_float",
|
|
||||||
"GL_ARB_texture_env_combine",
|
|
||||||
"GL_ARB_texture_env_dot3",
|
|
||||||
"GL_ARM_mali_program_binary",
|
|
||||||
"GL_ARM_mali_shader_binary",
|
|
||||||
"GL_ARM_rgba8",
|
|
||||||
"GL_ARM_shader_framebuffer_fetch",
|
|
||||||
"GL_ARM_shader_framebuffer_fetch_depth_stencil",
|
|
||||||
"GL_DMP_program_binary",
|
|
||||||
"GL_DMP_shader_binary",
|
|
||||||
"GL_EXT_EGL_image_array",
|
|
||||||
"GL_EXT_YUV_target",
|
|
||||||
"GL_EXT_base_instance",
|
|
||||||
"GL_EXT_blend_func_extended",
|
|
||||||
"GL_EXT_blend_minmax",
|
"GL_EXT_blend_minmax",
|
||||||
"GL_EXT_buffer_storage",
|
|
||||||
"GL_EXT_clear_texture",
|
|
||||||
"GL_EXT_clip_control",
|
|
||||||
"GL_EXT_clip_cull_distance",
|
|
||||||
"GL_EXT_color_buffer_float",
|
|
||||||
"GL_EXT_color_buffer_half_float",
|
|
||||||
"GL_EXT_compressed_ETC1_RGB8_sub_texture",
|
|
||||||
"GL_EXT_conservative_depth",
|
|
||||||
"GL_EXT_copy_image",
|
|
||||||
"GL_EXT_debug_label",
|
|
||||||
"GL_EXT_debug_marker",
|
|
||||||
"GL_EXT_discard_framebuffer",
|
|
||||||
"GL_EXT_disjoint_timer_query",
|
|
||||||
"GL_EXT_draw_buffers",
|
|
||||||
"GL_EXT_draw_buffers_indexed",
|
|
||||||
"GL_EXT_draw_elements_base_vertex",
|
|
||||||
"GL_EXT_draw_instanced",
|
|
||||||
"GL_EXT_draw_transform_feedback",
|
|
||||||
"GL_EXT_external_buffer",
|
|
||||||
"GL_EXT_float_blend",
|
|
||||||
"GL_EXT_frag_depth",
|
|
||||||
"GL_EXT_geometry_point_size",
|
|
||||||
"GL_EXT_geometry_shader",
|
|
||||||
"GL_EXT_gpu_shader5",
|
|
||||||
"GL_EXT_instanced_arrays",
|
|
||||||
"GL_EXT_map_buffer_range",
|
|
||||||
"GL_EXT_memory_object",
|
|
||||||
"GL_EXT_memory_object_fd",
|
|
||||||
"GL_EXT_memory_object_win32",
|
|
||||||
"GL_EXT_multi_draw_arrays",
|
|
||||||
"GL_EXT_multi_draw_indirect",
|
|
||||||
"GL_EXT_multisample_compatibility",
|
|
||||||
"GL_EXT_multisampled_render_to_texture",
|
|
||||||
"GL_EXT_multisampled_render_to_texture2",
|
|
||||||
"GL_EXT_multiview_draw_buffers",
|
|
||||||
"GL_EXT_occlusion_query_boolean",
|
|
||||||
"GL_EXT_polygon_offset_clamp",
|
|
||||||
"GL_EXT_post_depth_coverage",
|
|
||||||
"GL_EXT_primitive_bounding_box",
|
|
||||||
"GL_EXT_protected_textures",
|
|
||||||
"GL_EXT_pvrtc_sRGB",
|
|
||||||
"GL_EXT_raster_multisample",
|
|
||||||
"GL_EXT_read_format_bgra",
|
"GL_EXT_read_format_bgra",
|
||||||
"GL_EXT_render_snorm",
|
|
||||||
"GL_EXT_robustness",
|
|
||||||
"GL_EXT_sRGB",
|
|
||||||
"GL_EXT_sRGB_write_control",
|
|
||||||
"GL_EXT_semaphore",
|
|
||||||
"GL_EXT_semaphore_fd",
|
|
||||||
"GL_EXT_semaphore_win32",
|
|
||||||
"GL_EXT_separate_shader_objects",
|
|
||||||
"GL_EXT_shader_framebuffer_fetch",
|
|
||||||
"GL_EXT_shader_group_vote",
|
|
||||||
"GL_EXT_shader_implicit_conversions",
|
|
||||||
"GL_EXT_shader_integer_mix",
|
|
||||||
"GL_EXT_shader_io_blocks",
|
|
||||||
"GL_EXT_shader_non_constant_global_initializers",
|
|
||||||
"GL_EXT_shader_pixel_local_storage",
|
|
||||||
"GL_EXT_shader_pixel_local_storage2",
|
|
||||||
"GL_EXT_shader_texture_lod",
|
|
||||||
"GL_EXT_shadow_samplers",
|
|
||||||
"GL_EXT_sparse_texture",
|
|
||||||
"GL_EXT_sparse_texture2",
|
|
||||||
"GL_EXT_tessellation_point_size",
|
|
||||||
"GL_EXT_tessellation_shader",
|
|
||||||
"GL_EXT_texture_border_clamp",
|
|
||||||
"GL_EXT_texture_buffer",
|
|
||||||
"GL_EXT_texture_compression_astc_decode_mode",
|
|
||||||
"GL_EXT_texture_compression_astc_decode_mode_rgb9e5",
|
|
||||||
"GL_EXT_texture_compression_bptc",
|
|
||||||
"GL_EXT_texture_compression_dxt1",
|
|
||||||
"GL_EXT_texture_compression_rgtc",
|
|
||||||
"GL_EXT_texture_compression_s3tc",
|
|
||||||
"GL_EXT_texture_compression_s3tc_srgb",
|
|
||||||
"GL_EXT_texture_cube_map_array",
|
|
||||||
"GL_EXT_texture_filter_anisotropic",
|
"GL_EXT_texture_filter_anisotropic",
|
||||||
"GL_EXT_texture_filter_minmax",
|
|
||||||
"GL_EXT_texture_format_BGRA8888",
|
"GL_EXT_texture_format_BGRA8888",
|
||||||
"GL_EXT_texture_lod_bias",
|
"GL_EXT_texture_lod_bias",
|
||||||
"GL_EXT_texture_norm16",
|
|
||||||
"GL_EXT_texture_rg",
|
"GL_EXT_texture_rg",
|
||||||
"GL_EXT_texture_sRGB_R8",
|
|
||||||
"GL_EXT_texture_sRGB_RG8",
|
|
||||||
"GL_EXT_texture_sRGB_decode",
|
|
||||||
"GL_EXT_texture_storage",
|
|
||||||
"GL_EXT_texture_type_2_10_10_10_REV",
|
|
||||||
"GL_EXT_texture_view",
|
|
||||||
"GL_EXT_unpack_subimage",
|
|
||||||
"GL_EXT_win32_keyed_mutex",
|
|
||||||
"GL_EXT_window_rectangles",
|
|
||||||
"GL_FJ_shader_binary_GCCSO",
|
|
||||||
"GL_IMG_bindless_texture",
|
|
||||||
"GL_IMG_framebuffer_downsample",
|
|
||||||
"GL_IMG_multisampled_render_to_texture",
|
|
||||||
"GL_IMG_program_binary",
|
|
||||||
"GL_IMG_read_format",
|
"GL_IMG_read_format",
|
||||||
"GL_IMG_shader_binary",
|
|
||||||
"GL_IMG_texture_compression_pvrtc",
|
|
||||||
"GL_IMG_texture_compression_pvrtc2",
|
|
||||||
"GL_IMG_texture_env_enhanced_fixed_function",
|
|
||||||
"GL_IMG_texture_format_BGRA8888",
|
"GL_IMG_texture_format_BGRA8888",
|
||||||
"GL_IMG_texture_filter_cubic",
|
|
||||||
"GL_IMG_user_clip_plane",
|
"GL_IMG_user_clip_plane",
|
||||||
"GL_IMG_vertex_program",
|
|
||||||
"GL_INTEL_conservative_rasterization",
|
|
||||||
"GL_INTEL_framebuffer_CMAA",
|
|
||||||
"GL_INTEL_performance_query",
|
|
||||||
"GL_KHR_blend_equation_advanced",
|
|
||||||
"GL_KHR_blend_equation_advanced_coherent",
|
|
||||||
"GL_KHR_context_flush_control",
|
|
||||||
"GL_KHR_debug",
|
|
||||||
"GL_KHR_no_error",
|
|
||||||
"GL_KHR_parallel_shader_compile",
|
|
||||||
"GL_KHR_robust_buffer_access_behavior",
|
|
||||||
"GL_KHR_robustness",
|
|
||||||
"GL_KHR_texture_compression_astc_hdr",
|
|
||||||
"GL_KHR_texture_compression_astc_ldr",
|
|
||||||
"GL_KHR_texture_compression_astc_sliced_3d",
|
|
||||||
"GL_NVX_blend_equation_advanced_multi_draw_buffers",
|
|
||||||
"GL_NV_3dvision_settings",
|
|
||||||
"GL_NV_EGL_stream_consumer_external",
|
|
||||||
"GL_NV_bgr",
|
|
||||||
"GL_NV_bindless_texture",
|
|
||||||
"GL_NV_blend_equation_advanced",
|
|
||||||
"GL_NV_blend_equation_advanced_coherent",
|
|
||||||
"GL_NV_blend_minmax_factor",
|
|
||||||
"GL_NV_conditional_render",
|
|
||||||
"GL_NV_conservative_raster",
|
|
||||||
"GL_NV_conservative_raster_pre_snap_triangles",
|
|
||||||
"GL_NV_copy_buffer",
|
|
||||||
"GL_NV_coverage_sample",
|
|
||||||
"GL_NV_depth_nonlinear",
|
|
||||||
"GL_NV_draw_buffers",
|
|
||||||
"GL_NV_draw_instanced",
|
|
||||||
"GL_NV_draw_texture",
|
|
||||||
"GL_NV_draw_vulkan_image",
|
|
||||||
"GL_NV_explicit_attrib_location",
|
|
||||||
"GL_NV_fbo_color_attachments",
|
|
||||||
"GL_NV_fence",
|
|
||||||
"GL_NV_fill_rectangle",
|
|
||||||
"GL_NV_fragment_coverage_to_color",
|
|
||||||
"GL_NV_fragment_shader_interlock",
|
|
||||||
"GL_NV_framebuffer_blit",
|
|
||||||
"GL_NV_framebuffer_mixed_samples",
|
|
||||||
"GL_NV_framebuffer_multisample",
|
|
||||||
"GL_NV_generate_mipmap_sRGB",
|
|
||||||
"GL_NV_geometry_shader_passthrough",
|
|
||||||
"GL_NV_gpu_shader5",
|
|
||||||
"GL_NV_image_formats",
|
|
||||||
"GL_NV_instanced_arrays",
|
|
||||||
"GL_NV_internalformat_sample_query",
|
|
||||||
"GL_NV_non_square_matrices",
|
|
||||||
"GL_NV_pack_subimage",
|
|
||||||
"GL_NV_packed_float",
|
|
||||||
"GL_NV_path_rendering",
|
|
||||||
"GL_NV_path_rendering_shared_edge",
|
|
||||||
"GL_NV_pixel_buffer_object",
|
|
||||||
"GL_NV_platform_binary",
|
|
||||||
"GL_NV_polygon_mode",
|
|
||||||
"GL_NV_read_buffer",
|
|
||||||
"GL_NV_read_buffer_front",
|
|
||||||
"GL_NV_read_depth",
|
|
||||||
"GL_NV_read_depth_stencil",
|
|
||||||
"GL_NV_read_stencil",
|
|
||||||
"GL_NV_sRGB_formats",
|
|
||||||
"GL_NV_sample_locations",
|
|
||||||
"GL_NV_sample_mask_override_coverage",
|
|
||||||
"GL_NV_shader_atomic_fp16_vector",
|
|
||||||
"GL_NV_shader_noperspective_interpolation",
|
|
||||||
"GL_NV_shadow_samplers_array",
|
|
||||||
"GL_NV_shadow_samplers_cube",
|
|
||||||
"GL_NV_texture_array",
|
|
||||||
"GL_NV_texture_barrier",
|
|
||||||
"GL_NV_texture_border_clamp",
|
|
||||||
"GL_NV_texture_compression_latc",
|
|
||||||
"GL_NV_texture_compression_s3tc",
|
|
||||||
"GL_NV_texture_compression_s3tc_update",
|
|
||||||
"GL_NV_texture_npot_2D_mipmap",
|
|
||||||
"GL_NV_viewport_array",
|
|
||||||
"GL_NV_viewport_array2",
|
|
||||||
"GL_NV_viewport_swizzle",
|
|
||||||
"GL_OES_EGL_image",
|
|
||||||
"GL_OES_EGL_image_external",
|
|
||||||
"GL_OES_EGL_image_external_essl3",
|
|
||||||
"GL_OES_EGL_sync",
|
|
||||||
"GL_OES_blend_equation_separate",
|
|
||||||
"GL_OES_blend_func_separate",
|
"GL_OES_blend_func_separate",
|
||||||
"GL_OES_blend_subtract",
|
"GL_OES_blend_subtract",
|
||||||
"GL_OES_byte_coordinates",
|
"GL_OES_depth_texture",
|
||||||
"GL_OES_compressed_ETC1_RGB8_texture",
|
|
||||||
"GL_OES_compressed_paletted_texture",
|
|
||||||
"GL_OES_copy_image",
|
|
||||||
"GL_OES_depth24",
|
"GL_OES_depth24",
|
||||||
"GL_OES_depth32",
|
"GL_OES_depth32",
|
||||||
"GL_OES_depth_texture",
|
|
||||||
"GL_OES_depth_texture_cube_map",
|
|
||||||
"GL_OES_draw_buffers_indexed",
|
|
||||||
"GL_OES_draw_elements_base_vertex",
|
|
||||||
"GL_OES_draw_texture",
|
|
||||||
"GL_OES_element_index_uint",
|
"GL_OES_element_index_uint",
|
||||||
"GL_OES_extended_matrix_palette",
|
|
||||||
"GL_OES_fbo_render_mipmap",
|
|
||||||
"GL_OES_fixed_point",
|
|
||||||
"GL_OES_fragment_precision_high",
|
|
||||||
"GL_OES_framebuffer_object",
|
"GL_OES_framebuffer_object",
|
||||||
"GL_OES_geometry_shader",
|
|
||||||
"GL_OES_get_program_binary",
|
|
||||||
"GL_OES_gpu_shader5",
|
|
||||||
"GL_OES_mapbuffer",
|
|
||||||
"GL_OES_matrix_get",
|
|
||||||
"GL_OES_matrix_palette",
|
|
||||||
"GL_OES_packed_depth_stencil",
|
"GL_OES_packed_depth_stencil",
|
||||||
"GL_OES_point_size_array",
|
"GL_OES_point_size_array",
|
||||||
"GL_OES_point_sprite",
|
"GL_OES_point_sprite",
|
||||||
"GL_OES_primitive_bounding_box",
|
|
||||||
"GL_OES_query_matrix",
|
|
||||||
"GL_OES_read_format",
|
"GL_OES_read_format",
|
||||||
"GL_OES_required_internalformat",
|
|
||||||
"GL_OES_rgb8_rgba8",
|
|
||||||
"GL_OES_sample_shading",
|
|
||||||
"GL_OES_sample_variables",
|
|
||||||
"GL_OES_shader_image_atomic",
|
|
||||||
"GL_OES_shader_io_blocks",
|
|
||||||
"GL_OES_shader_multisample_interpolation",
|
|
||||||
"GL_OES_single_precision",
|
|
||||||
"GL_OES_standard_derivatives",
|
|
||||||
"GL_OES_stencil1",
|
|
||||||
"GL_OES_stencil4",
|
|
||||||
"GL_OES_stencil8",
|
|
||||||
"GL_OES_stencil_wrap",
|
"GL_OES_stencil_wrap",
|
||||||
"GL_OES_surfaceless_context",
|
|
||||||
"GL_OES_tessellation_shader",
|
|
||||||
"GL_OES_texture_3D",
|
|
||||||
"GL_OES_texture_border_clamp",
|
|
||||||
"GL_OES_texture_buffer",
|
|
||||||
"GL_OES_texture_compression_astc",
|
|
||||||
"GL_OES_texture_cube_map",
|
|
||||||
"GL_OES_texture_cube_map_array",
|
|
||||||
"GL_OES_texture_env_crossbar",
|
|
||||||
"GL_OES_texture_float",
|
"GL_OES_texture_float",
|
||||||
"GL_OES_texture_float_linear",
|
|
||||||
"GL_OES_texture_half_float",
|
"GL_OES_texture_half_float",
|
||||||
"GL_OES_texture_half_float_linear",
|
|
||||||
"GL_OES_texture_mirrored_repeat",
|
"GL_OES_texture_mirrored_repeat",
|
||||||
"GL_OES_texture_npot",
|
"GL_OES_texture_npot",
|
||||||
"GL_OES_texture_stencil8",
|
|
||||||
"GL_OES_texture_storage_multisample_2d_array",
|
|
||||||
"GL_OES_texture_view",
|
|
||||||
"GL_OES_vertex_array_object",
|
|
||||||
"GL_OES_vertex_half_float",
|
|
||||||
"GL_OES_vertex_type_10_10_10_2",
|
|
||||||
"GL_OES_viewport_array",
|
|
||||||
"GL_OVR_multiview",
|
|
||||||
"GL_OVR_multiview2",
|
|
||||||
"GL_OVR_multiview_multisampled_render_to_texture",
|
|
||||||
"GL_QCOM_alpha_test",
|
|
||||||
"GL_QCOM_binning_control",
|
|
||||||
"GL_QCOM_driver_control",
|
|
||||||
"GL_QCOM_extended_get",
|
|
||||||
"GL_QCOM_extended_get2",
|
|
||||||
"GL_QCOM_framebuffer_foveated",
|
|
||||||
"GL_QCOM_performance_monitor_global_mode",
|
|
||||||
"GL_QCOM_shader_framebuffer_fetch_noncoherent",
|
|
||||||
"GL_QCOM_tiled_rendering",
|
|
||||||
"GL_QCOM_writeonly_rendering",
|
|
||||||
"GL_SUN_multi_draw_arrays",
|
|
||||||
"GL_VIV_shader_binary",
|
|
||||||
"WGL_ARB_context_flush_control"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return OGLESFeatureStrings[index];
|
return OGLESFeatureStrings[index];
|
||||||
@ -721,10 +155,6 @@ namespace video
|
|||||||
core::stringc extensions = glGetString(GL_EXTENSIONS);
|
core::stringc extensions = glGetString(GL_EXTENSIONS);
|
||||||
os::Printer::log(extensions.c_str());
|
os::Printer::log(extensions.c_str());
|
||||||
|
|
||||||
// typo in the simulator (note the postfixed s)
|
|
||||||
if (extensions.find("GL_IMG_user_clip_planes"))
|
|
||||||
FeatureAvailable[IRR_GL_IMG_user_clip_plane] = true;
|
|
||||||
|
|
||||||
const u32 size = extensions.size() + 1;
|
const u32 size = extensions.size() + 1;
|
||||||
c8* str = new c8[size];
|
c8* str = new c8[size];
|
||||||
strncpy(str, extensions.c_str(), extensions.size());
|
strncpy(str, extensions.c_str(), extensions.size());
|
||||||
|
@ -125,8 +125,6 @@ bool COGLES1Driver::genericDriverInit(const core::dimension2d<u32>& screenSize,
|
|||||||
|
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
|
||||||
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
glAlphaFunc(GL_GREATER, 0.f);
|
glAlphaFunc(GL_GREATER, 0.f);
|
||||||
@ -1798,33 +1796,15 @@ void COGLES1Driver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||||||
// Anti aliasing
|
// Anti aliasing
|
||||||
if (resetAllRenderStates || lastmaterial.AntiAliasing != material.AntiAliasing)
|
if (resetAllRenderStates || lastmaterial.AntiAliasing != material.AntiAliasing)
|
||||||
{
|
{
|
||||||
// if (FeatureAvailable[IRR_ARB_multisample])
|
if (material.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||||
{
|
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||||
if (material.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
else if (lastmaterial.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||||
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
|
||||||
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
|
||||||
|
|
||||||
if ((AntiAlias >= 2) && (material.AntiAliasing & (EAAM_SIMPLE|EAAM_QUALITY)))
|
if ((AntiAlias >= 2) && (material.AntiAliasing & (EAAM_SIMPLE|EAAM_QUALITY)))
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
else
|
else
|
||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
|
||||||
if ((material.AntiAliasing & EAAM_LINE_SMOOTH) != (lastmaterial.AntiAliasing & EAAM_LINE_SMOOTH))
|
|
||||||
{
|
|
||||||
if (material.AntiAliasing & EAAM_LINE_SMOOTH)
|
|
||||||
glEnable(GL_LINE_SMOOTH);
|
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_LINE_SMOOTH)
|
|
||||||
glDisable(GL_LINE_SMOOTH);
|
|
||||||
}
|
|
||||||
if ((material.AntiAliasing & EAAM_POINT_SMOOTH) != (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH))
|
|
||||||
{
|
|
||||||
if (material.AntiAliasing & EAAM_POINT_SMOOTH)
|
|
||||||
// often in software, and thus very slow
|
|
||||||
glEnable(GL_POINT_SMOOTH);
|
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH)
|
|
||||||
glDisable(GL_POINT_SMOOTH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Texture parameters
|
// Texture parameters
|
||||||
@ -1872,33 +1852,7 @@ void COGLES1Driver::setTextureRenderStates(const SMaterial& material, bool reset
|
|||||||
if (resetAllRenderstates)
|
if (resetAllRenderstates)
|
||||||
statesCache.IsCached = false;
|
statesCache.IsCached = false;
|
||||||
|
|
||||||
#ifdef GL_VERSION_2_1
|
#if defined(GL_EXT_texture_lod_bias)
|
||||||
if (Version >= 210)
|
|
||||||
{
|
|
||||||
if (!statesCache.IsCached || material.TextureLayers[i].LODBias != statesCache.LODBias)
|
|
||||||
{
|
|
||||||
if (material.TextureLayers[i].LODBias)
|
|
||||||
{
|
|
||||||
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
|
|
||||||
glTexParameterf(tmpTextureType, GL_TEXTURE_LOD_BIAS, tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
glTexParameterf(tmpTextureType, GL_TEXTURE_LOD_BIAS, 0.f);
|
|
||||||
|
|
||||||
statesCache.LODBias = material.TextureLayers[i].LODBias;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (FeatureAvailable[IRR_EXT_texture_lod_bias])
|
|
||||||
{
|
|
||||||
if (material.TextureLayers[i].LODBias)
|
|
||||||
{
|
|
||||||
const float tmp = core::clamp(material.TextureLayers[i].LODBias * 0.125f, -MaxTextureLODBias, MaxTextureLODBias);
|
|
||||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.f);
|
|
||||||
}
|
|
||||||
#elif defined(GL_EXT_texture_lod_bias)
|
|
||||||
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_lod_bias])
|
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_lod_bias])
|
||||||
{
|
{
|
||||||
if (material.TextureLayers[i].LODBias)
|
if (material.TextureLayers[i].LODBias)
|
||||||
@ -2087,7 +2041,7 @@ void COGLES1Driver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||||||
|
|
||||||
|
|
||||||
//! \return Returns the name of the video driver.
|
//! \return Returns the name of the video driver.
|
||||||
const wchar_t* COGLES1Driver::getName() const
|
const char* COGLES1Driver::getName() const
|
||||||
{
|
{
|
||||||
return Name.c_str();
|
return Name.c_str();
|
||||||
}
|
}
|
||||||
@ -2420,36 +2374,6 @@ bool COGLES1Driver::setPixelShaderConstant(s32 index, const u32* ints, int count
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
void COGLES1Driver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
#ifdef GL_vertex_program
|
|
||||||
for (s32 i=0; i<constantAmount; ++i)
|
|
||||||
extGlProgramLocalParameter4fv(GL_VERTEX_PROGRAM, startRegister+i, &data[i*4]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
void COGLES1Driver::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
#ifdef GL_fragment_program
|
|
||||||
for (s32 i=0; i<constantAmount; ++i)
|
|
||||||
extGlProgramLocalParameter4fv(GL_FRAGMENT_PROGRAM, startRegister+i, &data[i*4]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
|
||||||
//! vertex shaders to render geometry.
|
|
||||||
s32 COGLES1Driver::addShaderMaterial(const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
|
||||||
{
|
|
||||||
os::Printer::log("No shader support.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
||||||
s32 COGLES1Driver::addHighLevelShaderMaterial(
|
s32 COGLES1Driver::addHighLevelShaderMaterial(
|
||||||
@ -2888,104 +2812,6 @@ bool COGLES1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||||||
}
|
}
|
||||||
pixelType = GL_UNSIGNED_BYTE;
|
pixelType = GL_UNSIGNED_BYTE;
|
||||||
break;
|
break;
|
||||||
#ifdef GL_EXT_texture_compression_s3tc
|
|
||||||
case ECF_DXT1:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_EXT_texture_compression_s3tc
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_EXT_texture_compression_s3tc
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc
|
|
||||||
case ECF_PVRTC_RGB2:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
||||||
pixelFormat = GL_RGB;
|
|
||||||
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc
|
|
||||||
case ECF_PVRTC_ARGB2:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc
|
|
||||||
case ECF_PVRTC_RGB4:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
||||||
pixelFormat = GL_RGB;
|
|
||||||
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc
|
|
||||||
case ECF_PVRTC_ARGB4:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
|
||||||
case ECF_PVRTC2_ARGB2:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
|
||||||
case ECF_PVRTC2_ARGB4:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_OES_compressed_ETC1_RGB8_texture
|
|
||||||
case ECF_ETC1:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_ETC1_RGB8_OES;
|
|
||||||
pixelFormat = GL_RGB;
|
|
||||||
pixelType = GL_ETC1_RGB8_OES;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
|
||||||
case ECF_ETC2_RGB:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGB8_ETC2;
|
|
||||||
pixelFormat = GL_RGB;
|
|
||||||
pixelType = GL_COMPRESSED_RGB8_ETC2;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
|
||||||
case ECF_ETC2_ARGB:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
|
||||||
pixelFormat = GL_RGBA;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case ECF_D16:
|
case ECF_D16:
|
||||||
supported = true;
|
supported = true;
|
||||||
internalFormat = GL_DEPTH_COMPONENT16;
|
internalFormat = GL_DEPTH_COMPONENT16;
|
||||||
|
@ -136,7 +136,7 @@ namespace video
|
|||||||
SColor color = SColor(255,255,255,255)) override;
|
SColor color = SColor(255,255,255,255)) override;
|
||||||
|
|
||||||
//! Returns the name of the video driver.
|
//! Returns the name of the video driver.
|
||||||
const wchar_t* getName() const override;
|
const char* getName() const override;
|
||||||
|
|
||||||
//! Sets the dynamic ambient light color.
|
//! Sets the dynamic ambient light color.
|
||||||
void setAmbientLight(const SColorf& color) override;
|
void setAmbientLight(const SColorf& color) override;
|
||||||
@ -201,16 +201,6 @@ namespace video
|
|||||||
//! Uint interface for the above.
|
//! Uint interface for the above.
|
||||||
bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
|
bool setPixelShaderConstant(s32 index, const u32* ints, int count) override;
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver
|
|
||||||
virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData) override;
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver
|
//! Adds a new material renderer to the VideoDriver
|
||||||
virtual s32 addHighLevelShaderMaterial(const c8* vertexShaderProgram, const c8* vertexShaderEntryPointName,
|
virtual s32 addHighLevelShaderMaterial(const c8* vertexShaderProgram, const c8* vertexShaderEntryPointName,
|
||||||
E_VERTEX_SHADER_TYPE vsCompileTarget, const c8* pixelShaderProgram, const c8* pixelShaderEntryPointName,
|
E_VERTEX_SHADER_TYPE vsCompileTarget, const c8* pixelShaderProgram, const c8* pixelShaderEntryPointName,
|
||||||
@ -318,7 +308,7 @@ namespace video
|
|||||||
|
|
||||||
COGLES1CacheHandler* CacheHandler;
|
COGLES1CacheHandler* CacheHandler;
|
||||||
|
|
||||||
core::stringw Name;
|
core::stringc Name;
|
||||||
core::matrix4 Matrices[ETS_COUNT];
|
core::matrix4 Matrices[ETS_COUNT];
|
||||||
core::array<u8> ColorBuffer;
|
core::array<u8> ColorBuffer;
|
||||||
|
|
||||||
|
@ -12,13 +12,11 @@
|
|||||||
#include "SMaterial.h"
|
#include "SMaterial.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) || defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#else
|
#else
|
||||||
#include <GLES/egl.h>
|
#include <GLES/egl.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -27,12 +25,10 @@ namespace video
|
|||||||
|
|
||||||
COGLES1ExtensionHandler::COGLES1ExtensionHandler() : COGLESCoreExtensionHandler(),
|
COGLES1ExtensionHandler::COGLES1ExtensionHandler() : COGLESCoreExtensionHandler(),
|
||||||
MaxUserClipPlanes(0), MaxLights(0)
|
MaxUserClipPlanes(0), MaxLights(0)
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
|
||||||
, pGlBlendEquationOES(0), pGlBlendFuncSeparateOES(0),
|
, pGlBlendEquationOES(0), pGlBlendFuncSeparateOES(0),
|
||||||
pGlBindFramebufferOES(0), pGlDeleteFramebuffersOES(0),
|
pGlBindFramebufferOES(0), pGlDeleteFramebuffersOES(0),
|
||||||
pGlGenFramebuffersOES(0), pGlCheckFramebufferStatusOES(0),
|
pGlGenFramebuffersOES(0), pGlCheckFramebufferStatusOES(0),
|
||||||
pGlFramebufferTexture2DOES(0), pGlGenerateMipmapOES(0)
|
pGlFramebufferTexture2DOES(0), pGlGenerateMipmapOES(0)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +80,6 @@ namespace video
|
|||||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||||
Feature.ColorAttachment = 1;
|
Feature.ColorAttachment = 1;
|
||||||
|
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
|
||||||
pGlBlendEquationOES = (PFNGLBLENDEQUATIONOESPROC)eglGetProcAddress("glBlendEquationOES");
|
pGlBlendEquationOES = (PFNGLBLENDEQUATIONOESPROC)eglGetProcAddress("glBlendEquationOES");
|
||||||
pGlBlendFuncSeparateOES = (PFNGLBLENDFUNCSEPARATEOESPROC)eglGetProcAddress("glBlendFuncSeparateOES");
|
pGlBlendFuncSeparateOES = (PFNGLBLENDFUNCSEPARATEOESPROC)eglGetProcAddress("glBlendFuncSeparateOES");
|
||||||
pGlBindFramebufferOES = (PFNGLBINDFRAMEBUFFEROESPROC)eglGetProcAddress("glBindFramebufferOES");
|
pGlBindFramebufferOES = (PFNGLBINDFRAMEBUFFEROESPROC)eglGetProcAddress("glBindFramebufferOES");
|
||||||
@ -93,7 +88,6 @@ namespace video
|
|||||||
pGlCheckFramebufferStatusOES = (PFNGLCHECKFRAMEBUFFERSTATUSOESPROC)eglGetProcAddress("glCheckFramebufferStatusOES");
|
pGlCheckFramebufferStatusOES = (PFNGLCHECKFRAMEBUFFERSTATUSOESPROC)eglGetProcAddress("glCheckFramebufferStatusOES");
|
||||||
pGlFramebufferTexture2DOES = (PFNGLFRAMEBUFFERTEXTURE2DOESPROC)eglGetProcAddress("glFramebufferTexture2DOES");
|
pGlFramebufferTexture2DOES = (PFNGLFRAMEBUFFERTEXTURE2DOESPROC)eglGetProcAddress("glFramebufferTexture2DOES");
|
||||||
pGlGenerateMipmapOES = (PFNGLGENERATEMIPMAPOESPROC)eglGetProcAddress("glGenerateMipmapOES");
|
pGlGenerateMipmapOES = (PFNGLGENERATEMIPMAPOESPROC)eglGetProcAddress("glGenerateMipmapOES");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
@ -55,14 +55,6 @@ namespace video
|
|||||||
return FeatureAvailable[IRR_GL_OES_framebuffer_object];
|
return FeatureAvailable[IRR_GL_OES_framebuffer_object];
|
||||||
case EVDF_VERTEX_BUFFER_OBJECT:
|
case EVDF_VERTEX_BUFFER_OBJECT:
|
||||||
return Version>100;
|
return Version>100;
|
||||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
|
||||||
return false; // NV Tegra need improvements here
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_PVRTC:
|
|
||||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
|
|
||||||
case EVDF_TEXTURE_COMPRESSED_ETC1:
|
|
||||||
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
|
|
||||||
case EVDF_TEXTURE_CUBEMAP:
|
|
||||||
return FeatureAvailable[IRR_GL_OES_texture_cube_map];
|
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -91,66 +83,40 @@ namespace video
|
|||||||
|
|
||||||
inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
|
inline void irrGlBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlBindFramebufferOES)
|
if (pGlBindFramebufferOES)
|
||||||
pGlBindFramebufferOES(target, framebuffer);
|
pGlBindFramebufferOES(target, framebuffer);
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
glBindFramebufferOES(target, framebuffer);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
|
inline void irrGlDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlDeleteFramebuffersOES)
|
if (pGlDeleteFramebuffersOES)
|
||||||
pGlDeleteFramebuffersOES(n, framebuffers);
|
pGlDeleteFramebuffersOES(n, framebuffers);
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
glDeleteFramebuffersOES(n, framebuffers);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
|
inline void irrGlGenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlGenFramebuffersOES)
|
if (pGlGenFramebuffersOES)
|
||||||
pGlGenFramebuffersOES(n, framebuffers);
|
pGlGenFramebuffersOES(n, framebuffers);
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
glGenFramebuffersOES(n, framebuffers);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GLenum irrGlCheckFramebufferStatus(GLenum target)
|
inline GLenum irrGlCheckFramebufferStatus(GLenum target)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlCheckFramebufferStatusOES)
|
if (pGlCheckFramebufferStatusOES)
|
||||||
return pGlCheckFramebufferStatusOES(target);
|
return pGlCheckFramebufferStatusOES(target);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
return glCheckFramebufferStatusOES(target);
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
inline void irrGlFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlFramebufferTexture2DOES)
|
if (pGlFramebufferTexture2DOES)
|
||||||
pGlFramebufferTexture2DOES(target, attachment, textarget, texture, level);
|
pGlFramebufferTexture2DOES(target, attachment, textarget, texture, level);
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlGenerateMipmap(GLenum target)
|
inline void irrGlGenerateMipmap(GLenum target)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlGenerateMipmapOES)
|
if (pGlGenerateMipmapOES)
|
||||||
pGlGenerateMipmapOES(target);
|
pGlGenerateMipmapOES(target);
|
||||||
#elif defined(GL_OES_framebuffer_object)
|
|
||||||
glGenerateMipmapOES(target);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlActiveStencilFace(GLenum face)
|
inline void irrGlActiveStencilFace(GLenum face)
|
||||||
@ -167,22 +133,14 @@ namespace video
|
|||||||
|
|
||||||
inline void irrGlBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
inline void irrGlBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlBlendFuncSeparateOES)
|
if (pGlBlendFuncSeparateOES)
|
||||||
pGlBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
pGlBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||||
#elif defined(GL_OES_blend_func_separate)
|
|
||||||
glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlBlendEquation(GLenum mode)
|
inline void irrGlBlendEquation(GLenum mode)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_OGLES1_USE_EXTPOINTER_
|
|
||||||
if (pGlBlendEquationOES)
|
if (pGlBlendEquationOES)
|
||||||
pGlBlendEquationOES(mode);
|
pGlBlendEquationOES(mode);
|
||||||
#elif defined(GL_OES_blend_subtract)
|
|
||||||
glBlendEquationOES(mode);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void irrGlEnableIndexed(GLenum target, GLuint index)
|
inline void irrGlEnableIndexed(GLenum target, GLuint index)
|
||||||
@ -218,7 +176,6 @@ namespace video
|
|||||||
u8 MaxUserClipPlanes;
|
u8 MaxUserClipPlanes;
|
||||||
u8 MaxLights;
|
u8 MaxLights;
|
||||||
|
|
||||||
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
|
|
||||||
PFNGLBLENDEQUATIONOESPROC pGlBlendEquationOES;
|
PFNGLBLENDEQUATIONOESPROC pGlBlendEquationOES;
|
||||||
PFNGLBLENDFUNCSEPARATEOESPROC pGlBlendFuncSeparateOES;
|
PFNGLBLENDFUNCSEPARATEOESPROC pGlBlendFuncSeparateOES;
|
||||||
PFNGLBINDFRAMEBUFFEROESPROC pGlBindFramebufferOES;
|
PFNGLBINDFRAMEBUFFEROESPROC pGlBindFramebufferOES;
|
||||||
@ -227,7 +184,6 @@ namespace video
|
|||||||
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC pGlCheckFramebufferStatusOES;
|
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC pGlCheckFramebufferStatusOES;
|
||||||
PFNGLFRAMEBUFFERTEXTURE2DOESPROC pGlFramebufferTexture2DOES;
|
PFNGLFRAMEBUFFERTEXTURE2DOESPROC pGlFramebufferTexture2DOES;
|
||||||
PFNGLGENERATEMIPMAPOESPROC pGlGenerateMipmapOES;
|
PFNGLGENERATEMIPMAPOESPROC pGlGenerateMipmapOES;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -159,10 +159,11 @@ const c8* COSOperator::getTextFromClipboard() const
|
|||||||
if (!OpenClipboard(NULL))
|
if (!OpenClipboard(NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wchar_t * buffer = 0;
|
|
||||||
|
|
||||||
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
|
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
|
||||||
buffer = (wchar_t*) GlobalLock( hData );
|
if (hData == NULL) // Probably not in Unicode text format
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
wchar_t * buffer = (wchar_t*) GlobalLock( hData );
|
||||||
|
|
||||||
core::wStringToUTF8(ClipboardBuf, buffer);
|
core::wStringToUTF8(ClipboardBuf, buffer);
|
||||||
|
|
||||||
|
@ -6,159 +6,15 @@
|
|||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
|
|
||||||
#if defined(_IRR_WINDOWS_API_)
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && defined(IRR_PREFER_SDL_GL_HEADER)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#define GL_GLEXT_LEGACY 1
|
|
||||||
#endif
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#endif
|
|
||||||
#include <GL/wglext.h>
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#define GL_GLEXT_LEGACY 1
|
|
||||||
#endif
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#endif
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#define GL_GLEXT_LEGACY 1
|
|
||||||
#else
|
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
|
||||||
#endif
|
|
||||||
#include <SDL_video.h>
|
#include <SDL_video.h>
|
||||||
#include <SDL_opengl.h>
|
#include <SDL_opengl.h>
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
// The SDL2 header doesn't cut it for extensions
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
#include "vendor/gl.h"
|
||||||
#define GL_GLEXT_LEGACY 1
|
|
||||||
#define GLX_GLXEXT_LEGACY 1
|
|
||||||
#else
|
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
|
||||||
#define GLX_GLXEXT_PROTOTYPES 1
|
|
||||||
#endif
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#include <GL/glxext.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_ARB_shader_objects
|
|
||||||
typedef char GLcharARB;
|
|
||||||
typedef unsigned int GLhandleARB;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GL_VERSION_2_0
|
|
||||||
typedef char GLchar;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Blending definitions.
|
|
||||||
|
|
||||||
#if !defined(GL_VERSION_1_4)
|
|
||||||
#if defined(GL_EXT_blend_subtract) || defined(GL_EXT_blend_minmax) || defined(GL_EXT_blend_logic_op)
|
|
||||||
#define GL_FUNC_ADD GL_FUNC_ADD_EXT
|
|
||||||
#else
|
|
||||||
#define GL_FUNC_ADD 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FBO definitions.
|
|
||||||
|
|
||||||
#if !defined(GL_VERSION_3_0) && !defined(GL_ARB_framebuffer_object)
|
|
||||||
#ifdef GL_EXT_framebuffer_object
|
|
||||||
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
|
||||||
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
|
||||||
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
|
||||||
#define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_EXT
|
|
||||||
#define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
|
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
|
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
|
|
||||||
#define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_EXT
|
|
||||||
#else
|
|
||||||
#define GL_FRAMEBUFFER 0
|
|
||||||
#define GL_COLOR_ATTACHMENT0 0
|
|
||||||
#define GL_DEPTH_ATTACHMENT 0
|
|
||||||
#define GL_STENCIL_ATTACHMENT 0
|
|
||||||
#define GL_FRAMEBUFFER_COMPLETE 0
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 1
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 2
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 3
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 4
|
|
||||||
#define GL_FRAMEBUFFER_UNSUPPORTED 5
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GL_EXT_framebuffer_object
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
|
|
||||||
#else
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 6
|
|
||||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 7
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// MipMaps definitions.
|
|
||||||
|
|
||||||
#if !defined(GL_VERSION_1_4)
|
|
||||||
#ifdef GL_SGIS_generate_mipmap
|
|
||||||
#define GL_GENERATE_MIPMAP GL_GENERATE_MIPMAP_SGIS
|
|
||||||
#define GL_GENERATE_MIPMAP_HINT GL_GENERATE_MIPMAP_HINT_SGIS
|
|
||||||
#else
|
|
||||||
#define GL_GENERATE_MIPMAP 0
|
|
||||||
#define GL_GENERATE_MIPMAP_HINT 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Texture definitions.
|
|
||||||
|
|
||||||
#if !defined(GL_VERSION_1_3)
|
|
||||||
#ifdef GL_ARB_multitexture
|
|
||||||
#define GL_TEXTURE0 GL_TEXTURE0_ARB
|
|
||||||
#else
|
|
||||||
#define GL_TEXTURE0 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(GL_VERSION_1_3)
|
|
||||||
#ifdef GL_ARB_texture_cube_map
|
|
||||||
#define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
|
|
||||||
#elif defined(GL_EXT_texture_cube_map)
|
|
||||||
#define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT
|
|
||||||
#else
|
|
||||||
#define GL_TEXTURE_CUBE_MAP 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0
|
|
||||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// To check if this header is in the current compile unit (different GL driver implementations use different "GLCommon" headers in Irrlicht)
|
// To check if this header is in the current compile unit (different GL driver implementations use different "GLCommon" headers in Irrlicht)
|
||||||
#define IRR_COMPILE_GL_COMMON
|
#define IRR_COMPILE_GL_COMMON
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "SMaterial.h"
|
#include "SMaterial.h"
|
||||||
#include "ITexture.h"
|
#include "ITexture.h"
|
||||||
|
|
||||||
|
#include "mt_opengl.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace video
|
namespace video
|
||||||
@ -87,19 +89,19 @@ class COpenGLCoreCacheHandler
|
|||||||
|
|
||||||
if (curTextureType != prevTextureType)
|
if (curTextureType != prevTextureType)
|
||||||
{
|
{
|
||||||
glBindTexture(prevTextureType, 0);
|
GL.BindTexture(prevTextureType, 0);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(prevTextureType);
|
GL.Disable(prevTextureType);
|
||||||
glEnable(curTextureType);
|
GL.Enable(curTextureType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
else if (!prevTexture)
|
else if (!prevTexture)
|
||||||
glEnable(curTextureType);
|
GL.Enable(curTextureType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glBindTexture(curTextureType, static_cast<const TOpenGLTexture*>(texture)->getOpenGLTextureName());
|
GL.BindTexture(curTextureType, static_cast<const TOpenGLTexture*>(texture)->getOpenGLTextureName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -115,10 +117,10 @@ class COpenGLCoreCacheHandler
|
|||||||
{
|
{
|
||||||
const GLenum prevTextureType = prevTexture->getOpenGLTextureType();
|
const GLenum prevTextureType = prevTexture->getOpenGLTextureType();
|
||||||
|
|
||||||
glBindTexture(prevTextureType, 0);
|
GL.BindTexture(prevTextureType, 0);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(prevTextureType);
|
GL.Disable(prevTextureType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,28 +224,28 @@ public:
|
|||||||
ColorMask[i] = ECP_ALL;
|
ColorMask[i] = ECP_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlendFunc(GL_ONE, GL_ZERO);
|
GL.BlendFunc(GL_ONE, GL_ZERO);
|
||||||
glDisable(GL_BLEND);
|
GL.Disable(GL_BLEND);
|
||||||
|
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
GL.ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
glCullFace(CullFaceMode);
|
GL.CullFace(CullFaceMode);
|
||||||
glDisable(GL_CULL_FACE);
|
GL.Disable(GL_CULL_FACE);
|
||||||
|
|
||||||
glDepthFunc(DepthFunc);
|
GL.DepthFunc(DepthFunc);
|
||||||
glDepthMask(GL_TRUE);
|
GL.DepthMask(GL_TRUE);
|
||||||
glDisable(GL_DEPTH_TEST);
|
GL.Disable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
Driver->irrGlActiveTexture(ActiveTexture);
|
Driver->irrGlActiveTexture(ActiveTexture);
|
||||||
|
|
||||||
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
#if ( defined(IRR_COMPILE_GL_COMMON) || defined(IRR_COMPILE_GLES_COMMON) )
|
||||||
glDisable(GL_TEXTURE_2D);
|
GL.Disable(GL_TEXTURE_2D);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const core::dimension2d<u32> ScreenSize = Driver->getScreenSize();
|
const core::dimension2d<u32> ScreenSize = Driver->getScreenSize();
|
||||||
ViewportWidth = ScreenSize.Width;
|
ViewportWidth = ScreenSize.Width;
|
||||||
ViewportHeight = ScreenSize.Height;
|
ViewportHeight = ScreenSize.Height;
|
||||||
glViewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);
|
GL.Viewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~COpenGLCoreCacheHandler()
|
virtual ~COpenGLCoreCacheHandler()
|
||||||
@ -300,7 +302,7 @@ public:
|
|||||||
BlendSourceAlpha[0] != source || BlendDestinationAlpha[0] != destination ||
|
BlendSourceAlpha[0] != source || BlendDestinationAlpha[0] != destination ||
|
||||||
BlendFuncInvalid)
|
BlendFuncInvalid)
|
||||||
{
|
{
|
||||||
glBlendFunc(source, destination);
|
GL.BlendFunc(source, destination);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
{
|
{
|
||||||
@ -383,9 +385,9 @@ public:
|
|||||||
if (Blend[0] != enable || BlendInvalid)
|
if (Blend[0] != enable || BlendInvalid)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_BLEND);
|
GL.Enable(GL_BLEND);
|
||||||
else
|
else
|
||||||
glDisable(GL_BLEND);
|
GL.Disable(GL_BLEND);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
Blend[i] = enable;
|
Blend[i] = enable;
|
||||||
@ -419,7 +421,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (ColorMask[0] != mask || ColorMaskInvalid)
|
if (ColorMask[0] != mask || ColorMaskInvalid)
|
||||||
{
|
{
|
||||||
glColorMask((mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);
|
GL.ColorMask((mask & ECP_RED) ? GL_TRUE : GL_FALSE, (mask & ECP_GREEN) ? GL_TRUE : GL_FALSE, (mask & ECP_BLUE) ? GL_TRUE : GL_FALSE, (mask & ECP_ALPHA) ? GL_TRUE : GL_FALSE);
|
||||||
|
|
||||||
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
for (GLuint i = 0; i < FrameBufferCount; ++i)
|
||||||
ColorMask[i] = mask;
|
ColorMask[i] = mask;
|
||||||
@ -445,7 +447,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (CullFaceMode != mode)
|
if (CullFaceMode != mode)
|
||||||
{
|
{
|
||||||
glCullFace(mode);
|
GL.CullFace(mode);
|
||||||
CullFaceMode = mode;
|
CullFaceMode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,9 +457,9 @@ public:
|
|||||||
if (CullFace != enable)
|
if (CullFace != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_CULL_FACE);
|
GL.Enable(GL_CULL_FACE);
|
||||||
else
|
else
|
||||||
glDisable(GL_CULL_FACE);
|
GL.Disable(GL_CULL_FACE);
|
||||||
|
|
||||||
CullFace = enable;
|
CullFace = enable;
|
||||||
}
|
}
|
||||||
@ -469,7 +471,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (DepthFunc != mode)
|
if (DepthFunc != mode)
|
||||||
{
|
{
|
||||||
glDepthFunc(mode);
|
GL.DepthFunc(mode);
|
||||||
DepthFunc = mode;
|
DepthFunc = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,9 +486,9 @@ public:
|
|||||||
if (DepthMask != enable)
|
if (DepthMask != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glDepthMask(GL_TRUE);
|
GL.DepthMask(GL_TRUE);
|
||||||
else
|
else
|
||||||
glDepthMask(GL_FALSE);
|
GL.DepthMask(GL_FALSE);
|
||||||
|
|
||||||
DepthMask = enable;
|
DepthMask = enable;
|
||||||
}
|
}
|
||||||
@ -502,9 +504,9 @@ public:
|
|||||||
if (DepthTest != enable)
|
if (DepthTest != enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
glEnable(GL_DEPTH_TEST);
|
GL.Enable(GL_DEPTH_TEST);
|
||||||
else
|
else
|
||||||
glDisable(GL_DEPTH_TEST);
|
GL.Disable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
DepthTest = enable;
|
DepthTest = enable;
|
||||||
}
|
}
|
||||||
@ -572,7 +574,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (ViewportX != viewportX || ViewportY != viewportY || ViewportWidth != viewportWidth || ViewportHeight != viewportHeight)
|
if (ViewportX != viewportX || ViewportY != viewportY || ViewportWidth != viewportWidth || ViewportHeight != viewportHeight)
|
||||||
{
|
{
|
||||||
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
GL.Viewport(viewportX, viewportY, viewportWidth, viewportHeight);
|
||||||
ViewportX = viewportX;
|
ViewportX = viewportX;
|
||||||
ViewportY = viewportY;
|
ViewportY = viewportY;
|
||||||
ViewportWidth = viewportWidth;
|
ViewportWidth = viewportWidth;
|
||||||
|
@ -12,10 +12,7 @@
|
|||||||
#include "CImage.h"
|
#include "CImage.h"
|
||||||
#include "CColorConverter.h"
|
#include "CColorConverter.h"
|
||||||
|
|
||||||
// Check if GL version we compile with should have the glGenerateMipmap function.
|
#include "mt_opengl.h"
|
||||||
#if defined(GL_VERSION_3_0) || defined(GL_ES_VERSION_2_0)
|
|
||||||
#define IRR_OPENGL_HAS_glGenerateMipmap
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -57,6 +54,8 @@ public:
|
|||||||
KeepImage = Driver->getTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY);
|
KeepImage = Driver->getTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY);
|
||||||
|
|
||||||
getImageValues(images[0]);
|
getImageValues(images[0]);
|
||||||
|
if (!InternalFormat)
|
||||||
|
return;
|
||||||
|
|
||||||
const core::array<IImage*>* tmpImages = &images;
|
const core::array<IImage*>* tmpImages = &images;
|
||||||
|
|
||||||
@ -90,32 +89,23 @@ public:
|
|||||||
tmpImages = &Images;
|
tmpImages = &Images;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &TextureName);
|
GL.GenTextures(1, &TextureName);
|
||||||
|
|
||||||
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||||
|
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
#ifdef GL_GENERATE_MIPMAP_HINT
|
#ifdef GL_GENERATE_MIPMAP_HINT
|
||||||
if (HasMipMaps)
|
if (HasMipMaps)
|
||||||
{
|
{
|
||||||
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||||
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||||
else
|
else
|
||||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
GL.Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(IRR_OPENGL_HAS_glGenerateMipmap) && defined(GL_GENERATE_MIPMAP)
|
|
||||||
if (HasMipMaps)
|
|
||||||
{
|
|
||||||
LegacyAutoGenerateMipMaps = Driver->getTextureCreationFlag(ETCF_AUTO_GENERATE_MIP_MAPS) &&
|
|
||||||
Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE);
|
|
||||||
glTexParameteri(TextureType, GL_GENERATE_MIPMAP, LegacyAutoGenerateMipMaps ? GL_TRUE : GL_FALSE);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -172,21 +162,22 @@ public:
|
|||||||
if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) )
|
if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) )
|
||||||
{
|
{
|
||||||
os::Printer::log("COpenGLCoreTexture: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
os::Printer::log("COpenGLCoreTexture: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &TextureName);
|
GL.GenTextures(1, &TextureName);
|
||||||
|
|
||||||
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
const COpenGLCoreTexture* prevTexture = Driver->getCacheHandler()->getTextureCache().get(0);
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
Driver->getCacheHandler()->getTextureCache().set(0, this);
|
||||||
|
|
||||||
|
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
GL.TexParameteri(TextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
#if defined(GL_VERSION_1_2)
|
#if defined(GL_VERSION_1_2)
|
||||||
glTexParameteri(TextureType, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
GL.TexParameteri(TextureType, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
||||||
@ -196,15 +187,15 @@ public:
|
|||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case ETT_2D:
|
case ETT_2D:
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_2D, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
break;
|
break;
|
||||||
case ETT_CUBEMAP:
|
case ETT_CUBEMAP:
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
GL.TexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, InternalFormat, Size.Width, Size.Height, 0, PixelFormat, PixelType, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +211,7 @@ public:
|
|||||||
virtual ~COpenGLCoreTexture()
|
virtual ~COpenGLCoreTexture()
|
||||||
{
|
{
|
||||||
if (TextureName)
|
if (TextureName)
|
||||||
glDeleteTextures(1, &TextureName);
|
GL.DeleteTextures(1, &TextureName);
|
||||||
|
|
||||||
if (LockImage)
|
if (LockImage)
|
||||||
LockImage->drop();
|
LockImage->drop();
|
||||||
@ -278,7 +269,7 @@ public:
|
|||||||
tmpTextureType = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
|
tmpTextureType = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
glGetTexImage(tmpTextureType, MipLevelStored, PixelFormat, PixelType, tmpImage->getData());
|
GL.GetTexImage(tmpTextureType, MipLevelStored, PixelFormat, PixelType, tmpImage->getData());
|
||||||
Driver->testGLError(__LINE__);
|
Driver->testGLError(__LINE__);
|
||||||
|
|
||||||
if (IsRenderTarget && lockFlags == ETLF_FLIP_Y_UP_RTT)
|
if (IsRenderTarget && lockFlags == ETLF_FLIP_Y_UP_RTT)
|
||||||
@ -321,12 +312,12 @@ public:
|
|||||||
|
|
||||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmpTexture->getOpenGLTextureName(), 0);
|
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmpTexture->getOpenGLTextureName(), 0);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
GL.Clear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Driver->draw2DImage(this, layer, true);
|
Driver->draw2DImage(this, layer, true);
|
||||||
|
|
||||||
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
IImage* tmpImage = Driver->createImage(ECF_A8R8G8B8, Size);
|
||||||
glReadPixels(0, 0, Size.Width, Size.Height, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
GL.ReadPixels(0, 0, Size.Width, Size.Height, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->getData());
|
||||||
|
|
||||||
Driver->getCacheHandler()->setFBO(prevFBO);
|
Driver->getCacheHandler()->setFBO(prevFBO);
|
||||||
Driver->getCacheHandler()->setViewport(prevViewportX, prevViewportY, prevViewportWidth, prevViewportHeight);
|
Driver->getCacheHandler()->setViewport(prevViewportX, prevViewportY, prevViewportWidth, prevViewportHeight);
|
||||||
@ -428,9 +419,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef IRR_OPENGL_HAS_glGenerateMipmap
|
|
||||||
Driver->irrGlGenerateMipmap(TextureType);
|
Driver->irrGlGenerateMipmap(TextureType);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
|
Driver->getCacheHandler()->getTextureCache().set(0, prevTexture);
|
||||||
@ -517,7 +506,8 @@ protected:
|
|||||||
if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) )
|
if ( !Driver->getColorFormatParameters(ColorFormat, InternalFormat, PixelFormat, PixelType, &Converter) )
|
||||||
{
|
{
|
||||||
os::Printer::log("getImageValues: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
os::Printer::log("getImageValues: Color format is not supported", ColorFormatNames[ColorFormat < ECF_UNKNOWN?ColorFormat:ECF_UNKNOWN], ELL_ERROR);
|
||||||
// not quitting as it will use some alternative internal format
|
InternalFormat = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IImage::isCompressedFormat(image->getColorFormat()))
|
if (IImage::isCompressedFormat(image->getColorFormat()))
|
||||||
@ -561,6 +551,10 @@ protected:
|
|||||||
|
|
||||||
u32 width = Size.Width >> level;
|
u32 width = Size.Width >> level;
|
||||||
u32 height = Size.Height >> level;
|
u32 height = Size.Height >> level;
|
||||||
|
if (width < 1)
|
||||||
|
width = 1;
|
||||||
|
if (height < 1)
|
||||||
|
height = 1;
|
||||||
|
|
||||||
GLenum tmpTextureType = TextureType;
|
GLenum tmpTextureType = TextureType;
|
||||||
|
|
||||||
@ -591,9 +585,9 @@ protected:
|
|||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
case GL_TEXTURE_CUBE_MAP:
|
case GL_TEXTURE_CUBE_MAP:
|
||||||
if (initTexture)
|
if (initTexture)
|
||||||
glTexImage2D(tmpTextureType, level, InternalFormat, width, height, 0, PixelFormat, PixelType, tmpData);
|
GL.TexImage2D(tmpTextureType, level, InternalFormat, width, height, 0, PixelFormat, PixelType, tmpData);
|
||||||
else
|
else
|
||||||
glTexSubImage2D(tmpTextureType, level, 0, 0, width, height, PixelFormat, PixelType, tmpData);
|
GL.TexSubImage2D(tmpTextureType, level, 0, 0, width, height, PixelFormat, PixelType, tmpData);
|
||||||
Driver->testGLError(__LINE__);
|
Driver->testGLError(__LINE__);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "COpenGLCacheHandler.h"
|
#include "COpenGLCacheHandler.h"
|
||||||
#include "COpenGLMaterialRenderer.h"
|
#include "COpenGLMaterialRenderer.h"
|
||||||
#include "COpenGLShaderMaterialRenderer.h"
|
|
||||||
#include "COpenGLSLMaterialRenderer.h"
|
#include "COpenGLSLMaterialRenderer.h"
|
||||||
|
|
||||||
#include "COpenGLCoreTexture.h"
|
#include "COpenGLCoreTexture.h"
|
||||||
@ -45,15 +44,14 @@ bool COpenGLDriver::initDriver()
|
|||||||
ContextManager->generateContext();
|
ContextManager->generateContext();
|
||||||
ExposedData = ContextManager->getContext();
|
ExposedData = ContextManager->getContext();
|
||||||
ContextManager->activateContext(ExposedData, false);
|
ContextManager->activateContext(ExposedData, false);
|
||||||
|
GL.LoadAllProcedures(ContextManager);
|
||||||
|
|
||||||
genericDriverInit();
|
genericDriverInit();
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||||
extGlSwapInterval(Params.Vsync ? 1 : 0);
|
extGlSwapInterval(Params.Vsync ? 1 : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL.LoadAllProcedures(ContextManager);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,9 +88,9 @@ bool COpenGLDriver::genericDriverInit()
|
|||||||
if (ContextManager)
|
if (ContextManager)
|
||||||
ContextManager->grab();
|
ContextManager->grab();
|
||||||
|
|
||||||
Name=L"OpenGL ";
|
Name="OpenGL ";
|
||||||
Name.append(glGetString(GL_VERSION));
|
Name.append(glGetString(GL_VERSION));
|
||||||
s32 pos=Name.findNext(L' ', 7);
|
s32 pos=Name.findNext(' ', 7);
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
Name=Name.subString(0, pos);
|
Name=Name.subString(0, pos);
|
||||||
printVersion();
|
printVersion();
|
||||||
@ -109,7 +107,7 @@ bool COpenGLDriver::genericDriverInit()
|
|||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
// load extensions
|
// load extensions
|
||||||
initExtensions(Params.Stencilbuffer);
|
initExtensions(ContextManager, Params.Stencilbuffer);
|
||||||
|
|
||||||
// reset cache handler
|
// reset cache handler
|
||||||
delete CacheHandler;
|
delete CacheHandler;
|
||||||
@ -171,8 +169,6 @@ bool COpenGLDriver::genericDriverInit()
|
|||||||
|
|
||||||
glClearDepth(1.0);
|
glClearDepth(1.0);
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
|
||||||
glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
|
|
||||||
glFrontFace(GL_CW);
|
glFrontFace(GL_CW);
|
||||||
// adjust flat coloring scheme to DirectX version
|
// adjust flat coloring scheme to DirectX version
|
||||||
#if defined(GL_ARB_provoking_vertex) || defined(GL_EXT_provoking_vertex)
|
#if defined(GL_ARB_provoking_vertex) || defined(GL_EXT_provoking_vertex)
|
||||||
@ -2557,46 +2553,29 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Anti aliasing
|
// Anti aliasing
|
||||||
if (resetAllRenderStates || lastmaterial.AntiAliasing != material.AntiAliasing)
|
if ((resetAllRenderStates
|
||||||
{
|
|| lastmaterial.AntiAliasing != material.AntiAliasing)
|
||||||
if (FeatureAvailable[IRR_ARB_multisample])
|
&& FeatureAvailable[IRR_ARB_multisample]) {
|
||||||
{
|
if (material.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||||
if (material.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
|
||||||
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
|
else if (lastmaterial.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_ALPHA_TO_COVERAGE)
|
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
|
||||||
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
|
|
||||||
|
|
||||||
if ((AntiAlias >= 2) && (material.AntiAliasing & (EAAM_SIMPLE|EAAM_QUALITY)))
|
if ((AntiAlias >= 2) && (material.AntiAliasing & (EAAM_SIMPLE|EAAM_QUALITY)))
|
||||||
{
|
{
|
||||||
glEnable(GL_MULTISAMPLE_ARB);
|
glEnable(GL_MULTISAMPLE_ARB);
|
||||||
#ifdef GL_NV_multisample_filter_hint
|
#ifdef GL_NV_multisample_filter_hint
|
||||||
if (FeatureAvailable[IRR_NV_multisample_filter_hint])
|
if (FeatureAvailable[IRR_NV_multisample_filter_hint])
|
||||||
{
|
{
|
||||||
if ((material.AntiAliasing & EAAM_QUALITY) == EAAM_QUALITY)
|
if ((material.AntiAliasing & EAAM_QUALITY) == EAAM_QUALITY)
|
||||||
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);
|
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST);
|
||||||
else
|
else
|
||||||
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_FASTEST);
|
glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_FASTEST);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
#endif
|
||||||
glDisable(GL_MULTISAMPLE_ARB);
|
|
||||||
}
|
|
||||||
if ((material.AntiAliasing & EAAM_LINE_SMOOTH) != (lastmaterial.AntiAliasing & EAAM_LINE_SMOOTH))
|
|
||||||
{
|
|
||||||
if (material.AntiAliasing & EAAM_LINE_SMOOTH)
|
|
||||||
glEnable(GL_LINE_SMOOTH);
|
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_LINE_SMOOTH)
|
|
||||||
glDisable(GL_LINE_SMOOTH);
|
|
||||||
}
|
|
||||||
if ((material.AntiAliasing & EAAM_POINT_SMOOTH) != (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH))
|
|
||||||
{
|
|
||||||
if (material.AntiAliasing & EAAM_POINT_SMOOTH)
|
|
||||||
// often in software, and thus very slow
|
|
||||||
glEnable(GL_POINT_SMOOTH);
|
|
||||||
else if (lastmaterial.AntiAliasing & EAAM_POINT_SMOOTH)
|
|
||||||
glDisable(GL_POINT_SMOOTH);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
glDisable(GL_MULTISAMPLE_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Texture parameters
|
// Texture parameters
|
||||||
@ -2939,7 +2918,7 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
|
|||||||
|
|
||||||
|
|
||||||
//! \return Returns the name of the video driver.
|
//! \return Returns the name of the video driver.
|
||||||
const wchar_t* COpenGLDriver::getName() const
|
const char* COpenGLDriver::getName() const
|
||||||
{
|
{
|
||||||
return Name.c_str();
|
return Name.c_str();
|
||||||
}
|
}
|
||||||
@ -3403,20 +3382,6 @@ s32 COpenGLDriver::getPixelShaderConstantID(const c8* name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
void COpenGLDriver::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
for (s32 i=0; i<constantAmount; ++i)
|
|
||||||
extGlProgramLocalParameter4fv(GL_VERTEX_PROGRAM_ARB, startRegister+i, &data[i*4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
void COpenGLDriver::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
for (s32 i=0; i<constantAmount; ++i)
|
|
||||||
extGlProgramLocalParameter4fv(GL_FRAGMENT_PROGRAM_ARB, startRegister+i, &data[i*4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Sets a constant for the vertex shader based on an index.
|
//! Sets a constant for the vertex shader based on an index.
|
||||||
bool COpenGLDriver::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
bool COpenGLDriver::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
||||||
{
|
{
|
||||||
@ -3457,23 +3422,6 @@ bool COpenGLDriver::setPixelShaderConstant(s32 index, const u32* ints, int count
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using pixel and/or
|
|
||||||
//! vertex shaders to render geometry.
|
|
||||||
s32 COpenGLDriver::addShaderMaterial(const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
|
||||||
{
|
|
||||||
s32 nr = -1;
|
|
||||||
COpenGLShaderMaterialRenderer* r = new COpenGLShaderMaterialRenderer(
|
|
||||||
this, nr, vertexShaderProgram, pixelShaderProgram,
|
|
||||||
callback, baseMaterial, userData);
|
|
||||||
|
|
||||||
r->drop();
|
|
||||||
return nr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
||||||
s32 COpenGLDriver::addHighLevelShaderMaterial(
|
s32 COpenGLDriver::addHighLevelShaderMaterial(
|
||||||
const c8* vertexShaderProgram,
|
const c8* vertexShaderProgram,
|
||||||
@ -3962,29 +3910,6 @@ bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||||||
if (Version > 101)
|
if (Version > 101)
|
||||||
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
|
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||||
break;
|
break;
|
||||||
case ECF_DXT1:
|
|
||||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_texture_compression_s3tc))
|
|
||||||
{
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
||||||
pixelFormat = GL_BGRA_EXT;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ECF_DXT2:
|
|
||||||
case ECF_DXT3:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
||||||
pixelFormat = GL_BGRA_EXT;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
||||||
break;
|
|
||||||
case ECF_DXT4:
|
|
||||||
case ECF_DXT5:
|
|
||||||
supported = true;
|
|
||||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
||||||
pixelFormat = GL_BGRA_EXT;
|
|
||||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
||||||
break;
|
|
||||||
case ECF_D16:
|
case ECF_D16:
|
||||||
supported = true;
|
supported = true;
|
||||||
internalFormat = GL_DEPTH_COMPONENT16;
|
internalFormat = GL_DEPTH_COMPONENT16;
|
||||||
|
@ -205,7 +205,7 @@ namespace video
|
|||||||
|
|
||||||
//! \return Returns the name of the video driver. Example: In case of the Direct3D8
|
//! \return Returns the name of the video driver. Example: In case of the Direct3D8
|
||||||
//! driver, it would return "Direct3D8.1".
|
//! driver, it would return "Direct3D8.1".
|
||||||
const wchar_t* getName() const override;
|
const char* getName() const override;
|
||||||
|
|
||||||
//! Sets the dynamic ambient light color. The default color is
|
//! Sets the dynamic ambient light color. The default color is
|
||||||
//! (0,0,0,0) which means it is dark.
|
//! (0,0,0,0) which means it is dark.
|
||||||
@ -259,12 +259,6 @@ namespace video
|
|||||||
//! Get a pixel shader constant index.
|
//! Get a pixel shader constant index.
|
||||||
s32 getPixelShaderConstantID(const c8* name) override;
|
s32 getPixelShaderConstantID(const c8* name) override;
|
||||||
|
|
||||||
//! Sets a vertex shader constant.
|
|
||||||
void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
|
|
||||||
//! Sets a pixel shader constant.
|
|
||||||
void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
|
|
||||||
//! Sets a constant for the vertex shader based on an index.
|
//! Sets a constant for the vertex shader based on an index.
|
||||||
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
||||||
|
|
||||||
@ -287,12 +281,6 @@ namespace video
|
|||||||
//! Returns whether disabling was successful or not.
|
//! Returns whether disabling was successful or not.
|
||||||
bool disableTextures(u32 fromStage=0);
|
bool disableTextures(u32 fromStage=0);
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using
|
|
||||||
//! extGLGetObjectParameteriv(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status)
|
|
||||||
//! pixel and/or vertex shaders to render geometry.
|
|
||||||
virtual s32 addShaderMaterial(const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData) override;
|
|
||||||
|
|
||||||
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
//! Adds a new material renderer to the VideoDriver, using GLSL to render geometry.
|
||||||
virtual s32 addHighLevelShaderMaterial(
|
virtual s32 addHighLevelShaderMaterial(
|
||||||
const c8* vertexShaderProgram,
|
const c8* vertexShaderProgram,
|
||||||
@ -439,7 +427,7 @@ namespace video
|
|||||||
|
|
||||||
COpenGLCacheHandler* CacheHandler;
|
COpenGLCacheHandler* CacheHandler;
|
||||||
|
|
||||||
core::stringw Name;
|
core::stringc Name;
|
||||||
core::matrix4 Matrices[ETS_COUNT];
|
core::matrix4 Matrices[ETS_COUNT];
|
||||||
core::array<u8> ColorBuffer;
|
core::array<u8> ColorBuffer;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "irrString.h"
|
#include "irrString.h"
|
||||||
#include "SMaterial.h"
|
#include "SMaterial.h"
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
#include "IContextManager.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -23,7 +24,6 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
|||||||
MaxTextureSize(1), MaxGeometryVerticesOut(0),
|
MaxTextureSize(1), MaxGeometryVerticesOut(0),
|
||||||
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
|
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
|
||||||
OcclusionQuerySupport(false), IsAtiRadeonX(false)
|
OcclusionQuerySupport(false), IsAtiRadeonX(false)
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
,pGlActiveTexture(0)
|
,pGlActiveTexture(0)
|
||||||
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
|
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
|
||||||
pGlGenProgramsARB(0), pGlGenProgramsNV(0),
|
pGlGenProgramsARB(0), pGlGenProgramsNV(0),
|
||||||
@ -105,7 +105,6 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
|
|||||||
#if defined(GLX_MESA_swap_control)
|
#if defined(GLX_MESA_swap_control)
|
||||||
,pGlxSwapIntervalMESA(0)
|
,pGlxSwapIntervalMESA(0)
|
||||||
#endif
|
#endif
|
||||||
#endif // _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
{
|
{
|
||||||
for (u32 i=0; i<IRR_OpenGL_Feature_Count; ++i)
|
for (u32 i=0; i<IRR_OpenGL_Feature_Count; ++i)
|
||||||
FeatureAvailable[i]=false;
|
FeatureAvailable[i]=false;
|
||||||
@ -127,221 +126,7 @@ void COpenGLExtensionHandler::dump(ELOG_LEVEL logLevel) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COpenGLExtensionHandler::dumpFramebufferFormats() const
|
void COpenGLExtensionHandler::initExtensions(video::IContextManager *cmgr, bool stencilBuffer)
|
||||||
{
|
|
||||||
#ifdef _IRR_WINDOWS_API_
|
|
||||||
HDC hdc=wglGetCurrentDC();
|
|
||||||
core::stringc wglExtensions;
|
|
||||||
#ifdef WGL_ARB_extensions_string
|
|
||||||
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
|
||||||
if (irrGetExtensionsString)
|
|
||||||
wglExtensions = irrGetExtensionsString(hdc);
|
|
||||||
#elif defined(WGL_EXT_extensions_string)
|
|
||||||
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
|
|
||||||
if (irrGetExtensionsString)
|
|
||||||
wglExtensions = irrGetExtensionsString(hdc);
|
|
||||||
#endif
|
|
||||||
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
|
||||||
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
|
||||||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
|
|
||||||
#ifdef _DEBUG
|
|
||||||
os::Printer::log("WGL_extensions", wglExtensions);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WGL_ARB_pixel_format
|
|
||||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
|
||||||
if (pixel_format_supported && wglChoosePixelFormat_ARB)
|
|
||||||
{
|
|
||||||
// This value determines the number of samples used for antialiasing
|
|
||||||
// My experience is that 8 does not show a big
|
|
||||||
// improvement over 4, but 4 shows a big improvement
|
|
||||||
// over 2.
|
|
||||||
|
|
||||||
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribiv_ARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB");
|
|
||||||
if (wglGetPixelFormatAttribiv_ARB)
|
|
||||||
{
|
|
||||||
int vals[128];
|
|
||||||
int atts[] = {
|
|
||||||
WGL_NUMBER_PIXEL_FORMATS_ARB,
|
|
||||||
WGL_DRAW_TO_BITMAP_ARB,
|
|
||||||
WGL_ACCELERATION_ARB,
|
|
||||||
WGL_NEED_PALETTE_ARB,
|
|
||||||
WGL_NEED_SYSTEM_PALETTE_ARB,
|
|
||||||
WGL_SWAP_LAYER_BUFFERS_ARB,
|
|
||||||
WGL_SWAP_METHOD_ARB,
|
|
||||||
WGL_NUMBER_OVERLAYS_ARB,
|
|
||||||
WGL_NUMBER_UNDERLAYS_ARB,
|
|
||||||
WGL_TRANSPARENT_ARB,
|
|
||||||
WGL_TRANSPARENT_RED_VALUE_ARB,
|
|
||||||
WGL_TRANSPARENT_GREEN_VALUE_ARB,
|
|
||||||
WGL_TRANSPARENT_BLUE_VALUE_ARB,
|
|
||||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB,
|
|
||||||
WGL_TRANSPARENT_INDEX_VALUE_ARB,
|
|
||||||
WGL_SHARE_DEPTH_ARB,
|
|
||||||
WGL_SHARE_STENCIL_ARB,
|
|
||||||
WGL_SHARE_ACCUM_ARB,
|
|
||||||
WGL_SUPPORT_GDI_ARB,
|
|
||||||
WGL_SUPPORT_OPENGL_ARB,
|
|
||||||
WGL_DOUBLE_BUFFER_ARB,
|
|
||||||
WGL_STEREO_ARB,
|
|
||||||
WGL_PIXEL_TYPE_ARB,
|
|
||||||
WGL_COLOR_BITS_ARB,
|
|
||||||
WGL_RED_BITS_ARB,
|
|
||||||
WGL_RED_SHIFT_ARB,
|
|
||||||
WGL_GREEN_BITS_ARB,
|
|
||||||
WGL_GREEN_SHIFT_ARB,
|
|
||||||
WGL_BLUE_BITS_ARB,
|
|
||||||
WGL_BLUE_SHIFT_ARB,
|
|
||||||
WGL_ALPHA_BITS_ARB,
|
|
||||||
WGL_ALPHA_SHIFT_ARB,
|
|
||||||
WGL_ACCUM_BITS_ARB,
|
|
||||||
WGL_ACCUM_RED_BITS_ARB,
|
|
||||||
WGL_ACCUM_GREEN_BITS_ARB,
|
|
||||||
WGL_ACCUM_BLUE_BITS_ARB,
|
|
||||||
WGL_ACCUM_ALPHA_BITS_ARB,
|
|
||||||
WGL_DEPTH_BITS_ARB,
|
|
||||||
WGL_STENCIL_BITS_ARB,
|
|
||||||
WGL_AUX_BUFFERS_ARB
|
|
||||||
#ifdef WGL_ARB_render_texture
|
|
||||||
,WGL_BIND_TO_TEXTURE_RGB_ARB //40
|
|
||||||
,WGL_BIND_TO_TEXTURE_RGBA_ARB
|
|
||||||
#endif
|
|
||||||
#ifdef WGL_ARB_pbuffer
|
|
||||||
,WGL_DRAW_TO_PBUFFER_ARB //42
|
|
||||||
,WGL_MAX_PBUFFER_PIXELS_ARB
|
|
||||||
,WGL_MAX_PBUFFER_WIDTH_ARB
|
|
||||||
,WGL_MAX_PBUFFER_HEIGHT_ARB
|
|
||||||
#endif
|
|
||||||
#ifdef WGL_ARB_framebuffer_sRGB
|
|
||||||
,WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB //46
|
|
||||||
#endif
|
|
||||||
#ifdef WGL_ARB_multisample
|
|
||||||
,WGL_SAMPLES_ARB //47
|
|
||||||
,WGL_SAMPLE_BUFFERS_ARB
|
|
||||||
#endif
|
|
||||||
#ifdef WGL_EXT_depth_float
|
|
||||||
,WGL_DEPTH_FLOAT_EXT //49
|
|
||||||
#endif
|
|
||||||
,0,0,0,0
|
|
||||||
};
|
|
||||||
size_t nums = sizeof(atts)/sizeof(int);
|
|
||||||
const bool depth_float_supported= (wglExtensions.find("WGL_EXT_depth_float") != -1);
|
|
||||||
if (!depth_float_supported)
|
|
||||||
{
|
|
||||||
memmove(&atts[49], &atts[50], (nums-50)*sizeof(int));
|
|
||||||
nums -= 1;
|
|
||||||
}
|
|
||||||
if (!multi_sample_supported)
|
|
||||||
{
|
|
||||||
memmove(&atts[47], &atts[49], (nums-49)*sizeof(int));
|
|
||||||
nums -= 2;
|
|
||||||
}
|
|
||||||
const bool framebuffer_sRGB_supported= (wglExtensions.find("WGL_ARB_framebuffer_sRGB") != -1);
|
|
||||||
if (!framebuffer_sRGB_supported)
|
|
||||||
{
|
|
||||||
memmove(&atts[46], &atts[47], (nums-47)*sizeof(int));
|
|
||||||
nums -= 1;
|
|
||||||
}
|
|
||||||
const bool pbuffer_supported = (wglExtensions.find("WGL_ARB_pbuffer") != -1);
|
|
||||||
if (!pbuffer_supported)
|
|
||||||
{
|
|
||||||
memmove(&atts[42], &atts[46], (nums-46)*sizeof(int));
|
|
||||||
nums -= 4;
|
|
||||||
}
|
|
||||||
const bool render_texture_supported = (wglExtensions.find("WGL_ARB_render_texture") != -1);
|
|
||||||
if (!render_texture_supported)
|
|
||||||
{
|
|
||||||
memmove(&atts[40], &atts[42], (nums-42)*sizeof(int));
|
|
||||||
nums -= 2;
|
|
||||||
}
|
|
||||||
wglGetPixelFormatAttribiv_ARB(hdc,0,0,1,atts,vals);
|
|
||||||
const int count = vals[0];
|
|
||||||
atts[0]=WGL_DRAW_TO_WINDOW_ARB;
|
|
||||||
for (int i=1; i<count; ++i)
|
|
||||||
{
|
|
||||||
memset(vals,0,sizeof(vals));
|
|
||||||
#define tmplog(x,y) os::Printer::log(x, core::stringc(y).c_str())
|
|
||||||
const BOOL res = wglGetPixelFormatAttribiv_ARB(hdc,i,0,(UINT)nums,atts,vals);
|
|
||||||
if (FALSE==res)
|
|
||||||
continue;
|
|
||||||
tmplog("Pixel format ",i);
|
|
||||||
u32 j=0;
|
|
||||||
tmplog("Draw to window " , vals[j]);
|
|
||||||
tmplog("Draw to bitmap " , vals[++j]);
|
|
||||||
++j;
|
|
||||||
tmplog("Acceleration " , (vals[j]==WGL_NO_ACCELERATION_ARB?"No":
|
|
||||||
vals[j]==WGL_GENERIC_ACCELERATION_ARB?"Generic":vals[j]==WGL_FULL_ACCELERATION_ARB?"Full":"ERROR"));
|
|
||||||
tmplog("Need palette " , vals[++j]);
|
|
||||||
tmplog("Need system palette " , vals[++j]);
|
|
||||||
tmplog("Swap layer buffers " , vals[++j]);
|
|
||||||
++j;
|
|
||||||
tmplog("Swap method " , (vals[j]==WGL_SWAP_EXCHANGE_ARB?"Exchange":
|
|
||||||
vals[j]==WGL_SWAP_COPY_ARB?"Copy":vals[j]==WGL_SWAP_UNDEFINED_ARB?"Undefined":"ERROR"));
|
|
||||||
tmplog("Number of overlays " , vals[++j]);
|
|
||||||
tmplog("Number of underlays " , vals[++j]);
|
|
||||||
tmplog("Transparent " , vals[++j]);
|
|
||||||
tmplog("Transparent red value " , vals[++j]);
|
|
||||||
tmplog("Transparent green value " , vals[++j]);
|
|
||||||
tmplog("Transparent blue value " , vals[++j]);
|
|
||||||
tmplog("Transparent alpha value " , vals[++j]);
|
|
||||||
tmplog("Transparent index value " , vals[++j]);
|
|
||||||
tmplog("Share depth " , vals[++j]);
|
|
||||||
tmplog("Share stencil " , vals[++j]);
|
|
||||||
tmplog("Share accum " , vals[++j]);
|
|
||||||
tmplog("Support GDI " , vals[++j]);
|
|
||||||
tmplog("Support OpenGL " , vals[++j]);
|
|
||||||
tmplog("Double Buffer " , vals[++j]);
|
|
||||||
tmplog("Stereo Buffer " , vals[++j]);
|
|
||||||
tmplog("Pixel type " , vals[++j]);
|
|
||||||
tmplog("Color bits" , vals[++j]);
|
|
||||||
tmplog("Red bits " , vals[++j]);
|
|
||||||
tmplog("Red shift " , vals[++j]);
|
|
||||||
tmplog("Green bits " , vals[++j]);
|
|
||||||
tmplog("Green shift " , vals[++j]);
|
|
||||||
tmplog("Blue bits " , vals[++j]);
|
|
||||||
tmplog("Blue shift " , vals[++j]);
|
|
||||||
tmplog("Alpha bits " , vals[++j]);
|
|
||||||
tmplog("Alpha Shift " , vals[++j]);
|
|
||||||
tmplog("Accum bits " , vals[++j]);
|
|
||||||
tmplog("Accum red bits " , vals[++j]);
|
|
||||||
tmplog("Accum green bits " , vals[++j]);
|
|
||||||
tmplog("Accum blue bits " , vals[++j]);
|
|
||||||
tmplog("Accum alpha bits " , vals[++j]);
|
|
||||||
tmplog("Depth bits " , vals[++j]);
|
|
||||||
tmplog("Stencil bits " , vals[++j]);
|
|
||||||
tmplog("Aux buffers " , vals[++j]);
|
|
||||||
if (render_texture_supported)
|
|
||||||
{
|
|
||||||
tmplog("Bind to texture RGB" , vals[++j]);
|
|
||||||
tmplog("Bind to texture RGBA" , vals[++j]);
|
|
||||||
}
|
|
||||||
if (pbuffer_supported)
|
|
||||||
{
|
|
||||||
tmplog("Draw to pbuffer" , vals[++j]);
|
|
||||||
tmplog("Max pbuffer pixels " , vals[++j]);
|
|
||||||
tmplog("Max pbuffer width" , vals[++j]);
|
|
||||||
tmplog("Max pbuffer height" , vals[++j]);
|
|
||||||
}
|
|
||||||
if (framebuffer_sRGB_supported)
|
|
||||||
tmplog("Framebuffer sRBG capable" , vals[++j]);
|
|
||||||
if (multi_sample_supported)
|
|
||||||
{
|
|
||||||
tmplog("Samples " , vals[++j]);
|
|
||||||
tmplog("Sample buffers " , vals[++j]);
|
|
||||||
}
|
|
||||||
if (depth_float_supported)
|
|
||||||
tmplog("Depth float" , vals[++j]);
|
|
||||||
#undef tmplog
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#elif defined(IRR_LINUX_DEVICE)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|
||||||
{
|
{
|
||||||
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
|
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
|
||||||
Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f));
|
Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f));
|
||||||
@ -393,37 +178,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||||||
IsAtiRadeonX = (strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0);
|
IsAtiRadeonX = (strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
#define IRR_OGL_LOAD_EXTENSION(x) cmgr->getProcAddress(x)
|
||||||
#ifdef _IRR_WINDOWS_API_
|
|
||||||
#define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast<const char*>(x))
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
|
||||||
#define IRR_OGL_LOAD_EXTENSION(x) SDL_GL_GetProcAddress(reinterpret_cast<const char*>(x))
|
|
||||||
#else
|
|
||||||
// Accessing the correct function is quite complex
|
|
||||||
// All libraries should support the ARB version, however
|
|
||||||
// since GLX 1.4 the non-ARB version is the official one
|
|
||||||
// So we have to check the runtime environment and
|
|
||||||
// choose the proper symbol
|
|
||||||
// In case you still have problems please enable the
|
|
||||||
// next line by uncommenting it
|
|
||||||
// #define _IRR_GETPROCADDRESS_WORKAROUND_
|
|
||||||
|
|
||||||
#ifndef _IRR_GETPROCADDRESS_WORKAROUND_
|
|
||||||
__GLXextFuncPtr (*IRR_OGL_LOAD_EXTENSION_FUNCP)(const GLubyte*)=0;
|
|
||||||
#ifdef GLX_VERSION_1_4
|
|
||||||
int major=0,minor=0;
|
|
||||||
if (glXGetCurrentDisplay())
|
|
||||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
|
||||||
if ((major>1) || (minor>3))
|
|
||||||
IRR_OGL_LOAD_EXTENSION_FUNCP=glXGetProcAddress;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
IRR_OGL_LOAD_EXTENSION_FUNCP=glXGetProcAddressARB;
|
|
||||||
#define IRR_OGL_LOAD_EXTENSION(X) IRR_OGL_LOAD_EXTENSION_FUNCP(reinterpret_cast<const GLubyte*>(X))
|
|
||||||
#else
|
|
||||||
#define IRR_OGL_LOAD_EXTENSION(X) glXGetProcAddressARB(reinterpret_cast<const GLubyte*>(X))
|
|
||||||
#endif // workaround
|
|
||||||
#endif // Windows, SDL, or Linux
|
|
||||||
|
|
||||||
// get multitexturing function pointers
|
// get multitexturing function pointers
|
||||||
pGlActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) IRR_OGL_LOAD_EXTENSION("glActiveTextureARB");
|
pGlActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) IRR_OGL_LOAD_EXTENSION("glActiveTextureARB");
|
||||||
@ -626,7 +381,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||||||
#if defined(GLX_MESA_swap_control) && !defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
#if defined(GLX_MESA_swap_control) && !defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
pGlxSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)IRR_OGL_LOAD_EXTENSION("glXSwapIntervalMESA");
|
pGlxSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)IRR_OGL_LOAD_EXTENSION("glXSwapIntervalMESA");
|
||||||
#endif
|
#endif
|
||||||
#endif // use extension pointer
|
|
||||||
|
|
||||||
GLint num=0;
|
GLint num=0;
|
||||||
// set some properties
|
// set some properties
|
||||||
@ -747,14 +501,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
|
|
||||||
if (!pGlActiveTextureARB || !pGlClientActiveTextureARB)
|
if (!pGlActiveTextureARB || !pGlClientActiveTextureARB)
|
||||||
{
|
{
|
||||||
Feature.MaxTextureUnits = 1;
|
Feature.MaxTextureUnits = 1;
|
||||||
os::Printer::log("Failed to load OpenGL's multitexture extension, proceeding without.", ELL_WARNING);
|
os::Printer::log("Failed to load OpenGL's multitexture extension, proceeding without.", ELL_WARNING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
Feature.MaxTextureUnits = core::min_(Feature.MaxTextureUnits, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||||
|
|
||||||
#ifdef GL_ARB_occlusion_query
|
#ifdef GL_ARB_occlusion_query
|
||||||
@ -882,8 +634,6 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
|||||||
return (Version>=104) || FeatureAvailable[IRR_EXT_blend_func_separate];
|
return (Version>=104) || FeatureAvailable[IRR_EXT_blend_func_separate];
|
||||||
case EVDF_TEXTURE_MATRIX:
|
case EVDF_TEXTURE_MATRIX:
|
||||||
return true;
|
return true;
|
||||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
|
||||||
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
|
|
||||||
case EVDF_TEXTURE_CUBEMAP:
|
case EVDF_TEXTURE_CUBEMAP:
|
||||||
return (Version >= 103) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
|
return (Version >= 103) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
|
||||||
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
|
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -571,16 +571,6 @@ s32 COpenGLSLMaterialRenderer::getPixelShaderConstantID(const c8* name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpenGLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void COpenGLSLMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
|
|
||||||
{
|
|
||||||
os::Printer::log("Cannot set constant, use high level shader call.", ELL_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool COpenGLSLMaterialRenderer::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
bool COpenGLSLMaterialRenderer::setVertexShaderConstant(s32 index, const f32* floats, int count)
|
||||||
{
|
{
|
||||||
return setPixelShaderConstant(index, floats, count);
|
return setPixelShaderConstant(index, floats, count);
|
||||||
|
@ -72,8 +72,6 @@ public:
|
|||||||
void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
|
void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) override;
|
||||||
s32 getVertexShaderConstantID(const c8* name) override;
|
s32 getVertexShaderConstantID(const c8* name) override;
|
||||||
s32 getPixelShaderConstantID(const c8* name) override;
|
s32 getPixelShaderConstantID(const c8* name) override;
|
||||||
void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) override;
|
|
||||||
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
bool setVertexShaderConstant(s32 index, const f32* floats, int count) override;
|
||||||
bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
|
bool setVertexShaderConstant(s32 index, const s32* ints, int count) override;
|
||||||
bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
|
bool setVertexShaderConstant(s32 index, const u32* ints, int count) override;
|
||||||
|
@ -1,403 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#include "COpenGLShaderMaterialRenderer.h"
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
|
||||||
|
|
||||||
#include "IGPUProgrammingServices.h"
|
|
||||||
#include "IShaderConstantSetCallBack.h"
|
|
||||||
#include "IVideoDriver.h"
|
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
#include "COpenGLDriver.h"
|
|
||||||
#include "COpenGLCacheHandler.h"
|
|
||||||
#include "COpenGLMaterialRenderer.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//! Constructor
|
|
||||||
COpenGLShaderMaterialRenderer::COpenGLShaderMaterialRenderer(video::COpenGLDriver* driver,
|
|
||||||
s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData)
|
|
||||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), AlphaTest(false),
|
|
||||||
VertexShader(0), UserData(userData)
|
|
||||||
{
|
|
||||||
#ifdef _DEBUG
|
|
||||||
setDebugName("COpenGLShaderMaterialRenderer");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PixelShader.set_used(4);
|
|
||||||
for (u32 i=0; i<4; ++i)
|
|
||||||
{
|
|
||||||
PixelShader[i]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (baseMaterial)
|
|
||||||
{
|
|
||||||
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
|
||||||
Alpha = true;
|
|
||||||
break;
|
|
||||||
case EMT_ONETEXTURE_BLEND:
|
|
||||||
Blending = true;
|
|
||||||
break;
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
|
||||||
AlphaTest = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->grab();
|
|
||||||
|
|
||||||
init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, EVT_STANDARD);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! constructor only for use by derived classes who want to
|
|
||||||
//! create a fall back material for example.
|
|
||||||
COpenGLShaderMaterialRenderer::COpenGLShaderMaterialRenderer(COpenGLDriver* driver,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
|
||||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), AlphaTest(false),
|
|
||||||
VertexShader(0), UserData(userData)
|
|
||||||
{
|
|
||||||
PixelShader.set_used(4);
|
|
||||||
for (u32 i=0; i<4; ++i)
|
|
||||||
{
|
|
||||||
PixelShader[i]=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (baseMaterial)
|
|
||||||
{
|
|
||||||
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
|
||||||
Alpha = true;
|
|
||||||
break;
|
|
||||||
case EMT_ONETEXTURE_BLEND:
|
|
||||||
Blending = true;
|
|
||||||
break;
|
|
||||||
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
|
||||||
AlphaTest = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->grab();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Destructor
|
|
||||||
COpenGLShaderMaterialRenderer::~COpenGLShaderMaterialRenderer()
|
|
||||||
{
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->drop();
|
|
||||||
|
|
||||||
if (VertexShader)
|
|
||||||
Driver->extGlDeletePrograms(1, &VertexShader);
|
|
||||||
|
|
||||||
for (u32 i=0; i<PixelShader.size(); ++i)
|
|
||||||
if (PixelShader[i])
|
|
||||||
Driver->extGlDeletePrograms(1, &PixelShader[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COpenGLShaderMaterialRenderer::init(s32& outMaterialTypeNr,
|
|
||||||
const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
E_VERTEX_TYPE type)
|
|
||||||
{
|
|
||||||
outMaterialTypeNr = -1;
|
|
||||||
|
|
||||||
bool success;
|
|
||||||
|
|
||||||
// create vertex shader
|
|
||||||
success=createVertexShader(vertexShaderProgram);
|
|
||||||
|
|
||||||
// create pixel shader
|
|
||||||
if (!createPixelShader(pixelShaderProgram) || !success)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// register as a new material
|
|
||||||
outMaterialTypeNr = Driver->addMaterialRenderer(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COpenGLShaderMaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
|
||||||
{
|
|
||||||
// call callback to set shader constants
|
|
||||||
if (CallBack && (VertexShader || PixelShader[0]))
|
|
||||||
CallBack->OnSetConstants(service, UserData);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COpenGLShaderMaterialRenderer::OnSetMaterial(const video::SMaterial& material, const video::SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates, video::IMaterialRendererServices* services)
|
|
||||||
{
|
|
||||||
if (Driver->getFixedPipelineState() == COpenGLDriver::EOFPS_ENABLE)
|
|
||||||
Driver->setFixedPipelineState(COpenGLDriver::EOFPS_ENABLE_TO_DISABLE);
|
|
||||||
else
|
|
||||||
Driver->setFixedPipelineState(COpenGLDriver::EOFPS_DISABLE);
|
|
||||||
|
|
||||||
COpenGLCacheHandler* cacheHandler = Driver->getCacheHandler();
|
|
||||||
|
|
||||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
|
||||||
{
|
|
||||||
if (VertexShader)
|
|
||||||
{
|
|
||||||
// set new vertex shader
|
|
||||||
#ifdef GL_ARB_vertex_program
|
|
||||||
Driver->extGlBindProgram(GL_VERTEX_PROGRAM_ARB, VertexShader);
|
|
||||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
|
||||||
#elif defined(GL_NV_vertex_program)
|
|
||||||
Driver->extGlBindProgram(GL_VERTEX_PROGRAM_NV, VertexShader);
|
|
||||||
glEnable(GL_VERTEX_PROGRAM_NV);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// set new pixel shader
|
|
||||||
if (PixelShader[0])
|
|
||||||
{
|
|
||||||
GLuint nextShader=PixelShader[0];
|
|
||||||
if (material.FogEnable)
|
|
||||||
{
|
|
||||||
GLint curFogMode;
|
|
||||||
glGetIntegerv(GL_FOG_MODE, &curFogMode);
|
|
||||||
// if (Driver->LinearFog && PixelShader[1])
|
|
||||||
if (curFogMode==GL_LINEAR && PixelShader[1])
|
|
||||||
nextShader=PixelShader[1];
|
|
||||||
// else if (!Driver->LinearFog && PixelShader[2])
|
|
||||||
else if (curFogMode==GL_EXP && PixelShader[2])
|
|
||||||
nextShader=PixelShader[2];
|
|
||||||
else if (curFogMode==GL_EXP2 && PixelShader[3])
|
|
||||||
nextShader=PixelShader[3];
|
|
||||||
}
|
|
||||||
#ifdef GL_ARB_fragment_program
|
|
||||||
Driver->extGlBindProgram(GL_FRAGMENT_PROGRAM_ARB, nextShader);
|
|
||||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
|
||||||
#elif defined(GL_NV_fragment_program)
|
|
||||||
Driver->extGlBindProgram(GL_FRAGMENT_PROGRAM_NV, nextShader);
|
|
||||||
glEnable(GL_FRAGMENT_PROGRAM_NV);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
|
||||||
|
|
||||||
if (Alpha)
|
|
||||||
{
|
|
||||||
cacheHandler->setBlend(true);
|
|
||||||
cacheHandler->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
}
|
|
||||||
else if (Blending)
|
|
||||||
{
|
|
||||||
E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact;
|
|
||||||
E_MODULATE_FUNC modulate;
|
|
||||||
u32 alphaSource;
|
|
||||||
unpack_textureBlendFuncSeparate(srcRGBFact, dstRGBFact, srcAlphaFact, dstAlphaFact, modulate, alphaSource, material.MaterialTypeParam);
|
|
||||||
|
|
||||||
if (Driver->queryFeature(EVDF_BLEND_SEPARATE))
|
|
||||||
{
|
|
||||||
cacheHandler->setBlendFuncSeparate(Driver->getGLBlend(srcRGBFact), Driver->getGLBlend(dstRGBFact),
|
|
||||||
Driver->getGLBlend(srcAlphaFact), Driver->getGLBlend(dstAlphaFact));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cacheHandler->setBlendFunc(Driver->getGLBlend(srcRGBFact), Driver->getGLBlend(dstRGBFact));
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheHandler->setBlend(true);
|
|
||||||
}
|
|
||||||
else if (AlphaTest)
|
|
||||||
{
|
|
||||||
cacheHandler->setAlphaTest(true);
|
|
||||||
cacheHandler->setAlphaFunc(GL_GREATER, 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CallBack)
|
|
||||||
CallBack->OnSetMaterial(material);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void COpenGLShaderMaterialRenderer::OnUnsetMaterial()
|
|
||||||
{
|
|
||||||
// disable vertex shader
|
|
||||||
#ifdef GL_ARB_vertex_program
|
|
||||||
if (VertexShader)
|
|
||||||
glDisable(GL_VERTEX_PROGRAM_ARB);
|
|
||||||
#elif defined(GL_NV_vertex_program)
|
|
||||||
if (VertexShader)
|
|
||||||
glDisable(GL_VERTEX_PROGRAM_NV);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GL_ARB_fragment_program
|
|
||||||
if (PixelShader[0])
|
|
||||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
|
||||||
#elif defined(GL_NV_fragment_program)
|
|
||||||
if (PixelShader[0])
|
|
||||||
glDisable(GL_FRAGMENT_PROGRAM_NV);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
COpenGLCacheHandler* cacheHandler = Driver->getCacheHandler();
|
|
||||||
if (Alpha || Blending)
|
|
||||||
{
|
|
||||||
cacheHandler->setBlend(false);
|
|
||||||
}
|
|
||||||
else if (AlphaTest)
|
|
||||||
{
|
|
||||||
cacheHandler->setAlphaTest(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! Returns if the material is transparent.
|
|
||||||
bool COpenGLShaderMaterialRenderer::isTransparent() const
|
|
||||||
{
|
|
||||||
return (Alpha || Blending);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This method needs a properly cleaned error state before the checked instruction is called
|
|
||||||
bool COpenGLShaderMaterialRenderer::checkError(const irr::c8* type)
|
|
||||||
{
|
|
||||||
#if defined(GL_ARB_vertex_program) || defined(GL_NV_vertex_program) || defined(GL_ARB_fragment_program) || defined(GL_NV_fragment_program)
|
|
||||||
GLenum g = glGetError();
|
|
||||||
if (g == GL_NO_ERROR)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
core::stringc errString = type;
|
|
||||||
errString += " compilation failed";
|
|
||||||
|
|
||||||
errString += " at position ";
|
|
||||||
GLint errPos=-1;
|
|
||||||
#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program)
|
|
||||||
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &errPos );
|
|
||||||
#else
|
|
||||||
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_NV, &errPos );
|
|
||||||
#endif
|
|
||||||
errString += core::stringc(s32(errPos));
|
|
||||||
errString += ":\n";
|
|
||||||
#if defined(GL_ARB_vertex_program) || defined(GL_ARB_fragment_program)
|
|
||||||
errString += reinterpret_cast<const char*>(glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
|
||||||
#else
|
|
||||||
errString += reinterpret_cast<const char*>(glGetString(GL_PROGRAM_ERROR_STRING_NV));
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
core::stringc errString("Shaders not supported.");
|
|
||||||
#endif
|
|
||||||
os::Printer::log(errString.c_str(), ELL_ERROR);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COpenGLShaderMaterialRenderer::createPixelShader(const c8* pxsh)
|
|
||||||
{
|
|
||||||
if (!pxsh)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
const core::stringc inshdr(pxsh);
|
|
||||||
core::stringc shdr;
|
|
||||||
const s32 pos = inshdr.find("#_IRR_FOG_MODE_");
|
|
||||||
const u32 numShaders = (-1 != pos)?4:1;
|
|
||||||
|
|
||||||
for (u32 i=0; i<numShaders; ++i)
|
|
||||||
{
|
|
||||||
if (i==0)
|
|
||||||
{
|
|
||||||
shdr=inshdr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shdr = inshdr.subString(0, pos);
|
|
||||||
switch (i) {
|
|
||||||
case 1: shdr += "OPTION ARB_fog_linear;"; break;
|
|
||||||
case 2: shdr += "OPTION ARB_fog_exp;"; break;
|
|
||||||
case 3: shdr += "OPTION ARB_fog_exp2;"; break;
|
|
||||||
}
|
|
||||||
shdr += inshdr.subString(pos+16, inshdr.size()-pos-16);
|
|
||||||
}
|
|
||||||
Driver->extGlGenPrograms(1, &PixelShader[i]);
|
|
||||||
#ifdef GL_ARB_fragment_program
|
|
||||||
Driver->extGlBindProgram(GL_FRAGMENT_PROGRAM_ARB, PixelShader[i]);
|
|
||||||
#elif defined GL_NV_fragment_program
|
|
||||||
Driver->extGlBindProgram(GL_FRAGMENT_PROGRAM_NV, PixelShader[i]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear error buffer
|
|
||||||
while(glGetError() != GL_NO_ERROR)
|
|
||||||
{}
|
|
||||||
|
|
||||||
#ifdef GL_ARB_fragment_program
|
|
||||||
// compile
|
|
||||||
Driver->extGlProgramString(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
|
||||||
shdr.size(), shdr.c_str());
|
|
||||||
#elif defined GL_NV_fragment_program
|
|
||||||
Driver->extGlLoadProgram(GL_FRAGMENT_PROGRAM_NV, PixelShader[i],
|
|
||||||
shdr.size(), shdr.c_str());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (checkError("Pixel shader"))
|
|
||||||
{
|
|
||||||
Driver->extGlDeletePrograms(1, &PixelShader[i]);
|
|
||||||
PixelShader[i]=0;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool COpenGLShaderMaterialRenderer::createVertexShader(const c8* vtxsh)
|
|
||||||
{
|
|
||||||
if (!vtxsh)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
Driver->extGlGenPrograms(1, &VertexShader);
|
|
||||||
#ifdef GL_ARB_vertex_program
|
|
||||||
Driver->extGlBindProgram(GL_VERTEX_PROGRAM_ARB, VertexShader);
|
|
||||||
#elif defined GL_NV_vertex_program
|
|
||||||
Driver->extGlBindProgram(GL_VERTEX_PROGRAM_NV, VertexShader);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear error buffer
|
|
||||||
while(glGetError() != GL_NO_ERROR)
|
|
||||||
{}
|
|
||||||
|
|
||||||
// compile
|
|
||||||
#ifdef GL_ARB_vertex_program
|
|
||||||
Driver->extGlProgramString(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
|
||||||
(GLsizei)strlen(vtxsh), vtxsh);
|
|
||||||
#elif defined GL_NV_vertex_program
|
|
||||||
Driver->extGlLoadProgram(GL_VERTEX_PROGRAM_NV, VertexShader,
|
|
||||||
(GLsizei)strlen(vtxsh), vtxsh);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (checkError("Vertex shader"))
|
|
||||||
{
|
|
||||||
Driver->extGlDeletePrograms(1, &VertexShader);
|
|
||||||
VertexShader=0;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace video
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
|||||||
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
||||||
// This file is part of the "Irrlicht Engine".
|
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
|
||||||
|
|
||||||
#include "IMaterialRenderer.h"
|
|
||||||
|
|
||||||
#include "COpenGLCommon.h"
|
|
||||||
|
|
||||||
namespace irr
|
|
||||||
{
|
|
||||||
namespace video
|
|
||||||
{
|
|
||||||
|
|
||||||
class COpenGLDriver;
|
|
||||||
class IShaderConstantSetCallBack;
|
|
||||||
|
|
||||||
//! Class for using vertex and pixel shaders with OpenGL (asm not glsl!)
|
|
||||||
class COpenGLShaderMaterialRenderer : public IMaterialRenderer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Constructor
|
|
||||||
COpenGLShaderMaterialRenderer(COpenGLDriver* driver,
|
|
||||||
s32& outMaterialTypeNr, const c8* vertexShaderProgram, const c8* pixelShaderProgram,
|
|
||||||
IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData);
|
|
||||||
|
|
||||||
//! Destructor
|
|
||||||
virtual ~COpenGLShaderMaterialRenderer();
|
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
|
||||||
bool resetAllRenderstates, IMaterialRendererServices* services) override;
|
|
||||||
|
|
||||||
bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) override;
|
|
||||||
|
|
||||||
void OnUnsetMaterial() override;
|
|
||||||
|
|
||||||
//! Returns if the material is transparent.
|
|
||||||
bool isTransparent() const override;
|
|
||||||
|
|
||||||
//! Access the callback provided by the users when creating shader materials
|
|
||||||
IShaderConstantSetCallBack* getShaderConstantSetCallBack() const override
|
|
||||||
{
|
|
||||||
return CallBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//! constructor only for use by derived classes who want to
|
|
||||||
//! create a fall back material for example.
|
|
||||||
COpenGLShaderMaterialRenderer(COpenGLDriver* driver,
|
|
||||||
IShaderConstantSetCallBack* callback,
|
|
||||||
E_MATERIAL_TYPE baseMaterial, s32 userData=0);
|
|
||||||
|
|
||||||
// must not be called more than once!
|
|
||||||
void init(s32& outMaterialTypeNr, const c8* vertexShaderProgram,
|
|
||||||
const c8* pixelShaderProgram, E_VERTEX_TYPE type);
|
|
||||||
|
|
||||||
bool createPixelShader(const c8* pxsh);
|
|
||||||
bool createVertexShader(const c8* vtxsh);
|
|
||||||
bool checkError(const irr::c8* type);
|
|
||||||
|
|
||||||
COpenGLDriver* Driver;
|
|
||||||
IShaderConstantSetCallBack* CallBack;
|
|
||||||
|
|
||||||
// I didn't write this, but here's my understanding:
|
|
||||||
// Those flags seem to be exclusive so far (so could be an enum).
|
|
||||||
// Maybe the idea was to make them non-exclusive in future (basically having a shader-material)
|
|
||||||
// Actually currently there's not even any need to cache them (probably even slower than not doing so).
|
|
||||||
// They seem to be mostly for downward compatibility.
|
|
||||||
// I suppose the idea is to use SMaterial.BlendOperation + SMaterial.BlendFactor and a simple non-transparent type as base for more flexibility in the future.
|
|
||||||
// Note that SMaterial.BlendOperation + SMaterial.BlendFactor are in some drivers already evaluated before OnSetMaterial.
|
|
||||||
bool Alpha;
|
|
||||||
bool Blending;
|
|
||||||
bool AlphaTest;
|
|
||||||
|
|
||||||
GLuint VertexShader;
|
|
||||||
// We have 4 values here, [0] is the non-fog version, the other three are
|
|
||||||
// ARB_fog_linear, ARB_fog_exp, and ARB_fog_exp2 in that order
|
|
||||||
core::array<GLuint> PixelShader;
|
|
||||||
s32 UserData;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace video
|
|
||||||
} // end namespace irr
|
|
||||||
|
|
||||||
#endif
|
|
@ -697,7 +697,8 @@ ISceneNode* CSceneManager::getSceneNodeFromName(const char* name, ISceneNode* st
|
|||||||
if (start == 0)
|
if (start == 0)
|
||||||
start = getRootSceneNode();
|
start = getRootSceneNode();
|
||||||
|
|
||||||
if (!strcmp(start->getName(),name))
|
auto startName = start->getName();
|
||||||
|
if (startName.has_value() && startName == name)
|
||||||
return start;
|
return start;
|
||||||
|
|
||||||
ISceneNode* node = 0;
|
ISceneNode* node = 0;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||||
|
|
||||||
#include "CSkinnedMesh.h"
|
#include "CSkinnedMesh.h"
|
||||||
|
#include <optional>
|
||||||
#include "CBoneSceneNode.h"
|
#include "CBoneSceneNode.h"
|
||||||
#include "IAnimatedMeshSceneNode.h"
|
#include "IAnimatedMeshSceneNode.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@ -624,18 +625,18 @@ u32 CSkinnedMesh::getJointCount() const
|
|||||||
return AllJoints.size();
|
return AllJoints.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Gets the name of a joint.
|
//! Gets the name of a joint.
|
||||||
const c8* CSkinnedMesh::getJointName(u32 number) const
|
const std::optional<std::string> &CSkinnedMesh::getJointName(u32 number) const {
|
||||||
{
|
if (number >= getJointCount()) {
|
||||||
if (number >= AllJoints.size())
|
static const std::optional<std::string> nullopt;
|
||||||
return 0;
|
return nullopt;
|
||||||
return AllJoints[number]->Name.c_str();
|
}
|
||||||
|
return AllJoints[number]->Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Gets a joint number from its name
|
//! Gets a joint number from its name
|
||||||
s32 CSkinnedMesh::getJointNumber(const c8* name) const
|
std::optional<u32> CSkinnedMesh::getJointNumber(const std::string &name) const
|
||||||
{
|
{
|
||||||
for (u32 i=0; i<AllJoints.size(); ++i)
|
for (u32 i=0; i<AllJoints.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -643,7 +644,7 @@ s32 CSkinnedMesh::getJointNumber(const c8* name) const
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1396,7 +1397,7 @@ void CSkinnedMesh::addJoints(core::array<IBoneSceneNode*> &jointChildSceneNodes,
|
|||||||
//Create new joints
|
//Create new joints
|
||||||
for (u32 i=0; i<AllJoints.size(); ++i)
|
for (u32 i=0; i<AllJoints.size(); ++i)
|
||||||
{
|
{
|
||||||
jointChildSceneNodes.push_back(new CBoneSceneNode(0, smgr, 0, i, AllJoints[i]->Name.c_str()));
|
jointChildSceneNodes.push_back(new CBoneSceneNode(0, smgr, 0, i, AllJoints[i]->Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Match up parents
|
//Match up parents
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user