This commit is contained in:
gl3nn 2014-01-17 04:58:29 +01:00
commit 97c19ece3c
19 changed files with 1364 additions and 242 deletions

View File

@ -1,5 +1,4 @@
SuperTuxkart 0.8.1 ##SuperTuxKart 0.8.1
~~~~~~~~~~~~~~~
* New track STK Enterprise * New track STK Enterprise
* Updated track The old mines * Updated track The old mines
* Updated Lighthouse track * Updated Lighthouse track
@ -20,8 +19,7 @@ SuperTuxkart 0.8.1
SuperTuxkart 0.8 ##SuperTuxKart 0.8
~~~~~~~~~~~~~~~
* Story mode and new challenge set * Story mode and new challenge set
* Improved AI * Improved AI
* Skidding and better collision physics * Skidding and better collision physics
@ -36,8 +34,7 @@ SuperTuxkart 0.8
* New music * New music
SuperTuxKart 0.7.3 ##SuperTuxKart 0.7.3
~~~~~~~~~~~~~~~~~~
* New Zen Garden and Subsea tracks * New Zen Garden and Subsea tracks
* New Island battle arena * New Island battle arena
* New Suzanne kart * New Suzanne kart
@ -53,8 +50,7 @@ SuperTuxKart 0.7.3
* Better placement of rescued karts * Better placement of rescued karts
* Transition track-making to blender 2.5/2.6 * Transition track-making to blender 2.5/2.6
SuperTuxKart 0.7.2 ##SuperTuxKart 0.7.2
~~~~~~~~~~~~~~~~~~
* Added in-game addon manager * Added in-game addon manager
* Fixed major memory leaks * Fixed major memory leaks
* New Snow Peak track by Samuncle * New Snow Peak track by Samuncle
@ -64,13 +60,11 @@ SuperTuxKart 0.7.2
* Improve gamepad configuration under Windows (add ability to tell gamepads apart) * Improve gamepad configuration under Windows (add ability to tell gamepads apart)
* Various other tweaks done and glitches fixed * Various other tweaks done and glitches fixed
SuperTuxkart 0.7.1b ##SuperTuxKart 0.7.1b
~~~~~~~~~~~~~~~~~~~
* Fix circular dependency in challenges * Fix circular dependency in challenges
* Updated translations * Updated translations
SuperTuxKart 0.7.1 ##SuperTuxKart 0.7.1
~~~~~~~~~~~~~~~~~~
* Particle (smoke, splash, fire) and weather effects * Particle (smoke, splash, fire) and weather effects
* New Fort Magma by Samuncle, new Shiny Suburbs track by Horace * New Fort Magma by Samuncle, new Shiny Suburbs track by Horace
* New Beagle kart by wolterh * New Beagle kart by wolterh
@ -89,9 +83,9 @@ SuperTuxKart 0.7.1
* Full RTL (right to left) support * Full RTL (right to left) support
* Various other tweaks done and glitches fixed * Various other tweaks done and glitches fixed
SuperTuxKart 0.7 (December 2010) ##SuperTuxKart 0.7 (December 2010)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Too many to list them all. Main points: Too many to list them all. Main points:
* Irrlicht: * Irrlicht:
- Ported from plib to irrlicht - Ported from plib to irrlicht
- Added animations to karts and some tracks - Added animations to karts and some tracks
@ -103,48 +97,34 @@ Too many to list them all. Main points:
* New art: * New art:
- New tracks farm, hacienda, scotland, secret garden - New tracks farm, hacienda, scotland, secret garden
SuperTuxKart 0.6.2a (October 2009) ##SuperTuxKart 0.6.2a (October 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: STK would crash while trying to save the config file * Bugfix: STK would crash while trying to save the config file
on Windows Vista. on Windows Vista.
SuperTuxKart 0.6.2 (July 2009) ##SuperTuxKart 0.6.2 (July 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: Game could crash in rare circumstances. * Bugfix: Game could crash in rare circumstances.
* Bugfix: Restarting a GP (with the in-race menu ESC) would * Bugfix: Restarting a GP (with the in-race menu ESC) would not subtract already allocated points.
not subtract already allocated points.
* Bugfix: A race could be finished with an invalid shortcut. * Bugfix: A race could be finished with an invalid shortcut.
* Bugfix: Playing a challenge after a splitscreen game would * Bugfix: Playing a challenge after a splitscreen game would play the challenge in split screen.
play the challenge in split screen.
* Bugfix: Items explode over void. * Bugfix: Items explode over void.
* Bugfix: Grass in castle arena slowed down the kart. * Bugfix: Grass in castle arena slowed down the kart.
* Bugfix: GP result showed kart identifier instead of name. * Bugfix: GP result showed kart identifier instead of name.
* Improvement: there is now 1 1 sec. wait period for the race * Improvement: there is now 1 1 sec. wait period for the race result screen, avoiding the problem that someone presses space/enter at the end of a race, immediately quitting the menu before it can be read.
result screen, avoiding the problem that someone
presses space/enter at the end of a race, immediately
quitting the menu before it can be read.
SuperTuxKart 0.6.1a (February 2009) ##SuperTuxKart 0.6.1a (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Bugfix: battle mode would not display track groups. * Bugfix: battle mode would not display track groups.
SuperTuxKart 0.6.1 (February 2009) ##SuperTuxKart 0.6.1 (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Added new kart ("Puffy"), new battle map ("Cave"), and new music for Snow Mountain.
* Added new kart ("Puffy"), new battle map ("Cave"), and new music * Fixed bug in track selection screen that could cause a crash when track groups were used.
for Snow Mountain. * Fixed crash in character selection that could happen if an old user config file existed.
* Fixed bug in track selection screen that could cause a crash
when track groups were used.
* Fixed crash in character selection that could happen if an
old user config file existed.
* Fixed incorrect rescues in Fort Magma. * Fixed incorrect rescues in Fort Magma.
* Improved track selection screen to not display empty track * Improved track selection screen to not display empty track groups.
groups.
* A plunger in the face is now removed when restarting. * A plunger in the face is now removed when restarting.
* Added slow-down for karts driving backwards. * Added slow-down for karts driving backwards.
* Somewhat reduced 'shaking' of AI driven karts. * Somewhat reduced 'shaking' of AI driven karts.
SuperTuxKart 0.6 (January 2009) ##SuperTuxKart 0.6 (January 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* New improved physics and kart handling * New improved physics and kart handling
* Added sharp turns and nitro speed boost (replacing wheelies and jump) * Added sharp turns and nitro speed boost (replacing wheelies and jump)
* Totally rewrote powerups (plunger, bowling ball, cake, bubblegum) and new look for bananas * Totally rewrote powerups (plunger, bowling ball, cake, bubblegum) and new look for bananas
@ -167,10 +147,8 @@ SuperTuxKart 0.6 (January 2009)
- Fixed 'joystick locks' (kart would turn even if the joystick is in neutral), - Fixed 'joystick locks' (kart would turn even if the joystick is in neutral),
thanks to Samjam for the patch. thanks to Samjam for the patch.
SuperTuxKart 0.5 (May 2008) ##SuperTuxKart 0.5 (May 2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Six new tracks and one improved track: Fort Magma, SnowTux Peak, Amazonian Journey, City, Canyon, Crescent Crossing and StarTrack
* Six new tracks and one improved track: Fort Magma, SnowTux Peak, Amazonian Journey, City,
Canyon, Crescent Crossing and StarTrack
* Complete Challenges to unlock game modes, new tracks and a skidding preview * Complete Challenges to unlock game modes, new tracks and a skidding preview
* New Follow the Leader game mode * New Follow the Leader game mode
* New Grand Prix * New Grand Prix
@ -179,12 +157,11 @@ SuperTuxKart 0.5 (May 2008)
* German, French, Dutch, Spanish, Italian and Swedish translations * German, French, Dutch, Spanish, Italian and Swedish translations
* Additional music * Additional music
* Many Bugfixes including: * Many Bugfixes including:
a memory leak fix (Charlie Head) - a memory leak fix (Charlie Head)
an AI crash fix (Chris Morris) - an AI crash fix (Chris Morris)
SuperTuxKart 0.4 (February 2008) ##SuperTuxKart 0.4 (February 2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* New physics handling using the bullet physics engine * New physics handling using the bullet physics engine
* New kart: wilber * New kart: wilber
* Improved 'Shifting Sands' and 'Lighthouse' tracks * Improved 'Shifting Sands' and 'Lighthouse' tracks
@ -195,8 +172,7 @@ SuperTuxKart 0.4 (February 2008)
* Additional music and main theme * Additional music and main theme
SuperTuxKart 0.3 (May 2007) ##SuperTuxKart 0.3 (May 2007)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Highscore lists * Highscore lists
* Shortcut detection * Shortcut detection
* Improved AI * Improved AI
@ -226,8 +202,7 @@ SuperTuxKart 0.3 (May 2007)
- Fixed keyboard keys unable to work on the first key press bug - Fixed keyboard keys unable to work on the first key press bug
- And others - And others
SuperTuxKart 0.2 (22. Sep 2006) ##SuperTuxKart 0.2 (22. Sep 2006)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Significant performance improvement by using display lists * Significant performance improvement by using display lists
* Improved AI * Improved AI
* Support for different grand prixs * Support for different grand prixs
@ -245,83 +220,61 @@ SuperTuxKart 0.2 (22. Sep 2006)
* Added help and about screens, added credits to track designer * Added help and about screens, added credits to track designer
* Items were added to all tracks * Items were added to all tracks
SuperTuxKart 0.1 (04. May 2006) (not officially released) ##SuperTuxKart 0.1 (04. May 2006) (not officially released)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Significant speedup by using a new HOT and collision algorithm --> all tracks are now playable
* Significant speedup by using a new HOT and collision algorithm
--> all tracks are now playable
* Removed all SDL dependencies, only plib is needed * Removed all SDL dependencies, only plib is needed
* Single and multi-window menu can be used * Single and multi-window menu can be used
* Code structure changes * Code structure changes
* Some bug fixes and small improvements * Some bug fixes and small improvements
* Added profile option to support automatic profiling * Added profile option to support automatic profiling
SuperTuxKart 0.0.0 (22. Dec 2004) ##SuperTuxKart 0.0.0 (22. Dec 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* new tracks * new tracks
* new characters and karts * new characters and karts
* new user-interface * new user-interface
* some additional effects (skid-marks, smoke) * some additional effects (skid-marks, smoke)
TuxKart v0.4.0 (March 19th 2004) ##TuxKart v0.4.0 (March 19th 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.8.0 and later. * Changes for compatibility with PLIB 1.8.0 and later.
* Removed some features that were only there to support * Removed some features that were only there to support
truly ancient graphics cards like 3Dfx Voodoo-1/2. truly ancient graphics cards like 3Dfx Voodoo-1/2.
TuxKart v0.3.0 (??) ##TuxKart v0.3.0 (??)
~~~~~~~~~~~~~~~~~~~
* Converted to use the new PLIB/PW library and thus * Converted to use the new PLIB/PW library and thus
avoid the need to link to GLUT. avoid the need to link to GLUT.
TuxKart v0.2.0 (Sept 3rd 2002) ##TuxKart v0.2.0 (Sept 3rd 2002)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.6.0 and later. * Changes for compatibility with PLIB 1.6.0 and later.
TuxKart v0.0.5 (??) ##TuxKart v0.0.5 (??)
~~~~~~~~~~~~~~~~~~~
* Changes for compatibility with PLIB 1.4.0 and later. * Changes for compatibility with PLIB 1.4.0 and later.
TuxKart v0.0.4 (??) ##TuxKart v0.0.4 (??)
~~~~~~~~~~~~~~~~~~~
* Changes to suit rassin-frassin-Windoze-junk. * Changes to suit rassin-frassin-Windoze-junk.
* Steady-cam camera - courtesy of cowtan@ysbl.york.ac.uk * Steady-cam camera - courtesy of cowtan@ysbl.york.ac.uk
* Changes for compatibility with PLIB 1.3.1 and later. * Changes for compatibility with PLIB 1.3.1 and later.
* Added new music courtesy of Matt Thomas. * Added new music courtesy of Matt Thomas.
TuxKart v0.0.3 (July 4th 2000) ##TuxKart v0.0.3 (July 4th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Fixed bug in Keyboard driver when no * Fixed bug in Keyboard driver when no
joystick driver is installed. joystick driver is installed.
* More CygWin fixes. * More CygWin fixes.
* Started new feature to allow you to be * Started new feature to allow you to be
rescued from lava, etc. rescued from lava, etc.
TuxKart v0.0.2 (July 2nd 2000) ##TuxKart v0.0.2 (July 2nd 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added ability to add new tracks without * Added ability to add new tracks without
recompiling. recompiling.
* Can now drive using keyboard only - no joystick * Can now drive using keyboard only - no joystick
required. required.
* Should compile and run under Windoze using CygWin. * Should compile and run under Windoze using CygWin.
TuxKart v0.0.1 (July 1st 2000) ##TuxKart v0.0.1 (July 1st 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Fixed a couple of files missing in initial * Fixed a couple of files missing in initial
Distro. Distro.
TuxKart v0.0.0 (June 29th 2000) ##TuxKart v0.0.0 (June 29th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* First CVS release. * First CVS release.
TuxKart (unnumbered) (April 13th 2000) ##TuxKart (unnumbered) (April 13th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* First hack. * First hack.
# EOF #

View File

@ -1 +0,0 @@
See the ChangeLog file.

View File

@ -1,43 +1,37 @@
##TODO
SuperTuxKart is looking for additional man power to make this SuperTuxKart is looking for additional man power to make this
one of the best free linux games out there :) We need (in one of the best free linux games out there :) We need (in
no particular order): no particular order):
1) Musicians/sound engineers 1. Musicians/sound engineers
- Create additional background soundtrack - Create additional background soundtrack
- Create sound effects - Create sound effects
2. Artists and track designer
2) Artists and track designer
- Create additional tracks - Create additional tracks
- Create additional art work for tracks, - Create additional art work for tracks,
background images background images
3. Developers
3) Developers
- See todo list below - it's rather long at the moment :) - See todo list below - it's rather long at the moment :)
4. Web master
4) Web master
- Extend the current web page, keep it up to date - Extend the current web page, keep it up to date
5. Tester
5) Tester
- For just about everything - For just about everything
- Esp. different platforms - Esp. different platforms
6. Package creators
6) Package creators
- Create packages for - Create packages for
- most common linux Distributors - most common Linux Distributors
- Windows - Windows
7. Writers
7) Writers
- Write documentation, ranging from man page, to - Write documentation, ranging from man page, to
a description for the web, to a design document, ... a description for the web, to a design document, ...
If you want to help the SuperTuxKart - Project, please If you want to help the SuperTuxKart - Project, please
contact us on the email list: contact us on the email list: [supertuxkart-devel@lists.sourceforge.net](mailto:supertuxkart-devel@lists.sourceforge.net)
supertuxkart-devel@lists.sourceforge.net
Thanks in advance! Thanks in advance!
The SuperTuxKart-Team
-- The SuperTuxKart-Team
For details, see For details, see <http://supertuxkart.sourceforge.net/Get_involved>
http://supertuxkart.sourceforge.net/Get_involved

View File

@ -1,12 +0,0 @@
#version 130
uniform sampler2D texture;
in vec2 uv;
noperspective in vec3 nor;
void main(void)
{
vec4 tex = texture2D(texture, uv);
gl_FragData[0] = vec4(tex.xyz, 1.);
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(1. - tex.a);
}

View File

@ -0,0 +1,7 @@
#version 130
noperspective in vec3 nor;
void main(void)
{
gl_FragColor = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
}

View File

@ -3,14 +3,11 @@ uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView; uniform mat4 TransposeInverseModelView;
in vec3 Position; in vec3 Position;
in vec2 Texcoord;
in vec3 Normal; in vec3 Normal;
out vec2 uv;
noperspective out vec3 nor; noperspective out vec3 nor;
void main(void) void main(void)
{ {
uv = Texcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.); gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz; nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
} }

View File

@ -0,0 +1,19 @@
#version 130
uniform sampler2D Albedo;
uniform sampler2D DiffuseMap;
uniform sampler2D SpecularMap;
uniform sampler2D SSAO;
uniform vec2 screen;
uniform vec3 ambient;
in vec2 uv;
void main(void)
{
vec2 tc = gl_FragCoord.xy / screen;
vec4 color = texture2D(Albedo, uv);
vec3 DiffuseComponent = texture2D(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture2D(SpecularMap, tc).xyz;
float ao = texture2D(SSAO, tc).x;
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent * (1. - color.a);
gl_FragColor = vec4(color.xyz * LightFactor, 1.);
}

View File

@ -0,0 +1,12 @@
#version 130
uniform mat4 ModelViewProjectionMatrix;
in vec3 Position;
in vec2 Texcoord;
out vec2 uv;
void main(void)
{
uv = Texcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
}

View File

@ -1,14 +0,0 @@
#version 130
uniform sampler2D texture;
in vec2 uv;
noperspective in vec3 nor;
void main(void)
{
vec4 tex = texture2D(texture, uv);
if (tex.a < 0.5)
discard;
gl_FragData[0] = vec4(tex.xyz, 1.);
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
gl_FragData[2] = vec4(1. - tex.a);
}

View File

@ -61,6 +61,7 @@ GlowNode::~GlowNode()
void GlowNode::render() void GlowNode::render()
{ {
return;
IVideoDriver * const drv = irr_driver->getVideoDriver(); IVideoDriver * const drv = irr_driver->getVideoDriver();
drv->setTransform(ETS_WORLD, AbsoluteTransformation); drv->setTransform(ETS_WORLD, AbsoluteTransformation);
drv->setMaterial(mat); drv->setMaterial(mat);

View File

@ -140,6 +140,21 @@ void IrrDriver::reset()
if (m_glsl) m_post_processing->reset(); if (m_glsl) m_post_processing->reset();
} // reset } // reset
void IrrDriver::setPhase(unsigned p)
{
phase = p;
}
unsigned IrrDriver::getPhase() const
{
return phase;
}
core::array<video::IRenderTarget> &IrrDriver::getMainSetup()
{
return m_mrt;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if defined(__linux__) && !defined(ANDROID) #if defined(__linux__) && !defined(ANDROID)

View File

@ -174,6 +174,8 @@ private:
std::vector<scene::ISceneNode *> m_background; std::vector<scene::ISceneNode *> m_background;
unsigned phase;
#ifdef DEBUG #ifdef DEBUG
/** Used to visualise skeletons. */ /** Used to visualise skeletons. */
std::vector<irr::scene::IAnimatedMeshSceneNode*> m_debug_meshes; std::vector<irr::scene::IAnimatedMeshSceneNode*> m_debug_meshes;
@ -206,6 +208,9 @@ public:
~IrrDriver(); ~IrrDriver();
void initDevice(); void initDevice();
void reset(); void reset();
void setPhase(unsigned);
unsigned getPhase() const;
core::array<video::IRenderTarget> &getMainSetup();
void updateConfigIfRelevant(); void updateConfigIfRelevant();
void setAllMaterialFlags(scene::IMesh *mesh) const; void setAllMaterialFlags(scene::IMesh *mesh) const;
scene::IAnimatedMesh *getAnimatedMesh(const std::string &name); scene::IAnimatedMesh *getAnimatedMesh(const std::string &name);

View File

@ -632,6 +632,8 @@ void PostProcessing::renderLightbBlend(ITexture *diffuse, ITexture *specular, IT
const SColorf s = irr_driver->getSceneManager()->getAmbientLight(); const SColorf s = irr_driver->getSceneManager()->getAmbientLight();
if (!LightBlendShader::Program) if (!LightBlendShader::Program)
LightBlendShader::init(); LightBlendShader::init();
glStencilFunc(GL_EQUAL, 1, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD); glBlendEquation(GL_FUNC_ADD);
if (debug) if (debug)
@ -664,6 +666,7 @@ void PostProcessing::renderLightbBlend(ITexture *diffuse, ITexture *specular, IT
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_STENCIL_TEST);
} }

View File

@ -193,14 +193,22 @@ void IrrDriver::renderGLSL(float dt)
m_video_driver->setRenderTarget(m_mrt, false, false); m_video_driver->setRenderTarget(m_mrt, false, false);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_SOLID; m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_SOLID;
irr_driver->setPhase(0);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilFunc(GL_ALWAYS, 1, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glEnable(GL_STENCIL_TEST);
m_scene_manager->drawAll(m_renderpass); m_scene_manager->drawAll(m_renderpass);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glDisable(GL_STENCIL_TEST);
irr_driver->setProjMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION)); irr_driver->setProjMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION));
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW)); irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
irr_driver->genProjViewMatrix(); irr_driver->genProjViewMatrix();
ShadowImportanceProvider * const sicb = (ShadowImportanceProvider *) // Todo : reenable glow and shadows
irr_driver->getCallback(ES_SHADOW_IMPORTANCE); //ShadowImportanceProvider * const sicb = (ShadowImportanceProvider *)
sicb->updateIPVMatrix(); // irr_driver->getCallback(ES_SHADOW_IMPORTANCE);
//sicb->updateIPVMatrix();
// Used to cull glowing items & lights // Used to cull glowing items & lights
const core::aabbox3df cambox = camnode->getViewFrustum()->getBoundingBox(); const core::aabbox3df cambox = camnode->getViewFrustum()->getBoundingBox();
@ -208,18 +216,25 @@ void IrrDriver::renderGLSL(float dt)
// Render anything glowing. // Render anything glowing.
if (!m_mipviz && !m_wireframe) if (!m_mipviz && !m_wireframe)
{ {
renderGlow(overridemat, glows, cambox, cam); //renderGlow(overridemat, glows, cambox, cam);
} // end glow } // end glow
// Shadows // Shadows
if (!m_mipviz && !m_wireframe && UserConfigParams::m_shadows && if (!m_mipviz && !m_wireframe && UserConfigParams::m_shadows &&
World::getWorld()->getTrack()->hasShadows()) World::getWorld()->getTrack()->hasShadows())
{ {
renderShadows(sicb, camnode, overridemat, camera); //renderShadows(sicb, camnode, overridemat, camera);
} }
// Lights // Lights
renderLights(cambox, camnode, overridemat, cam, dt); renderLights(cambox, camnode, overridemat, cam, dt);
irr_driver->setPhase(1);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_SOLID;
glStencilFunc(GL_EQUAL, 0, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glEnable(GL_STENCIL_TEST);
m_scene_manager->drawAll(m_renderpass);
glDisable(GL_STENCIL_TEST);
if (!bgnodes) if (!bgnodes)
{ {

View File

@ -2,6 +2,7 @@
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include <ISceneManager.h> #include <ISceneManager.h>
#include <IMaterialRenderer.h> #include <IMaterialRenderer.h>
#include "config/user_config.hpp"
static static
GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_texcoord, GLuint attrib_normal, size_t stride) GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_texcoord, GLuint attrib_normal, size_t stride)
@ -11,81 +12,74 @@ GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_t
glBindVertexArray(vao); glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(attrib_position); glEnableVertexAttribArray(attrib_position);
glEnableVertexAttribArray(attrib_texcoord); if ((GLint)attrib_texcoord != -1)
glEnableVertexAttribArray(attrib_normal); glEnableVertexAttribArray(attrib_texcoord);
if ((GLint)attrib_normal != -1)
glEnableVertexAttribArray(attrib_normal);
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0); glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28); if ((GLint)attrib_texcoord != -1)
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12); glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
if ((GLint)attrib_normal != -1)
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
glBindVertexArray(0); glBindVertexArray(0);
return vao; return vao;
} }
namespace ObjectRefShader namespace ObjectPass1Shader
{ {
GLuint Program; GLuint Program;
GLuint attrib_position, attrib_texcoord, attrib_normal; GLuint attrib_position, attrib_normal;
GLuint uniform_MVP, uniform_TIMV, uniform_texture; GLuint uniform_MVP, uniform_TIMV;
void init() void init()
{ {
initGL(); initGL();
Program = LoadProgram(file_manager->getAsset("shaders/object.vert").c_str(), file_manager->getAsset("shaders/objectref.frag").c_str()); Program = LoadProgram(file_manager->getAsset("shaders/object_pass1.vert").c_str(), file_manager->getAsset("shaders/object_pass1.frag").c_str());
attrib_position = glGetAttribLocation(Program, "Position"); attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_normal = glGetAttribLocation(Program, "Normal"); attrib_normal = glGetAttribLocation(Program, "Normal");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix"); uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView"); uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");;
uniform_texture = glGetUniformLocation(Program, "texture");
} }
void setProgramAndUniforms() void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView)
{ {
glUseProgram(Program);
core::matrix4 ModelViewProjectionMatrix = irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
core::matrix4 TransposeInverseModelView = irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
TransposeInverseModelView *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
TransposeInverseModelView.makeInverse();
TransposeInverseModelView = TransposeInverseModelView.getTransposed();
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer()); glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer()); glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
} }
} }
namespace ObjectShader namespace ObjectPass2Shader
{ {
GLuint Program; GLuint Program;
GLuint attrib_position, attrib_texcoord, attrib_normal; GLuint attrib_position, attrib_texcoord;
GLuint uniform_MVP, uniform_TIMV, uniform_texture; GLuint uniform_MVP, uniform_TIMV, uniform_Albedo, uniform_DiffuseMap, uniform_SpecularMap, uniform_SSAO, uniform_screen, uniform_ambient;
void init() void init()
{ {
initGL(); initGL();
Program = LoadProgram(file_manager->getAsset("shaders/object.vert").c_str(), file_manager->getAsset("shaders/object.frag").c_str()); Program = LoadProgram(file_manager->getAsset("shaders/object_pass2.vert").c_str(), file_manager->getAsset("shaders/object_pass2.frag").c_str());
attrib_position = glGetAttribLocation(Program, "Position"); attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord"); attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_normal = glGetAttribLocation(Program, "Normal");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix"); uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView"); uniform_Albedo = glGetUniformLocation(Program, "Albedo");
uniform_texture = glGetUniformLocation(Program, "texture"); uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
uniform_SSAO = glGetUniformLocation(Program, "SSAO");
uniform_screen = glGetUniformLocation(Program, "screen");
uniform_ambient = glGetUniformLocation(Program, "ambient");
} }
void setProgramAndUniforms() void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_Albedo, unsigned TU_DiffuseMap, unsigned TU_SpecularMap, unsigned TU_SSAO)
{ {
glUseProgram(Program);
core::matrix4 ModelViewProjectionMatrix = irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
core::matrix4 TransposeInverseModelView = irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
TransposeInverseModelView *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
TransposeInverseModelView.makeInverse();
TransposeInverseModelView = TransposeInverseModelView.getTransposed();
glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer()); glUniformMatrix4fv(uniform_MVP, 1, GL_FALSE, ModelViewProjectionMatrix.pointer());
glUniformMatrix4fv(uniform_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer()); glUniform1i(uniform_Albedo, TU_Albedo);
glUniform1i(uniform_DiffuseMap, TU_DiffuseMap);
glUniform1i(uniform_SpecularMap, TU_SpecularMap);
glUniform1i(uniform_SSAO, TU_SSAO);
glUniform2f(uniform_screen, UserConfigParams::m_width, UserConfigParams::m_height);
const video::SColorf s = irr_driver->getSceneManager()->getAmbientLight();
glUniform3f(uniform_ambient, s.r, s.g, s.b);
} }
} }
@ -165,7 +159,6 @@ GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
result.textures = static_cast<irr::video::COpenGLTexture*>(tex)->getOpenGLTextureName(); result.textures = static_cast<irr::video::COpenGLTexture*>(tex)->getOpenGLTextureName();
else else
result.textures = 0; result.textures = 0;
result.vao = 0;
return result; return result;
} }
@ -181,10 +174,10 @@ STKMesh::STKMesh(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::IScene
GLmeshes.push_back(allocateMeshBuffer(mb)); GLmeshes.push_back(allocateMeshBuffer(mb));
} }
if (ObjectRefShader::Program) if (ObjectPass1Shader::Program && ObjectPass2Shader::Program)
return; return;
ObjectRefShader::init(); ObjectPass1Shader::init();
ObjectShader::init(); ObjectPass2Shader::init();
} }
STKMesh::~STKMesh() STKMesh::~STKMesh()
@ -193,48 +186,89 @@ STKMesh::~STKMesh()
// glDeleteBuffers(index_buffer.size(), index_buffer.data()); // glDeleteBuffers(index_buffer.size(), index_buffer.data());
} }
static
void drawFirstPass(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
irr_driver->getVideoDriver()->setRenderTarget(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH), false, false);
glStencilFunc(GL_ALWAYS, 0, ~0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_ALPHA_TEST);
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
core::matrix4 ModelViewProjectionMatrix = irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
core::matrix4 TransposeInverseModelView = irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
TransposeInverseModelView *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
TransposeInverseModelView.makeInverse();
TransposeInverseModelView = TransposeInverseModelView.getTransposed();
glUseProgram(ObjectPass1Shader::Program);
ObjectPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glStencilFunc(GL_ALWAYS, 1, ~0);
irr_driver->getVideoDriver()->setRenderTarget(irr_driver->getMainSetup(), false, false);
}
static
void drawSecondPass(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
irr_driver->getVideoDriver()->setRenderTarget(irr_driver->getRTT(RTT_COLOR), false, false);
glEnable(GL_DEPTH_TEST);
glEnable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
core::matrix4 ModelViewProjectionMatrix = irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW);
ModelViewProjectionMatrix *= irr_driver->getVideoDriver()->getTransform(video::ETS_WORLD);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mesh.textures);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(irr_driver->getRTT(RTT_TMP1))->getOpenGLTextureName());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(irr_driver->getRTT(RTT_TMP2))->getOpenGLTextureName());
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, static_cast<irr::video::COpenGLTexture*>(irr_driver->getRTT(RTT_SSAO))->getOpenGLTextureName());
glUseProgram(ObjectPass2Shader::Program);
ObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, 0, 1, 2, 3);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
irr_driver->getVideoDriver()->setRenderTarget(irr_driver->getRTT(RTT_COLOR), false, false);
}
static static
void draw(const GLMesh &mesh, video::E_MATERIAL_TYPE type) void draw(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{ {
if (!mesh.textures) if (!mesh.textures)
return; return;
glEnable(GL_DEPTH_TEST); if (irr_driver->getPhase() == 0)
glEnable(GL_ALPHA_TEST); drawFirstPass(mesh, type);
glDepthMask(GL_TRUE); else
glDisable(GL_BLEND); drawSecondPass(mesh, type);
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
{
ObjectRefShader::setProgramAndUniforms();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mesh.textures);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glUniform1i(ObjectRefShader::uniform_texture, 0);
}
if (type == irr_driver->getShader(ES_OBJECTPASS))
{
ObjectShader::setProgramAndUniforms();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mesh.textures);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glUniform1i(ObjectShader::uniform_texture, 0);
}
glBindVertexArray(mesh.vao);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
video::SMaterial material; video::SMaterial material;
material.MaterialType = irr_driver->getShader(ES_RAIN); material.MaterialType = irr_driver->getShader(ES_RAIN);
@ -247,23 +281,22 @@ void draw(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
static bool isObject(video::E_MATERIAL_TYPE type) static bool isObject(video::E_MATERIAL_TYPE type)
{ {
if (type == irr_driver->getShader(ES_OBJECTPASS_REF) || type == irr_driver->getShader(ES_OBJECTPASS)) if (type == irr_driver->getShader(ES_OBJECTPASS))
return true; return true;
return false; return false;
} }
static void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type) static void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type)
{ {
if (mesh.vao) if (mesh.vao_first_pass)
return; return;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
ObjectRefShader::attrib_position, ObjectRefShader::attrib_texcoord, ObjectRefShader::attrib_normal, ObjectPass1Shader::attrib_position, -1, ObjectPass1Shader::attrib_normal,
mesh.Stride); mesh.Stride);
if (type == irr_driver->getShader(ES_OBJECTPASS)) mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, ObjectPass2Shader::attrib_position, ObjectPass2Shader::attrib_texcoord, -1,
ObjectShader::attrib_position, ObjectShader::attrib_texcoord, ObjectShader::attrib_normal, mesh.Stride);
mesh.Stride);
} }
void STKMesh::render() void STKMesh::render()
@ -291,7 +324,6 @@ void STKMesh::render()
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(material.MaterialType); video::IMaterialRenderer* rnd = driver->getMaterialRenderer(material.MaterialType);
bool transparent = (rnd && rnd->isTransparent()); bool transparent = (rnd && rnd->isTransparent());
#ifdef OGL32CTX
// only render transparent buffer if this is the transparent render pass // only render transparent buffer if this is the transparent render pass
// and solid only in solid pass // and solid only in solid pass
if (isObject(material.MaterialType) && !isTransparentPass && !transparent) if (isObject(material.MaterialType) && !isTransparentPass && !transparent)
@ -300,9 +332,6 @@ void STKMesh::render()
draw(GLmeshes[i], material.MaterialType); draw(GLmeshes[i], material.MaterialType);
} }
else if (transparent == isTransparentPass) else if (transparent == isTransparentPass)
#else
if (transparent == isTransparentPass)
#endif
{ {
driver->setMaterial(material); driver->setMaterial(material);
driver->drawMeshBuffer(mb); driver->drawMeshBuffer(mb);

View File

@ -9,7 +9,8 @@
#include <vector> #include <vector>
struct GLMesh { struct GLMesh {
GLuint vao; GLuint vao_first_pass;
GLuint vao_second_pass;
GLuint vertex_buffer; GLuint vertex_buffer;
GLuint index_buffer; GLuint index_buffer;
GLuint textures; GLuint textures;

View File

@ -1037,11 +1037,16 @@ void FileManager::checkAndCreateDirForAddons(const std::string &dir)
} // checkAndCreateDirForAddons } // checkAndCreateDirForAddons
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Removes the specified file, returns true if successful, or false /** Removes the specified file.
* if the file is not a regular file or can not be removed. * \return True if successful, or false if the file is not a regular file or
* can not be removed.
*/ */
bool FileManager::removeFile(const std::string &name) const bool FileManager::removeFile(const std::string &name) const
{ {
// If the file does not exists, everything is fine
if(!fileExists(name))
return true;
struct stat mystat; struct stat mystat;
if(stat(name.c_str(), &mystat) < 0) return false; if(stat(name.c_str(), &mystat) < 0) return false;
if( S_ISREG(mystat.st_mode)) if( S_ISREG(mystat.st_mode))

1087
src/io/file_manager.cpp~ Normal file

File diff suppressed because it is too large Load Diff

View File

@ -227,14 +227,20 @@ namespace Online
Log::info("HTTPRequest", "Download successful."); Log::info("HTTPRequest", "Download successful.");
// The behaviour of rename is unspecified if the target // The behaviour of rename is unspecified if the target
// file should already exist - so remove it. // file should already exist - so remove it.
file_manager->removeFile(m_filename); bool ok = file_manager->removeFile(m_filename);
if(!ok)
{
Log::error("addons",
"Could not removed existing addons.xml file.");
m_curl_code = CURLE_WRITE_ERROR;
}
int ret = rename((m_filename+".part").c_str(), int ret = rename((m_filename+".part").c_str(),
m_filename.c_str() ); m_filename.c_str() );
// In case of an error, set the status to indicate this // In case of an error, set the status to indicate this
if(ret!=0) if(ret!=0)
{ {
if(UserConfigParams::logAddons()) Log::error("addons",
Log::error("addons", "Could not rename downloaded file!"); "Could not rename downloaded addons.xml file!");
m_curl_code = CURLE_WRITE_ERROR; m_curl_code = CURLE_WRITE_ERROR;
} }
} // m_curl_code ==CURLE_OK } // m_curl_code ==CURLE_OK