Commit d0d324c9 authored by Christopher Tenter's avatar Christopher Tenter
Browse files

cleanup and minor bug fixes

parent 0e27f27e
Pipeline #1835 failed with stage
......@@ -94,7 +94,6 @@ GCodeNode::GCodeNode(const GCode::Shared& _gc, BaseNode* _parent, std::string _n
DrawModes::DrawMode MODE_COLOR;
DrawModes::DrawMode MODE_HEAT;
DrawModes::DrawMode MODE_SPEED;
DrawModes::DrawMode MODE_TYPE;
*/
MODE_COLOR = DrawModes::DrawMode(ACG::SceneGraph::DrawModes::addDrawMode("Color",
......@@ -112,11 +111,6 @@ GCodeNode::GCodeNode(const GCode::Shared& _gc, BaseNode* _parent, std::string _n
ACG::SceneGraph::DrawModes::LIGHTSTAGE_SMOOTH,
ACG::SceneGraph::DrawModes::NORMAL_PER_VERTEX)));
MODE_TYPE = DrawModes::DrawMode(ACG::SceneGraph::DrawModes::addDrawMode("Edge Type",
ACG::SceneGraph::DrawModes::DrawModeProperties(ACG::SceneGraph::DrawModes::PRIMITIVE_POLYGON,
ACG::SceneGraph::DrawModes::LIGHTSTAGE_SMOOTH,
ACG::SceneGraph::DrawModes::NORMAL_PER_VERTEX)));
// Initial default draw mode
drawMode(MODE_COLOR);
}
......@@ -161,7 +155,7 @@ void GCodeNode::boundingBox(Vec3d& _bbMin, Vec3d& _bbMax)
DrawModes::DrawMode GCodeNode::availableDrawModes() const
{
return (MODE_COLOR | MODE_HEAT | MODE_SPEED | MODE_TYPE);
return (MODE_COLOR | MODE_HEAT | MODE_SPEED);
}
......@@ -185,9 +179,6 @@ void GCodeNode::draw(GLState& _state, const DrawModes::DrawMode& _drawMode)
}else if (_drawMode & MODE_SPEED)
{
drawmode = Ultimaker::GCodeNode_renderer::Speed;
}else if (_drawMode & MODE_TYPE)
{
drawmode = Ultimaker::GCodeNode_renderer::Type;
}
renderer->render(_state, _state.projection(), _state.modelview(), drawmode, distance_, color);
......@@ -323,22 +314,12 @@ void GCodeNode::getRenderObjects(ACG::IRenderer* _renderer, ACG::GLState& _stat
ACG::Vec4f color = _state.diffuse_color();
if (_drawMode & MODE_COLOR)
{
drawmode = Ultimaker::GCodeNode_renderer::Color;
}
else if (_drawMode & MODE_HEAT)
{
drawmode = Ultimaker::GCodeNode_renderer::Heat;
}
else if (_drawMode & MODE_SPEED)
{
drawmode = Ultimaker::GCodeNode_renderer::Speed;
}
else if (_drawMode & MODE_TYPE)
{
drawmode = Ultimaker::GCodeNode_renderer::Type;
}
renderer->createRenderObjects(_renderer, _state, drawmode, distance_, color);
// init base render object
......
......@@ -172,7 +172,6 @@ private:
DrawModes::DrawMode MODE_COLOR;
DrawModes::DrawMode MODE_HEAT;
DrawModes::DrawMode MODE_SPEED;
DrawModes::DrawMode MODE_TYPE;
};
......
......@@ -227,7 +227,6 @@ void GCodeNode_renderer::render(ACG::GLState& _state, const ACG::GLMatrixd& _pro
case Color: frag_shader = "GCode/gcode_color_fs.glsl"; break;
case Heat: frag_shader = "GCode/gcode_heat_fs.glsl"; break;
case Speed: frag_shader = "GCode/gcode_speed_fs.glsl"; break;
case Type: frag_shader = "GCode/gcode_type_fs.glsl"; break;
default: return;
}
......@@ -338,7 +337,6 @@ void GCodeNode_renderer::render(ACG::GLState& _state, const ACG::GLMatrixd& _pro
case Color: shader = ACG::ShaderCache::getInstance()->getProgram("GCode/gcode_vs.glsl", 0, 0, "GCode/gcode_gs.glsl", "GCode/gcode_color_fs.glsl"); break;
case Heat: shader = ACG::ShaderCache::getInstance()->getProgram("GCode/gcode_vs.glsl", 0, 0, "GCode/gcode_gs.glsl", "GCode/gcode_heat_fs.glsl"); break;
case Speed: shader = ACG::ShaderCache::getInstance()->getProgram("GCode/gcode_vs.glsl", 0, 0, "GCode/gcode_gs.glsl", "GCode/gcode_speed_fs.glsl"); break;
case Type: shader = ACG::ShaderCache::getInstance()->getProgram("GCode/gcode_vs.glsl", 0, 0, "GCode/gcode_gs.glsl", "GCode/gcode_type_fs.glsl"); break;
default: shader = 0;
}
......@@ -444,7 +442,6 @@ void GCodeNode_renderer::createRenderObjects(ACG::IRenderer* _renderer, ACG::GLS
case Color: frag_shader = "GCode/gcode_color_fs_gen.glsl"; break;
case Heat: frag_shader = "GCode/gcode_heat_fs_gen.glsl"; break;
case Speed: frag_shader = "GCode/gcode_speed_fs_gen.glsl"; break;
case Type: frag_shader = "GCode/gcode_type_fs_gen.glsl"; break;
default: return;
}
......
......@@ -63,7 +63,7 @@ namespace Ultimaker{
class GCodeNode_renderer
{
public:
enum DrawMode { Color, Heat, Speed, Type };
enum DrawMode { Color, Heat, Speed };
GCodeNode_renderer();
virtual ~GCodeNode_renderer();
......
......@@ -126,11 +126,11 @@ void GCodePlugin::slotGCodePositionBoxChanged()
tool_->lbl_gcode_extmode->setText(QString("Extruder Mode: Relative"));
}
tool_->lbl_gcode_fan->setText(QString("Fan Speed: %1%").arg(100.0*double(state.fan_speed) / 255.0));
tool_->lbl_gcode_fan->setText(QString("Fan Speed: %1").arg(100.0*double(state.fan_speed) / 255.0));
tool_->lbl_gcode_extrude->setText(QString("Extrude: %1 mm").arg(state.pos_extruder*(1.0 - x) + next_state.pos_extruder*x));
tool_->lbl_gcode_temp_ext->setText(QString("Temp Extruder: %1").arg(state.temp_extruder));
tool_->lbl_gcode_temp_bed->setText(QString("Temp Bed: %1").arg(state.temp_bed));
tool_->lbl_gcode_temp_ext->setText(QString("Temp Extruder: %1 C").arg(state.temp_extruder));
tool_->lbl_gcode_temp_bed->setText(QString("Temp Bed: %1 C").arg(state.temp_bed));
emit updateView();
}
......
#define SG_REQUEST_NORMALVS
in float gEdgeType;
in float gTime;
in float gSpeed;
uniform float uTime;
void main()
{
......
// shader for rendering the interpolation of the currently active segment
// (current time is within this segment)
out float gEdgeType;
out float gTime;
out float gSpeed;
out vec4 v2f_params;
uniform vec4 uParams;
......@@ -12,7 +10,5 @@ void main()
SG_VERTEX_BEGIN;
SG_VERTEX_END;
gEdgeType = uParams.w;
gTime = uParams.x;
gSpeed = uParams.z;
v2f_params = uParams;
}
\ No newline at end of file
#define SG_REQUEST_NORMALVS
in float gEdgeType;
in float gTime;
in float gSpeed;
uniform float uTime;
void main()
......@@ -11,7 +7,4 @@ void main()
SG_FRAGMENT_BEGIN;
SG_FRAGMENT_END;
float time_passed = (uTime - gTime);
float heat = exp(-time_passed/10000.0);
outFragment *= vec4(heat, 1.0-heat, 0.0, 1.0);
}
\ No newline at end of file
#define SG_REQUEST_NORMALVS
in float gEdgeType;
in float gTime;
in float gSpeed;
in vec4 v2f_params;
uniform float uTime;
......@@ -11,7 +9,8 @@ void main()
SG_FRAGMENT_BEGIN;
SG_FRAGMENT_END;
float time_passed = (uTime - gTime);
float heat = exp(-time_passed/10000.0);
float time_passed = (uTime - v2f_params.x);
float heat = exp(-time_passed/10.0);
heat = clamp(heat, 0, 1);
outFragment *= vec4(heat, 1.0-heat, 0.0, 1.0);
}
\ No newline at end of file
......@@ -4,9 +4,8 @@ in vec3 inTranslation;
in vec4 inParams; // start_time, end_time, speed, edge_type
out float gEdgeType;
out float gTime;
out float gSpeed;
out vec4 v2f_params;
uniform float uTime;
......@@ -16,9 +15,7 @@ void main()
{
SG_VERTEX_BEGIN;
gEdgeType = inParams.w;
gTime = inParams.x;
gSpeed = inParams.z;
v2f_params = inParams;
vec4 posWS;
posWS.xyz = inPosition.xyz * g_Scale + inTranslation;
......
......@@ -7,9 +7,7 @@ in vec4 inWorld2;
in vec4 inParams; // start_time, end_time, speed, edge_type
out float gEdgeType;
out float gTime;
out float gSpeed;
out vec4 v2f_params;
uniform float uTime;
......@@ -17,9 +15,7 @@ void main()
{
SG_VERTEX_BEGIN;
gEdgeType = inParams.w;
gTime = inParams.x;
gSpeed = inParams.z;
v2f_params = inParams;
// transform position
vec4 posWS;
......
#define SG_REQUEST_NORMALVS
in vec4 v2f_params;
uniform float uTime;
void main()
{
SG_FRAGMENT_BEGIN;
SG_FRAGMENT_END;
float speed = min((v2f_params.z-1200.0)/(4800.0-1200.0), 1.0);
outFragment *= vec4(1.0-speed, speed, 0.0, 1.0);
}
\ No newline at end of file
#version 330
in vec3 gNormal;
in float gEdgeType;
in float gTime;
in float gSpeed;
out vec4 oColor;
uniform float uTime;
void main(){
int edge_type = int(round(gEdgeType));
vec3 color = vec3(0.0, 0.0, 0.0);
if(edge_type == 0){
color = vec3(0.0, 0.0, 1.0);
}else if(edge_type == 1){
color = vec3(0.0, 1.0, 0.0);
}else if(edge_type == 2){
color = vec3(1.0, 0.0, 0.0);
}else if(edge_type == 3){
color = vec3(0.0, 1.0, 1.0);
}else if(edge_type == 4){
color = vec3(1.0, 0.0, 1.0);
}
vec3 normal = normalize(gNormal);
oColor = vec4(color, 1.0)*max(normal[2], 0.0);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment