Merge OpenGL ES renderer branch
It adds support for OpenGL ES renderer, which is needed for Android port and for running STK on other embedded devices such as Raspberry Pi. Currently it works in two ways: - Shader-based pipeline, which requires OpenGL ES 3.0 (Android >= 4.3) - Fallback to irrlicht-based fixed pipeline that needs OpenGL ES 2.0. The fixed pipeline generally works, but it is affected by the same issues as our OpenGL 2.1 fixed pipeline renderer. I tried to modify our OpenGL renderer as little as possible to avoid regressions. The only one major change is that we are now using the "#stk_include" directive in shaders instead of linking multiple shaders into one program. Currently it works only on linux. The Android port needs some refactoring. In theory it should be possible to make it working on Windows, but we would need some OpenGL ES SDK, or maybe modified libglew. At this stage it is playable with current mesa drivers. I tested it on intel graphics card and I didn't notice any issues. On Android only the OpenGL ES 2.0 renderer with fixed pipeline has been tested for now.
This commit is contained in:
commit
93fc20e275
@ -20,6 +20,10 @@ option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
|
||||
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
|
||||
option(ENABLE_NETWORK_MULTIPLAYER "Enable network multiplayer. This will replace the online profile GUI in the main menu with the network multiplayer GUI" OFF)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
option(USE_GLES2 "Use OpenGL ES2 renderer" OFF)
|
||||
endif()
|
||||
|
||||
if(MSVC AND (MSVC_VERSION LESS 1900))
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
# on the installation of the Windows DDK (Driver Developer Kit),
|
||||
@ -60,6 +64,10 @@ if(WIN32)
|
||||
add_definitions(-D_IRR_STATIC_LIB_)
|
||||
endif()
|
||||
|
||||
if(USE_GLES2)
|
||||
add_definitions(-DUSE_GLES2)
|
||||
endif()
|
||||
|
||||
# Build the Bullet physics library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
|
||||
@ -69,9 +77,11 @@ add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
|
||||
|
||||
# Build glew library
|
||||
add_definitions(-DGLEW_NO_GLU)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
|
||||
if(NOT USE_GLES2)
|
||||
add_definitions(-DGLEW_NO_GLU)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
|
||||
endif()
|
||||
|
||||
if((WIN32 AND NOT MINGW) OR APPLE)
|
||||
if (NOT APPLE)
|
||||
@ -196,8 +206,10 @@ if (OPENMP_FOUND)
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
if(NOT USE_GLES2)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
@ -355,16 +367,20 @@ target_link_libraries(supertuxkart
|
||||
bulletcollision
|
||||
bulletmath
|
||||
enet
|
||||
glew
|
||||
stkirrlicht
|
||||
${Angelscript_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
${OGGVORBIS_LIBRARIES}
|
||||
${OPENAL_LIBRARY}
|
||||
${OPENGL_LIBRARIES}
|
||||
${FREETYPE_LIBRARIES}
|
||||
)
|
||||
|
||||
if(NOT USE_GLES2)
|
||||
target_link_libraries(supertuxkart ${OPENGL_LIBRARIES} glew)
|
||||
else()
|
||||
target_link_libraries(supertuxkart EGL GLESv2)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(supertuxkart ${X11_LIBRARIES})
|
||||
if(USE_XRANDR)
|
||||
|
@ -4,10 +4,10 @@ uniform sampler2D dtex;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 DiffuseIBL(vec3 normal);
|
||||
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/DiffuseIBL.frag"
|
||||
#stk_include "utils/SpecularIBL.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ layout (std430) buffer BoundingBoxes
|
||||
CascadeBoundingBox BB[4];
|
||||
};
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
shared int xmin[4];
|
||||
shared int xmax[4];
|
||||
|
@ -3,12 +3,13 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D depth;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float sigma = 5.;
|
||||
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
@ -23,11 +24,11 @@ void main()
|
||||
g1 *= g2;
|
||||
float tmp_weight, total_weight = g0;
|
||||
for (int i = 1; i < 9; i++) {
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X - i * pixel.x, Y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X - i * pixel.x, Y)) * g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X - float(i) * pixel.x, Y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X - float(i) * pixel.x, Y)) * g0 * tmp_weight;
|
||||
total_weight += g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X + i * pixel.x, Y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X + i * pixel.x, Y)) * g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X + float(i) * pixel.x, Y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X + float(i) * pixel.x, Y)) * g0 * tmp_weight;
|
||||
total_weight += g0 * tmp_weight;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
|
@ -3,12 +3,13 @@
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D depth;
|
||||
uniform vec2 pixel;
|
||||
uniform float sigma = 5.;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float sigma = 5.;
|
||||
|
||||
vec2 uv = gl_FragCoord.xy * pixel;
|
||||
float X = uv.x;
|
||||
float Y = uv.y;
|
||||
@ -23,11 +24,11 @@ void main()
|
||||
g1 *= g2;
|
||||
float tmp_weight, total_weight = g0;
|
||||
for (int i = 1; i < 9; i++) {
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y - i * pixel.y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X, Y - i * pixel.y)) * g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y - float(i) * pixel.y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X, Y - float(i) * pixel.y)) * g0 * tmp_weight;
|
||||
total_weight += g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y + i * pixel.y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X, Y + i * pixel.y)) * g0 * tmp_weight;
|
||||
tmp_weight = max(0.0, 1.0 - .001 * abs(texture(depth, vec2(X, Y + float(i) * pixel.y)).x - pixel_depth));
|
||||
sum += texture(tex, vec2(X, Y + float(i) * pixel.y)) * g0 * tmp_weight;
|
||||
total_weight += g0 * tmp_weight;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
|
@ -2,17 +2,17 @@ uniform sampler2D tex;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
vec3 getRGBFromCIEXxy(vec3 YxyColor);
|
||||
#stk_include "utils/getCIEXYZ.frag"
|
||||
#stk_include "utils/getRGBfromCIEXxy.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / 512;
|
||||
vec2 uv = gl_FragCoord.xy / 512.;
|
||||
vec3 col = texture(tex, uv).xyz;
|
||||
vec3 Yxy = getCIEYxy(col);
|
||||
vec3 WhiteYxy = getCIEYxy(vec3(1.));
|
||||
|
||||
Yxy.x = smoothstep(WhiteYxy.x, WhiteYxy.x * 4, Yxy.x);
|
||||
Yxy.x = smoothstep(WhiteYxy.x, WhiteYxy.x * 4., Yxy.x);
|
||||
|
||||
FragColor = vec4(max(vec3(0.), getRGBFromCIEXxy(Yxy)), 1.0);
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ uniform sampler2D ntex;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 DiffuseIBL(vec3 normal);
|
||||
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/DiffuseIBL.frag"
|
||||
#stk_include "utils/SpecularIBL.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float curdepth = texture(dtex, uv).x;
|
||||
vec4 FragPos = InverseProjectionMatrix * (2.0f * vec4(uv, curdepth, 1.0f) - 1.0f);
|
||||
vec4 FragPos = InverseProjectionMatrix * (2.0 * vec4(uv, curdepth, 1.0) - 1.0);
|
||||
FragPos /= FragPos.w;
|
||||
|
||||
float depth = FragPos.z;
|
||||
@ -70,7 +70,7 @@ void main()
|
||||
col = vec4(col.rgb / 41.0, col.a);
|
||||
depth = clamp(max(1.1666 - (FragPos.z/240.0), FragPos.z - 2000.0), 0., 1.);
|
||||
|
||||
vec3 final = colOriginal.rgb * depth + col.rgb * (1 - depth);
|
||||
vec3 final = colOriginal.rgb * depth + col.rgb * (1. - depth);
|
||||
|
||||
FragColor = vec4(final, colOriginal.a);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ uniform vec3 col;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -20,8 +20,8 @@ void main()
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 6; i++) {
|
||||
sum += texture(tex, vec2(X - i * pixel.x, Y)) * g0;
|
||||
sum += texture(tex, vec2(X + i * pixel.x, Y)) * g0;
|
||||
sum += texture(tex, vec2(X - float(i) * pixel.x, Y)) * g0;
|
||||
sum += texture(tex, vec2(X + float(i) * pixel.x, Y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ void main()
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
for (int i = 1; i < 6; i++) {
|
||||
sum += texture(tex, vec2(X, Y - i * pixel.y)) * g0;
|
||||
sum += texture(tex, vec2(X, Y + i * pixel.y)) * g0;
|
||||
sum += texture(tex, vec2(X, Y - float(i) * pixel.y)) * g0;
|
||||
sum += texture(tex, vec2(X, Y + float(i) * pixel.y)) * g0;
|
||||
g0 *= g1;
|
||||
g1 *= g2;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ uniform mat4 RHMatrix;
|
||||
uniform mat4 InvRHMatrix;
|
||||
|
||||
vec4 SHBasis (const in vec3 dir)
|
||||
{
|
||||
{
|
||||
float L00 = 0.282095;
|
||||
float L1_1 = 0.488603 * dir.y;
|
||||
float L10 = 0.488603 * dir.z;
|
||||
@ -30,8 +30,8 @@ vec3 SH2RGB (in vec4 sh_r, in vec4 sh_g, in vec4 sh_b, in vec3 dir)
|
||||
|
||||
out vec4 Diffuse;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
vec3 resolution = vec3(32, 16, 32);
|
||||
|
||||
|
@ -12,8 +12,7 @@ layout(location = 12) in vec4 GlowColor;
|
||||
|
||||
flat out vec4 glowColor;
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -32,8 +32,7 @@ flat out sampler2D handle;
|
||||
flat out sampler2D secondhandle;
|
||||
#endif
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ in vec3 bitangent;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -42,8 +42,7 @@ flat out sampler2D secondhandle;
|
||||
flat out sampler2D thirdhandle;
|
||||
#endif
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -14,9 +14,8 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
#stk_include "utils/rgb_conversion.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -10,9 +10,8 @@ flat in sampler2D handle;
|
||||
in vec3 nor;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main() {
|
||||
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
|
@ -11,7 +11,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main() {
|
||||
#ifdef Use_Bindless_Texture
|
||||
|
@ -11,7 +11,7 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -21,8 +21,7 @@ flat out uvec2 handle;
|
||||
#endif
|
||||
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -36,8 +36,7 @@ flat out uvec2 hdle;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@ -57,4 +56,4 @@ void main(void)
|
||||
hdle = Handle;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,7 @@ flat out uvec2 hdle;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
#stk_include "utils/getworldmatrix.vert"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
@ -54,4 +53,4 @@ void main(void)
|
||||
hdle = Handle;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
142
data/shaders/irrlicht/COGLES2FixedPipeline.fsh
Normal file
142
data/shaders/irrlicht/COGLES2FixedPipeline.fsh
Normal file
@ -0,0 +1,142 @@
|
||||
precision mediump float;
|
||||
|
||||
/* Definitions */
|
||||
|
||||
#define Solid 0
|
||||
#define Solid2Layer 1
|
||||
#define LightMap 2
|
||||
#define DetailMap 3
|
||||
#define SphereMap 4
|
||||
#define Reflection2Layer 5
|
||||
#define TransparentAlphaChannel 6
|
||||
#define TransparentAlphaChannelRef 7
|
||||
#define TransparentVertexAlpha 8
|
||||
#define TransparentReflection2Layer 9
|
||||
|
||||
/* Uniforms */
|
||||
|
||||
uniform int uMaterialType;
|
||||
|
||||
uniform bool uTextureUsage0;
|
||||
uniform bool uTextureUsage1;
|
||||
|
||||
uniform sampler2D uTextureUnit0;
|
||||
uniform sampler2D uTextureUnit1;
|
||||
|
||||
/* Varyings */
|
||||
|
||||
varying vec2 varTexCoord0;
|
||||
varying vec2 varTexCoord1;
|
||||
varying vec4 varVertexColor;
|
||||
varying float varEyeDist;
|
||||
|
||||
vec4 renderSolid()
|
||||
{
|
||||
vec4 Color = varVertexColor;
|
||||
|
||||
if(uTextureUsage0)
|
||||
Color *= texture2D(uTextureUnit0, varTexCoord0);
|
||||
|
||||
Color.a = 1.0;
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
vec4 render2LayerSolid()
|
||||
{
|
||||
float BlendFactor = varVertexColor.a;
|
||||
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0 * BlendFactor + Texel1 * (1.0 - BlendFactor);
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
vec4 renderLightMap()
|
||||
{
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0 * Texel1 * 4.0;
|
||||
Color.a = Texel0.a * Texel0.a;
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
vec4 renderDetailMap()
|
||||
{
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0;
|
||||
Color += Texel1 - 0.5;
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
vec4 renderReflection2Layer()
|
||||
{
|
||||
vec4 Color = varVertexColor;
|
||||
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
Color *= Texel0 * Texel1;
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
vec4 renderTransparent()
|
||||
{
|
||||
vec4 Color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
if(uTextureUsage0)
|
||||
Color *= texture2D(uTextureUnit0, varTexCoord0);
|
||||
|
||||
return Color;
|
||||
}
|
||||
|
||||
void main ()
|
||||
{
|
||||
if (uMaterialType == Solid)
|
||||
gl_FragColor = renderSolid();
|
||||
else if(uMaterialType == Solid2Layer)
|
||||
gl_FragColor = render2LayerSolid();
|
||||
else if(uMaterialType == LightMap)
|
||||
gl_FragColor = renderLightMap();
|
||||
else if(uMaterialType == DetailMap)
|
||||
gl_FragColor = renderDetailMap();
|
||||
else if(uMaterialType == SphereMap)
|
||||
gl_FragColor = renderSolid();
|
||||
else if(uMaterialType == Reflection2Layer)
|
||||
gl_FragColor = renderReflection2Layer();
|
||||
else if(uMaterialType == TransparentAlphaChannel)
|
||||
gl_FragColor = renderTransparent();
|
||||
else if(uMaterialType == TransparentAlphaChannelRef)
|
||||
{
|
||||
vec4 Color = renderTransparent();
|
||||
|
||||
if (Color.a < 0.5)
|
||||
discard;
|
||||
|
||||
gl_FragColor = Color;
|
||||
}
|
||||
else if(uMaterialType == TransparentVertexAlpha)
|
||||
{
|
||||
vec4 Color = renderTransparent();
|
||||
Color.a = varVertexColor.a;
|
||||
|
||||
gl_FragColor = Color;
|
||||
}
|
||||
else if(uMaterialType == TransparentReflection2Layer)
|
||||
{
|
||||
vec4 Color = renderReflection2Layer();
|
||||
Color.a = varVertexColor.a;
|
||||
|
||||
gl_FragColor = Color;
|
||||
}
|
||||
else
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
}
|
36
data/shaders/irrlicht/COGLES2FixedPipeline.vsh
Normal file
36
data/shaders/irrlicht/COGLES2FixedPipeline.vsh
Normal file
@ -0,0 +1,36 @@
|
||||
/* Attributes */
|
||||
|
||||
attribute vec3 inVertexPosition;
|
||||
attribute vec3 inVertexNormal;
|
||||
attribute vec4 inVertexColor;
|
||||
attribute vec2 inTexCoord0;
|
||||
attribute vec2 inTexCoord1;
|
||||
|
||||
/* Uniforms */
|
||||
|
||||
uniform int uMaterialType;
|
||||
|
||||
uniform mat4 uMvpMatrix;
|
||||
|
||||
uniform mat4 uTextureMatrix0;
|
||||
uniform mat4 uTextureMatrix1;
|
||||
|
||||
/* Varyings */
|
||||
|
||||
varying vec2 varTexCoord0;
|
||||
varying vec2 varTexCoord1;
|
||||
varying vec4 varVertexColor;
|
||||
varying float varEyeDist;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = uMvpMatrix * vec4(inVertexPosition,1.0);
|
||||
|
||||
vec4 TexCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 0.0, 0.0);
|
||||
varTexCoord0 = vec4(uTextureMatrix0 * TexCoord0).xy;
|
||||
|
||||
vec4 TexCoord1 = vec4(inTexCoord1.x, inTexCoord1.y, 0.0, 0.0);
|
||||
varTexCoord1 = vec4(uTextureMatrix1 * TexCoord1).xy;
|
||||
|
||||
varVertexColor = inVertexColor.zyxw;
|
||||
}
|
36
data/shaders/irrlicht/COGLES2NormalMap.fsh
Normal file
36
data/shaders/irrlicht/COGLES2NormalMap.fsh
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
#define MAX_LIGHTS 2
|
||||
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
uniform sampler2D texture1;
|
||||
|
||||
varying vec4 varTexCoord;
|
||||
varying vec3 varLightVector[MAX_LIGHTS];
|
||||
varying vec4 varLightColor[MAX_LIGHTS];
|
||||
|
||||
varying vec4 debug;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// fetch color and normal map
|
||||
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
|
||||
vec4 colorMap = texture2D(texture0, varTexCoord.xy);
|
||||
|
||||
// calculate color of light 0
|
||||
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
|
||||
|
||||
// calculate color of light 1
|
||||
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
|
||||
|
||||
//luminance * base color
|
||||
color *= colorMap;
|
||||
color.a = varLightColor[0].a;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
69
data/shaders/irrlicht/COGLES2NormalMap.vsh
Normal file
69
data/shaders/irrlicht/COGLES2NormalMap.vsh
Normal file
@ -0,0 +1,69 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
#define MAX_LIGHTS 2
|
||||
|
||||
attribute vec4 inVertexPosition;
|
||||
attribute vec4 inVertexColor;
|
||||
attribute vec4 inTexCoord0;
|
||||
attribute vec3 inVertexNormal;
|
||||
attribute vec3 inVertexTangent;
|
||||
attribute vec3 inVertexBinormal;
|
||||
|
||||
uniform mat4 uMvpMatrix;
|
||||
uniform vec4 uLightPos[MAX_LIGHTS];
|
||||
uniform vec4 uLightColor[MAX_LIGHTS];
|
||||
|
||||
varying vec4 varTexCoord;
|
||||
varying vec3 varLightVector[MAX_LIGHTS];
|
||||
varying vec4 varLightColor[MAX_LIGHTS];
|
||||
|
||||
varying vec4 debug;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
debug = vec4(inVertexNormal, 1.0);
|
||||
// transform position to clip space
|
||||
gl_Position = uMvpMatrix * inVertexPosition;
|
||||
|
||||
// vertex - lightpositions
|
||||
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
|
||||
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
|
||||
|
||||
// transform the light vector 1 with U, V, W
|
||||
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
|
||||
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
|
||||
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
|
||||
|
||||
|
||||
// transform the light vector 2 with U, V, W
|
||||
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
|
||||
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
|
||||
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
|
||||
|
||||
// calculate attenuation of light 0
|
||||
varLightColor[0].w = 0.0;
|
||||
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
|
||||
varLightColor[0].x *= uLightColor[0].w;
|
||||
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
|
||||
varLightColor[0] *= uLightColor[0];
|
||||
|
||||
// normalize light vector 0
|
||||
varLightVector[0] = normalize(varLightVector[0]);
|
||||
|
||||
// calculate attenuation of light 1
|
||||
varLightColor[1].w = 0.0;
|
||||
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
|
||||
varLightColor[1].x *= uLightColor[1].w;
|
||||
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
|
||||
varLightColor[1] *= uLightColor[1];
|
||||
|
||||
// normalize light vector 1
|
||||
varLightVector[1] = normalize(varLightVector[1]);
|
||||
|
||||
// move out texture coordinates and original alpha value
|
||||
varTexCoord = inTexCoord0;
|
||||
varLightColor[0].a = inVertexColor.a;
|
||||
}
|
49
data/shaders/irrlicht/COGLES2ParallaxMap.fsh
Normal file
49
data/shaders/irrlicht/COGLES2ParallaxMap.fsh
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
#define MAX_LIGHTS 2
|
||||
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
uniform sampler2D texture1;
|
||||
|
||||
//uniform vec4 uLightDiffuse[MAX_LIGHTS];
|
||||
uniform float uHeightScale;
|
||||
|
||||
varying vec4 varTexCoord;
|
||||
varying vec3 varLightVector[MAX_LIGHTS];
|
||||
varying vec4 varLightColor[MAX_LIGHTS];
|
||||
varying vec3 varEyeVector;
|
||||
|
||||
varying vec4 debug;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// fetch color and normal map
|
||||
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
|
||||
|
||||
// height = height * scale
|
||||
normalMap *= uHeightScale;
|
||||
|
||||
// calculate new texture coord: height * eye + oldTexCoord
|
||||
vec2 offset = varEyeVector.xy * normalMap.w + varTexCoord.xy;
|
||||
|
||||
// fetch new textures
|
||||
vec4 colorMap = texture2D(texture0, offset);
|
||||
normalMap = normalize(texture2D(texture1, offset) * 2.0 - 1.0);
|
||||
|
||||
// calculate color of light 0
|
||||
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
|
||||
|
||||
// calculate color of light 1
|
||||
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
|
||||
|
||||
//luminance * base color
|
||||
color *= colorMap;
|
||||
color.a = varLightColor[0].a;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
81
data/shaders/irrlicht/COGLES2ParallaxMap.vsh
Normal file
81
data/shaders/irrlicht/COGLES2ParallaxMap.vsh
Normal file
@ -0,0 +1,81 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
#define MAX_LIGHTS 2
|
||||
|
||||
attribute vec4 inVertexPosition;
|
||||
attribute vec4 inVertexColor;
|
||||
attribute vec4 inTexCoord0;
|
||||
attribute vec3 inVertexNormal;
|
||||
attribute vec3 inVertexTangent;
|
||||
attribute vec3 inVertexBinormal;
|
||||
|
||||
uniform mat4 uMvpMatrix;
|
||||
uniform vec4 uLightPos[MAX_LIGHTS];
|
||||
uniform vec4 uLightColor[MAX_LIGHTS];
|
||||
uniform vec3 uEyePos;
|
||||
|
||||
varying vec4 varTexCoord;
|
||||
varying vec3 varLightVector[MAX_LIGHTS];
|
||||
varying vec4 varLightColor[MAX_LIGHTS];
|
||||
varying vec3 varEyeVector;
|
||||
|
||||
varying vec4 debug;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
debug = vec4(inVertexNormal, 1.0);
|
||||
// transform position to clip space
|
||||
gl_Position = uMvpMatrix * inVertexPosition;
|
||||
|
||||
// vertex - lightpositions
|
||||
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
|
||||
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
|
||||
|
||||
// eye vector
|
||||
vec4 Temp = vec4(uEyePos, 1.0) - inVertexPosition;
|
||||
|
||||
// transform the light vector 1 with U, V, W
|
||||
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
|
||||
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
|
||||
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
|
||||
|
||||
|
||||
// transform the light vector 2 with U, V, W
|
||||
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
|
||||
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
|
||||
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
|
||||
|
||||
// transform the eye vector with U, V, W
|
||||
varEyeVector.x = dot(inVertexTangent, Temp.xyz);
|
||||
varEyeVector.y = dot(inVertexBinormal, Temp.xyz);
|
||||
varEyeVector.z = dot(inVertexNormal, Temp.xyz);
|
||||
varEyeVector *= vec3(1.0,-1.0, -1.0);
|
||||
varEyeVector = normalize(varEyeVector);
|
||||
|
||||
// calculate attenuation of light 0
|
||||
varLightColor[0].w = 0.0;
|
||||
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
|
||||
varLightColor[0].x *= uLightColor[0].w;
|
||||
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
|
||||
varLightColor[0] *= uLightColor[0];
|
||||
|
||||
// normalize light vector 0
|
||||
varLightVector[0] = normalize(varLightVector[0]);
|
||||
|
||||
// calculate attenuation of light 1
|
||||
varLightColor[1].w = 0.0;
|
||||
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
|
||||
varLightColor[1].x *= uLightColor[1].w;
|
||||
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
|
||||
varLightColor[1] *= uLightColor[1];
|
||||
|
||||
// normalize light vector 1
|
||||
varLightVector[1] = normalize(varLightVector[1]);
|
||||
|
||||
// move out texture coordinates and original alpha value
|
||||
varTexCoord = inTexCoord0;
|
||||
varLightColor[0].a = inVertexColor.a;
|
||||
}
|
23
data/shaders/irrlicht/COGLES2Renderer2D.fsh
Normal file
23
data/shaders/irrlicht/COGLES2Renderer2D.fsh
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
precision mediump float;
|
||||
|
||||
uniform bool uUseTexture;
|
||||
uniform sampler2D uTextureUnit;
|
||||
|
||||
varying vec4 vVertexColor;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 Color = vVertexColor;
|
||||
|
||||
if(uUseTexture)
|
||||
Color *= texture2D(uTextureUnit, vTexCoord);
|
||||
|
||||
gl_FragColor = Color;
|
||||
}
|
21
data/shaders/irrlicht/COGLES2Renderer2D.vsh
Normal file
21
data/shaders/irrlicht/COGLES2Renderer2D.vsh
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
attribute vec4 inVertexPosition;
|
||||
attribute vec4 inVertexColor;
|
||||
attribute vec2 inTexCoord0;
|
||||
|
||||
uniform mat4 uOrthoMatrix;
|
||||
|
||||
varying vec4 vVertexColor;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = uOrthoMatrix * inVertexPosition;
|
||||
vVertexColor = inVertexColor.bgra;
|
||||
vTexCoord = inTexCoord0;
|
||||
}
|
@ -42,7 +42,7 @@ out vec4 FragColor;
|
||||
// Number of samples used for blurring
|
||||
#define NB_SAMPLES 8
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -74,7 +74,7 @@ void main()
|
||||
|
||||
// Compute the blur
|
||||
vec2 inc_vec = blur_dir / vec2(NB_SAMPLES);
|
||||
vec2 blur_texcoords = texcoords - inc_vec * NB_SAMPLES / 2;
|
||||
vec2 blur_texcoords = texcoords - inc_vec * float(NB_SAMPLES) / 2.;
|
||||
for(int i=1 ; i < NB_SAMPLES ; i++)
|
||||
{
|
||||
color += texture(color_buffer, blur_texcoords).rgb;
|
||||
|
@ -11,7 +11,7 @@ in vec3 bitangent;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -1,3 +1,8 @@
|
||||
#ifdef GL_ES
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
uniform mat4 TextureMatrix;
|
||||
#else
|
||||
uniform mat4 ModelMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
@ -14,6 +19,7 @@ uniform mat4 TextureMatrix =
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
#endif
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
@ -8,7 +8,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -12,9 +12,8 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
vec3 rgbToHsv(vec3 c);
|
||||
vec3 hsvToRgb(vec3 c);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
#stk_include "utils/rgb_conversion.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -9,8 +9,8 @@ uniform sampler2D tex;
|
||||
in vec3 nor;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main() {
|
||||
vec3 texc = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
|
@ -10,7 +10,7 @@ in vec3 nor;
|
||||
in vec2 uv;
|
||||
out vec3 EncodedNormal;
|
||||
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
#stk_include "utils/encode_normal.frag"
|
||||
|
||||
void main() {
|
||||
vec4 col = texture(tex, uv);
|
||||
|
@ -10,7 +10,7 @@ in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ in vec2 tc;
|
||||
in vec3 pc;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
13
data/shaders/pass_gles.frag
Normal file
13
data/shaders/pass_gles.frag
Normal file
@ -0,0 +1,13 @@
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(tex, uv);
|
||||
}
|
10
data/shaders/pass_gles.vert
Normal file
10
data/shaders/pass_gles.vert
Normal file
@ -0,0 +1,10 @@
|
||||
#version 300 es
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
uv = Texcoord;
|
||||
gl_Position = vec4(Position, 1.);
|
||||
}
|
@ -39,7 +39,7 @@ void main(void)
|
||||
if (gl_VertexID < level)
|
||||
{
|
||||
float dt_from_last_frame = fract(updated_lifetime) * lifetime_initial;
|
||||
float coeff = dt_from_last_frame / dt;
|
||||
float coeff = dt_from_last_frame / float(dt);
|
||||
|
||||
vec4 previous_frame_position = previous_frame_sourcematrix * vec4(particle_position_initial, 1.0);
|
||||
vec4 current_frame_position = sourcematrix * vec4(particle_position_initial, 1.0);
|
||||
@ -66,7 +66,7 @@ void main(void)
|
||||
else
|
||||
{
|
||||
new_lifetime = fract(updated_lifetime);
|
||||
new_size = 0;
|
||||
new_size = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -74,7 +74,7 @@ void main(void)
|
||||
new_particle_position = particle_position + particle_velocity.xyz * float(dt);
|
||||
new_particle_velocity = particle_velocity;
|
||||
new_lifetime = updated_lifetime;
|
||||
new_size = (size == 0) ? 0. : mix(size_initial, size_initial * size_increase_factor, updated_lifetime);
|
||||
new_size = (size == 0.0) ? 0. : mix(size_initial, size_initial * size_increase_factor, updated_lifetime);
|
||||
}
|
||||
gl_Position = vec4(0.);
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ flat in float radius;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/SpecularBRDF.frag"
|
||||
#stk_include "utils/DiffuseBRDF.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ flat in float radius;
|
||||
|
||||
out vec4 Fog;
|
||||
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -28,14 +28,14 @@ void main()
|
||||
vec3 closestpoint = - eyedir * (dot(-eyedir, light_pos) - radius);
|
||||
if (closestpoint.z < 1.) closestpoint = vec3(0.);
|
||||
|
||||
float stepsize = length(farthestpoint - closestpoint) / 16;
|
||||
float stepsize = length(farthestpoint - closestpoint) / 16.;
|
||||
vec3 fog = vec3(0.);
|
||||
vec3 xpos = farthestpoint;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
float d = distance(light_pos, xpos);
|
||||
float l = (16 - i) * stepsize;
|
||||
float l = (16. - float(i)) * stepsize;
|
||||
float att = energy * 20. / (1. + d * d);
|
||||
att *= max((radius - d) / radius, 0.);
|
||||
fog += density * light_col * att * exp(- density * d) * exp(- density * l) * stepsize;
|
||||
|
@ -24,7 +24,7 @@ void main(void)
|
||||
color = Color.zyxw;
|
||||
vec3 P = Position / vec3(screen, 1.);
|
||||
P = 2. * P - 1.;
|
||||
P.y *= -1;
|
||||
P.y *= -1.;
|
||||
gl_Position = vec4(P, 1.);
|
||||
uv = Texcoord;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ in vec2 uv;
|
||||
in vec2 uv_bis;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main() {
|
||||
// Splatting part
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
uniform sampler2D dtex;
|
||||
uniform float radius;
|
||||
uniform float k = 1.5;
|
||||
uniform float sigma = 1.;
|
||||
uniform float k;
|
||||
uniform float sigma;
|
||||
out float AO;
|
||||
|
||||
const float tau = 7.;
|
||||
@ -12,14 +12,13 @@ const float beta = 0.002;
|
||||
const float epsilon = .00001;
|
||||
|
||||
#define SAMPLES 16
|
||||
|
||||
const float invSamples = 1. / SAMPLES;
|
||||
const float invSamples = 0.0625; // 1. / SAMPLES
|
||||
|
||||
vec3 getXcYcZc(int x, int y, float zC)
|
||||
{
|
||||
// We use perspective symetric projection matrix hence P(0,2) = P(1, 2) = 0
|
||||
float xC= (2 * (float(x)) / screen.x - 1.) * zC / ProjectionMatrix[0][0];
|
||||
float yC= (2 * (float(y)) / screen.y - 1.) * zC / ProjectionMatrix[1][1];
|
||||
float xC= (2. * (float(x)) / screen.x - 1.) * zC / ProjectionMatrix[0][0];
|
||||
float yC= (2. * (float(y)) / screen.y - 1.) * zC / ProjectionMatrix[1][1];
|
||||
return vec3(xC, yC, zC);
|
||||
}
|
||||
|
||||
@ -36,16 +35,16 @@ void main(void)
|
||||
vec3 norm = normalize(cross(ddy, ddx));
|
||||
|
||||
float r = radius / FragPos.z;
|
||||
float phi = 3. * (x ^ y) + x * y;
|
||||
float phi = 3. * float((x ^ y) + x * y);
|
||||
float bl = 0.0;
|
||||
float m = log2(r) + 6 + log2(invSamples);
|
||||
float m = log2(r) + 6. + log2(invSamples);
|
||||
|
||||
float theta = mod(2. * 3.14 * tau * .5 * invSamples + phi, 6.283185307179586);
|
||||
vec2 rotations = vec2(cos(theta), sin(theta)) * screen;
|
||||
vec2 offset = vec2(cos(invSamples), sin(invSamples));
|
||||
|
||||
for(int i = 0; i < SAMPLES; ++i) {
|
||||
float alpha = (i + .5) * invSamples;
|
||||
float alpha = (float(i) + .5) * invSamples;
|
||||
rotations = vec2(rotations.x * offset.x - rotations.y * offset.y, rotations.x * offset.y + rotations.y * offset.x);
|
||||
float h = r * alpha;
|
||||
vec2 localoffset = h * rotations;
|
||||
@ -53,13 +52,13 @@ void main(void)
|
||||
m = m + .5;
|
||||
ivec2 ioccluder_uv = ivec2(x, y) + ivec2(localoffset);
|
||||
|
||||
if (ioccluder_uv.x < 0 || ioccluder_uv.x > screen.x || ioccluder_uv.y < 0 || ioccluder_uv.y > screen.y) continue;
|
||||
if (ioccluder_uv.x < 0 || ioccluder_uv.x > int(screen.x) || ioccluder_uv.y < 0 || ioccluder_uv.y > int(screen.y)) continue;
|
||||
|
||||
float LinearoccluderFragmentDepth = textureLod(dtex, vec2(ioccluder_uv) / screen, max(m, 0.)).x;
|
||||
vec3 OccluderPos = getXcYcZc(ioccluder_uv.x, ioccluder_uv.y, LinearoccluderFragmentDepth);
|
||||
|
||||
vec3 vi = OccluderPos - FragPos;
|
||||
bl += max(0, dot(vi, norm) - FragPos.z * beta) / (dot(vi, vi) + epsilon);
|
||||
bl += max(0., dot(vi, norm) - FragPos.z * beta) / (dot(vi, vi) + epsilon);
|
||||
}
|
||||
|
||||
AO = max(pow(1.0 - min(2. * sigma * bl * invSamples, 0.99), k), 0.);
|
||||
|
@ -4,11 +4,11 @@ uniform sampler2D dtex;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 SunMRP(vec3 normal, vec3 eyedir);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/SpecularBRDF.frag"
|
||||
#stk_include "utils/DiffuseBRDF.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/SunMRP.frag"
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
|
@ -12,11 +12,11 @@ in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 SunMRP(vec3 normal, vec3 eyedir);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/SpecularBRDF.frag"
|
||||
#stk_include "utils/DiffuseBRDF.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/SunMRP.frag"
|
||||
|
||||
float getShadowFactor(vec3 pos, int index)
|
||||
{
|
||||
|
@ -11,11 +11,11 @@ in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec3 DiffuseBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 SunMRP(vec3 normal, vec3 eyedir);
|
||||
#stk_include "utils/decodeNormal.frag"
|
||||
#stk_include "utils/SpecularBRDF.frag"
|
||||
#stk_include "utils/DiffuseBRDF.frag"
|
||||
#stk_include "utils/getPosFromUVDepth.frag"
|
||||
#stk_include "utils/SunMRP.frag"
|
||||
|
||||
float getShadowFactor(vec3 pos, int index)
|
||||
{
|
||||
|
6
data/shaders/tfb_dummy.frag
Normal file
6
data/shaders/tfb_dummy.frag
Normal file
@ -0,0 +1,6 @@
|
||||
out vec4 FragColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
FragColor = vec4(1.0);
|
||||
}
|
@ -3,8 +3,8 @@ uniform float vignette_weight;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getCIEYxy(vec3 rgbColor);
|
||||
vec3 getRGBFromCIEXxy(vec3 YxyColor);
|
||||
#stk_include "utils/getCIEXYZ.frag"
|
||||
#stk_include "utils/getRGBfromCIEXxy.frag"
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -7,5 +7,5 @@ out vec4 FragColor;
|
||||
void main()
|
||||
{
|
||||
vec4 res = texture(tex, uv);
|
||||
FragColor = res * color / 255.;
|
||||
FragColor = res * vec4(color) / 255.;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
#stk_include "utils/getLightFactor.frag"
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -6,6 +6,6 @@ vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float rou
|
||||
vec3 H = normalize(eyedir + lightdir);
|
||||
float NdotH = clamp(dot(normal, H), 0., 1.);
|
||||
float normalisationFactor = (exponentroughness + 2.) / 8.;
|
||||
vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - clamp(dot(eyedir, H), 0., 1.), 5);
|
||||
vec3 FresnelSchlick = color + (1.0f - color) * pow(1.0f - clamp(dot(eyedir, H), 0., 1.), 5.);
|
||||
return max(pow(NdotH, exponentroughness) * FresnelSchlick * normalisationFactor, vec3(0.));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix)
|
||||
{
|
||||
vec4 pos = 2.0 * vec4(uvDepth, 1.0) - 1.0f;
|
||||
vec4 pos = 2.0 * vec4(uvDepth, 1.0) - 1.0;
|
||||
pos.xy *= vec2(InverseProjectionMatrix[0][0], InverseProjectionMatrix[1][1]);
|
||||
pos.zw = vec2(pos.z * InverseProjectionMatrix[2][2] + pos.w, pos.z * InverseProjectionMatrix[2][3] + pos.w);
|
||||
pos /= pos.w;
|
||||
|
@ -8,8 +8,10 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
"${ZLIB_INCLUDE_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../zlib/") # For zconf.h on WIN32
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
if(NOT USE_GLES2)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
@ -40,6 +42,10 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_GLES2)
|
||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_ -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DNO_IRR_COMPILE_WITH_OGLES1_ -DNO_IRR_COMPILE_WITH_OPENGL_ -DNO_IRR_USE_NON_SYSTEM_JPEG_LIB_ -DNO_IRR_USE_NON_SYSTEM_LIB_PNG_ -DNO_IRR_USE_NON_SYSTEM_ZLIB_)
|
||||
endif()
|
||||
|
||||
# Xrandr
|
||||
if(UNIX AND USE_XRANDR)
|
||||
add_definitions(-DNO_IRR_LINUX_X11_VIDMODE_)
|
||||
@ -50,448 +56,470 @@ if(CYGWIN)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
||||
endif()
|
||||
|
||||
|
||||
set(IRRLICHT_SOURCES
|
||||
source/Irrlicht/CGUIListBox.cpp
|
||||
source/Irrlicht/CZBuffer.cpp
|
||||
source/Irrlicht/CGUIModalScreen.cpp
|
||||
source/Irrlicht/CParticleCylinderEmitter.cpp
|
||||
source/Irrlicht/CLimitReadFile.cpp
|
||||
source/Irrlicht/CVideoModeList.cpp
|
||||
source/Irrlicht/CDefaultGUIElementFactory.cpp
|
||||
source/Irrlicht/CCubeSceneNode.cpp
|
||||
source/Irrlicht/CGUIMeshViewer.cpp
|
||||
source/Irrlicht/CParticleSphereEmitter.cpp
|
||||
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
|
||||
source/Irrlicht/CGUITabControl.cpp
|
||||
source/Irrlicht/CGUIToolBar.cpp
|
||||
source/Irrlicht/CTerrainTriangleSelector.cpp
|
||||
source/Irrlicht/CFileSystem.cpp
|
||||
source/Irrlicht/CTerrainSceneNode.cpp
|
||||
source/Irrlicht/os.cpp
|
||||
source/Irrlicht/CFPSCounter.cpp
|
||||
source/Irrlicht/CGUIContextMenu.cpp
|
||||
source/Irrlicht/CImageWriterJPG.cpp
|
||||
source/Irrlicht/CZipReader.cpp
|
||||
source/Irrlicht/CImageLoaderPNG.cpp
|
||||
source/Irrlicht/CImageLoaderBMP.cpp
|
||||
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
|
||||
source/Irrlicht/CSkyDomeSceneNode.cpp
|
||||
source/Irrlicht/CGUIFileOpenDialog.cpp
|
||||
source/Irrlicht/CGUISpriteBank.cpp
|
||||
source/Irrlicht/CParticleFadeOutAffector.cpp
|
||||
source/Irrlicht/CGUIMenu.cpp
|
||||
source/Irrlicht/CSphereSceneNode.cpp
|
||||
source/Irrlicht/CImageWriterPNG.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
|
||||
source/Irrlicht/CGUIMessageBox.cpp
|
||||
source/Irrlicht/CParticleGravityAffector.cpp
|
||||
source/Irrlicht/CGUISkin.cpp
|
||||
source/Irrlicht/CBoneSceneNode.cpp
|
||||
source/Irrlicht/COpenGLSLMaterialRenderer.cpp
|
||||
source/Irrlicht/CParticleRotationAffector.cpp
|
||||
source/Irrlicht/CTriangleBBSelector.cpp
|
||||
source/Irrlicht/CGUIComboBox.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorTexture.cpp
|
||||
source/Irrlicht/COpenGLTexture.cpp
|
||||
source/Irrlicht/COctreeSceneNode.cpp
|
||||
source/Irrlicht/CWaterSurfaceSceneNode.cpp
|
||||
source/Irrlicht/CParticleAttractionAffector.cpp
|
||||
source/Irrlicht/CMeshSceneNode.cpp
|
||||
source/Irrlicht/CGUIScrollBar.cpp
|
||||
source/Irrlicht/CAttributes.cpp
|
||||
source/Irrlicht/CGUIStaticText.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
|
||||
source/Irrlicht/CGUIFont.cpp
|
||||
source/Irrlicht/CTriangleSelector.cpp
|
||||
source/Irrlicht/CParticlePointEmitter.cpp
|
||||
source/Irrlicht/CTextSceneNode.cpp
|
||||
source/Irrlicht/CIrrDeviceLinux.cpp
|
||||
source/Irrlicht/CIrrDeviceStub.cpp
|
||||
source/Irrlicht/CGUIInOutFader.cpp
|
||||
source/Irrlicht/CGUITreeView.cpp
|
||||
source/Irrlicht/CAnimatedMeshSceneNode.cpp
|
||||
source/Irrlicht/CGUICheckBox.cpp
|
||||
source/Irrlicht/CGUIWindow.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
|
||||
source/Irrlicht/CColorConverter.cpp
|
||||
source/Irrlicht/CMeshCache.cpp
|
||||
source/Irrlicht/CIrrDeviceFB.cpp
|
||||
source/Irrlicht/CMemoryFile.cpp
|
||||
source/Irrlicht/CMountPointReader.cpp
|
||||
source/Irrlicht/CBillboardSceneNode.cpp
|
||||
source/Irrlicht/CGUIImageList.cpp
|
||||
source/Irrlicht/CSceneCollisionManager.cpp
|
||||
source/Irrlicht/CIrrDeviceWin32.cpp
|
||||
source/Irrlicht/CEmptySceneNode.cpp
|
||||
source/Irrlicht/CParticleBoxEmitter.cpp
|
||||
source/Irrlicht/CParticleSystemSceneNode.cpp
|
||||
source/Irrlicht/CIrrDeviceConsole.cpp
|
||||
source/Irrlicht/CImage.cpp
|
||||
source/Irrlicht/CTarReader.cpp
|
||||
source/Irrlicht/CGUIButton.cpp
|
||||
source/Irrlicht/COpenGLParallaxMapRenderer.cpp
|
||||
source/Irrlicht/CGUIEditBox.cpp
|
||||
source/Irrlicht/CLogger.cpp
|
||||
source/Irrlicht/CMeshManipulator.cpp
|
||||
source/Irrlicht/CLightSceneNode.cpp
|
||||
source/Irrlicht/CSkyBoxSceneNode.cpp
|
||||
source/Irrlicht/CWriteFile.cpp
|
||||
source/Irrlicht/COctreeTriangleSelector.cpp
|
||||
source/Irrlicht/CFileList.cpp
|
||||
source/Irrlicht/CIrrDeviceSDL.cpp
|
||||
source/Irrlicht/COSOperator.cpp
|
||||
source/Irrlicht/CImageLoaderJPG.cpp
|
||||
source/Irrlicht/COpenGLExtensionHandler.cpp
|
||||
source/Irrlicht/CXMLWriter.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
|
||||
source/Irrlicht/CGUIColorSelectDialog.cpp
|
||||
source/Irrlicht/CSceneManager.cpp
|
||||
source/Irrlicht/Irrlicht.cpp
|
||||
source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
|
||||
source/Irrlicht/COpenGLDriver.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
|
||||
source/Irrlicht/irrXML.cpp
|
||||
source/Irrlicht/CSkinnedMesh.cpp
|
||||
source/Irrlicht/CXMLReader.cpp
|
||||
source/Irrlicht/CDummyTransformationSceneNode.cpp
|
||||
source/Irrlicht/CGUITable.cpp
|
||||
source/Irrlicht/CAttributes.cpp
|
||||
source/Irrlicht/CB3DMeshFileLoader.cpp
|
||||
source/Irrlicht/CGeometryCreator.cpp
|
||||
source/Irrlicht/CNullDriver.cpp
|
||||
source/Irrlicht/CBillboardSceneNode.cpp
|
||||
source/Irrlicht/CBoneSceneNode.cpp
|
||||
source/Irrlicht/CCameraSceneNode.cpp
|
||||
source/Irrlicht/CGUISpinBox.cpp
|
||||
source/Irrlicht/CReadFile.cpp
|
||||
source/Irrlicht/CParticleRingEmitter.cpp
|
||||
source/Irrlicht/CMetaTriangleSelector.cpp
|
||||
source/Irrlicht/CColorConverter.cpp
|
||||
source/Irrlicht/CCubeSceneNode.cpp
|
||||
source/Irrlicht/CDefaultGUIElementFactory.cpp
|
||||
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
|
||||
source/Irrlicht/CDefaultSceneNodeFactory.cpp
|
||||
source/Irrlicht/CGUIImage.cpp
|
||||
source/Irrlicht/CDummyTransformationSceneNode.cpp
|
||||
source/Irrlicht/CEmptySceneNode.cpp
|
||||
source/Irrlicht/CFileList.cpp
|
||||
source/Irrlicht/CFileSystem.cpp
|
||||
source/Irrlicht/CFPSCounter.cpp
|
||||
source/Irrlicht/CGeometryCreator.cpp
|
||||
source/Irrlicht/CGUIButton.cpp
|
||||
source/Irrlicht/CGUICheckBox.cpp
|
||||
source/Irrlicht/CGUIColorSelectDialog.cpp
|
||||
source/Irrlicht/CGUIComboBox.cpp
|
||||
source/Irrlicht/CGUIContextMenu.cpp
|
||||
source/Irrlicht/CGUIEditBox.cpp
|
||||
source/Irrlicht/CGUIEnvironment.cpp
|
||||
source/Irrlicht/CParticleScaleAffector.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorDelete.cpp
|
||||
source/Irrlicht/CGUIFileOpenDialog.cpp
|
||||
source/Irrlicht/CGUIFont.cpp
|
||||
source/Irrlicht/CGUIImage.cpp
|
||||
source/Irrlicht/CGUIImageList.cpp
|
||||
source/Irrlicht/CGUIInOutFader.cpp
|
||||
source/Irrlicht/CGUIListBox.cpp
|
||||
source/Irrlicht/CGUIMenu.cpp
|
||||
source/Irrlicht/CGUIMeshViewer.cpp
|
||||
source/Irrlicht/CGUIMessageBox.cpp
|
||||
source/Irrlicht/CGUIModalScreen.cpp
|
||||
source/Irrlicht/CGUIScrollBar.cpp
|
||||
source/Irrlicht/CGUISkin.cpp
|
||||
source/Irrlicht/CGUISpinBox.cpp
|
||||
source/Irrlicht/CGUISpriteBank.cpp
|
||||
source/Irrlicht/CGUIStaticText.cpp
|
||||
source/Irrlicht/CGUITabControl.cpp
|
||||
source/Irrlicht/CGUITable.cpp
|
||||
source/Irrlicht/CGUIToolBar.cpp
|
||||
source/Irrlicht/CGUITreeView.cpp
|
||||
source/Irrlicht/CGUIWindow.cpp
|
||||
source/Irrlicht/CImage.cpp
|
||||
source/Irrlicht/CImageLoaderBMP.cpp
|
||||
source/Irrlicht/CImageLoaderJPG.cpp
|
||||
source/Irrlicht/CImageLoaderPNG.cpp
|
||||
source/Irrlicht/CImageWriterBMP.cpp
|
||||
source/Irrlicht/CImageWriterJPG.cpp
|
||||
source/Irrlicht/CImageWriterPNG.cpp
|
||||
source/Irrlicht/CIrrDeviceConsole.cpp
|
||||
source/Irrlicht/CIrrDeviceFB.cpp
|
||||
source/Irrlicht/CIrrDeviceLinux.cpp
|
||||
source/Irrlicht/CIrrDeviceSDL.cpp
|
||||
source/Irrlicht/CIrrDeviceStub.cpp
|
||||
source/Irrlicht/CIrrDeviceWin32.cpp
|
||||
source/Irrlicht/CLightSceneNode.cpp
|
||||
source/Irrlicht/CLimitReadFile.cpp
|
||||
source/Irrlicht/CLogger.cpp
|
||||
source/Irrlicht/CMemoryFile.cpp
|
||||
source/Irrlicht/CMeshCache.cpp
|
||||
source/Irrlicht/CMeshManipulator.cpp
|
||||
source/Irrlicht/CMeshSceneNode.cpp
|
||||
source/Irrlicht/CMetaTriangleSelector.cpp
|
||||
source/Irrlicht/CMountPointReader.cpp
|
||||
source/Irrlicht/CNullDriver.cpp
|
||||
source/Irrlicht/COctreeSceneNode.cpp
|
||||
source/Irrlicht/COctreeTriangleSelector.cpp
|
||||
source/Irrlicht/COGLES2Driver.cpp
|
||||
source/Irrlicht/COGLES2ExtensionHandler.cpp
|
||||
source/Irrlicht/COGLES2FixedPipelineRenderer.cpp
|
||||
source/Irrlicht/COGLES2MaterialRenderer.cpp
|
||||
source/Irrlicht/COGLES2NormalMapRenderer.cpp
|
||||
source/Irrlicht/COGLES2ParallaxMapRenderer.cpp
|
||||
source/Irrlicht/COGLES2Renderer2D.cpp
|
||||
source/Irrlicht/COGLES2Texture.cpp
|
||||
source/Irrlicht/COpenGLDriver.cpp
|
||||
source/Irrlicht/COpenGLExtensionHandler.cpp
|
||||
source/Irrlicht/COpenGLParallaxMapRenderer.cpp
|
||||
source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
|
||||
source/Irrlicht/COpenGLSLMaterialRenderer.cpp
|
||||
source/Irrlicht/COpenGLTexture.cpp
|
||||
source/Irrlicht/COSOperator.cpp
|
||||
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
|
||||
source/Irrlicht/CParticleAttractionAffector.cpp
|
||||
source/Irrlicht/CParticleBoxEmitter.cpp
|
||||
source/Irrlicht/CParticleCylinderEmitter.cpp
|
||||
source/Irrlicht/CParticleFadeOutAffector.cpp
|
||||
source/Irrlicht/CParticleGravityAffector.cpp
|
||||
source/Irrlicht/CParticleMeshEmitter.cpp
|
||||
source/Irrlicht/CParticlePointEmitter.cpp
|
||||
source/Irrlicht/CParticleRingEmitter.cpp
|
||||
source/Irrlicht/CParticleRotationAffector.cpp
|
||||
source/Irrlicht/CParticleScaleAffector.cpp
|
||||
source/Irrlicht/CParticleSphereEmitter.cpp
|
||||
source/Irrlicht/CParticleSystemSceneNode.cpp
|
||||
source/Irrlicht/CReadFile.cpp
|
||||
source/Irrlicht/CSceneCollisionManager.cpp
|
||||
source/Irrlicht/CSceneManager.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorDelete.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
|
||||
source/Irrlicht/CSceneNodeAnimatorRotation.cpp
|
||||
source/Irrlicht/glext.h
|
||||
source/Irrlicht/CB3DMeshFileLoader.h
|
||||
source/Irrlicht/CIrrDeviceLinux.h
|
||||
source/Irrlicht/CMeshCache.h
|
||||
source/Irrlicht/CSceneNodeAnimatorTexture.cpp
|
||||
source/Irrlicht/CSkinnedMesh.cpp
|
||||
source/Irrlicht/CSkyBoxSceneNode.cpp
|
||||
source/Irrlicht/CSkyDomeSceneNode.cpp
|
||||
source/Irrlicht/CSphereSceneNode.cpp
|
||||
source/Irrlicht/CTarReader.cpp
|
||||
source/Irrlicht/CTerrainSceneNode.cpp
|
||||
source/Irrlicht/CTerrainTriangleSelector.cpp
|
||||
source/Irrlicht/CTextSceneNode.cpp
|
||||
source/Irrlicht/CTriangleBBSelector.cpp
|
||||
source/Irrlicht/CTriangleSelector.cpp
|
||||
source/Irrlicht/CVideoModeList.cpp
|
||||
source/Irrlicht/CWaterSurfaceSceneNode.cpp
|
||||
source/Irrlicht/CWriteFile.cpp
|
||||
source/Irrlicht/CXMLReader.cpp
|
||||
source/Irrlicht/CXMLWriter.cpp
|
||||
source/Irrlicht/CZBuffer.cpp
|
||||
source/Irrlicht/CZipReader.cpp
|
||||
source/Irrlicht/Irrlicht.cpp
|
||||
source/Irrlicht/irrXML.cpp
|
||||
source/Irrlicht/os.cpp
|
||||
source/Irrlicht/BuiltInFont.h
|
||||
source/Irrlicht/CAnimatedMeshSceneNode.h
|
||||
source/Irrlicht/CAttributeImpl.h
|
||||
source/Irrlicht/CAttributes.h
|
||||
source/Irrlicht/CB3DMeshFileLoader.h
|
||||
source/Irrlicht/CBillboardSceneNode.h
|
||||
source/Irrlicht/CBlit.h
|
||||
source/Irrlicht/CBoneSceneNode.h
|
||||
source/Irrlicht/CCameraSceneNode.h
|
||||
source/Irrlicht/CColorConverter.h
|
||||
source/Irrlicht/CCubeSceneNode.h
|
||||
source/Irrlicht/CDefaultGUIElementFactory.h
|
||||
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
|
||||
source/Irrlicht/CDefaultSceneNodeFactory.h
|
||||
source/Irrlicht/CDummyTransformationSceneNode.h
|
||||
source/Irrlicht/CEmptySceneNode.h
|
||||
source/Irrlicht/CFileList.h
|
||||
source/Irrlicht/CFileSystem.h
|
||||
source/Irrlicht/CFPSCounter.h
|
||||
source/Irrlicht/CGeometryCreator.h
|
||||
source/Irrlicht/CGUIButton.h
|
||||
source/Irrlicht/CGUICheckBox.h
|
||||
source/Irrlicht/CGUIColorSelectDialog.h
|
||||
source/Irrlicht/CGUIComboBox.h
|
||||
source/Irrlicht/CGUIContextMenu.h
|
||||
source/Irrlicht/CGUIEditBox.h
|
||||
source/Irrlicht/CGUIEnvironment.h
|
||||
source/Irrlicht/CGUIFileOpenDialog.h
|
||||
source/Irrlicht/CGUIFont.h
|
||||
source/Irrlicht/CGUIImage.h
|
||||
source/Irrlicht/CGUIImageList.h
|
||||
source/Irrlicht/CGUIInOutFader.h
|
||||
source/Irrlicht/CGUIListBox.h
|
||||
source/Irrlicht/CGUIMenu.h
|
||||
source/Irrlicht/CGUIMeshViewer.h
|
||||
source/Irrlicht/CGUIMessageBox.h
|
||||
source/Irrlicht/CGUIModalScreen.h
|
||||
source/Irrlicht/CGUIScrollBar.h
|
||||
source/Irrlicht/CGUISkin.h
|
||||
source/Irrlicht/CGUISpinBox.h
|
||||
source/Irrlicht/CGUISpriteBank.h
|
||||
source/Irrlicht/CGUIStaticText.h
|
||||
source/Irrlicht/CGUITabControl.h
|
||||
source/Irrlicht/CGUITable.h
|
||||
source/Irrlicht/CGUIToolBar.h
|
||||
source/Irrlicht/CGUITreeView.h
|
||||
source/Irrlicht/CGUIWindow.h
|
||||
source/Irrlicht/CImage.h
|
||||
source/Irrlicht/CImageLoaderBMP.h
|
||||
source/Irrlicht/CImageLoaderJPG.h
|
||||
source/Irrlicht/CImageLoaderPNG.h
|
||||
source/Irrlicht/CImageWriterBMP.h
|
||||
source/Irrlicht/CImageWriterJPG.h
|
||||
source/Irrlicht/CImageWriterPNG.h
|
||||
source/Irrlicht/CIrrDeviceConsole.h
|
||||
source/Irrlicht/CIrrDeviceFB.h
|
||||
source/Irrlicht/CIrrDeviceLinux.h
|
||||
source/Irrlicht/CIrrDeviceSDL.h
|
||||
source/Irrlicht/CIrrDeviceStub.h
|
||||
source/Irrlicht/CIrrDeviceWin32.h
|
||||
source/Irrlicht/CLightSceneNode.h
|
||||
source/Irrlicht/CLimitReadFile.h
|
||||
source/Irrlicht/CLogger.h
|
||||
source/Irrlicht/CMemoryFile.h
|
||||
source/Irrlicht/CMeshCache.h
|
||||
source/Irrlicht/CMeshManipulator.h
|
||||
source/Irrlicht/CMeshSceneNode.h
|
||||
source/Irrlicht/CMetaTriangleSelector.h
|
||||
source/Irrlicht/CMountPointReader.h
|
||||
source/Irrlicht/CNullDriver.h
|
||||
source/Irrlicht/COctreeSceneNode.h
|
||||
source/Irrlicht/COctreeTriangleSelector.h
|
||||
source/Irrlicht/COGLES2Driver.h
|
||||
source/Irrlicht/COGLES2ExtensionHandler.h
|
||||
source/Irrlicht/COGLES2FixedPipelineRenderer.h
|
||||
source/Irrlicht/COGLES2MaterialRenderer.h
|
||||
source/Irrlicht/COGLES2NormalMapRenderer.h
|
||||
source/Irrlicht/COGLES2ParallaxMapRenderer.h
|
||||
source/Irrlicht/COGLES2Renderer2D.h
|
||||
source/Irrlicht/COGLES2Texture.h
|
||||
source/Irrlicht/COpenGLDriver.h
|
||||
source/Irrlicht/COpenGLExtensionHandler.h
|
||||
source/Irrlicht/COpenGLMaterialRenderer.h
|
||||
source/Irrlicht/COpenGLParallaxMapRenderer.h
|
||||
source/Irrlicht/COpenGLShaderMaterialRenderer.h
|
||||
source/Irrlicht/COpenGLSLMaterialRenderer.h
|
||||
source/Irrlicht/COpenGLTexture.h
|
||||
source/Irrlicht/COSOperator.h
|
||||
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
|
||||
source/Irrlicht/CParticleAttractionAffector.h
|
||||
source/Irrlicht/CParticleBoxEmitter.h
|
||||
source/Irrlicht/CParticleCylinderEmitter.h
|
||||
source/Irrlicht/CParticleFadeOutAffector.h
|
||||
source/Irrlicht/CParticleGravityAffector.h
|
||||
source/Irrlicht/CParticleMeshEmitter.h
|
||||
source/Irrlicht/CParticlePointEmitter.h
|
||||
source/Irrlicht/CParticleRotationAffector.h
|
||||
source/Irrlicht/CMountPointReader.h
|
||||
source/Irrlicht/CIrrDeviceConsole.h
|
||||
source/Irrlicht/CTerrainSceneNode.h
|
||||
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
|
||||
source/Irrlicht/CImageLoaderBMP.h
|
||||
source/Irrlicht/CSkinnedMesh.h
|
||||
source/Irrlicht/COpenGLParallaxMapRenderer.h
|
||||
source/Irrlicht/CParticleRingEmitter.h
|
||||
source/Irrlicht/COpenGLShaderMaterialRenderer.h
|
||||
source/Irrlicht/CImageLoaderPNG.h
|
||||
source/Irrlicht/COctreeTriangleSelector.h
|
||||
source/Irrlicht/COpenGLTexture.h
|
||||
source/Irrlicht/Octree.h
|
||||
source/Irrlicht/os.h
|
||||
source/Irrlicht/CDefaultGUIElementFactory.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
|
||||
source/Irrlicht/CTriangleBBSelector.h
|
||||
source/Irrlicht/S2DVertex.h
|
||||
source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
|
||||
source/Irrlicht/CGUIMessageBox.h
|
||||
source/Irrlicht/CBoneSceneNode.h
|
||||
source/Irrlicht/CGUITable.h
|
||||
source/Irrlicht/CGUIColorSelectDialog.h
|
||||
source/Irrlicht/CCubeSceneNode.h
|
||||
source/Irrlicht/resource.h
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
|
||||
source/Irrlicht/SoftwareDriver2_helper.h
|
||||
source/Irrlicht/CGUIWindow.h
|
||||
source/Irrlicht/dmfsupport.h
|
||||
source/Irrlicht/CGUICheckBox.h
|
||||
source/Irrlicht/CMeshManipulator.h
|
||||
source/Irrlicht/IImagePresenter.h
|
||||
source/Irrlicht/CGUIMeshViewer.h
|
||||
source/Irrlicht/CMeshSceneNode.h
|
||||
source/Irrlicht/CGUIImage.h
|
||||
source/Irrlicht/CCameraSceneNode.h
|
||||
source/Irrlicht/IZBuffer.h
|
||||
source/Irrlicht/CAnimatedMeshSceneNode.h
|
||||
source/Irrlicht/CGUIStaticText.h
|
||||
source/Irrlicht/wglext.h
|
||||
source/Irrlicht/CTimer.h
|
||||
source/Irrlicht/CParticleRotationAffector.h
|
||||
source/Irrlicht/CParticleScaleAffector.h
|
||||
source/Irrlicht/CParticleSphereEmitter.h
|
||||
source/Irrlicht/CParticleSystemSceneNode.h
|
||||
source/Irrlicht/CReadFile.h
|
||||
source/Irrlicht/CSceneCollisionManager.h
|
||||
source/Irrlicht/CSceneManager.h
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
|
||||
source/Irrlicht/CParticleFadeOutAffector.h
|
||||
source/Irrlicht/COpenGLSLMaterialRenderer.h
|
||||
source/Irrlicht/CParticleAttractionAffector.h
|
||||
source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
|
||||
source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
|
||||
source/Irrlicht/CSceneNodeAnimatorDelete.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
|
||||
source/Irrlicht/CSceneNodeAnimatorRotation.h
|
||||
source/Irrlicht/CSceneNodeAnimatorTexture.h
|
||||
source/Irrlicht/CSkinnedMesh.h
|
||||
source/Irrlicht/CSkyBoxSceneNode.h
|
||||
source/Irrlicht/CSkyDomeSceneNode.h
|
||||
source/Irrlicht/CSphereSceneNode.h
|
||||
source/Irrlicht/CTarReader.h
|
||||
source/Irrlicht/CTerrainSceneNode.h
|
||||
source/Irrlicht/CTerrainTriangleSelector.h
|
||||
source/Irrlicht/CTextSceneNode.h
|
||||
source/Irrlicht/CTimer.h
|
||||
source/Irrlicht/CTriangleBBSelector.h
|
||||
source/Irrlicht/CTriangleSelector.h
|
||||
source/Irrlicht/CVideoModeList.h
|
||||
source/Irrlicht/CWaterSurfaceSceneNode.h
|
||||
source/Irrlicht/CWriteFile.h
|
||||
source/Irrlicht/CXMLReader.h
|
||||
source/Irrlicht/CXMLReaderImpl.h
|
||||
source/Irrlicht/CXMLWriter.h
|
||||
source/Irrlicht/CZBuffer.h
|
||||
source/Irrlicht/CZipReader.h
|
||||
source/Irrlicht/dmfsupport.h
|
||||
source/Irrlicht/gles2-ext.h
|
||||
source/Irrlicht/glext.h
|
||||
source/Irrlicht/glxext.h
|
||||
source/Irrlicht/IAttribute.h
|
||||
source/Irrlicht/IImagePresenter.h
|
||||
source/Irrlicht/ISceneNodeAnimatorFinishing.h
|
||||
source/Irrlicht/ITriangleRenderer.h
|
||||
source/Irrlicht/IZBuffer.h
|
||||
source/Irrlicht/MacOSX/AppDelegate.h
|
||||
source/Irrlicht/MacOSX/CIrrDeviceMacOSX.h
|
||||
source/Irrlicht/MacOSX/OSXClipboard.h
|
||||
source/Irrlicht/CSceneManager.h
|
||||
source/Irrlicht/COpenGLDriver.h
|
||||
source/Irrlicht/CGUIComboBox.h
|
||||
source/Irrlicht/CSceneCollisionManager.h
|
||||
source/Irrlicht/ISceneNodeAnimatorFinishing.h
|
||||
source/Irrlicht/CGUITabControl.h
|
||||
source/Irrlicht/CSphereSceneNode.h
|
||||
source/Irrlicht/CIrrDeviceStub.h
|
||||
source/Irrlicht/CDummyTransformationSceneNode.h
|
||||
source/Irrlicht/CParticleBoxEmitter.h
|
||||
source/Irrlicht/COctreeSceneNode.h
|
||||
source/Irrlicht/CReadFile.h
|
||||
source/Irrlicht/COSOperator.h
|
||||
source/Irrlicht/CLightSceneNode.h
|
||||
source/Irrlicht/CParticleSphereEmitter.h
|
||||
source/Irrlicht/CZBuffer.h
|
||||
source/Irrlicht/CImage.h
|
||||
source/Irrlicht/CIrrDeviceWin32.h
|
||||
source/Irrlicht/CGUIEditBox.h
|
||||
source/Irrlicht/CGUISpriteBank.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
|
||||
source/Irrlicht/COpenGLExtensionHandler.h
|
||||
source/Irrlicht/CGUIScrollBar.h
|
||||
source/Irrlicht/CTriangleSelector.h
|
||||
source/Irrlicht/CParticleGravityAffector.h
|
||||
source/Irrlicht/CGUIModalScreen.h
|
||||
source/Irrlicht/CDefaultSceneNodeFactory.h
|
||||
source/Irrlicht/CXMLReaderImpl.h
|
||||
source/Irrlicht/COpenGLMaterialRenderer.h
|
||||
source/Irrlicht/CVideoModeList.h
|
||||
source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
|
||||
source/Irrlicht/CColorConverter.h
|
||||
source/Irrlicht/CWaterSurfaceSceneNode.h
|
||||
source/Irrlicht/SoftwareDriver2_compile_config.h
|
||||
source/Irrlicht/CSceneNodeAnimatorTexture.h
|
||||
source/Irrlicht/CXMLReader.h
|
||||
source/Irrlicht/CEmptySceneNode.h
|
||||
source/Irrlicht/CParticleSystemSceneNode.h
|
||||
source/Irrlicht/CImageWriterPNG.h
|
||||
source/Irrlicht/CParticleScaleAffector.h
|
||||
source/Irrlicht/CImageLoaderJPG.h
|
||||
source/Irrlicht/CBillboardSceneNode.h
|
||||
source/Irrlicht/CIrrDeviceSDL.h
|
||||
source/Irrlicht/CSkyDomeSceneNode.h
|
||||
source/Irrlicht/CGUIInOutFader.h
|
||||
source/Irrlicht/CGUIFont.h
|
||||
source/Irrlicht/CGUIImageList.h
|
||||
source/Irrlicht/CFileSystem.h
|
||||
source/Irrlicht/CSceneNodeAnimatorRotation.h
|
||||
source/Irrlicht/CGUISkin.h
|
||||
source/Irrlicht/Octree.h
|
||||
source/Irrlicht/os.h
|
||||
source/Irrlicht/resource.h
|
||||
source/Irrlicht/S2DVertex.h
|
||||
source/Irrlicht/S4DVertex.h
|
||||
source/Irrlicht/CGUIMenu.h
|
||||
source/Irrlicht/CBlit.h
|
||||
source/Irrlicht/CZipReader.h
|
||||
source/Irrlicht/CGUIToolBar.h
|
||||
source/Irrlicht/CImageWriterJPG.h
|
||||
source/Irrlicht/IAttribute.h
|
||||
source/Irrlicht/CNullDriver.h
|
||||
source/Irrlicht/CWriteFile.h
|
||||
source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
|
||||
source/Irrlicht/glxext.h
|
||||
source/Irrlicht/CMetaTriangleSelector.h
|
||||
source/Irrlicht/CTarReader.h
|
||||
source/Irrlicht/CXMLWriter.h
|
||||
source/Irrlicht/CParticleCylinderEmitter.h
|
||||
source/Irrlicht/ITriangleRenderer.h
|
||||
source/Irrlicht/CSceneNodeAnimatorDelete.h
|
||||
source/Irrlicht/CIrrDeviceFB.h
|
||||
source/Irrlicht/CGUIEnvironment.h
|
||||
source/Irrlicht/CTerrainTriangleSelector.h
|
||||
source/Irrlicht/CAttributeImpl.h
|
||||
source/Irrlicht/CGeometryCreator.h
|
||||
source/Irrlicht/CSkyBoxSceneNode.h
|
||||
source/Irrlicht/CImageWriterBMP.h
|
||||
source/Irrlicht/BuiltInFont.h
|
||||
source/Irrlicht/CMemoryFile.h
|
||||
source/Irrlicht/CFPSCounter.h
|
||||
source/Irrlicht/CGUITreeView.h
|
||||
source/Irrlicht/CGUIContextMenu.h
|
||||
source/Irrlicht/CFileList.h
|
||||
source/Irrlicht/CLimitReadFile.h
|
||||
source/Irrlicht/CGUISpinBox.h
|
||||
source/Irrlicht/CGUIButton.h
|
||||
source/Irrlicht/CGUIListBox.h
|
||||
source/Irrlicht/CGUIFileOpenDialog.h
|
||||
source/Irrlicht/CTextSceneNode.h
|
||||
source/Irrlicht/SoftwareDriver2_compile_config.h
|
||||
source/Irrlicht/SoftwareDriver2_helper.h
|
||||
source/Irrlicht/wglext.h
|
||||
|
||||
include/ESceneNodeAnimatorTypes.h
|
||||
include/IParticleGravityAffector.h
|
||||
include/IGUIFontBitmap.h
|
||||
include/IEventReceiver.h
|
||||
include/EMessageBoxFlags.h
|
||||
include/IParticleSphereEmitter.h
|
||||
include/IParticleFadeOutAffector.h
|
||||
include/IGeometryCreator.h
|
||||
include/IGUIEnvironment.h
|
||||
include/irrunpack.h
|
||||
include/IParticleRingEmitter.h
|
||||
include/IGUIElement.h
|
||||
include/IMaterialRenderer.h
|
||||
include/SVertexIndex.h
|
||||
include/SMaterialLayer.h
|
||||
include/irrMap.h
|
||||
include/EMaterialTypes.h
|
||||
include/IAnimatedMeshSceneNode.h
|
||||
include/IParticleCylinderEmitter.h
|
||||
include/IAttributeExchangingObject.h
|
||||
include/IVertexBuffer.h
|
||||
include/ISkinnedMesh.h
|
||||
include/irrList.h
|
||||
include/SAnimatedMesh.h
|
||||
include/IGUITreeView.h
|
||||
include/IGUIFont.h
|
||||
include/IGUIElementFactory.h
|
||||
include/IParticleSystemSceneNode.h
|
||||
include/ITerrainSceneNode.h
|
||||
include/SMeshBuffer.h
|
||||
include/IGUIEditBox.h
|
||||
include/ILogger.h
|
||||
include/ILightManager.h
|
||||
include/IMeshBuffer.h
|
||||
include/irrlicht.h
|
||||
include/ITimer.h
|
||||
include/IImage.h
|
||||
include/position2d.h
|
||||
include/IGUIToolbar.h
|
||||
include/IGUISpinBox.h
|
||||
include/IGUITabControl.h
|
||||
include/IBillboardTextSceneNode.h
|
||||
include/IGUIInOutFader.h
|
||||
include/path.h
|
||||
include/IMetaTriangleSelector.h
|
||||
include/ISceneUserDataSerializer.h
|
||||
include/irrArray.h
|
||||
include/irrString.h
|
||||
include/IMesh.h
|
||||
include/line3d.h
|
||||
include/IMeshLoader.h
|
||||
include/aabbox3d.h
|
||||
include/CMeshBuffer.h
|
||||
include/ETerrainElements.h
|
||||
include/EDebugSceneTypes.h
|
||||
include/driverChoice.h
|
||||
include/IParticleAttractionAffector.h
|
||||
include/IGUISpriteBank.h
|
||||
include/IGUISkin.h
|
||||
include/irrAllocator.h
|
||||
include/IDummyTransformationSceneNode.h
|
||||
include/SSkinMeshBuffer.h
|
||||
include/ISceneLoader.h
|
||||
include/IrrlichtDevice.h
|
||||
include/IMaterialRendererServices.h
|
||||
include/SColor.h
|
||||
include/IXMLWriter.h
|
||||
include/CDynamicMeshBuffer.h
|
||||
include/IFileArchive.h
|
||||
include/IGUIContextMenu.h
|
||||
include/IVideoDriver.h
|
||||
include/irrMath.h
|
||||
include/ISceneNode.h
|
||||
include/line2d.h
|
||||
include/irrpack.h
|
||||
include/plane3d.h
|
||||
include/ISceneManager.h
|
||||
include/IImageWriter.h
|
||||
include/EGUIElementTypes.h
|
||||
include/IParticleMeshEmitter.h
|
||||
include/IGUIColorSelectDialog.h
|
||||
include/IGUIImage.h
|
||||
include/IGUIListBox.h
|
||||
include/vector2d.h
|
||||
include/CIndexBuffer.h
|
||||
include/IAnimatedMesh.h
|
||||
include/SMaterial.h
|
||||
include/rect.h
|
||||
include/EDriverFeatures.h
|
||||
include/IVideoModeList.h
|
||||
include/fast_atof.h
|
||||
include/IGUICheckBox.h
|
||||
include/ISceneNodeAnimatorFactory.h
|
||||
include/SVertexManipulator.h
|
||||
include/ITextSceneNode.h
|
||||
include/IDynamicMeshBuffer.h
|
||||
include/SExposedVideoData.h
|
||||
include/IReferenceCounted.h
|
||||
include/irrXML.h
|
||||
include/SKeyMap.h
|
||||
include/ECullingTypes.h
|
||||
include/IBillboardSceneNode.h
|
||||
include/ITriangleSelector.h
|
||||
include/CMeshBuffer.h
|
||||
include/coreutil.h
|
||||
include/SMeshBufferTangents.h
|
||||
include/ILightSceneNode.h
|
||||
include/dimension2d.h
|
||||
include/ISceneCollisionManager.h
|
||||
include/heapsort.h
|
||||
include/IGUIComboBox.h
|
||||
include/Keycodes.h
|
||||
include/SParticle.h
|
||||
include/EDriverTypes.h
|
||||
include/IFileSystem.h
|
||||
include/SMesh.h
|
||||
include/IParticleAffector.h
|
||||
include/IGUIImageList.h
|
||||
include/EShaderTypes.h
|
||||
include/SceneParameters.h
|
||||
include/IGUIScrollBar.h
|
||||
include/IImageLoader.h
|
||||
include/IParticleBoxEmitter.h
|
||||
include/ICursorControl.h
|
||||
include/ICameraSceneNode.h
|
||||
include/ISceneNodeAnimatorCameraMaya.h
|
||||
include/IMeshManipulator.h
|
||||
include/CVertexBuffer.h
|
||||
include/SSharedMeshBuffer.h
|
||||
include/vector3d.h
|
||||
include/ISceneNodeAnimatorCameraFPS.h
|
||||
include/IGUIMeshViewer.h
|
||||
include/triangle3d.h
|
||||
include/matrix4.h
|
||||
include/IGUIStaticText.h
|
||||
include/IMeshWriter.h
|
||||
include/IMeshSceneNode.h
|
||||
include/IParticleAnimatedMeshSceneNodeEmitter.h
|
||||
include/IMeshCache.h
|
||||
include/EMeshWriterEnums.h
|
||||
include/EPrimitiveTypes.h
|
||||
include/SViewFrustum.h
|
||||
include/IXMLReader.h
|
||||
include/EHardwareBufferFlags.h
|
||||
include/IOSOperator.h
|
||||
include/IGPUProgrammingServices.h
|
||||
include/IrrCompileConfig.h
|
||||
include/ISceneNodeFactory.h
|
||||
include/IGUITable.h
|
||||
include/IGUIButton.h
|
||||
include/EMaterialFlags.h
|
||||
include/EDeviceTypes.h
|
||||
include/IGUIWindow.h
|
||||
include/dimension2d.h
|
||||
include/driverChoice.h
|
||||
include/EAttributes.h
|
||||
include/S3DVertex.h
|
||||
include/ISceneNodeAnimatorCollisionResponse.h
|
||||
include/IWriteFile.h
|
||||
include/irrTypes.h
|
||||
include/IParticleEmitter.h
|
||||
include/quaternion.h
|
||||
include/SLight.h
|
||||
include/IReadFile.h
|
||||
include/ESceneNodeTypes.h
|
||||
include/IIndexBuffer.h
|
||||
include/ECullingTypes.h
|
||||
include/EDebugSceneTypes.h
|
||||
include/EDeviceTypes.h
|
||||
include/EDriverFeatures.h
|
||||
include/EDriverTypes.h
|
||||
include/EGUIAlignment.h
|
||||
include/SIrrCreationParameters.h
|
||||
include/IFileList.h
|
||||
include/SMeshBufferLightMap.h
|
||||
include/IRandomizer.h
|
||||
include/ISceneNodeAnimator.h
|
||||
include/EGUIElementTypes.h
|
||||
include/EHardwareBufferFlags.h
|
||||
include/EMaterialFlags.h
|
||||
include/EMaterialTypes.h
|
||||
include/EMeshWriterEnums.h
|
||||
include/EMessageBoxFlags.h
|
||||
include/EPrimitiveTypes.h
|
||||
include/ESceneNodeAnimatorTypes.h
|
||||
include/ESceneNodeTypes.h
|
||||
include/EShaderTypes.h
|
||||
include/ETerrainElements.h
|
||||
include/EVertexAttributes.h
|
||||
include/fast_atof.h
|
||||
include/heapsort.h
|
||||
include/IAnimatedMesh.h
|
||||
include/IAnimatedMeshSceneNode.h
|
||||
include/IAttributeExchangingObject.h
|
||||
include/IAttributes.h
|
||||
include/IParticleRotationAffector.h
|
||||
include/IGUIFileOpenDialog.h
|
||||
include/IBillboardSceneNode.h
|
||||
include/IBillboardTextSceneNode.h
|
||||
include/IBoneSceneNode.h
|
||||
include/ICameraSceneNode.h
|
||||
include/ICursorControl.h
|
||||
include/IDummyTransformationSceneNode.h
|
||||
include/IDynamicMeshBuffer.h
|
||||
include/IEventReceiver.h
|
||||
include/IFileArchive.h
|
||||
include/IFileList.h
|
||||
include/IFileSystem.h
|
||||
include/IGeometryCreator.h
|
||||
include/IGPUProgrammingServices.h
|
||||
include/IGUIButton.h
|
||||
include/IGUICheckBox.h
|
||||
include/IGUIColorSelectDialog.h
|
||||
include/IGUIComboBox.h
|
||||
include/IGUIContextMenu.h
|
||||
include/IGUIEditBox.h
|
||||
include/IGUIElementFactory.h
|
||||
include/IGUIElement.h
|
||||
include/IGUIEnvironment.h
|
||||
include/IGUIFileOpenDialog.h
|
||||
include/IGUIFontBitmap.h
|
||||
include/IGUIFont.h
|
||||
include/IGUIImage.h
|
||||
include/IGUIImageList.h
|
||||
include/IGUIInOutFader.h
|
||||
include/IGUIListBox.h
|
||||
include/IGUIMeshViewer.h
|
||||
include/IGUIScrollBar.h
|
||||
include/IGUISkin.h
|
||||
include/IGUISpinBox.h
|
||||
include/IGUISpriteBank.h
|
||||
include/IGUIStaticText.h
|
||||
include/IGUITabControl.h
|
||||
include/IGUITable.h
|
||||
include/IGUIToolbar.h
|
||||
include/IGUITreeView.h
|
||||
include/IGUIWindow.h
|
||||
include/IImage.h
|
||||
include/IImageLoader.h
|
||||
include/IImageWriter.h
|
||||
include/IIndexBuffer.h
|
||||
include/ILightManager.h
|
||||
include/ILightSceneNode.h
|
||||
include/ILogger.h
|
||||
include/IMaterialRenderer.h
|
||||
include/IMaterialRendererServices.h
|
||||
include/IMeshBuffer.h
|
||||
include/IMeshCache.h
|
||||
include/IMesh.h
|
||||
include/IMeshLoader.h
|
||||
include/IMeshManipulator.h
|
||||
include/IMeshSceneNode.h
|
||||
include/IMeshWriter.h
|
||||
include/IMetaTriangleSelector.h
|
||||
include/IOSOperator.h
|
||||
include/IParticleAffector.h
|
||||
include/IParticleAnimatedMeshSceneNodeEmitter.h
|
||||
include/IParticleAttractionAffector.h
|
||||
include/IParticleBoxEmitter.h
|
||||
include/IParticleCylinderEmitter.h
|
||||
include/IParticleEmitter.h
|
||||
include/IParticleFadeOutAffector.h
|
||||
include/IParticleGravityAffector.h
|
||||
include/IParticleMeshEmitter.h
|
||||
include/IParticleRingEmitter.h
|
||||
include/IParticleRotationAffector.h
|
||||
include/IParticleSphereEmitter.h
|
||||
include/IParticleSystemSceneNode.h
|
||||
include/IRandomizer.h
|
||||
include/IReadFile.h
|
||||
include/IReferenceCounted.h
|
||||
include/irrAllocator.h
|
||||
include/irrArray.h
|
||||
include/IrrCompileConfig.h
|
||||
include/IrrlichtDevice.h
|
||||
include/irrlicht.h
|
||||
include/irrList.h
|
||||
include/irrMap.h
|
||||
include/irrMath.h
|
||||
include/irrpack.h
|
||||
include/irrString.h
|
||||
include/irrTypes.h
|
||||
include/irrunpack.h
|
||||
include/irrXML.h
|
||||
include/ISceneCollisionManager.h
|
||||
include/ISceneLoader.h
|
||||
include/ISceneManager.h
|
||||
include/ISceneNodeAnimatorCameraFPS.h
|
||||
include/ISceneNodeAnimatorCameraMaya.h
|
||||
include/ISceneNodeAnimatorCollisionResponse.h
|
||||
include/ISceneNodeAnimatorFactory.h
|
||||
include/ISceneNodeAnimator.h
|
||||
include/ISceneNodeFactory.h
|
||||
include/ISceneNode.h
|
||||
include/ISceneUserDataSerializer.h
|
||||
include/IShaderConstantSetCallBack.h
|
||||
include/ISkinnedMesh.h
|
||||
include/ITerrainSceneNode.h
|
||||
include/ITextSceneNode.h
|
||||
include/ITexture.h
|
||||
include/ITimer.h
|
||||
include/ITriangleSelector.h
|
||||
include/IVertexBuffer.h
|
||||
include/IVideoDriver.h
|
||||
include/IVideoModeList.h
|
||||
include/IWriteFile.h
|
||||
include/IXMLReader.h
|
||||
include/IXMLWriter.h
|
||||
include/Keycodes.h
|
||||
include/line2d.h
|
||||
include/line3d.h
|
||||
include/matrix4.h
|
||||
include/path.h
|
||||
include/plane3d.h
|
||||
include/position2d.h
|
||||
include/quaternion.h
|
||||
include/rect.h
|
||||
include/S3DVertex.h
|
||||
include/SAnimatedMesh.h
|
||||
include/SceneParameters.h
|
||||
include/SColor.h
|
||||
include/SExposedVideoData.h
|
||||
include/SIrrCreationParameters.h
|
||||
include/SKeyMap.h
|
||||
include/SLight.h
|
||||
include/SMaterial.h
|
||||
include/SMaterialLayer.h
|
||||
include/SMeshBuffer.h
|
||||
include/SMeshBufferLightMap.h
|
||||
include/SMeshBufferTangents.h
|
||||
include/SMesh.h
|
||||
include/SParticle.h
|
||||
include/SSharedMeshBuffer.h
|
||||
include/SSkinMeshBuffer.h
|
||||
include/SVertexIndex.h
|
||||
include/SVertexManipulator.h
|
||||
include/SViewFrustum.h
|
||||
include/triangle3d.h
|
||||
include/utfwrapping.h
|
||||
include/vector2d.h
|
||||
include/vector3d.h
|
||||
)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(IRRLICHT_SOURCES
|
||||
${IRRLICHT_SOURCES}
|
||||
|
@ -28,6 +28,10 @@ namespace irr
|
||||
//! A device native to Mac OSX
|
||||
/** This device uses Apple's Cocoa API and works in Mac OSX 10.2 and above. */
|
||||
EIDT_OSX,
|
||||
|
||||
//! A device native to the IPhone/IPod touch
|
||||
/** This device should be used with the OpenGL-ES driver. */
|
||||
EIDT_IPHONE,
|
||||
|
||||
//! A device which uses Simple DirectMedia Layer
|
||||
/** The SDL device works under all platforms supported by SDL but first must be compiled
|
||||
@ -51,7 +55,13 @@ namespace irr
|
||||
to your operating system. If this is unavailable then the X11, SDL and then console device
|
||||
will be tried. This ensures that Irrlicht will run even if your platform is unsupported,
|
||||
although it may not be able to render anything. */
|
||||
EIDT_BEST
|
||||
EIDT_BEST,
|
||||
|
||||
//! A device for Android platforms
|
||||
/** Best used with embedded devices and mobile systems.
|
||||
Does not need X11 or other graphical subsystems.
|
||||
May support hw-acceleration via OpenGL-ES */
|
||||
EIDT_ANDROID,
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
@ -118,8 +118,8 @@ namespace video
|
||||
//! Support for texture coord transformation via texture matrix
|
||||
EVDF_TEXTURE_MATRIX,
|
||||
|
||||
//! Support for NVidia's CG shader language
|
||||
EVDF_CG,
|
||||
//! Support for DXTn compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_DXT,
|
||||
|
||||
//! Only used for counting the elements of this enum
|
||||
EVDF_COUNT
|
||||
|
@ -51,6 +51,13 @@ namespace video
|
||||
/** Performs hardware accelerated rendering of 3D and 2D
|
||||
primitives. */
|
||||
EDT_OPENGL,
|
||||
|
||||
//! OpenGL-ES 1.x driver, for embedded and mobile systems
|
||||
EDT_OGLES1,
|
||||
|
||||
//! OpenGL-ES 2.x driver, for embedded and mobile systems
|
||||
/** Supports shaders etc. */
|
||||
EDT_OGLES2,
|
||||
|
||||
//! No driver, just for counting the elements
|
||||
EDT_COUNT
|
||||
|
38
lib/irrlicht/include/EVertexAttributes.h
Normal file
38
lib/irrlicht/include/EVertexAttributes.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef __E_VERTEX_ATTRIBUTES_H_INCLUDED__
|
||||
#define __E_VERTEX_ATTRIBUTES_H_INCLUDED__
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Enumeration for all vertex attibutes there are.
|
||||
enum E_VERTEX_ATTRIBUTES
|
||||
{
|
||||
EVA_POSITION = 0,
|
||||
EVA_NORMAL,
|
||||
EVA_COLOR,
|
||||
EVA_TCOORD0,
|
||||
EVA_TCOORD1,
|
||||
EVA_TANGENT,
|
||||
EVA_BINORMAL,
|
||||
EVA_COUNT
|
||||
};
|
||||
|
||||
//! Array holding the built in vertex attribute names
|
||||
const char* const sBuiltInVertexAttributeNames[] =
|
||||
{
|
||||
"inVertexPosition",
|
||||
"inVertexNormal",
|
||||
"inVertexColor",
|
||||
"inTexCoord0",
|
||||
"inTexCoord1",
|
||||
"inVertexTangent",
|
||||
"inVertexBinormal",
|
||||
0
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif //__E_VERTEX_ATTRIBUTES_H_INCLUDED__
|
@ -33,6 +33,18 @@ namespace irr
|
||||
/** Like mouse events, keyboard events are created by the device and passed to
|
||||
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
|
||||
EET_KEY_INPUT_EVENT,
|
||||
|
||||
//! A multi touch event.
|
||||
EET_MULTI_TOUCH_EVENT,
|
||||
|
||||
//! A accelerometer event.
|
||||
EET_ACCELEROMETER_EVENT,
|
||||
|
||||
//! A gyroscope event.
|
||||
EET_GYROSCOPE_EVENT,
|
||||
|
||||
//! A device motion event.
|
||||
EET_DEVICE_MOTION_EVENT,
|
||||
|
||||
//! A joystick (joypad, gamepad) input event.
|
||||
/** Joystick events are created by polling all connected joysticks once per
|
||||
@ -163,6 +175,25 @@ namespace irr
|
||||
EIME_FORCE_32_BIT = 0x7fffffff
|
||||
};
|
||||
#endif
|
||||
|
||||
//! Enumeration for all touch input events
|
||||
enum EMULTI_TOUCH_INPUT_EVENT
|
||||
{
|
||||
//! Max multi touch count
|
||||
NUMBER_OF_MULTI_TOUCHES = 10,
|
||||
|
||||
//! Touch was pressed down.
|
||||
EMTIE_PRESSED_DOWN = 0,
|
||||
|
||||
//! Touch was left up.
|
||||
EMTIE_LEFT_UP,
|
||||
|
||||
//! The touch changed its position.
|
||||
EMTIE_MOVED,
|
||||
|
||||
//! No real event. Just for convenience to get number of events
|
||||
EMTIE_COUNT
|
||||
};
|
||||
|
||||
namespace gui
|
||||
{
|
||||
@ -352,6 +383,97 @@ struct SEvent
|
||||
//! True if ctrl was also pressed
|
||||
bool Control:1;
|
||||
};
|
||||
|
||||
//! Any kind of multi touch event.
|
||||
struct SMultiTouchInput
|
||||
{
|
||||
//! A helper function to check if a button is pressed.
|
||||
u32 touchedCount() const
|
||||
{
|
||||
u32 count = 0;
|
||||
|
||||
for (u16 i = 0; i < NUMBER_OF_MULTI_TOUCHES; ++i)
|
||||
{
|
||||
if (Touched[i])
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
//! Reset variables.
|
||||
void clear()
|
||||
{
|
||||
for (u16 i = 0; i < NUMBER_OF_MULTI_TOUCHES; ++i)
|
||||
{
|
||||
Touched[i] = 0;
|
||||
X[i] = 0;
|
||||
Y[i] = 0;
|
||||
PrevX[i] = 0;
|
||||
PrevY[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Status of simple touch.
|
||||
u8 Touched[NUMBER_OF_MULTI_TOUCHES];
|
||||
|
||||
// X position of simple touch.
|
||||
s32 X[NUMBER_OF_MULTI_TOUCHES];
|
||||
|
||||
// Y position of simple touch.
|
||||
s32 Y[NUMBER_OF_MULTI_TOUCHES];
|
||||
|
||||
// Previous X position of simple touch.
|
||||
s32 PrevX[NUMBER_OF_MULTI_TOUCHES];
|
||||
|
||||
// Previous Y position of simple touch.
|
||||
s32 PrevY[NUMBER_OF_MULTI_TOUCHES];
|
||||
|
||||
//! Type of multi touch event
|
||||
EMULTI_TOUCH_INPUT_EVENT Event;
|
||||
};
|
||||
|
||||
//! Any kind of accelerometer event.
|
||||
struct SAccelerometerEvent
|
||||
{
|
||||
|
||||
// X acceleration.
|
||||
f64 X;
|
||||
|
||||
// Y acceleration.
|
||||
f64 Y;
|
||||
|
||||
// Z acceleration.
|
||||
f64 Z;
|
||||
};
|
||||
|
||||
//! Any kind of gyroscope event.
|
||||
struct SGyroscopeEvent
|
||||
{
|
||||
|
||||
// X rotation.
|
||||
f64 X;
|
||||
|
||||
// Y rotation.
|
||||
f64 Y;
|
||||
|
||||
// Z rotation.
|
||||
f64 Z;
|
||||
};
|
||||
|
||||
//! Any kind of device motion event.
|
||||
struct SDeviceMotionEvent
|
||||
{
|
||||
|
||||
// X angle - roll.
|
||||
f64 X;
|
||||
|
||||
// Y angle - pitch.
|
||||
f64 Y;
|
||||
|
||||
// Z angle - yaw.
|
||||
f64 Z;
|
||||
};
|
||||
|
||||
//! A joystick event.
|
||||
/** Unlike other events, joystick events represent the result of polling
|
||||
@ -412,7 +534,6 @@ struct SEvent
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! Any kind of log event.
|
||||
struct SLogEvent
|
||||
{
|
||||
@ -447,12 +568,17 @@ struct SEvent
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
EEVENT_TYPE EventType;
|
||||
union
|
||||
{
|
||||
struct SGUIEvent GUIEvent;
|
||||
struct SMouseInput MouseInput;
|
||||
struct SKeyInput KeyInput;
|
||||
struct SMultiTouchInput MultiTouchInput;
|
||||
struct SAccelerometerEvent AccelerometerEvent;
|
||||
struct SGyroscopeEvent GyroscopeEvent;
|
||||
struct SDeviceMotionEvent DeviceMotionEvent;
|
||||
struct SJoystickEvent JoystickEvent;
|
||||
struct SLogEvent LogEvent;
|
||||
struct SUserEvent UserEvent;
|
||||
|
@ -45,6 +45,9 @@ enum E_FILE_ARCHIVE_TYPE
|
||||
//! A wad Archive, Quake2, Halflife
|
||||
EFAT_WAD = MAKE_IRR_ID('W','A','D', 0),
|
||||
|
||||
//! An Android asset file archive
|
||||
EFAT_ANDROID_ASSET = MAKE_IRR_ID('A','S','S','E'),
|
||||
|
||||
//! The type of this archive is unknown
|
||||
EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n')
|
||||
};
|
||||
|
@ -37,6 +37,11 @@ public:
|
||||
virtual void setBasicRenderStates(const SMaterial& material,
|
||||
const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates) = 0;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
//! Return an index constant for the vertex shader based on a name.
|
||||
virtual s32 getVertexShaderConstantID(const c8* name) = 0;
|
||||
#endif
|
||||
|
||||
//! Sets a constant for the vertex shader based on a name.
|
||||
/** This can be used if you used a high level shader language like GLSL
|
||||
@ -63,13 +68,23 @@ public:
|
||||
\param count Amount of floats in array.
|
||||
\return True if successful.
|
||||
*/
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count) = 0;
|
||||
#else
|
||||
virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Bool interface for the above.
|
||||
#ifndef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Int interface for the above.
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count) = 0;
|
||||
#else
|
||||
virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Sets a vertex shader constant.
|
||||
/** Can be used if you created a shader using pixel/vertex shader
|
||||
@ -78,6 +93,11 @@ public:
|
||||
\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;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
//! Return an index constant for the pixel shader based on a name.
|
||||
virtual s32 getPixelShaderConstantID(const c8* name) = 0;
|
||||
#endif
|
||||
|
||||
//! Sets a constant for the pixel shader based on a name.
|
||||
/** This can be used if you used a high level shader language like GLSL
|
||||
@ -87,13 +107,23 @@ public:
|
||||
\param floats Pointer to array of floats
|
||||
\param count Amount of floats in array.
|
||||
\return True if successful. */
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count) = 0;
|
||||
#else
|
||||
virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Bool interface for the above.
|
||||
#ifndef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Int interface for the above.
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count) = 0;
|
||||
#else
|
||||
virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count) = 0;
|
||||
#endif
|
||||
|
||||
//! Sets a pixel shader constant.
|
||||
/** Can be used if you created a shader using pixel/vertex shader
|
||||
@ -102,6 +132,32 @@ public:
|
||||
\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;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
//! \deprecated. This method may be removed by Irrlicht 2.0
|
||||
_IRR_DEPRECATED_ bool setVertexShaderConstant(const c8* name, const f32* floats, int count)
|
||||
{
|
||||
return setVertexShaderConstant(getVertexShaderConstantID(name), floats, count);
|
||||
}
|
||||
|
||||
//! \deprecated. This method may be removed by Irrlicht 2.0
|
||||
_IRR_DEPRECATED_ bool setVertexShaderConstant(const c8* name, const s32* ints, int count)
|
||||
{
|
||||
return setVertexShaderConstant(getVertexShaderConstantID(name), ints, count);
|
||||
}
|
||||
|
||||
//! \deprecated. This method may be removed by Irrlicht 2.0
|
||||
_IRR_DEPRECATED_ bool setPixelShaderConstant(const c8* name, const f32* floats, int count)
|
||||
{
|
||||
return setPixelShaderConstant(getPixelShaderConstantID(name), floats, count);
|
||||
}
|
||||
|
||||
//! \deprecated. This method may be removed by Irrlicht 2.0
|
||||
_IRR_DEPRECATED_ bool setPixelShaderConstant(const c8* name, const s32* ints, int count)
|
||||
{
|
||||
return setPixelShaderConstant(getPixelShaderConstantID(name), ints, count);
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Get pointer to the IVideoDriver interface
|
||||
/** \return Pointer to the IVideoDriver interface */
|
||||
|
@ -24,6 +24,8 @@
|
||||
//! _IRR_LINUX_PLATFORM_ for Linux (it is defined here if no other os is defined)
|
||||
//! _IRR_SOLARIS_PLATFORM_ for Solaris
|
||||
//! _IRR_OSX_PLATFORM_ for Apple systems running OSX
|
||||
//! _IRR_IPHONE_PLATFORM_ for Apple devices running iOS
|
||||
//! _IRR_ANDROID_PLATFORM_ for devices running Android
|
||||
//! _IRR_POSIX_API_ for Posix compatible systems
|
||||
//! Note: PLATFORM defines the OS specific layer, API can group several platforms
|
||||
|
||||
@ -93,11 +95,29 @@
|
||||
#if !defined(MACOSX)
|
||||
#define MACOSX // legacy support
|
||||
#endif
|
||||
#define _IRR_OSX_PLATFORM_
|
||||
#define _IRR_OSX_PLATFORM_ // we only support OSX on these systems
|
||||
|
||||
#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
|
||||
#define _IRR_IPHONE_PLATFORM_
|
||||
#define _IRR_COMPILE_WITH_IPHONE_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_OGLES2_
|
||||
#else
|
||||
#define _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
||||
#if defined(ANDROID)
|
||||
#define _IRR_ANDROID_PLATFORM_
|
||||
#define _IRR_POSIX_API_
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_ANDROID_PLATFORM_)
|
||||
#define _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
#define _IRR_COMPILE_WITH_OGLES2_
|
||||
#define _IRR_COMPILE_ANDROID_ASSET_READER_
|
||||
#endif
|
||||
|
||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_)
|
||||
#ifndef _IRR_SOLARIS_PLATFORM_
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__)
|
||||
#define _IRR_LINUX_PLATFORM_
|
||||
@ -152,11 +172,34 @@ If not defined, Windows Multimedia library is used, which offers also broad supp
|
||||
//! Define _IRR_COMPILE_WITH_OPENGL_ to compile the Irrlicht engine with OpenGL.
|
||||
/** If you do not wish the engine to be compiled with OpenGL, comment this
|
||||
define out. */
|
||||
#if !defined(_IRR_IPHONE_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_)
|
||||
#define _IRR_COMPILE_WITH_OPENGL_
|
||||
#endif
|
||||
#ifdef NO_IRR_COMPILE_WITH_OPENGL_
|
||||
#undef _IRR_COMPILE_WITH_OPENGL_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_OGLES2_ to compile the Irrlicht engine with OpenGL-ES 2.x.
|
||||
/** If you do not wish the engine to be compiled with OpenGL-ES 2.x, comment
|
||||
this define out.
|
||||
You should only use this define if you really need the OpenGL-ES driver, and
|
||||
it should be usually the only HW accelerated one. OpenGL is currently disabled
|
||||
if using this driver, to avoid problems with the ogl-es emulators.
|
||||
*/
|
||||
// #define _IRR_COMPILE_WITH_OGLES2_
|
||||
#ifdef NO_IRR_COMPILE_WITH_OGLES2_
|
||||
#undef _IRR_COMPILE_WITH_OGLES2_
|
||||
#endif
|
||||
#ifndef IRR_OGLES2_SHADER_PATH
|
||||
#ifdef _IRR_COMPILE_WITH_IPHONE_DEVICE_
|
||||
#define IRR_OGLES2_SHADER_PATH ""
|
||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#define IRR_OGLES2_SHADER_PATH "media/Shaders/"
|
||||
#else
|
||||
#define IRR_OGLES2_SHADER_PATH "data/shaders/irrlicht/"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_X11_ to compile the Irrlicht engine with X11 support.
|
||||
/** If you do not wish the engine to be compiled with X11, comment this
|
||||
define out. */
|
||||
@ -169,9 +212,21 @@ define out. */
|
||||
//! Define _IRR_OPENGL_USE_EXTPOINTER_ if the OpenGL renderer should use OpenGL extensions via function pointers.
|
||||
/** On some systems there is no support for the dynamic extension of OpenGL
|
||||
via function pointers such that this has to be undef'ed. */
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
#if !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_SOLARIS_PLATFORM_)
|
||||
#define _IRR_OPENGL_USE_EXTPOINTER_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! Define _IRR_OGLES2_USE_EXTPOINTER_ if the OpenGL-ES 2.x driver should use extensions via function pointers.
|
||||
/** This should usually be enabled, but also depends on the specific
|
||||
architecture. You can simply uncomment the define and recompile.
|
||||
*/
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
#if !defined(_IRR_IPHONE_PLATFORM_)
|
||||
#define _IRR_OGLES2_USE_EXTPOINTER_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//! On some Linux systems the XF86 vidmode extension or X11 RandR are missing. Use these flags
|
||||
//! to remove the dependencies such that Irrlicht will compile on those systems, too.
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "EDeviceTypes.h"
|
||||
#include "dimension2d.h"
|
||||
#include "ILogger.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -48,6 +49,7 @@ namespace irr
|
||||
DriverMultithreaded(false),
|
||||
UsePerformanceTimer(true),
|
||||
ForceLegacyDevice(false),
|
||||
ShadersPath(""),
|
||||
SDK_version_do_not_use(IRRLICHT_SDK_VERSION)
|
||||
{
|
||||
}
|
||||
@ -81,6 +83,8 @@ namespace irr
|
||||
DisplayAdapter = other.DisplayAdapter;
|
||||
UsePerformanceTimer = other.UsePerformanceTimer;
|
||||
ForceLegacyDevice = other.ForceLegacyDevice;
|
||||
ShadersPath = other.ShadersPath;
|
||||
PrivateData = other.PrivateData;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -295,11 +299,23 @@ namespace irr
|
||||
/** opengl 3 context is available.
|
||||
*/
|
||||
bool ForceLegacyDevice;
|
||||
|
||||
//! Specifies custom path for shaders directory.
|
||||
/** Allows to overwrite IRR_OGLES2_SHADER_PATH constant
|
||||
*/
|
||||
core::stringc ShadersPath;
|
||||
|
||||
//! Don't use or change this parameter.
|
||||
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
|
||||
This is needed for sdk version checks. */
|
||||
const c8* const SDK_version_do_not_use;
|
||||
|
||||
//! Define some private data storage.
|
||||
/** Used when platform devices need access to OS specific data structures etc.
|
||||
This is only used for Android at th emoment in order to access the native
|
||||
Java RE. */
|
||||
void *PrivateData;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -358,6 +358,18 @@ void CColorConverter::convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toR5G5B5A1(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
const u16* sB = (const u16*)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB = (*sB<<1)|(*sB>>15);
|
||||
++sB; ++dB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
@ -516,6 +528,30 @@ void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toR8G8B8A8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
const u32* sB = (const u32*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB++ = (*sB<<8) | (*sB>>24);
|
||||
++sB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
const u32* sB = (const u32*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB++ = (*sB&0xff00ff00)|((*sB&0x00ff0000)>>16)|((*sB&0x000000ff)<<16);
|
||||
++sB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
@ -534,6 +570,22 @@ void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* d
|
||||
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[2] = sB[0];
|
||||
dB[1] = sB[1];
|
||||
dB[0] = sB[2];
|
||||
|
||||
sB += 3;
|
||||
dB += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
static void convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G5B5A1(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
|
||||
static void convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
@ -71,9 +72,12 @@ public:
|
||||
static void convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR8G8B8A8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP);
|
||||
|
||||
static void convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
|
@ -63,6 +63,8 @@ namespace irr
|
||||
extern bool useCoreContext;
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceLinux* device);
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io);
|
||||
}
|
||||
} // end namespace irr
|
||||
|
||||
@ -506,6 +508,7 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, bool force_legacy_context)
|
||||
{
|
||||
GLXContext Context;
|
||||
@ -590,6 +593,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig, boo
|
||||
Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
|
||||
return Context;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CIrrDeviceLinux::createWindow()
|
||||
{
|
||||
@ -1138,6 +1142,19 @@ void CIrrDeviceLinux::createDriver()
|
||||
#endif
|
||||
break;
|
||||
|
||||
case video::EDT_OGLES2:
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLLinux.X11Window = window;
|
||||
data.OpenGLLinux.X11Display = display;
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
|
||||
#else
|
||||
os::Printer::log("No OpenGL ES 2.0 support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case video::EDT_DIRECT3D8:
|
||||
case video::EDT_DIRECT3D9:
|
||||
os::Printer::log("This driver is not available in Linux. Try OpenGL or Software renderer.",
|
||||
|
3132
lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp
Normal file
3132
lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp
Normal file
File diff suppressed because it is too large
Load Diff
556
lib/irrlicht/source/Irrlicht/COGLES2Driver.h
Normal file
556
lib/irrlicht/source/Irrlicht/COGLES2Driver.h
Normal file
@ -0,0 +1,556 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_DRIVER_H_INCLUDED__
|
||||
#define __C_OGLES2_DRIVER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#if defined(_IRR_WINDOWS_API_)
|
||||
// include windows headers for HWND
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
#include "MacOSX/CIrrDeviceMacOSX.h"
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include "iOS/CIrrDeviceiOS.h"
|
||||
#endif
|
||||
|
||||
#include "SIrrCreationParameters.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
#include "android_native_app_glue.h"
|
||||
#else
|
||||
#include <EGL/eglplatform.h>
|
||||
#endif
|
||||
|
||||
#include "CNullDriver.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "EDriverFeatures.h"
|
||||
#include "fast_atof.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libEGL.lib")
|
||||
#pragma comment(lib, "libGLESv2.lib")
|
||||
#endif
|
||||
#include "COGLES2ExtensionHandler.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class COGLES2CallBridge;
|
||||
class COGLES2Texture;
|
||||
class COGLES2FixedPipelineRenderer;
|
||||
class COGLES2Renderer2D;
|
||||
class COGLES2NormalMapRenderer;
|
||||
class COGLES2ParallaxMapRenderer;
|
||||
|
||||
class COGLES2Driver : public CNullDriver, public IMaterialRendererServices, public COGLES2ExtensionHandler
|
||||
{
|
||||
friend class COGLES2CallBridge;
|
||||
friend class COGLES2Texture;
|
||||
|
||||
public:
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_COMPILE_WITH_SDL_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_CONSOLE_DEVICE_)
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data,
|
||||
io::IFileSystem* io);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceMacOSX *device);
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data,
|
||||
io::IFileSystem* io, CIrrDeviceIPhone* device);
|
||||
#endif
|
||||
|
||||
//! destructor
|
||||
virtual ~COGLES2Driver();
|
||||
|
||||
//! clears the zbuffer
|
||||
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
|
||||
SColor color=SColor(255, 0, 0, 0),
|
||||
const SExposedVideoData& videoData=SExposedVideoData(),
|
||||
core::rect<s32>* sourceRect=0);
|
||||
|
||||
//! presents the rendered scene on the screen, returns false if failed
|
||||
virtual bool endScene();
|
||||
|
||||
//! sets transformation
|
||||
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat);
|
||||
|
||||
struct SHWBufferLink_opengl : public SHWBufferLink
|
||||
{
|
||||
SHWBufferLink_opengl(const scene::IMeshBuffer *meshBuffer): SHWBufferLink(meshBuffer), vbo_verticesID(0), vbo_indicesID(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
|
||||
virtual bool updateHardwareBuffer(SHWBufferLink *HWBuffer);
|
||||
|
||||
//! Create hardware buffer from mesh
|
||||
virtual SHWBufferLink *createHardwareBuffer(const scene::IMeshBuffer* mb);
|
||||
|
||||
//! Delete hardware buffer (only some drivers can)
|
||||
virtual void deleteHardwareBuffer(SHWBufferLink *HWBuffer);
|
||||
|
||||
//! Draw hardware buffer
|
||||
virtual void drawHardwareBuffer(SHWBufferLink *HWBuffer);
|
||||
|
||||
//! 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);
|
||||
|
||||
void drawVertexPrimitiveList2d3d(const void* vertices, u32 vertexCount,
|
||||
const void* indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType,
|
||||
E_INDEX_TYPE iType = EIT_16BIT, bool threed = true);
|
||||
|
||||
//! queries the features of the driver, returns true if feature is available
|
||||
virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
||||
{
|
||||
return FeatureEnabled[feature] && COGLES2ExtensionHandler::queryFeature(feature);
|
||||
}
|
||||
|
||||
//! Sets a material.
|
||||
virtual void setMaterial(const SMaterial& material);
|
||||
|
||||
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
|
||||
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);
|
||||
|
||||
//! 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);
|
||||
|
||||
//! Draws a part of the texture into the rectangle.
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
//! draw an 2d rectangle
|
||||
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
|
||||
const core::rect<s32>* clip = 0);
|
||||
|
||||
//!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);
|
||||
|
||||
//! Draws a 2d line.
|
||||
virtual void draw2DLine(const core::position2d<s32>& start,
|
||||
const core::position2d<s32>& end,
|
||||
SColor color = SColor(255, 255, 255, 255));
|
||||
|
||||
//! Draws a single pixel
|
||||
virtual void drawPixel(u32 x, u32 y, const SColor & color);
|
||||
|
||||
//! Draws a 3d line.
|
||||
virtual void draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end,
|
||||
SColor color = SColor(255, 255, 255, 255));
|
||||
|
||||
//! Draws a pixel
|
||||
// virtual void drawPixel(u32 x, u32 y, const SColor & color);
|
||||
|
||||
//! Returns the name of the video driver.
|
||||
virtual const wchar_t* getName() const;
|
||||
|
||||
//! deletes all dynamic lights there are
|
||||
virtual void deleteAllDynamicLights();
|
||||
|
||||
//! adds a dynamic light
|
||||
virtual s32 addDynamicLight(const SLight& light);
|
||||
|
||||
//! Turns a dynamic light on or off
|
||||
/** \param lightIndex: the index returned by addDynamicLight
|
||||
\param turnOn: true to turn the light on, false to turn it off */
|
||||
virtual void turnLightOn(s32 lightIndex, bool turnOn);
|
||||
|
||||
//! returns the maximal amount of dynamic lights the device can handle
|
||||
virtual u32 getMaximalDynamicLightAmount() const;
|
||||
|
||||
//! Sets the dynamic ambient light color.
|
||||
virtual void setAmbientLight(const SColorf& color);
|
||||
|
||||
//! return the dynamic ambient light color.
|
||||
const SColorf& getAmbientLight() const;
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const;
|
||||
|
||||
//! Draws a shadow volume into the stencil buffer.
|
||||
virtual void drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail);
|
||||
|
||||
//! 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));
|
||||
|
||||
//! sets a viewport
|
||||
virtual void setViewPort(const core::rect<s32>& area);
|
||||
|
||||
//! Only used internally by the engine
|
||||
virtual void OnResize(const core::dimension2d<u32>& size);
|
||||
|
||||
//! Returns type of video driver
|
||||
virtual E_DRIVER_TYPE getDriverType() const;
|
||||
|
||||
//! get color format of the current color buffer
|
||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||
|
||||
//! Returns the transformation set by setTransform
|
||||
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const;
|
||||
|
||||
//! Can be called by an IMaterialRenderer to make its work easier.
|
||||
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, bool resetAllRenderstates);
|
||||
|
||||
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
||||
virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates);
|
||||
|
||||
//! Get a vertex shader constant index.
|
||||
virtual s32 getVertexShaderConstantID(const c8* name);
|
||||
|
||||
//! Get a pixel shader constant index.
|
||||
virtual s32 getPixelShaderConstantID(const c8* name);
|
||||
|
||||
//! Sets a vertex shader constant.
|
||||
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount = 1);
|
||||
|
||||
//! Sets a pixel shader constant.
|
||||
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount = 1);
|
||||
|
||||
//! Sets a constant for the vertex shader based on an index.
|
||||
virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count);
|
||||
|
||||
//! Int interface for the above.
|
||||
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count);
|
||||
|
||||
//! Sets a constant for the pixel shader based on an index.
|
||||
virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count);
|
||||
|
||||
//! Int interface for the above.
|
||||
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count);
|
||||
|
||||
//! sets the current Texture
|
||||
bool setActiveTexture(u32 stage, const video::ITexture* texture);
|
||||
|
||||
//! check if active texture is not equal null.
|
||||
bool isActiveTexture(u32 stage);
|
||||
|
||||
//! disables all textures beginning with fromStage.
|
||||
bool disableTextures(u32 fromStage = 0);
|
||||
|
||||
//! 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);
|
||||
|
||||
//! 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,
|
||||
E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT);
|
||||
|
||||
//! Returns pointer to the IGPUProgrammingServices interface.
|
||||
virtual IGPUProgrammingServices* getGPUProgrammingServices();
|
||||
|
||||
//! Returns a pointer to the IVideoDriver interface.
|
||||
virtual IVideoDriver* getVideoDriver();
|
||||
|
||||
//! Returns the maximum amount of primitives
|
||||
virtual u32 getMaximalPrimitiveCount() const;
|
||||
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
|
||||
bool clearZBuffer, SColor color);
|
||||
|
||||
//! set or reset special render targets
|
||||
// virtual bool setRenderTarget(video::E_RENDER_TARGET target, bool clearTarget,
|
||||
// bool clearZBuffer, SColor color);
|
||||
|
||||
//! Sets multiple render targets
|
||||
// virtual bool setRenderTarget(const core::array<video::IRenderTarget>& texture,
|
||||
// bool clearBackBuffer=true, bool clearZBuffer=true, SColor color=SColor(0,0,0,0));
|
||||
|
||||
//! Clears the ZBuffer.
|
||||
virtual void clearZBuffer();
|
||||
|
||||
//! Returns an image created from the last rendered frame.
|
||||
virtual IImage* createScreenShot(video::ECOLOR_FORMAT format=video::ECF_UNKNOWN, video::E_RENDER_TARGET target=video::ERT_FRAME_BUFFER);
|
||||
|
||||
//! checks if an OpenGL error has happend and prints it
|
||||
bool testGLError();
|
||||
|
||||
//! checks if an OGLES1 error has happend and prints it
|
||||
bool testEGLError();
|
||||
|
||||
//! Set/unset a clipping plane.
|
||||
virtual bool setClipPlane(u32 index, const core::plane3df& plane, bool enable = false);
|
||||
|
||||
//! 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.
|
||||
virtual void enableClipPlane(u32 index, bool enable);
|
||||
|
||||
//! Returns the graphics card vendor name.
|
||||
virtual core::stringc getVendorInfo()
|
||||
{
|
||||
return vendorName;
|
||||
};
|
||||
|
||||
ITexture* createDepthTexture(ITexture* texture, bool shared = true);
|
||||
void removeDepthTexture(ITexture* texture);
|
||||
|
||||
void deleteFramebuffers(s32 n, const u32 *framebuffers);
|
||||
void deleteRenderbuffers(s32 n, const u32 *renderbuffers);
|
||||
|
||||
// returns the current size of the screen or rendertarget
|
||||
virtual const core::dimension2d<u32>& getCurrentRenderTargetSize() const;
|
||||
|
||||
//! Convert E_BLEND_FACTOR to OpenGL equivalent
|
||||
GLenum getGLBlend(E_BLEND_FACTOR factor) const;
|
||||
|
||||
//! Get ZBuffer bits.
|
||||
GLenum getZBufferBits() const;
|
||||
|
||||
//! Get current material.
|
||||
const SMaterial& getCurrentMaterial() const;
|
||||
|
||||
//! Get bridge calls.
|
||||
COGLES2CallBridge* getBridgeCalls() const;
|
||||
|
||||
private:
|
||||
// Bridge calls.
|
||||
COGLES2CallBridge* BridgeCalls;
|
||||
|
||||
void uploadClipPlane(u32 index);
|
||||
|
||||
//! inits the opengl-es driver
|
||||
bool genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer);
|
||||
|
||||
//! returns a device dependent texture from a software surface (IImage)
|
||||
virtual video::ITexture* createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData);
|
||||
|
||||
//! creates a transposed matrix in supplied GLfloat array to pass to OGLES1
|
||||
inline void createGLMatrix(float gl_matrix[16], const core::matrix4& m);
|
||||
|
||||
inline void createGLTextureMatrix(float gl_matrix[16], const core::matrix4& m);
|
||||
|
||||
//! 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);
|
||||
|
||||
void createMaterialRenderers();
|
||||
|
||||
core::stringw Name;
|
||||
core::matrix4 Matrices[ETS_COUNT];
|
||||
|
||||
//! enumeration for rendering modes such as 2d and 3d for minizing 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 to make all renderstates reset if set to true.
|
||||
bool ResetRenderStates;
|
||||
bool Transformation3DChanged;
|
||||
u8 AntiAlias;
|
||||
|
||||
SMaterial Material, LastMaterial;
|
||||
COGLES2Texture* RenderTargetTexture;
|
||||
const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
|
||||
core::array<ITexture*> DepthTextures;
|
||||
|
||||
struct SUserClipPlane
|
||||
{
|
||||
core::plane3df Plane;
|
||||
bool Enabled;
|
||||
};
|
||||
|
||||
core::array<SUserClipPlane> UserClipPlane;
|
||||
|
||||
core::dimension2d<u32> CurrentRendertargetSize;
|
||||
|
||||
core::stringc vendorName;
|
||||
|
||||
core::matrix4 TextureFlipMatrix;
|
||||
|
||||
//! Color buffer format
|
||||
ECOLOR_FORMAT ColorFormat;
|
||||
|
||||
//! All the lights that have been requested; a hardware limited
|
||||
//! number of them will be used at once.
|
||||
struct RequestedLight
|
||||
{
|
||||
RequestedLight(SLight const & lightData)
|
||||
: LightData(lightData), DesireToBeOn(true) { }
|
||||
|
||||
SLight LightData;
|
||||
bool DesireToBeOn;
|
||||
};
|
||||
|
||||
core::array<RequestedLight> RequestedLights;
|
||||
SColorf AmbientLight;
|
||||
|
||||
COGLES2Renderer2D* MaterialRenderer2D;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
HDC HDc;
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
CIrrDeviceIPhone* Device;
|
||||
GLuint ViewFramebuffer;
|
||||
GLuint ViewRenderbuffer;
|
||||
GLuint ViewDepthRenderbuffer;
|
||||
#else
|
||||
NativeWindowType EglWindow;
|
||||
void* EglDisplay;
|
||||
void* EglSurface;
|
||||
void* EglContext;
|
||||
#endif
|
||||
|
||||
SIrrlichtCreationParameters Params;
|
||||
};
|
||||
|
||||
//! This bridge between Irlicht pseudo OpenGL calls
|
||||
//! and true OpenGL calls.
|
||||
|
||||
class COGLES2CallBridge
|
||||
{
|
||||
public:
|
||||
COGLES2CallBridge(COGLES2Driver* driver);
|
||||
|
||||
// Blending calls.
|
||||
|
||||
void setBlendFunc(GLenum source, GLenum destination);
|
||||
|
||||
void setBlend(bool enable);
|
||||
|
||||
// Cull face calls.
|
||||
|
||||
void setCullFaceFunc(GLenum mode);
|
||||
|
||||
void setCullFace(bool enable);
|
||||
|
||||
// Depth calls.
|
||||
|
||||
void setDepthFunc(GLenum mode);
|
||||
|
||||
void setDepthMask(bool enable);
|
||||
|
||||
void setDepthTest(bool enable);
|
||||
|
||||
// Program calls.
|
||||
|
||||
void setProgram(GLuint program);
|
||||
|
||||
// Texture calls.
|
||||
|
||||
void setActiveTexture(GLenum texture);
|
||||
|
||||
void setTexture(u32 stage);
|
||||
|
||||
// Viewport calls.
|
||||
|
||||
void setViewport(const core::rect<s32>& viewport);
|
||||
|
||||
private:
|
||||
COGLES2Driver* Driver;
|
||||
|
||||
GLenum BlendSource;
|
||||
GLenum BlendDestination;
|
||||
bool Blend;
|
||||
|
||||
GLenum CullFaceMode;
|
||||
bool CullFace;
|
||||
|
||||
GLenum DepthFunc;
|
||||
bool DepthMask;
|
||||
bool DepthTest;
|
||||
|
||||
GLuint Program;
|
||||
|
||||
GLenum ActiveTexture;
|
||||
|
||||
const ITexture* Texture[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
core::rect<s32> Viewport;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
#endif
|
||||
|
262
lib/irrlicht/source/Irrlicht/COGLES2ExtensionHandler.cpp
Normal file
262
lib/irrlicht/source/Irrlicht/COGLES2ExtensionHandler.cpp
Normal file
@ -0,0 +1,262 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2ExtensionHandler.h"
|
||||
#include "COGLES2Driver.h"
|
||||
#include "fast_atof.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
static const char* const OGLES2FeatureStrings[COGLES2ExtensionHandler::IRR_OGLES2_Feature_Count] =
|
||||
{
|
||||
"GL_AMD_compressed_3DC_texture",
|
||||
"GL_AMD_compressed_ATC_texture",
|
||||
"GL_AMD_performance_monitor",
|
||||
"GL_AMD_program_binary_Z400",
|
||||
"GL_ANGLE_framebuffer_blit",
|
||||
"GL_ANGLE_framebuffer_multisample",
|
||||
"GL_ANGLE_instanced_arrays",
|
||||
"GL_ANGLE_pack_reverse_row_order",
|
||||
"GL_ANGLE_texture_compression_dxt3",
|
||||
"GL_ANGLE_texture_compression_dxt5",
|
||||
"GL_ANGLE_texture_usage",
|
||||
"GL_ANGLE_translated_shader_source",
|
||||
"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_format_BGRA8888",
|
||||
"GL_APPLE_texture_max_level",
|
||||
"GL_ARB_texture_env_combine",
|
||||
"GL_ARB_texture_env_dot3",
|
||||
"GL_ARM_mali_program_binary",
|
||||
"GL_ARM_mali_shader_binary",
|
||||
"GL_ARM_rgba8",
|
||||
"GL_DMP_shader_binary",
|
||||
"GL_EXT_blend_minmax",
|
||||
"GL_EXT_color_buffer_half_float",
|
||||
"GL_EXT_debug_label",
|
||||
"GL_EXT_debug_marker",
|
||||
"GL_EXT_discard_framebuffer",
|
||||
"GL_EXT_frag_depth",
|
||||
"GL_EXT_map_buffer_range",
|
||||
"GL_EXT_multisampled_render_to_texture",
|
||||
"GL_EXT_multiview_draw_buffers",
|
||||
"GL_EXT_multi_draw_arrays",
|
||||
"GL_EXT_occlusion_query_boolean",
|
||||
"GL_EXT_read_format_bgra",
|
||||
"GL_EXT_robustness",
|
||||
"GL_EXT_separate_shader_objects",
|
||||
"GL_EXT_shader_framebuffer_fetch",
|
||||
"GL_EXT_shader_texture_lod",
|
||||
"GL_EXT_shadow_samplers",
|
||||
"GL_EXT_sRGB",
|
||||
"GL_EXT_texture_compression_dxt1",
|
||||
"GL_EXT_texture_filter_anisotropic",
|
||||
"GL_EXT_texture_format_BGRA8888",
|
||||
"GL_EXT_texture_lod_bias",
|
||||
"GL_EXT_texture_rg",
|
||||
"GL_EXT_texture_storage",
|
||||
"GL_EXT_texture_type_2_10_10_10_REV",
|
||||
"GL_EXT_unpack_subimage",
|
||||
"GL_FJ_shader_binary_GCCSO",
|
||||
"GL_IMG_multisampled_render_to_texture",
|
||||
"GL_IMG_program_binary",
|
||||
"GL_IMG_read_format",
|
||||
"GL_IMG_shader_binary",
|
||||
"GL_IMG_texture_compression_pvrtc",
|
||||
"GL_IMG_texture_env_enhanced_fixed_function",
|
||||
"GL_IMG_texture_format_BGRA8888",
|
||||
"GL_IMG_user_clip_plane",
|
||||
"GL_IMG_vertex_program",
|
||||
"GL_KHR_debug",
|
||||
"GL_KHR_texture_compression_astc_ldr",
|
||||
"GL_NV_coverage_sample",
|
||||
"GL_NV_depth_nonlinear",
|
||||
"GL_NV_draw_buffers",
|
||||
"GL_NV_EGL_stream_consumer_external",
|
||||
"GL_NV_fbo_color_attachments",
|
||||
"GL_NV_fence",
|
||||
"GL_NV_read_buffer",
|
||||
"GL_NV_read_buffer_front",
|
||||
"GL_NV_read_depth",
|
||||
"GL_NV_read_depth_stencil",
|
||||
"GL_NV_read_stencil",
|
||||
"GL_NV_texture_compression_s3tc_update",
|
||||
"GL_NV_texture_npot_2D_mipmap",
|
||||
"GL_OES_blend_equation_separate",
|
||||
"GL_OES_blend_func_separate",
|
||||
"GL_OES_blend_subtract",
|
||||
"GL_OES_byte_coordinates",
|
||||
"GL_OES_compressed_ETC1_RGB8_texture",
|
||||
"GL_OES_compressed_paletted_texture",
|
||||
"GL_OES_depth24",
|
||||
"GL_OES_depth32",
|
||||
"GL_OES_depth_texture",
|
||||
"GL_OES_draw_texture",
|
||||
"GL_OES_EGL_image",
|
||||
"GL_OES_EGL_image_external",
|
||||
"GL_OES_EGL_sync",
|
||||
"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_get_program_binary",
|
||||
"GL_OES_mapbuffer",
|
||||
"GL_OES_matrix_get",
|
||||
"GL_OES_matrix_palette",
|
||||
"GL_OES_packed_depth_stencil",
|
||||
"GL_OES_point_size_array",
|
||||
"GL_OES_point_sprite",
|
||||
"GL_OES_query_matrix",
|
||||
"GL_OES_read_format",
|
||||
"GL_OES_required_internalformat",
|
||||
"GL_OES_rgb8_rgba8",
|
||||
"GL_OES_single_precision",
|
||||
"GL_OES_standard_derivatives",
|
||||
"GL_OES_stencil1",
|
||||
"GL_OES_stencil4",
|
||||
"GL_OES_stencil8",
|
||||
"GL_OES_stencil_wrap",
|
||||
"GL_OES_surfaceless_context",
|
||||
"GL_OES_texture_3D",
|
||||
"GL_OES_texture_cube_map",
|
||||
"GL_OES_texture_env_crossbar",
|
||||
"GL_OES_texture_float",
|
||||
"GL_OES_texture_float_linear",
|
||||
"GL_OES_texture_half_float",
|
||||
"GL_OES_texture_half_float_linear",
|
||||
"GL_OES_texture_mirrored_repeat",
|
||||
"GL_OES_texture_npot",
|
||||
"GL_OES_vertex_array_object",
|
||||
"GL_OES_vertex_half_float",
|
||||
"GL_OES_vertex_type_10_10_10_2",
|
||||
"GL_QCOM_alpha_test",
|
||||
"GL_QCOM_binning_control",
|
||||
"GL_QCOM_driver_control",
|
||||
"GL_QCOM_extended_get",
|
||||
"GL_QCOM_extended_get2",
|
||||
"GL_QCOM_performance_monitor_global_mode",
|
||||
"GL_QCOM_tiled_rendering",
|
||||
"GL_QCOM_writeonly_rendering",
|
||||
"GL_SUN_multi_draw_arrays",
|
||||
"GL_VIV_shader_binary"
|
||||
};
|
||||
|
||||
|
||||
COGLES2ExtensionHandler::COGLES2ExtensionHandler() :
|
||||
EGLVersion(0), Version(0), MaxTextureUnits(0), MaxSupportedTextures(0),
|
||||
MaxAnisotropy(1), MaxTextureSize(1),
|
||||
MaxIndices(0xffff), MaxTextureLODBias(0.f),
|
||||
StencilBuffer(false)
|
||||
{
|
||||
for (u32 i=0; i<IRR_OGLES2_Feature_Count; ++i)
|
||||
FeatureAvailable[i] = false;
|
||||
}
|
||||
|
||||
|
||||
void COGLES2ExtensionHandler::dump() const
|
||||
{
|
||||
for (u32 i=0; i<IRR_OGLES2_Feature_Count; ++i)
|
||||
os::Printer::log(OGLES2FeatureStrings[i], FeatureAvailable[i] ? " true" : " false");
|
||||
}
|
||||
|
||||
|
||||
void COGLES2ExtensionHandler::initExtensions(COGLES2Driver* driver,
|
||||
#ifdef EGL_VERSION_1_0
|
||||
EGLDisplay display,
|
||||
#endif
|
||||
bool withStencil)
|
||||
{
|
||||
#ifdef EGL_VERSION_1_0
|
||||
const f32 egl_ver = core::fast_atof(reinterpret_cast<const c8*>(eglQueryString(display, EGL_VERSION)));
|
||||
EGLVersion = static_cast<u16>(core::floor32(egl_ver)*100+core::round32(core::fract(egl_ver)*10.0f));
|
||||
core::stringc eglExtensions = eglQueryString(display, EGL_EXTENSIONS);
|
||||
os::Printer::log(eglExtensions.c_str());
|
||||
#endif
|
||||
const core::stringc stringVer(glGetString(GL_VERSION));
|
||||
const f32 ogl_ver = core::fast_atof(stringVer.c_str() + 10);
|
||||
Version = static_cast<u16>(core::floor32(ogl_ver) * 100 + core::round32(core::fract(ogl_ver) * 10.0f));
|
||||
core::stringc extensions = glGetString(GL_EXTENSIONS);
|
||||
os::Printer::log(extensions.c_str());
|
||||
|
||||
// typo in the simulator (note the postfixed s)
|
||||
if (extensions.find("GL_IMG_user_clip_planes"))
|
||||
FeatureAvailable[IRR_IMG_user_clip_plane] = true;
|
||||
|
||||
{
|
||||
const u32 size = extensions.size() + 1;
|
||||
c8* str = new c8[size];
|
||||
strncpy(str, extensions.c_str(), extensions.size());
|
||||
str[extensions.size()] = ' ';
|
||||
c8* p = str;
|
||||
|
||||
for (u32 i=0; i<size; ++i)
|
||||
{
|
||||
if (str[i] == ' ')
|
||||
{
|
||||
str[i] = 0;
|
||||
if (*p)
|
||||
for (u32 j=0; j<IRR_OGLES2_Feature_Count; ++j)
|
||||
{
|
||||
if (!strcmp(OGLES2FeatureStrings[j], p))
|
||||
{
|
||||
FeatureAvailable[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p = p + strlen(p) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
GLint val=0;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &val);
|
||||
MaxSupportedTextures = core::min_(MATERIAL_MAX_TEXTURES, static_cast<u32>(val));
|
||||
|
||||
#ifdef GL_EXT_texture_filter_anisotropic
|
||||
if (FeatureAvailable[IRR_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);
|
||||
|
||||
MaxTextureUnits = core::min_(MaxSupportedTextures, static_cast<u8>(MATERIAL_MAX_TEXTURES));
|
||||
}
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
||||
|
263
lib/irrlicht/source/Irrlicht/COGLES2ExtensionHandler.h
Normal file
263
lib/irrlicht/source/Irrlicht/COGLES2ExtensionHandler.h
Normal file
@ -0,0 +1,263 @@
|
||||
// Copyright (C) 2009-2010 Amundis
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// and OpenGL ES driver implemented by Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__
|
||||
#define __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <EGL/egl.h>
|
||||
#include <GLES2/gl2.h>
|
||||
// seems to be missing...
|
||||
typedef char GLchar;
|
||||
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
|
||||
#include "gles2-ext.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "os.h"
|
||||
#include "EDriverFeatures.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class COGLES2Driver;
|
||||
class COGLES2ExtensionHandler
|
||||
{
|
||||
public:
|
||||
enum EOGLES2Features
|
||||
{
|
||||
IRR_AMD_compressed_3DC_texture=0, // 39
|
||||
IRR_AMD_compressed_ATC_texture, // 40
|
||||
IRR_AMD_performance_monitor, // 50
|
||||
IRR_AMD_program_binary_Z400, // 48
|
||||
IRR_ANGLE_framebuffer_blit, // 84
|
||||
IRR_ANGLE_framebuffer_multisample, // 84
|
||||
IRR_ANGLE_instanced_arrays, // 109
|
||||
IRR_ANGLE_pack_reverse_row_order, // 110
|
||||
IRR_ANGLE_texture_compression_dxt3, // 111
|
||||
IRR_ANGLE_texture_compression_dxt5, // 111
|
||||
IRR_ANGLE_texture_usage, // 112
|
||||
IRR_ANGLE_translated_shader_source, // 113
|
||||
IRR_APPLE_copy_texture_levels, // 123
|
||||
IRR_APPLE_framebuffer_multisample, // 78
|
||||
IRR_APPLE_rgb_422, // 76
|
||||
IRR_APPLE_sync, // 124
|
||||
IRR_APPLE_texture_2D_limited_npot, // 59
|
||||
IRR_APPLE_texture_format_BGRA8888, // 79
|
||||
IRR_APPLE_texture_max_level, // 80
|
||||
IRR_ARB_texture_env_combine, //ogl, IMG simulator
|
||||
IRR_ARB_texture_env_dot3, //ogl, IMG simulator
|
||||
IRR_ARM_mali_program_binary, // 120
|
||||
IRR_ARM_mali_shader_binary, // 81
|
||||
IRR_ARM_rgba8, // 82
|
||||
IRR_DMP_shader_binary, // 88
|
||||
IRR_EXT_blend_minmax, // 65
|
||||
IRR_EXT_color_buffer_half_float, // 97
|
||||
IRR_EXT_debug_label, // 98
|
||||
IRR_EXT_debug_marker, // 99
|
||||
IRR_EXT_discard_framebuffer, // 64
|
||||
IRR_EXT_frag_depth, // 86
|
||||
IRR_EXT_map_buffer_range, // 121
|
||||
IRR_EXT_multisampled_render_to_texture, // 106
|
||||
IRR_EXT_multiview_draw_buffers, // 125
|
||||
IRR_EXT_multi_draw_arrays, // 69
|
||||
IRR_EXT_occlusion_query_boolean, // 100
|
||||
IRR_EXT_read_format_bgra, // 66
|
||||
IRR_EXT_robustness, // 107
|
||||
IRR_EXT_separate_shader_objects, // 101
|
||||
IRR_EXT_shader_framebuffer_fetch, // 122
|
||||
IRR_EXT_shader_texture_lod, // 77
|
||||
IRR_EXT_shadow_samplers, // 102
|
||||
IRR_EXT_sRGB, // 105
|
||||
IRR_EXT_texture_compression_dxt1, // 49
|
||||
IRR_EXT_texture_filter_anisotropic, // 41
|
||||
IRR_EXT_texture_format_BGRA8888, // 51
|
||||
IRR_EXT_texture_lod_bias, // 60
|
||||
IRR_EXT_texture_rg, // 103
|
||||
IRR_EXT_texture_storage, // 108
|
||||
IRR_EXT_texture_type_2_10_10_10_REV, // 42
|
||||
IRR_EXT_unpack_subimage, // 90
|
||||
IRR_FJ_shader_binary_GCCSO, // 114
|
||||
IRR_IMG_multisampled_render_to_texture, // 74
|
||||
IRR_IMG_program_binary, // 67
|
||||
IRR_IMG_read_format, // 53
|
||||
IRR_IMG_shader_binary, // 68
|
||||
IRR_IMG_texture_compression_pvrtc, // 54
|
||||
IRR_IMG_texture_env_enhanced_fixed_function, // 58
|
||||
IRR_IMG_texture_format_BGRA8888, // replaced by EXT version
|
||||
IRR_IMG_user_clip_plane, // 57, was clip_planes
|
||||
IRR_IMG_vertex_program, // non-standard
|
||||
IRR_KHR_debug, // 118
|
||||
IRR_KHR_texture_compression_astc_ldr, // 117
|
||||
IRR_NV_coverage_sample, // 72
|
||||
IRR_NV_depth_nonlinear, // 73
|
||||
IRR_NV_draw_buffers, // 91
|
||||
IRR_NV_EGL_stream_consumer_external, // 104
|
||||
IRR_NV_fbo_color_attachments, // 92
|
||||
IRR_NV_fence, // 52
|
||||
IRR_NV_read_buffer, // 93
|
||||
IRR_NV_read_buffer_front, // part of 93
|
||||
IRR_NV_read_depth, // part of 94
|
||||
IRR_NV_read_depth_stencil, // 94
|
||||
IRR_NV_read_stencil, // part of 94
|
||||
IRR_NV_texture_compression_s3tc_update, // 95
|
||||
IRR_NV_texture_npot_2D_mipmap, // 96
|
||||
IRR_OES_blend_equation_separate, // 1
|
||||
IRR_OES_blend_func_separate, // 2
|
||||
IRR_OES_blend_subtract, // 3
|
||||
IRR_OES_byte_coordinates, // 4
|
||||
IRR_OES_compressed_ETC1_RGB8_texture, // 5
|
||||
IRR_OES_compressed_paletted_texture, // 6
|
||||
IRR_OES_depth24, // 24
|
||||
IRR_OES_depth32, // 25
|
||||
IRR_OES_depth_texture, // 43
|
||||
IRR_OES_draw_texture, // 7
|
||||
IRR_OES_EGL_image, // 23
|
||||
IRR_OES_EGL_image_external, // 87
|
||||
IRR_OES_EGL_sync, // 75
|
||||
IRR_OES_element_index_uint, // 26
|
||||
IRR_OES_extended_matrix_palette, // 8
|
||||
IRR_OES_fbo_render_mipmap, // 27
|
||||
IRR_OES_fixed_point, // 9
|
||||
IRR_OES_fragment_precision_high, // 28
|
||||
IRR_OES_framebuffer_object, // 10
|
||||
IRR_OES_get_program_binary, // 47
|
||||
IRR_OES_mapbuffer, // 29
|
||||
IRR_OES_matrix_get, // 11
|
||||
IRR_OES_matrix_palette, // 12
|
||||
IRR_OES_packed_depth_stencil, // 44
|
||||
IRR_OES_point_size_array, // 14
|
||||
IRR_OES_point_sprite, // 15
|
||||
IRR_OES_query_matrix, // 16
|
||||
IRR_OES_read_format, // 17
|
||||
IRR_OES_required_internalformat, // 115
|
||||
IRR_OES_rgb8_rgba8, // 30
|
||||
IRR_OES_single_precision, // 18
|
||||
IRR_OES_standard_derivatives, // 45
|
||||
IRR_OES_stencil1, // 31
|
||||
IRR_OES_stencil4, // 32
|
||||
IRR_OES_stencil8, // 33
|
||||
IRR_OES_stencil_wrap, // 19
|
||||
IRR_OES_surfaceless_context, // 116
|
||||
IRR_OES_texture_3D, // 34
|
||||
IRR_OES_texture_cube_map, // 20
|
||||
IRR_OES_texture_env_crossbar, // 21
|
||||
IRR_OES_texture_float, // 36
|
||||
IRR_OES_texture_float_linear, // 35
|
||||
IRR_OES_texture_half_float, // 36
|
||||
IRR_OES_texture_half_float_linear, // 35
|
||||
IRR_OES_texture_mirrored_repeat, // 22
|
||||
IRR_OES_texture_npot, // 37
|
||||
IRR_OES_vertex_array_object, // 71
|
||||
IRR_OES_vertex_half_float, // 38
|
||||
IRR_OES_vertex_type_10_10_10_2, // 46
|
||||
IRR_QCOM_alpha_test, // 89
|
||||
IRR_QCOM_binning_control, // 119
|
||||
IRR_QCOM_driver_control, // 55
|
||||
IRR_QCOM_extended_get, // 62
|
||||
IRR_QCOM_extended_get2, // 63
|
||||
IRR_QCOM_performance_monitor_global_mode, // 56
|
||||
IRR_QCOM_tiled_rendering, // 70
|
||||
IRR_QCOM_writeonly_rendering, // 61
|
||||
IRR_SUN_multi_draw_arrays, // 69
|
||||
IRR_VIV_shader_binary, // 85
|
||||
|
||||
IRR_OGLES2_Feature_Count
|
||||
};
|
||||
|
||||
//! queries the features of the driver, returns true if feature is available
|
||||
bool queryOpenGLFeature(EOGLES2Features feature) const
|
||||
{
|
||||
return FeatureAvailable[feature];
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
COGLES2ExtensionHandler();
|
||||
|
||||
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_TEXTURE_MATRIX:
|
||||
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_BLEND_OPERATIONS:
|
||||
return false;
|
||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
||||
return false; // NV Tegra need improvements here
|
||||
case EVDF_STENCIL_BUFFER:
|
||||
return StencilBuffer;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
void dump() const;
|
||||
|
||||
void initExtensions(COGLES2Driver* driver,
|
||||
#ifdef EGL_VERSION_1_0
|
||||
EGLDisplay display,
|
||||
#endif
|
||||
bool withStencil);
|
||||
|
||||
protected:
|
||||
u16 EGLVersion;
|
||||
u16 Version;
|
||||
u8 MaxTextureUnits;
|
||||
u8 MaxSupportedTextures;
|
||||
u8 MaxAnisotropy;
|
||||
u32 MaxIndices;
|
||||
u32 MaxTextureSize;
|
||||
f32 MaxTextureLODBias;
|
||||
//! Minimal and maximal supported thickness for lines without smoothing
|
||||
GLfloat DimAliasedLine[2];
|
||||
//! Minimal and maximal supported thickness for points without smoothing
|
||||
GLfloat DimAliasedPoint[2];
|
||||
bool StencilBuffer;
|
||||
bool FeatureAvailable[IRR_OGLES2_Feature_Count];
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
||||
#endif
|
||||
|
173
lib/irrlicht/source/Irrlicht/COGLES2FixedPipelineRenderer.cpp
Normal file
173
lib/irrlicht/source/Irrlicht/COGLES2FixedPipelineRenderer.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2FixedPipelineRenderer.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "os.h"
|
||||
#include "COGLES2Driver.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Constructor
|
||||
COGLES2FixedPipelineRenderer::COGLES2FixedPipelineRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver)
|
||||
: COGLES2MaterialRenderer(driver, 0, baseMaterial)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2FixedPipelineRenderer");
|
||||
#endif
|
||||
yy = (int)baseMaterial;
|
||||
int Temp = 0;
|
||||
|
||||
SharedRenderer = reinterpret_cast<COGLES2MaterialRenderer*>(driver->getMaterialRenderer(EMT_SOLID));
|
||||
|
||||
if (SharedRenderer)
|
||||
SharedRenderer->grab();
|
||||
else
|
||||
init(Temp, vertexShaderProgram, pixelShaderProgram, false);
|
||||
}
|
||||
|
||||
|
||||
//! Destructor
|
||||
COGLES2FixedPipelineRenderer::~COGLES2FixedPipelineRenderer()
|
||||
{
|
||||
if(SharedRenderer)
|
||||
SharedRenderer->drop();
|
||||
}
|
||||
|
||||
|
||||
void COGLES2FixedPipelineRenderer::OnSetMaterial(const video::SMaterial& material,
|
||||
const video::SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates,
|
||||
video::IMaterialRendererServices* services)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
Driver->getBridgeCalls()->setProgram(SharedRenderer->getProgram());
|
||||
else
|
||||
Driver->getBridgeCalls()->setProgram(Program);
|
||||
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (FixedBlending)
|
||||
{
|
||||
Driver->getBridgeCalls()->setBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||
Driver->getBridgeCalls()->setBlend(true);
|
||||
}
|
||||
else if (Blending)
|
||||
{
|
||||
E_BLEND_FACTOR srcFact,dstFact;
|
||||
E_MODULATE_FUNC modulate;
|
||||
u32 alphaSource;
|
||||
unpack_textureBlendFunc(srcFact, dstFact, modulate, alphaSource, material.MaterialTypeParam);
|
||||
|
||||
Driver->getBridgeCalls()->setBlendFunc(Driver->getGLBlend(srcFact), Driver->getGLBlend(dstFact));
|
||||
Driver->getBridgeCalls()->setBlend(true);
|
||||
}
|
||||
else
|
||||
Driver->getBridgeCalls()->setBlend(false);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2FixedPipelineRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
return SharedRenderer->OnRender(service, vtxtype);
|
||||
else
|
||||
{
|
||||
Driver->setTextureRenderStates(Driver->getCurrentMaterial(), false);
|
||||
|
||||
s32 materialType = 0;
|
||||
|
||||
switch(Driver->getCurrentMaterial().MaterialType)
|
||||
{
|
||||
case EMT_SOLID_2_LAYER:
|
||||
materialType = 1;
|
||||
break;
|
||||
case EMT_LIGHTMAP:
|
||||
case EMT_LIGHTMAP_ADD:
|
||||
case EMT_LIGHTMAP_M2:
|
||||
case EMT_LIGHTMAP_M4:
|
||||
case EMT_LIGHTMAP_LIGHTING:
|
||||
case EMT_LIGHTMAP_LIGHTING_M2:
|
||||
case EMT_LIGHTMAP_LIGHTING_M4:
|
||||
materialType = 2;
|
||||
break;
|
||||
case EMT_DETAIL_MAP:
|
||||
materialType = 3;
|
||||
break;
|
||||
case EMT_SPHERE_MAP:
|
||||
materialType = 4;
|
||||
break;
|
||||
case EMT_REFLECTION_2_LAYER:
|
||||
materialType = 5;
|
||||
break;
|
||||
case EMT_TRANSPARENT_ALPHA_CHANNEL:
|
||||
materialType = 6;
|
||||
break;
|
||||
case EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
|
||||
materialType = 7;
|
||||
break;
|
||||
case EMT_TRANSPARENT_VERTEX_ALPHA:
|
||||
materialType = 8;
|
||||
break;
|
||||
case EMT_TRANSPARENT_REFLECTION_2_LAYER:
|
||||
materialType = 9;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uMaterialType", &materialType, 1);
|
||||
|
||||
/* Transform Matrices Upload */
|
||||
|
||||
core::matrix4 world = Driver->getTransform(ETS_WORLD);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uWorldMatrix", world.pointer(), 16);
|
||||
|
||||
core::matrix4 worldViewProj = Driver->getTransform(video::ETS_PROJECTION);
|
||||
worldViewProj *= Driver->getTransform(video::ETS_VIEW);
|
||||
worldViewProj *= Driver->getTransform(ETS_WORLD);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uMvpMatrix", worldViewProj.pointer(), 16);
|
||||
|
||||
/* Textures Upload */
|
||||
|
||||
s32 TextureUsage0 = Driver->isActiveTexture(0);
|
||||
s32 TextureUsage1 = Driver->isActiveTexture(1);
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUsage0", &TextureUsage0, 1);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUsage1", &TextureUsage1, 1);
|
||||
|
||||
core::matrix4 textureMatrix0 = Driver->getTransform(video::ETS_TEXTURE_0);
|
||||
core::matrix4 textureMatrix1 = Driver->getTransform(video::ETS_TEXTURE_0);
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureMatrix0", textureMatrix0.pointer(), 16);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureMatrix1", textureMatrix1.pointer(), 16);
|
||||
|
||||
s32 TextureUnit0 = 0;
|
||||
s32 TextureUnit1 = 1;
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUnit0", &TextureUnit0, 1);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUnit1", &TextureUnit1, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
49
lib/irrlicht/source/Irrlicht/COGLES2FixedPipelineRenderer.h
Normal file
49
lib/irrlicht/source/Irrlicht/COGLES2FixedPipelineRenderer.h
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_FIXED_PIPELINE_SHADER_H_INCLUDED__
|
||||
#define __C_OGLES2_FIXED_PIPELINE_SHADER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Class for rendering fixed pipeline stuff with OpenGL ES 2.0
|
||||
class COGLES2FixedPipelineRenderer : public COGLES2MaterialRenderer
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
COGLES2FixedPipelineRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver);
|
||||
|
||||
//! Destructor
|
||||
~COGLES2FixedPipelineRenderer();
|
||||
|
||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
||||
|
||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
||||
|
||||
protected:
|
||||
int yy;
|
||||
COGLES2MaterialRenderer* SharedRenderer;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif
|
461
lib/irrlicht/source/Irrlicht/COGLES2MaterialRenderer.cpp
Normal file
461
lib/irrlicht/source/Irrlicht/COGLES2MaterialRenderer.cpp
Normal file
@ -0,0 +1,461 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "IShaderConstantSetCallBack.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "os.h"
|
||||
#include "COGLES2Driver.h"
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
|
||||
//! Constructor
|
||||
COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
|
||||
s32& outMaterialTypeNr,
|
||||
const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram,
|
||||
IShaderConstantSetCallBack* callback,
|
||||
E_MATERIAL_TYPE baseMaterial,
|
||||
s32 userData)
|
||||
: Driver(driver), CallBack(callback), Program(0), Alpha(false), Blending(false), FixedBlending(false), UserData(userData)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2MaterialRenderer");
|
||||
#endif
|
||||
|
||||
if (baseMaterial == EMT_TRANSPARENT_VERTEX_ALPHA || baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL ||
|
||||
/*baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL_REF || */baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA ||
|
||||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA)
|
||||
{
|
||||
Alpha = true;
|
||||
}
|
||||
else if (baseMaterial == EMT_TRANSPARENT_ADD_COLOR || baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR ||
|
||||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR)
|
||||
{
|
||||
FixedBlending = true;
|
||||
}
|
||||
else if (baseMaterial == EMT_ONETEXTURE_BLEND)
|
||||
Blending = true;
|
||||
|
||||
if (CallBack)
|
||||
CallBack->grab();
|
||||
|
||||
init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram);
|
||||
}
|
||||
|
||||
|
||||
//! constructor only for use by derived classes who want to
|
||||
//! create a fall back material for example.
|
||||
COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
|
||||
IShaderConstantSetCallBack* callback,
|
||||
E_MATERIAL_TYPE baseMaterial, s32 userData)
|
||||
: Driver(driver), CallBack(callback), Program(0), Alpha(false), Blending(false), FixedBlending(false), UserData(userData)
|
||||
{
|
||||
if (baseMaterial == EMT_TRANSPARENT_VERTEX_ALPHA || baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL ||
|
||||
/*baseMaterial == EMT_TRANSPARENT_ALPHA_CHANNEL_REF || */baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA ||
|
||||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA)
|
||||
{
|
||||
Alpha = true;
|
||||
}
|
||||
else if (baseMaterial == EMT_TRANSPARENT_ADD_COLOR || baseMaterial == EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR ||
|
||||
baseMaterial == EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR)
|
||||
{
|
||||
FixedBlending = true;
|
||||
}
|
||||
else if (baseMaterial == EMT_ONETEXTURE_BLEND)
|
||||
Blending = true;
|
||||
|
||||
if (CallBack)
|
||||
CallBack->grab();
|
||||
}
|
||||
|
||||
|
||||
//! Destructor
|
||||
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;
|
||||
|
||||
// register myself as new material
|
||||
if (addMaterial)
|
||||
outMaterialTypeNr = Driver->addMaterialRenderer(this);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2MaterialRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
||||
{
|
||||
Driver->setTextureRenderStates(Driver->getCurrentMaterial(), false);
|
||||
|
||||
// call callback to set shader constants
|
||||
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)
|
||||
{
|
||||
Driver->getBridgeCalls()->setProgram(Program);
|
||||
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (FixedBlending)
|
||||
{
|
||||
Driver->getBridgeCalls()->setBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||
Driver->getBridgeCalls()->setBlend(true);
|
||||
}
|
||||
else if (Blending)
|
||||
{
|
||||
E_BLEND_FACTOR srcFact,dstFact;
|
||||
E_MODULATE_FUNC modulate;
|
||||
u32 alphaSource;
|
||||
unpack_textureBlendFunc(srcFact, dstFact, modulate, alphaSource, material.MaterialTypeParam);
|
||||
|
||||
Driver->getBridgeCalls()->setBlendFunc(Driver->getGLBlend(srcFact), Driver->getGLBlend(dstFact));
|
||||
Driver->getBridgeCalls()->setBlend(true);
|
||||
}
|
||||
else
|
||||
Driver->getBridgeCalls()->setBlend(false);
|
||||
|
||||
if (CallBack)
|
||||
CallBack->OnSetMaterial(material);
|
||||
}
|
||||
|
||||
|
||||
void COGLES2MaterialRenderer::OnUnsetMaterial()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//! Returns if the material is transparent.
|
||||
bool COGLES2MaterialRenderer::isTransparent() const
|
||||
{
|
||||
return (Alpha || Blending || FixedBlending);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
// check error message and log it
|
||||
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);
|
||||
// check error message and log it
|
||||
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;
|
||||
}
|
||||
|
||||
// get uniforms information
|
||||
|
||||
GLint num = 0;
|
||||
|
||||
glGetProgramiv(Program, GL_ACTIVE_UNIFORMS, &num);
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
// no uniforms
|
||||
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));
|
||||
ui.name = buf;
|
||||
ui.location = glGetUniformLocation(Program, buf);
|
||||
|
||||
UniformInfo.push_back(ui);
|
||||
}
|
||||
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void COGLES2MaterialRenderer::setBasicRenderStates(const SMaterial& material,
|
||||
const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates)
|
||||
{
|
||||
// forward
|
||||
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::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;
|
||||
}
|
||||
|
||||
IVideoDriver* COGLES2MaterialRenderer::getVideoDriver()
|
||||
{
|
||||
return Driver;
|
||||
}
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
122
lib/irrlicht/source/Irrlicht/COGLES2MaterialRenderer.h
Normal file
122
lib/irrlicht/source/Irrlicht/COGLES2MaterialRenderer.h
Normal file
@ -0,0 +1,122 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__
|
||||
#define __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
#endif
|
||||
|
||||
#include "EMaterialTypes.h"
|
||||
#include "EVertexAttributes.h"
|
||||
#include "IMaterialRenderer.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "IShaderConstantSetCallBack.h"
|
||||
#include "irrArray.h"
|
||||
#include "irrString.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
class COGLES2Driver;
|
||||
|
||||
//! Class for using GLSL shaders with OpenGL ES 2.0
|
||||
//! Please note: This renderer implements its own IMaterialRendererServices
|
||||
class COGLES2MaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
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);
|
||||
|
||||
//! Destructor
|
||||
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();
|
||||
|
||||
//! Returns if the material is transparent.
|
||||
virtual bool isTransparent() const;
|
||||
|
||||
// implementations for the render services
|
||||
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates);
|
||||
|
||||
virtual s32 getVertexShaderConstantID(const c8* name);
|
||||
virtual s32 getPixelShaderConstantID(const c8* name);
|
||||
virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
|
||||
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1);
|
||||
virtual bool setVertexShaderConstant(s32 index, const f32* floats, int count);
|
||||
virtual bool setVertexShaderConstant(s32 index, const s32* ints, int count);
|
||||
virtual bool setPixelShaderConstant(s32 index, const f32* floats, int count);
|
||||
virtual bool setPixelShaderConstant(s32 index, const s32* ints, int count);
|
||||
|
||||
virtual IVideoDriver* getVideoDriver();
|
||||
|
||||
protected:
|
||||
|
||||
//! constructor only for use by derived classes who want to
|
||||
//! create a fall back material for example.
|
||||
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;
|
||||
bool FixedBlending;
|
||||
|
||||
struct SUniformInfo
|
||||
{
|
||||
core::stringc name;
|
||||
GLenum type;
|
||||
GLint location;
|
||||
};
|
||||
|
||||
GLuint Program;
|
||||
core::array<SUniformInfo> UniformInfo;
|
||||
s32 UserData;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif // compile with OpenGL ES 2.0
|
||||
#endif // if included
|
80
lib/irrlicht/source/Irrlicht/COGLES2NormalMapRenderer.cpp
Normal file
80
lib/irrlicht/source/Irrlicht/COGLES2NormalMapRenderer.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2NormalMapRenderer.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "os.h"
|
||||
#include "COGLES2Driver.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Constructor
|
||||
COGLES2NormalMapRenderer::COGLES2NormalMapRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver)
|
||||
: COGLES2MaterialRenderer(driver, 0, baseMaterial)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2NormalMapRenderer");
|
||||
#endif
|
||||
|
||||
int Temp = 0;
|
||||
|
||||
SharedRenderer = reinterpret_cast<COGLES2MaterialRenderer*>(driver->getMaterialRenderer(EMT_NORMAL_MAP_SOLID));
|
||||
|
||||
if (SharedRenderer)
|
||||
SharedRenderer->grab();
|
||||
else
|
||||
init(Temp, vertexShaderProgram, pixelShaderProgram, false);
|
||||
}
|
||||
|
||||
|
||||
//! Destructor
|
||||
COGLES2NormalMapRenderer::~COGLES2NormalMapRenderer()
|
||||
{
|
||||
if(SharedRenderer)
|
||||
SharedRenderer->drop();
|
||||
}
|
||||
|
||||
|
||||
void COGLES2NormalMapRenderer::OnSetMaterial(const video::SMaterial& material,
|
||||
const video::SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates,
|
||||
video::IMaterialRendererServices* services)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
SharedRenderer->OnSetMaterial(material, lastMaterial, resetAllRenderstates, services);
|
||||
else
|
||||
COGLES2MaterialRenderer::OnSetMaterial(material, lastMaterial, resetAllRenderstates, services);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2NormalMapRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
return SharedRenderer->OnRender(service, vtxtype);
|
||||
else
|
||||
{
|
||||
/* Vertex Shader part */
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
50
lib/irrlicht/source/Irrlicht/COGLES2NormalMapRenderer.h
Normal file
50
lib/irrlicht/source/Irrlicht/COGLES2NormalMapRenderer.h
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_NORMAL_MAP_RENDERER_H_INCLUDED__
|
||||
#define __C_OGLES2_NORMAL_MAP_RENDERER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Class for normal mapping in OpenGL ES 2.0
|
||||
class COGLES2NormalMapRenderer : public COGLES2MaterialRenderer
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
COGLES2NormalMapRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver);
|
||||
|
||||
//! Destructor
|
||||
~COGLES2NormalMapRenderer();
|
||||
|
||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
||||
|
||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
||||
|
||||
protected:
|
||||
|
||||
COGLES2MaterialRenderer* SharedRenderer;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
80
lib/irrlicht/source/Irrlicht/COGLES2ParallaxMapRenderer.cpp
Normal file
80
lib/irrlicht/source/Irrlicht/COGLES2ParallaxMapRenderer.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2ParallaxMapRenderer.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "os.h"
|
||||
#include "COGLES2Driver.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Constructor
|
||||
COGLES2ParallaxMapRenderer::COGLES2ParallaxMapRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver)
|
||||
: COGLES2MaterialRenderer(driver, 0, baseMaterial)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2ParallaxMapRenderer");
|
||||
#endif
|
||||
|
||||
int Temp = 0;
|
||||
|
||||
SharedRenderer = reinterpret_cast<COGLES2MaterialRenderer*>(driver->getMaterialRenderer(EMT_PARALLAX_MAP_SOLID));
|
||||
|
||||
if (SharedRenderer)
|
||||
SharedRenderer->grab();
|
||||
else
|
||||
init(Temp, vertexShaderProgram, pixelShaderProgram, false);
|
||||
}
|
||||
|
||||
|
||||
//! Destructor
|
||||
COGLES2ParallaxMapRenderer::~COGLES2ParallaxMapRenderer()
|
||||
{
|
||||
if(SharedRenderer)
|
||||
SharedRenderer->drop();
|
||||
}
|
||||
|
||||
|
||||
void COGLES2ParallaxMapRenderer::OnSetMaterial(const video::SMaterial& material,
|
||||
const video::SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates,
|
||||
video::IMaterialRendererServices* services)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
SharedRenderer->OnSetMaterial(material, lastMaterial, resetAllRenderstates, services);
|
||||
else
|
||||
COGLES2MaterialRenderer::OnSetMaterial(material, lastMaterial, resetAllRenderstates, services);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2ParallaxMapRenderer::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
||||
{
|
||||
if (SharedRenderer)
|
||||
return SharedRenderer->OnRender(service, vtxtype);
|
||||
else
|
||||
{
|
||||
/* Vertex Shader part */
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
51
lib/irrlicht/source/Irrlicht/COGLES2ParallaxMapRenderer.h
Normal file
51
lib/irrlicht/source/Irrlicht/COGLES2ParallaxMapRenderer.h
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_PARALLAX_MAP_RENDERER_H_INCLUDED__
|
||||
#define __C_OGLES2_PARALLAX_MAP_RENDERER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Class for parallax mapping in OpenGL ES 2.0
|
||||
class COGLES2ParallaxMapRenderer : public COGLES2MaterialRenderer
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
COGLES2ParallaxMapRenderer(const c8* vertexShaderProgram,
|
||||
const c8* pixelShaderProgram, E_MATERIAL_TYPE baseMaterial,
|
||||
COGLES2Driver* driver);
|
||||
|
||||
//! Destructor
|
||||
~COGLES2ParallaxMapRenderer();
|
||||
|
||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
||||
|
||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
||||
|
||||
protected:
|
||||
|
||||
COGLES2MaterialRenderer* SharedRenderer;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
100
lib/irrlicht/source/Irrlicht/COGLES2Renderer2D.cpp
Normal file
100
lib/irrlicht/source/Irrlicht/COGLES2Renderer2D.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2Renderer2D.h"
|
||||
#include "IGPUProgrammingServices.h"
|
||||
#include "os.h"
|
||||
#include "COGLES2Driver.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Constructor
|
||||
COGLES2Renderer2D::COGLES2Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COGLES2Driver* driver)
|
||||
: COGLES2MaterialRenderer(driver, 0, EMT_SOLID), RenderTargetSize(core::dimension2d<u32>(0,0)),
|
||||
Matrix(core::matrix4::EM4CONST_NOTHING), Texture(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2Renderer2D");
|
||||
#endif
|
||||
|
||||
int Temp = 0;
|
||||
|
||||
init(Temp, vertexShaderProgram, pixelShaderProgram, false);
|
||||
|
||||
Driver->getBridgeCalls()->setProgram(Program);
|
||||
|
||||
// These states doesn't change later.
|
||||
|
||||
MatrixID = getPixelShaderConstantID("uOrthoMatrix");
|
||||
UseTextureID = getPixelShaderConstantID("uUseTexture");
|
||||
s32 TextureUnitID = getPixelShaderConstantID("uTextureUnit");
|
||||
|
||||
int TextureUnit = 0;
|
||||
setPixelShaderConstant(TextureUnitID, &TextureUnit, 1);
|
||||
|
||||
Driver->getBridgeCalls()->setProgram(0);
|
||||
}
|
||||
|
||||
|
||||
//! Destructor
|
||||
COGLES2Renderer2D::~COGLES2Renderer2D()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void COGLES2Renderer2D::OnSetMaterial(const video::SMaterial& material,
|
||||
const video::SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates,
|
||||
video::IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->getBridgeCalls()->setProgram(Program);
|
||||
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2Renderer2D::OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype)
|
||||
{
|
||||
Driver->setTextureRenderStates(Driver->getCurrentMaterial(), false);
|
||||
|
||||
const core::dimension2d<u32>& renderTargetSize = Driver->getCurrentRenderTargetSize();
|
||||
|
||||
if (RenderTargetSize != renderTargetSize)
|
||||
{
|
||||
Matrix.buildProjectionMatrixOrthoLH(f32(renderTargetSize.Width), f32(-(s32)(renderTargetSize.Height)), -1.0f, 1.0f);
|
||||
Matrix.setTranslation(core::vector3df(-1,1,0));
|
||||
|
||||
setPixelShaderConstant(MatrixID, Matrix.pointer(), 16);
|
||||
|
||||
RenderTargetSize = renderTargetSize;
|
||||
}
|
||||
|
||||
int UseTexture = Texture ? 1 : 0;
|
||||
setPixelShaderConstant(UseTextureID, &UseTexture, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void COGLES2Renderer2D::setTexture(const ITexture* texture)
|
||||
{
|
||||
Texture = texture;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
56
lib/irrlicht/source/Irrlicht/COGLES2Renderer2D.h
Normal file
56
lib/irrlicht/source/Irrlicht/COGLES2Renderer2D.h
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_RENDERER_2D_H_INCLUDED__
|
||||
#define __C_OGLES2_RENDERER_2D_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "COGLES2MaterialRenderer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! Class for renderer 2D in OpenGL ES 2.0
|
||||
class COGLES2Renderer2D : public COGLES2MaterialRenderer
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
COGLES2Renderer2D(const c8* vertexShaderProgram, const c8* pixelShaderProgram, COGLES2Driver* driver);
|
||||
|
||||
//! Destructor
|
||||
~COGLES2Renderer2D();
|
||||
|
||||
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates, IMaterialRendererServices* services);
|
||||
|
||||
virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype);
|
||||
|
||||
void setTexture(const ITexture* texture);
|
||||
|
||||
protected:
|
||||
|
||||
core::dimension2d<u32> RenderTargetSize;
|
||||
core::matrix4 Matrix;
|
||||
|
||||
const ITexture* Texture;
|
||||
|
||||
s32 MatrixID;
|
||||
s32 UseTextureID;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
772
lib/irrlicht/source/Irrlicht/COGLES2Texture.cpp
Normal file
772
lib/irrlicht/source/Irrlicht/COGLES2Texture.cpp
Normal file
@ -0,0 +1,772 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#include "irrTypes.h"
|
||||
#include "COGLES2Texture.h"
|
||||
#include "COGLES2Driver.h"
|
||||
#include "os.h"
|
||||
#include "CImage.h"
|
||||
#include "CColorConverter.h"
|
||||
|
||||
#include "irrString.h"
|
||||
|
||||
#if !defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifndef GL_BGRA
|
||||
// we need to do this for the IMG_BGRA8888 extension
|
||||
int GL_BGRA=GL_RGBA;
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
//! constructor for usual textures
|
||||
COGLES2Texture::COGLES2Texture(IImage* origImage, const io::path& name, void* mipmapData, COGLES2Driver* driver)
|
||||
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
|
||||
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
|
||||
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0),
|
||||
IsRenderTarget(false), AutomaticMipmapUpdate(false),
|
||||
ReadOnlyLock(false), KeepImage(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2Texture");
|
||||
#endif
|
||||
|
||||
HasMipMaps = Driver->getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
getImageValues(origImage);
|
||||
|
||||
glGenTextures(1, &TextureName);
|
||||
|
||||
if (ImageSize==TextureSize)
|
||||
{
|
||||
Image = Driver->createImage(ColorFormat, ImageSize);
|
||||
origImage->copyTo(Image);
|
||||
}
|
||||
else
|
||||
{
|
||||
Image = Driver->createImage(ColorFormat, TextureSize);
|
||||
// scale texture
|
||||
origImage->copyToScaling(Image);
|
||||
}
|
||||
uploadTexture(true, mipmapData);
|
||||
if (!KeepImage)
|
||||
{
|
||||
Image->drop();
|
||||
Image=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! constructor for basic setup (only for derived classes)
|
||||
COGLES2Texture::COGLES2Texture(const io::path& name, COGLES2Driver* driver)
|
||||
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
|
||||
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
|
||||
PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0), HasMipMaps(true),
|
||||
IsRenderTarget(false), AutomaticMipmapUpdate(false),
|
||||
ReadOnlyLock(false), KeepImage(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2Texture");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//! destructor
|
||||
COGLES2Texture::~COGLES2Texture()
|
||||
{
|
||||
if (TextureName)
|
||||
glDeleteTextures(1, &TextureName);
|
||||
if (Image)
|
||||
Image->drop();
|
||||
}
|
||||
|
||||
|
||||
//! Choose best matching color format, based on texture creation flags
|
||||
ECOLOR_FORMAT COGLES2Texture::getBestColorFormat(ECOLOR_FORMAT format)
|
||||
{
|
||||
ECOLOR_FORMAT destFormat = ECF_A8R8G8B8;
|
||||
switch (format)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
if (!Driver->getTextureCreationFlag(ETCF_ALWAYS_32_BIT))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
break;
|
||||
case ECF_R5G6B5:
|
||||
if (!Driver->getTextureCreationFlag(ETCF_ALWAYS_32_BIT))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) ||
|
||||
Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
if (Driver->getTextureCreationFlag(ETCF_ALWAYS_16_BIT) ||
|
||||
Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
destFormat = ECF_A1R5G5B5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (Driver->getTextureCreationFlag(ETCF_NO_ALPHA_CHANNEL))
|
||||
{
|
||||
switch (destFormat)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
destFormat = ECF_R5G6B5;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
destFormat = ECF_R8G8B8;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return destFormat;
|
||||
}
|
||||
|
||||
|
||||
// prepare values ImageSize, TextureSize, and ColorFormat based on image
|
||||
void COGLES2Texture::getImageValues(IImage* image)
|
||||
{
|
||||
if (!image)
|
||||
{
|
||||
os::Printer::log("No image for OpenGL texture.", ELL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
ImageSize = image->getDimension();
|
||||
|
||||
if ( !ImageSize.Width || !ImageSize.Height)
|
||||
{
|
||||
os::Printer::log("Invalid size of image for OpenGL Texture.", ELL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
const f32 ratio = (f32)ImageSize.Width/(f32)ImageSize.Height;
|
||||
if ((ImageSize.Width>Driver->MaxTextureSize) && (ratio >= 1.0f))
|
||||
{
|
||||
ImageSize.Width = Driver->MaxTextureSize;
|
||||
ImageSize.Height = (u32)(Driver->MaxTextureSize/ratio);
|
||||
}
|
||||
else if (ImageSize.Height>Driver->MaxTextureSize)
|
||||
{
|
||||
ImageSize.Height = Driver->MaxTextureSize;
|
||||
ImageSize.Width = (u32)(Driver->MaxTextureSize*ratio);
|
||||
}
|
||||
TextureSize=ImageSize.getOptimalSize(false);
|
||||
|
||||
ColorFormat = getBestColorFormat(image->getColorFormat());
|
||||
}
|
||||
|
||||
|
||||
//! copies the the texture into an open gl texture.
|
||||
void COGLES2Texture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
|
||||
{
|
||||
// check which image needs to be uploaded
|
||||
IImage* image = level?MipImage:Image;
|
||||
if (!image)
|
||||
{
|
||||
os::Printer::log("No image for OGLES2 texture to upload", ELL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef GL_BGRA
|
||||
// whoa, pretty badly implemented extension...
|
||||
if (Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_IMG_texture_format_BGRA8888] || Driver->FeatureAvailable[COGLES2ExtensionHandler::IRR_EXT_texture_format_BGRA8888])
|
||||
GL_BGRA=0x80E1;
|
||||
else
|
||||
GL_BGRA=GL_RGBA;
|
||||
#endif
|
||||
|
||||
GLenum oldInternalFormat = InternalFormat;
|
||||
void(*convert)(const void*, s32, void*)=0;
|
||||
switch (Image->getColorFormat())
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
InternalFormat=GL_RGBA;
|
||||
PixelFormat=GL_RGBA;
|
||||
PixelType=GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
convert=CColorConverter::convert_A1R5G5B5toR5G5B5A1;
|
||||
break;
|
||||
case ECF_R5G6B5:
|
||||
InternalFormat=GL_RGB;
|
||||
PixelFormat=GL_RGB;
|
||||
PixelType=GL_UNSIGNED_SHORT_5_6_5;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
InternalFormat=GL_RGB;
|
||||
PixelFormat=GL_RGB;
|
||||
PixelType=GL_UNSIGNED_BYTE;
|
||||
convert=CColorConverter::convert_R8G8B8toB8G8R8;
|
||||
break;
|
||||
case ECF_A8R8G8B8:
|
||||
PixelType=GL_UNSIGNED_BYTE;
|
||||
if (!Driver->queryOpenGLFeature(COGLES2ExtensionHandler::IRR_IMG_texture_format_BGRA8888) && !Driver->queryOpenGLFeature(COGLES2ExtensionHandler::IRR_EXT_texture_format_BGRA8888))
|
||||
{
|
||||
convert=CColorConverter::convert_A8R8G8B8toA8B8G8R8;
|
||||
InternalFormat=GL_RGBA;
|
||||
PixelFormat=GL_RGBA;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalFormat=GL_BGRA;
|
||||
PixelFormat=GL_BGRA;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
os::Printer::log("Unsupported texture format", ELL_ERROR);
|
||||
break;
|
||||
}
|
||||
// Hack for iPhone SDK, which requires a different InternalFormat
|
||||
#ifdef _IRR_IPHONE_PLATFORM_
|
||||
if (InternalFormat==GL_BGRA)
|
||||
InternalFormat=GL_RGBA;
|
||||
#endif
|
||||
// make sure we don't change the internal format of existing matrices
|
||||
if (!newTexture)
|
||||
InternalFormat=oldInternalFormat;
|
||||
|
||||
Driver->setActiveTexture(0, this);
|
||||
Driver->getBridgeCalls()->setTexture(0);
|
||||
|
||||
if (Driver->testGLError())
|
||||
os::Printer::log("Could not bind Texture", ELL_ERROR);
|
||||
|
||||
// mipmap handling for main texture
|
||||
if (!level && newTexture)
|
||||
{
|
||||
#ifndef DISABLE_MIPMAPPING
|
||||
// auto generate if possible and no mipmap data is given
|
||||
if (HasMipMaps && !mipmapData)
|
||||
{
|
||||
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
|
||||
else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY))
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
|
||||
else
|
||||
glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE);
|
||||
|
||||
AutomaticMipmapUpdate=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Either generate manually due to missing capability
|
||||
// or use predefined mipmap data
|
||||
AutomaticMipmapUpdate=false;
|
||||
regenerateMipMapLevels(mipmapData);
|
||||
}
|
||||
|
||||
if (HasMipMaps) // might have changed in regenerateMipMapLevels
|
||||
{
|
||||
// enable bilinear mipmap filter
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
StatesCache.BilinearFilter = true;
|
||||
StatesCache.TrilinearFilter = false;
|
||||
StatesCache.MipMapStatus = true;
|
||||
}
|
||||
else
|
||||
#else
|
||||
HasMipMaps=false;
|
||||
os::Printer::log("Did not create OpenGL texture mip maps.", ELL_INFORMATION);
|
||||
#endif
|
||||
{
|
||||
// enable bilinear filter without mipmaps
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
StatesCache.BilinearFilter = true;
|
||||
StatesCache.TrilinearFilter = false;
|
||||
StatesCache.MipMapStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
// now get image data and upload to GPU
|
||||
void* source = image->lock();
|
||||
IImage* tmpImage=0;
|
||||
|
||||
if (convert)
|
||||
{
|
||||
tmpImage = new CImage(image->getColorFormat(), image->getDimension());
|
||||
void* dest = tmpImage->lock();
|
||||
convert(source, image->getDimension().getArea(), dest);
|
||||
image->unlock();
|
||||
source = dest;
|
||||
}
|
||||
|
||||
if (newTexture)
|
||||
glTexImage2D(GL_TEXTURE_2D, level, InternalFormat, image->getDimension().Width,
|
||||
image->getDimension().Height, 0, PixelFormat, PixelType, source);
|
||||
else
|
||||
glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width,
|
||||
image->getDimension().Height, PixelFormat, PixelType, source);
|
||||
|
||||
if (convert)
|
||||
{
|
||||
tmpImage->unlock();
|
||||
tmpImage->drop();
|
||||
}
|
||||
else
|
||||
image->unlock();
|
||||
|
||||
if (AutomaticMipmapUpdate)
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
if (Driver->testGLError())
|
||||
os::Printer::log("Could not glTexImage2D", ELL_ERROR);
|
||||
}
|
||||
|
||||
|
||||
//! lock function
|
||||
void* COGLES2Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel)
|
||||
{
|
||||
// store info about which image is locked
|
||||
IImage* image = (mipmapLevel==0)?Image:MipImage;
|
||||
|
||||
return image->lock();
|
||||
}
|
||||
|
||||
|
||||
//! unlock function
|
||||
void COGLES2Texture::unlock()
|
||||
{
|
||||
// test if miplevel or main texture was locked
|
||||
IImage* image = MipImage?MipImage:Image;
|
||||
if (!image)
|
||||
return;
|
||||
// unlock image to see changes
|
||||
image->unlock();
|
||||
// copy texture data to GPU
|
||||
if (!ReadOnlyLock)
|
||||
uploadTexture(false, 0, MipLevelStored);
|
||||
ReadOnlyLock = false;
|
||||
// cleanup local image
|
||||
if (MipImage)
|
||||
{
|
||||
MipImage->drop();
|
||||
MipImage=0;
|
||||
}
|
||||
else if (!KeepImage)
|
||||
{
|
||||
Image->drop();
|
||||
Image=0;
|
||||
}
|
||||
// update information
|
||||
if (Image)
|
||||
ColorFormat=Image->getColorFormat();
|
||||
else
|
||||
ColorFormat=ECF_A8R8G8B8;
|
||||
}
|
||||
|
||||
|
||||
//! Returns size of the original image.
|
||||
const core::dimension2d<u32>& COGLES2Texture::getOriginalSize() const
|
||||
{
|
||||
return ImageSize;
|
||||
}
|
||||
|
||||
|
||||
//! Returns size of the texture.
|
||||
const core::dimension2d<u32>& COGLES2Texture::getSize() const
|
||||
{
|
||||
return TextureSize;
|
||||
}
|
||||
|
||||
|
||||
//! returns driver type of texture, i.e. the driver, which created the texture
|
||||
E_DRIVER_TYPE COGLES2Texture::getDriverType() const
|
||||
{
|
||||
return EDT_OGLES2;
|
||||
}
|
||||
|
||||
|
||||
//! returns color format of texture
|
||||
ECOLOR_FORMAT COGLES2Texture::getColorFormat() const
|
||||
{
|
||||
return ColorFormat;
|
||||
}
|
||||
|
||||
|
||||
//! returns pitch of texture (in bytes)
|
||||
u32 COGLES2Texture::getPitch() const
|
||||
{
|
||||
if (Image)
|
||||
return Image->getPitch();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//! return open gl texture name
|
||||
GLuint COGLES2Texture::getOpenGLTextureName() const
|
||||
{
|
||||
return TextureName;
|
||||
}
|
||||
|
||||
|
||||
//! Returns whether this texture has mipmaps
|
||||
bool COGLES2Texture::hasMipMaps() const
|
||||
{
|
||||
return HasMipMaps;
|
||||
}
|
||||
|
||||
|
||||
//! Regenerates the mip map levels of the texture. Useful after locking and
|
||||
//! modifying the texture
|
||||
void COGLES2Texture::regenerateMipMapLevels(void* mipmapData)
|
||||
{
|
||||
if (AutomaticMipmapUpdate || !HasMipMaps || !Image)
|
||||
return;
|
||||
if ((Image->getDimension().Width==1) && (Image->getDimension().Height==1))
|
||||
return;
|
||||
|
||||
// Manually create mipmaps or use prepared version
|
||||
u32 width=Image->getDimension().Width;
|
||||
u32 height=Image->getDimension().Height;
|
||||
u32 i=0;
|
||||
u8* target = static_cast<u8*>(mipmapData);
|
||||
do
|
||||
{
|
||||
if (width>1)
|
||||
width>>=1;
|
||||
if (height>1)
|
||||
height>>=1;
|
||||
++i;
|
||||
if (!target)
|
||||
target = new u8[width*height*Image->getBytesPerPixel()];
|
||||
// create scaled version if no mipdata available
|
||||
if (!mipmapData)
|
||||
Image->copyToScaling(target, width, height, Image->getColorFormat());
|
||||
glTexImage2D(GL_TEXTURE_2D, i, InternalFormat, width, height,
|
||||
0, PixelFormat, PixelType, target);
|
||||
// get next prepared mipmap data if available
|
||||
if (mipmapData)
|
||||
{
|
||||
mipmapData = static_cast<u8*>(mipmapData)+width*height*Image->getBytesPerPixel();
|
||||
target = static_cast<u8*>(mipmapData);
|
||||
}
|
||||
}
|
||||
while (width!=1 || height!=1);
|
||||
// cleanup
|
||||
if (!mipmapData)
|
||||
delete [] target;
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2Texture::isRenderTarget() const
|
||||
{
|
||||
return IsRenderTarget;
|
||||
}
|
||||
|
||||
|
||||
void COGLES2Texture::setIsRenderTarget(bool isTarget)
|
||||
{
|
||||
IsRenderTarget = isTarget;
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2Texture::isFrameBufferObject() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//! Bind Render Target Texture
|
||||
void COGLES2Texture::bindRTT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//! Unbind Render Target Texture
|
||||
void COGLES2Texture::unbindRTT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//! Get an access to texture states cache.
|
||||
COGLES2Texture::SStatesCache& COGLES2Texture::getStatesCache() const
|
||||
{
|
||||
return StatesCache;
|
||||
}
|
||||
|
||||
|
||||
/* FBO Textures */
|
||||
|
||||
// helper function for render to texture
|
||||
static bool checkOGLES2FBOStatus(COGLES2Driver* Driver);
|
||||
|
||||
//! RTT ColorFrameBuffer constructor
|
||||
COGLES2FBOTexture::COGLES2FBOTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, COGLES2Driver* driver,
|
||||
ECOLOR_FORMAT format)
|
||||
: COGLES2Texture(name, driver), DepthTexture(0), ColorFrameBuffer(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2Texture_FBO");
|
||||
#endif
|
||||
|
||||
ImageSize = size;
|
||||
TextureSize = size;
|
||||
HasMipMaps = false;
|
||||
IsRenderTarget = true;
|
||||
ColorFormat = getBestColorFormat(format);
|
||||
|
||||
switch (ColorFormat)
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
InternalFormat = GL_RGBA;
|
||||
PixelFormat = GL_RGBA;
|
||||
PixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case ECF_R8G8B8:
|
||||
InternalFormat = GL_RGB;
|
||||
PixelFormat = GL_RGB;
|
||||
PixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
break;
|
||||
case ECF_A1R5G5B5:
|
||||
InternalFormat = GL_RGBA;
|
||||
PixelFormat = GL_RGBA;
|
||||
PixelType = GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
break;
|
||||
break;
|
||||
case ECF_R5G6B5:
|
||||
InternalFormat = GL_RGB;
|
||||
PixelFormat = GL_RGB;
|
||||
PixelType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
break;
|
||||
default:
|
||||
os::Printer::log( "color format not handled", ELL_WARNING );
|
||||
break;
|
||||
}
|
||||
|
||||
// generate frame buffer
|
||||
glGenFramebuffers(1, &ColorFrameBuffer);
|
||||
bindRTT();
|
||||
|
||||
// generate color texture
|
||||
glGenTextures(1, &TextureName);
|
||||
|
||||
Driver->setActiveTexture(0, this);
|
||||
Driver->getBridgeCalls()->setTexture(0);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
StatesCache.BilinearFilter = true;
|
||||
StatesCache.WrapU = ETC_CLAMP_TO_EDGE;
|
||||
StatesCache.WrapV = ETC_CLAMP_TO_EDGE;
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, ImageSize.Width, ImageSize.Height, 0, PixelFormat, PixelType, 0);
|
||||
|
||||
#ifdef _DEBUG
|
||||
driver->testGLError();
|
||||
#endif
|
||||
|
||||
// attach color texture to frame buffer
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, TextureName, 0);
|
||||
#ifdef _DEBUG
|
||||
checkOGLES2FBOStatus(Driver);
|
||||
#endif
|
||||
|
||||
unbindRTT();
|
||||
}
|
||||
|
||||
|
||||
//! destructor
|
||||
COGLES2FBOTexture::~COGLES2FBOTexture()
|
||||
{
|
||||
if (DepthTexture)
|
||||
if (DepthTexture->drop())
|
||||
Driver->removeDepthTexture(DepthTexture);
|
||||
if (ColorFrameBuffer)
|
||||
glDeleteFramebuffers(1, &ColorFrameBuffer);
|
||||
}
|
||||
|
||||
|
||||
bool COGLES2FBOTexture::isFrameBufferObject() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//! Bind Render Target Texture
|
||||
void COGLES2FBOTexture::bindRTT()
|
||||
{
|
||||
if (ColorFrameBuffer != 0)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, ColorFrameBuffer);
|
||||
}
|
||||
|
||||
|
||||
//! Unbind Render Target Texture
|
||||
void COGLES2FBOTexture::unbindRTT()
|
||||
{
|
||||
if (ColorFrameBuffer != 0)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
/* FBO Depth Textures */
|
||||
|
||||
//! RTT DepthBuffer constructor
|
||||
COGLES2FBODepthTexture::COGLES2FBODepthTexture(
|
||||
const core::dimension2d<u32>& size,
|
||||
const io::path& name,
|
||||
COGLES2Driver* driver,
|
||||
bool useStencil)
|
||||
: COGLES2Texture(name, driver), DepthRenderBuffer(0),
|
||||
StencilRenderBuffer(0), UseStencil(useStencil)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2TextureFBO_Depth");
|
||||
#endif
|
||||
|
||||
ImageSize = size;
|
||||
TextureSize = size;
|
||||
InternalFormat = GL_RGBA;
|
||||
PixelFormat = GL_RGBA;
|
||||
PixelType = GL_UNSIGNED_BYTE;
|
||||
HasMipMaps = false;
|
||||
|
||||
if (useStencil)
|
||||
{
|
||||
glGenRenderbuffers(1, &DepthRenderBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, DepthRenderBuffer);
|
||||
#ifdef GL_OES_packed_depth_stencil
|
||||
if (Driver->queryOpenGLFeature(COGLES2ExtensionHandler::IRR_OES_packed_depth_stencil))
|
||||
{
|
||||
// generate packed depth stencil buffer
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, ImageSize.Width, ImageSize.Height);
|
||||
StencilRenderBuffer = DepthRenderBuffer; // stencil is packed with depth
|
||||
}
|
||||
else // generate separate stencil and depth textures
|
||||
#endif
|
||||
{
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, Driver->getZBufferBits(), ImageSize.Width, ImageSize.Height);
|
||||
|
||||
glGenRenderbuffers(1, &StencilRenderBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, StencilRenderBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, ImageSize.Width, ImageSize.Height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// generate depth buffer
|
||||
glGenRenderbuffers(1, &DepthRenderBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, DepthRenderBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, Driver->getZBufferBits(), ImageSize.Width, ImageSize.Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! destructor
|
||||
COGLES2FBODepthTexture::~COGLES2FBODepthTexture()
|
||||
{
|
||||
if (DepthRenderBuffer)
|
||||
glDeleteRenderbuffers(1, &DepthRenderBuffer);
|
||||
|
||||
if (StencilRenderBuffer && StencilRenderBuffer != DepthRenderBuffer)
|
||||
glDeleteRenderbuffers(1, &StencilRenderBuffer);
|
||||
}
|
||||
|
||||
|
||||
//combine depth texture and rtt
|
||||
bool COGLES2FBODepthTexture::attach(ITexture* renderTex)
|
||||
{
|
||||
if (!renderTex)
|
||||
return false;
|
||||
COGLES2FBOTexture* rtt = static_cast<COGLES2FBOTexture*>(renderTex);
|
||||
rtt->bindRTT();
|
||||
|
||||
// attach stencil texture to stencil buffer
|
||||
if (UseStencil)
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, StencilRenderBuffer);
|
||||
|
||||
// attach depth renderbuffer to depth buffer
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthRenderBuffer);
|
||||
|
||||
// check the status
|
||||
if (!checkOGLES2FBOStatus(Driver))
|
||||
{
|
||||
os::Printer::log("FBO incomplete");
|
||||
return false;
|
||||
}
|
||||
rtt->DepthTexture=this;
|
||||
rtt->DepthBufferTexture = DepthRenderBuffer;
|
||||
grab(); // grab the depth buffer, not the RTT
|
||||
rtt->unbindRTT();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//! Bind Render Target Texture
|
||||
void COGLES2FBODepthTexture::bindRTT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//! Unbind Render Target Texture
|
||||
void COGLES2FBODepthTexture::unbindRTT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool checkOGLES2FBOStatus(COGLES2Driver* Driver)
|
||||
{
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case GL_FRAMEBUFFER_COMPLETE:
|
||||
return true;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
||||
os::Printer::log("FBO has one or several incomplete image attachments", ELL_ERROR);
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
||||
os::Printer::log("FBO missing an image attachment", ELL_ERROR);
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
||||
os::Printer::log("FBO has one or several image attachments with different dimensions", ELL_ERROR);
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED:
|
||||
os::Printer::log("FBO format unsupported", ELL_ERROR);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
os::Printer::log("FBO error", ELL_ERROR);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
||||
|
209
lib/irrlicht/source/Irrlicht/COGLES2Texture.h
Normal file
209
lib/irrlicht/source/Irrlicht/COGLES2Texture.h
Normal file
@ -0,0 +1,209 @@
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
|
||||
// OpenGL ES driver implemented by Christian Stehno and first OpenGL ES 2.0
|
||||
// driver implemented by Amundis.
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_OGLES2_TEXTURE_H_INCLUDED__
|
||||
#define __C_OGLES2_TEXTURE_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
|
||||
#include "ITexture.h"
|
||||
#include "IImage.h"
|
||||
#include "SMaterialLayer.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
class COGLES2Driver;
|
||||
|
||||
//! OpenGL ES 2.0 texture.
|
||||
class COGLES2Texture : public ITexture
|
||||
{
|
||||
public:
|
||||
|
||||
//! Cache structure.
|
||||
struct SStatesCache
|
||||
{
|
||||
SStatesCache() : WrapU(ETC_REPEAT), WrapV(ETC_REPEAT), BilinearFilter(false),
|
||||
TrilinearFilter(false), AnisotropicFilter(0), MipMapStatus(false), IsCached(false), LODBias(0)
|
||||
{
|
||||
}
|
||||
|
||||
u8 WrapU;
|
||||
u8 WrapV;
|
||||
bool BilinearFilter;
|
||||
bool TrilinearFilter;
|
||||
u8 AnisotropicFilter;
|
||||
bool MipMapStatus;
|
||||
s8 LODBias;
|
||||
|
||||
bool IsCached;
|
||||
};
|
||||
|
||||
//! constructor
|
||||
COGLES2Texture(IImage* surface, const io::path& name, void* mipmapData=0, COGLES2Driver* driver=0);
|
||||
|
||||
//! destructor
|
||||
virtual ~COGLES2Texture();
|
||||
|
||||
//! lock function
|
||||
virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0);
|
||||
|
||||
//! unlock function
|
||||
virtual void unlock();
|
||||
|
||||
//! Returns original size of the texture (image).
|
||||
virtual const core::dimension2d<u32>& getOriginalSize() const;
|
||||
|
||||
//! Returns size of the texture.
|
||||
virtual const core::dimension2d<u32>& getSize() const;
|
||||
|
||||
//! returns driver type of texture (=the driver, that created it)
|
||||
virtual E_DRIVER_TYPE getDriverType() const;
|
||||
|
||||
//! returns color format of texture
|
||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||
|
||||
//! returns pitch of texture (in bytes)
|
||||
virtual u32 getPitch() const;
|
||||
|
||||
//! return open gl texture name
|
||||
GLuint getOpenGLTextureName() const;
|
||||
|
||||
//! return whether this texture has mipmaps
|
||||
virtual bool hasMipMaps() const;
|
||||
|
||||
//! Regenerates the mip map levels of the texture.
|
||||
/** Useful after locking and modifying the texture
|
||||
\param mipmapData Pointer to raw mipmap data, including all necessary mip levels, in the same format as the main texture image. If not set the mipmaps are derived from the main image. */
|
||||
virtual void regenerateMipMapLevels(void* mipmapData=0);
|
||||
|
||||
//! Is it a render target?
|
||||
virtual bool isRenderTarget() const;
|
||||
|
||||
//! Is it a FrameBufferObject?
|
||||
virtual bool isFrameBufferObject() const;
|
||||
|
||||
//! Bind RenderTargetTexture
|
||||
virtual void bindRTT();
|
||||
|
||||
//! Unbind RenderTargetTexture
|
||||
virtual void unbindRTT();
|
||||
|
||||
//! sets whether this texture is intended to be used as a render target.
|
||||
void setIsRenderTarget(bool isTarget);
|
||||
|
||||
//! Get an access to texture states cache.
|
||||
SStatesCache& getStatesCache() const;
|
||||
|
||||
protected:
|
||||
|
||||
//! protected constructor with basic setup, no GL texture name created, for derived classes
|
||||
COGLES2Texture(const io::path& name, COGLES2Driver* driver);
|
||||
|
||||
//! get the desired color format based on texture creation flags and the input format.
|
||||
ECOLOR_FORMAT getBestColorFormat(ECOLOR_FORMAT format);
|
||||
|
||||
//! get important numbers of the image and hw texture
|
||||
void getImageValues(IImage* image);
|
||||
|
||||
//! copies the texture into an OpenGL texture.
|
||||
/** \param newTexture True if method is called for a newly created texture for the first time. Otherwise call with false to improve memory handling.
|
||||
\param mipmapData Pointer to raw mipmap data, including all necessary mip levels, in the same format as the main texture image.
|
||||
\param mipLevel If set to non-zero, only that specific miplevel is updated, using the MipImage member. */
|
||||
void uploadTexture(bool newTexture=false, void* mipmapData=0, u32 mipLevel=0);
|
||||
|
||||
core::dimension2d<u32> ImageSize;
|
||||
core::dimension2d<u32> TextureSize;
|
||||
ECOLOR_FORMAT ColorFormat;
|
||||
COGLES2Driver* Driver;
|
||||
IImage* Image;
|
||||
IImage* MipImage;
|
||||
|
||||
GLuint TextureName;
|
||||
GLint InternalFormat;
|
||||
GLenum PixelFormat;
|
||||
GLenum PixelType;
|
||||
|
||||
u8 MipLevelStored;
|
||||
bool HasMipMaps;
|
||||
bool IsRenderTarget;
|
||||
bool AutomaticMipmapUpdate;
|
||||
bool ReadOnlyLock;
|
||||
bool KeepImage;
|
||||
|
||||
mutable SStatesCache StatesCache;
|
||||
};
|
||||
|
||||
//! OpenGL ES 2.0 FBO texture.
|
||||
class COGLES2FBOTexture : public COGLES2Texture
|
||||
{
|
||||
public:
|
||||
|
||||
//! FrameBufferObject constructor
|
||||
COGLES2FBOTexture(const core::dimension2d<u32>& size, const io::path& name,
|
||||
COGLES2Driver* driver = 0, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
//! destructor
|
||||
virtual ~COGLES2FBOTexture();
|
||||
|
||||
//! Is it a FrameBufferObject?
|
||||
virtual bool isFrameBufferObject() const;
|
||||
|
||||
//! Bind RenderTargetTexture
|
||||
virtual void bindRTT();
|
||||
|
||||
//! Unbind RenderTargetTexture
|
||||
virtual void unbindRTT();
|
||||
|
||||
ITexture* DepthTexture;
|
||||
GLuint DepthBufferTexture;
|
||||
protected:
|
||||
GLuint ColorFrameBuffer;
|
||||
};
|
||||
|
||||
|
||||
//! OpenGL ES 2.0 FBO depth texture.
|
||||
class COGLES2FBODepthTexture : public COGLES2Texture
|
||||
{
|
||||
public:
|
||||
//! FrameBufferObject depth constructor
|
||||
COGLES2FBODepthTexture(const core::dimension2d<u32>& size, const io::path& name, COGLES2Driver* driver=0, bool useStencil=false);
|
||||
|
||||
//! destructor
|
||||
virtual ~COGLES2FBODepthTexture();
|
||||
|
||||
//! Bind RenderTargetTexture
|
||||
virtual void bindRTT();
|
||||
|
||||
//! Unbind RenderTargetTexture
|
||||
virtual void unbindRTT();
|
||||
|
||||
bool attach(ITexture*);
|
||||
|
||||
protected:
|
||||
GLuint DepthRenderBuffer;
|
||||
GLuint StencilRenderBuffer;
|
||||
bool UseStencil;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
#endif // _IRR_COMPILE_WITH_OGLES2_
|
||||
|
@ -42,6 +42,11 @@
|
||||
#include "CIrrDeviceConsole.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
#include "CIrrDeviceAndroid.h"
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
//! stub for calling createDeviceEx
|
||||
@ -99,6 +104,14 @@ namespace irr
|
||||
dev = new CIrrDeviceFB(params);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %d", __FILE__, __LINE__);
|
||||
if (params.DeviceType == EIDT_ANDROID || (!dev && params.DeviceType == EIDT_BEST)) {
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %d", __FILE__, __LINE__);
|
||||
dev = new CIrrDeviceAndroid(params);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
if (params.DeviceType == EIDT_CONSOLE || (!dev && params.DeviceType == EIDT_BEST))
|
||||
dev = new CIrrDeviceConsole(params);
|
||||
|
1808
lib/irrlicht/source/Irrlicht/gles2-ext.h
Normal file
1808
lib/irrlicht/source/Irrlicht/gles2-ext.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -143,6 +143,10 @@ namespace os
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef _IRR_ANDROID_PLATFORM_
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace os
|
||||
@ -176,24 +180,38 @@ namespace os
|
||||
|
||||
void Printer::log(const c8* message, ELOG_LEVEL ll)
|
||||
{
|
||||
#ifdef _IRR_ANDROID_PLATFORM_
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", message);
|
||||
#endif
|
||||
if (Logger)
|
||||
Logger->log(message, ll);
|
||||
}
|
||||
|
||||
void Printer::log(const wchar_t* message, ELOG_LEVEL ll)
|
||||
{
|
||||
#ifdef _IRR_ANDROID_PLATFORM_
|
||||
char test[200];
|
||||
wcstombs(test, message, 200);
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", test);
|
||||
#endif
|
||||
if (Logger)
|
||||
Logger->log(message, ll);
|
||||
}
|
||||
|
||||
void Printer::log(const c8* message, const c8* hint, ELOG_LEVEL ll)
|
||||
{
|
||||
#ifdef _IRR_ANDROID_PLATFORM_
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, hint);
|
||||
#endif
|
||||
if (Logger)
|
||||
Logger->log(message, hint, ll);
|
||||
}
|
||||
|
||||
void Printer::log(const c8* message, const io::path& hint, ELOG_LEVEL ll)
|
||||
{
|
||||
#ifdef _IRR_ANDROID_PLATFORM_
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, core::stringc(hint).c_str());
|
||||
#endif
|
||||
if (Logger)
|
||||
Logger->log(message, hint.c_str(), ll);
|
||||
}
|
||||
|
@ -25,7 +25,12 @@
|
||||
#include "glwrap.hpp"
|
||||
#include "utils/cpp2011.hpp"
|
||||
|
||||
#include "../../lib/irrlicht/source/Irrlicht/COpenGLTexture.h"
|
||||
#if defined(USE_GLES2)
|
||||
# define _IRR_COMPILE_WITH_OGLES2_
|
||||
# include "../../lib/irrlicht/source/Irrlicht/COGLES2Texture.h"
|
||||
#else
|
||||
# include "../../lib/irrlicht/source/Irrlicht/COpenGLTexture.h"
|
||||
#endif
|
||||
|
||||
|
||||
// ============================================================================
|
||||
@ -179,8 +184,13 @@ static void drawTexColoredQuad(const video::ITexture *texture,
|
||||
ColoredTextureRectShader::getInstance()->use();
|
||||
glBindVertexArray(ColoredTextureRectShader::getInstance()->m_vao);
|
||||
|
||||
#if !defined(USE_GLES2)
|
||||
const irr::video::COpenGLTexture *t =
|
||||
static_cast<const irr::video::COpenGLTexture*>(texture);
|
||||
#else
|
||||
const irr::video::COGLES2Texture *t =
|
||||
static_cast<const irr::video::COGLES2Texture*>(texture);
|
||||
#endif
|
||||
ColoredTextureRectShader::getInstance()
|
||||
->setTextureUnits(t->getOpenGLTextureName());
|
||||
ColoredTextureRectShader::getInstance()
|
||||
@ -312,8 +322,13 @@ void draw2DImage(const video::ITexture* texture,
|
||||
UniformColoredTextureRectShader::getInstance()->use();
|
||||
glBindVertexArray(SharedGPUObjects::getUI_VAO());
|
||||
|
||||
#if !defined(USE_GLES2)
|
||||
const video::COpenGLTexture *c_texture =
|
||||
static_cast<const video::COpenGLTexture*>(texture);
|
||||
#else
|
||||
const video::COGLES2Texture *c_texture =
|
||||
static_cast<const video::COGLES2Texture*>(texture);
|
||||
#endif
|
||||
UniformColoredTextureRectShader::getInstance()
|
||||
->setTextureUnits(c_texture->getOpenGLTextureName());
|
||||
|
||||
@ -430,8 +445,13 @@ void draw2DImage(const video::ITexture* texture,
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(USE_GLES2)
|
||||
const video::COpenGLTexture *c_texture =
|
||||
static_cast<const video::COpenGLTexture*>(texture);
|
||||
#else
|
||||
const video::COGLES2Texture *c_texture =
|
||||
static_cast<const video::COGLES2Texture*>(texture);
|
||||
#endif
|
||||
drawTexQuad(c_texture->getOpenGLTextureName(), width, height,
|
||||
center_pos_x, center_pos_y, tex_center_pos_x,
|
||||
tex_center_pos_y, tex_width, tex_height);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/graphics_restrictions.hpp"
|
||||
|
||||
|
||||
CentralVideoSettings *CVS = new CentralVideoSettings();
|
||||
|
||||
void CentralVideoSettings::init()
|
||||
@ -68,8 +69,12 @@ void CentralVideoSettings::init()
|
||||
Log::info("IrrDriver", "OpenGL renderer: %s", glGetString(GL_RENDERER));
|
||||
Log::info("IrrDriver", "OpenGL version string: %s", glGetString(GL_VERSION));
|
||||
}
|
||||
#if !defined(USE_GLES2)
|
||||
m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1))
|
||||
&& !UserConfigParams::m_force_legacy_device;
|
||||
#else
|
||||
m_glsl = m_gl_major_version >= 3 && !UserConfigParams::m_force_legacy_device;
|
||||
#endif
|
||||
if (!ProfileWorld::isNoGraphics())
|
||||
initGL();
|
||||
|
||||
@ -79,11 +84,11 @@ void CentralVideoSettings::init()
|
||||
std::string card((char*)(glGetString(GL_RENDERER)));
|
||||
GraphicsRestrictions::init(driver, card);
|
||||
|
||||
#if !defined(USE_GLES2)
|
||||
if (hasGLExtension("GL_AMD_vertex_shader_layer")) {
|
||||
hasVSLayer = true;
|
||||
Log::info("GLDriver", "AMD Vertex Shader Layer Present");
|
||||
}
|
||||
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BUFFER_STORAGE) &&
|
||||
hasGLExtension("GL_ARB_buffer_storage") )
|
||||
{
|
||||
@ -202,6 +207,18 @@ void CentralVideoSettings::init()
|
||||
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, ¶m);
|
||||
m_need_srgb_visual_workaround = (param != GL_SRGB);
|
||||
}
|
||||
#else
|
||||
if (m_glsl == true)
|
||||
{
|
||||
hasArraysOfArrays = true;
|
||||
hasTextureStorage = true;
|
||||
hasTextureView = true;
|
||||
hasBindlessTexture = true;
|
||||
hasImageLoadStore = true;
|
||||
hasAtomics = true;
|
||||
hasSSBO = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,9 @@
|
||||
#define GLEW_STATIC
|
||||
|
||||
extern "C" {
|
||||
#include <GL/glew.h>
|
||||
#if !defined(USE_GLES2)
|
||||
# include <GL/glew.h>
|
||||
#endif
|
||||
}
|
||||
#include <cinttypes>
|
||||
|
||||
@ -38,8 +40,11 @@ extern "C" {
|
||||
# ifndef GL_TEXTURE_SWIZZLE_RGBA
|
||||
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
|
||||
# endif
|
||||
#elif defined(ANDROID)
|
||||
# include <GLES/gl.h>
|
||||
#elif defined(USE_GLES2)
|
||||
# include <GLES3/gl3.h>
|
||||
# include <GLES3/gl3ext.h>
|
||||
# include <GLES2/gl2ext.h>
|
||||
# define glVertexAttribDivisorARB glVertexAttribDivisor
|
||||
#elif defined(WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
@ -50,6 +55,23 @@ extern "C" {
|
||||
# include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
#define GL_BGRA 0x80E1
|
||||
#define GL_BGR 0x80E0
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
|
||||
|
||||
// The glDrawElementsBaseVertex is available only in OpenGL ES 3.2. At this
|
||||
// stage the 'basevertex' argument is always equal to 0 because features that
|
||||
// use it are disabled in OpenGL ES renderer. We can simply use glDrawElements
|
||||
// instead.
|
||||
inline void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
|
||||
GLvoid *indices, GLint basevertex)
|
||||
{
|
||||
glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct DrawElementsIndirectCommand{
|
||||
GLuint count;
|
||||
GLuint instanceCount;
|
||||
|
@ -30,6 +30,39 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef DEBUG
|
||||
#if !defined(__APPLE__) && !defined(ANDROID)
|
||||
#define ARB_DEBUG_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
#define GL_DEBUG_SEVERITY_HIGH_ARB GL_DEBUG_SEVERITY_HIGH_KHR
|
||||
#define GL_DEBUG_SEVERITY_LOW_ARB GL_DEBUG_SEVERITY_LOW_KHR
|
||||
#define GL_DEBUG_SEVERITY_MEDIUM_ARB GL_DEBUG_SEVERITY_MEDIUM_KHR
|
||||
#define GL_DEBUG_SOURCE_API_ARB GL_DEBUG_SOURCE_API_KHR
|
||||
#define GL_DEBUG_SOURCE_APPLICATION_ARB GL_DEBUG_SOURCE_APPLICATION_KHR
|
||||
#define GL_DEBUG_SOURCE_OTHER_ARB GL_DEBUG_SOURCE_OTHER_KHR
|
||||
#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB GL_DEBUG_SOURCE_SHADER_COMPILER_KHR
|
||||
#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB GL_DEBUG_SOURCE_THIRD_PARTY_KHR
|
||||
#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR
|
||||
#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR
|
||||
#define GL_DEBUG_TYPE_ERROR_ARB GL_DEBUG_TYPE_ERROR_KHR
|
||||
#define GL_DEBUG_TYPE_OTHER_ARB GL_DEBUG_TYPE_OTHER_KHR
|
||||
#define GL_DEBUG_TYPE_PERFORMANCE_ARB GL_DEBUG_TYPE_PERFORMANCE_KHR
|
||||
#define GL_DEBUG_TYPE_PORTABILITY_ARB GL_DEBUG_TYPE_PORTABILITY_KHR
|
||||
#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR
|
||||
|
||||
#define GLDEBUGPROCARB GLDEBUGPROCKHR
|
||||
PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR;
|
||||
#define glDebugMessageCallbackARB pglDebugMessageCallbackKHR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool is_gl_init = false;
|
||||
|
||||
#if DEBUG
|
||||
@ -38,13 +71,6 @@ bool GLContextDebugBit = true;
|
||||
bool GLContextDebugBit = false;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#if !defined(__APPLE__)
|
||||
#define ARB_DEBUG_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
static void
|
||||
#ifdef WIN32
|
||||
@ -134,12 +160,19 @@ void initGL()
|
||||
return;
|
||||
is_gl_init = true;
|
||||
// For Mesa extension reporting
|
||||
#if !defined(USE_GLES2)
|
||||
#ifndef WIN32
|
||||
glewExperimental = GL_TRUE;
|
||||
#endif
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
Log::fatal("GLEW", "Glew initialisation failed with error %s", glewGetErrorString(err));
|
||||
#else
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)eglGetProcAddress("glDebugMessageCallbackKHR");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ARB_DEBUG_OUTPUT
|
||||
if (glDebugMessageCallbackARB)
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)debugCallback, NULL);
|
||||
@ -198,12 +231,14 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, size_t w, size_t h,
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
#if !defined(USE_GLES2)
|
||||
if (layered)
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, RTTs[i], 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
|
||||
@ -219,6 +254,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
|
||||
{
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
#if !defined(USE_GLES2)
|
||||
if (layered)
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
@ -226,6 +262,7 @@ FrameBuffer::FrameBuffer(const std::vector<GLuint> &RTTs, GLuint DS, size_t w,
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, DS, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (unsigned i = 0; i < RTTs.size(); i++)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0);
|
||||
|
@ -63,7 +63,6 @@ public:
|
||||
{
|
||||
loadProgram(PARTICLES_RENDERING,
|
||||
GL_VERTEX_SHADER, "particle.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "particle.frag");
|
||||
|
||||
assignUniforms("color_from", "color_to");
|
||||
@ -82,7 +81,6 @@ public:
|
||||
{
|
||||
loadProgram(PARTICLES_RENDERING,
|
||||
GL_VERTEX_SHADER, "flipparticle.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "particle.frag");
|
||||
assignUniforms();
|
||||
assignSamplerNames(0, "tex", ST_TRILINEAR_ANISOTROPIC_FILTERED,
|
||||
@ -149,7 +147,7 @@ ParticleSystemProxy::ParticleSystemProxy(bool createDefaultEmitter,
|
||||
|
||||
m_color_from[0] = m_color_from[1] = m_color_from[2] = 1.0;
|
||||
m_color_to[0] = m_color_to[1] = m_color_to[2] = 1.0;
|
||||
|
||||
|
||||
// We set these later but avoid coverity report them
|
||||
heighmapbuffer = 0;
|
||||
heightmaptexture = 0;
|
||||
@ -184,6 +182,7 @@ void ParticleSystemProxy::setFlip()
|
||||
void ParticleSystemProxy::setHeightmap(const std::vector<std::vector<float> > &hm,
|
||||
float f1, float f2, float f3, float f4)
|
||||
{
|
||||
#if !defined(USE_GLES2)
|
||||
track_x = f1, track_z = f2, track_x_len = f3, track_z_len = f4;
|
||||
|
||||
unsigned width = (unsigned)hm.size();
|
||||
@ -206,6 +205,7 @@ void ParticleSystemProxy::setHeightmap(const std::vector<std::vector<float> > &h
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||
|
||||
delete[] hm_array;
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
@ -263,7 +263,7 @@ void ParticleSystemProxy::generateParticlesFromPointEmitter(scene::IParticlePoin
|
||||
ParticleParams[i].PositionZ = 0;
|
||||
// Initial lifetime is >1
|
||||
InitialValues[i].Lifetime = 2.;
|
||||
|
||||
|
||||
memcpy(&(InitialValues[i].PositionX), &(ParticleParams[i].PositionX), 3 * sizeof(float));
|
||||
|
||||
generateLifetimeSizeDirection(emitter, ParticleParams[i].Lifetime, ParticleParams[i].Size,
|
||||
@ -467,18 +467,20 @@ void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initia
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::simulate()
|
||||
{
|
||||
{
|
||||
int timediff = int(GUIEngine::getLatestDt() * 1000.f);
|
||||
int active_count = getEmitter()->getMaxLifeTime() * getEmitter()->getMaxParticlesPerSecond() / 1000;
|
||||
core::matrix4 matrix = getAbsoluteTransformation();
|
||||
|
||||
|
||||
glEnable(GL_RASTERIZER_DISCARD);
|
||||
if (has_height_map)
|
||||
{
|
||||
#if !defined(USE_GLES2)
|
||||
HeightmapSimulationShader::getInstance()->use();
|
||||
glActiveTexture(GL_TEXTURE0 + HeightmapSimulationShader::getInstance()->m_TU_heightmap);
|
||||
glBindTexture(GL_TEXTURE_BUFFER, heightmaptexture);
|
||||
HeightmapSimulationShader::getInstance()->setUniforms(matrix, timediff, active_count, size_increase_factor, track_x, track_x_len, track_z, track_z_len);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -486,7 +488,7 @@ void ParticleSystemProxy::simulate()
|
||||
PointEmitterShader::getInstance()->setUniforms(m_previous_frame_matrix, matrix, timediff, active_count, size_increase_factor);
|
||||
}
|
||||
m_previous_frame_matrix = matrix;
|
||||
|
||||
|
||||
glBindVertexArray(current_simulation_vao);
|
||||
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfb_buffers[1]);
|
||||
|
||||
|
@ -140,12 +140,16 @@ public:
|
||||
std::vector<std::string> l = StringUtils::split(driver, ' ');
|
||||
if (l.size() > 2)
|
||||
{
|
||||
// driver can be: "1.4 (3.0 Mesa 10.1.0)" --> l[3] must be used
|
||||
if (l[2] != "Mesa")
|
||||
convertVersionString(l[2]);
|
||||
else
|
||||
convertVersionString(l[3]);
|
||||
return;
|
||||
// driver can be: "1.4 (3.0 Mesa 10.1.0)" -->
|
||||
// we use value next to "Mesa" word.
|
||||
for (unsigned int i = 0; i < l.size(); i++)
|
||||
{
|
||||
if (l[i] == "Mesa" && i < l.size() - 1)
|
||||
{
|
||||
convertVersionString(l[i+1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +278,7 @@ private:
|
||||
std::string m_card_name;
|
||||
|
||||
/** Operators to test version numbers with. */
|
||||
enum {VERSION_IGNORE, VERSION_EQUAL, VERSION_LESS,
|
||||
enum {VERSION_IGNORE, VERSION_EQUAL, VERSION_LESS,
|
||||
VERSION_LESS_EQUAL} m_version_test;
|
||||
|
||||
/** Driver version for which this rule applies. */
|
||||
@ -357,7 +361,7 @@ public:
|
||||
case CARD_IS:
|
||||
if(card!=m_card_name) return false;
|
||||
break;
|
||||
case CARD_CONTAINS:
|
||||
case CARD_CONTAINS:
|
||||
if(card.find(m_card_name)==std::string::npos)
|
||||
return false;
|
||||
break;
|
||||
@ -413,7 +417,7 @@ void unitTesting()
|
||||
assert(Version("10.3") <= Version("10.3.2"));
|
||||
assert(!(Version("10.3.2") < Version("10.3")));
|
||||
assert(!(Version("10.3.2") <= Version("10.3")));
|
||||
assert(Version("3.3 NVIDIA-10.0.19 310.90.10.05b1",
|
||||
assert(Version("3.3 NVIDIA-10.0.19 310.90.10.05b1",
|
||||
"NVIDIA GeForce GTX 680MX OpenGL Engine")
|
||||
== Version("310.90.10.5") );
|
||||
|
||||
@ -424,7 +428,7 @@ void unitTesting()
|
||||
assert(Version("3.1 (Core Profile) Mesa 10.3.0",
|
||||
"Mesa DRI Mobile Intel\u00ae GM45 Express Chipset")
|
||||
== Version("10.3.0") );
|
||||
assert(Version("3.3 (Core Profile) Mesa 10.5.0-devel",
|
||||
assert(Version("3.3 (Core Profile) Mesa 10.5.0-devel",
|
||||
"Gallium 0.4 on NVC1")
|
||||
== Version("10.5.0") );
|
||||
assert(Version("3.3 (Core Profile) Mesa 10.5.0-devel",
|
||||
@ -442,7 +446,7 @@ void unitTesting()
|
||||
assert(Version("4.0.10188 Core Profile Context",
|
||||
"ATI Radeon HD 5400 Series")
|
||||
== Version("4.0.10188"));
|
||||
assert(Version("4.1 ATI-1.24.38", "AMD Radeon HD 6970M OpenGL Engine")
|
||||
assert(Version("4.1 ATI-1.24.38", "AMD Radeon HD 6970M OpenGL Engine")
|
||||
== Version("1.24.38"));
|
||||
|
||||
} // unitTesting
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user