Skip to content

Commit

Permalink
Fix for texture loading (Revolutionary-Games#639) (Revolutionary-Game…
Browse files Browse the repository at this point in the history
…s#741)

* Revert "Deleted my badly  formatted comment, and added one more check, because in the createbackground we only checked one of the backgrounds before editing it."

This reverts commit c01247b.

* Revert "The microbe editor now uses its own background mesh, as a result it always uses the same texture (ocean, we can change that later very easily so i can fix that), but at least it seems to have stopped the banana background from happening."

This reverts commit 3223dcf.

* Removed some comments and one log

The bandaids should now all be gone

* This automates hitting suicide every 15 seconds and other stuff

For testing banana bug

* Added a potential fix for texture loading, increased max open file count

* Revert "This automates hitting suicide every 15 seconds and other stuff"

This reverts commit c24a714.

A bunch of debugging stuff

* Updated engine to invalidate precompiled cAudio version

Now everyone should get the changes by crodnu
  • Loading branch information
hhyyrylainen authored Feb 24, 2019
1 parent 1b79a23 commit 756b3e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion SetupThrive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def parseExtraArgs
leviathan = Leviathan.new(
# Use this if you always want the latest commit
# version: "develop",
version: "02599f1c44a37d6d84bf9cdd1051b8debdd4815c",
version: "ff0b85fa6fafe9d1161910524775eb2c1e6a486d",
# Doesn't actually work, but leviathan doesn't install with sudo by
# default, or install at all for that matter
noInstallSudo: true
Expand Down
44 changes: 15 additions & 29 deletions src/ThriveGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ class ThriveGame::Implementation {
m_microbeBackgroundMesh.reset();
m_microbeBackgroundSubMesh = nullptr;
}

if(m_microbeEditorBackgroundMesh) {

Ogre::MeshManager::getSingleton().remove(
m_microbeEditorBackgroundMesh);
m_microbeEditorBackgroundMesh.reset();
m_microbeEditorBackgroundSubMesh = nullptr;
}
}

void
Expand Down Expand Up @@ -98,8 +90,6 @@ class ThriveGame::Implementation {
{
destroyBackgroundItem();

LOG_INFO("Creating background item");

LEVIATHAN_ASSERT(
m_cellStage, "Trying to create background item before world");

Expand All @@ -117,7 +107,7 @@ class ThriveGame::Implementation {
if(!m_microbeEditorBackgroundItem) {
m_microbeEditorBackgroundItem =
m_microbeEditor->GetScene()->createItem(
m_microbeEditorBackgroundMesh, Ogre::SCENE_STATIC);
m_microbeBackgroundMesh, Ogre::SCENE_STATIC);
m_microbeEditorBackgroundItem->setCastShadows(false);

// Need to edit the render queue and add it to an early one
Expand Down Expand Up @@ -145,8 +135,6 @@ class ThriveGame::Implementation {
//! This is the background object of the cell stage
Ogre::MeshPtr m_microbeBackgroundMesh;
Ogre::SubMesh* m_microbeBackgroundSubMesh;
Ogre::MeshPtr m_microbeEditorBackgroundMesh;
Ogre::SubMesh* m_microbeEditorBackgroundSubMesh;
Ogre::Item* m_microbeBackgroundItem = nullptr;
Ogre::SceneNode* m_backgroundRenderNode = nullptr;

Expand All @@ -167,6 +155,17 @@ ThriveGame::ThriveGame()
m_cheatsEnabled = true;
#endif // MAKE_RELEASE

#ifdef _WIN32
// This should fix the texture loading error. It is likely caused by running
// out of file descriptors, so here we set our limit to the max Not sure why
// it was able to happen on linux. Perhaps the launcher could do "ulimit" to
// increase the file limit when running the game, but it is very rare to
// happen on Linux
if(_setmaxstdio(2048) != 2048) {
LOG_ERROR("Max open file increase failed! _setmaxstdio");
}
#endif //_WIN32

StaticGame = this;
}

Expand Down Expand Up @@ -375,17 +374,7 @@ void

m_impl->m_microbeBackgroundSubMesh->setMaterialName("Background");
}
// This also needs to be manually destroyed later.
if(!m_impl->m_microbeEditorBackgroundMesh) {
m_impl->m_microbeEditorBackgroundMesh =
Leviathan::GeometryHelpers::CreateScreenSpaceQuad(
"Editor_background", -1, -1, 2, 2);

m_impl->m_microbeEditorBackgroundSubMesh =
m_impl->m_microbeEditorBackgroundMesh->getSubMesh(0);

m_impl->m_microbeEditorBackgroundSubMesh->setMaterialName("Background");
}
// Setup render queue for it
m_impl->m_cellStage->GetScene()->getRenderQueue()->setRenderQueueMode(
1, Ogre::RenderQueue::FAST);
Expand Down Expand Up @@ -546,17 +535,17 @@ void

m_impl->m_microbeEditor->SetCamera(camera);

// Background
// Ill add an if statement here and see what happens
if(!m_impl->m_editorBackgroundRenderNode) {
m_impl->m_editorBackgroundRenderNode =
m_impl->m_microbeEditor->GetScene()->createSceneNode(
Ogre::SCENE_STATIC);

// Setup render queue for it
m_impl->m_microbeEditor->GetScene()
->getRenderQueue()
->setRenderQueueMode(1, Ogre::RenderQueue::FAST);
// This also attaches it

// This creates and attaches the item
m_impl->createBackgroundItem();
}

Expand Down Expand Up @@ -984,9 +973,6 @@ void
LOG_INFO("Setting microbe background to: " + material);
m_impl->m_microbeBackgroundSubMesh->setMaterialName(material);

// If the banana background re-appears after this change, we will make it
// just use the default blue background. SO just comment this out then.
m_impl->m_microbeEditorBackgroundSubMesh->setMaterialName(material);
m_impl->createBackgroundItem();
}

Expand Down

0 comments on commit 756b3e8

Please sign in to comment.