don't render fire on stamps (reduces lag)

This commit is contained in:
jacob1 2012-10-02 19:45:35 -04:00 committed by Simon Robertshaw
parent 63c364652d
commit 5c59b9d6cb
7 changed files with 35 additions and 28 deletions

View File

@ -28,16 +28,16 @@ ThumbnailBroker::~ThumbnailBroker()
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener)
{
RenderThumbnail(gameSave, true, width, height, tListener);
RenderThumbnail(gameSave, true, true, width, height, tListener);
}
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener)
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, bool decorations, bool fire, int width, int height, ThumbnailListener * tListener)
{
AttachThumbnailListener(tListener);
pthread_mutex_lock(&thumbnailQueueMutex);
bool running = thumbnailQueueRunning;
thumbnailQueueRunning = true;
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), decorations, width, height, ListenerHandle(tListener->ListenerRand, tListener)));
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), decorations, fire, width, height, ListenerHandle(tListener->ListenerRand, tListener)));
pthread_mutex_unlock(&thumbnailQueueMutex);
if(!running)
@ -122,7 +122,7 @@ void ThumbnailBroker::thumbnailQueueProcessTH()
std::cout << typeid(*this).name() << " Processing render request" << std::endl;
#endif
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save, req.Decorations);
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save, req.Decorations, req.Fire);
delete req.Save;
if(thumbnail)

View File

@ -59,11 +59,12 @@ private:
public:
int Width, Height;
bool Decorations;
bool Fire;
GameSave * Save;
ListenerHandle CompletedListener;
ThumbRenderRequest(GameSave * save, bool decorations, int width, int height, ListenerHandle completedListener) :
Save(save), Width(width), Height(height), CompletedListener(completedListener), Decorations(decorations) {}
ThumbRenderRequest() : Save(0), Decorations(true), Width(0), Height(0), CompletedListener(ListenerHandle(0, (ThumbnailListener*)NULL)) {}
ThumbRenderRequest(GameSave * save, bool decorations, bool fire, int width, int height, ListenerHandle completedListener) :
Save(save), Width(width), Height(height), CompletedListener(completedListener), Decorations(decorations), Fire(fire) {}
ThumbRenderRequest() : Save(0), Decorations(true), Fire(true), Width(0), Height(0), CompletedListener(ListenerHandle(0, (ThumbnailListener*)NULL)) {}
};
//Thumbnail retreival
@ -96,7 +97,7 @@ public:
virtual ~ThumbnailBroker();
void FlushThumbQueue();
void RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener);
void RenderThumbnail(GameSave * gameSave, bool decorations, bool fire, int width, int height, ThumbnailListener * tListener);
void RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener);
void RetrieveThumbnail(int saveID, int saveDate, int width, int height, ThumbnailListener * tListener);
void RetrieveThumbnail(int saveID, int width, int height, ThumbnailListener * tListener);

View File

@ -397,7 +397,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
if(save->GetGameSave())
{
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false);
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false, true);
if(savePreview && savePreview->Data && !(savePreview->Size.X == XRES/2 && savePreview->Size.Y == YRES/2))
{

View File

@ -70,7 +70,7 @@ LocalSaveActivity::LocalSaveActivity(SaveFile save) :
SetOkayButton(okayButton);
if(save.GetGameSave())
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), Size.X-16, -1, this);
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), true, false, Size.X-16, -1, this);
}
void LocalSaveActivity::Save()

View File

@ -128,7 +128,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
SetOkayButton(okayButton);
if(save.GetGameSave())
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), false, (Size.X/2)-16, -1, this);
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), false, true, (Size.X/2)-16, -1, this);
}
ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :

View File

@ -39,7 +39,7 @@ SaveRenderer::SaveRenderer(){
#endif
}
Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
{
int width, height;
Thumbnail * tempThumb;
@ -71,13 +71,16 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
ren->RenderBegin();
ren->RenderEnd();
#else
int frame = 15;
while(frame)
if (fire)
{
frame--;
ren->render_parts();
ren->render_fire();
ren->clearScreen(1.0f);
int frame = 15;
while(frame)
{
frame--;
ren->render_parts();
ren->render_fire();
ren->clearScreen(1.0f);
}
}
ren->RenderBegin();
@ -119,13 +122,16 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
ren->ClearAccumulation();
int frame = 15;
while(frame)
if (fire)
{
frame--;
ren->render_parts();
ren->render_fire();
ren->clearScreen(1.0f);
int frame = 15;
while(frame)
{
frame--;
ren->render_parts();
ren->render_fire();
ren->clearScreen(1.0f);
}
}
ren->RenderBegin();
@ -151,7 +157,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
return tempThumb;
}
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool decorations)
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool decorations, bool fire)
{
GameSave * tempSave;
try {
@ -166,7 +172,7 @@ Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool de
return thumb;
}
Thumbnail * thumb = Render(tempSave, decorations);
Thumbnail * thumb = Render(tempSave, decorations, fire);
delete tempSave;
return thumb;
}

View File

@ -24,8 +24,8 @@ class SaveRenderer: public Singleton<SaveRenderer> {
Renderer * ren;
public:
SaveRenderer();
Thumbnail * Render(GameSave * save, bool decorations = true);
Thumbnail * Render(unsigned char * saveData, int saveDataSize, bool decorations = true);
Thumbnail * Render(GameSave * save, bool decorations = true, bool fire = true);
Thumbnail * Render(unsigned char * saveData, int saveDataSize, bool decorations = true, bool fire = true);
virtual ~SaveRenderer();
private: