redo spark graphics, add spark render setting

This commit is contained in:
jacob1 2014-08-11 21:56:40 -04:00
parent 774fb88002
commit 986b25b508
4 changed files with 41 additions and 10 deletions

View File

@ -1956,6 +1956,23 @@ void Renderer::render_parts()
fire_r[ny/CELL][nx/CELL] = firer; fire_r[ny/CELL][nx/CELL] = firer;
fire_g[ny/CELL][nx/CELL] = fireg; fire_g[ny/CELL][nx/CELL] = fireg;
fire_b[ny/CELL][nx/CELL] = fireb; fire_b[ny/CELL][nx/CELL] = fireb;
#endif
}
if(firea && (pixel_mode & FIRE_SPARK))
{
#ifdef OGLR
smokeV[csmokeV++] = nx;
smokeV[csmokeV++] = ny;
smokeC[csmokeC++] = ((float)firer)/255.0f;
smokeC[csmokeC++] = ((float)fireg)/255.0f;
smokeC[csmokeC++] = ((float)fireb)/255.0f;
smokeC[csmokeC++] = ((float)firea)/255.0f;
csmoke++;
#else
firea /= 4;
fire_r[ny/CELL][nx/CELL] = (firea*firer + (255-firea)*fire_r[ny/CELL][nx/CELL]) >> 8;
fire_g[ny/CELL][nx/CELL] = (firea*fireg + (255-firea)*fire_g[ny/CELL][nx/CELL]) >> 8;
fire_b[ny/CELL][nx/CELL] = (firea*fireb + (255-firea)*fire_b[ny/CELL][nx/CELL]) >> 8;
#endif #endif
} }
} }
@ -2441,6 +2458,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
SetColourMode(COLOUR_DEFAULT); SetColourMode(COLOUR_DEFAULT);
AddRenderMode(RENDER_BASC); AddRenderMode(RENDER_BASC);
AddRenderMode(RENDER_FIRE); AddRenderMode(RENDER_FIRE);
AddRenderMode(RENDER_SPRK);
//Render mode presets. Possibly load from config in future? //Render mode presets. Possibly load from config in future?
renderModePresets = new RenderPreset[11]; renderModePresets = new RenderPreset[11];
@ -2467,11 +2485,13 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
renderModePresets[4].Name = "Fire Display"; renderModePresets[4].Name = "Fire Display";
renderModePresets[4].RenderModes.push_back(RENDER_FIRE); 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_EFFE);
renderModePresets[4].RenderModes.push_back(RENDER_BASC); renderModePresets[4].RenderModes.push_back(RENDER_BASC);
renderModePresets[5].Name = "Blob Display"; renderModePresets[5].Name = "Blob Display";
renderModePresets[5].RenderModes.push_back(RENDER_FIRE); 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_EFFE);
renderModePresets[5].RenderModes.push_back(RENDER_BLOB); renderModePresets[5].RenderModes.push_back(RENDER_BLOB);
@ -2482,6 +2502,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
renderModePresets[7].Name = "Fancy Display"; renderModePresets[7].Name = "Fancy Display";
renderModePresets[7].RenderModes.push_back(RENDER_FIRE); 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_GLOW);
renderModePresets[7].RenderModes.push_back(RENDER_BLUR); renderModePresets[7].RenderModes.push_back(RENDER_BLUR);
renderModePresets[7].RenderModes.push_back(RENDER_EFFE); renderModePresets[7].RenderModes.push_back(RENDER_EFFE);

View File

@ -186,6 +186,14 @@ RenderView::RenderView():
tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BASC)); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BASC));
AddComponent(tCheckbox); AddComponent(tCheckbox);
checkboxOffset += cSpace;
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Spark", "Glow effect on sparks");
renderModes.push_back(tCheckbox);
tCheckbox->SetIcon(IconEffect);
tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_SPRK));
AddComponent(tCheckbox);
checkboxOffset += sSpace; checkboxOffset += sSpace;
line1 = checkboxOffset-5; line1 = checkboxOffset-5;
@ -231,9 +239,9 @@ RenderView::RenderView():
AddComponent(tCheckbox); AddComponent(tCheckbox);
#ifdef OGLR #ifdef OGLR
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "I don't know what this does..."); //I would remove the whole checkbox, but then there's a large empty space tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Some type of OpenGL effect ... maybe"); //I would remove the whole checkbox, but then there's a large empty space
#else #else
tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Does nothing"); tCheckbox = new ui::Checkbox(ui::Point(checkboxOffset, YRES+4), ui::Point(30, 16), "Effect", "Enables moving solids, stickmen guns, and premium(tm) graphics");
#endif #endif
displayModes.push_back(tCheckbox); displayModes.push_back(tCheckbox);
tCheckbox->SetIcon(IconEffect); tCheckbox->SetIcon(IconEffect);
@ -379,9 +387,9 @@ void RenderView::OnTick(float dt)
isToolTipFadingIn = false; isToolTipFadingIn = false;
if(toolTipPresence < 120) if(toolTipPresence < 120)
{ {
toolTipPresence += int(dt*2)>0?int(dt*2):1; toolTipPresence += int(dt*2)>1?int(dt*2):2;
if(toolTipPresence > 120) if(toolTipPresence > 120)
toolTipPresence = 0; toolTipPresence = 120;
} }
} }
if(toolTipPresence>0) if(toolTipPresence>0)

View File

@ -21,6 +21,7 @@
#define FIREMODE 0x00FF0000 #define FIREMODE 0x00FF0000
#define FIRE_ADD 0x00010000 #define FIRE_ADD 0x00010000
#define FIRE_BLEND 0x00020000 #define FIRE_BLEND 0x00020000
#define FIRE_SPARK 0x00040000
#define EFFECT 0xFF000000 #define EFFECT 0xFF000000
#define EFFECT_GRAVIN 0x01000000 #define EFFECT_GRAVIN 0x01000000
@ -29,7 +30,8 @@
#define EFFECT_DBGLINES 0x08000000 #define EFFECT_DBGLINES 0x08000000
#define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE #define RENDER_EFFE OPTIONS | PSPEC_STICKMAN | EFFECT | PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE
#define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_ADD | PMODE_BLEND | FIREMODE #define RENDER_FIRE OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_ADD | PMODE_BLEND | FIRE_ADD | FIRE_BLEND
#define RENDER_SPRK OPTIONS | PSPEC_STICKMAN | PMODE_ADD | PMODE_BLEND | FIRE_SPARK
#define RENDER_GLOW OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_GLOW | PMODE_ADD | PMODE_BLEND #define RENDER_GLOW OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_GLOW | PMODE_ADD | PMODE_BLEND
#define RENDER_BLUR OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_BLUR | PMODE_ADD | PMODE_BLEND #define RENDER_BLUR OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_BLUR | PMODE_ADD | PMODE_BLEND
#define RENDER_BLOB OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_BLOB | PMODE_ADD | PMODE_BLEND #define RENDER_BLOB OPTIONS | PSPEC_STICKMAN | /*PMODE_FLAT |*/ PMODE_BLOB | PMODE_ADD | PMODE_BLEND

View File

@ -355,11 +355,11 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
int Element_SPRK::graphics(GRAPHICS_FUNC_ARGS) int Element_SPRK::graphics(GRAPHICS_FUNC_ARGS)
{ {
*firea = 80; *firea = 60;
*firer = 170; *firer = *colr/2;
*fireg = 200; *fireg = *colg/2;
*fireb = 220; *fireb = *colb/2;
*pixel_mode |= FIRE_ADD; *pixel_mode |= FIRE_SPARK;
return 1; return 1;
} }