Merge remote-tracking branch 'origin/master' into new_login
This commit is contained in:
35
data/gfx/gfx_fallingLeaf_a.xml
Normal file
35
data/gfx/gfx_fallingLeaf_a.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For sky particles, the size of the box is ignored -->
|
||||
<particles emitter="box" box_x="10.0" box_y="0.5" box_z="10.0">
|
||||
|
||||
<spreading angle="3" />
|
||||
|
||||
<velocity x="-0.00"
|
||||
y="-0.002"
|
||||
z="-0.00" />
|
||||
|
||||
<material file="gfx_leaf_a.png" clampu="Y" clampv="Y" />
|
||||
|
||||
<!-- Amount of particles emitted per second -->
|
||||
<rate min="2"
|
||||
max="5" />
|
||||
|
||||
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
|
||||
<lifetime min="30000"
|
||||
max="30000" />
|
||||
|
||||
<!-- Size of the particles -->
|
||||
<size min="0.40"
|
||||
max="0.60" />
|
||||
|
||||
<color min="40 40 255"
|
||||
max="255 255 255" />
|
||||
|
||||
<!-- How much time in milliseconds before the particle is fully faded out -->
|
||||
<fadeout time="100" />
|
||||
|
||||
<wind speed="0.16"
|
||||
flips="Y" />
|
||||
|
||||
</particles>
|
||||
@@ -2,34 +2,22 @@
|
||||
<materials>
|
||||
<material name="banana.png"/>
|
||||
<material name="gift-box.png"/>
|
||||
<material name="gift-loop.png" sphere="Y"/>
|
||||
<material name="gold.png" light="Y" smooth-reflection="Y"/>
|
||||
<material name="silver.png" light="Y" smooth-reflection="Y"/>
|
||||
<material name="bronze.png" light="Y" smooth-reflection="Y"/>
|
||||
<material name="gift-loop.png" shader="spheremap"/>
|
||||
<material name="gold.png" light="Y" shader="spheremap"/>
|
||||
<material name="silver.png" light="Y" shader="spheremap"/>
|
||||
<material name="bronze.png" light="Y" shader="spheremap"/>
|
||||
|
||||
<material name="stk_mod_nitroBarrel.png" />
|
||||
<material name="stk_mod_nitroBottle.png" />
|
||||
<material name="stk_mod_nitroLogo.png" compositing="additive" light="N" disable-z-write="Y" />
|
||||
<material name="stk_mod_nitroLogo.png" shader="additive" disable-z-write="Y" />
|
||||
|
||||
<material name="traffic_light_green.jpg" light="N"/>
|
||||
<material name="traffic_light_yellow.jpg" light="N"/>
|
||||
<material name="traffic_light_red.jpg" light="N"/>
|
||||
<material name="traffic_light_green.jpg" shader="unlit"/>
|
||||
<material name="traffic_light_yellow.jpg" shader="unlit"/>
|
||||
<material name="traffic_light_red.jpg" shader="unlit"/>
|
||||
|
||||
<material name="bubblegum_shield.png" compositing="blend" disable-z-write="Y"/>
|
||||
<material name="bubblegum_shield_nolok.png" compositing="blend" disable-z-write="Y"/>
|
||||
<material name="bubblegum_shield.png" shader="alphablend" disable-z-write="Y"/>
|
||||
<material name="bubblegum_shield_nolok.png" shader="alphablend" disable-z-write="Y"/>
|
||||
<material name="parachute.png" backface-culling="n" ignore="Y"/>
|
||||
<material name="zipper.png" light="N" zipper="Y"/>
|
||||
<material name="zipper_collect.png" light="N" zipper="Y"/>
|
||||
<material name="bowling-icon.png" transparency="Y" light="N"/>
|
||||
<material name="bubblegum-icon.png" transparency="Y" light="N"/>
|
||||
<material name="cake-icon.png" transparency="Y" light="N" />
|
||||
<material name="anchor-icon.png" clampU="Y" clampV="Y" transparency="Y" light="N" ignore="Y"/>
|
||||
<material name="plunger-icon.png" transparency="Y" light="N"/>
|
||||
<material name="parachute-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||
<material name="anchor-attach-icon.png" clampU="Y" clampV="Y" transparency="Y" light="N" ignore="Y"/>
|
||||
<material name="parachute-attach-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||
<material name="bomb-attach-icon.png" clampU="Y" clampV="Y" ignore="Y"/>
|
||||
|
||||
<material name="balldimpleddark.jpg"/>
|
||||
<material name="zipper.png" shader="unlit" zipper="Y"/>
|
||||
</materials>
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ void main(void)
|
||||
|
||||
vec4 color = texture(Albedo, uv);
|
||||
if (color.a < 0.5) discard;
|
||||
vec3 LightFactor = scattering + getLightFactor(1.);
|
||||
vec3 LightFactor = (scattering * 0.3) + getLightFactor(1.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
||||
{
|
||||
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
|
||||
{
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
||||
bestMode = i;
|
||||
@@ -282,15 +282,15 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
||||
modes[i]->hdisplay == modes[bestMode]->hdisplay &&
|
||||
modes[i]->vdisplay == modes[bestMode]->vdisplay)
|
||||
{
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
||||
float refresh_rate_tmp = pixels_per_second / pixels_per_frame;
|
||||
|
||||
|
||||
if (refresh_rate_tmp > refresh_rate)
|
||||
{
|
||||
refresh_rate = refresh_rate_tmp;
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bestMode!=-1 &&
|
||||
modes[i]->hdisplay >= Width &&
|
||||
@@ -298,7 +298,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
||||
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
|
||||
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
|
||||
{
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_second = modes[i]->dotclock * 1000.0;
|
||||
float pixels_per_frame = modes[i]->htotal * modes[i]->vtotal;
|
||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
||||
bestMode = i;
|
||||
@@ -746,8 +746,21 @@ bool CIrrDeviceLinux::createWindow()
|
||||
|
||||
if (!CreationParams.WindowId)
|
||||
{
|
||||
Atom *list;
|
||||
Atom type;
|
||||
int form;
|
||||
unsigned long remain, len;
|
||||
|
||||
Atom WMCheck = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", false);
|
||||
Status s = XGetWindowProperty(display, DefaultRootWindow(display),
|
||||
WMCheck, 0L, 1L, False, XA_WINDOW,
|
||||
&type, &form, &len, &remain,
|
||||
(unsigned char **)&list);
|
||||
|
||||
bool netWM = (s == Success) && len;
|
||||
attributes.override_redirect = !netWM && CreationParams.Fullscreen;
|
||||
|
||||
// create new Window
|
||||
attributes.override_redirect = false;
|
||||
window = XCreateWindow(display,
|
||||
RootWindow(display, visual->screen),
|
||||
0, 0, Width, Height, 0, visual->depth,
|
||||
@@ -762,31 +775,45 @@ bool CIrrDeviceLinux::createWindow()
|
||||
|
||||
if (CreationParams.Fullscreen)
|
||||
{
|
||||
// Workaround for Gnome which sometimes creates window smaller than display
|
||||
XSizeHints *hints = XAllocSizeHints();
|
||||
hints->flags=PMinSize;
|
||||
hints->min_width=Width;
|
||||
hints->min_height=Height;
|
||||
XSetWMNormalHints(display, window, hints);
|
||||
XFree(hints);
|
||||
if (netWM)
|
||||
{
|
||||
// Workaround for Gnome which sometimes creates window smaller than display
|
||||
XSizeHints *hints = XAllocSizeHints();
|
||||
hints->flags=PMinSize;
|
||||
hints->min_width=Width;
|
||||
hints->min_height=Height;
|
||||
XSetWMNormalHints(display, window, hints);
|
||||
XFree(hints);
|
||||
|
||||
// Set the fullscreen mode via the window manager. This allows alt-tabing, volume hot keys & others.
|
||||
// Get the needed atom from there freedesktop names
|
||||
Atom WMStateAtom = XInternAtom(display, "_NET_WM_STATE", true);
|
||||
Atom WMFullscreenAtom = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true);
|
||||
// Set the fullscreen property
|
||||
XChangeProperty(display, window, WMStateAtom, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char *>(& WMFullscreenAtom), 1);
|
||||
|
||||
// Notify the root window
|
||||
XEvent xev = {0}; // The event should be filled with zeros before setting its attributes
|
||||
|
||||
xev.type = ClientMessage;
|
||||
xev.xclient.window = window;
|
||||
xev.xclient.message_type = WMStateAtom;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.data.l[0] = 1;
|
||||
xev.xclient.data.l[1] = WMFullscreenAtom;
|
||||
XSendEvent(display, DefaultRootWindow(display), false, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
||||
// Set the fullscreen mode via the window manager. This allows alt-tabing, volume hot keys & others.
|
||||
// Get the needed atom from there freedesktop names
|
||||
Atom WMStateAtom = XInternAtom(display, "_NET_WM_STATE", true);
|
||||
Atom WMFullscreenAtom = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true);
|
||||
// Set the fullscreen property
|
||||
XChangeProperty(display, window, WMStateAtom, XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char *>(& WMFullscreenAtom), 1);
|
||||
|
||||
// Notify the root window
|
||||
XEvent xev = {0}; // The event should be filled with zeros before setting its attributes
|
||||
|
||||
xev.type = ClientMessage;
|
||||
xev.xclient.window = window;
|
||||
xev.xclient.message_type = WMStateAtom;
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.data.l[0] = 1;
|
||||
xev.xclient.data.l[1] = WMFullscreenAtom;
|
||||
XSendEvent(display, DefaultRootWindow(display), false, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetInputFocus(display, window, RevertToParent, CurrentTime);
|
||||
int grabKb = XGrabKeyboard(display, window, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
IrrPrintXGrabError(grabKb, "XGrabKeyboard");
|
||||
int grabPointer = XGrabPointer(display, window, True, ButtonPressMask,
|
||||
GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
||||
IrrPrintXGrabError(grabPointer, "XGrabPointer");
|
||||
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -233,7 +233,7 @@ private:
|
||||
RES_CHANGE_CANCEL} m_resolution_changing;
|
||||
|
||||
public:
|
||||
GLuint SkyboxCubeMap, FakeSkybox;
|
||||
GLuint SkyboxCubeMap;
|
||||
/** A simple class to store video resolutions. */
|
||||
class VideoMode
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ const unsigned int VCLAMP = 2;
|
||||
*/
|
||||
Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SOLID;
|
||||
m_deprecated = deprecated;
|
||||
|
||||
node->get("name", &m_texname);
|
||||
@@ -73,26 +74,20 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
node->get("clampv", &b); if (b) m_clamp_tex |= VCLAMP; //blender 2.4 style
|
||||
node->get("clampV", &b); if (b) m_clamp_tex |= VCLAMP; //blender 2.5 style
|
||||
|
||||
node->get("transparency", &m_alpha_testing );
|
||||
node->get("lightmap", &m_lightmap );
|
||||
node->get("additive-lightmap",&m_additive_lightmap );
|
||||
|
||||
|
||||
std::string s;
|
||||
node->get("adjust-image", &s );
|
||||
if(s=="premultiply")
|
||||
m_adjust_image = ADJ_PREMUL;
|
||||
else if (s=="divide")
|
||||
m_adjust_image = ADJ_DIV;
|
||||
else if (s=="" || s=="none")
|
||||
m_adjust_image = ADJ_NONE;
|
||||
else
|
||||
Log::warn("material",
|
||||
"Incorrect adjust-image specification: '%s' - ignored.",
|
||||
s.c_str());
|
||||
node->get("alpha", &m_alpha_blending );
|
||||
node->get("light", &m_lighting );
|
||||
//node->get("adjust-image", &s );
|
||||
//if(s=="premultiply")
|
||||
// m_adjust_image = ADJ_PREMUL;
|
||||
//else if (s=="divide")
|
||||
// m_adjust_image = ADJ_DIV;
|
||||
//else if (s=="" || s=="none")
|
||||
// m_adjust_image = ADJ_NONE;
|
||||
//else
|
||||
// Log::warn("material",
|
||||
// "Incorrect adjust-image specification: '%s' - ignored.",
|
||||
// s.c_str());
|
||||
|
||||
node->get("smooth-reflection",&m_smooth_reflection_shader);
|
||||
node->get("high-adhesion", &m_high_tire_adhesion);
|
||||
node->get("reset", &m_drive_reset );
|
||||
|
||||
@@ -135,7 +130,6 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
node->get("surface", &m_surface );
|
||||
node->get("ignore", &m_ignore );
|
||||
|
||||
node->get("additive", &m_add );
|
||||
node->get("max-speed", &m_max_speed_fraction);
|
||||
node->get("slowdown-time", &m_slowdown_time );
|
||||
node->get("backface-culling", &m_backface_culling );
|
||||
@@ -160,152 +154,203 @@ Material::Material(const XMLNode *node, int index, bool deprecated)
|
||||
}
|
||||
|
||||
|
||||
s="";
|
||||
node->get("graphical-effect", &s);
|
||||
|
||||
if (s == "water")
|
||||
s = "";
|
||||
if (node->get("shader", &s))
|
||||
{
|
||||
// For backwards compatibility only, eventually remove
|
||||
m_water_splash = true;
|
||||
}
|
||||
else if (s == "bubble")
|
||||
{
|
||||
m_graphical_effect = GE_BUBBLE;
|
||||
}
|
||||
else if (s == "grass")
|
||||
{
|
||||
m_graphical_effect = GE_GRASS;
|
||||
m_grass_speed = 1.5f;
|
||||
m_grass_amplitude = 0.25f;
|
||||
node->get("grass-speed", &m_grass_speed);
|
||||
node->get("grass-amplitude", &m_grass_amplitude);
|
||||
}
|
||||
else if (s == "water_shader")
|
||||
{
|
||||
m_graphical_effect = GE_WATER_SHADER;
|
||||
node->get("water-shader-speed-1", &m_water_shader_speed_1);
|
||||
node->get("water-shader-speed-2", &m_water_shader_speed_2);
|
||||
}
|
||||
else if (s == "normal_map")
|
||||
{
|
||||
m_graphical_effect = GE_NORMAL_MAP;
|
||||
node->get("normal-map", &m_normal_map_tex);
|
||||
node->get("normal-light-map", &m_normal_map_shader_lightmap);
|
||||
|
||||
// TODO: add support for parallax and height maps?
|
||||
/*
|
||||
else if (node->get("normal-heightmap", &m_normal_map_tex))
|
||||
if (s == "solid")
|
||||
{
|
||||
m_is_heightmap = true;
|
||||
m_normal_map = true;
|
||||
m_shader_type = SHADERTYPE_SOLID;
|
||||
}
|
||||
else if (node->get("parallax-map", &m_normal_map_tex))
|
||||
else if (s == "unlit")
|
||||
{
|
||||
m_parallax_map = true;
|
||||
m_parallax_height = 0.2f;
|
||||
node->get("parallax-height", &m_parallax_height);
|
||||
m_shader_type = SHADERTYPE_SOLID_UNLIT;
|
||||
}
|
||||
else if (node->get("parallax-heightmap", &m_normal_map_tex))
|
||||
else if (s == "additive")
|
||||
{
|
||||
m_is_heightmap = true;
|
||||
m_parallax_map = true;
|
||||
m_parallax_height = 0.2f;
|
||||
node->get("parallax-height", &m_parallax_height);
|
||||
m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (s == "spheremap")
|
||||
{
|
||||
m_graphical_effect = GE_SPHERE_MAP;
|
||||
}
|
||||
else if (s == "skybox")
|
||||
{
|
||||
m_graphical_effect = GE_SKYBOX;
|
||||
}
|
||||
else if (s == "splatting")
|
||||
{
|
||||
m_graphical_effect = GE_SPLATTING;
|
||||
node->get("splatting-texture-1", &m_splatting_texture_1);
|
||||
node->get("splatting-texture-2", &m_splatting_texture_2);
|
||||
node->get("splatting-texture-3", &m_splatting_texture_3);
|
||||
node->get("splatting-texture-4", &m_splatting_texture_4);
|
||||
}
|
||||
else if (s == "caustics")
|
||||
{
|
||||
m_graphical_effect = GE_CAUSTICS;
|
||||
}
|
||||
else if (s == "none")
|
||||
{
|
||||
}
|
||||
else if (s != "")
|
||||
{
|
||||
Log::warn("material",
|
||||
"Invalid graphical effect specification: '%s' - ignored.",
|
||||
s.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_graphical_effect = GE_NONE;
|
||||
}
|
||||
|
||||
|
||||
// BACKWARDS COMPATIBILITY, remove eventually
|
||||
bool use_normal_map = false;
|
||||
node->get("use-normal-map", &use_normal_map);
|
||||
|
||||
if (use_normal_map)
|
||||
{
|
||||
if (node->get("normal-map", &m_normal_map_tex))
|
||||
else if (s == "alphatest")
|
||||
{
|
||||
m_graphical_effect = GE_NORMAL_MAP;
|
||||
m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
}
|
||||
else if (s == "alphablend")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
}
|
||||
else if (s == "spheremap")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SPHERE_MAP;
|
||||
}
|
||||
else if (s == "water_shader")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_WATER;
|
||||
node->get("water-shader-speed-1", &m_water_shader_speed_1);
|
||||
node->get("water-shader-speed-2", &m_water_shader_speed_2);
|
||||
}
|
||||
else if (s == "grass")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_VEGETATION;
|
||||
m_grass_speed = 1.5f;
|
||||
m_grass_amplitude = 0.25f;
|
||||
node->get("grass-speed", &m_grass_speed);
|
||||
node->get("grass-amplitude", &m_grass_amplitude);
|
||||
}
|
||||
else if (s == "splatting")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SPLATTING;
|
||||
node->get("splatting-texture-1", &m_splatting_texture_1);
|
||||
node->get("splatting-texture-2", &m_splatting_texture_2);
|
||||
node->get("splatting-texture-3", &m_splatting_texture_3);
|
||||
node->get("splatting-texture-4", &m_splatting_texture_4);
|
||||
}
|
||||
else if (s == "bubble")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_BUBBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::warn("material",
|
||||
"Could not find normal map image in materials.xml");
|
||||
Log::warn("Material", "Unknown shader type <%s> for <%s>", s.c_str(), m_texname.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// BACKWARS COMPATIBILITY, EVENTUALLY REMOVE
|
||||
|
||||
bool b = false;
|
||||
node->get("additive", &b);
|
||||
if (b)
|
||||
m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
|
||||
b = false;
|
||||
node->get("transparency", &b);
|
||||
if (b)
|
||||
m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
|
||||
//node->get("lightmap", &m_lightmap);
|
||||
|
||||
b = false;
|
||||
node->get("alpha", &b);
|
||||
if (b)
|
||||
m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
|
||||
b = true;
|
||||
node->get("light", &b);
|
||||
if (!b)
|
||||
m_shader_type = SHADERTYPE_SOLID_UNLIT;
|
||||
|
||||
b = false;
|
||||
node->get("smooth-reflection", &b);
|
||||
if (b)
|
||||
m_shader_type = SHADERTYPE_SPHERE_MAP;
|
||||
|
||||
|
||||
if (node->get("compositing", &s))
|
||||
{
|
||||
if (s == "blend") m_shader_type = SHADERTYPE_ALPHA_BLEND;
|
||||
else if (s == "test") m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
else if (s == "additive") m_shader_type = SHADERTYPE_ADDITIVE;
|
||||
else if (s == "coverage") m_shader_type = SHADERTYPE_ALPHA_TEST;
|
||||
else if (s != "none")
|
||||
Log::warn("material", "Unknown compositing mode '%s'", s.c_str());
|
||||
}
|
||||
|
||||
node->get("normal-light-map", &m_normal_map_shader_lightmap);
|
||||
s = "";
|
||||
node->get("graphical-effect", &s);
|
||||
|
||||
if (s == "water")
|
||||
{
|
||||
m_water_splash = true;
|
||||
}
|
||||
else if (s == "bubble")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_BUBBLE;
|
||||
}
|
||||
else if (s == "grass")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_VEGETATION;
|
||||
m_grass_speed = 1.5f;
|
||||
m_grass_amplitude = 0.25f;
|
||||
node->get("grass-speed", &m_grass_speed);
|
||||
node->get("grass-amplitude", &m_grass_amplitude);
|
||||
}
|
||||
else if (s == "water_shader")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_WATER;
|
||||
node->get("water-shader-speed-1", &m_water_shader_speed_1);
|
||||
node->get("water-shader-speed-2", &m_water_shader_speed_2);
|
||||
}
|
||||
else if (s == "normal_map")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SOLID;
|
||||
node->get("normal-map", &m_normal_map_tex);
|
||||
}
|
||||
else if (s == "spheremap")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SPHERE_MAP;
|
||||
}
|
||||
else if (s == "splatting")
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SPLATTING;
|
||||
node->get("splatting-texture-1", &m_splatting_texture_1);
|
||||
node->get("splatting-texture-2", &m_splatting_texture_2);
|
||||
node->get("splatting-texture-3", &m_splatting_texture_3);
|
||||
node->get("splatting-texture-4", &m_splatting_texture_4);
|
||||
}
|
||||
else if (s == "none")
|
||||
{
|
||||
}
|
||||
else if (s != "")
|
||||
{
|
||||
Log::warn("material",
|
||||
"Invalid graphical effect specification: '%s' - ignored.",
|
||||
s.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SOLID;
|
||||
}
|
||||
|
||||
bool use_normal_map = false;
|
||||
node->get("use-normal-map", &use_normal_map);
|
||||
|
||||
if (use_normal_map)
|
||||
{
|
||||
if (node->get("normal-map", &m_normal_map_tex))
|
||||
{
|
||||
//m_graphical_effect = GE_NORMAL_MAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::warn("material",
|
||||
"Could not find normal map image in materials.xml");
|
||||
}
|
||||
}
|
||||
|
||||
bool sphere_map = false;
|
||||
node->get("sphere", &sphere_map);
|
||||
if (sphere_map)
|
||||
{
|
||||
m_shader_type = SHADERTYPE_SPHERE_MAP;
|
||||
}
|
||||
|
||||
bool water_shader = false;
|
||||
node->get("water-shader", &water_shader);
|
||||
if (water_shader)
|
||||
{
|
||||
m_shader_type = SHADERTYPE_WATER;
|
||||
node->get("water-shader-speed-1", &m_water_shader_speed_1);
|
||||
node->get("water-shader-speed-2", &m_water_shader_speed_2);
|
||||
}
|
||||
|
||||
// ---- End backwards compatibility
|
||||
}
|
||||
|
||||
|
||||
// BACKWARDS COMPATIBILITY, remove eventually
|
||||
bool sphere_map = false;
|
||||
node->get("sphere", &sphere_map );
|
||||
if (sphere_map)
|
||||
if (m_disable_z_write && m_shader_type != SHADERTYPE_ALPHA_BLEND && m_shader_type != SHADERTYPE_ADDITIVE)
|
||||
{
|
||||
m_graphical_effect = GE_SPHERE_MAP;
|
||||
}
|
||||
|
||||
|
||||
if (node->get("compositing", &s))
|
||||
{
|
||||
if (s == "blend") m_alpha_blending = true;
|
||||
else if (s == "test") m_alpha_testing = true;
|
||||
else if (s == "additive") m_add = true;
|
||||
// backwards compatibility only, no longer supported
|
||||
else if (s == "coverage") m_alpha_testing = true;
|
||||
else if (s != "none")
|
||||
Log::warn("material", "Unknown compositing mode '%s'",
|
||||
s.c_str());
|
||||
}
|
||||
|
||||
if (m_disable_z_write && !m_alpha_blending && !m_add)
|
||||
{
|
||||
Log::warn("material", "Disabling writes to z buffer only makes sense when compositing is blending or additive (for %s)", m_texname.c_str());
|
||||
Log::debug("material", "Disabling writes to z buffer only makes sense when compositing is blending or additive (for %s)", m_texname.c_str());
|
||||
m_disable_z_write = false;
|
||||
}
|
||||
|
||||
bool water_shader = false;
|
||||
node->get("water-shader", &water_shader);
|
||||
if (water_shader)
|
||||
{
|
||||
// BACKWARDS COMPATIBILITY, eventually remove
|
||||
m_graphical_effect = GE_WATER_SHADER;
|
||||
node->get("water-shader-speed-1", &m_water_shader_speed_1);
|
||||
node->get("water-shader-speed-2", &m_water_shader_speed_2);
|
||||
}
|
||||
|
||||
// Terrain-specifc sound effect
|
||||
const unsigned int children_count = node->getNumNodes();
|
||||
for (unsigned int i=0; i<children_count; i++)
|
||||
@@ -376,14 +421,10 @@ void Material::init(unsigned int index)
|
||||
{
|
||||
m_index = index;
|
||||
m_clamp_tex = 0;
|
||||
m_alpha_testing = false;
|
||||
m_lightmap = false;
|
||||
m_additive_lightmap = false;
|
||||
m_adjust_image = ADJ_NONE;
|
||||
m_alpha_blending = false;
|
||||
m_lighting = true;
|
||||
m_shader_type = SHADERTYPE_SOLID;
|
||||
//m_lightmap = false;
|
||||
//m_adjust_image = ADJ_NONE;
|
||||
m_backface_culling = true;
|
||||
m_smooth_reflection_shader = false;
|
||||
m_high_tire_adhesion = false;
|
||||
m_below_surface = false;
|
||||
m_falling_effect = false;
|
||||
@@ -391,7 +432,6 @@ void Material::init(unsigned int index)
|
||||
m_ignore = false;
|
||||
m_drive_reset = false;
|
||||
m_collision_reaction = NORMAL;
|
||||
m_add = false;
|
||||
m_disable_z_write = false;
|
||||
m_water_shader_speed_1 = 6.6667f;
|
||||
m_water_shader_speed_2 = 4.0f;
|
||||
@@ -403,7 +443,6 @@ void Material::init(unsigned int index)
|
||||
m_sfx_max_speed = 30;
|
||||
m_sfx_min_pitch = 1.0f;
|
||||
m_sfx_max_pitch = 1.0f;
|
||||
m_graphical_effect = GE_NONE;
|
||||
m_zipper = false;
|
||||
m_zipper_duration = -1.0f;
|
||||
m_zipper_fade_out_time = -1.0f;
|
||||
@@ -411,8 +450,6 @@ void Material::init(unsigned int index)
|
||||
m_zipper_speed_gain = -1.0f;
|
||||
m_zipper_engine_force = -1.0f;
|
||||
m_zipper_min_speed = -1.0f;
|
||||
m_parallax_map = false;
|
||||
m_is_heightmap = false;
|
||||
m_water_splash = false;
|
||||
m_is_jump_texture = false;
|
||||
m_has_gravity = false;
|
||||
@@ -438,8 +475,8 @@ void Material::install(bool is_full_path, bool complain_if_not_found)
|
||||
else
|
||||
{
|
||||
m_texture = irr_driver->getTexture(full_path,
|
||||
isPreMul(),
|
||||
isPreDiv(),
|
||||
false, //isPreMul(),
|
||||
false, //isPreDiv(),
|
||||
complain_if_not_found);
|
||||
}
|
||||
|
||||
@@ -659,36 +696,35 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
}
|
||||
|
||||
|
||||
int modes = 0;
|
||||
|
||||
if (!m_lighting && irr_driver->isGLSL() && !m_alpha_blending && !m_add)
|
||||
if (m_shader_type == SHADERTYPE_SOLID_UNLIT)
|
||||
{
|
||||
m->MaterialType = irr_driver->getShader(ES_OBJECT_UNLIT);
|
||||
modes++;
|
||||
|
||||
m->AmbientColor = video::SColor(255, 255, 255, 255);
|
||||
m->DiffuseColor = video::SColor(255, 255, 255, 255);
|
||||
m->EmissiveColor = video::SColor(255, 255, 255, 255);
|
||||
m->SpecularColor = video::SColor(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if (m_alpha_testing)
|
||||
if (m_shader_type == SHADERTYPE_ALPHA_TEST)
|
||||
{
|
||||
m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
modes++;
|
||||
}
|
||||
if (m_alpha_blending)
|
||||
{
|
||||
//m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
|
||||
// EMT_TRANSPARENT_ALPHA_CHANNEL does include vertex color alpha into
|
||||
if (m_shader_type == SHADERTYPE_ALPHA_BLEND)
|
||||
{
|
||||
// EMT_TRANSPARENT_ALPHA_CHANNEL doesn't include vertex color alpha into
|
||||
// account, which messes up fading in/out effects. So we use the more
|
||||
// customizable EMT_ONETEXTURE_BLEND instead.
|
||||
m->MaterialType = video::EMT_ONETEXTURE_BLEND ;
|
||||
m->MaterialType = video::EMT_ONETEXTURE_BLEND;
|
||||
m->MaterialTypeParam =
|
||||
pack_textureBlendFunc(video::EBF_SRC_ALPHA,
|
||||
video::EBF_ONE_MINUS_SRC_ALPHA,
|
||||
video::EMFN_MODULATE_1X,
|
||||
video::EAS_TEXTURE | video::EAS_VERTEX_COLOR);
|
||||
|
||||
modes++;
|
||||
}
|
||||
if (m_smooth_reflection_shader)
|
||||
|
||||
if (m_shader_type == SHADERTYPE_SPHERE_MAP)
|
||||
{
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
@@ -697,58 +733,17 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
else
|
||||
{
|
||||
m->MaterialType = video::EMT_SPHERE_MAP;
|
||||
|
||||
// sphere map + alpha blending is a supported combination so in
|
||||
// this case don't increase mode count
|
||||
if (m_alpha_blending)
|
||||
{
|
||||
m->BlendOperation = video::EBO_ADD;
|
||||
}
|
||||
else
|
||||
{
|
||||
modes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_graphical_effect == GE_SPHERE_MAP)
|
||||
{
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
m->MaterialType = irr_driver->getShader(ES_SPHERE_MAP);
|
||||
}
|
||||
else
|
||||
{
|
||||
m->MaterialType = video::EMT_SPHERE_MAP;
|
||||
|
||||
// sphere map + alpha blending is a supported combination so in
|
||||
// this case don't increase mode count
|
||||
if (m_alpha_blending)
|
||||
{
|
||||
m->BlendOperation = video::EBO_ADD;
|
||||
}
|
||||
else
|
||||
{
|
||||
modes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_lightmap)
|
||||
{
|
||||
m->MaterialType = video::EMT_LIGHTMAP;
|
||||
modes++;
|
||||
}
|
||||
if (m_additive_lightmap)
|
||||
{
|
||||
m->MaterialType = video::EMT_LIGHTMAP_ADD;
|
||||
modes++;
|
||||
}
|
||||
//if (m_lightmap)
|
||||
//{
|
||||
// m->MaterialType = video::EMT_LIGHTMAP;
|
||||
//}
|
||||
|
||||
if (m_add)
|
||||
if (m_shader_type == SHADERTYPE_ADDITIVE)
|
||||
{
|
||||
//m->MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
|
||||
|
||||
// EMT_TRANSPARENT_ADD_COLOR does include vertex color alpha into
|
||||
// EMT_TRANSPARENT_ADD_COLOR doesn't include vertex color alpha into
|
||||
// account, which messes up fading in/out effects. So we use the
|
||||
// more customizable EMT_ONETEXTURE_BLEND instead
|
||||
m->MaterialType = video::EMT_ONETEXTURE_BLEND ;
|
||||
@@ -757,39 +752,39 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
video::EMFN_MODULATE_1X,
|
||||
video::EAS_TEXTURE |
|
||||
video::EAS_VERTEX_COLOR);
|
||||
modes++;
|
||||
}
|
||||
if (m_graphical_effect == GE_NORMAL_MAP)
|
||||
|
||||
if (m_shader_type == SHADERTYPE_SOLID && m_normal_map_tex.size() > 0)
|
||||
{
|
||||
IVideoDriver* video_driver = irr_driver->getVideoDriver();
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
|
||||
if (mb->getVertexType() != video::EVT_TANGENTS)
|
||||
Log::error("material", "Requiring normal map without tangent enabled mesh");
|
||||
ITexture* tex = irr_driver->getTexture(m_normal_map_tex);
|
||||
if (m_is_heightmap)
|
||||
{
|
||||
video_driver->makeNormalMapTexture( tex );
|
||||
Log::warn("material", "Requiring normal map without tangent enabled mesh for <%s>",
|
||||
m_texname.c_str());
|
||||
}
|
||||
m->setTexture(1, tex);
|
||||
|
||||
bool with_lightmap = false;
|
||||
|
||||
if (m_normal_map_shader_lightmap.size() > 0)
|
||||
else
|
||||
{
|
||||
ITexture* lm_tex = irr_driver->getTexture(m_normal_map_shader_lightmap);
|
||||
m->setTexture(2, lm_tex);
|
||||
with_lightmap = true;
|
||||
ITexture* tex = irr_driver->getTexture(m_normal_map_tex);
|
||||
m->setTexture(1, tex);
|
||||
|
||||
bool with_lightmap = false;
|
||||
|
||||
//if (m_normal_map_shader_lightmap.size() > 0)
|
||||
//{
|
||||
// ITexture* lm_tex = irr_driver->getTexture(m_normal_map_shader_lightmap);
|
||||
// m->setTexture(2, lm_tex);
|
||||
// with_lightmap = true;
|
||||
//}
|
||||
|
||||
// Material and shaders
|
||||
m->MaterialType = irr_driver->getShader(
|
||||
with_lightmap ? ES_NORMAL_MAP_LIGHTMAP : ES_NORMAL_MAP);
|
||||
m->Lighting = false;
|
||||
m->ZWriteEnable = true;
|
||||
}
|
||||
|
||||
// Material and shaders
|
||||
m->MaterialType = irr_driver->getShader(
|
||||
with_lightmap ? ES_NORMAL_MAP_LIGHTMAP : ES_NORMAL_MAP );
|
||||
m->Lighting = false;
|
||||
m->ZWriteEnable = true;
|
||||
|
||||
modes++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -797,29 +792,30 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->setTexture(1, NULL);
|
||||
}
|
||||
}
|
||||
if (m_parallax_map)
|
||||
{
|
||||
video::ITexture* tex = irr_driver->getTexture(m_normal_map_tex);
|
||||
if (m_is_heightmap)
|
||||
{
|
||||
irr_driver->getVideoDriver()->makeNormalMapTexture( tex );
|
||||
}
|
||||
m->setTexture(1, tex);
|
||||
m->MaterialType = video::EMT_PARALLAX_MAP_SOLID;
|
||||
m->MaterialTypeParam = m_parallax_height;
|
||||
m->SpecularColor.set(0,0,0,0);
|
||||
modes++;
|
||||
}
|
||||
//if (m_parallax_map)
|
||||
//{
|
||||
// video::ITexture* tex = irr_driver->getTexture(m_normal_map_tex);
|
||||
// if (m_is_heightmap)
|
||||
// {
|
||||
// irr_driver->getVideoDriver()->makeNormalMapTexture( tex );
|
||||
// }
|
||||
// m->setTexture(1, tex);
|
||||
// m->MaterialType = video::EMT_PARALLAX_MAP_SOLID;
|
||||
// m->MaterialTypeParam = m_parallax_height;
|
||||
// m->SpecularColor.set(0,0,0,0);
|
||||
// modes++;
|
||||
//}
|
||||
|
||||
if(m_graphical_effect == GE_SKYBOX && irr_driver->isGLSL())
|
||||
{
|
||||
ITexture* tex = irr_driver->getTexture("cloud_mask.png");
|
||||
m->setTexture(1, tex);
|
||||
//if(m_graphical_effect == GE_SKYBOX && irr_driver->isGLSL())
|
||||
//{
|
||||
// ITexture* tex = irr_driver->getTexture("cloud_mask.png");
|
||||
// m->setTexture(1, tex);
|
||||
//
|
||||
//
|
||||
// m->MaterialType = irr_driver->getShader(ES_SKYBOX);
|
||||
//}
|
||||
|
||||
|
||||
m->MaterialType = irr_driver->getShader(ES_SKYBOX);
|
||||
}
|
||||
if (m_graphical_effect == GE_SPLATTING)
|
||||
if (m_shader_type == SHADERTYPE_SPLATTING)
|
||||
{
|
||||
if (irr_driver->supportsSplatting())
|
||||
{
|
||||
@@ -846,12 +842,12 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
|
||||
// Material and shaders
|
||||
m->MaterialType = irr_driver->getShader(ES_SPLATTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
m->MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m->MaterialType = video::EMT_SOLID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Modify lightmap materials so that vertex colors are taken into account.
|
||||
@@ -866,7 +862,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->SpecularColor = video::SColor(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if (m_graphical_effect == GE_BUBBLE && mb != NULL)
|
||||
if (m_shader_type == SHADERTYPE_BUBBLE && mb != NULL)
|
||||
{
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
@@ -876,18 +872,11 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
|
||||
m->MaterialType = irr_driver->getShader(ES_BUBBLES);
|
||||
m->BlendOperation = video::EBO_ADD;
|
||||
|
||||
// alpha blending and bubble shading can work together so when both are enabled
|
||||
// don't increment the 'modes' counter to not get the 'too many modes' warning
|
||||
if (!m_alpha_blending)
|
||||
{
|
||||
modes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_graphical_effect == GE_WATER_SHADER)
|
||||
if (m_shader_type == SHADERTYPE_WATER)
|
||||
{
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
@@ -901,10 +890,9 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
|
||||
m->MaterialType = irr_driver->getShader(ES_WATER);
|
||||
}
|
||||
modes++;
|
||||
}
|
||||
|
||||
if (m_graphical_effect == GE_GRASS)
|
||||
if (m_shader_type == SHADERTYPE_VEGETATION)
|
||||
{
|
||||
if (UserConfigParams::m_weather_effects &&
|
||||
irr_driver->isGLSL())
|
||||
@@ -916,22 +904,20 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
setAmplitude(m_grass_amplitude);
|
||||
|
||||
// Material and shaders
|
||||
if (m_alpha_testing)
|
||||
{
|
||||
//if (m_alpha_testing)
|
||||
//{
|
||||
m->MaterialType = irr_driver->getShader(ES_GRASS_REF);
|
||||
}
|
||||
else {
|
||||
m->MaterialType = irr_driver->getShader(ES_GRASS);
|
||||
m->BlendOperation = video::EBO_ADD;
|
||||
}
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m->MaterialType = irr_driver->getShader(ES_GRASS);
|
||||
// m->BlendOperation = video::EBO_ADD;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
m->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
}
|
||||
}
|
||||
|
||||
if (modes > 1)
|
||||
{
|
||||
std::cerr << "[Material::setMaterialProperties] More than one main "
|
||||
"mode set for " << m_texname.c_str() << "\n";
|
||||
}
|
||||
|
||||
if (m_disable_z_write)
|
||||
@@ -939,15 +925,6 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
|
||||
m->ZWriteEnable = false;
|
||||
}
|
||||
|
||||
if (!m_lighting)
|
||||
{
|
||||
//m->setFlag( video::EMF_LIGHTING, false );
|
||||
m->AmbientColor = video::SColor(255, 255, 255, 255);
|
||||
m->DiffuseColor = video::SColor(255, 255, 255, 255);
|
||||
m->EmissiveColor = video::SColor(255, 255, 255, 255);
|
||||
m->SpecularColor = video::SColor(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if(UserConfigParams::m_rendering_debug)
|
||||
{
|
||||
@@ -1024,7 +1001,7 @@ void Material::adjustForFog(scene::ISceneNode* parent, video::SMaterial *m,
|
||||
// to disable fog in the new pipeline, we slightly abuse the steps :
|
||||
// moving an object into the transparent pass will make it rendered
|
||||
// above fog and thus unaffected by it
|
||||
if (use_fog && !m_fog && !m_alpha_blending && !m_add)
|
||||
if (use_fog && !m_fog && m_shader_type != SHADERTYPE_ALPHA_BLEND && m_shader_type != SHADERTYPE_ADDITIVE)
|
||||
{
|
||||
m->ZWriteEnable = true;
|
||||
m->MaterialType = video::EMT_ONETEXTURE_BLEND;
|
||||
|
||||
@@ -46,17 +46,21 @@ class ParticleKind;
|
||||
class Material : public NoCopy
|
||||
{
|
||||
public:
|
||||
enum GraphicalEffect {GE_NONE,
|
||||
/** Effect where the UV texture is moved in a wave pattern */
|
||||
GE_BUBBLE,
|
||||
/** Effect that makes grass wave as in the wind */
|
||||
GE_GRASS,
|
||||
GE_WATER_SHADER,
|
||||
GE_SPHERE_MAP,
|
||||
GE_SPLATTING,
|
||||
GE_SKYBOX,
|
||||
GE_NORMAL_MAP,
|
||||
GE_CAUSTICS};
|
||||
enum ShaderType
|
||||
{
|
||||
SHADERTYPE_SOLID,
|
||||
SHADERTYPE_ALPHA_TEST,
|
||||
SHADERTYPE_ALPHA_BLEND,
|
||||
SHADERTYPE_ADDITIVE,
|
||||
SHADERTYPE_SOLID_UNLIT,
|
||||
/** Effect where the UV texture is moved in a wave pattern */
|
||||
SHADERTYPE_BUBBLE,
|
||||
/** Effect that makes grass wave as in the wind */
|
||||
SHADERTYPE_VEGETATION,
|
||||
SHADERTYPE_WATER,
|
||||
SHADERTYPE_SPHERE_MAP,
|
||||
SHADERTYPE_SPLATTING
|
||||
};
|
||||
|
||||
enum ParticleConditions
|
||||
{
|
||||
@@ -82,7 +86,9 @@ private:
|
||||
/** Name of a special sfx to play when a kart is on this terrain, or
|
||||
* "" if no special sfx exists. */
|
||||
std::string m_sfx_name;
|
||||
GraphicalEffect m_graphical_effect;
|
||||
|
||||
ShaderType m_shader_type;
|
||||
|
||||
/** Set if being on this surface means being under some other mesh.
|
||||
* This is used to simulate that a kart is in water: the ground under
|
||||
* the water is marked as 'm_below_surface', which will then trigger a raycast
|
||||
@@ -117,11 +123,11 @@ private:
|
||||
bool m_has_gravity;
|
||||
|
||||
/** Speed of the 'main' wave in the water shader. Only used if
|
||||
m_graphical_effect == WATER_SHADER */
|
||||
m_shader_type == SHDERTYPE_WATER */
|
||||
float m_water_shader_speed_1;
|
||||
|
||||
/** Speed of the 'secondary' waves in the water shader. Only used if
|
||||
m_graphical_effect == WATER_SHADER */
|
||||
m_shader_type == SHADERTYPE_WATER */
|
||||
float m_water_shader_speed_2;
|
||||
|
||||
/** If a kart is rescued when crashing into this surface. */
|
||||
@@ -130,13 +136,13 @@ private:
|
||||
/** Particles to show on touch */
|
||||
std::string m_collision_particles;
|
||||
|
||||
/** If m_shader_type == SHADERTYPE_VEGETATION */
|
||||
float m_grass_speed;
|
||||
float m_grass_amplitude;
|
||||
|
||||
/** If the property should be ignored in the physics. Example would be
|
||||
* plants that a kart can just drive through. */
|
||||
bool m_ignore;
|
||||
bool m_add;
|
||||
|
||||
bool m_fog;
|
||||
|
||||
@@ -144,21 +150,10 @@ private:
|
||||
|
||||
/** For normal maps */
|
||||
std::string m_normal_map_tex;
|
||||
std::string m_normal_map_shader_lightmap;
|
||||
|
||||
//bool m_normal_map_uv2; //!< Whether to use a second UV layer for normal map
|
||||
bool m_is_heightmap;
|
||||
bool m_parallax_map;
|
||||
float m_parallax_height;
|
||||
|
||||
/** Texture clamp bitmask */
|
||||
unsigned int m_clamp_tex;
|
||||
|
||||
bool m_lighting;
|
||||
bool m_smooth_reflection_shader;
|
||||
bool m_alpha_testing;
|
||||
bool m_alpha_blending;
|
||||
|
||||
/** True if backface culliing should be enabled. */
|
||||
bool m_backface_culling;
|
||||
|
||||
@@ -167,18 +162,21 @@ private:
|
||||
|
||||
/** Some textures need to be pre-multiplied, some divided to give
|
||||
* the intended effect. */
|
||||
enum {ADJ_NONE, ADJ_PREMUL, ADJ_DIV}
|
||||
m_adjust_image;
|
||||
/** True if (blending) lightmapping is enabled for this material. */
|
||||
bool m_lightmap;
|
||||
/** True if (additive) lightmapping is enabled for this material. */
|
||||
bool m_additive_lightmap;
|
||||
//enum {ADJ_NONE, ADJ_PREMUL, ADJ_DIV}
|
||||
// m_adjust_image;
|
||||
|
||||
/** True if lightmapping is enabled for this material. */
|
||||
//bool m_lightmap;
|
||||
|
||||
/** True if the material shouldn't be "slippy" at an angle */
|
||||
bool m_high_tire_adhesion;
|
||||
|
||||
/** How much the top speed is reduced per second. */
|
||||
float m_slowdown_time;
|
||||
|
||||
/** Maximum speed at which no more slow down occurs. */
|
||||
float m_max_speed_fraction;
|
||||
|
||||
/** Minimum speed on this terrain. This is used for zippers on a ramp to
|
||||
* guarantee the right jump distance. A negative value indicates no
|
||||
* minimum speed. */
|
||||
@@ -211,7 +209,7 @@ private:
|
||||
float m_zipper_fade_out_time;
|
||||
/** Additional engine force. */
|
||||
float m_zipper_engine_force;
|
||||
|
||||
|
||||
std::string m_mask;
|
||||
|
||||
/** If m_splatting is true, indicates the first splatting texture */
|
||||
@@ -249,7 +247,6 @@ public:
|
||||
bool isIgnore () const { return m_ignore; }
|
||||
/** Returns true if this material is a zipper. */
|
||||
bool isZipper () const { return m_zipper; }
|
||||
bool isSphereMap () const { return m_graphical_effect == GE_SPHERE_MAP; }
|
||||
/** Returns if this material should trigger a rescue if a kart
|
||||
* is driving on it. */
|
||||
bool isDriveReset () const { return m_drive_reset; }
|
||||
@@ -264,14 +261,19 @@ public:
|
||||
getTexFname () const { return m_texname; }
|
||||
int getIndex () const { return m_index; }
|
||||
|
||||
bool isTransparent () const { return m_alpha_testing || m_alpha_blending || m_add; }
|
||||
bool isTransparent () const
|
||||
{
|
||||
return m_shader_type == SHADERTYPE_ADDITIVE ||
|
||||
m_shader_type == SHADERTYPE_ALPHA_BLEND ||
|
||||
m_shader_type == SHADERTYPE_ALPHA_TEST;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this materials need pre-multiply of alpha. */
|
||||
bool isPreMul() const {return m_adjust_image==ADJ_PREMUL; }
|
||||
//bool isPreMul() const {return m_adjust_image==ADJ_PREMUL; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this materials need pre-division of alpha. */
|
||||
bool isPreDiv() const {return m_adjust_image==ADJ_DIV; }
|
||||
//bool isPreDiv() const {return m_adjust_image==ADJ_DIV; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the fraction of maximum speed on this material. */
|
||||
float getMaxSpeedFraction() const { return m_max_speed_fraction; }
|
||||
@@ -281,9 +283,6 @@ public:
|
||||
* karts. So a short time will slowdown a kart much faster. */
|
||||
float getSlowDownTime() const { return m_slowdown_time; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this material should have smoke effect. */
|
||||
//bool hasSmoke () const { return m_graphical_effect==GE_SMOKE;}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this material is under some other mesh and therefore
|
||||
* requires another raycast to find the surface it is under (used for
|
||||
* gfx, e.g. driving under water to find where the water splash should
|
||||
@@ -341,14 +340,11 @@ public:
|
||||
* on lower speeds. A negative value indicates no minimum speed. */
|
||||
float getZipperMinSpeed() const { return m_zipper_min_speed; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isNormalMap() const { return m_graphical_effect == GE_NORMAL_MAP; }
|
||||
|
||||
ShaderType getShaderType() const { return m_shader_type; }
|
||||
// ------------------------------------------------------------------------
|
||||
void onMadeVisible(scene::IMeshBuffer* who);
|
||||
void onHidden(scene::IMeshBuffer* who);
|
||||
void isInitiallyHidden(scene::IMeshBuffer* who);
|
||||
/** For particle system : specify if the particle should be additively blended
|
||||
*/
|
||||
bool isAlphaAdditive() const { return !m_alpha_blending; }
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -453,7 +453,10 @@ void ParticleEmitter::setParticleType(const ParticleKind* type)
|
||||
m_node = irr_driver->addParticleNode();
|
||||
|
||||
if (m_is_glsl)
|
||||
static_cast<ParticleSystemProxy *>(m_node)->setAlphaAdditive(type->getMaterial()->isAlphaAdditive());
|
||||
{
|
||||
bool additive = (type->getMaterial()->getShaderType() == Material::SHADERTYPE_ADDITIVE);
|
||||
static_cast<ParticleSystemProxy *>(m_node)->setAlphaAdditive(additive);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_parent != NULL)
|
||||
|
||||
@@ -313,7 +313,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, std::vector
|
||||
}
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Skybox", 0xFF, 0x00, 0xFF);
|
||||
renderSkybox(camnode);
|
||||
if (!SkyboxTextures.empty())
|
||||
renderSkybox(camnode);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Glow", 0xFF, 0xFF, 0x00);
|
||||
@@ -493,17 +494,44 @@ void IrrDriver::renderSolidFirstPass()
|
||||
glUseProgram(MeshShader::ObjectPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_DEFAULT>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawObjectPass1(*GroupedFPSM<FPSM_DEFAULT>::MeshSet[i], GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i]);
|
||||
const GLMesh &mesh = *GroupedFPSM<FPSM_DEFAULT>::MeshSet[i];
|
||||
if (mesh.textures[0])
|
||||
{
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTexture(0, 0, GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, false);
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ONE };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
draw<MeshShader::ObjectPass1Shader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i], 0);
|
||||
if (!mesh.textures[0])
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
}
|
||||
|
||||
glUseProgram(MeshShader::ObjectRefPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawObjectRefPass1(*GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix);
|
||||
const GLMesh &mesh = *GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i];
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
draw<MeshShader::ObjectRefPass1Shader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MVPSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet[i], GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::MeshSet[i]->TextureMatrix, 0);
|
||||
}
|
||||
glUseProgram(MeshShader::NormalMapShader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet.size(); ++i)
|
||||
{
|
||||
drawNormalPass(*GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i]);
|
||||
const GLMesh &mesh = *GroupedFPSM<FPSM_NORMAL_MAP>::MeshSet[i];
|
||||
assert(mesh.textures[1]);
|
||||
compressTexture(mesh.textures[1], false);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(1, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
draw<MeshShader::NormalMapShader>(mesh, mesh.vao_first_pass, GroupedFPSM<FPSM_NORMAL_MAP>::MVPSet[i], GroupedFPSM<FPSM_NORMAL_MAP>::TIMVSet[i], 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1375,20 +1403,6 @@ void IrrDriver::generateSkyboxCubemap()
|
||||
|
||||
void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
{
|
||||
if (SkyboxTextures.empty() && FakeSkybox)
|
||||
{
|
||||
glGenTextures(1, &FakeSkybox);
|
||||
|
||||
unsigned w = 1, h = 1;
|
||||
|
||||
char *rgba[6];
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
rgba[i] = new char[w * h * 4];
|
||||
for (unsigned i = 0; i < 6; i++)
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_COMPRESSED_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SkyboxCubeMap)
|
||||
generateSkyboxCubemap();
|
||||
glBindVertexArray(MeshShader::SkyboxShader::cubevao);
|
||||
|
||||
@@ -213,56 +213,6 @@ core::vector3df getWind()
|
||||
return m_speed * vector3df(1., 0., 0.) * cos(time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
if (mesh.textures[0])
|
||||
{
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTexture(0, 0, GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, false);
|
||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ONE };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
MeshShader::ObjectPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, 0);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
|
||||
if (!mesh.textures[0])
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
}
|
||||
|
||||
void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
|
||||
MeshShader::ObjectRefPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix, 0);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
@@ -280,26 +230,6 @@ void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectio
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelMatrix, const core::matrix4 &InverseModelMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
assert(mesh.textures[1]);
|
||||
compressTexture(mesh.textures[1], false);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[1]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(1, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
|
||||
MeshShader::NormalMapShader::setUniforms(ModelMatrix, InverseModelMatrix, 0, 1);
|
||||
|
||||
assert(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
|
||||
@@ -89,9 +89,22 @@ std::vector<core::matrix4> GroupedFPSM<T>::MVPSet;
|
||||
template<enum GeometricMaterial T>
|
||||
std::vector<core::matrix4> GroupedFPSM<T>::TIMVSet;
|
||||
|
||||
void drawObjectPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView);
|
||||
void drawNormalPass(const GLMesh &mesh, const core::matrix4 & ModelMatrix, const core::matrix4 &InverseModelMatrix);
|
||||
void drawObjectRefPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix);
|
||||
|
||||
template<typename Shader, typename...uniforms>
|
||||
void draw(const GLMesh &mesh, GLuint vao, uniforms... Args)
|
||||
{
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
Shader::setUniforms(Args...);
|
||||
|
||||
assert(vao);
|
||||
glBindVertexArray(vao);
|
||||
glDrawElements(ptype, count, itype, 0);
|
||||
}
|
||||
|
||||
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir);
|
||||
|
||||
// Pass 2 shader (ie shaders that outputs final color)
|
||||
|
||||
@@ -197,18 +197,9 @@ void STKMeshSceneNode::drawSolidPass1(const GLMesh &mesh, GeometricMaterial type
|
||||
windDir = getWind();
|
||||
switch (type)
|
||||
{
|
||||
case FPSM_NORMAL_MAP:
|
||||
drawNormalPass(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
|
||||
break;
|
||||
case FPSM_ALPHA_REF_TEXTURE:
|
||||
drawObjectRefPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, mesh.TextureMatrix);
|
||||
break;
|
||||
case FPSM_GRASS:
|
||||
drawGrassPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView, windDir);
|
||||
break;
|
||||
case FPSM_DEFAULT:
|
||||
drawObjectPass1(mesh, ModelViewProjectionMatrix, TransposeInverseModelView);
|
||||
break;
|
||||
default:
|
||||
assert(0 && "wrong geometric material");
|
||||
}
|
||||
|
||||
@@ -175,6 +175,12 @@ void RegisterScreen::doRegister()
|
||||
{
|
||||
m_info_widget->setText(_("Email has to be between 4 and 50 characters long!"), false);
|
||||
}
|
||||
else if ( email.find(L"@")== -1 || email.find(L".")== -1 ||
|
||||
(email.findLast(L'.') - email.findLast(L'@') <= 2 ) ||
|
||||
email.findLast(L'@')==0 )
|
||||
{
|
||||
m_info_widget->setText(_("Email is invalid!"), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info_widget->setDefaultColor();
|
||||
|
||||
Reference in New Issue
Block a user