Skip to content

Commit

Permalink
Added level editor features
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMoroz committed Aug 27, 2019
1 parent 90b64bc commit 739c1b6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion game_folder/shaders/compute/distance_estimators.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ uniform vec3 iMarblePos;
uniform float iMarbleRad;
uniform float iFlagScale;
uniform vec3 iFlagPos;
#define FRACTAL_ITER 16
uniform int FRACTAL_ITER;

///Original MM distance estimators

Expand Down
2 changes: 1 addition & 1 deletion src/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Camera
};

Camera(): alpha(0), beta(0), gamma(0), cur_mode(Free), radius(1.f),
smooth(0.3f), FOV(75.f), focus(1e10), bokeh(0), mblur(0.01), speckle(10), size(0), exposure(1.0f), bloomintensity(0.2), bloomtreshold(3), bloomradius(2)
smooth(0.3f), FOV(75.f), focus(1e10), bokeh(0), mblur(0.01), speckle(10), size(0), exposure(1.0f), bloomintensity(0.12), bloomtreshold(2.7), bloomradius(3)
{
//camera directions
dirx = quat(0, 1, 0, 0);
Expand Down
27 changes: 17 additions & 10 deletions src/Overlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,19 +493,26 @@ void Overlays::SetAntTweakBar(int Width, int Height, float &fps, Scene *scene, R
TwAddVarRW(level_editor, "Sun color", TW_TYPE_DIR3F, copy->light_col.data(), "group='Level parameters'");
TwAddVarRW(level_editor, "Background color", TW_TYPE_DIR3F, copy->background_col.data(), "group='Level parameters'");
TwAddVarRW(level_editor, "Gravity strenght", TW_TYPE_FLOAT, &copy->gravity, "min=0 max=0.5 step=0.0001 group='Level parameters'");
TwAddVarRW(level_editor, "Level restart y position", TW_TYPE_FLOAT, &copy->kill_y, "min=-100 max=100 step=0.1 group='Level parameters'");
TwAddVarRW(level_editor, "Is planet", TW_TYPE_BOOLCPP, &copy->planet, "group='Level parameters'");
TwAddVarRW(level_editor, "Starting look direction angle", TW_TYPE_FLOAT, &copy->start_look_x, "min=-3.14159 max=3.14159 step=0.01 group='Level parameters'");

fractal_editor = TwNewBar("FractalEditor");

TwAddVarRW(fractal_editor, "PBR roughness", TW_TYPE_FLOAT, &copy->PBR_roughness, "min=0 max=1 step=0.001 ");
TwAddVarRW(fractal_editor, "PBR metallic", TW_TYPE_FLOAT, &copy->PBR_metal, "min=0 max=1 step=0.001");
TwAddVarRW(fractal_editor, "PBR roughness", TW_TYPE_FLOAT, &copy->PBR_roughness, "min=0 max=1 step=0.001 group='Fractal Material'");
TwAddVarRW(fractal_editor, "PBR metallic", TW_TYPE_FLOAT, &copy->PBR_metal, "min=0 max=1 step=0.001 group='Fractal Material'");
float *p = copy->params.data();
TwAddVarRW(fractal_editor, "Fractal Iterations", TW_TYPE_INT32, &copy->FractalIter, "min=1 max=20 step=1");
TwAddVarRW(fractal_editor, "Fractal Scale", TW_TYPE_FLOAT, p, "min=0 max=5 step=0.0001");
TwAddVarRW(fractal_editor, "Fractal Angle1", TW_TYPE_FLOAT, p + 1, "min=-10 max=10 step=0.0001 ");
TwAddVarRW(fractal_editor, "Fractal Angle2", TW_TYPE_FLOAT, p + 2, "min=-10 max=10 step=0.0001 ");
TwAddVarRW(fractal_editor, "Fractal Shift", TW_TYPE_DIR3F, p + 3, "");
TwAddVarRW(fractal_editor, "Fractal Color", TW_TYPE_DIR3F, p + 6, "");

//TwAddButton(stats, "Info1.1", NULL, NULL, string);
TwAddVarRW(fractal_editor, "Fractal Iterations", TW_TYPE_INT32, &copy->FractalIter, "min=1 max=20 step=1 group='Fractal Coefficients'");
TwAddVarRW(fractal_editor, "Fractal Scale", TW_TYPE_FLOAT, p, "min=0 max=5 step=0.0001 group='Fractal Coefficients'");
TwAddVarRW(fractal_editor, "Fractal Angle1", TW_TYPE_FLOAT, p + 1, "min=-10 max=10 step=0.0001 group='Fractal Coefficients'");
TwAddVarRW(fractal_editor, "Fractal Angle2", TW_TYPE_FLOAT, p + 2, "min=-10 max=10 step=0.0001 group='Fractal Coefficients'");
TwAddVarRW(fractal_editor, "Fractal Shift", TW_TYPE_DIR3F, p + 3, "group='Fractal Coefficients'");
TwAddVarRW(fractal_editor, "Fractal Color", TW_TYPE_DIR3F, p + 6, "group='Fractal Coefficients'");

TwAddVarRW(fractal_editor, "Fractal Animation1", TW_TYPE_FLOAT, &copy->anim_1, "min=0 max=0.5 step=0.0001 group='Fractal Animation'");
TwAddVarRW(fractal_editor, "Fractal Animation2", TW_TYPE_FLOAT, &copy->anim_2, "min=0 max=0.5 step=0.0001 group='Fractal Animation'");
TwAddVarRW(fractal_editor, "Fractal Animation3", TW_TYPE_FLOAT, &copy->anim_3, "min=0 max=0.5 step=0.0001 group='Fractal Animation'");


confirmation_box = TwNewBar("confirm");

Expand Down
4 changes: 2 additions & 2 deletions src/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ void Scene::Write(sf::Shader& shader) const {

shader.setUniform("SHADOWS_ENABLED", Shadows_Enabled);
shader.setUniform("CAMERA_SIZE", camera_size*level_copy.marble_rad/0.035f);
shader.setUniform("FRACTAL_ITER", Fractal_Iterations);
shader.setUniform("FRACTAL_ITER", level_copy.FractalIter);
shader.setUniform("REFL_REFR_ENABLED", Refl_Refr_Enabled);
shader.setUniform("MARBLE_MODE", MarbleType);
}
Expand Down Expand Up @@ -836,7 +836,7 @@ void Scene::WriteShader(ComputeShader& shader)

shader.setUniform("SHADOWS_ENABLED", Shadows_Enabled);
shader.setUniform("CAMERA_SIZE", camera_size*level_copy.marble_rad / 0.035f);
shader.setUniform("FRACTAL_ITER", Fractal_Iterations);
shader.setUniform("FRACTAL_ITER", level_copy.FractalIter);
shader.setUniform("REFL_REFR_ENABLED", Refl_Refr_Enabled);
shader.setUniform("MARBLE_MODE", MarbleType);
}
Expand Down

0 comments on commit 739c1b6

Please sign in to comment.