90 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
90 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
91 */ |
91 */ |
92 glEnable (GL_DEPTH_TEST); |
92 glEnable (GL_DEPTH_TEST); |
93 glShadeModel (GL_SMOOTH); |
93 glShadeModel (GL_SMOOTH); |
94 glEnable (GL_MULTISAMPLE); |
94 glEnable (GL_MULTISAMPLE); |
95 if (this->renderPreferences.lineAntiAliasing) |
95 if (this->renderPreferences.lineAntiAliasing && this->renderPreferences.style != gl::RenderStyle::PickScene) |
96 { |
96 { |
97 glEnable(GL_LINE_SMOOTH); |
97 glEnable(GL_LINE_SMOOTH); |
98 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); |
98 glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); |
99 } |
99 } |
100 else { |
100 else { |
104 } |
104 } |
105 |
105 |
106 void PartRenderer::renderScene() |
106 void PartRenderer::renderScene() |
107 { |
107 { |
108 const QColor& backgroundColor = this->renderPreferences.backgroundColor; |
108 const QColor& backgroundColor = this->renderPreferences.backgroundColor; |
109 glClearColor( |
109 if (this->renderPreferences.style != gl::RenderStyle::PickScene) |
110 static_cast<float>(backgroundColor.redF()), |
110 { |
111 static_cast<float>(backgroundColor.greenF()), |
111 glClearColor( |
112 static_cast<float>(backgroundColor.blueF()), |
112 static_cast<float>(backgroundColor.redF()), |
113 1.0f); |
113 static_cast<float>(backgroundColor.greenF()), |
|
114 static_cast<float>(backgroundColor.blueF()), |
|
115 1.0f); |
|
116 this->compiler->setUniform("useLighting", true); |
|
117 } |
|
118 else |
|
119 { |
|
120 glClearColor(0.0f, 0.0f, 0.0f, 1.0f); |
|
121 this->compiler->setUniform("useLighting", false); |
|
122 } |
114 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
123 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
115 glEnable(GL_DEPTH_TEST); |
124 glEnable(GL_DEPTH_TEST); |
116 glEnable(GL_POLYGON_OFFSET_FILL); |
125 glEnable(GL_POLYGON_OFFSET_FILL); |
117 glPolygonOffset(1.0f, 1.0f); |
126 glPolygonOffset(1.0f, 1.0f); |
118 glLineWidth(this->renderPreferences.lineThickness); |
127 glLineWidth(this->renderPreferences.lineThickness); |
137 renderVao(gl::ArrayClass::Lines); |
146 renderVao(gl::ArrayClass::Lines); |
138 case gl::RenderStyle::RandomColors: |
147 case gl::RenderStyle::RandomColors: |
139 this->setFragmentStyle(gl::FragmentStyle::RandomColors); |
148 this->setFragmentStyle(gl::FragmentStyle::RandomColors); |
140 this->renderAllArrays(); |
149 this->renderAllArrays(); |
141 break; |
150 break; |
|
151 case gl::RenderStyle::PickScene: |
|
152 glLineWidth(3.0f); |
|
153 this->setFragmentStyle(gl::FragmentStyle::Id); |
|
154 this->renderAllArrays(); |
|
155 break; |
142 case gl::RenderStyle::Wireframe: |
156 case gl::RenderStyle::Wireframe: |
143 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); |
157 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); |
144 this->setFragmentStyle(gl::FragmentStyle::Normal); |
158 this->setFragmentStyle(gl::FragmentStyle::Normal); |
145 this->renderAllArrays(); |
159 this->renderAllArrays(); |
146 break; |
160 break; |