Merge branch 'master' of https://github.com/supertuxkart/stk-code into ScriptEngine
This commit is contained in:
commit
3573452519
3
TODO.md
3
TODO.md
@ -1,5 +1,8 @@
|
||||
##TODO
|
||||
|
||||
THIS IS A 2nd TEST.
|
||||
THIS IS A TEST.
|
||||
|
||||
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):
|
||||
|
@ -21,17 +21,9 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform float time;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
out vec2 uv;
|
||||
#else
|
||||
attribute vec3 Position;
|
||||
attribute vec2 Texcoord;
|
||||
varying vec2 uv;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -17,9 +17,15 @@ layout (std140) uniform MatrixesData
|
||||
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 4) in vec2 SecondTexcoord;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
#endif
|
||||
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
|
@ -3,11 +3,17 @@ uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
|
||||
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec4 Color;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
in vec2 Texcoord;
|
||||
#endif
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
|
@ -10,16 +10,26 @@ layout (std140) uniform MatrixesData
|
||||
|
||||
uniform vec3 windDir;
|
||||
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec4 Color;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
in vec2 Texcoord;
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
#endif
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
|
||||
|
@ -15,16 +15,29 @@ layout (std140) uniform MatrixesData
|
||||
};
|
||||
#endif
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec4 Color;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
in vec2 Texcoord;
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
#endif
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
out vec4 color;
|
||||
|
||||
mat4 getWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
mat4 getInverseWorldMatrix(vec3 translation, vec3 rotation, vec3 scale);
|
||||
@ -36,4 +49,5 @@ void main(void)
|
||||
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
color = Color.zyxw;
|
||||
}
|
||||
|
@ -7,12 +7,21 @@ layout (std140) uniform MatrixesData
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
};
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
|
||||
in vec3 Origin;
|
||||
in vec3 Orientation;
|
||||
in vec3 Scale;
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
#endif
|
||||
|
||||
#ifdef VSLayer
|
||||
out vec2 uv;
|
||||
|
@ -10,11 +10,17 @@ layout (std140) uniform MatrixesData
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 5) in vec3 Tangent;
|
||||
layout(location = 6) in vec3 Bitangent;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec2 Texcoord;
|
||||
in vec3 Tangent;
|
||||
in vec3 Bitangent;
|
||||
#endif
|
||||
|
||||
out vec3 tangent;
|
||||
out vec3 bitangent;
|
||||
|
@ -24,12 +24,19 @@ uniform mat4 TextureMatrix =
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
|
||||
|
||||
#if __VERSION__ >= 330
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec4 Color;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 4) in vec2 SecondTexcoord;
|
||||
#else
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
in vec4 Color;
|
||||
in vec2 Texcoord;
|
||||
in vec2 SecondTexcoord;
|
||||
#endif
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
|
@ -1,18 +1,14 @@
|
||||
uniform sampler2D Albedo;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
in vec4 color;
|
||||
out vec4 FragColor;
|
||||
#else
|
||||
varying vec2 uv;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 color = texture(Albedo, uv);
|
||||
vec4 col = texture(Albedo, uv) * color;
|
||||
vec3 LightFactor = getLightFactor(1.);
|
||||
FragColor = vec4(color.xyz * LightFactor, 1.);
|
||||
FragColor = vec4(col.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
@ -2,11 +2,12 @@ uniform sampler2D tex;
|
||||
|
||||
in vec2 uv;
|
||||
in vec3 nor;
|
||||
in vec4 color;
|
||||
layout (location = 0) out vec3 RSMColor;
|
||||
layout (location = 1) out vec3 RSMNormals;
|
||||
|
||||
void main()
|
||||
{
|
||||
RSMColor = texture(tex, uv).xyz;
|
||||
RSMColor = texture(tex, uv).xyz * color.rgb;
|
||||
RSMNormals = .5 * normalize(nor) + .5;
|
||||
}
|
||||
|
@ -11,10 +11,12 @@ uniform mat4 TextureMatrix =
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec4 Color;
|
||||
layout(location = 3) in vec2 Texcoord;
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
out vec4 color;
|
||||
|
||||
|
||||
void main(void)
|
||||
@ -24,4 +26,5 @@ void main(void)
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
|
||||
nor = (vec4(Normal, 0.)).xyz;
|
||||
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
|
||||
color = Color.zyxw;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ uniform sampler2D tex;
|
||||
uniform sampler2D logluminancetex;
|
||||
uniform float exposure = .09;
|
||||
uniform float Lwhite = 1.;
|
||||
uniform float vignette_weight = 0.;
|
||||
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
@ -43,12 +44,11 @@ void main()
|
||||
// Uncharted2 tonemap with Auria's custom coefficients
|
||||
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
||||
perChannel = pow(perChannel, vec4(2.2));
|
||||
|
||||
|
||||
vec2 inside = uv - 0.5;
|
||||
float vignette = 1 - dot(inside, inside);
|
||||
float vignette = 1. - dot(inside, inside) * vignette_weight;
|
||||
vignette = clamp(pow(vignette, 0.8), 0., 1.);
|
||||
//vignette = clamp(vignette + vignette - 0.5, 0., 1.15);
|
||||
|
||||
|
||||
FragColor = vec4(perChannel.xyz * vignette, col.a);
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ varying vec2 uv;
|
||||
void main()
|
||||
{
|
||||
vec4 res = texture(tex, uv);
|
||||
FragColor = vec4(res.xyz * color.xyz / 255., res.a);
|
||||
FragColor = res * color / 255.;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
||||
// enumerate video modes
|
||||
s32 modeCount;
|
||||
XF86VidModeModeInfo** modes;
|
||||
float refresh_rate;
|
||||
float refresh_rate, refresh_rate_old;
|
||||
|
||||
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
|
||||
|
||||
@ -273,22 +273,17 @@ 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_frame = modes[i]->htotal * modes[i]->vtotal;
|
||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
||||
bestMode = i;
|
||||
}
|
||||
else if (bestMode!=-1 &&
|
||||
modes[i]->hdisplay == modes[bestMode]->hdisplay &&
|
||||
modes[i]->vdisplay == modes[bestMode]->vdisplay)
|
||||
{
|
||||
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;
|
||||
refresh_rate_old = (modes[bestMode]->dotclock * 1000.0) / (modes[bestMode]->htotal * modes[bestMode]->vtotal);
|
||||
refresh_rate = (modes[i]->dotclock * 1000.0) / (modes[i]->htotal * modes[i]->vtotal);
|
||||
|
||||
if (refresh_rate_tmp > refresh_rate)
|
||||
if (refresh_rate > refresh_rate_old)
|
||||
{
|
||||
refresh_rate = refresh_rate_tmp;
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
@ -298,9 +293,6 @@ 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_frame = modes[i]->htotal * modes[i]->vtotal;
|
||||
refresh_rate = pixels_per_second / pixels_per_frame;
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "irr_driver.hpp"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include "config/user_config.hpp"
|
||||
@ -44,6 +43,7 @@ PFNGLUNIFORM4FVPROC glUniform4fv;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
|
||||
PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
||||
PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
||||
@ -197,6 +197,7 @@ void initGL()
|
||||
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)IRR_OGL_LOAD_EXTENSION("glGetProgramInfoLog");
|
||||
glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)IRR_OGL_LOAD_EXTENSION("glTransformFeedbackVaryings");
|
||||
glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)IRR_OGL_LOAD_EXTENSION("glGetAttribLocation");
|
||||
glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)IRR_OGL_LOAD_EXTENSION("glBindAttribLocation");
|
||||
glBlendEquation = (PFNGLBLENDEQUATIONPROC)IRR_OGL_LOAD_EXTENSION("glBlendEquation");
|
||||
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)IRR_OGL_LOAD_EXTENSION("glVertexAttribDivisor");
|
||||
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)IRR_OGL_LOAD_EXTENSION("glDrawArraysInstanced");
|
||||
@ -473,6 +474,20 @@ void saveCompressedTexture(const std::string& compressed_tex)
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
static unsigned colorcount = 0;
|
||||
|
||||
video::ITexture* getUnicolorTexture(video::SColor c)
|
||||
{
|
||||
video::SColor tmp[4] = {
|
||||
c, c, c, c
|
||||
};
|
||||
video::IImage *img = irr_driver->getVideoDriver()->createImageFromData(video::ECF_A8R8G8B8, core::dimension2d<u32>(2, 2), tmp);
|
||||
img->grab();
|
||||
std::string name("color");
|
||||
name += colorcount++;
|
||||
return irr_driver->getVideoDriver()->addTexture(name.c_str(), img);
|
||||
}
|
||||
|
||||
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + TextureUnit);
|
||||
@ -779,9 +794,13 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
|
||||
void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
const core::rect<s32>& destRect,
|
||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
||||
bool useAlphaChannelOfTexture)
|
||||
const video::SColor &colors, bool useAlphaChannelOfTexture)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
if (useAlphaChannelOfTexture)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
float width, height,
|
||||
center_pos_x, center_pos_y,
|
||||
tex_width, tex_height,
|
||||
@ -790,9 +809,16 @@ void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
getSize(texture_w, texture_h, true,
|
||||
destRect, sourceRect, width, height, center_pos_x, center_pos_y,
|
||||
tex_width, tex_height, tex_center_pos_x, tex_center_pos_y);
|
||||
drawTexQuad(texture, width, height, center_pos_x, center_pos_y,
|
||||
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
|
||||
|
||||
glUseProgram(UIShader::UniformColoredTextureRectShader::Program);
|
||||
glBindVertexArray(UIShader::UniformColoredTextureRectShader::vao);
|
||||
|
||||
setTexture(0, texture, GL_LINEAR, GL_LINEAR);
|
||||
UIShader::UniformColoredTextureRectShader::setUniforms(center_pos_x, center_pos_y, width, height, tex_center_pos_x, tex_center_pos_y, tex_width, tex_height, colors, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include "irr_driver.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
// already includes glext.h, which defines useful GL constants.
|
||||
@ -68,6 +69,7 @@ extern PFNGLUNIFORM4IPROC glUniform4i;
|
||||
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
|
||||
extern PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
|
||||
extern PFNGLBLENDEQUATIONPROC glBlendEquation;
|
||||
extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
|
||||
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
|
||||
@ -107,6 +109,7 @@ extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
|
||||
|
||||
void initGL();
|
||||
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
|
||||
video::ITexture* getUnicolorTexture(video::SColor c);
|
||||
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF = false);
|
||||
GLuint LoadShader(const char * file, unsigned type);
|
||||
|
||||
@ -143,6 +146,19 @@ GLint LoadProgram(Types ... args)
|
||||
{
|
||||
GLint ProgramID = glCreateProgram();
|
||||
loadAndAttach(ProgramID, args...);
|
||||
if (irr_driver->getGLSLVersion() < 330)
|
||||
{
|
||||
glBindAttribLocation(ProgramID, 0, "Position");
|
||||
glBindAttribLocation(ProgramID, 1, "Normal");
|
||||
glBindAttribLocation(ProgramID, 2, "Color");
|
||||
glBindAttribLocation(ProgramID, 3, "Texcoord");
|
||||
glBindAttribLocation(ProgramID, 4, "SecondTexcoord");
|
||||
glBindAttribLocation(ProgramID, 5, "Tangent");
|
||||
glBindAttribLocation(ProgramID, 6, "Bitangent");
|
||||
glBindAttribLocation(ProgramID, 7, "Origin");
|
||||
glBindAttribLocation(ProgramID, 8, "Orientation");
|
||||
glBindAttribLocation(ProgramID, 9, "Scale");
|
||||
}
|
||||
glLinkProgram(ProgramID);
|
||||
|
||||
GLint Result = GL_FALSE;
|
||||
@ -199,7 +215,7 @@ public:
|
||||
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
|
||||
~FrameBuffer();
|
||||
void Bind();
|
||||
std::vector<GLuint> &getRTT() { return RenderTargets; }
|
||||
const std::vector<GLuint> &getRTT() const { return RenderTargets; }
|
||||
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
|
||||
size_t getWidth() const { return width; }
|
||||
size_t getHeight() const { return height; }
|
||||
@ -224,7 +240,7 @@ void draw3DLine(const core::vector3df& start,
|
||||
void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
|
||||
const core::rect<s32>& destRect,
|
||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
||||
bool useAlphaChannelOfTexture);
|
||||
const video::SColor &colors, bool useAlphaChannelOfTexture);
|
||||
|
||||
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
|
||||
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
|
||||
|
@ -2055,7 +2055,10 @@ bool IrrDriver::supportsSplatting()
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Begins a rendering to a texture.
|
||||
/**
|
||||
* THIS IS THE OLD OPENGL 1 RTT PROVIDER, USE THE SHADER-BASED
|
||||
* RTT FOR NEW DEVELOPMENT
|
||||
* Begins a rendering to a texture.
|
||||
* \param dimension The size of the texture.
|
||||
* \param name Name of the texture.
|
||||
* \param persistent_texture Whether the created RTT texture should persist in
|
||||
|
@ -716,8 +716,11 @@ public:
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
|
||||
// --------------------- RTT --------------------
|
||||
// --------------------- OLD RTT --------------------
|
||||
/**
|
||||
* THIS IS THE OLD OPENGL 1 RTT PROVIDER, USE THE SHADER-BASED
|
||||
* RTT FOR NEW DEVELOPMENT
|
||||
*
|
||||
* Class that provides RTT (currently, only when no other 3D rendering
|
||||
* in the main scene is required)
|
||||
* Provides an optional 'setupRTTScene' method to make it quick and easy
|
||||
|
@ -727,7 +727,7 @@ void PostProcessing::applyMLAA()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Render the post-processed scene */
|
||||
FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, bool isRace)
|
||||
{
|
||||
IVideoDriver * const drv = irr_driver->getVideoDriver();
|
||||
|
||||
@ -745,7 +745,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
if (UserConfigParams::m_dof)
|
||||
if (isRace && UserConfigParams::m_dof)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- DoF", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_DOF));
|
||||
@ -761,7 +761,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
if (World::getWorld() != NULL)
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
|
||||
if (UserConfigParams::m_light_shaft && m_sunpixels > 30 && hasgodrays)
|
||||
if (isRace && UserConfigParams::m_light_shaft && m_sunpixels > 30 && hasgodrays)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// Grab the sky
|
||||
@ -827,7 +827,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Bloom", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_BLOOM));
|
||||
if (UserConfigParams::m_bloom)
|
||||
if (isRace && UserConfigParams::m_bloom)
|
||||
{
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
||||
@ -879,7 +879,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MOTIONBLUR));
|
||||
if (UserConfigParams::m_motionblur && m_any_boost && World::getWorld() != NULL) // motion blur
|
||||
if (isRace && UserConfigParams::m_motionblur && m_any_boost && World::getWorld() != NULL) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
void renderGlow(unsigned tex);
|
||||
|
||||
/** Render the post-processed scene */
|
||||
FrameBuffer *render(scene::ICameraSceneNode * const camnode);
|
||||
FrameBuffer *render(scene::ICameraSceneNode * const camnode, bool isRace);
|
||||
|
||||
/** Use motion blur for a short time */
|
||||
void giveBoost(unsigned int cam_index);
|
||||
|
@ -186,7 +186,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
// Render the post-processed scene
|
||||
if (UserConfigParams::m_dynamic_lights)
|
||||
{
|
||||
FrameBuffer *fbo = m_post_processing->render(camnode);
|
||||
FrameBuffer *fbo = m_post_processing->render(camnode, true);
|
||||
|
||||
if (irr_driver->getNormals())
|
||||
irr_driver->getFBO(FBO_NORMAL_AND_DEPTHS).BlitToDefault(viewport.UpperLeftCorner.X, viewport.UpperLeftCorner.Y, viewport.LowerRightCorner.X, viewport.LowerRightCorner.Y);
|
||||
@ -528,24 +528,12 @@ void IrrDriver::renderSolidFirstPass()
|
||||
glUseProgram(MeshShader::ObjectPass1Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedFPSM<FPSM_DEFAULT>::MeshSet.size(); ++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, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i], 0);
|
||||
GLMesh &mesh = *GroupedFPSM<FPSM_DEFAULT>::MeshSet[i];
|
||||
if (!mesh.textures[0])
|
||||
{
|
||||
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
mesh.textures[0] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
draw<MeshShader::ObjectPass1Shader>(mesh, mesh.vao, GroupedFPSM<FPSM_DEFAULT>::MVPSet[i], GroupedFPSM<FPSM_DEFAULT>::TIMVSet[i], 0);
|
||||
}
|
||||
|
||||
glUseProgram(MeshShader::ObjectRefPass1Shader::Program);
|
||||
@ -599,7 +587,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
GroupedSM<SM_SPLATTING>::reset();
|
||||
GroupedSM<SM_UNLIT>::reset();
|
||||
GroupedSM<SM_DETAILS>::reset();
|
||||
GroupedSM<SM_UNTEXTURED>::reset();
|
||||
setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST);
|
||||
setTexture(2, m_rtts->getRenderTarget(RTT_HALF1_R), GL_LINEAR, GL_LINEAR);
|
||||
@ -637,10 +624,6 @@ void IrrDriver::renderSolidSecondPass()
|
||||
glUseProgram(MeshShader::DetailledObjectPass2Shader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_DETAILS>::MeshSet.size(); i++)
|
||||
drawDetailledObjectPass2(*GroupedSM<SM_DETAILS>::MeshSet[i], GroupedSM<SM_DETAILS>::MVPSet[i]);
|
||||
|
||||
glUseProgram(MeshShader::UntexturedObjectShader::Program);
|
||||
for (unsigned i = 0; i < GroupedSM<SM_UNTEXTURED>::MeshSet.size(); i++)
|
||||
drawUntexturedObject(*GroupedSM<SM_UNTEXTURED>::MeshSet[i], GroupedSM<SM_UNTEXTURED>::MVPSet[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -837,13 +820,17 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
{
|
||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||
core::vector3df(0, 30, 0));
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
core::matrix4 tmp_matrix;
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(trackbox.MinEdge.X, trackbox.MaxEdge.X,
|
||||
trackbox.MaxEdge.Y, trackbox.MinEdge.Y,
|
||||
30, trackbox.MaxEdge.Z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
if (trackbox.MinEdge.X != trackbox.MaxEdge.X &&
|
||||
trackbox.MinEdge.Y != trackbox.MaxEdge.Y)
|
||||
{
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
core::matrix4 tmp_matrix;
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(trackbox.MinEdge.X, trackbox.MaxEdge.X,
|
||||
trackbox.MaxEdge.Y, trackbox.MinEdge.Y,
|
||||
30, trackbox.MaxEdge.Z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
}
|
||||
rsm_matrix = getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW);
|
||||
}
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/post_processing.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include <ISceneManager.h>
|
||||
|
||||
static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint internalFormat, GLint format, GLint type)
|
||||
{
|
||||
@ -72,6 +74,8 @@ static GLuint generateFBO(GLuint ColorAttachement, GLuint DepthAttachement)
|
||||
|
||||
RTT::RTT(size_t width, size_t height)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_shadow_FBO = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
m_RSM = NULL;
|
||||
@ -281,3 +285,24 @@ RTT::~RTT()
|
||||
glDeleteTextures(1, &RH_Blue);
|
||||
}
|
||||
}
|
||||
|
||||
FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt)
|
||||
{
|
||||
irr_driver->setRTT(this);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(camera);
|
||||
|
||||
std::vector<IrrDriver::GlowData> glows;
|
||||
irr_driver->computeCameraMatrix(camera, m_width, m_height);
|
||||
unsigned plc = irr_driver->UpdateLightsInfo(camera, dt);
|
||||
irr_driver->renderScene(camera, plc, glows, dt, false, true);
|
||||
FrameBuffer* frame_buffer = irr_driver->getPostProcessing()->render(camera, false);
|
||||
|
||||
// reset
|
||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
irr_driver->setRTT(NULL);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(NULL);
|
||||
return frame_buffer;
|
||||
}
|
||||
|
@ -45,11 +45,17 @@ public:
|
||||
unsigned getDepthStencilTexture() const { return DepthStencilTexture; }
|
||||
unsigned getRenderTarget(enum TypeRTT target) const { return RenderTargetTextures[target]; }
|
||||
FrameBuffer& getFBO(enum TypeFBO fbo) { return FrameBuffers[fbo]; }
|
||||
|
||||
FrameBuffer* render(scene::ICameraSceneNode* camera, float dt);
|
||||
|
||||
private:
|
||||
unsigned RenderTargetTextures[RTT_COUNT];
|
||||
PtrVector<FrameBuffer> FrameBuffers;
|
||||
unsigned DepthStencilTexture;
|
||||
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
unsigned shadowColorTex, shadowNormalTex, shadowDepthTex;
|
||||
unsigned RSM_Color, RSM_Normal, RSM_Depth;
|
||||
unsigned RH_Red, RH_Green, RH_Blue;
|
||||
|
@ -450,9 +450,6 @@ namespace MeshShader
|
||||
|
||||
// Solid Normal and depth pass shaders
|
||||
GLuint ObjectPass1Shader::Program;
|
||||
GLuint ObjectPass1Shader::attrib_position;
|
||||
GLuint ObjectPass1Shader::attrib_normal;
|
||||
GLuint ObjectPass1Shader::attrib_texcoord;
|
||||
GLuint ObjectPass1Shader::uniform_MM;
|
||||
GLuint ObjectPass1Shader::uniform_IMM;
|
||||
GLuint ObjectPass1Shader::uniform_tex;
|
||||
@ -463,9 +460,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass1.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
@ -486,9 +480,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint ObjectRefPass1Shader::Program;
|
||||
GLuint ObjectRefPass1Shader::attrib_position;
|
||||
GLuint ObjectRefPass1Shader::attrib_normal;
|
||||
GLuint ObjectRefPass1Shader::attrib_texcoord;
|
||||
GLuint ObjectRefPass1Shader::uniform_MM;
|
||||
GLuint ObjectRefPass1Shader::uniform_IMM;
|
||||
GLuint ObjectRefPass1Shader::uniform_TM;
|
||||
@ -500,9 +491,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass1.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
@ -525,10 +513,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint GrassPass1Shader::Program;
|
||||
GLuint GrassPass1Shader::attrib_position;
|
||||
GLuint GrassPass1Shader::attrib_texcoord;
|
||||
GLuint GrassPass1Shader::attrib_normal;
|
||||
GLuint GrassPass1Shader::attrib_color;
|
||||
GLuint GrassPass1Shader::uniform_MVP;
|
||||
GLuint GrassPass1Shader::uniform_TIMV;
|
||||
GLuint GrassPass1Shader::uniform_tex;
|
||||
@ -540,10 +524,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass1.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_TIMV = glGetUniformLocation(Program, "TransposeInverseModelView");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
@ -559,10 +539,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint NormalMapShader::Program;
|
||||
GLuint NormalMapShader::attrib_position;
|
||||
GLuint NormalMapShader::attrib_texcoord;
|
||||
GLuint NormalMapShader::attrib_tangent;
|
||||
GLuint NormalMapShader::attrib_bitangent;
|
||||
GLuint NormalMapShader::uniform_MM;
|
||||
GLuint NormalMapShader::uniform_IMM;
|
||||
GLuint NormalMapShader::uniform_normalMap;
|
||||
@ -574,10 +550,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/normalmap.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/normalmap.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_tangent = glGetAttribLocation(Program, "Tangent");
|
||||
attrib_bitangent = glGetAttribLocation(Program, "Bitangent");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_normalMap = glGetUniformLocation(Program, "normalMap");
|
||||
@ -600,12 +572,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedObjectPass1Shader::Program;
|
||||
GLuint InstancedObjectPass1Shader::attrib_position;
|
||||
GLuint InstancedObjectPass1Shader::attrib_normal;
|
||||
GLuint InstancedObjectPass1Shader::attrib_texcoord;
|
||||
GLuint InstancedObjectPass1Shader::attrib_orientation;
|
||||
GLuint InstancedObjectPass1Shader::attrib_origin;
|
||||
GLuint InstancedObjectPass1Shader::attrib_scale;
|
||||
GLuint InstancedObjectPass1Shader::uniform_tex;
|
||||
|
||||
void InstancedObjectPass1Shader::init()
|
||||
@ -615,12 +581,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass1.frag").c_str());
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
@ -637,12 +597,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedObjectRefPass1Shader::Program;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_position;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_normal;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_texcoord;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_orientation;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_origin;
|
||||
GLuint InstancedObjectRefPass1Shader::attrib_scale;
|
||||
GLuint InstancedObjectRefPass1Shader::uniform_tex;
|
||||
|
||||
void InstancedObjectRefPass1Shader::init()
|
||||
@ -652,12 +606,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass1.frag").c_str());
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
@ -674,13 +622,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedGrassPass1Shader::Program;
|
||||
GLuint InstancedGrassPass1Shader::attrib_position;
|
||||
GLuint InstancedGrassPass1Shader::attrib_normal;
|
||||
GLuint InstancedGrassPass1Shader::attrib_origin;
|
||||
GLuint InstancedGrassPass1Shader::attrib_orientation;
|
||||
GLuint InstancedGrassPass1Shader::attrib_scale;
|
||||
GLuint InstancedGrassPass1Shader::attrib_texcoord;
|
||||
GLuint InstancedGrassPass1Shader::attrib_color;
|
||||
GLuint InstancedGrassPass1Shader::uniform_windDir;
|
||||
GLuint InstancedGrassPass1Shader::uniform_tex;
|
||||
|
||||
@ -691,13 +632,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_grass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/encode_normal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass1.frag").c_str());
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_windDir = glGetUniformLocation(Program, "windDir");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
@ -718,8 +652,6 @@ namespace MeshShader
|
||||
// Solid Lit pass shaders
|
||||
|
||||
GLuint ObjectPass2Shader::Program;
|
||||
GLuint ObjectPass2Shader::attrib_position;
|
||||
GLuint ObjectPass2Shader::attrib_texcoord;
|
||||
GLuint ObjectPass2Shader::uniform_MM;
|
||||
GLuint ObjectPass2Shader::uniform_TM;
|
||||
GLuint ObjectPass2Shader::uniform_ambient;
|
||||
@ -731,8 +663,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
@ -766,11 +696,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedObjectPass2Shader::Program;
|
||||
GLuint InstancedObjectPass2Shader::attrib_position;
|
||||
GLuint InstancedObjectPass2Shader::attrib_texcoord;
|
||||
GLuint InstancedObjectPass2Shader::attrib_origin;
|
||||
GLuint InstancedObjectPass2Shader::attrib_orientation;
|
||||
GLuint InstancedObjectPass2Shader::attrib_scale;
|
||||
GLuint InstancedObjectPass2Shader::uniform_VP;
|
||||
GLuint InstancedObjectPass2Shader::uniform_TM;
|
||||
GLuint InstancedObjectPass2Shader::uniform_ambient;
|
||||
@ -783,11 +708,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
uniform_VP = glGetUniformLocation(Program, "ViewProjectionMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
@ -822,11 +742,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedObjectRefPass2Shader::Program;
|
||||
GLuint InstancedObjectRefPass2Shader::attrib_position;
|
||||
GLuint InstancedObjectRefPass2Shader::attrib_texcoord;
|
||||
GLuint InstancedObjectRefPass2Shader::attrib_origin;
|
||||
GLuint InstancedObjectRefPass2Shader::attrib_orientation;
|
||||
GLuint InstancedObjectRefPass2Shader::attrib_scale;
|
||||
GLuint InstancedObjectRefPass2Shader::uniform_VP;
|
||||
GLuint InstancedObjectRefPass2Shader::uniform_TM;
|
||||
GLuint InstancedObjectRefPass2Shader::uniform_ambient;
|
||||
@ -839,11 +754,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
uniform_VP = glGetUniformLocation(Program, "ViewProjectionMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
@ -875,9 +785,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint DetailledObjectPass2Shader::Program;
|
||||
GLuint DetailledObjectPass2Shader::attrib_position;
|
||||
GLuint DetailledObjectPass2Shader::attrib_texcoord;
|
||||
GLuint DetailledObjectPass2Shader::attrib_second_texcoord;
|
||||
GLuint DetailledObjectPass2Shader::uniform_MM;
|
||||
GLuint DetailledObjectPass2Shader::uniform_ambient;
|
||||
GLuint DetailledObjectPass2Shader::TU_Albedo;
|
||||
@ -889,9 +796,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/detailledobject_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_Detail = glGetUniformLocation(Program, "Detail");
|
||||
@ -923,8 +827,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint ObjectUnlitShader::Program;
|
||||
GLuint ObjectUnlitShader::attrib_position;
|
||||
GLuint ObjectUnlitShader::attrib_texcoord;
|
||||
GLuint ObjectUnlitShader::uniform_MM;
|
||||
GLuint ObjectUnlitShader::TU_tex;
|
||||
|
||||
@ -933,8 +835,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
@ -957,9 +857,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint ObjectRimLimitShader::Program;
|
||||
GLuint ObjectRimLimitShader::attrib_position;
|
||||
GLuint ObjectRimLimitShader::attrib_texcoord;
|
||||
GLuint ObjectRimLimitShader::attrib_normal;
|
||||
GLuint ObjectRimLimitShader::uniform_MM;
|
||||
GLuint ObjectRimLimitShader::uniform_IMM;
|
||||
GLuint ObjectRimLimitShader::uniform_TM;
|
||||
@ -971,9 +868,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_rimlit.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
@ -1012,8 +906,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint UntexturedObjectShader::Program;
|
||||
GLuint UntexturedObjectShader::attrib_position;
|
||||
GLuint UntexturedObjectShader::attrib_color;
|
||||
GLuint UntexturedObjectShader::uniform_MM;
|
||||
GLuint UntexturedObjectShader::uniform_ambient;
|
||||
|
||||
@ -1023,8 +915,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/untextured_object.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
GLuint uniform_SpecularMap = glGetUniformLocation(Program, "SpecularMap");
|
||||
@ -1054,8 +944,6 @@ namespace MeshShader
|
||||
|
||||
|
||||
GLuint ObjectRefPass2Shader::Program;
|
||||
GLuint ObjectRefPass2Shader::attrib_position;
|
||||
GLuint ObjectRefPass2Shader::attrib_texcoord;
|
||||
GLuint ObjectRefPass2Shader::uniform_MM;
|
||||
GLuint ObjectRefPass2Shader::uniform_TM;
|
||||
GLuint ObjectRefPass2Shader::uniform_ambient;
|
||||
@ -1068,8 +956,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
@ -1104,9 +990,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint GrassPass2Shader::Program;
|
||||
GLuint GrassPass2Shader::attrib_position;
|
||||
GLuint GrassPass2Shader::attrib_texcoord;
|
||||
GLuint GrassPass2Shader::attrib_color;
|
||||
GLuint GrassPass2Shader::uniform_MVP;
|
||||
GLuint GrassPass2Shader::uniform_ambient;
|
||||
GLuint GrassPass2Shader::uniform_windDir;
|
||||
@ -1118,9 +1001,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -1148,13 +1028,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedGrassPass2Shader::Program;
|
||||
GLuint InstancedGrassPass2Shader::attrib_position;
|
||||
GLuint InstancedGrassPass2Shader::attrib_texcoord;
|
||||
GLuint InstancedGrassPass2Shader::attrib_color;
|
||||
GLuint InstancedGrassPass2Shader::attrib_normal;
|
||||
GLuint InstancedGrassPass2Shader::attrib_origin;
|
||||
GLuint InstancedGrassPass2Shader::attrib_orientation;
|
||||
GLuint InstancedGrassPass2Shader::attrib_scale;
|
||||
GLuint InstancedGrassPass2Shader::uniform_VP;
|
||||
GLuint InstancedGrassPass2Shader::uniform_ambient;
|
||||
GLuint InstancedGrassPass2Shader::uniform_windDir;
|
||||
@ -1171,13 +1044,6 @@ namespace MeshShader
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/instanced_grass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
uniform_VP = glGetUniformLocation(Program, "ViewProjectionMatrix");
|
||||
GLuint uniform_Albedo = glGetUniformLocation(Program, "Albedo");
|
||||
GLuint uniform_DiffuseMap = glGetUniformLocation(Program, "DiffuseMap");
|
||||
@ -1218,8 +1084,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint SphereMapShader::Program;
|
||||
GLuint SphereMapShader::attrib_position;
|
||||
GLuint SphereMapShader::attrib_normal;
|
||||
GLuint SphereMapShader::uniform_MM;
|
||||
GLuint SphereMapShader::uniform_IMM;
|
||||
GLuint SphereMapShader::uniform_ambient;
|
||||
@ -1232,8 +1096,6 @@ namespace MeshShader
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectpass_spheremap.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_IMM = glGetUniformLocation(Program, "InverseModelMatrix");
|
||||
uniform_ambient = glGetUniformLocation(Program, "ambient");
|
||||
@ -1267,9 +1129,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint SplattingShader::Program;
|
||||
GLuint SplattingShader::attrib_position;
|
||||
GLuint SplattingShader::attrib_texcoord;
|
||||
GLuint SplattingShader::attrib_second_texcoord;
|
||||
GLuint SplattingShader::uniform_MM;
|
||||
GLuint SplattingShader::uniform_ambient;
|
||||
GLuint SplattingShader::TU_tex_layout;
|
||||
@ -1283,9 +1142,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/splatting.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_tex_layout = glGetUniformLocation(Program, "tex_layout");
|
||||
GLuint uniform_tex_detail0 = glGetUniformLocation(Program, "tex_detail0");
|
||||
@ -1322,8 +1178,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint BubbleShader::Program;
|
||||
GLuint BubbleShader::attrib_position;
|
||||
GLuint BubbleShader::attrib_texcoord;
|
||||
GLuint BubbleShader::uniform_MVP;
|
||||
GLuint BubbleShader::uniform_tex;
|
||||
GLuint BubbleShader::uniform_time;
|
||||
@ -1334,8 +1188,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/bubble.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/bubble.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_time = glGetUniformLocation(Program, "time");
|
||||
@ -1350,9 +1202,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint TransparentShader::Program;
|
||||
GLuint TransparentShader::attrib_position;
|
||||
GLuint TransparentShader::attrib_texcoord;
|
||||
GLuint TransparentShader::attrib_color;
|
||||
GLuint TransparentShader::uniform_MVP;
|
||||
GLuint TransparentShader::uniform_TM;
|
||||
GLuint TransparentShader::uniform_tex;
|
||||
@ -1362,9 +1211,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparent.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
@ -1383,9 +1229,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint TransparentFogShader::Program;
|
||||
GLuint TransparentFogShader::attrib_position;
|
||||
GLuint TransparentFogShader::attrib_texcoord;
|
||||
GLuint TransparentFogShader::attrib_color;
|
||||
GLuint TransparentFogShader::uniform_MVP;
|
||||
GLuint TransparentFogShader::uniform_TM;
|
||||
GLuint TransparentFogShader::uniform_tex;
|
||||
@ -1401,9 +1244,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/transparentfog.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_TM = glGetUniformLocation(Program, "TextureMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
@ -1470,7 +1310,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint ColorizeShader::Program;
|
||||
GLuint ColorizeShader::attrib_position;
|
||||
GLuint ColorizeShader::uniform_MM;
|
||||
GLuint ColorizeShader::uniform_col;
|
||||
|
||||
@ -1479,7 +1318,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/colorize.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_col = glGetUniformLocation(Program, "col");
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
@ -1498,17 +1336,13 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint ShadowShader::Program;
|
||||
GLuint ShadowShader::attrib_position;
|
||||
GLuint ShadowShader::uniform_MM;
|
||||
|
||||
void ShadowShader::init()
|
||||
{
|
||||
// Geometry shader needed
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
{
|
||||
attrib_position = -1;
|
||||
return;
|
||||
}
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -1522,7 +1356,6 @@ namespace MeshShader
|
||||
GL_GEOMETRY_SHADER, file_manager->getAsset("shaders/shadow.geom").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/white.frag").c_str());
|
||||
}
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -1535,22 +1368,18 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint RSMShader::Program;
|
||||
GLuint RSMShader::attrib_position;
|
||||
GLuint RSMShader::attrib_texcoord;
|
||||
GLuint RSMShader::attrib_normal;
|
||||
GLuint RSMShader::uniform_MM;
|
||||
GLuint RSMShader::uniform_tex;
|
||||
GLuint RSMShader::uniform_RSMMatrix;
|
||||
|
||||
void RSMShader::init()
|
||||
{
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
return;
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/rsm.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/rsm.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_normal = glGetAttribLocation(Program, "Normal");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix");
|
||||
}
|
||||
@ -1563,19 +1392,12 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedShadowShader::Program;
|
||||
GLuint InstancedShadowShader::attrib_position;
|
||||
GLuint InstancedShadowShader::attrib_origin;
|
||||
GLuint InstancedShadowShader::attrib_orientation;
|
||||
GLuint InstancedShadowShader::attrib_scale;
|
||||
|
||||
void InstancedShadowShader::init()
|
||||
{
|
||||
// Geometry shader needed
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
{
|
||||
attrib_position = -1;
|
||||
return;
|
||||
}
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -1591,10 +1413,6 @@ namespace MeshShader
|
||||
GL_GEOMETRY_SHADER, file_manager->getAsset("shaders/shadow.geom").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/white.frag").c_str());
|
||||
}
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
@ -1604,8 +1422,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint RefShadowShader::Program;
|
||||
GLuint RefShadowShader::attrib_position;
|
||||
GLuint RefShadowShader::attrib_texcoord;
|
||||
GLuint RefShadowShader::uniform_MM;
|
||||
GLuint RefShadowShader::uniform_tex;
|
||||
|
||||
@ -1613,11 +1429,7 @@ namespace MeshShader
|
||||
{
|
||||
// Geometry shader needed
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
{
|
||||
attrib_position = -1;
|
||||
attrib_texcoord = -1;
|
||||
return;
|
||||
}
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -1631,8 +1443,6 @@ namespace MeshShader
|
||||
GL_GEOMETRY_SHADER, file_manager->getAsset("shaders/shadow.geom").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());
|
||||
}
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
uniform_MM = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
@ -1646,22 +1456,13 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint InstancedRefShadowShader::Program;
|
||||
GLuint InstancedRefShadowShader::attrib_position;
|
||||
GLuint InstancedRefShadowShader::attrib_texcoord;
|
||||
GLuint InstancedRefShadowShader::attrib_origin;
|
||||
GLuint InstancedRefShadowShader::attrib_orientation;
|
||||
GLuint InstancedRefShadowShader::attrib_scale;
|
||||
GLuint InstancedRefShadowShader::uniform_tex;
|
||||
|
||||
void InstancedRefShadowShader::init()
|
||||
{
|
||||
// Geometry shader needed
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
{
|
||||
attrib_position = -1;
|
||||
attrib_texcoord = -1;
|
||||
return;
|
||||
}
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -1677,11 +1478,6 @@ namespace MeshShader
|
||||
GL_GEOMETRY_SHADER, file_manager->getAsset("shaders/shadow.geom").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());
|
||||
}
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_origin = glGetAttribLocation(Program, "Origin");
|
||||
attrib_orientation = glGetAttribLocation(Program, "Orientation");
|
||||
attrib_scale = glGetAttribLocation(Program, "Scale");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -1693,9 +1489,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint GrassShadowShader::Program;
|
||||
GLuint GrassShadowShader::attrib_position;
|
||||
GLuint GrassShadowShader::attrib_texcoord;
|
||||
GLuint GrassShadowShader::attrib_color;
|
||||
GLuint GrassShadowShader::uniform_MVP;
|
||||
GLuint GrassShadowShader::uniform_tex;
|
||||
GLuint GrassShadowShader::uniform_windDir;
|
||||
@ -1706,11 +1499,8 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/object_unlit.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelViewProjectionMatrix");
|
||||
uniform_tex = glGetUniformLocation(Program, "tex");
|
||||
attrib_color = glGetAttribLocation(Program, "Color");
|
||||
uniform_windDir = glGetUniformLocation(Program, "windDir");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
@ -1724,7 +1514,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint DisplaceMaskShader::Program;
|
||||
GLuint DisplaceMaskShader::attrib_position;
|
||||
GLuint DisplaceMaskShader::uniform_MVP;
|
||||
|
||||
void DisplaceMaskShader::init()
|
||||
@ -1732,10 +1521,12 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/displace.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/white.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
if (!UserConfigParams::m_ubo_disabled)
|
||||
{
|
||||
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
|
||||
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplaceMaskShader::setUniforms(const core::matrix4 &ModelMatrix)
|
||||
@ -1744,9 +1535,6 @@ namespace MeshShader
|
||||
}
|
||||
|
||||
GLuint DisplaceShader::Program;
|
||||
GLuint DisplaceShader::attrib_position;
|
||||
GLuint DisplaceShader::attrib_texcoord;
|
||||
GLuint DisplaceShader::attrib_second_texcoord;
|
||||
GLuint DisplaceShader::uniform_MVP;
|
||||
GLuint DisplaceShader::uniform_displacement_tex;
|
||||
GLuint DisplaceShader::uniform_mask_tex;
|
||||
@ -1759,9 +1547,6 @@ namespace MeshShader
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/displace.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/displace.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
|
||||
attrib_second_texcoord = glGetAttribLocation(Program, "SecondTexcoord");
|
||||
uniform_MVP = glGetUniformLocation(Program, "ModelMatrix");
|
||||
uniform_displacement_tex = glGetUniformLocation(Program, "displacement_tex");
|
||||
uniform_color_tex = glGetUniformLocation(Program, "color_tex");
|
||||
@ -2391,6 +2176,8 @@ namespace FullScreenShader
|
||||
|
||||
void RadianceHintsConstructionShader::init()
|
||||
{
|
||||
if (irr_driver->getGLSLVersion() < 150)
|
||||
return;
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@ -2520,6 +2307,8 @@ namespace FullScreenShader
|
||||
void ComputeGaussian17TapHShader::init()
|
||||
{
|
||||
#if WIN32
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
return;
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralH.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
@ -2579,6 +2368,8 @@ namespace FullScreenShader
|
||||
void ComputeGaussian17TapVShader::init()
|
||||
{
|
||||
#if WIN32
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
return;
|
||||
Program = LoadProgram(
|
||||
GL_COMPUTE_SHADER, file_manager->getAsset("shaders/bilateralV.comp").c_str());
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
|
@ -53,7 +53,6 @@ class ObjectPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_normal;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -64,7 +63,6 @@ class ObjectRefPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_IMM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -75,7 +73,6 @@ class GrassPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_normal, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_TIMV, uniform_tex, uniform_windDir;
|
||||
|
||||
static void init();
|
||||
@ -86,7 +83,6 @@ class NormalMapShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_tangent, attrib_bitangent;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_normalMap, uniform_DiffuseForAlpha;
|
||||
|
||||
static void init();
|
||||
@ -97,7 +93,6 @@ class InstancedObjectPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -108,7 +103,6 @@ class InstancedObjectRefPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -119,7 +113,6 @@ class InstancedGrassPass1Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_origin, attrib_orientation, attrib_scale, attrib_color, attrib_texcoord;
|
||||
static GLuint uniform_windDir, uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -130,7 +123,6 @@ class ObjectPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -142,7 +134,6 @@ class InstancedObjectPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_VP, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -154,7 +145,6 @@ class InstancedObjectRefPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_VP, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -166,7 +156,6 @@ class DetailledObjectPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||
static GLuint uniform_MM, uniform_ambient;
|
||||
static GLuint TU_Albedo, TU_detail;
|
||||
|
||||
@ -178,7 +167,6 @@ class ObjectRimLimitShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal, attrib_texcoord;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -190,7 +178,6 @@ class UntexturedObjectShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_color;
|
||||
static GLuint uniform_MM, uniform_ambient;
|
||||
|
||||
static void init();
|
||||
@ -201,7 +188,6 @@ class ObjectUnlitShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MM;
|
||||
static GLuint TU_tex;
|
||||
|
||||
@ -213,7 +199,6 @@ class ObjectRefPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MM, uniform_TM, uniform_ambient;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -225,7 +210,6 @@ class GrassPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_ambient, uniform_windDir;
|
||||
static GLuint TU_Albedo;
|
||||
|
||||
@ -237,7 +221,6 @@ class InstancedGrassPass2Shader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_normal, attrib_color, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_VP, uniform_TM, uniform_IVM, uniform_ambient, uniform_windDir, uniform_invproj, uniform_SunDir;
|
||||
static GLuint TU_Albedo, TU_dtex;
|
||||
|
||||
@ -249,7 +232,6 @@ class SphereMapShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_normal;
|
||||
static GLuint uniform_MM, uniform_IMM, uniform_ambient;
|
||||
static GLuint TU_tex;
|
||||
|
||||
@ -261,7 +243,6 @@ class SplattingShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||
static GLuint uniform_MM, uniform_ambient;
|
||||
static GLuint TU_tex_layout, TU_tex_detail0, TU_tex_detail1, TU_tex_detail2, TU_tex_detail3;
|
||||
|
||||
@ -273,7 +254,6 @@ class BubbleShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MVP, uniform_tex, uniform_time, uniform_transparency;
|
||||
|
||||
static void init();
|
||||
@ -284,7 +264,6 @@ class TransparentShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_TM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -295,7 +274,6 @@ class TransparentFogShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_TM, uniform_tex, uniform_fogmax, uniform_startH, uniform_endH, uniform_start, uniform_end, uniform_col;
|
||||
|
||||
static void init();
|
||||
@ -318,7 +296,6 @@ class ColorizeShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_MM, uniform_col;
|
||||
|
||||
static void init();
|
||||
@ -329,7 +306,6 @@ class ShadowShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_MM, uniform_ViewProjectionMatrixesUBO;
|
||||
|
||||
static void init();
|
||||
@ -340,7 +316,6 @@ class RSMShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_normal;
|
||||
static GLuint uniform_MM, uniform_tex, uniform_RSMMatrix;
|
||||
|
||||
static void init();
|
||||
@ -351,7 +326,6 @@ class InstancedShadowShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_origin, attrib_orientation, attrib_scale;
|
||||
|
||||
static void init();
|
||||
static void setUniforms();
|
||||
@ -361,7 +335,6 @@ class RefShadowShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord;
|
||||
static GLuint uniform_MM, uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -372,7 +345,6 @@ class InstancedRefShadowShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
|
||||
static GLuint uniform_tex;
|
||||
|
||||
static void init();
|
||||
@ -383,7 +355,6 @@ class GrassShadowShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_color;
|
||||
static GLuint uniform_MVP, uniform_tex, uniform_windDir;
|
||||
|
||||
static void init();
|
||||
@ -394,7 +365,6 @@ class DisplaceMaskShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_MVP;
|
||||
|
||||
static void init();
|
||||
@ -405,7 +375,6 @@ class DisplaceShader
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position, attrib_texcoord, attrib_second_texcoord;
|
||||
static GLuint uniform_MVP, uniform_displacement_tex, uniform_mask_tex, uniform_color_tex, uniform_dir, uniform_dir2;
|
||||
|
||||
static void init();
|
||||
|
@ -199,13 +199,6 @@ void STKAnimatedMesh::render()
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for_in(mesh, ShadedMesh[SM_UNTEXTURED])
|
||||
{
|
||||
GroupedSM<SM_UNTEXTURED>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNTEXTURED>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_UNTEXTURED>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,6 @@ void STKInstancedSceneNode::cleanGL()
|
||||
continue;
|
||||
if (mesh.vao)
|
||||
glDeleteVertexArrays(1, &(mesh.vao));
|
||||
if (mesh.vao_second_pass)
|
||||
glDeleteVertexArrays(1, &(mesh.vao_second_pass));
|
||||
if (mesh.vao_shadow_pass)
|
||||
glDeleteVertexArrays(1, &(mesh.vao_shadow_pass));
|
||||
glDeleteBuffers(1, &(mesh.vertex_buffer));
|
||||
@ -56,83 +54,34 @@ void STKInstancedSceneNode::createGLMeshes()
|
||||
isMaterialInitialized = false;
|
||||
}
|
||||
|
||||
template<typename T, unsigned divisor>
|
||||
void setInstanceAttribPointer()
|
||||
{
|
||||
glEnableVertexAttribArray(T::attrib_origin);
|
||||
glVertexAttribPointer(T::attrib_origin, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 0);
|
||||
glVertexAttribDivisor(T::attrib_origin, divisor);
|
||||
glEnableVertexAttribArray(T::attrib_orientation);
|
||||
glVertexAttribPointer(T::attrib_orientation, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(3 * sizeof(float)));
|
||||
glVertexAttribDivisor(T::attrib_orientation, divisor);
|
||||
glEnableVertexAttribArray(T::attrib_scale);
|
||||
glVertexAttribPointer(T::attrib_scale, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(6 * sizeof(float)));
|
||||
glVertexAttribDivisor(T::attrib_scale, divisor);
|
||||
}
|
||||
|
||||
void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)
|
||||
{
|
||||
switch (GeoMat)
|
||||
{
|
||||
case FPSM_DEFAULT:
|
||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glGenBuffers(1, &instances_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||
setInstanceAttribPointer<MeshShader::InstancedObjectPass1Shader, 1>();
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
{
|
||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
setInstanceAttribPointer<MeshShader::InstancedShadowShader, 4>();
|
||||
}
|
||||
break;
|
||||
case FPSM_ALPHA_REF_TEXTURE:
|
||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glGenBuffers(1, &instances_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass1Shader, 1>();
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
{
|
||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
setInstanceAttribPointer<MeshShader::InstancedRefShadowShader, 4>();
|
||||
}
|
||||
break;
|
||||
case FPSM_GRASS:
|
||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glGenBuffers(1, &instances_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||
setInstanceAttribPointer<MeshShader::InstancedGrassPass1Shader, 1>();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glGenBuffers(1, &instances_vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);
|
||||
|
||||
glEnableVertexAttribArray(7);
|
||||
glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 0);
|
||||
glVertexAttribDivisor(7, 1);
|
||||
glEnableVertexAttribArray(8);
|
||||
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(3 * sizeof(float)));
|
||||
glVertexAttribDivisor(8, 1);
|
||||
glEnableVertexAttribArray(9);
|
||||
glVertexAttribPointer(9, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(6 * sizeof(float)));
|
||||
glVertexAttribDivisor(9, 1);
|
||||
|
||||
|
||||
switch (ShadedMat)
|
||||
{
|
||||
case SM_DEFAULT:
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
setInstanceAttribPointer<MeshShader::InstancedObjectPass2Shader, 1>();
|
||||
break;
|
||||
case SM_ALPHA_REF_TEXTURE:
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
setInstanceAttribPointer<MeshShader::InstancedObjectRefPass2Shader, 1>();
|
||||
break;
|
||||
case SM_GRASS:
|
||||
mesh.vao_second_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
setInstanceAttribPointer<MeshShader::InstancedGrassPass2Shader, 1>();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
mesh.vao_shadow_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
|
||||
glEnableVertexAttribArray(7);
|
||||
glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), 0);
|
||||
glVertexAttribDivisor(7, 4);
|
||||
glEnableVertexAttribArray(8);
|
||||
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(3 * sizeof(float)));
|
||||
glVertexAttribDivisor(8, 4);
|
||||
glEnableVertexAttribArray(9);
|
||||
glVertexAttribPointer(9, 3, GL_FLOAT, GL_FALSE, 9 * sizeof(float), (GLvoid*)(6 * sizeof(float)));
|
||||
glVertexAttribDivisor(9, 4);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
@ -152,10 +101,8 @@ void STKInstancedSceneNode::setFirstTimeMaterial()
|
||||
GeometricMaterial GeometricType = MaterialTypeToGeometricMaterial(type);
|
||||
ShadedMaterial ShadedType = MaterialTypeToShadedMaterial(type, mesh.textures);
|
||||
initinstancedvaostate(mesh, GeometricType, ShadedType);
|
||||
if (mesh.vao_first_pass)
|
||||
GeometricMesh[GeometricType].push_back(&mesh);
|
||||
if (mesh.vao_second_pass)
|
||||
ShadedMesh[ShadedType].push_back(&mesh);
|
||||
GeometricMesh[GeometricType].push_back(&mesh);
|
||||
ShadedMesh[ShadedType].push_back(&mesh);
|
||||
}
|
||||
isMaterialInitialized = true;
|
||||
}
|
||||
@ -193,7 +140,7 @@ static void drawFSPMDefault(GLMesh &mesh, size_t instance_count)
|
||||
}
|
||||
MeshShader::InstancedObjectPass1Shader::setUniforms(0);
|
||||
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
|
||||
if (!mesh.textures[0])
|
||||
@ -212,7 +159,6 @@ static void drawShadowDefault(GLMesh &mesh, size_t instance_count)
|
||||
|
||||
MeshShader::InstancedShadowShader::setUniforms();
|
||||
|
||||
assert(mesh.vao_shadow_pass);
|
||||
glBindVertexArray(mesh.vao_shadow_pass);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, 4 * instance_count);
|
||||
}
|
||||
@ -228,7 +174,7 @@ static void drawFSPMAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedObjectRefPass1Shader::setUniforms(0);
|
||||
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
}
|
||||
|
||||
@ -243,9 +189,8 @@ static void drawShadowAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedRefShadowShader::setUniforms(0);
|
||||
|
||||
assert(mesh.vao_shadow_pass);
|
||||
glBindVertexArray(mesh.vao_shadow_pass);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, 4 * instance_count);
|
||||
}
|
||||
|
||||
static void drawFSPMGrass(GLMesh &mesh, const core::vector3df &windDir, size_t instance_count)
|
||||
@ -259,7 +204,7 @@ static void drawFSPMGrass(GLMesh &mesh, const core::vector3df &windDir, size_t i
|
||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
MeshShader::InstancedGrassPass1Shader::setUniforms(windDir, 0);
|
||||
|
||||
glBindVertexArray(mesh.vao_first_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
}
|
||||
|
||||
@ -284,7 +229,7 @@ static void drawSMDefault(GLMesh &mesh, const core::matrix4 &ModelViewProjection
|
||||
|
||||
MeshShader::InstancedObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
|
||||
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
}
|
||||
|
||||
@ -310,7 +255,7 @@ static void drawSMAlphaRefTexture(GLMesh &mesh, const core::matrix4 &ModelViewPr
|
||||
|
||||
MeshShader::InstancedObjectRefPass2Shader::setUniforms(ModelViewProjectionMatrix, core::matrix4::EM4CONST_IDENTITY);
|
||||
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
}
|
||||
|
||||
@ -338,7 +283,7 @@ static void drawSMGrass(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMa
|
||||
|
||||
MeshShader::InstancedGrassPass2Shader::setUniforms(ModelViewProjectionMatrix, irr_driver->getInvViewMatrix(), irr_driver->getInvProjMatrix(), windDir, cb->getPosition());
|
||||
|
||||
glBindVertexArray(mesh.vao_second_pass);
|
||||
glBindVertexArray(mesh.vao);
|
||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,6 @@ ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE type, video::
|
||||
return SM_UNLIT;
|
||||
else if (textures[1] && type != irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return SM_DETAILS;
|
||||
else if (!textures[0])
|
||||
return SM_UNTEXTURED;
|
||||
else
|
||||
return SM_DEFAULT;
|
||||
}
|
||||
@ -522,6 +520,8 @@ void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
||||
GLenum itype = mesh.IndexType;
|
||||
size_t count = mesh.IndexCount;
|
||||
|
||||
if (!mesh.textures[0])
|
||||
const_cast<GLMesh &>(mesh).textures[0] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||
compressTexture(mesh.textures[0], true);
|
||||
setTexture(MeshShader::ObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||
if (irr_driver->getLightViz())
|
||||
|
@ -29,7 +29,6 @@ enum ShadedMaterial
|
||||
SM_GRASS,
|
||||
SM_UNLIT,
|
||||
SM_DETAILS,
|
||||
SM_UNTEXTURED,
|
||||
SM_COUNT
|
||||
};
|
||||
|
||||
@ -43,12 +42,6 @@ enum TransparentMaterial
|
||||
|
||||
struct GLMesh {
|
||||
GLuint vao;
|
||||
GLuint vao_first_pass;
|
||||
GLuint vao_second_pass;
|
||||
GLuint vao_glow_pass;
|
||||
GLuint vao_displace_pass;
|
||||
GLuint vao_displace_mask_pass;
|
||||
GLuint vao_rsm_pass;
|
||||
GLuint vao_shadow_pass;
|
||||
GLuint vertex_buffer;
|
||||
GLuint index_buffer;
|
||||
|
@ -365,13 +365,6 @@ void STKMeshSceneNode::render()
|
||||
GroupedSM<SM_DETAILS>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
for_in(mesh, ShadedMesh[SM_UNTEXTURED])
|
||||
{
|
||||
GroupedSM<SM_UNTEXTURED>::MeshSet.push_back(mesh);
|
||||
GroupedSM<SM_UNTEXTURED>::MVPSet.push_back(AbsoluteTransformation);
|
||||
GroupedSM<SM_UNTEXTURED>::TIMVSet.push_back(invmodel);
|
||||
}
|
||||
|
||||
if (!ShadedMesh[SM_GRASS].empty())
|
||||
glUseProgram(MeshShader::GrassPass2Shader::Program);
|
||||
for_in(mesh, ShadedMesh[SM_GRASS])
|
||||
|
@ -1944,7 +1944,7 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
|
||||
if (fb != NULL && fb->getRTT().size() > 0)
|
||||
{
|
||||
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
|
||||
rect, core::rect<s32>(0, 0, 512, 512), NULL, true);
|
||||
rect, core::rect<s32>(0, 0, 512, 512), NULL, SColor(255, 255, 255, 255), true);
|
||||
}
|
||||
}
|
||||
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)
|
||||
|
@ -173,21 +173,9 @@ void ModelViewWidget::update(float delta)
|
||||
m_rtt_main_node->setRotation(core::vector3df(0.0f, angle, 0.0f));
|
||||
|
||||
m_rtt_main_node->setVisible(true);
|
||||
irr_driver->setRTT(m_rtt_provider);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(m_camera);
|
||||
m_frame_buffer = m_rtt_provider->render(m_camera, GUIEngine::getLatestDt());
|
||||
|
||||
std::vector<IrrDriver::GlowData> glows;
|
||||
irr_driver->computeCameraMatrix(m_camera, 512, 512);
|
||||
unsigned plc = irr_driver->UpdateLightsInfo(m_camera, GUIEngine::getLatestDt());
|
||||
irr_driver->renderScene(m_camera, plc, glows, GUIEngine::getLatestDt(), false, true);
|
||||
m_frame_buffer = irr_driver->getPostProcessing()->render(m_camera);
|
||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
|
||||
irr_driver->setRTT(NULL);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
irr_driver->getSceneManager()->setActiveCamera(NULL);
|
||||
m_rtt_main_node->setVisible(false);
|
||||
}
|
||||
|
||||
@ -284,10 +272,7 @@ void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
m_camera->setAspectRatio(1.0f);
|
||||
|
||||
m_camera->setPosition(core::vector3df(0.0, 20.0f, 70.0f));
|
||||
if (irr_driver->isGLSL())
|
||||
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
|
||||
else
|
||||
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
|
||||
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
|
||||
m_camera->setTarget(core::vector3df(0, 10, 0.0f));
|
||||
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
|
||||
m_camera->updateAbsolutePosition();
|
||||
|
@ -2540,6 +2540,8 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
|
||||
center_shift.setY(m_skidding->getGraphicalJumpOffset() + lean_height
|
||||
- m_kart_model->getLowestPoint() -chassis_delta );
|
||||
center_shift = getTrans().getBasis() * center_shift;
|
||||
|
||||
float heading = m_skidding->getVisualSkidRotation();
|
||||
Moveable::updateGraphics(dt, center_shift,
|
||||
btQuaternion(heading, 0, m_current_lean));
|
||||
|
11
src/main.cpp
11
src/main.cpp
@ -418,17 +418,10 @@ void setupRaceStart()
|
||||
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||
}
|
||||
|
||||
if(!track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
{
|
||||
race_manager->setTrack("jungle");
|
||||
}
|
||||
else
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices
|
||||
// is read.
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
} // setupRaceMode
|
||||
} // setupRaceStart
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Prints help for command line options to stdout.
|
||||
@ -1118,6 +1111,8 @@ void initRest()
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
|
||||
race_manager->setDifficulty(
|
||||
(RaceManager::Difficulty)(int)UserConfigParams::m_difficulty);
|
||||
if(track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
} // initRest
|
||||
|
||||
|
@ -176,7 +176,7 @@ void MainLoop::run()
|
||||
|
||||
PROFILER_SYNC_FRAME();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
} // while !m_exit
|
||||
} // while !m_abort
|
||||
|
||||
} // run
|
||||
|
||||
|
@ -630,7 +630,7 @@ void World::resetAllKarts()
|
||||
{
|
||||
if (count++ > 100)
|
||||
{
|
||||
Log::error("World", "Infitine loop waiting for all_finished?");
|
||||
Log::error("World", "Infinite loop waiting for all_finished?");
|
||||
break;
|
||||
}
|
||||
m_physics->update(1.f/60.f);
|
||||
|
@ -323,35 +323,24 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
#else
|
||||
if(index==2 || index==3)
|
||||
{
|
||||
if(m_visual_rotation==0.123123123)
|
||||
btTransform chassisTrans = getChassisWorldTransform();
|
||||
if (getRigidBody()->getMotionState())
|
||||
{
|
||||
m_visual_contact_point[index ] = rayResults.m_hitPointInWorld;
|
||||
m_visual_contact_point[index-2] = source;
|
||||
m_visual_wheels_touch_ground &= (object!=NULL);
|
||||
getRigidBody()->getMotionState()->getWorldTransform(chassisTrans);
|
||||
}
|
||||
else
|
||||
{
|
||||
btTransform chassisTrans = getChassisWorldTransform();
|
||||
if (getRigidBody()->getMotionState())
|
||||
{
|
||||
getRigidBody()->getMotionState()->getWorldTransform(chassisTrans);
|
||||
}
|
||||
btQuaternion q(m_visual_rotation, 0, 0);
|
||||
btQuaternion rot_new = chassisTrans.getRotation() * q;
|
||||
chassisTrans.setRotation(rot_new);
|
||||
btVector3 pos = m_kart->getKartModel()->getWheelGraphicsPosition(index);
|
||||
pos.setZ(pos.getZ()*0.9f);
|
||||
//pos.setX(pos.getX()*0.1f);
|
||||
//btVector3 pos = wheel.m_chassisConnectionPointCS;
|
||||
btVector3 source = chassisTrans( pos );
|
||||
btVector3 target = source + rayvector;
|
||||
btVehicleRaycaster::btVehicleRaycasterResult rayResults;
|
||||
btQuaternion q(m_visual_rotation, 0, 0);
|
||||
btQuaternion rot_new = chassisTrans.getRotation() * q;
|
||||
chassisTrans.setRotation(rot_new);
|
||||
btVector3 pos = m_kart->getKartModel()->getWheelGraphicsPosition(index);
|
||||
pos.setZ(pos.getZ()*0.9f);
|
||||
btVector3 source = chassisTrans( pos );
|
||||
btVector3 target = source + rayvector;
|
||||
btVehicleRaycaster::btVehicleRaycasterResult rayResults;
|
||||
|
||||
void* object = m_vehicleRaycaster->castRay(source,target,rayResults);
|
||||
m_visual_contact_point[index] = rayResults.m_hitPointInWorld;
|
||||
m_visual_contact_point[index-2] = source;
|
||||
m_visual_wheels_touch_ground &= (object!=NULL);
|
||||
}
|
||||
void* object = m_vehicleRaycaster->castRay(source,target,rayResults);
|
||||
m_visual_contact_point[index] = rayResults.m_hitPointInWorld;
|
||||
m_visual_contact_point[index-2] = source;
|
||||
m_visual_wheels_touch_ground &= (object!=NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -607,7 +607,7 @@ void PhysicalObject::hit(const Material *m, const Vec3 &normal)
|
||||
if(isSoccerBall() && m != NULL &&
|
||||
m->getCollisionReaction() == Material::PUSH_SOCCER_BALL)
|
||||
{
|
||||
m_body->applyCentralImpulse(normal * 1000.0f);
|
||||
m_body->applyCentralImpulse(normal * 100.0f);
|
||||
}
|
||||
} // hit
|
||||
|
||||
|
@ -274,12 +274,16 @@ btVector3 TriangleMesh::getInterpolatedNormal(unsigned int index,
|
||||
* \param xyz The position in world where the ray hit.
|
||||
* \param material The material of the mesh that was hit.
|
||||
* \param normal The intrapolated normal at that position.
|
||||
* \param interpolate_normal If true, the returned normal is the interpolated
|
||||
* based on the three normals of the triangle and the location of the
|
||||
* hit point (which is more compute intensive, but results in much
|
||||
* smoother results).
|
||||
* \return True if a triangle was hit, false otherwise (and no output
|
||||
* variable will be set.
|
||||
*/
|
||||
bool TriangleMesh::castRay(const btVector3 &from, const btVector3 &to,
|
||||
btVector3 *xyz, const Material **material,
|
||||
btVector3 *normal) const
|
||||
btVector3 *normal, bool interpolate_normal) const
|
||||
{
|
||||
if(!m_collision_shape)
|
||||
{
|
||||
@ -300,26 +304,25 @@ bool TriangleMesh::castRay(const btVector3 &from, const btVector3 &to,
|
||||
|
||||
btCollisionWorld::ClosestRayResultCallback result(from, to);
|
||||
|
||||
|
||||
/** A special ray result class that stores the index of the triangle
|
||||
* that was hit. */
|
||||
class MaterialRayResult : public btCollisionWorld::ClosestRayResultCallback
|
||||
{
|
||||
public:
|
||||
const Material* m_material;
|
||||
const TriangleMesh *m_this;
|
||||
/** Stores the index of the triangle that was hit. */
|
||||
int m_index;
|
||||
// --------------------------------------------------------------------
|
||||
MaterialRayResult(const btVector3 &p1, const btVector3 &p2,
|
||||
const TriangleMesh *me)
|
||||
: btCollisionWorld::ClosestRayResultCallback(p1,p2)
|
||||
{
|
||||
m_material = NULL;
|
||||
m_this = me;
|
||||
m_index = -1;;
|
||||
} // MaterialRayResult
|
||||
// --------------------------------------------------------------------
|
||||
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,
|
||||
bool normalInWorldSpace)
|
||||
{
|
||||
m_material =
|
||||
m_this->getMaterial(rayResult.m_localShapeInfo->m_triangleIndex);
|
||||
m_index = rayResult.m_localShapeInfo->m_triangleIndex;
|
||||
return btCollisionWorld::ClosestRayResultCallback
|
||||
::addSingleResult(rayResult, normalInWorldSpace);
|
||||
} // AddSingleResult
|
||||
@ -335,13 +338,23 @@ bool TriangleMesh::castRay(const btVector3 &from, const btVector3 &to,
|
||||
: m_body,
|
||||
m_collision_shape, world_trans,
|
||||
ray_callback);
|
||||
// Get the index of the triangle hit
|
||||
int index = ray_callback.m_index;
|
||||
if(ray_callback.hasHit())
|
||||
{
|
||||
*xyz = ray_callback.m_hitPointWorld;
|
||||
*material = ray_callback.m_material;
|
||||
*material = m_triangleIndex2Material[index];
|
||||
|
||||
if(normal)
|
||||
{
|
||||
*normal = ray_callback.m_hitNormalWorld;
|
||||
// If requested interpolate the normal. I.e. instead of using
|
||||
// the normal of the triangle interpolate the normal at the
|
||||
// hit position based on the three normals of the triangle.
|
||||
if(interpolate_normal)
|
||||
*normal = getInterpolatedNormal(ray_callback.m_index,
|
||||
ray_callback.m_hitPointWorld);
|
||||
else
|
||||
*normal = ray_callback.m_hitNormalWorld;
|
||||
normal->normalize();
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
bool castRay(const btVector3 &from, const btVector3 &to,
|
||||
btVector3 *xyz, const Material **material,
|
||||
btVector3 *normal=NULL) const;
|
||||
btVector3 *normal=NULL, bool interpolate_normal=false) const;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the points of the 'indx' triangle.
|
||||
* \param indx Index of the triangle to get.
|
||||
|
@ -342,19 +342,28 @@ void RaceGUI::drawGlobalMiniMap()
|
||||
// arenas currently don't have a map.
|
||||
if(world->getTrack()->isArena() || world->getTrack()->isSoccer()) return;
|
||||
|
||||
const video::ITexture *mini_map = world->getTrack()->getMiniMap();
|
||||
const video::ITexture *old_rtt_mini_map = world->getTrack()->getOldRttMiniMap();
|
||||
const FrameBuffer* new_rtt_mini_map = world->getTrack()->getNewRttMiniMap();
|
||||
|
||||
int upper_y = UserConfigParams::m_height - m_map_bottom - m_map_height;
|
||||
int lower_y = UserConfigParams::m_height - m_map_bottom;
|
||||
|
||||
if (mini_map != NULL)
|
||||
core::rect<s32> dest(m_map_left, upper_y,
|
||||
m_map_left + m_map_width, lower_y);
|
||||
|
||||
if (old_rtt_mini_map != NULL)
|
||||
{
|
||||
core::rect<s32> dest(m_map_left, upper_y,
|
||||
m_map_left + m_map_width, lower_y);
|
||||
core::rect<s32> source(core::position2di(0, 0),
|
||||
mini_map->getOriginalSize());
|
||||
draw2DImage(mini_map, dest, source,
|
||||
NULL, NULL, true);
|
||||
old_rtt_mini_map->getOriginalSize());
|
||||
draw2DImage(old_rtt_mini_map, dest, source,
|
||||
NULL, NULL, true);
|
||||
}
|
||||
else if (new_rtt_mini_map != NULL)
|
||||
{
|
||||
core::rect<s32> source(0, 0, new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight());
|
||||
draw2DImageFromRTT(new_rtt_mini_map->getRTT()[0],
|
||||
new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight(),
|
||||
dest, source, NULL, video::SColor(127, 255, 255, 255), true);
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
|
@ -321,17 +321,26 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
||||
}
|
||||
|
||||
|
||||
const video::ITexture *mini_map = world->getTrack()->getMiniMap();
|
||||
const video::ITexture *old_rtt_mini_map = world->getTrack()->getOldRttMiniMap();
|
||||
const FrameBuffer* new_rtt_mini_map = world->getTrack()->getNewRttMiniMap();
|
||||
|
||||
int upper_y = m_map_bottom - m_map_height;
|
||||
int lower_y = m_map_bottom;
|
||||
|
||||
if (mini_map != NULL)
|
||||
core::rect<s32> dest(m_map_left, upper_y,
|
||||
m_map_left + m_map_width, lower_y);
|
||||
|
||||
if (old_rtt_mini_map != NULL)
|
||||
{
|
||||
core::rect<s32> dest(m_map_left, upper_y,
|
||||
m_map_left + m_map_width, lower_y);
|
||||
core::rect<s32> source(core::position2di(0, 0), mini_map->getOriginalSize());
|
||||
draw2DImage(mini_map, dest, source, 0, 0, true);
|
||||
core::rect<s32> source(core::position2di(0, 0), old_rtt_mini_map->getOriginalSize());
|
||||
draw2DImage(old_rtt_mini_map, dest, source, 0, 0, true);
|
||||
}
|
||||
else if (new_rtt_mini_map != NULL)
|
||||
{
|
||||
core::rect<s32> source(0, 0, new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight());
|
||||
draw2DImageFromRTT(new_rtt_mini_map->getRTT()[0],
|
||||
new_rtt_mini_map->getWidth(), new_rtt_mini_map->getHeight(),
|
||||
dest, source, NULL, video::SColor(127, 255, 255, 255), true);
|
||||
}
|
||||
|
||||
Vec3 kart_xyz;
|
||||
|
@ -452,12 +452,12 @@ void QuadGraph::createMesh(bool show_invisible,
|
||||
// Set up the indices for the triangles
|
||||
// (note, afaik with opengl we could use quads directly, but the code
|
||||
// would not be portable to directx anymore).
|
||||
ind[6*i ] = 4*i; // First triangle: vertex 0, 1, 2
|
||||
ind[6*i ] = 4*i+2; // First triangle: vertex 0, 1, 2
|
||||
ind[6*i+1] = 4*i+1;
|
||||
ind[6*i+2] = 4*i+2;
|
||||
ind[6*i+3] = 4*i; // second triangle: vertex 0, 1, 3
|
||||
ind[6*i+2] = 4*i;
|
||||
ind[6*i+3] = 4*i+3; // second triangle: vertex 0, 1, 3
|
||||
ind[6*i+4] = 4*i+2;
|
||||
ind[6*i+5] = 4*i+3;
|
||||
ind[6*i+5] = 4*i;
|
||||
i++;
|
||||
} // for i=1; i<QuadSet::get()
|
||||
|
||||
@ -491,12 +491,12 @@ void QuadGraph::createMesh(bool show_invisible,
|
||||
lap_v[2].Pos = lap_v[1].Pos+core::vector3df(0, 0, 1);
|
||||
else
|
||||
lap_v[2].Pos = lap_v[1].Pos+dr*length/sqrt(lr2);
|
||||
lap_ind[0] = 0;
|
||||
lap_ind[0] = 2;
|
||||
lap_ind[1] = 1;
|
||||
lap_ind[2] = 2;
|
||||
lap_ind[3] = 0;
|
||||
lap_ind[2] = 0;
|
||||
lap_ind[3] = 3;
|
||||
lap_ind[4] = 2;
|
||||
lap_ind[5] = 3;
|
||||
lap_ind[5] = 0;
|
||||
// Set it a bit higher to avoid issued with z fighting,
|
||||
// i.e. part of the lap line might not be visible.
|
||||
for(unsigned int i=0; i<4; i++)
|
||||
@ -970,20 +970,37 @@ int QuadGraph::findOutOfRoadSector(const Vec3& xyz,
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Takes a snapshot of the driveline quads so they can be used as minimap.
|
||||
*/
|
||||
video::ITexture *QuadGraph::makeMiniMap(const core::dimension2du &origdimension,
|
||||
const std::string &name,
|
||||
const video::SColor &fill_color)
|
||||
void QuadGraph::makeMiniMap(const core::dimension2du &dimension,
|
||||
const std::string &name,
|
||||
const video::SColor &fill_color,
|
||||
video::ITexture** oldRttMinimap,
|
||||
FrameBuffer** newRttMinimap)
|
||||
{
|
||||
const core::dimension2du dimension = origdimension * 2;
|
||||
const SColor oldClearColor = World::getWorld()->getClearColor();
|
||||
World::getWorld()->setClearbackBufferColor(SColor(0, 255, 255, 255));
|
||||
*oldRttMinimap = NULL;
|
||||
*newRttMinimap = NULL;
|
||||
|
||||
RTT* newRttProvider = NULL;
|
||||
IrrDriver::RTTProvider* oldRttProvider = NULL;
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
newRttProvider = new RTT(dimension.Width, dimension.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
oldRttProvider = new IrrDriver::RTTProvider(dimension, name, true);
|
||||
}
|
||||
|
||||
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 255, 255, 255));
|
||||
|
||||
IrrDriver::RTTProvider rttProvider(dimension, name, true);
|
||||
video::SColor red(128, 255, 0, 0);
|
||||
createMesh(/*show_invisible part of the track*/ false,
|
||||
/*enable_transparency*/ false,
|
||||
/*track_color*/ &fill_color,
|
||||
/*lap line color*/ &red );
|
||||
|
||||
m_node = irr_driver->getSceneManager()->addMeshSceneNode(m_mesh); // add Debug Mesh
|
||||
m_node = irr_driver->addMesh(m_mesh);
|
||||
#ifdef DEBUG
|
||||
m_node->setName("minimap-mesh");
|
||||
#endif
|
||||
@ -1031,32 +1048,54 @@ video::ITexture *QuadGraph::makeMiniMap(const core::dimension2du &origdimension,
|
||||
float range = (dx>dz) ? dx : dz;
|
||||
|
||||
core::matrix4 projection;
|
||||
projection.buildProjectionMatrixOrthoLH(range,
|
||||
range,
|
||||
projection.buildProjectionMatrixOrthoLH(range /* width */,
|
||||
range /* height */,
|
||||
-1, bb_max.getY()-bb_min.getY()+1);
|
||||
camera->setProjectionMatrix(projection, true);
|
||||
|
||||
irr_driver->suppressSkyBox();
|
||||
irr_driver->clearLights();
|
||||
|
||||
// Adjust Y position by +1 for max, -1 for min - this helps in case that
|
||||
// the maximum Y coordinate is negative (otherwise the minimap is mirrored)
|
||||
// and avoids problems for tracks which have a flat (max Y = min Y) minimap.
|
||||
camera->setPosition(core::vector3df(center.getX(), bb_max.getY()+1, center.getZ()));
|
||||
camera->setPosition(core::vector3df(center.getX(), bb_min.getY() + 1.0f, center.getZ()));
|
||||
//camera->setPosition(core::vector3df(center.getX() - 5.0f, bb_min.getY() - 1 - 5.0f, center.getZ() - 15.0f));
|
||||
camera->setUpVector(core::vector3df(0, 0, 1));
|
||||
camera->setTarget(core::vector3df(center.getX(),bb_min.getY()-1,center.getZ()));
|
||||
//camera->setAspectRatio(1.0f);
|
||||
camera->updateAbsolutePosition();
|
||||
|
||||
video::ITexture *texture = rttProvider.renderToTexture();
|
||||
video::ITexture* texture = NULL;
|
||||
FrameBuffer* frame_buffer = NULL;
|
||||
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
frame_buffer = newRttProvider->render(camera, GUIEngine::getLatestDt());
|
||||
|
||||
// TODO: leak
|
||||
//delete newRttProvider;
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = oldRttProvider->renderToTexture();
|
||||
delete oldRttProvider;
|
||||
}
|
||||
|
||||
cleanupDebugMesh();
|
||||
irr_driver->removeCameraSceneNode(camera);
|
||||
m_min_coord = bb_min;
|
||||
|
||||
|
||||
if (texture == NULL)
|
||||
if (texture == NULL && frame_buffer == NULL)
|
||||
{
|
||||
Log::error("Quad Graph", "[makeMiniMap] WARNING: RTT does not appear to work,"
|
||||
"mini-map will not be available.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return texture;
|
||||
*oldRttMinimap = texture;
|
||||
*newRttMinimap = frame_buffer;
|
||||
World::getWorld()->setClearbackBufferColor(oldClearColor);
|
||||
} // makeMiniMap
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,7 @@ namespace irr
|
||||
using namespace irr;
|
||||
|
||||
class CheckLine;
|
||||
class FrameBuffer;
|
||||
|
||||
/**
|
||||
* \brief This class stores a graph of quads. It uses a 'simplified singleton'
|
||||
@ -118,10 +119,11 @@ public:
|
||||
float forwards_distance=1.5f,
|
||||
float sidewards_distance=1.5f,
|
||||
float upwards_distance=0.0f) const;
|
||||
video::ITexture *makeMiniMap(const core::dimension2du &where,
|
||||
const std::string &name,
|
||||
const video::SColor &fill_color
|
||||
=video::SColor(127, 255, 255, 255) );
|
||||
void makeMiniMap(const core::dimension2du &where,
|
||||
const std::string &name,
|
||||
const video::SColor &fill_color,
|
||||
video::ITexture** oldRttMinimap,
|
||||
FrameBuffer** newRttMinimap);
|
||||
void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *out) const;
|
||||
void updateDistancesForAllSuccessors(unsigned int indx,
|
||||
float delta,
|
||||
|
@ -57,7 +57,8 @@ void TerrainInfo::update(const Vec3 &from)
|
||||
to.setY(-10000.0f);
|
||||
|
||||
const TriangleMesh &tm = World::getWorld()->getTrack()->getTriangleMesh();
|
||||
tm.castRay(from, to, &m_hit_point, &m_material, &m_normal);
|
||||
tm.castRay(from, to, &m_hit_point, &m_material, &m_normal,
|
||||
/*interpolate*/false);
|
||||
} // update
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Update the terrain information based on the latest position.
|
||||
@ -71,7 +72,8 @@ void TerrainInfo::update(const btTransform &trans, const Vec3 &offset)
|
||||
to = trans(to);
|
||||
|
||||
const TriangleMesh &tm = World::getWorld()->getTrack()->getTriangleMesh();
|
||||
tm.castRay(from, to, &m_hit_point, &m_material, &m_normal);
|
||||
tm.castRay(from, to, &m_hit_point, &m_material, &m_normal,
|
||||
/*interpolate*/true);
|
||||
} // update
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -115,7 +115,8 @@ Track::Track(const std::string &filename)
|
||||
m_is_soccer = false;
|
||||
m_is_cutscene = false;
|
||||
m_camera_far = 1000.0f;
|
||||
m_mini_map = NULL;
|
||||
m_old_rtt_mini_map = NULL;
|
||||
m_new_rtt_mini_map = NULL;
|
||||
m_bloom = true;
|
||||
m_bloom_threshold = 0.75f;
|
||||
m_color_inlevel = core::vector3df(0.0,1.0, 255.0);
|
||||
@ -275,13 +276,13 @@ void Track::cleanup()
|
||||
// Clear reminder of the link between textures and file names.
|
||||
irr_driver->clearTexturesFileName();
|
||||
|
||||
for(unsigned int i=0; i<m_animated_textures.size(); i++)
|
||||
for (unsigned int i = 0; i < m_animated_textures.size(); i++)
|
||||
{
|
||||
delete m_animated_textures[i];
|
||||
}
|
||||
m_animated_textures.clear();
|
||||
|
||||
for(unsigned int i=0; i<m_all_nodes.size(); i++)
|
||||
for (unsigned int i = 0; i < m_all_nodes.size(); i++)
|
||||
{
|
||||
irr_driver->removeNode(m_all_nodes[i]);
|
||||
}
|
||||
@ -312,37 +313,42 @@ void Track::cleanup()
|
||||
// than once are in m_all_cached_mesh more than once (which is easier
|
||||
// than storing the mesh only once, but then having to test for each
|
||||
// mesh if it is already contained in the list or not).
|
||||
for(unsigned int i=0; i<m_all_cached_meshes.size(); i++)
|
||||
for (unsigned int i = 0; i < m_all_cached_meshes.size(); i++)
|
||||
{
|
||||
irr_driver->dropAllTextures(m_all_cached_meshes[i]);
|
||||
// If a mesh is not in Irrlicht's texture cache, its refcount is
|
||||
// 1 (since its scene node was removed, so the only other reference
|
||||
// is in m_all_cached_meshes). In this case we only drop it once
|
||||
// and don't try to remove it from the cache.
|
||||
if(m_all_cached_meshes[i]->getReferenceCount()==1)
|
||||
if (m_all_cached_meshes[i]->getReferenceCount() == 1)
|
||||
{
|
||||
m_all_cached_meshes[i]->drop();
|
||||
continue;
|
||||
}
|
||||
m_all_cached_meshes[i]->drop();
|
||||
if(m_all_cached_meshes[i]->getReferenceCount()==1)
|
||||
if (m_all_cached_meshes[i]->getReferenceCount() == 1)
|
||||
irr_driver->removeMeshFromCache(m_all_cached_meshes[i]);
|
||||
}
|
||||
m_all_cached_meshes.clear();
|
||||
|
||||
// Now free meshes that are not associated to any scene node.
|
||||
for (unsigned int i=0; i<m_detached_cached_meshes.size(); i++)
|
||||
for (unsigned int i = 0; i < m_detached_cached_meshes.size(); i++)
|
||||
{
|
||||
irr_driver->dropAllTextures(m_detached_cached_meshes[i]);
|
||||
irr_driver->removeMeshFromCache(m_detached_cached_meshes[i]);
|
||||
}
|
||||
m_detached_cached_meshes.clear();
|
||||
|
||||
if(m_mini_map)
|
||||
if (m_old_rtt_mini_map)
|
||||
{
|
||||
assert(m_mini_map->getReferenceCount()==1);
|
||||
irr_driver->removeTexture(m_mini_map);
|
||||
m_mini_map = NULL;
|
||||
assert(m_old_rtt_mini_map->getReferenceCount() == 1);
|
||||
irr_driver->removeTexture(m_old_rtt_mini_map);
|
||||
m_old_rtt_mini_map = NULL;
|
||||
}
|
||||
if (m_new_rtt_mini_map)
|
||||
{
|
||||
delete m_new_rtt_mini_map;
|
||||
m_new_rtt_mini_map = NULL;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<m_sky_textures.size(); i++)
|
||||
@ -639,11 +645,18 @@ void Track::loadQuadGraph(unsigned int mode_id, const bool reverse)
|
||||
m_mini_map_size = World::getWorld()->getRaceGUI()->getMiniMapSize();
|
||||
core::dimension2du size = m_mini_map_size
|
||||
.getOptimalSize(!nonpower,!nonsquare);
|
||||
m_mini_map = QuadGraph::get()->makeMiniMap(size, "minimap::"+m_ident);
|
||||
if (m_mini_map)
|
||||
|
||||
QuadGraph::get()->makeMiniMap(size, "minimap::" + m_ident, video::SColor(127, 255, 255, 255),
|
||||
&m_old_rtt_mini_map, &m_new_rtt_mini_map);
|
||||
if (m_old_rtt_mini_map)
|
||||
{
|
||||
m_minimap_x_scale = float(m_mini_map_size.Width) / float(m_mini_map->getSize().Width);
|
||||
m_minimap_y_scale = float(m_mini_map_size.Height) / float(m_mini_map->getSize().Height);
|
||||
m_minimap_x_scale = float(m_mini_map_size.Width) / float(m_old_rtt_mini_map->getSize().Width);
|
||||
m_minimap_y_scale = float(m_mini_map_size.Height) / float(m_old_rtt_mini_map->getSize().Height);
|
||||
}
|
||||
else if (m_new_rtt_mini_map)
|
||||
{
|
||||
m_minimap_x_scale = float(m_mini_map_size.Width) / float(m_new_rtt_mini_map->getWidth());
|
||||
m_minimap_y_scale = float(m_mini_map_size.Height) / float(m_new_rtt_mini_map->getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -378,7 +378,8 @@ private:
|
||||
video::SColor m_fog_color;
|
||||
|
||||
/** The texture for the mini map, which is displayed in the race gui. */
|
||||
video::ITexture *m_mini_map;
|
||||
video::ITexture *m_old_rtt_mini_map;
|
||||
FrameBuffer *m_new_rtt_mini_map;
|
||||
core::dimension2du m_mini_map_size;
|
||||
float m_minimap_x_scale;
|
||||
float m_minimap_y_scale;
|
||||
@ -455,7 +456,8 @@ public:
|
||||
std::vector< std::vector<float> > buildHeightMap();
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the texture with the mini map for this track. */
|
||||
const video::ITexture* getMiniMap () const { return m_mini_map; }
|
||||
const video::ITexture* getOldRttMiniMap() const { return m_old_rtt_mini_map; }
|
||||
const FrameBuffer* getNewRttMiniMap() const { return m_new_rtt_mini_map; }
|
||||
// ------------------------------------------------------------------------
|
||||
const core::dimension2du& getMiniMapSize() const { return m_mini_map_size; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
inline Vec3(const btVector3& a) : btVector3(a) {}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Empty constructor. */
|
||||
inline Vec3() : btVector3() {}
|
||||
inline Vec3() : btVector3(0, 0, 0) {}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Creates a 3d vector from three scalars. */
|
||||
inline Vec3(float x, float y, float z) : btVector3(x,y,z) {}
|
||||
|
27
tools/simplify_challenges.sh
Executable file
27
tools/simplify_challenges.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script simplifies all challenges by removing any time
|
||||
# limit, position requirement, etc, and setting the number
|
||||
# of laps to 0. This is meant to quickly test the story
|
||||
# mode without having to fully play all challenges.
|
||||
|
||||
for i in data/challenges/*.challenge; do
|
||||
echo "Simplifying $i"
|
||||
cat $i | sed 's/position="[0-9]*"/position="99"/' \
|
||||
| sed 's/laps="[0-9]*"/laps="0"/' \
|
||||
| sed 's/energy="[0-9]*"/energy="0"/' \
|
||||
| sed 's/time="[0-9]*"/time="9999"/' \
|
||||
> $i.new
|
||||
mv $i.new $i
|
||||
done
|
||||
|
||||
for i in data/grandprix/*.grandprix; do
|
||||
echo "Simplyfing GP $i"
|
||||
cat $i | sed 's/laps="[0-9]*"/laps="0"/' > $i.new
|
||||
mv $i.new $i
|
||||
done
|
||||
echo
|
||||
echo "All challenges simplified."
|
||||
echo "PLEASE do not commit the changes back to our repository!"
|
||||
echo "========================================================"
|
||||
|
Loading…
Reference in New Issue
Block a user