Port feature unlocked to use SP
This commit is contained in:
parent
60b173559a
commit
294f0d79d1
@ -414,7 +414,8 @@ bool CentralVideoSettings::isARBTextureViewUsable() const
|
||||
|
||||
bool CentralVideoSettings::isARBBindlessTextureUsable() const
|
||||
{
|
||||
return hasBindlessTexture && hasNVGPUShader5;
|
||||
return false;
|
||||
//return hasBindlessTexture && hasNVGPUShader5;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isARBShaderAtomicCountersUsable() const
|
||||
@ -566,8 +567,9 @@ bool CentralVideoSettings::supportsThreadedTextureLoading() const
|
||||
|
||||
bool CentralVideoSettings::useArrayTextures() const
|
||||
{
|
||||
return (UserConfigParams::m_high_definition_textures & 0x01) == 0 &&
|
||||
UserConfigParams::m_max_texture_size <= 256;
|
||||
return false;
|
||||
//return (UserConfigParams::m_high_definition_textures & 0x01) == 0 &&
|
||||
// UserConfigParams::m_max_texture_size <= 256;
|
||||
}
|
||||
|
||||
#endif // !SERVER_ONLY
|
||||
|
@ -515,4 +515,17 @@ void SPMeshBuffer::enableTextureMatrix(unsigned mat_id)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
} // enableTextureMatrix
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void SPMeshBuffer::reloadTextureCompare()
|
||||
{
|
||||
assert(!m_textures.empty());
|
||||
m_tex_cmp.clear();
|
||||
for (unsigned i = 0; i < m_stk_material.size(); i++)
|
||||
{
|
||||
const std::string name =
|
||||
m_textures[i][0]->getPath() + m_textures[i][1]->getPath();
|
||||
m_tex_cmp[name] = i;
|
||||
}
|
||||
} // reloadTextureCompare
|
||||
|
||||
}
|
||||
|
@ -190,8 +190,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
void enableTextureMatrix(unsigned mat_id);
|
||||
// ------------------------------------------------------------------------
|
||||
std::array<std::shared_ptr<SPTexture>, 6>
|
||||
getSPTextures(unsigned first_index = 0) const
|
||||
std::array<std::shared_ptr<SPTexture>, 6>&
|
||||
getSPTextures(unsigned first_index = 0)
|
||||
{
|
||||
assert(m_stk_material.size() == m_textures.size());
|
||||
for (unsigned i = 0; i < m_stk_material.size(); i++)
|
||||
@ -204,7 +204,7 @@ public:
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
return std::array<std::shared_ptr<SPTexture>, 6> ();
|
||||
return m_textures[0];
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
std::array<std::shared_ptr<SPTexture>, 6>
|
||||
@ -282,6 +282,8 @@ public:
|
||||
m_stk_material[0] = std::make_tuple(0u, getIndexCount(), m);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
void reloadTextureCompare();
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const video::SMaterial& getMaterial() const
|
||||
{
|
||||
static video::SMaterial unused;
|
||||
|
@ -24,8 +24,13 @@
|
||||
#include "challenges/challenge_data.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/render_info.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "graphics/sp/sp_mesh.hpp"
|
||||
#include "graphics/sp/sp_mesh_buffer.hpp"
|
||||
#include "graphics/sp/sp_mesh_node.hpp"
|
||||
#include "graphics/sp/sp_texture_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
@ -95,7 +100,17 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(irr::video::ITexture* pict
|
||||
irr::core::stringw msg)
|
||||
{
|
||||
m_unlocked_kart = NULL;
|
||||
m_pictures.push_back(pict);
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_sp_pictures.push_back(SP::SPTextureManager::get()
|
||||
->getTexture(pict->getName().getPtr(), NULL, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pictures.push_back(pict);
|
||||
}
|
||||
#endif
|
||||
m_w = w;
|
||||
m_h = h;
|
||||
m_unlock_message = msg;
|
||||
@ -110,6 +125,18 @@ FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::vector<irr::video::IT
|
||||
irr::core::stringw msg)
|
||||
{
|
||||
m_unlocked_kart = NULL;
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
for (auto* pict : picts)
|
||||
{
|
||||
m_sp_pictures.push_back(SP::SPTextureManager::get()
|
||||
->getTexture(pict->getName().getPtr(), NULL, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pictures = picts;
|
||||
}
|
||||
m_pictures = picts;
|
||||
m_w = w;
|
||||
m_h = h;
|
||||
@ -158,8 +185,14 @@ void FeatureUnlockedCutScene::onCutsceneEnd()
|
||||
irr_driver->removeNode(m_avoid_irrlicht_bug);
|
||||
m_avoid_irrlicht_bug = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
m_unlocked_stuff.clearAndDeleteAll();
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
SP::SPTextureManager::get()->removeUnusedTextures();
|
||||
}
|
||||
#endif
|
||||
m_all_kart_models.clearAndDeleteAll();
|
||||
|
||||
// update point count and the list of locked/unlocked stuff
|
||||
@ -318,6 +351,36 @@ void FeatureUnlockedCutScene::init()
|
||||
scene::IMesh* mesh =
|
||||
irr_driver->createTexturedQuadMesh(&m, 0, 0);
|
||||
m_avoid_irrlicht_bug = irr_driver->addMesh(mesh);
|
||||
#endif
|
||||
}
|
||||
else if (!m_unlocked_stuff[n].m_sp_pictures.empty())
|
||||
{
|
||||
scene::IMesh* mesh = irr_driver->createTexturedQuadMesh(NULL,
|
||||
m_unlocked_stuff[n].m_w, m_unlocked_stuff[n].m_h);
|
||||
m_unlocked_stuff[n].m_root_gift_node = irr_driver->getSceneManager()->addEmptySceneNode();
|
||||
SP::SPMesh* spm = SP::convertEVTStandard(mesh);
|
||||
m_unlocked_stuff[n].m_side_1 = irr_driver->addMesh(spm,
|
||||
"unlocked_picture", m_unlocked_stuff[n].m_root_gift_node);
|
||||
spm->getSPMeshBuffer(0)->uploadGLMesh();
|
||||
spm->getSPMeshBuffer(0)->getSPTextures()[0] =
|
||||
m_unlocked_stuff[n].m_sp_pictures[0];
|
||||
spm->getSPMeshBuffer(0)->reloadTextureCompare();
|
||||
spm->drop();
|
||||
|
||||
mesh = irr_driver->createTexturedQuadMesh(NULL,
|
||||
m_unlocked_stuff[n].m_w, m_unlocked_stuff[n].m_h);
|
||||
spm = SP::convertEVTStandard(mesh);
|
||||
m_unlocked_stuff[n].m_side_2 = irr_driver->addMesh(spm,
|
||||
"unlocked_picture", m_unlocked_stuff[n].m_root_gift_node);
|
||||
m_unlocked_stuff[n].m_side_2->setRotation
|
||||
(core::vector3df(0.0f, 180.0f, 0.0f));
|
||||
spm->getSPMeshBuffer(0)->uploadGLMesh();
|
||||
spm->getSPMeshBuffer(0)->getSPTextures()[0] =
|
||||
m_unlocked_stuff[n].m_sp_pictures[0];
|
||||
spm->getSPMeshBuffer(0)->reloadTextureCompare();
|
||||
spm->drop();
|
||||
#ifdef DEBUG
|
||||
m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture");
|
||||
#endif
|
||||
}
|
||||
else if (!m_unlocked_stuff[n].m_pictures.empty())
|
||||
@ -445,34 +508,61 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
|
||||
if (textureID != previousTextureID)
|
||||
{
|
||||
/* scene::IMesh* mesh = m_unlocked_stuff[n].m_side_1->getMesh();
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
SP::SPMesh* mesh =
|
||||
static_cast<SP::SPMeshNode*>(m_unlocked_stuff[n].m_side_1)->getSPM();
|
||||
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
SP::SPMeshBuffer* mb = mesh->getSPMeshBuffer(0);
|
||||
mb->getSPTextures()[0] =
|
||||
m_unlocked_stuff[n].m_sp_pictures[textureID];
|
||||
mb->reloadTextureCompare();
|
||||
|
||||
scene::IMeshBuffer* mb = mesh->getMeshBuffer(0);
|
||||
mesh =
|
||||
static_cast<SP::SPMeshNode*>(m_unlocked_stuff[n].m_side_2)->getSPM();
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
mb = mesh->getSPMeshBuffer(0);
|
||||
mb->getSPTextures()[0] =
|
||||
m_unlocked_stuff[n].m_sp_pictures[textureID];
|
||||
mb->reloadTextureCompare();
|
||||
|
||||
SMaterial& m = mb->getMaterial();
|
||||
m.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
}
|
||||
else
|
||||
{
|
||||
scene::IMesh* mesh =
|
||||
static_cast<scene::IMeshSceneNode*>(m_unlocked_stuff[n].m_side_1)->getMesh();
|
||||
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
m_unlocked_stuff[n].m_side_1->setMesh(mesh);
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
scene::IMeshBuffer* mb = mesh->getMeshBuffer(0);
|
||||
|
||||
SMaterial& m = mb->getMaterial();
|
||||
m.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
|
||||
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
static_cast<scene::IMeshSceneNode*>(m_unlocked_stuff[n].m_side_1)->setMesh(mesh);
|
||||
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
|
||||
|
||||
mesh = m_unlocked_stuff[n].m_side_2->getMesh();
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
mb = mesh->getMeshBuffer(0);
|
||||
mesh = static_cast<scene::IMeshSceneNode*>(m_unlocked_stuff[n].m_side_2)->getMesh();
|
||||
assert(mesh->getMeshBufferCount() == 1);
|
||||
mb = mesh->getMeshBuffer(0);
|
||||
|
||||
SMaterial& m2 = mb->getMaterial();
|
||||
m2.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
|
||||
SMaterial& m2 = mb->getMaterial();
|
||||
m2.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]);
|
||||
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
m_unlocked_stuff[n].m_side_2->setMesh(mesh);
|
||||
// FIXME: this mesh is already associated with this node. I'm calling this
|
||||
// to force irrLicht to refresh the display, now that Material has changed.
|
||||
static_cast<scene::IMeshSceneNode*>(m_unlocked_stuff[n].m_side_2)->setMesh(mesh);
|
||||
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;*/
|
||||
m_unlocked_stuff[n].m_curr_image = textureID;
|
||||
}
|
||||
#endif
|
||||
} // textureID != previousTextureID
|
||||
} // if picture_count>1
|
||||
} // if !m_unlocked_stuff[n].m_pictures.empty()
|
||||
|
@ -24,10 +24,18 @@
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace irr {
|
||||
namespace scene { class ISceneNode; class ICameraSceneNode;
|
||||
class ILightSceneNode; }
|
||||
}
|
||||
|
||||
namespace SP
|
||||
{
|
||||
class SPTexture;
|
||||
}
|
||||
|
||||
class KartModel;
|
||||
class KartProperties;
|
||||
class ChallengeData;
|
||||
@ -52,6 +60,9 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi
|
||||
|
||||
/** Will be non-empty if this unlocked thing is one or many pictures */
|
||||
std::vector<irr::video::ITexture*> m_pictures;
|
||||
|
||||
std::vector<std::shared_ptr<SP::SPTexture> > m_sp_pictures;
|
||||
|
||||
/** Will be set if this unlocked thing is a picture */
|
||||
float m_w, m_h;
|
||||
/** used for slideshows */
|
||||
|
Loading…
Reference in New Issue
Block a user