Permalink
Browse files

redo spark graphics, add spark render setting

  • Loading branch information...
jacob1 committed Aug 12, 2014
1 parent 774fb88 commit 986b25b50838996800263b9ee18cf1397d9558a7
Showing with 41 additions and 10 deletions.
  1. +21 −0 src/graphics/Renderer.cpp
  2. +12 −4 src/gui/render/RenderView.cpp
  3. +3 −1 src/simulation/ElementGraphics.h
  4. +5 −5 src/simulation/elements/SPRK.cpp
@@ -1956,6 +1956,23 @@ void Renderer::render_parts()
fire_r[ny/CELL][nx/CELL] = firer;
fire_g[ny/CELL][nx/CELL] = fireg;
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
}
}
@@ -2441,6 +2458,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
SetColourMode(COLOUR_DEFAULT);
AddRenderMode(RENDER_BASC);
AddRenderMode(RENDER_FIRE);
AddRenderMode(RENDER_SPRK);
//Render mode presets. Possibly load from config in future?
renderModePresets = new RenderPreset[11];
@@ -2467,11 +2485,13 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
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);
@@ -2482,6 +2502,7 @@ Renderer::Renderer(Graphics * g, Simulation * sim):
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);
@@ -186,6 +186,14 @@ RenderView::RenderView():
tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BASC));
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;
line1 = checkboxOffset-5;
@@ -231,9 +239,9 @@ RenderView::RenderView():
AddComponent(tCheckbox);
#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
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
displayModes.push_back(tCheckbox);
tCheckbox->SetIcon(IconEffect);
@@ -379,9 +387,9 @@ void RenderView::OnTick(float dt)
isToolTipFadingIn = false;
if(toolTipPresence < 120)
{
toolTipPresence += int(dt*2)>0?int(dt*2):1;
toolTipPresence += int(dt*2)>1?int(dt*2):2;
if(toolTipPresence > 120)
toolTipPresence = 0;
toolTipPresence = 120;
}
}
if(toolTipPresence>0)
@@ -21,6 +21,7 @@
#define FIREMODE 0x00FF0000
#define FIRE_ADD 0x00010000
#define FIRE_BLEND 0x00020000
#define FIRE_SPARK 0x00040000
#define EFFECT 0xFF000000
#define EFFECT_GRAVIN 0x01000000
@@ -29,7 +30,8 @@
#define EFFECT_DBGLINES 0x08000000
#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_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
@@ -355,11 +355,11 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
int Element_SPRK::graphics(GRAPHICS_FUNC_ARGS)
{
*firea = 80;
*firer = 170;
*fireg = 200;
*fireb = 220;
*pixel_mode |= FIRE_ADD;
*firea = 60;
*firer = *colr/2;
*fireg = *colg/2;
*fireb = *colb/2;
*pixel_mode |= FIRE_SPARK;
return 1;
}

0 comments on commit 986b25b

Please sign in to comment.