Commit f7af30f5 authored by Jan Möbius's avatar Jan Möbius
Browse files

Added function to disable internal color setting for GlutPrimitive Node

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9073 383ad7c9-94d9-4d36-a494-682f7c89f535
parent cef65052
......@@ -173,8 +173,10 @@ draw(GLState& _state, DrawModes::DrawMode _drawMode)
glShadeModel(GL_FLAT);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
if ( setColor_ ) {
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
}
draw_obj(i);
......@@ -208,8 +210,10 @@ draw(GLState& _state, DrawModes::DrawMode _drawMode)
glEnable(GL_LIGHTING);
glShadeModel(GL_FLAT);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
if ( setColor_ ) {
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
}
draw_obj(i);
}
......@@ -221,8 +225,10 @@ draw(GLState& _state, DrawModes::DrawMode _drawMode)
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
if ( setColor_ ) {
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glColor(primitives_[i].color);
}
draw_obj(i);
}
......
......@@ -163,14 +163,16 @@ public:
GlutPrimitiveNode( BaseNode* _parent=0,
std::string _name="<GlutPrimitive>" )
: BaseNode(_parent, _name)
: BaseNode(_parent, _name),
setColor_(true)
{};
GlutPrimitiveNode( GlutPrimitiveType _type,
BaseNode* _parent=0,
std::string _name="<GlutPrimitive>" )
: BaseNode(_parent, _name)
: BaseNode(_parent, _name),
setColor_(true)
{
// add a single primitive of the given type
Primitive p;
......@@ -213,11 +215,20 @@ public:
/// picking
void pick(GLState& _state, PickTarget _target);
/** \brief Disable internal color processing
*
* Disables the internal color processing of the primitives. If disabled,
* a Materialnodes settings will apply here.
*/
void setColorInternal(bool _set) { setColor_ = _set; };
private:
std::vector<Primitive> primitives_;
bool setColor_;
};
......
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