Skip to content
Snippets Groups Projects
Commit fc2dfcb1 authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

fixed outline transparency; switched outline mode 1/2 algorithms

parent 72989545
Branches
Tags
No related merge requests found
......@@ -148,17 +148,22 @@ void GfxObj::RenderGL(RenderPass pass)
render_depth_only();
} else if(pass==TRANSPARENT_RENDER_PASS) {
if(GetOpacity()<1.0) {
render_depth_only();
CustomRenderGL(STANDARD_RENDER_PASS);
render_depth_only();
CustomRenderGL(STANDARD_RENDER_PASS);
if(outline_flag_) {
va_.SetOutlineMode(outline_mode_);
CustomRenderGL(pass);
va_.SetOutlineMode(0);
}
}
} else if(pass==STANDARD_RENDER_PASS) {
if(GetOpacity()>=1.0) {
CustomRenderGL(STANDARD_RENDER_PASS);
}
if(outline_flag_) {
va_.SetOutlineMode(outline_mode_);
CustomRenderGL(pass);
va_.SetOutlineMode(0);
CustomRenderGL(STANDARD_RENDER_PASS);
if(outline_flag_) {
va_.SetOutlineMode(outline_mode_);
CustomRenderGL(pass);
va_.SetOutlineMode(0);
}
}
} else if(pass==GLOW_RENDER_PASS) {
CustomRenderGL(GLOW_RENDER_PASS);
......
......@@ -382,6 +382,7 @@ void IndexedVertexArray::SetOpacity(float o)
for(EntryList::iterator it=entry_list_.begin();it!=entry_list_.end();++it) {
it->c[3]=o;
}
opacity_=o;
FlagRefresh();
}
......@@ -436,7 +437,7 @@ void IndexedVertexArray::RenderGL()
glCullFace(GL_FRONT);
glEnable(GL_CULL_FACE);
glShadeModel(GL_FLAT);
if(outline_mode_==1) {
if(outline_mode_==2) {
glCallList(outline_mat_dlist_);
glEnable(GL_POLYGON_OFFSET_LINE);
glEnable(GL_POLYGON_OFFSET_POINT);
......@@ -446,7 +447,7 @@ void IndexedVertexArray::RenderGL()
glEnable(GL_LINE_SMOOTH);
glDisable(GL_POINT_SMOOTH); // kills selfx fragment shader if enabled
glDisable(GL_POLYGON_SMOOTH);
} else if(outline_mode_==2) {
} else if(outline_mode_==1) {
glCallList(outline_mat_dlist_);
glEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(10.0,1.0);
......@@ -459,7 +460,12 @@ void IndexedVertexArray::RenderGL()
glDisable(GL_POLYGON_OFFSET_LINE);
glDisable(GL_POLYGON_OFFSET_POINT);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
if(opacity_<1.0) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
} else {
glDisable(GL_BLEND);
}
}
} else {
// not in outline mode
......@@ -473,17 +479,17 @@ void IndexedVertexArray::RenderGL()
} else {
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
}
if(color_mat_) {
glEnable(GL_COLOR_MATERIAL);
} else {
glDisable(GL_COLOR_MATERIAL);
}
if(cull_face_) {
glEnable(GL_CULL_FACE);
} else {
glDisable(GL_CULL_FACE);
}
}
if(color_mat_) {
glEnable(GL_COLOR_MATERIAL);
} else {
glDisable(GL_COLOR_MATERIAL);
}
if(mode_&0x1) {
if(outline_mode_>0) {
......@@ -516,7 +522,7 @@ void IndexedVertexArray::RenderGL()
glUniform1f(glGetUniformLocation(Shader::Instance().GetCurrentProgram(),"scalef"),outline_exp_factor_);
glUniform4f(glGetUniformLocation(Shader::Instance().GetCurrentProgram(),"color"),
outline_exp_color_[0],outline_exp_color_[1],
outline_exp_color_[2],outline_exp_color_[3]);
outline_exp_color_[2],opacity_);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
draw_ltq(use_buff);
......@@ -663,6 +669,7 @@ void IndexedVertexArray::Reset()
aalines_flag_=false;
point_size_=2.0;
line_halo_=0.0;
opacity_=1.0;
outline_mode_=0;
outline_width_=4.0;
outline_mat_=Material(0.3,1.0,0.0,0.0,0.0);
......
......@@ -211,6 +211,7 @@ class DLLEXPORT_OST_GFX IndexedVertexArray {
bool aalines_flag_;
float point_size_;
float line_halo_;
float opacity_;
int outline_mode_;
float outline_width_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment