Merge remote-tracking branch 'origin/master' into fix-cannon
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
android:versionName="1.0">
|
||||
|
||||
<!-- This .apk has no Java code itself, so set hasCode to false. -->
|
||||
<application android:debuggable="true"
|
||||
android:label="@string/app_name"
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:hasCode="false"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
|
||||
@@ -70,6 +70,10 @@ If you want to prepare a package for particular architecture, you can choose it
|
||||
by setting the COMPILE_ARCH environmental variable. At this stage, supported
|
||||
architectures are "armv7", "x86" and "aarch64". The default is "armv7".
|
||||
|
||||
You can choose build type by setting BUILD_TYPE environment variable to "debug"
|
||||
or "release". The default is debug build. Note that if you choose release build,
|
||||
you have to manually sign the apk with your key and run zipalign.
|
||||
|
||||
Basically if all dependencies are installed in the system, it should be enough
|
||||
to just run:
|
||||
|
||||
@@ -84,24 +88,16 @@ to just run:
|
||||
KNOWN ISSUES
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1. At this stage only shader-based (OpenGL ES 3.0) pipeline works. The fixed
|
||||
pipeline (GLES 2.0) could work (it works under linux), but it doesn't look
|
||||
good and is generally broken. It means that it's not possible to run STK on
|
||||
Android 4.2 or older. It is technically possible to do - check GLES context
|
||||
version, load OpenGL functions dynamically using EGL, and if they are not
|
||||
loaded properly, then fallback to GLES 2.0. But these devices may be too
|
||||
slow to run STK anyway.
|
||||
1. It's not possible to compile STK for Android < 4.4 due to missing GLES 3.0
|
||||
functions. It is technically possible to do - check GLES context version,
|
||||
load OpenGL functions dynamically using EGL, and if they are not loaded
|
||||
properly, then fallback to GLES 2.0.
|
||||
|
||||
2. It never ocurred for me, but it's possible that EGL context is lost in some
|
||||
cases. SuperTuxKart is not designed to re-create all textures at any moment,
|
||||
so this is a "Wontfix", at least for now.
|
||||
|
||||
3. Some bright tracks (Farm, Gran Paradiso) seem to be a bit darker in GLES
|
||||
renderer than in original OpenGL 3.x renderer. It can be easily hacked by
|
||||
adding few lines to object pass shader, but we should rather try to find the
|
||||
real reason.
|
||||
|
||||
4. We use "exit(0)" at the end of main function. We shouldn't do it and we
|
||||
3. We use "exit(0)" at the end of main function. We shouldn't do it and we
|
||||
should just return from the main function. But STK uses some global
|
||||
variables and their values are remembered when the game is restarted. We
|
||||
should properly clear them or re-initialize on startup. Using the "exit(0)"
|
||||
@@ -109,18 +105,18 @@ to just run:
|
||||
It seems to affect only Android 5.0. More information about the crash:
|
||||
https://code.google.com/p/android/issues/detail?id=160824
|
||||
|
||||
5. STK crashes on Qualcomm with Adreno 305 when trying to draw menu interface.
|
||||
4. STK crashes on Qualcomm with Adreno 305 when trying to draw menu interface.
|
||||
Backtrace shows glDrawElements function, and internally crashed in vbo
|
||||
allocation.
|
||||
|
||||
6. STK crashes on startup on some devices when aarch64 build is made using
|
||||
5. STK crashes on startup on some devices when aarch64 build is made using
|
||||
Android r13 NDK. The r13 version has rather big modifications (it uses clang
|
||||
instead of gcc by default). This is probably a bug in NDK/compiler/OS, but
|
||||
for this reason using NDK r12 for 64-bit arm compilation is preferred.
|
||||
|
||||
7. Angelscript doesn't have full support for aarch64 builds, so that scripting
|
||||
6. Angelscript doesn't have full support for aarch64 builds, so that scripting
|
||||
won't work on this platform.
|
||||
|
||||
8. Turning left/right using accelerometer is available, but at this stage the
|
||||
7. Turning left/right using accelerometer is available, but at this stage the
|
||||
default screen orientation is not automatically detected and user must
|
||||
manually choose if he needs "phone" or "tablet" accelerometer.
|
||||
|
||||
@@ -65,11 +65,11 @@ if [ -f "$DIRNAME/obj/compile_arch" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update variables for selected architecture
|
||||
if [ -z "$COMPILE_ARCH" ]; then
|
||||
COMPILE_ARCH="armv7"
|
||||
fi
|
||||
|
||||
# Update variables for selected architecture
|
||||
if [ "$COMPILE_ARCH" = "armv7" ]; then
|
||||
export NDK_PLATFORM=$NDK_PLATFORM_ARMV7
|
||||
export NDK_ABI=$NDK_ABI_ARMV7
|
||||
@@ -91,6 +91,23 @@ else
|
||||
exit
|
||||
fi
|
||||
|
||||
# Update variables for selected build type
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE="debug"
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" = "debug" ] || [ "$BUILD_TYPE" = "Debug" ]; then
|
||||
export BUILD_TYPE="debug"
|
||||
export IS_DEBUG_BUILD=1
|
||||
elif [ "$BUILD_TYPE" = "release" ] || [ "$BUILD_TYPE" = "Release" ]; then
|
||||
export BUILD_TYPE="release"
|
||||
export IS_DEBUG_BUILD=0
|
||||
else
|
||||
echo "Unsupported BUILD_TYPE: $BUILD_TYPE. Possible values are: " \
|
||||
"debug, release"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check if we have access to the Android NDK and SDK
|
||||
if [ -z "$NDK_PATH" ]; then
|
||||
export NDK_PATH="$NDK_PATH_DEFAULT"
|
||||
@@ -278,11 +295,12 @@ ${NDK_PATH}/ndk-build $@ \
|
||||
APP_ABI="$NDK_ABI" \
|
||||
APP_PLATFORM="$NDK_PLATFORM" \
|
||||
APP_CPPFLAGS="$NDK_CPPFLAGS" \
|
||||
APP_STL=gnustl_static
|
||||
APP_STL=gnustl_static \
|
||||
NDK_DEBUG=$IS_DEBUG_BUILD
|
||||
|
||||
check_error
|
||||
|
||||
# Build apk
|
||||
echo "Building APK"
|
||||
ant debug -Dsdk.dir="$SDK_PATH" -Dtarget=$NDK_PLATFORM
|
||||
ant $BUILD_TYPE -Dsdk.dir="$SDK_PATH" -Dtarget=$NDK_PLATFORM
|
||||
check_error
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
name="Christoffel Columbus" description="Play every official track at least once." >
|
||||
<city goal="1"/>
|
||||
<cocoa_temple goal="1"/>
|
||||
<farm goal="1"/>
|
||||
<cornfield_crossing goal="1"/>
|
||||
<fortmagma goal="1"/>
|
||||
<gran_paradiso_island goal="1"/>
|
||||
<greenvalley goal="1"/>
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="4"/>
|
||||
<requirements time="275"/>
|
||||
<requirements time="290"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</medium>
|
||||
<easy>
|
||||
<karts number="5"/>
|
||||
<requirements position="1" time="105"/>
|
||||
<requirements position="1" time="130"/>
|
||||
</easy>
|
||||
</challenge>
|
||||
|
||||
|
||||
@@ -4,76 +4,75 @@
|
||||
<header id="title" width="100%" height="fit" text_align="center" word_wrap="true" text="Touch Device Settings" />
|
||||
|
||||
<spacer height="35" width="10" />
|
||||
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="General"/>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Device enabled"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="General"/>
|
||||
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Device enabled"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<checkbox id="buttons_enabled"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Buttons scale"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<gauge id="scale" proportion="1" min_value="50" max_value="150"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="Accelerometer"/>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Disabled"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Buttons scale"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<gauge id="scale" proportion="1" min_value="50" max_value="150"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="Accelerometer"/>
|
||||
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Disabled"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<checkbox id="accelerometer_disabled"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Phone"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<checkbox id="accelerometer_phone"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Tablet"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<checkbox id="accelerometer_tablet"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="Advanced"/>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Deadzone center"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<gauge id="deadzone_center" proportion="1" min_value="0" max_value="50"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="right" I18N="In the multitouch settings screen" text="Deadzone edge"/>
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="100%" />
|
||||
<gauge id="deadzone_edge" proportion="1" min_value="0" max_value="50"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="35" width="10"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="fit" height="fit" layout="horizontal-row" align="center">
|
||||
<button id="restore" text="Restore defaults"/>
|
||||
<spacer width="40" height="100%" />
|
||||
<button id="close" text="Apply"/>
|
||||
</div>
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Phone"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<checkbox id="accelerometer_phone"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Tablet"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<checkbox id="accelerometer_tablet"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label width="100%" I18N="In the multitouch settings screen" text="Advanced"/>
|
||||
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Deadzone center"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<gauge id="deadzone_center" proportion="1" min_value="0" max_value="50"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div width="75%" layout="horizontal-row" proportion="1">
|
||||
<label proportion="1" align="center" text_align="right" I18N="In the multitouch settings screen" text="Deadzone edge"/>
|
||||
<div proportion="1" align="center" height="fit" layout="horizontal-row" >
|
||||
<spacer width="40" height="10" />
|
||||
<gauge id="deadzone_edge" proportion="1" min_value="0" max_value="50"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<spacer height="35" width="10"/>
|
||||
|
||||
<div width="fit" height="fit" layout="horizontal-row" align="center" proportion="1">
|
||||
<button id="restore" text="Restore defaults"/>
|
||||
<spacer width="40" height="10" />
|
||||
<button id="close" text="Apply"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</stkgui>
|
||||
|
||||
@@ -18,15 +18,15 @@ precision mediump float;
|
||||
uniform int uMaterialType;
|
||||
|
||||
uniform bool uTextureUsage0;
|
||||
uniform bool uTextureUsage1;
|
||||
//uniform bool uTextureUsage1;
|
||||
|
||||
uniform sampler2D uTextureUnit0;
|
||||
uniform sampler2D uTextureUnit1;
|
||||
//uniform sampler2D uTextureUnit1;
|
||||
|
||||
/* Varyings */
|
||||
|
||||
varying vec2 varTexCoord0;
|
||||
varying vec2 varTexCoord1;
|
||||
//varying vec2 varTexCoord1;
|
||||
varying vec4 varVertexColor;
|
||||
varying float varEyeDist;
|
||||
|
||||
@@ -37,7 +37,7 @@ vec4 renderSolid()
|
||||
if(uTextureUsage0)
|
||||
Color *= texture2D(uTextureUnit0, varTexCoord0);
|
||||
|
||||
Color.a = 1.0;
|
||||
//Color.a = 1.0;
|
||||
|
||||
return Color;
|
||||
}
|
||||
@@ -47,9 +47,10 @@ vec4 render2LayerSolid()
|
||||
float BlendFactor = varVertexColor.a;
|
||||
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
//vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0 * BlendFactor + Texel1 * (1.0 - BlendFactor);
|
||||
vec4 Color = Texel0 * BlendFactor;
|
||||
//vec4 Color += Texel1 * (1.0 - BlendFactor);
|
||||
|
||||
return Color;
|
||||
}
|
||||
@@ -57,9 +58,10 @@ vec4 render2LayerSolid()
|
||||
vec4 renderLightMap()
|
||||
{
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
//vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0 * Texel1 * 4.0;
|
||||
vec4 Color = Texel0 * 4.0;
|
||||
//Color *= Texel1;
|
||||
Color.a = Texel0.a * Texel0.a;
|
||||
|
||||
return Color;
|
||||
@@ -68,10 +70,10 @@ vec4 renderLightMap()
|
||||
vec4 renderDetailMap()
|
||||
{
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
//vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
vec4 Color = Texel0;
|
||||
Color += Texel1 - 0.5;
|
||||
//Color += Texel1 - 0.5;
|
||||
|
||||
return Color;
|
||||
}
|
||||
@@ -81,9 +83,10 @@ vec4 renderReflection2Layer()
|
||||
vec4 Color = varVertexColor;
|
||||
|
||||
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
|
||||
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
//vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
|
||||
|
||||
Color *= Texel0 * Texel1;
|
||||
Color *= Texel0;
|
||||
//Color *= Texel1;
|
||||
|
||||
return Color;
|
||||
}
|
||||
@@ -105,7 +108,7 @@ void main ()
|
||||
else if(uMaterialType == Solid2Layer)
|
||||
gl_FragColor = render2LayerSolid();
|
||||
else if(uMaterialType == LightMap)
|
||||
gl_FragColor = renderLightMap();
|
||||
gl_FragColor = renderSolid();
|
||||
else if(uMaterialType == DetailMap)
|
||||
gl_FragColor = renderDetailMap();
|
||||
else if(uMaterialType == SphereMap)
|
||||
|
||||
@@ -4,33 +4,31 @@ attribute vec3 inVertexPosition;
|
||||
attribute vec3 inVertexNormal;
|
||||
attribute vec4 inVertexColor;
|
||||
attribute vec2 inTexCoord0;
|
||||
attribute vec2 inTexCoord1;
|
||||
//attribute vec2 inTexCoord1;
|
||||
|
||||
/* Uniforms */
|
||||
|
||||
uniform int uMaterialType;
|
||||
|
||||
uniform mat4 uMvpMatrix;
|
||||
|
||||
uniform mat4 uTextureMatrix0;
|
||||
uniform mat4 uTextureMatrix1;
|
||||
//uniform mat4 uTextureMatrix1;
|
||||
|
||||
/* Varyings */
|
||||
|
||||
varying vec2 varTexCoord0;
|
||||
varying vec2 varTexCoord1;
|
||||
//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;
|
||||
|
||||
|
||||
//vec4 TexCoord1 = vec4(inTexCoord1.x, inTexCoord1.y, 0.0, 0.0);
|
||||
//varTexCoord1 = vec4(uTextureMatrix1 * TexCoord1).xy;
|
||||
|
||||
varVertexColor = inVertexColor.zyxw;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */
|
||||
#undef _IRR_USE_NVIDIA_PERFHUD_
|
||||
|
||||
//! Uncomment the following line if you want to ignore the deprecated warnings
|
||||
//#define IGNORE_DEPRECATED_WARNING
|
||||
#define IGNORE_DEPRECATED_WARNING
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based
|
||||
/** animated meshes. If you compile without this, you will be unable to load
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
bool useCoreContext = true;
|
||||
|
||||
//! constructor and init code
|
||||
COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
@@ -41,8 +42,8 @@ namespace video
|
||||
#endif
|
||||
)
|
||||
: CNullDriver(io, params.WindowSize), COGLES2ExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias), BridgeCalls(0),
|
||||
BridgeCalls(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(params.AntiAlias),
|
||||
RenderTargetTexture(0), CurrentRendertargetSize(0, 0), ColorFormat(ECF_R8G8B8)
|
||||
#ifdef EGL_VERSION_1_0
|
||||
, EglDisplay(EGL_NO_DISPLAY)
|
||||
@@ -105,7 +106,7 @@ namespace video
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_NONE
|
||||
#else
|
||||
#else
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 5,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
@@ -216,7 +217,7 @@ namespace video
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
{
|
||||
os::Printer::log("FAILED\n");
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, NULL, NULL);
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, 0, NULL);
|
||||
os::Printer::log("Creating EglSurface without nativeWindows...");
|
||||
}
|
||||
else
|
||||
@@ -235,11 +236,11 @@ namespace video
|
||||
#endif
|
||||
os::Printer::log("Creating EglContext...");
|
||||
EglContext = EGL_NO_CONTEXT;
|
||||
|
||||
|
||||
if (!Params.ForceLegacyDevice)
|
||||
{
|
||||
os::Printer::log("Trying to create Context for OpenGL-ES3.");
|
||||
|
||||
|
||||
EGLint contextAttrib[] =
|
||||
{
|
||||
#ifdef EGL_VERSION_1_3
|
||||
@@ -247,14 +248,15 @@ namespace video
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
|
||||
EglContext = eglCreateContext(EglDisplay, EglConfig, EGL_NO_CONTEXT, contextAttrib);
|
||||
}
|
||||
|
||||
|
||||
if (EGL_NO_CONTEXT == EglContext)
|
||||
{
|
||||
os::Printer::log("Trying to create Context for OpenGL-ES2.");
|
||||
|
||||
useCoreContext = false;
|
||||
|
||||
EGLint contextAttrib[] =
|
||||
{
|
||||
#ifdef EGL_VERSION_1_3
|
||||
@@ -262,7 +264,7 @@ namespace video
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
|
||||
EglContext = eglCreateContext(EglDisplay, EglConfig, EGL_NO_CONTEXT, contextAttrib);
|
||||
if (EGL_NO_CONTEXT == EglContext)
|
||||
{
|
||||
@@ -287,7 +289,7 @@ namespace video
|
||||
core::dimension2d<u32> WindowSize(backingWidth, backingHeight);
|
||||
CNullDriver::ScreenSize = WindowSize;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// set vsync
|
||||
if (params.Vsync)
|
||||
@@ -306,25 +308,25 @@ namespace video
|
||||
GLint backingHeight;
|
||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);
|
||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);
|
||||
|
||||
|
||||
glGenRenderbuffers(1, &ViewDepthRenderbuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, ViewDepthRenderbuffer);
|
||||
|
||||
|
||||
GLenum depthComponent = GL_DEPTH_COMPONENT16;
|
||||
|
||||
|
||||
if(params.ZBufferBits >= 24)
|
||||
depthComponent = GL_DEPTH_COMPONENT24_OES;
|
||||
|
||||
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, depthComponent, backingWidth, backingHeight);
|
||||
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, ViewFramebuffer);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, ViewRenderbuffer);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, ViewDepthRenderbuffer);
|
||||
|
||||
|
||||
core::dimension2d<u32> WindowSize(backingWidth, backingHeight);
|
||||
CNullDriver::ScreenSize = WindowSize;
|
||||
CNullDriver::ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(WindowSize));
|
||||
|
||||
|
||||
genericDriverInit(WindowSize, params.Stencilbuffer);
|
||||
#endif
|
||||
}
|
||||
@@ -339,22 +341,22 @@ namespace video
|
||||
|
||||
if (BridgeCalls)
|
||||
delete BridgeCalls;
|
||||
|
||||
|
||||
#if defined(EGL_VERSION_1_0)
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
|
||||
if (EglContext != EGL_NO_CONTEXT)
|
||||
{
|
||||
eglDestroyContext(EglDisplay, EglContext);
|
||||
EglContext = EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
|
||||
if (EglSurface != EGL_NO_SURFACE)
|
||||
{
|
||||
eglDestroySurface(EglDisplay, EglSurface);
|
||||
EglSurface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
|
||||
if (EglDisplay != EGL_NO_DISPLAY)
|
||||
{
|
||||
eglTerminate(EglDisplay);
|
||||
@@ -391,28 +393,28 @@ namespace video
|
||||
void COGLES2Driver::reloadEGLSurface(void* window)
|
||||
{
|
||||
os::Printer::log("Reload EGL surface.");
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_0
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EglWindow = (ANativeWindow*)window;
|
||||
#endif
|
||||
|
||||
|
||||
if (!EglWindow)
|
||||
os::Printer::log("Invalid Egl window.");
|
||||
|
||||
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
|
||||
eglDestroySurface(EglDisplay, EglSurface);
|
||||
|
||||
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, EglWindow, 0);
|
||||
|
||||
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
os::Printer::log("Could not create EGL surface.");
|
||||
|
||||
|
||||
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool COGLES2Driver::genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer)
|
||||
{
|
||||
@@ -498,10 +500,10 @@ namespace video
|
||||
// Load shaders from files (in future shaders will be merged with source code).
|
||||
|
||||
// Fixed pipeline.
|
||||
|
||||
|
||||
core::stringc shaders_path = IRR_OGLES2_SHADER_PATH;
|
||||
if (Params.ShadersPath.size() > 0)
|
||||
shaders_path = Params.ShadersPath;
|
||||
shaders_path = Params.ShadersPath;
|
||||
|
||||
core::stringc FPVSPath = shaders_path;
|
||||
FPVSPath += "COGLES2FixedPipeline.vsh";
|
||||
@@ -627,7 +629,7 @@ namespace video
|
||||
if (PMFSFile)
|
||||
PMFSFile->drop();
|
||||
|
||||
// Create materials.
|
||||
// Create materials.
|
||||
|
||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID, this));
|
||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID_2_LAYER, this));
|
||||
@@ -647,9 +649,12 @@ namespace video
|
||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_VERTEX_ALPHA, this));
|
||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_REFLECTION_2_LAYER, this));
|
||||
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_SOLID, this));
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, this));
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
||||
if (!useCoreContext)
|
||||
{
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_SOLID, this));
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, this));
|
||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
||||
}
|
||||
|
||||
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_SOLID, this));
|
||||
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, this));
|
||||
@@ -707,7 +712,7 @@ namespace video
|
||||
bool COGLES2Driver::endScene()
|
||||
{
|
||||
CNullDriver::endScene();
|
||||
|
||||
|
||||
#if defined(EGL_VERSION_1_0)
|
||||
eglSwapBuffers(EglDisplay, EglSurface);
|
||||
EGLint g = eglGetError();
|
||||
@@ -729,7 +734,7 @@ namespace video
|
||||
Device->displayEnd();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1102,18 +1107,18 @@ namespace video
|
||||
glVertexAttribPointer(EVA_TCOORD0, 2, GL_FLOAT, false, sizeof(S3DVertex), buffer_offset(28));
|
||||
}
|
||||
|
||||
if (CurrentTexture[1])
|
||||
{
|
||||
// There must be some optimisation here as it uses the same texture coord !
|
||||
glEnableVertexAttribArray(EVA_TCOORD1);
|
||||
if (vertices)
|
||||
glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].TCoords);
|
||||
else
|
||||
glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex), buffer_offset(28));
|
||||
}
|
||||
//if (CurrentTexture[1])
|
||||
//{
|
||||
// // There must be some optimisation here as it uses the same texture coord !
|
||||
// glEnableVertexAttribArray(EVA_TCOORD1);
|
||||
// if (vertices)
|
||||
// glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].TCoords);
|
||||
// else
|
||||
// glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex), buffer_offset(28));
|
||||
//}
|
||||
break;
|
||||
case EVT_2TCOORDS:
|
||||
glEnableVertexAttribArray(EVA_TCOORD1);
|
||||
//glEnableVertexAttribArray(EVA_TCOORD1);
|
||||
if (vertices)
|
||||
{
|
||||
glVertexAttribPointer(EVA_POSITION, (threed ? 3 : 2), GL_FLOAT, false, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].Pos);
|
||||
@@ -1121,7 +1126,7 @@ namespace video
|
||||
glVertexAttribPointer(EVA_NORMAL, 3, GL_FLOAT, false, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].Normal);
|
||||
glVertexAttribPointer(EVA_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].Color);
|
||||
glVertexAttribPointer(EVA_TCOORD0, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords);
|
||||
glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords2);
|
||||
//glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), &(static_cast<const S3DVertex2TCoords*>(vertices))[0].TCoords2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1129,7 +1134,7 @@ namespace video
|
||||
glVertexAttribPointer(EVA_NORMAL, 3, GL_FLOAT, false, sizeof(S3DVertex2TCoords), buffer_offset(12));
|
||||
glVertexAttribPointer(EVA_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(S3DVertex2TCoords), buffer_offset(24));
|
||||
glVertexAttribPointer(EVA_TCOORD0, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), buffer_offset(28));
|
||||
glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), buffer_offset(36));
|
||||
//glVertexAttribPointer(EVA_TCOORD1, 2, GL_FLOAT, false, sizeof(S3DVertex2TCoords), buffer_offset(36));
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -1156,6 +1161,8 @@ namespace video
|
||||
glVertexAttribPointer(EVA_BINORMAL, 3, GL_FLOAT, false, sizeof(S3DVertexTangents), buffer_offset(48));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1261,10 +1268,10 @@ namespace video
|
||||
glDisableVertexAttribArray(EVA_TANGENT);
|
||||
glDisableVertexAttribArray(EVA_BINORMAL);
|
||||
}
|
||||
if ((vType != EVT_STANDARD) || CurrentTexture[1])
|
||||
{
|
||||
glDisableVertexAttribArray(EVA_TCOORD1);
|
||||
}
|
||||
//if ((vType != EVT_STANDARD) || CurrentTexture[1])
|
||||
//{
|
||||
// glDisableVertexAttribArray(EVA_TCOORD1);
|
||||
//}
|
||||
|
||||
#ifdef GL_OES_point_size_array
|
||||
if (FeatureAvailable[IRR_OES_point_size_array] && (Material.Thickness == 0.0f))
|
||||
@@ -1950,6 +1957,9 @@ namespace video
|
||||
|
||||
void COGLES2Driver::setRenderStates3DMode()
|
||||
{
|
||||
if (useCoreContext)
|
||||
return;
|
||||
|
||||
if (CurrentRenderMode != ERM_3D)
|
||||
{
|
||||
// Reset Texture Stages
|
||||
@@ -1988,6 +1998,9 @@ namespace video
|
||||
//! Can be called by an IMaterialRenderer to make its work easier.
|
||||
void COGLES2Driver::setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, bool resetAllRenderStates)
|
||||
{
|
||||
if (useCoreContext)
|
||||
return;
|
||||
|
||||
// ZBuffer
|
||||
if (resetAllRenderStates || lastmaterial.ZBuffer != material.ZBuffer)
|
||||
{
|
||||
@@ -2112,10 +2125,13 @@ namespace video
|
||||
// Texture parameters
|
||||
setTextureRenderStates(material, resetAllRenderStates);
|
||||
}
|
||||
|
||||
|
||||
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
|
||||
void COGLES2Driver::setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates)
|
||||
{
|
||||
if (useCoreContext)
|
||||
return;
|
||||
|
||||
// Set textures to TU/TIU and apply filters to them
|
||||
|
||||
for (s32 i = MaxTextureUnits-1; i>= 0; --i)
|
||||
@@ -2127,6 +2143,11 @@ namespace video
|
||||
else
|
||||
continue;
|
||||
|
||||
// This code causes issues on some devices with legacy pipeline
|
||||
// and also mipmaps should be handled in STK texture manager,
|
||||
// so just disable this part of code
|
||||
continue;
|
||||
|
||||
if(resetAllRenderstates)
|
||||
tmpTexture->getStatesCache().IsCached = false;
|
||||
|
||||
@@ -2217,6 +2238,9 @@ namespace video
|
||||
//! sets the needed renderstates
|
||||
void COGLES2Driver::setRenderStates2DMode(bool alpha, bool texture, bool alphaChannel)
|
||||
{
|
||||
if (useCoreContext)
|
||||
return;
|
||||
|
||||
if (CurrentRenderMode != ERM_2D)
|
||||
{
|
||||
// unset last 3d material
|
||||
@@ -2631,9 +2655,10 @@ namespace video
|
||||
}
|
||||
|
||||
|
||||
ITexture* COGLES2Driver::addRenderTargetTexture(
|
||||
const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format)
|
||||
ITexture* COGLES2Driver::addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name,
|
||||
const ECOLOR_FORMAT format,
|
||||
const bool useStencil)
|
||||
{
|
||||
//disable mip-mapping
|
||||
const bool generateMipLevels = getTextureCreationFlag(ETCF_CREATE_MIP_MAPS);
|
||||
@@ -2981,7 +3006,7 @@ namespace video
|
||||
{
|
||||
return Material;
|
||||
}
|
||||
|
||||
|
||||
COGLES2CallBridge* COGLES2Driver::getBridgeCalls() const
|
||||
{
|
||||
return BridgeCalls;
|
||||
@@ -3003,7 +3028,7 @@ namespace video
|
||||
|
||||
glCullFace(GL_BACK);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
|
||||
glDepthFunc(GL_LESS);
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@@ -3028,7 +3053,7 @@ namespace video
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
|
||||
Blend = enable;
|
||||
}
|
||||
}
|
||||
@@ -3038,7 +3063,7 @@ namespace video
|
||||
if(CullFaceMode != mode)
|
||||
{
|
||||
glCullFace(mode);
|
||||
|
||||
|
||||
CullFaceMode = mode;
|
||||
}
|
||||
}
|
||||
@@ -3051,7 +3076,7 @@ namespace video
|
||||
glEnable(GL_CULL_FACE);
|
||||
else
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
|
||||
CullFace = enable;
|
||||
}
|
||||
}
|
||||
@@ -3061,11 +3086,11 @@ namespace video
|
||||
if(DepthFunc != mode)
|
||||
{
|
||||
glDepthFunc(mode);
|
||||
|
||||
|
||||
DepthFunc = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COGLES2CallBridge::setDepthMask(bool enable)
|
||||
{
|
||||
if(DepthMask != enable)
|
||||
@@ -3074,7 +3099,7 @@ namespace video
|
||||
glDepthMask(GL_TRUE);
|
||||
else
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
|
||||
DepthMask = enable;
|
||||
}
|
||||
}
|
||||
@@ -3087,7 +3112,7 @@ namespace video
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
DepthTest = enable;
|
||||
}
|
||||
}
|
||||
@@ -3100,7 +3125,7 @@ namespace video
|
||||
Program = program;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COGLES2CallBridge::setActiveTexture(GLenum texture)
|
||||
{
|
||||
if (ActiveTexture != texture)
|
||||
@@ -3109,7 +3134,7 @@ namespace video
|
||||
ActiveTexture = texture;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void COGLES2CallBridge::setTexture(u32 stage)
|
||||
{
|
||||
if (stage < MATERIAL_MAX_TEXTURES)
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace video
|
||||
|
||||
//! 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);
|
||||
|
||||
@@ -317,7 +317,8 @@ namespace video
|
||||
virtual u32 getMaximalPrimitiveCount() const;
|
||||
|
||||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN,
|
||||
const bool useStencil = false);
|
||||
|
||||
virtual bool setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
|
||||
bool clearZBuffer, SColor color);
|
||||
@@ -487,7 +488,7 @@ namespace video
|
||||
|
||||
//! This bridge between Irlicht pseudo OpenGL calls
|
||||
//! and true OpenGL calls.
|
||||
|
||||
|
||||
class COGLES2CallBridge
|
||||
{
|
||||
public:
|
||||
@@ -504,7 +505,7 @@ namespace video
|
||||
void setCullFaceFunc(GLenum mode);
|
||||
|
||||
void setCullFace(bool enable);
|
||||
|
||||
|
||||
// Depth calls.
|
||||
|
||||
void setDepthFunc(GLenum mode);
|
||||
@@ -516,17 +517,17 @@ namespace video
|
||||
// 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;
|
||||
|
||||
@@ -536,13 +537,13 @@ namespace video
|
||||
|
||||
GLenum CullFaceMode;
|
||||
bool CullFace;
|
||||
|
||||
|
||||
GLenum DepthFunc;
|
||||
bool DepthMask;
|
||||
bool DepthTest;
|
||||
|
||||
GLuint Program;
|
||||
|
||||
|
||||
GLenum ActiveTexture;
|
||||
|
||||
const ITexture* Texture[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
@@ -157,11 +157,10 @@ namespace video
|
||||
"GL_VIV_shader_binary"
|
||||
};
|
||||
|
||||
|
||||
COGLES2ExtensionHandler::COGLES2ExtensionHandler() :
|
||||
EGLVersion(0), Version(0), MaxTextureUnits(0), MaxSupportedTextures(0),
|
||||
MaxAnisotropy(1), MaxTextureSize(1),
|
||||
MaxIndices(0xffff), MaxTextureLODBias(0.f),
|
||||
MaxAnisotropy(1), MaxIndices(0xffff), MaxTextureSize(1),
|
||||
MaxTextureLODBias(0.f),
|
||||
StencilBuffer(false)
|
||||
{
|
||||
for (u32 i=0; i<IRR_OGLES2_Feature_Count; ++i)
|
||||
@@ -197,7 +196,7 @@ namespace video
|
||||
// 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];
|
||||
|
||||
@@ -89,6 +89,7 @@ bool COGLES2FixedPipelineRenderer::OnRender(IMaterialRendererServices* service,
|
||||
Driver->setTextureRenderStates(Driver->getCurrentMaterial(), false);
|
||||
|
||||
s32 materialType = 0;
|
||||
bool second_texture = false;
|
||||
|
||||
switch(Driver->getCurrentMaterial().MaterialType)
|
||||
{
|
||||
@@ -99,10 +100,13 @@ bool COGLES2FixedPipelineRenderer::OnRender(IMaterialRendererServices* service,
|
||||
case EMT_LIGHTMAP_ADD:
|
||||
case EMT_LIGHTMAP_M2:
|
||||
case EMT_LIGHTMAP_M4:
|
||||
materialType = 2;
|
||||
break;
|
||||
case EMT_LIGHTMAP_LIGHTING:
|
||||
case EMT_LIGHTMAP_LIGHTING_M2:
|
||||
case EMT_LIGHTMAP_LIGHTING_M4:
|
||||
materialType = 2;
|
||||
second_texture = true;
|
||||
break;
|
||||
case EMT_DETAIL_MAP:
|
||||
materialType = 3;
|
||||
@@ -144,22 +148,25 @@ bool COGLES2FixedPipelineRenderer::OnRender(IMaterialRendererServices* service,
|
||||
/* Textures Upload */
|
||||
|
||||
s32 TextureUsage0 = Driver->isActiveTexture(0);
|
||||
s32 TextureUsage1 = Driver->isActiveTexture(1);
|
||||
//s32 TextureUsage1 = Driver->isActiveTexture(1);
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUsage0", &TextureUsage0, 1);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUsage1", &TextureUsage1, 1);
|
||||
//IMaterialRendererServices::setPixelShaderConstant("uTextureUsage1", &TextureUsage1, 1);
|
||||
|
||||
core::matrix4 textureMatrix0 = Driver->getTransform(video::ETS_TEXTURE_0);
|
||||
core::matrix4 textureMatrix1 = 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);
|
||||
//IMaterialRendererServices::setPixelShaderConstant("uTextureMatrix1", textureMatrix1.pointer(), 16);
|
||||
|
||||
s32 TextureUnit0 = 0;
|
||||
s32 TextureUnit1 = 1;
|
||||
//s32 TextureUnit1 = 1;
|
||||
|
||||
if (second_texture)
|
||||
TextureUnit0 = 1;
|
||||
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUnit0", &TextureUnit0, 1);
|
||||
IMaterialRendererServices::setPixelShaderConstant("uTextureUnit1", &TextureUnit1, 1);
|
||||
//IMaterialRendererServices::setPixelShaderConstant("uTextureUnit1", &TextureUnit1, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ 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)
|
||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COGLES2MaterialRenderer");
|
||||
@@ -63,7 +63,7 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
|
||||
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)
|
||||
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), 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 ||
|
||||
@@ -117,7 +117,7 @@ void COGLES2MaterialRenderer::init(s32& outMaterialTypeNr,
|
||||
bool addMaterial)
|
||||
{
|
||||
outMaterialTypeNr = -1;
|
||||
|
||||
|
||||
if (!vertexShaderProgram || !pixelShaderProgram)
|
||||
return;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
namespace video
|
||||
{
|
||||
|
||||
class COGLES2Driver;
|
||||
@@ -44,8 +44,8 @@ public:
|
||||
|
||||
//! Constructor
|
||||
COGLES2MaterialRenderer(
|
||||
COGLES2Driver* driver,
|
||||
s32& outMaterialTypeNr,
|
||||
COGLES2Driver* driver,
|
||||
s32& outMaterialTypeNr,
|
||||
const c8* vertexShaderProgram = 0,
|
||||
const c8* pixelShaderProgram = 0,
|
||||
IShaderConstantSetCallBack* callback = 0,
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
// 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);
|
||||
@@ -94,7 +94,7 @@ protected:
|
||||
|
||||
bool createShader(GLenum shaderType, const char* shader);
|
||||
bool linkProgram();
|
||||
|
||||
|
||||
COGLES2Driver* Driver;
|
||||
IShaderConstantSetCallBack* CallBack;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
struct SStatesCache
|
||||
{
|
||||
SStatesCache() : WrapU(ETC_REPEAT), WrapV(ETC_REPEAT), BilinearFilter(false),
|
||||
TrilinearFilter(false), AnisotropicFilter(0), MipMapStatus(false), IsCached(false), LODBias(0)
|
||||
TrilinearFilter(false), AnisotropicFilter(0), MipMapStatus(false), LODBias(0), IsCached(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -926,6 +926,10 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
|
||||
"Whether to enable track debugging features") );
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_hide_gui
|
||||
PARAM_DEFAULT(BoolUserConfigParam(false, "debug_hide_gui",
|
||||
"Whether to hide the GUI (artist debug mode)"));
|
||||
|
||||
PARAM_PREFIX BoolUserConfigParam m_everything_unlocked
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "everything_unlocked",
|
||||
"Enable all karts and tracks") );
|
||||
|
||||
@@ -225,7 +225,7 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
image_data[4 * i + 3] = bits->buffer[i];
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, m_used_width, m_used_height,
|
||||
bits->width, bits->rows, GL_BGRA, GL_UNSIGNED_BYTE,
|
||||
bits->width, bits->rows, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
image_data);
|
||||
delete[] image_data;
|
||||
}
|
||||
|
||||
@@ -1653,7 +1653,12 @@ void IrrDriver::onUnloadWorld()
|
||||
void IrrDriver::setAmbientLight(const video::SColorf &light, bool force_SH_computation)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
m_scene_manager->setAmbientLight(light);
|
||||
video::SColorf color = light;
|
||||
color.r = powf(color.r, 1.0f / 2.2f);
|
||||
color.g = powf(color.g, 1.0f / 2.2f);
|
||||
color.b = powf(color.b, 1.0f / 2.2f);
|
||||
|
||||
m_scene_manager->setAmbientLight(color);
|
||||
m_renderer->setAmbientLight(light, force_SH_computation);
|
||||
#endif
|
||||
} // setAmbientLight
|
||||
@@ -2057,7 +2062,7 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos,
|
||||
{
|
||||
scene::ILightSceneNode* light = m_scene_manager
|
||||
->addLightSceneNode(m_scene_manager->getRootSceneNode(),
|
||||
pos, video::SColorf(1.0f, r, g, b));
|
||||
pos, video::SColorf(r, g, b, 1.0f));
|
||||
light->setRadius(radius);
|
||||
return light;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,18 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
Log::warn("Material", "Cannot determine texture full path : <%s>", m_texname.c_str());
|
||||
else
|
||||
m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str();
|
||||
|
||||
core::stringc texfname(m_texname.c_str());
|
||||
texfname.make_lower();
|
||||
m_texname = texfname.c_str();
|
||||
|
||||
if (m_full_path.size() > 0)
|
||||
{
|
||||
core::stringc texfname2(m_full_path.c_str());
|
||||
texfname2.make_lower();
|
||||
m_full_path = texfname2.c_str();
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
bool b = false;
|
||||
@@ -432,6 +444,14 @@ Material::Material(const std::string& fname, bool is_full_path,
|
||||
file_manager->searchTexture(m_texname).c_str()).c_str();
|
||||
}
|
||||
|
||||
core::stringc texfname(m_texname.c_str());
|
||||
texfname.make_lower();
|
||||
m_texname = texfname.c_str();
|
||||
|
||||
core::stringc texfname2(m_full_path.c_str());
|
||||
texfname2.make_lower();
|
||||
m_full_path = texfname2.c_str();
|
||||
|
||||
m_complain_if_not_found = complain_if_not_found;
|
||||
|
||||
if (load_texture)
|
||||
@@ -516,6 +536,10 @@ void Material::install(bool srgb, bool premul_alpha)
|
||||
// now set the name to the basename, so that all tests work as expected
|
||||
m_texname = StringUtils::getBasename(m_texname);
|
||||
|
||||
core::stringc texfname(m_texname.c_str());
|
||||
texfname.make_lower();
|
||||
m_texname = texfname.c_str();
|
||||
|
||||
m_texture->grab();
|
||||
} // install
|
||||
|
||||
|
||||
@@ -80,17 +80,14 @@ Material* MaterialManager::getMaterialFor(video::ITexture* t,
|
||||
//-----------------------------------------------------------------------------
|
||||
Material* MaterialManager::getMaterialFor(video::ITexture* t)
|
||||
{
|
||||
core::stringc img_path = core::stringc(t->getName());
|
||||
img_path.make_lower();
|
||||
const io::path& img_path = t->getName().getInternalName();
|
||||
|
||||
if (!img_path.empty() && (img_path.findFirst('/') != -1 || img_path.findFirst('\\') != -1))
|
||||
{
|
||||
// Search backward so that temporary (track) textures are found first
|
||||
for (int i = (int)m_materials.size() - 1; i >= 0; i--)
|
||||
{
|
||||
core::stringc fullpath = core::stringc(m_materials[i]->getTexFullPath().c_str());
|
||||
fullpath.make_lower();
|
||||
if (fullpath == img_path.c_str())
|
||||
if (m_materials[i]->getTexFullPath() == img_path.c_str())
|
||||
{
|
||||
return m_materials[i];
|
||||
}
|
||||
@@ -103,9 +100,7 @@ Material* MaterialManager::getMaterialFor(video::ITexture* t)
|
||||
|
||||
for (int i = (int)m_materials.size() - 1; i >= 0; i--)
|
||||
{
|
||||
core::stringc texfname(m_materials[i]->getTexFname().c_str());
|
||||
texfname.make_lower();
|
||||
if (texfname == image)
|
||||
if (m_materials[i]->getTexFname() == image.c_str())
|
||||
{
|
||||
return m_materials[i];
|
||||
}
|
||||
@@ -361,9 +356,7 @@ Material *MaterialManager::getMaterial(const std::string& fname,
|
||||
// Search backward so that temporary (track) textures are found first
|
||||
for (int i = (int)m_materials.size()-1; i>=0; i-- )
|
||||
{
|
||||
core::stringc fname(m_materials[i]->getTexFname().c_str());
|
||||
fname.make_lower();
|
||||
if (fname == basename_lower)
|
||||
if (m_materials[i]->getTexFname() == basename_lower.c_str())
|
||||
return m_materials[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -470,8 +470,12 @@ void ParticleEmitter::setParticleType(const ParticleKind* type)
|
||||
|
||||
if (m_is_glsl)
|
||||
{
|
||||
bool additive = (type->getMaterial()->getShaderType() == Material::SHADERTYPE_ADDITIVE);
|
||||
static_cast<ParticleSystemProxy *>(m_node)->setAlphaAdditive(additive);
|
||||
Material* material = type->getMaterial();
|
||||
if (material != nullptr)
|
||||
{
|
||||
bool additive = (material->getShaderType() == Material::SHADERTYPE_ADDITIVE);
|
||||
static_cast<ParticleSystemProxy *>(m_node)->setAlphaAdditive(additive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,10 @@ ParticleKind::ParticleKind(const std::string &file)
|
||||
{
|
||||
material->get("file", &m_material_file);
|
||||
|
||||
core::stringc tmp(m_material_file.c_str());
|
||||
tmp.make_lower();
|
||||
m_material_file = tmp.c_str();
|
||||
|
||||
if (m_material_file.size() == 0)
|
||||
{
|
||||
delete xml;
|
||||
@@ -257,7 +261,7 @@ Material* ParticleKind::getMaterial() const
|
||||
if (material_manager->hasMaterial(m_material_file))
|
||||
{
|
||||
Material* material = material_manager->getMaterial(m_material_file);
|
||||
if (material->getTexture(true/*srgb*/, true/*premul_alpha*/) == NULL)
|
||||
if (material == NULL || material->getTexture(true/*srgb*/, true/*premul_alpha*/) == NULL)
|
||||
{
|
||||
throw std::runtime_error("[ParticleKind] Cannot locate file " + m_material_file);
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,7 @@ void PostProcessing::renderGaussian6Blur(const FrameBuffer &in_fbo,
|
||||
{
|
||||
auxiliary.bind();
|
||||
Gaussian6VBlurShader::getInstance()
|
||||
->render(in_fbo.getRTT()[0], in_fbo.getWidth(), in_fbo.getWidth(),
|
||||
->render(in_fbo.getRTT()[0], in_fbo.getWidth(), in_fbo.getHeight(),
|
||||
sigma_v);
|
||||
|
||||
in_fbo.bind();
|
||||
|
||||
@@ -37,6 +37,12 @@ GL1RenderTarget::GL1RenderTarget(const irr::core::dimension2du &dimension,
|
||||
{
|
||||
irr_driver->getVideoDriver()->setRenderTarget(m_render_target_texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_render_target_texture will be NULL if RTT doesn't work on this
|
||||
// computer
|
||||
Log::error("GL1RenderTarget", "Cannot render to texture.");
|
||||
}
|
||||
|
||||
m_rtt_main_node = NULL;
|
||||
}
|
||||
@@ -58,12 +64,8 @@ irr::core::dimension2du GL1RenderTarget::getTextureSize() const
|
||||
//-----------------------------------------------------------------------------
|
||||
void GL1RenderTarget::renderToTexture(irr::scene::ICameraSceneNode* camera, float dt)
|
||||
{
|
||||
// m_render_target_texture will be NULL if RTT doesn't work on this computer
|
||||
if (m_render_target_texture == NULL)
|
||||
{
|
||||
Log::error("GL1RenderTarget", "Cannot render to texture.");
|
||||
return;
|
||||
}
|
||||
|
||||
irr_driver->getVideoDriver()->setRenderTarget(m_render_target_texture);
|
||||
|
||||
@@ -154,4 +156,4 @@ void GL3RenderTarget::draw2DImage(const irr::core::rect<s32>& dest_rect,
|
||||
|
||||
} // draw2DImage
|
||||
|
||||
#endif // !SERVER_ONLY
|
||||
#endif // !SERVER_ONLY
|
||||
|
||||
@@ -88,6 +88,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
GLint rgb_format = GL_BGR;
|
||||
GLint diffuse_specular_internal_format = GL_R11F_G11F_B10F;
|
||||
GLint type = GL_FLOAT;
|
||||
GLint srgb_internal_format = GL_SRGB8_ALPHA8;
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
if (!CVS->isEXTColorBufferFloatUsable())
|
||||
@@ -101,6 +102,8 @@ RTT::RTT(size_t width, size_t height)
|
||||
diffuse_specular_internal_format = GL_RGBA8;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
srgb_internal_format = GL_RGBA8;
|
||||
#endif
|
||||
|
||||
RenderTargetTextures[RTT_TMP1] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
@@ -110,9 +113,9 @@ RTT::RTT(size_t width, size_t height)
|
||||
RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, red32_internal_format, red_format, type, linear_depth_mip_levels);
|
||||
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, rgba_internal_format, GL_RGBA, type);
|
||||
RenderTargetTextures[RTT_COLOR] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8_ALPHA8, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, GL_SRGB8_ALPHA8, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, GL_SRGB8_ALPHA8, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_TMP] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_BLEND] = generateRTT(res, srgb_internal_format, rgb_format, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_SSAO] = generateRTT(res, red_internal_format, red_format, type);
|
||||
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, rgba_internal_format, rgba_format, type);
|
||||
RenderTargetTextures[RTT_DIFFUSE] = generateRTT(res, diffuse_specular_internal_format, rgb_format, type);
|
||||
|
||||
@@ -863,6 +863,10 @@ void ShaderBasedRenderer::render(float dt)
|
||||
irr_driver->getVideoDriver()->setViewPort(core::recti(0, 0,
|
||||
irr_driver->getActualScreenSize().Width,
|
||||
irr_driver->getActualScreenSize().Height));
|
||||
|
||||
m_current_screen_size = core::vector2df(
|
||||
irr_driver->getActualScreenSize().Width,
|
||||
irr_driver->getActualScreenSize().Height);
|
||||
|
||||
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
|
||||
{
|
||||
|
||||
@@ -492,10 +492,13 @@ void STKTexture::saveCompressedTexture(const std::string& compressed_tex)
|
||||
//-----------------------------------------------------------------------------
|
||||
bool STKTexture::hasMipMaps() const
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
#if defined(USE_GLES2)
|
||||
return true;
|
||||
#elif defined(SERVER_ONLY)
|
||||
return false;
|
||||
#else
|
||||
return CVS->getGLSLVersion() >= 130;
|
||||
#endif // !SERVER_ONLY
|
||||
return false;
|
||||
} // hasMipMaps
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "font/font_manager.hpp"
|
||||
#include "font/regular_face.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/widgets/dynamic_ribbon_widget.hpp"
|
||||
@@ -146,8 +147,14 @@ void DynamicRibbonWidget::add()
|
||||
m_right_widget = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false);
|
||||
|
||||
const int average_y = m_y + (m_h - m_label_height)/2;
|
||||
m_arrows_w = 40;
|
||||
const int button_h = 50;
|
||||
|
||||
unsigned int screen_height = irr_driver->getActualScreenSize().Height;
|
||||
m_arrows_w = (int)(screen_height / 15);
|
||||
m_arrows_w = std::max(m_arrows_w, 40);
|
||||
#ifdef ANDROID
|
||||
m_arrows_w *= 1.5f;
|
||||
#endif
|
||||
const int button_h = m_arrows_w;
|
||||
|
||||
// right arrow
|
||||
rect<s32> right_arrow_location = rect<s32>(m_x + m_w - m_arrows_w,
|
||||
|
||||
@@ -75,25 +75,55 @@ void AssetsAndroid::init()
|
||||
paths.push_back("/storage/sdcard1/");
|
||||
paths.push_back("/data/data/org.supertuxkart.stk/files/");
|
||||
|
||||
// Check if STK data is available somewhere
|
||||
// Check if STK data for current version is available somewhere
|
||||
for (std::string path : paths)
|
||||
{
|
||||
Log::info("AssetsAndroid", "Check data files in: %s", path.c_str());
|
||||
|
||||
if (m_file_manager->fileExists(path + "/stk/data/" + version))
|
||||
{
|
||||
Log::info("AssetsAndroid", "Data files found in: %s", path.c_str());
|
||||
m_stk_dir = path + "/stk";
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_file_manager->fileExists(path + "/supertuxkart/data/" + version))
|
||||
{
|
||||
Log::info("AssetsAndroid", "Data files found in: %s", path.c_str());
|
||||
m_stk_dir = path + "/supertuxkart";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If data for current version is not available, then try to find any other
|
||||
// version, so that we won't accidentaly create second STK directory in
|
||||
// different place
|
||||
if (m_stk_dir.size() == 0)
|
||||
{
|
||||
for (std::string path : paths)
|
||||
{
|
||||
Log::info("AssetsAndroid", "Check data files for different STK "
|
||||
"version in: %s", path.c_str());
|
||||
|
||||
if (m_file_manager->fileExists(path + "/stk/.extracted"))
|
||||
{
|
||||
m_stk_dir = path + "/stk";
|
||||
needs_extract_data = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_file_manager->fileExists(path + "/supertuxkart/.extracted"))
|
||||
{
|
||||
m_stk_dir = path + "/supertuxkart";
|
||||
needs_extract_data = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_stk_dir.size() > 0)
|
||||
{
|
||||
Log::info("AssetsAndroid", "Data files found in: %s",
|
||||
m_stk_dir.c_str());
|
||||
}
|
||||
|
||||
// Create data dir if it's not available anywhere
|
||||
if (m_stk_dir.size() == 0)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "utils/no_copy.hpp"
|
||||
#include "utils/vec3.hpp"
|
||||
|
||||
#include <line2d.h>
|
||||
#include <line3d.h>
|
||||
|
||||
class AbstractKart;
|
||||
class Item;
|
||||
@@ -194,10 +194,12 @@ public:
|
||||
*/
|
||||
bool hitKart(const Vec3 &xyz, const AbstractKart *kart=NULL) const
|
||||
{
|
||||
Vec3 diff = (xyz - m_xyz);
|
||||
diff.setY(diff.getY() / 2.0f); // don't be too strict if the kart is a bit above the item
|
||||
return (m_event_handler!=kart || m_deactive_time <=0) &&
|
||||
diff.length2()<m_distance_2;
|
||||
if (m_event_handler == kart && m_deactive_time > 0)
|
||||
return false;
|
||||
Vec3 lc = quatRotate(m_original_rotation, xyz - m_xyz);
|
||||
// Don't be too strict if the kart is a bit above the item
|
||||
lc.setY(lc.getY() / 2.0f);
|
||||
return lc.length2() < m_distance_2;
|
||||
} // hitKart
|
||||
|
||||
protected:
|
||||
@@ -214,7 +216,7 @@ protected:
|
||||
const AbstractKart *kart=NULL) const
|
||||
{
|
||||
if(m_event_handler==kart && m_deactive_time >0) return false;
|
||||
|
||||
|
||||
Vec3 closest = line.getClosestPoint(m_xyz.toIrrVector());
|
||||
return hitKart(closest, kart);
|
||||
} // hitLine
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@@ -911,8 +912,15 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
const Vec3& left = items_to_avoid[index_left_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_left_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 hit;
|
||||
Vec3 hit_nor(0, 1, 0);
|
||||
const Material* m;
|
||||
m_track->getPtrTriangleMesh()->castRay(
|
||||
Vec3(line_to_target.getMiddle()) + normal,
|
||||
Vec3(line_to_target.getMiddle()) + normal * -10000, &hit, &m,
|
||||
&hit_nor);
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p2 = line_to_target.getMiddle() + hit_nor.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
int item_index = -1;
|
||||
@@ -929,12 +937,6 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
else
|
||||
{
|
||||
const Vec3& right = items_to_avoid[index_right_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_right_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
if (right.sideofPlane(p1, p2, p3) >= 0)
|
||||
{
|
||||
// Right of rightmost point
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#include "tracks/drive_node.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
#include <line3d.h>
|
||||
|
||||
class LinearWorld;
|
||||
class DriveGraph;
|
||||
class ShowCurve;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@@ -917,8 +918,15 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
const Vec3& left = items_to_avoid[index_left_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_left_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 hit;
|
||||
Vec3 hit_nor(0, 1, 0);
|
||||
const Material* m;
|
||||
m_track->getPtrTriangleMesh()->castRay(
|
||||
Vec3(line_to_target.getMiddle()) + normal,
|
||||
Vec3(line_to_target.getMiddle()) + normal * -10000, &hit, &m,
|
||||
&hit_nor);
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p2 = line_to_target.getMiddle() + hit_nor.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
int item_index = -1;
|
||||
@@ -935,12 +943,6 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
else
|
||||
{
|
||||
const Vec3& right = items_to_avoid[index_right_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_right_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
if (right.sideofPlane(p1, p2, p3) >= 0)
|
||||
{
|
||||
// Right of rightmost point
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "tracks/drive_node.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
#include <line3d.h>
|
||||
|
||||
#ifdef AI_DEBUG
|
||||
class ShowCurve;
|
||||
|
||||
|
||||
@@ -2566,7 +2566,16 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
||||
->isFogEnabled() );
|
||||
}
|
||||
#ifndef SERVER_ONLY
|
||||
if (!CVS->supportsShadows())
|
||||
bool create_shadow = m_kart_properties->getShadowTexture() != NULL &&
|
||||
!CVS->supportsShadows();
|
||||
|
||||
#ifdef USE_GLES2
|
||||
// Disable kart shadow for legacy pipeline in GLES renderer because it's
|
||||
// broken
|
||||
create_shadow = create_shadow && CVS->isGLSL();
|
||||
#endif
|
||||
|
||||
if (create_shadow)
|
||||
{
|
||||
m_shadow = new Shadow(m_kart_properties.get(), m_node,
|
||||
-m_kart_model->getLowestPoint());
|
||||
|
||||
@@ -138,10 +138,8 @@ KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_d
|
||||
addEffect(KGFX_NITRO2, "nitro.xml", rear_nitro_left, true );
|
||||
addEffect(KGFX_NITROSMOKE1, "nitro-smoke.xml", rear_nitro_left, false);
|
||||
addEffect(KGFX_NITROSMOKE2, "nitro-smoke.xml", rear_nitro_right, false);
|
||||
|
||||
addEffect(KGFX_EXHAUST1, "kart_exhaust.xml",rear_nitro_right, false );
|
||||
addEffect(KGFX_EXHAUST2, "kart_exhaust.xml",rear_nitro_left, false );
|
||||
|
||||
addEffect(KGFX_ZIPPER, "zipper_fire.xml", rear_center, true );
|
||||
addEffect(KGFX_TERRAIN, "smoke.xml", Vec3(0, 0, 0), false);
|
||||
addEffect(KGFX_SKID1L, "skid1.xml", rear_left, true );
|
||||
@@ -441,9 +439,12 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
|
||||
m_nitro_light->setVisible(false);
|
||||
}
|
||||
|
||||
// Exhaust is always emitting
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0);
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0);
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
// Exhaust is always emitting
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0);
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0);
|
||||
}
|
||||
#endif
|
||||
} // updateGraphics
|
||||
|
||||
|
||||
@@ -86,6 +86,16 @@ void MainMenuScreen::loadedFromFile()
|
||||
{
|
||||
LabelWidget* w = getWidget<LabelWidget>("info_addons");
|
||||
w->setScrollSpeed(15);
|
||||
|
||||
RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow");
|
||||
assert(rw_top != NULL);
|
||||
|
||||
if (track_manager->getTrack("overworld") == NULL ||
|
||||
track_manager->getTrack("introcutscene") == NULL ||
|
||||
track_manager->getTrack("introcutscene2") == NULL)
|
||||
{
|
||||
rw_top->removeChildNamed("story");
|
||||
}
|
||||
|
||||
#if DEBUG_MENU_ITEM != 1
|
||||
RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow");
|
||||
@@ -98,6 +108,13 @@ void MainMenuScreen::loadedFromFile()
|
||||
#endif
|
||||
} // loadedFromFile
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void MainMenuScreen::beforeAddingWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
void MainMenuScreen::init()
|
||||
|
||||
@@ -52,6 +52,9 @@ public:
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void beforeAddingWidget() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||
|
||||
@@ -65,6 +65,9 @@ RaceGUI::RaceGUI()
|
||||
{
|
||||
m_enabled = true;
|
||||
|
||||
if (UserConfigParams::m_artist_debug_mode && UserConfigParams::m_hide_gui)
|
||||
m_enabled = false;
|
||||
|
||||
// Determine maximum length of the rank/lap text, in order to
|
||||
// align those texts properly on the right side of the viewport.
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
|
||||
@@ -41,6 +41,7 @@ RaceGUIMultitouch::RaceGUIMultitouch(RaceGUIBase* race_gui)
|
||||
{
|
||||
m_race_gui = race_gui;
|
||||
m_minimap_bottom = 0;
|
||||
m_gui_action = false;
|
||||
m_directionnal_wheel_tex = NULL;
|
||||
m_pause_tex = NULL;
|
||||
m_nitro_tex = NULL;
|
||||
@@ -147,6 +148,7 @@ void RaceGUIMultitouch::initMultitouchSteering()
|
||||
"android/blur_bg_button.png");
|
||||
m_bg_button_focus_tex = irr_driver->getTexture(FileManager::GUI,
|
||||
"android/blur_bg_button_focus.png");
|
||||
m_gui_action_tex = irr_driver->getTexture(FileManager::GUI,"challenge.png");
|
||||
|
||||
} // initMultitouchSteering
|
||||
|
||||
@@ -209,8 +211,12 @@ void RaceGUIMultitouch::drawMultitouchSteering(const AbstractKart* kart,
|
||||
case MultitouchButtonType::BUTTON_FIRE:
|
||||
{
|
||||
const Powerup* powerup = kart->getPowerup();
|
||||
if (powerup->getType() != PowerupManager::POWERUP_NOTHING &&
|
||||
!kart->hasFinishedRace())
|
||||
if (m_gui_action == true)
|
||||
{
|
||||
btn_texture = m_gui_action_tex;
|
||||
}
|
||||
else if (powerup->getType() != PowerupManager::POWERUP_NOTHING
|
||||
&& !kart->hasFinishedRace())
|
||||
{
|
||||
btn_texture = powerup->getIcon()->getTexture();
|
||||
}
|
||||
@@ -271,7 +277,8 @@ void RaceGUIMultitouch::drawMultitouchSteering(const AbstractKart* kart,
|
||||
core::vector2df(scale, scale));
|
||||
}
|
||||
else if (button->type == MultitouchButtonType::BUTTON_FIRE &&
|
||||
kart->getPowerup()->getNum() > 1)
|
||||
kart->getPowerup()->getNum() > 1 &&
|
||||
m_gui_action == false)
|
||||
{
|
||||
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
|
||||
core::rect<s32> pos((int)(button->x),
|
||||
|
||||
@@ -35,6 +35,7 @@ private:
|
||||
RaceGUIBase* m_race_gui;
|
||||
MultitouchDevice* m_device;
|
||||
|
||||
bool m_gui_action;
|
||||
unsigned int m_minimap_bottom;
|
||||
|
||||
video::ITexture* m_directionnal_wheel_tex;
|
||||
@@ -46,6 +47,7 @@ private:
|
||||
video::ITexture* m_drift_tex;
|
||||
video::ITexture* m_bg_button_tex;
|
||||
video::ITexture* m_bg_button_focus_tex;
|
||||
video::ITexture* m_gui_action_tex;
|
||||
|
||||
void initMultitouchSteering();
|
||||
void closeMultitouchSteering();
|
||||
@@ -59,6 +61,7 @@ public:
|
||||
const core::vector2df &scaling);
|
||||
|
||||
unsigned int getMinimapBottom() {return m_minimap_bottom;}
|
||||
void setGuiAction(bool enabled = true) {m_gui_action = enabled;}
|
||||
|
||||
}; // RaceGUIMultitouch
|
||||
|
||||
|
||||
@@ -73,6 +73,10 @@ const int COMPLETED_HARD = 4;
|
||||
RaceGUIOverworld::RaceGUIOverworld()
|
||||
{
|
||||
m_enabled = true;
|
||||
|
||||
if (UserConfigParams::m_artist_debug_mode && UserConfigParams::m_hide_gui)
|
||||
m_enabled = false;
|
||||
|
||||
m_is_first_render_call = true;
|
||||
m_close_to_a_challenge = false;
|
||||
m_current_challenge = NULL;
|
||||
@@ -586,6 +590,11 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
||||
true, true /* vcenter */, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_multitouch_gui != NULL)
|
||||
{
|
||||
m_multitouch_gui->setGuiAction(m_close_to_a_challenge);
|
||||
}
|
||||
#endif // SERVER_ONLY
|
||||
} // drawGlobalMiniMap
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "tracks/quad.hpp"
|
||||
#include "utils/cpp2011.hpp"
|
||||
|
||||
#include <line3d.h>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "io/file_manager.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "matrix4.h"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "tracks/drive_node.hpp"
|
||||
#include "utils/cpp2011.hpp"
|
||||
|
||||
#include <line3d.h>
|
||||
|
||||
/**
|
||||
* \ingroup tracks
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef HEADER_VEC3_HPP
|
||||
#define HEADER_VEC3_HPP
|
||||
|
||||
#include <triangle3d.h>
|
||||
#include <vector3d.h>
|
||||
#include <vector2d.h>
|
||||
using namespace irr;
|
||||
@@ -216,12 +215,8 @@ public:
|
||||
|
||||
float sideofPlane(const Vec3& x1, const Vec3& x2, const Vec3& x3) const
|
||||
{
|
||||
core::triangle3df triangle(x1.toIrrVector(), x2.toIrrVector(), x3.toIrrVector());
|
||||
core::vector3df normal = triangle.getNormal();
|
||||
return normal.dotProduct((*this - x1).toIrrVector());
|
||||
|
||||
return ((x2 - x1).cross(x3 - x1)).dot(*this - x1);
|
||||
} // sideOfPlane
|
||||
}; // Vec3
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user