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
* Updated track The old mines
* Updated Lighthouse track
@ -20,8 +19,7 @@ SuperTuxkart 0.8.1
SuperTuxkart 0.8
~~~~~~~~~~~~~~~
##SuperTuxKart 0.8
* Story mode and new challenge set
* Improved AI
* Skidding and better collision physics
@ -36,8 +34,7 @@ SuperTuxkart 0.8
* New music
SuperTuxKart 0.7.3
~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.7.3
* New Zen Garden and Subsea tracks
* New Island battle arena
* New Suzanne kart
@ -53,8 +50,7 @@ SuperTuxKart 0.7.3
* Better placement of rescued karts
* Transition track-making to blender 2.5/2.6
SuperTuxKart 0.7.2
~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.7.2
* Added in-game addon manager
* Fixed major memory leaks
* 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)
* Various other tweaks done and glitches fixed
SuperTuxkart 0.7.1b
~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.7.1b
* Fix circular dependency in challenges
* Updated translations
SuperTuxKart 0.7.1
~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.7.1
* Particle (smoke, splash, fire) and weather effects
* New Fort Magma by Samuncle, new Shiny Suburbs track by Horace
* New Beagle kart by wolterh
@ -89,9 +83,9 @@ SuperTuxKart 0.7.1
* Full RTL (right to left) support
* 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:
* Irrlicht:
- Ported from plib to irrlicht
- Added animations to karts and some tracks
@ -103,48 +97,34 @@ Too many to list them all. Main points:
* New art:
- 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
on Windows Vista.
SuperTuxKart 0.6.2 (July 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.6.2 (July 2009)
* Bugfix: Game could crash in rare circumstances.
* Bugfix: Restarting a GP (with the in-race menu ESC) would
not subtract already allocated points.
* Bugfix: Restarting a GP (with the in-race menu ESC) would not subtract already allocated points.
* Bugfix: A race could be finished with an invalid shortcut.
* Bugfix: Playing a challenge after a splitscreen game would
play the challenge in split screen.
* Bugfix: Playing a challenge after a splitscreen game would play the challenge in split screen.
* Bugfix: Items explode over void.
* Bugfix: Grass in castle arena slowed down the kart.
* Bugfix: GP result showed kart identifier instead of name.
* 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.
* 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.
SuperTuxKart 0.6.1a (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.6.1a (February 2009)
* Bugfix: battle mode would not display track groups.
SuperTuxKart 0.6.1 (February 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Added new kart ("Puffy"), new battle map ("Cave"), and new music
for Snow Mountain.
* 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.
##SuperTuxKart 0.6.1 (February 2009)
* Added new kart ("Puffy"), new battle map ("Cave"), and new music for Snow Mountain.
* 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.
* Improved track selection screen to not display empty track
groups.
* Improved track selection screen to not display empty track groups.
* A plunger in the face is now removed when restarting.
* Added slow-down for karts driving backwards.
* Somewhat reduced 'shaking' of AI driven karts.
SuperTuxKart 0.6 (January 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.6 (January 2009)
* New improved physics and kart handling
* Added sharp turns and nitro speed boost (replacing wheelies and jump)
* 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),
thanks to Samjam for the patch.
SuperTuxKart 0.5 (May 2008)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Six new tracks and one improved track: Fort Magma, SnowTux Peak, Amazonian Journey, City,
Canyon, Crescent Crossing and StarTrack
##SuperTuxKart 0.5 (May 2008)
* 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
* New Follow the Leader game mode
* New Grand Prix
@ -179,12 +157,11 @@ SuperTuxKart 0.5 (May 2008)
* German, French, Dutch, Spanish, Italian and Swedish translations
* Additional music
* Many Bugfixes including:
a memory leak fix (Charlie Head)
an AI crash fix (Chris Morris)
- a memory leak fix (Charlie Head)
- 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 kart: wilber
* Improved 'Shifting Sands' and 'Lighthouse' tracks
@ -195,8 +172,7 @@ SuperTuxKart 0.4 (February 2008)
* Additional music and main theme
SuperTuxKart 0.3 (May 2007)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.3 (May 2007)
* Highscore lists
* Shortcut detection
* Improved AI
@ -226,8 +202,7 @@ SuperTuxKart 0.3 (May 2007)
- Fixed keyboard keys unable to work on the first key press bug
- And others
SuperTuxKart 0.2 (22. Sep 2006)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.2 (22. Sep 2006)
* Significant performance improvement by using display lists
* Improved AI
* 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
* Items were added to all tracks
SuperTuxKart 0.1 (04. May 2006) (not officially released)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Significant speedup by using a new HOT and collision algorithm
--> all tracks are now playable
##SuperTuxKart 0.1 (04. May 2006) (not officially released)
* Significant speedup by using a new HOT and collision algorithm --> all tracks are now playable
* Removed all SDL dependencies, only plib is needed
* Single and multi-window menu can be used
* Code structure changes
* Some bug fixes and small improvements
* Added profile option to support automatic profiling
SuperTuxKart 0.0.0 (22. Dec 2004)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##SuperTuxKart 0.0.0 (22. Dec 2004)
* new tracks
* new characters and karts
* new user-interface
* 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.
* Removed some features that were only there to support
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
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.
TuxKart v0.0.5 (??)
~~~~~~~~~~~~~~~~~~~
##TuxKart v0.0.5 (??)
* 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.
* Steady-cam camera - courtesy of cowtan@ysbl.york.ac.uk
* Changes for compatibility with PLIB 1.3.1 and later.
* 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
joystick driver is installed.
* More CygWin fixes.
* Started new feature to allow you to be
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
recompiling.
* Can now drive using keyboard only - no joystick
required.
* 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
Distro.
TuxKart v0.0.0 (June 29th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##TuxKart v0.0.0 (June 29th 2000)
* First CVS release.
TuxKart (unnumbered) (April 13th 2000)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##TuxKart (unnumbered) (April 13th 2000)
* 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
one of the best free linux games out there :) We need (in
no particular order):
1) Musicians/sound engineers
1. Musicians/sound engineers
- Create additional background soundtrack
- Create sound effects
2) Artists and track designer
2. Artists and track designer
- Create additional tracks
- Create additional art work for tracks,
background images
3) Developers
3. Developers
- 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
5) Tester
5. Tester
- For just about everything
- Esp. different platforms
6) Package creators
6. Package creators
- Create packages for
- most common linux Distributors
- most common Linux Distributors
- Windows
7) Writers
7. Writers
- Write documentation, ranging from man page, to
a description for the web, to a design document, ...
If you want to help the SuperTuxKart - Project, please
contact us on the email list:
supertuxkart-devel@lists.sourceforge.net
contact us on the email list: [supertuxkart-devel@lists.sourceforge.net](mailto:supertuxkart-devel@lists.sourceforge.net)
Thanks in advance!
The SuperTuxKart-Team
-- The SuperTuxKart-Team
For details, see
http://supertuxkart.sourceforge.net/Get_involved
For details, see <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;
in vec3 Position;
in vec2 Texcoord;
in vec3 Normal;
out vec2 uv;
noperspective out vec3 nor;
void main(void)
{
uv = Texcoord;
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
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()
{
return;
IVideoDriver * const drv = irr_driver->getVideoDriver();
drv->setTransform(ETS_WORLD, AbsoluteTransformation);
drv->setMaterial(mat);

View File

@ -140,6 +140,21 @@ void IrrDriver::reset()
if (m_glsl) m_post_processing->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)

View File

@ -174,6 +174,8 @@ private:
std::vector<scene::ISceneNode *> m_background;
unsigned phase;
#ifdef DEBUG
/** Used to visualise skeletons. */
std::vector<irr::scene::IAnimatedMeshSceneNode*> m_debug_meshes;
@ -206,6 +208,9 @@ public:
~IrrDriver();
void initDevice();
void reset();
void setPhase(unsigned);
unsigned getPhase() const;
core::array<video::IRenderTarget> &getMainSetup();
void updateConfigIfRelevant();
void setAllMaterialFlags(scene::IMesh *mesh) const;
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();
if (!LightBlendShader::Program)
LightBlendShader::init();
glStencilFunc(GL_EQUAL, 1, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
if (debug)
@ -664,6 +666,7 @@ void PostProcessing::renderLightbBlend(ITexture *diffuse, ITexture *specular, IT
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_DEPTH_TEST);
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_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);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glDisable(GL_STENCIL_TEST);
irr_driver->setProjMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_PROJECTION));
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
irr_driver->genProjViewMatrix();
ShadowImportanceProvider * const sicb = (ShadowImportanceProvider *)
irr_driver->getCallback(ES_SHADOW_IMPORTANCE);
sicb->updateIPVMatrix();
// Todo : reenable glow and shadows
//ShadowImportanceProvider * const sicb = (ShadowImportanceProvider *)
// irr_driver->getCallback(ES_SHADOW_IMPORTANCE);
//sicb->updateIPVMatrix();
// Used to cull glowing items & lights
const core::aabbox3df cambox = camnode->getViewFrustum()->getBoundingBox();
@ -208,18 +216,25 @@ void IrrDriver::renderGLSL(float dt)
// Render anything glowing.
if (!m_mipviz && !m_wireframe)
{
renderGlow(overridemat, glows, cambox, cam);
//renderGlow(overridemat, glows, cambox, cam);
} // end glow
// Shadows
if (!m_mipviz && !m_wireframe && UserConfigParams::m_shadows &&
World::getWorld()->getTrack()->hasShadows())
{
renderShadows(sicb, camnode, overridemat, camera);
//renderShadows(sicb, camnode, overridemat, camera);
}
// Lights
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)
{

View File

@ -2,6 +2,7 @@
#include "graphics/irr_driver.hpp"
#include <ISceneManager.h>
#include <IMaterialRenderer.h>
#include "config/user_config.hpp"
static
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);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(attrib_position);
glEnableVertexAttribArray(attrib_texcoord);
glEnableVertexAttribArray(attrib_normal);
if ((GLint)attrib_texcoord != -1)
glEnableVertexAttribArray(attrib_texcoord);
if ((GLint)attrib_normal != -1)
glEnableVertexAttribArray(attrib_normal);
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
if ((GLint)attrib_texcoord != -1)
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);
glBindVertexArray(0);
return vao;
}
namespace ObjectRefShader
namespace ObjectPass1Shader
{
GLuint Program;
GLuint attrib_position, attrib_texcoord, attrib_normal;
GLuint uniform_MVP, uniform_TIMV, uniform_texture;
GLuint attrib_position, attrib_normal;
GLuint uniform_MVP, uniform_TIMV;
void init()
{
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_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_normal = glGetAttribLocation(Program, "Normal");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
uniform_texture = glGetUniformLocation(Program, "texture");
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");;
}
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_TIMV, 1, GL_FALSE, TransposeInverseModelView.pointer());
}
}
namespace ObjectShader
namespace ObjectPass2Shader
{
GLuint Program;
GLuint attrib_position, attrib_texcoord, attrib_normal;
GLuint uniform_MVP, uniform_TIMV, uniform_texture;
GLuint attrib_position, attrib_texcoord;
GLuint uniform_MVP, uniform_TIMV, uniform_Albedo, uniform_DiffuseMap, uniform_SpecularMap, uniform_SSAO, uniform_screen, uniform_ambient;
void init()
{
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_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_normal = glGetAttribLocation(Program, "Normal");
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
uniform_texture = glGetUniformLocation(Program, "texture");
uniform_Albedo = glGetUniformLocation(Program, "Albedo");
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_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();
else
result.textures = 0;
result.vao = 0;
return result;
}
@ -181,10 +174,10 @@ STKMesh::STKMesh(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::IScene
GLmeshes.push_back(allocateMeshBuffer(mb));
}
if (ObjectRefShader::Program)
if (ObjectPass1Shader::Program && ObjectPass2Shader::Program)
return;
ObjectRefShader::init();
ObjectShader::init();
ObjectPass1Shader::init();
ObjectPass2Shader::init();
}
STKMesh::~STKMesh()
@ -193,48 +186,89 @@ STKMesh::~STKMesh()
// 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
void draw(const GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
if (!mesh.textures)
return;
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;
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);
if (irr_driver->getPhase() == 0)
drawFirstPass(mesh, type);
else
drawSecondPass(mesh, type);
video::SMaterial material;
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)
{
if (type == irr_driver->getShader(ES_OBJECTPASS_REF) || type == irr_driver->getShader(ES_OBJECTPASS))
if (type == irr_driver->getShader(ES_OBJECTPASS))
return true;
return false;
}
static void initvaostate(GLMesh &mesh, video::E_MATERIAL_TYPE type)
{
if (mesh.vao)
if (mesh.vao_first_pass)
return;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer,
ObjectRefShader::attrib_position, ObjectRefShader::attrib_texcoord, ObjectRefShader::attrib_normal,
mesh.Stride);
if (type == irr_driver->getShader(ES_OBJECTPASS))
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer,
ObjectShader::attrib_position, ObjectShader::attrib_texcoord, ObjectShader::attrib_normal,
mesh.Stride);
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
ObjectPass1Shader::attrib_position, -1, ObjectPass1Shader::attrib_normal,
mesh.Stride);
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
ObjectPass2Shader::attrib_position, ObjectPass2Shader::attrib_texcoord, -1,
mesh.Stride);
}
void STKMesh::render()
@ -291,7 +324,6 @@ void STKMesh::render()
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(material.MaterialType);
bool transparent = (rnd && rnd->isTransparent());
#ifdef OGL32CTX
// only render transparent buffer if this is the transparent render pass
// and solid only in solid pass
if (isObject(material.MaterialType) && !isTransparentPass && !transparent)
@ -300,9 +332,6 @@ void STKMesh::render()
draw(GLmeshes[i], material.MaterialType);
}
else if (transparent == isTransparentPass)
#else
if (transparent == isTransparentPass)
#endif
{
driver->setMaterial(material);
driver->drawMeshBuffer(mb);

View File

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

View File

@ -1037,11 +1037,16 @@ void FileManager::checkAndCreateDirForAddons(const std::string &dir)
} // checkAndCreateDirForAddons
// ----------------------------------------------------------------------------
/** Removes the specified file, returns true if successful, or false
* if the file is not a regular file or can not be removed.
/** Removes the specified file.
* \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
{
// If the file does not exists, everything is fine
if(!fileExists(name))
return true;
struct stat mystat;
if(stat(name.c_str(), &mystat) < 0) return false;
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.");
// The behaviour of rename is unspecified if the target
// 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(),
m_filename.c_str() );
// In case of an error, set the status to indicate this
if(ret!=0)
{
if(UserConfigParams::logAddons())
Log::error("addons", "Could not rename downloaded file!");
Log::error("addons",
"Could not rename downloaded addons.xml file!");
m_curl_code = CURLE_WRITE_ERROR;
}
} // m_curl_code ==CURLE_OK