Merge branch 'NewRTTWidget'
This commit is contained in:
commit
02c68d5b02
@ -82,5 +82,5 @@ void main()
|
||||
depth = (1 - depth);
|
||||
vec3 final = colOriginal.rgb * depth + col.rgb * (1 - depth);
|
||||
|
||||
FragColor = vec4(final, 1.);
|
||||
FragColor = vec4(final, colOriginal.a);
|
||||
}
|
||||
|
@ -1,4 +1,12 @@
|
||||
uniform vec2 PIXEL_SIZE;
|
||||
layout (std140) uniform MatrixesData
|
||||
{
|
||||
mat4 ViewMatrix;
|
||||
mat4 ProjectionMatrix;
|
||||
mat4 InverseViewMatrix;
|
||||
mat4 InverseProjectionMatrix;
|
||||
mat4 ShadowViewProjMatrixes[4];
|
||||
vec2 screen;
|
||||
};
|
||||
|
||||
in vec2 Position;
|
||||
in vec2 Texcoord;
|
||||
@ -12,6 +20,6 @@ void main() {
|
||||
// invy.y = 1.0 - invy.y;
|
||||
uv = invy.st;
|
||||
|
||||
offset[0] = invy.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, 1.0);
|
||||
offset[1] = invy.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, -1.0);
|
||||
offset[0] = invy.xyxy + screen.xyxy * vec4(-1.0, 0.0, 0.0, 1.0);
|
||||
offset[1] = invy.xyxy + screen.xyxy * vec4( 1.0, 0.0, 0.0, -1.0);
|
||||
}
|
||||
|
@ -43,6 +43,5 @@ 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));
|
||||
FragColor = vec4(perChannel.xyz, 1.);
|
||||
|
||||
FragColor = vec4(perChannel.xyz, col.a);
|
||||
}
|
||||
|
@ -262,6 +262,8 @@ void DisplaceProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
|
||||
void DisplaceProvider::update()
|
||||
{
|
||||
if (World::getWorld() == NULL) return;
|
||||
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
const float speed = World::getWorld()->getTrack()->getDisplacementSpeed();
|
||||
|
||||
|
@ -648,14 +648,15 @@ static void drawTexColoredQuad(const video::ITexture *texture, const video::SCol
|
||||
glGetError();
|
||||
}
|
||||
|
||||
void drawTexQuad(const video::ITexture *texture, float width, float height,
|
||||
static
|
||||
void drawTexQuad(GLuint texture, float width, float height,
|
||||
float center_pos_x, float center_pos_y, float tex_center_pos_x, float tex_center_pos_y,
|
||||
float tex_width, float tex_height)
|
||||
{
|
||||
glUseProgram(UIShader::TextureRectShader::Program);
|
||||
glBindVertexArray(UIShader::TextureRectShader::vao);
|
||||
|
||||
setTexture(0, static_cast<const irr::video::COpenGLTexture*>(texture)->getOpenGLTextureName(), GL_LINEAR, GL_LINEAR);
|
||||
setTexture(0, texture, GL_LINEAR, GL_LINEAR);
|
||||
UIShader::TextureRectShader::setUniforms(center_pos_x, center_pos_y, width, height, tex_center_pos_x, tex_center_pos_y, tex_width, tex_height, 0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
@ -666,7 +667,8 @@ void drawTexQuad(const video::ITexture *texture, float width, float height,
|
||||
}
|
||||
|
||||
static void
|
||||
getSize(const video::ITexture* texture, const core::rect<s32>& destRect,
|
||||
getSize(unsigned texture_width, unsigned texture_height, bool textureisRTT,
|
||||
const core::rect<s32>& destRect,
|
||||
const core::rect<s32>& sourceRect,
|
||||
float &width, float &height,
|
||||
float ¢er_pos_x, float ¢er_pos_y,
|
||||
@ -689,23 +691,20 @@ getSize(const video::ITexture* texture, const core::rect<s32>& destRect,
|
||||
height = float(destRect.LowerRightCorner.Y - destRect.UpperLeftCorner.Y);
|
||||
height /= screen_h;
|
||||
|
||||
const core::dimension2d<u32>& ss = texture->getOriginalSize();
|
||||
tex_center_pos_x = float(sourceRect.UpperLeftCorner.X + sourceRect.LowerRightCorner.X);
|
||||
tex_center_pos_x /= ss.Width * 2.f;
|
||||
tex_center_pos_x /= texture_width * 2.f;
|
||||
tex_center_pos_y = float(sourceRect.UpperLeftCorner.Y + sourceRect.LowerRightCorner.Y);
|
||||
tex_center_pos_y /= ss.Height * 2.f;
|
||||
tex_center_pos_y /= texture_height * 2.f;
|
||||
tex_width = float(sourceRect.LowerRightCorner.X - sourceRect.UpperLeftCorner.X);
|
||||
tex_width /= ss.Width * 2.f;
|
||||
tex_width /= texture_width * 2.f;
|
||||
tex_height = float(sourceRect.LowerRightCorner.Y - sourceRect.UpperLeftCorner.Y);
|
||||
tex_height /= ss.Height * 2.f;
|
||||
tex_height /= texture_height * 2.f;
|
||||
|
||||
if (texture->isRenderTarget())
|
||||
{
|
||||
if (textureisRTT)
|
||||
tex_height = -tex_height;
|
||||
}
|
||||
|
||||
const f32 invW = 1.f / static_cast<f32>(ss.Width);
|
||||
const f32 invH = 1.f / static_cast<f32>(ss.Height);
|
||||
const f32 invW = 1.f / static_cast<f32>(texture_width);
|
||||
const f32 invH = 1.f / static_cast<f32>(texture_height);
|
||||
const core::rect<f32> tcoords(
|
||||
sourceRect.UpperLeftCorner.X * invW,
|
||||
sourceRect.UpperLeftCorner.Y * invH,
|
||||
@ -730,7 +729,8 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
|
||||
tex_width, tex_height,
|
||||
tex_center_pos_x, tex_center_pos_y;
|
||||
|
||||
getSize(texture, destRect, sourceRect, width, height, center_pos_x, center_pos_y,
|
||||
getSize(texture->getOriginalSize().Width, texture->getOriginalSize().Height, texture->isRenderTarget(),
|
||||
destRect, sourceRect, width, height, center_pos_x, center_pos_y,
|
||||
tex_width, tex_height, tex_center_pos_x, tex_center_pos_y);
|
||||
|
||||
if (useAlphaChannelOfTexture)
|
||||
@ -769,6 +769,25 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
|
||||
glGetError();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
float width, height,
|
||||
center_pos_x, center_pos_y,
|
||||
tex_width, tex_height,
|
||||
tex_center_pos_x, tex_center_pos_y;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
|
||||
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
|
||||
const video::SColor* const colors, bool useAlphaChannelOfTexture)
|
||||
@ -784,7 +803,8 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
|
||||
tex_width, tex_height,
|
||||
tex_center_pos_x, tex_center_pos_y;
|
||||
|
||||
getSize(texture, destRect, sourceRect, width, height, center_pos_x, center_pos_y,
|
||||
getSize(texture->getOriginalSize().Width, texture->getOriginalSize().Height, texture->isRenderTarget(),
|
||||
destRect, sourceRect, width, height, center_pos_x, center_pos_y,
|
||||
tex_width, tex_height, tex_center_pos_x, tex_center_pos_y);
|
||||
|
||||
if (useAlphaChannelOfTexture)
|
||||
@ -810,7 +830,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
|
||||
drawTexColoredQuad(texture, colors, width, height, center_pos_x, center_pos_y,
|
||||
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
|
||||
else
|
||||
drawTexQuad(texture, width, height, center_pos_x, center_pos_y,
|
||||
drawTexQuad(static_cast<const irr::video::COpenGLTexture*>(texture)->getOpenGLTextureName(), width, height, center_pos_x, center_pos_y,
|
||||
tex_center_pos_x, tex_center_pos_y, tex_width, tex_height);
|
||||
if (clipRect)
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
@ -219,6 +219,11 @@ void saveCompressedTexture(const std::string& compressed_tex);
|
||||
void draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end, irr::video::SColor color);
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
const irr::video::SColor &color, bool useAlphaChannelOfTexture);
|
||||
|
@ -1557,6 +1557,11 @@ video::ITexture* IrrDriver::applyMask(video::ITexture* texture,
|
||||
return t;
|
||||
} // applyMask
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::setRTT(RTT* rtt)
|
||||
{
|
||||
m_rtts = rtt;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
void IrrDriver::onLoadWorld()
|
||||
{
|
||||
if (m_glsl)
|
||||
@ -1571,6 +1576,8 @@ void IrrDriver::onUnloadWorld()
|
||||
{
|
||||
delete m_rtts;
|
||||
m_rtts = NULL;
|
||||
|
||||
suppressSkyBox();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Sets the ambient light.
|
||||
|
@ -290,6 +290,11 @@ public:
|
||||
m_lwhite = v;
|
||||
}
|
||||
|
||||
struct GlowData {
|
||||
scene::ISceneNode * node;
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<VideoMode> m_modes;
|
||||
|
||||
@ -327,11 +332,6 @@ private:
|
||||
scene::CLensFlareSceneNode *m_lensflare;
|
||||
scene::ICameraSceneNode *m_suncam;
|
||||
|
||||
struct GlowData {
|
||||
scene::ISceneNode * node;
|
||||
float r, g, b;
|
||||
};
|
||||
|
||||
std::vector<GlowData> m_glowing;
|
||||
|
||||
std::vector<LightNode *> m_lights;
|
||||
@ -361,12 +361,9 @@ private:
|
||||
void renderTransparent();
|
||||
void renderParticles();
|
||||
void computeSunVisibility();
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadows);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
void renderShadows();
|
||||
void renderGlow(std::vector<GlowData>& glows);
|
||||
void renderSSAO();
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void renderLights(unsigned pointlightCount);
|
||||
void renderDisplacement();
|
||||
void doScreenShot();
|
||||
@ -525,7 +522,10 @@ public:
|
||||
{
|
||||
return m_texture_error_message;
|
||||
} // getTextureErrorMessage
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
void setRTT(RTT* rtt);
|
||||
// ------------------------------------------------------------------------
|
||||
RTT* getRTT() { return m_rtts; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns a list of all video modes supports by the graphics card. */
|
||||
const std::vector<VideoMode>& getVideoModes() const { return m_modes; }
|
||||
@ -696,6 +696,10 @@ public:
|
||||
void onLoadWorld();
|
||||
void onUnloadWorld();
|
||||
|
||||
void renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadows, bool forceRTT);
|
||||
unsigned UpdateLightsInfo(scene::ICameraSceneNode * const camnode, float dt);
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode, size_t width, size_t height);
|
||||
|
||||
// --------------------- RTT --------------------
|
||||
/**
|
||||
* Class that provides RTT (currently, only when no other 3D rendering
|
||||
|
@ -207,7 +207,10 @@ void PostProcessing::update(float dt)
|
||||
static
|
||||
void renderBloom(GLuint in)
|
||||
{
|
||||
const float threshold = World::getWorld()->getTrack()->getBloomThreshold();
|
||||
float threshold = 1.0f;
|
||||
if (World::getWorld() != NULL)
|
||||
threshold = World::getWorld()->getTrack()->getBloomThreshold();
|
||||
|
||||
glUseProgram(FullScreenShader::BloomShader::Program);
|
||||
glBindVertexArray(FullScreenShader::BloomShader::vao);
|
||||
|
||||
@ -693,7 +696,10 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Godrays", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_GODRAYS));
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
bool hasgodrays = false;
|
||||
if (World::getWorld() != NULL)
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
|
||||
if (UserConfigParams::m_light_shaft && m_sunpixels > 30 && hasgodrays)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@ -763,6 +769,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
if (UserConfigParams::m_bloom)
|
||||
{
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
|
||||
|
||||
FrameBuffer::Blit(*in_fbo, irr_driver->getFBO(FBO_BLOOM_1024), GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
@ -794,6 +801,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode)
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
} // end if bloom
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
@ -810,7 +818,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) // motion blur
|
||||
if (UserConfigParams::m_motionblur && m_any_boost && World::getWorld() != NULL) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
|
@ -143,7 +143,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
|
||||
unsigned plc = UpdateLightsInfo(camnode, dt);
|
||||
computeCameraMatrix(camnode, viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
||||
renderScene(camnode, plc, glows, dt, track->hasShadows());
|
||||
renderScene(camnode, plc, glows, dt, track->hasShadows(), false);
|
||||
|
||||
// Debug physic
|
||||
// Note that drawAll must be called before rendering
|
||||
@ -259,7 +259,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
getPostProcessing()->update(dt);
|
||||
}
|
||||
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow)
|
||||
void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned pointlightcount, std::vector<GlowData>& glows, float dt, bool hasShadow, bool forceRTT)
|
||||
{
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||
|
||||
@ -300,7 +300,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
}
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0x00, 0x00, 0xFF);
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
if (!UserConfigParams::m_dynamic_lights && ! forceRTT)
|
||||
{
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
@ -310,7 +310,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
renderSolidSecondPass();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
if (UserConfigParams::m_dynamic_lights && World::getWorld()->isFogEnabled())
|
||||
if (UserConfigParams::m_dynamic_lights && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Fog", 0xFF, 0x00, 0x00);
|
||||
m_post_processing->renderFog();
|
||||
@ -372,7 +373,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
renderParticles();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
if (!UserConfigParams::m_dynamic_lights && !forceRTT)
|
||||
return;
|
||||
|
||||
// Render displacement
|
||||
@ -463,8 +464,15 @@ void IrrDriver::renderFixed(float dt)
|
||||
void IrrDriver::computeSunVisibility()
|
||||
{
|
||||
// Is the lens flare enabled & visible? Check last frame's query.
|
||||
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
bool hasflare = false;
|
||||
bool hasgodrays = false;
|
||||
|
||||
if (World::getWorld() != NULL)
|
||||
{
|
||||
hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
}
|
||||
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
|
||||
{
|
||||
@ -563,7 +571,10 @@ void IrrDriver::renderSolidFirstPass()
|
||||
|
||||
void IrrDriver::renderSolidSecondPass()
|
||||
{
|
||||
SColor clearColor = World::getWorld()->getClearColor();
|
||||
SColor clearColor(0., 150, 150, 150);
|
||||
if (World::getWorld() != NULL)
|
||||
clearColor = World::getWorld()->getClearColor();
|
||||
|
||||
glClearColor(clearColor.getRed() / 255.f, clearColor.getGreen() / 255.f,
|
||||
clearColor.getBlue() / 255.f, clearColor.getAlpha() / 255.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
@ -662,9 +673,6 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
irr_driver->genProjViewMatrix();
|
||||
|
||||
const Vec3 *vmin, *vmax;
|
||||
World::getWorld()->getTrack()->getAABB(&vmin, &vmax);
|
||||
|
||||
const float oldfar = camnode->getFarValue();
|
||||
const float oldnear = camnode->getNearValue();
|
||||
float FarValues[] =
|
||||
@ -682,81 +690,89 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
50.,
|
||||
};
|
||||
|
||||
const core::matrix4 &SunCamViewMatrix = m_suncam->getViewMatrix();
|
||||
sun_ortho_matrix.clear();
|
||||
|
||||
// Build the 3 ortho projection (for the 3 shadow resolution levels)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
camnode->setFarValue(FarValues[i]);
|
||||
camnode->setNearValue(NearValues[i]);
|
||||
camnode->render();
|
||||
const core::aabbox3df smallcambox = camnode->
|
||||
getViewFrustum()->getBoundingBox();
|
||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||
core::vector3df(0, 30, 0));
|
||||
|
||||
|
||||
// Set up a nice ortho projection that contains our camera frustum
|
||||
core::aabbox3df box = smallcambox;
|
||||
box = box.intersect(trackbox);
|
||||
|
||||
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
SunCamViewMatrix.transformBoxEx(box);
|
||||
|
||||
core::vector3df extent = trackbox.getExtent();
|
||||
const float w = fabsf(extent.X);
|
||||
const float h = fabsf(extent.Y);
|
||||
float z = box.MaxEdge.Z;
|
||||
|
||||
// Snap to texels
|
||||
const float units_per_w = w / 1024;
|
||||
const float units_per_h = h / 1024;
|
||||
|
||||
float left = box.MinEdge.X;
|
||||
float right = box.MaxEdge.X;
|
||||
float up = box.MaxEdge.Y;
|
||||
float down = box.MinEdge.Y;
|
||||
|
||||
core::matrix4 tmp_matrix;
|
||||
|
||||
// Prevent Matrix without extend
|
||||
if (left == right || up == down)
|
||||
{
|
||||
Log::error("Shadows", "Shadows Near/Far plane have a 0 area");
|
||||
sun_ortho_matrix.push_back(tmp_matrix);
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(left, right,
|
||||
up, down,
|
||||
30, z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
core::vector3df translation(8 * floor(campos.X / 8), 8 * floor(campos.Y / 8), 8 * floor(campos.Z / 8));
|
||||
rh_matrix.setTranslation(translation);
|
||||
|
||||
assert(sun_ortho_matrix.size() == 4);
|
||||
camnode->setNearValue(oldnear);
|
||||
camnode->setFarValue(oldfar);
|
||||
|
||||
float *tmp = new float[18 * 8];
|
||||
|
||||
memcpy(tmp, irr_driver->getViewMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[16], irr_driver->getProjMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[32], irr_driver->getInvViewMatrix().pointer(), 16 * sizeof(float));
|
||||
memcpy(&tmp[48], irr_driver->getInvProjMatrix().pointer(), 16 * sizeof(float));
|
||||
size_t size = irr_driver->getShadowViewProj().size();
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
memcpy(&tmp[16 * i + 64], irr_driver->getShadowViewProj()[i].pointer(), 16 * sizeof(float));
|
||||
|
||||
const core::matrix4 &SunCamViewMatrix = m_suncam->getViewMatrix();
|
||||
sun_ortho_matrix.clear();
|
||||
|
||||
if (World::getWorld() && World::getWorld()->getTrack())
|
||||
{
|
||||
const Vec3 *vmin, *vmax;
|
||||
World::getWorld()->getTrack()->getAABB(&vmin, &vmax);
|
||||
|
||||
// Build the 3 ortho projection (for the 3 shadow resolution levels)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
camnode->setFarValue(FarValues[i]);
|
||||
camnode->setNearValue(NearValues[i]);
|
||||
camnode->render();
|
||||
const core::aabbox3df smallcambox = camnode->
|
||||
getViewFrustum()->getBoundingBox();
|
||||
core::aabbox3df trackbox(vmin->toIrrVector(), vmax->toIrrVector() -
|
||||
core::vector3df(0, 30, 0));
|
||||
|
||||
// Set up a nice ortho projection that contains our camera frustum
|
||||
core::aabbox3df box = smallcambox;
|
||||
box = box.intersect(trackbox);
|
||||
|
||||
|
||||
SunCamViewMatrix.transformBoxEx(trackbox);
|
||||
SunCamViewMatrix.transformBoxEx(box);
|
||||
|
||||
core::vector3df extent = box.getExtent();
|
||||
const float w = fabsf(extent.X);
|
||||
const float h = fabsf(extent.Y);
|
||||
float z = box.MaxEdge.Z;
|
||||
|
||||
// Snap to texels
|
||||
const float units_per_w = w / 1024;
|
||||
const float units_per_h = h / 1024;
|
||||
|
||||
float left = box.MinEdge.X;
|
||||
float right = box.MaxEdge.X;
|
||||
float up = box.MaxEdge.Y;
|
||||
float down = box.MinEdge.Y;
|
||||
|
||||
core::matrix4 tmp_matrix;
|
||||
|
||||
// Prevent Matrix without extend
|
||||
if (left == right || up == down)
|
||||
{
|
||||
Log::error("Shadows", "Shadows Near/Far plane have a 0 area");
|
||||
sun_ortho_matrix.push_back(tmp_matrix);
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp_matrix.buildProjectionMatrixOrthoLH(left, right,
|
||||
up, down,
|
||||
30, z);
|
||||
m_suncam->setProjectionMatrix(tmp_matrix, true);
|
||||
m_suncam->render();
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
core::vector3df translation(8 * floor(campos.X / 8), 8 * floor(campos.Y / 8), 8 * floor(campos.Z / 8));
|
||||
rh_matrix.setTranslation(translation);
|
||||
|
||||
|
||||
assert(sun_ortho_matrix.size() == 4);
|
||||
camnode->setNearValue(oldnear);
|
||||
camnode->setFarValue(oldfar);
|
||||
|
||||
size_t size = irr_driver->getShadowViewProj().size();
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
memcpy(&tmp[16 * i + 64], irr_driver->getShadowViewProj()[i].pointer(), 16 * sizeof(float));
|
||||
}
|
||||
|
||||
tmp[128] = float(width);
|
||||
tmp[129] = float(height);
|
||||
|
||||
@ -990,22 +1006,21 @@ void IrrDriver::renderLights(unsigned pointlightcount)
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return;
|
||||
|
||||
m_rtts->getFBO(FBO_TMP1_WITH_DS).Bind();
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
m_rtts->getFBO(FBO_TMP1_WITH_DS).Bind();
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
if (SkyboxCubeMap)
|
||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind();
|
||||
}
|
||||
|
||||
if (SkyboxCubeMap && UserConfigParams::m_gi)
|
||||
m_rtts->getFBO(FBO_COMBINED_TMP1_TMP2).Bind();
|
||||
if (SkyboxCubeMap)
|
||||
m_post_processing->renderDiffuseEnvMap(blueSHCoeff, greenSHCoeff, redSHCoeff);
|
||||
|
||||
if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && SkyboxCubeMap && UserConfigParams::m_gi)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
// Render sunlight if and only if track supports shadow
|
||||
if (World::getWorld()->getTrack()->hasShadows())
|
||||
if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows())
|
||||
{
|
||||
if (UserConfigParams::m_shadows)
|
||||
if (World::getWorld() && UserConfigParams::m_shadows)
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
|
@ -57,6 +57,7 @@ static GLuint generateFBO(GLuint ColorAttachement, GLuint DepthAttachement)
|
||||
RTT::RTT(size_t width, size_t height)
|
||||
{
|
||||
m_shadow_FBO = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
m_RSM = NULL;
|
||||
m_RH_FBO = NULL;
|
||||
using namespace video;
|
||||
@ -93,7 +94,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
RenderTargetTextures[RTT_LINEAR_DEPTH] = generateRTT(res, GL_R32F, GL_RED, GL_FLOAT, linear_depth_mip_levels);
|
||||
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB8_ALPHA8, GL_BGR, GL_UNSIGNED_BYTE);
|
||||
RenderTargetTextures[RTT_SSAO] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);
|
||||
RenderTargetTextures[RTT_DISPLACE] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
|
||||
|
||||
|
@ -230,7 +230,7 @@ void STKAnimatedMesh::render()
|
||||
for_in(mesh, TransparentMesh[TM_BUBBLE])
|
||||
drawBubble(*mesh, ModelViewProjectionMatrix);
|
||||
|
||||
if (World::getWorld()->isFogEnabled())
|
||||
if (World::getWorld() != NULL && World::getWorld()->isFogEnabled())
|
||||
{
|
||||
if (!TransparentMesh[TM_DEFAULT].empty() || !TransparentMesh[TM_ADDITIVE].empty())
|
||||
glUseProgram(MeshShader::TransparentFogShader::Program);
|
||||
|
@ -740,7 +740,7 @@ void initvaostate(GLMesh &mesh, TransparentMaterial TranspMat)
|
||||
break;
|
||||
case TM_DEFAULT:
|
||||
case TM_ADDITIVE:
|
||||
if (World::getWorld()->isFogEnabled())
|
||||
if (World::getWorld() != NULL && World::getWorld()->isFogEnabled())
|
||||
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
|
||||
MeshShader::TransparentFogShader::attrib_position, MeshShader::TransparentFogShader::attrib_texcoord, -1, -1, -1, -1, MeshShader::TransparentFogShader::attrib_color, mesh.Stride);
|
||||
else
|
||||
|
@ -1915,6 +1915,16 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect,
|
||||
if (!widget->m_event_handler->m_deactivated)
|
||||
drawSpinnerChild(rect, widget, pressed, focused);
|
||||
}
|
||||
else if (type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
ModelViewWidget* mvw = dynamic_cast<ModelViewWidget*>(widget);
|
||||
FrameBuffer* fb = mvw->getFrameBuffer();
|
||||
if (fb != NULL && fb->getRTT().size() > 0)
|
||||
{
|
||||
draw2DImageFromRTT(fb->getRTT()[0], 512, 512,
|
||||
rect, core::rect<s32>(0, 0, 512, 512), NULL, true);
|
||||
}
|
||||
}
|
||||
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
drawIconButton(rect, widget, pressed, focused);
|
||||
|
@ -15,9 +15,19 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/model_view_widget.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/post_processing.hpp"
|
||||
#include "graphics/rtts.hpp"
|
||||
#include <algorithm>
|
||||
#include <IAnimatedMesh.h>
|
||||
#include <IAnimatedMeshSceneNode.h>
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <ILightSceneNode.h>
|
||||
#include <ISceneManager.h>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
@ -25,7 +35,10 @@ using namespace irr::gui;
|
||||
ModelViewWidget::ModelViewWidget() :
|
||||
IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, false, false)
|
||||
{
|
||||
//FIXME: find nicer way than overriding what IconButtonWidget's constructor already set...
|
||||
m_frame_buffer = NULL;
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
m_type = WTYPE_MODEL_VIEW;
|
||||
m_rtt_provider = NULL;
|
||||
m_rotation_mode = ROTATE_OFF;
|
||||
@ -70,10 +83,17 @@ void ModelViewWidget::clearModels()
|
||||
m_model_scale.clear();
|
||||
m_model_frames.clear();
|
||||
|
||||
delete m_rtt_provider;
|
||||
m_rtt_provider = NULL;
|
||||
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
|
||||
if (m_light != NULL) m_light->remove();
|
||||
if (m_camera != NULL) m_camera->remove();
|
||||
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location,
|
||||
const Vec3& scale, const int frame)
|
||||
{
|
||||
@ -83,20 +103,8 @@ void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location,
|
||||
m_model_location.push_back(location);
|
||||
m_model_scale.push_back(scale);
|
||||
m_model_frames.push_back(frame);
|
||||
|
||||
/*
|
||||
((IGUIMeshViewer*)m_element)->setMesh( mesh );
|
||||
|
||||
video::SMaterial mat = mesh->getMeshBuffer(0)->getMaterial(); //mesh_view->getMaterial();
|
||||
mat.setFlag(EMF_LIGHTING , false);
|
||||
//mat.setFlag(EMF_GOURAUD_SHADING, false);
|
||||
//mat.setFlag(EMF_NORMALIZE_NORMALS, true);
|
||||
((IGUIMeshViewer*)m_element)->setMaterial(mat);
|
||||
*/
|
||||
|
||||
delete m_rtt_provider;
|
||||
m_rtt_provider = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void ModelViewWidget::update(float delta)
|
||||
{
|
||||
@ -146,27 +154,144 @@ void ModelViewWidget::update(float delta)
|
||||
if (fabsf(angle - m_rotation_target) < 2.0f) m_rotation_mode = ROTATE_OFF;
|
||||
}
|
||||
|
||||
if (!irr_driver->isGLSL())
|
||||
return;
|
||||
|
||||
if (m_rtt_provider == NULL)
|
||||
{
|
||||
std::string name = "model view ";
|
||||
name += m_properties[PROP_ID].c_str();
|
||||
m_rtt_provider = new IrrDriver::RTTProvider(core::dimension2d< u32 >(512, 512), name, false);
|
||||
m_rtt_provider->setupRTTScene(m_models, m_model_location, m_model_scale, m_model_frames);
|
||||
|
||||
m_rtt_provider = new RTT(512, 512);
|
||||
}
|
||||
|
||||
m_texture = m_rtt_provider->renderToTexture(angle);
|
||||
if (m_texture != NULL)
|
||||
if (m_rtt_main_node == NULL)
|
||||
{
|
||||
setImage(m_texture);
|
||||
setupRTTScene(m_models, m_model_location, m_model_scale, m_model_frames);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
AlignedArray<Vec3>& mesh_location,
|
||||
AlignedArray<Vec3>& mesh_scale,
|
||||
const std::vector<int>& model_frames)
|
||||
{
|
||||
irr_driver->suppressSkyBox();
|
||||
|
||||
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
|
||||
if (m_light != NULL) m_light->remove();
|
||||
if (m_camera != NULL) m_camera->remove();
|
||||
|
||||
m_rtt_main_node = NULL;
|
||||
m_camera = NULL;
|
||||
m_light = NULL;
|
||||
|
||||
irr_driver->clearLights();
|
||||
|
||||
if (model_frames[0] == -1)
|
||||
{
|
||||
scene::ISceneNode* node = irr_driver->addMesh(mesh.get(0), NULL);
|
||||
node->setPosition(mesh_location[0].toIrrVector());
|
||||
node->setScale(mesh_scale[0].toIrrVector());
|
||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
|
||||
m_rtt_main_node = node;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rtt_unsupported = true;
|
||||
}
|
||||
//getIrrlichtElement<IGUIButton>()->setImage(m_texture);
|
||||
//getIrrlichtElement<IGUIButton>()->setPressedImage(m_texture);
|
||||
}
|
||||
scene::IAnimatedMeshSceneNode* node =
|
||||
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(0), NULL);
|
||||
node->setPosition(mesh_location[0].toIrrVector());
|
||||
node->setFrameLoop(model_frames[0], model_frames[0]);
|
||||
node->setAnimationSpeed(0);
|
||||
node->setScale(mesh_scale[0].toIrrVector());
|
||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
|
||||
|
||||
m_rtt_main_node = node;
|
||||
}
|
||||
|
||||
assert(m_rtt_main_node != NULL);
|
||||
assert(mesh.size() == mesh_location.size());
|
||||
assert(mesh.size() == model_frames.size());
|
||||
|
||||
const int mesh_amount = mesh.size();
|
||||
for (int n = 1; n<mesh_amount; n++)
|
||||
{
|
||||
if (model_frames[n] == -1)
|
||||
{
|
||||
scene::ISceneNode* node =
|
||||
irr_driver->addMesh(mesh.get(n), m_rtt_main_node);
|
||||
node->setPosition(mesh_location[n].toIrrVector());
|
||||
node->updateAbsolutePosition();
|
||||
node->setScale(mesh_scale[n].toIrrVector());
|
||||
}
|
||||
else
|
||||
{
|
||||
scene::IAnimatedMeshSceneNode* node =
|
||||
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(n),
|
||||
m_rtt_main_node);
|
||||
node->setPosition(mesh_location[n].toIrrVector());
|
||||
node->setFrameLoop(model_frames[n], model_frames[n]);
|
||||
node->setAnimationSpeed(0);
|
||||
node->updateAbsolutePosition();
|
||||
node->setScale(mesh_scale[n].toIrrVector());
|
||||
//std::cout << "(((( set frame " << model_frames[n] << " ))))\n";
|
||||
}
|
||||
}
|
||||
|
||||
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 35, 35, 35));
|
||||
|
||||
const core::vector3df &spot_pos = core::vector3df(0, 30, 40);
|
||||
m_light = irr_driver->addLight(spot_pos, 0.3f /* energy */, 10 /* distance */, 1.0f /* r */, 1.0f /* g */, 1.0f /* g*/, true, NULL);
|
||||
|
||||
m_rtt_main_node->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);
|
||||
m_rtt_main_node->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
|
||||
const int materials = m_rtt_main_node->getMaterialCount();
|
||||
for (int n = 0; n<materials; n++)
|
||||
{
|
||||
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_LIGHTING, true);
|
||||
|
||||
// set size of specular highlights
|
||||
m_rtt_main_node->getMaterial(n).Shininess = 100.0f;
|
||||
m_rtt_main_node->getMaterial(n).SpecularColor.set(255, 50, 50, 50);
|
||||
m_rtt_main_node->getMaterial(n).DiffuseColor.set(255, 150, 150, 150);
|
||||
|
||||
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_GOURAUD_SHADING,
|
||||
true);
|
||||
}
|
||||
|
||||
m_camera = irr_driver->getSceneManager()->addCameraSceneNode();
|
||||
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->setTarget(core::vector3df(0, 10, 0.0f));
|
||||
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
|
||||
m_camera->updateAbsolutePosition();
|
||||
}
|
||||
|
||||
void ModelViewWidget::setRotateOff()
|
||||
{
|
||||
|
@ -52,12 +52,20 @@ namespace GUIEngine
|
||||
|
||||
video::ITexture* m_texture;
|
||||
|
||||
IrrDriver::RTTProvider* m_rtt_provider;
|
||||
RTT* m_rtt_provider;
|
||||
|
||||
float angle;
|
||||
|
||||
bool m_rtt_unsupported;
|
||||
|
||||
scene::ISceneNode *m_rtt_main_node;
|
||||
|
||||
scene::ICameraSceneNode *m_camera;
|
||||
|
||||
scene::ISceneNode *m_light;
|
||||
|
||||
FrameBuffer *m_frame_buffer;
|
||||
|
||||
public:
|
||||
|
||||
LEAK_CHECK()
|
||||
@ -89,6 +97,13 @@ namespace GUIEngine
|
||||
bool isRotating();
|
||||
|
||||
void clearRttProvider();
|
||||
|
||||
void setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
|
||||
AlignedArray<Vec3>& mesh_location,
|
||||
AlignedArray<Vec3>& mesh_scale,
|
||||
const std::vector<int>& model_frames);
|
||||
|
||||
FrameBuffer* getFrameBuffer() { return m_frame_buffer; }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -320,9 +320,16 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
||||
m_kartInternalName = props->getIdent();
|
||||
|
||||
const KartModel &kart_model = props->getMasterKartModel();
|
||||
|
||||
float scale = 35.0f;
|
||||
if (kart_model.getLength() > 1.45f)
|
||||
{
|
||||
// if kart is too long, size it down a bit so that it fits
|
||||
scale = 30.0f;
|
||||
}
|
||||
|
||||
m_model_view->addModel( kart_model.getModel(), Vec3(0,0,0),
|
||||
Vec3(35.0f, 35.0f, 35.0f),
|
||||
Vec3(scale, scale, scale),
|
||||
kart_model.getBaseFrame() );
|
||||
m_model_view->addModel( kart_model.getWheelModel(0),
|
||||
kart_model.getWheelGraphicsPosition(0) );
|
||||
@ -1461,6 +1468,7 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
||||
// Random kart
|
||||
scene::IMesh* model =
|
||||
ItemManager::getItemModel(Item::ITEM_BONUS_BOX);
|
||||
|
||||
w3->clearModels();
|
||||
w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f),
|
||||
Vec3(35.0f, 35.0f, 35.0f) );
|
||||
@ -1497,9 +1505,16 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
||||
{
|
||||
const KartModel &kart_model = kp->getMasterKartModel();
|
||||
|
||||
float scale = 35.0f;
|
||||
if (kart_model.getLength() > 1.45f)
|
||||
{
|
||||
// if kart is too long, size it down a bit so that it fits
|
||||
scale = 30.0f;
|
||||
}
|
||||
|
||||
w3->clearModels();
|
||||
w3->addModel( kart_model.getModel(), Vec3(0,0,0),
|
||||
Vec3(35.0f, 35.0f, 35.0f),
|
||||
Vec3(scale, scale, scale),
|
||||
kart_model.getBaseFrame() );
|
||||
w3->addModel( kart_model.getWheelModel(0),
|
||||
kart_model.getWheelGraphicsPosition(0) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user