mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-29 12:40:01 +01:00
Use current rendering modes when placing a save (fixes #446)
This commit is contained in:
parent
8223e06670
commit
23337862a4
@ -22,6 +22,7 @@ ThumbnailRendererTask::~ThumbnailRendererTask()
|
||||
|
||||
bool ThumbnailRendererTask::doWork()
|
||||
{
|
||||
SaveRenderer::Ref().ResetModes();
|
||||
thumbnail = std::unique_ptr<VideoBuffer>(SaveRenderer::Ref().Render(Save.get(), Decorations, Fire));
|
||||
if (thumbnail)
|
||||
{
|
||||
|
@ -2583,70 +2583,75 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
|
||||
memset(fire_b, 0, sizeof(fire_b));
|
||||
|
||||
//Set defauly display modes
|
||||
SetColourMode(COLOUR_DEFAULT);
|
||||
AddRenderMode(RENDER_BASC);
|
||||
AddRenderMode(RENDER_FIRE);
|
||||
AddRenderMode(RENDER_SPRK);
|
||||
ResetModes();
|
||||
|
||||
//Render mode presets. Possibly load from config in future?
|
||||
renderModePresets = new RenderPreset[11];
|
||||
|
||||
renderModePresets[0].Name = "Alternative Velocity Display";
|
||||
renderModePresets[0].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[0].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[0].DisplayModes.push_back(DISPLAY_AIRC);
|
||||
|
||||
renderModePresets[1].Name = "Velocity Display";
|
||||
renderModePresets[1].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[1].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[1].DisplayModes.push_back(DISPLAY_AIRV);
|
||||
|
||||
renderModePresets[2].Name = "Pressure Display";
|
||||
renderModePresets[2].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[2].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[2].DisplayModes.push_back(DISPLAY_AIRP);
|
||||
|
||||
renderModePresets[3].Name = "Persistent Display";
|
||||
renderModePresets[3].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[3].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[3].DisplayModes.push_back(DISPLAY_PERS);
|
||||
|
||||
renderModePresets[4].Name = "Fire Display";
|
||||
renderModePresets[4].RenderModes.push_back(RENDER_FIRE);
|
||||
renderModePresets[4].RenderModes.push_back(RENDER_SPRK);
|
||||
renderModePresets[4].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[4].RenderModes.push_back(RENDER_BASC);
|
||||
|
||||
renderModePresets[5].Name = "Blob Display";
|
||||
renderModePresets[5].RenderModes.push_back(RENDER_FIRE);
|
||||
renderModePresets[5].RenderModes.push_back(RENDER_SPRK);
|
||||
renderModePresets[5].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[5].RenderModes.push_back(RENDER_BLOB);
|
||||
|
||||
renderModePresets[6].Name = "Heat Display";
|
||||
renderModePresets[6].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[6].DisplayModes.push_back(DISPLAY_AIRH);
|
||||
renderModePresets[6].ColourMode = COLOUR_HEAT;
|
||||
|
||||
renderModePresets[7].Name = "Fancy Display";
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_FIRE);
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_SPRK);
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_GLOW);
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_BLUR);
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_EFFE);
|
||||
renderModePresets[7].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[7].DisplayModes.push_back(DISPLAY_WARP);
|
||||
|
||||
renderModePresets[8].Name = "Nothing Display";
|
||||
renderModePresets[8].RenderModes.push_back(RENDER_BASC);
|
||||
|
||||
renderModePresets[9].Name = "Heat Gradient Display";
|
||||
renderModePresets[9].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[9].ColourMode = COLOUR_GRAD;
|
||||
|
||||
renderModePresets[10].Name = "Life Gradient Display";
|
||||
renderModePresets[10].RenderModes.push_back(RENDER_BASC);
|
||||
renderModePresets[10].ColourMode = COLOUR_LIFE;
|
||||
renderModePresets.push_back({
|
||||
"Alternative Velocity Display",
|
||||
{ RENDER_EFFE, RENDER_BASC },
|
||||
{ DISPLAY_AIRC },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Velocity Display",
|
||||
{ RENDER_EFFE, RENDER_BASC },
|
||||
{ DISPLAY_AIRV },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Pressure Display",
|
||||
{ RENDER_EFFE, RENDER_BASC },
|
||||
{ DISPLAY_AIRP },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Persistent Display",
|
||||
{ RENDER_EFFE, RENDER_BASC },
|
||||
{ DISPLAY_PERS },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Fire Display",
|
||||
{ RENDER_FIRE, RENDER_SPRK, RENDER_EFFE, RENDER_BASC },
|
||||
{ },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Blob Display",
|
||||
{ RENDER_FIRE, RENDER_SPRK, RENDER_EFFE, RENDER_BLOB },
|
||||
{ },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Heat Display",
|
||||
{ RENDER_BASC },
|
||||
{ DISPLAY_AIRH },
|
||||
{ COLOUR_HEAT }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Fancy Display",
|
||||
{ RENDER_FIRE, RENDER_SPRK, RENDER_GLOW, RENDER_BLUR, RENDER_EFFE, RENDER_BASC },
|
||||
{ DISPLAY_WARP },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Nothing Display",
|
||||
{ RENDER_BASC },
|
||||
{ },
|
||||
{ }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Heat Gradient Display",
|
||||
{ RENDER_BASC },
|
||||
{ },
|
||||
{ COLOUR_GRAD }
|
||||
});
|
||||
renderModePresets.push_back({
|
||||
"Life Gradient Display",
|
||||
{ RENDER_BASC },
|
||||
{ },
|
||||
{ COLOUR_LIFE }
|
||||
});
|
||||
|
||||
//Prepare the graphics cache
|
||||
graphicscache = new gcache_item[PT_NUM];
|
||||
@ -2933,6 +2938,14 @@ unsigned int Renderer::GetColourMode()
|
||||
return colour_mode;
|
||||
}
|
||||
|
||||
void Renderer::ResetModes()
|
||||
{
|
||||
SetColourMode(COLOUR_DEFAULT);
|
||||
AddRenderMode(RENDER_BASC);
|
||||
AddRenderMode(RENDER_FIRE);
|
||||
AddRenderMode(RENDER_SPRK);
|
||||
}
|
||||
|
||||
VideoBuffer Renderer::DumpFrame()
|
||||
{
|
||||
#ifdef OGLR
|
||||
@ -2952,8 +2965,6 @@ VideoBuffer Renderer::DumpFrame()
|
||||
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
delete[] renderModePresets;
|
||||
|
||||
#if !defined(OGLR)
|
||||
#if defined(OGLI)
|
||||
delete[] vid;
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
unsigned int colour_mode;
|
||||
std::vector<unsigned int> display_modes;
|
||||
unsigned int display_mode;
|
||||
RenderPreset * renderModePresets;
|
||||
std::vector<RenderPreset> renderModePresets;
|
||||
//
|
||||
unsigned char fire_r[YRES/CELL][XRES/CELL];
|
||||
unsigned char fire_g[YRES/CELL][XRES/CELL];
|
||||
@ -154,6 +154,8 @@ public:
|
||||
void SetColourMode(unsigned int mode);
|
||||
unsigned int GetColourMode();
|
||||
|
||||
void ResetModes();
|
||||
|
||||
int GetGridSize() { return gridSize; }
|
||||
void SetGridSize(int value) { gridSize = value; }
|
||||
|
||||
|
@ -1964,6 +1964,7 @@ void GameView::NotifyPlaceSaveChanged(GameModel * sender)
|
||||
placeSaveOffset = ui::Point(0, 0);
|
||||
if(sender->GetPlaceSave())
|
||||
{
|
||||
SaveRenderer::Ref().CopyModes(sender->GetRenderer());
|
||||
placeSaveThumb = SaveRenderer::Ref().Render(sender->GetPlaceSave());
|
||||
selectMode = PlaceSave;
|
||||
selectPoint2 = mousePosition;
|
||||
|
@ -547,6 +547,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
||||
|
||||
if(save->GetGameSave())
|
||||
{
|
||||
SaveRenderer::Ref().ResetModes();
|
||||
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false, true);
|
||||
|
||||
if(savePreview && savePreview->Buffer && !(savePreview->Width == XRES/2 && savePreview->Height == YRES/2))
|
||||
|
@ -176,3 +176,14 @@ SaveRenderer::~SaveRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
void SaveRenderer::CopyModes(Renderer *source)
|
||||
{
|
||||
ren->SetRenderMode(source->GetRenderMode());
|
||||
ren->SetDisplayMode(source->GetDisplayMode());
|
||||
ren->SetColourMode(source->GetColourMode());
|
||||
}
|
||||
|
||||
void SaveRenderer::ResetModes()
|
||||
{
|
||||
ren->ResetModes();
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
SaveRenderer();
|
||||
VideoBuffer * Render(GameSave * save, bool decorations = true, bool fire = true);
|
||||
VideoBuffer * Render(unsigned char * saveData, int saveDataSize, bool decorations = true, bool fire = true);
|
||||
void CopyModes(Renderer *source);
|
||||
void ResetModes();
|
||||
virtual ~SaveRenderer();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user