0000834: Minor preselection color bug

This commit is contained in:
wmayer 2012-09-30 13:50:09 +02:00
parent d8d7fcca34
commit c223f44a97
2 changed files with 76 additions and 73 deletions

View File

@ -963,7 +963,7 @@ void SoBrepEdgeSet::renderHighlight(SoGLRenderAction *action)
SoLazyElement::setEmissive(state, &this->highlightColor);
SoOverrideElement::setEmissiveColorOverride(state, this, TRUE);
SoLazyElement::setDiffuse(state, this,1, &this->highlightColor,&this->colorpacker);
SoLazyElement::setDiffuse(state, this,1, &this->highlightColor,&this->colorpacker1);
SoOverrideElement::setDiffuseColorOverride(state, this, TRUE);
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);
@ -1000,7 +1000,7 @@ void SoBrepEdgeSet::renderSelection(SoGLRenderAction *action)
SoLazyElement::setEmissive(state, &this->selectionColor);
SoOverrideElement::setEmissiveColorOverride(state, this, TRUE);
SoLazyElement::setDiffuse(state, this,1, &this->selectionColor,&this->colorpacker);
SoLazyElement::setDiffuse(state, this,1, &this->selectionColor,&this->colorpacker2);
SoOverrideElement::setDiffuseColorOverride(state, this, TRUE);
SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR);

View File

@ -30,7 +30,7 @@
#include <Inventor/nodes/SoIndexedFaceSet.h>
#include <Inventor/nodes/SoIndexedLineSet.h>
#include <Inventor/nodes/SoPointSet.h>
#include <Inventor/elements/SoLazyElement.h>
#include <Inventor/elements/SoLazyElement.h>
#include <Inventor/elements/SoReplacedElement.h>
#include <vector>
@ -56,49 +56,49 @@ protected:
virtual ~SoBrepFaceSet() {};
virtual void GLRender(SoGLRenderAction *action);
virtual void GLRenderBelowPath(SoGLRenderAction * action);
virtual void doAction(SoAction* action);
virtual SoDetail * createTriangleDetail(
SoRayPickAction * action,
const SoPrimitiveVertex * v1,
const SoPrimitiveVertex * v2,
const SoPrimitiveVertex * v3,
virtual void doAction(SoAction* action);
virtual SoDetail * createTriangleDetail(
SoRayPickAction * action,
const SoPrimitiveVertex * v1,
const SoPrimitiveVertex * v2,
const SoPrimitiveVertex * v3,
SoPickedPoint * pp);
virtual void generatePrimitives(SoAction * action);
private:
enum Binding {
OVERALL = 0,
PER_PART,
PER_PART_INDEXED,
PER_FACE,
PER_FACE_INDEXED,
PER_VERTEX,
PER_VERTEX_INDEXED,
NONE = OVERALL
};
Binding findMaterialBinding(SoState * const state) const;
Binding findNormalBinding(SoState * const state) const;
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices,
const int32_t *partindices,
int num_partindices,
const SbVec3f *normals,
const int32_t *normindices,
SoMaterialBundle *const materials,
const int32_t *matindices,
SoTextureCoordinateBundle * const texcoords,
const int32_t *texindices,
const int nbind,
const int mbind,
const int texture);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
SbColor selectionColor;
SbColor highlightColor;
SoColorPacker colorpacker;
enum Binding {
OVERALL = 0,
PER_PART,
PER_PART_INDEXED,
PER_FACE,
PER_FACE_INDEXED,
PER_VERTEX,
PER_VERTEX_INDEXED,
NONE = OVERALL
};
Binding findMaterialBinding(SoState * const state) const;
Binding findNormalBinding(SoState * const state) const;
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices,
const int32_t *partindices,
int num_partindices,
const SbVec3f *normals,
const int32_t *normindices,
SoMaterialBundle *const materials,
const int32_t *matindices,
SoTextureCoordinateBundle * const texcoords,
const int32_t *texindices,
const int nbind,
const int mbind,
const int texture);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
SbColor selectionColor;
SbColor highlightColor;
SoColorPacker colorpacker;
};
// ---------------------------------------------------------------------
@ -119,24 +119,27 @@ protected:
virtual ~SoBrepEdgeSet() {};
virtual void GLRender(SoGLRenderAction *action);
virtual void GLRenderBelowPath(SoGLRenderAction * action);
virtual void doAction(SoAction* action);
virtual SoDetail * createLineSegmentDetail(
SoRayPickAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2,
SoPickedPoint *pp);
private:
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
std::vector<int32_t> hl, sl;
SbColor selectionColor;
SbColor highlightColor;
SoColorPacker colorpacker;
virtual void doAction(SoAction* action);
virtual SoDetail * createLineSegmentDetail(
SoRayPickAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2,
SoPickedPoint *pp);
private:
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
std::vector<int32_t> hl, sl;
SbColor selectionColor;
SbColor highlightColor;
//#0000834: Minor preselection color bug
//To solve this we need a seprate color packer for highlighting and selection
SoColorPacker colorpacker1;
SoColorPacker colorpacker2;
};
// ---------------------------------------------------------------------
@ -157,19 +160,19 @@ protected:
virtual ~SoBrepPointSet() {};
virtual void GLRender(SoGLRenderAction *action);
virtual void GLRenderBelowPath(SoGLRenderAction * action);
virtual void doAction(SoAction* action);
private:
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
SbColor selectionColor;
SbColor highlightColor;
SoColorPacker colorpacker;
virtual void doAction(SoAction* action);
private:
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices,
int num_vertexindices);
void renderHighlight(SoGLRenderAction *action);
void renderSelection(SoGLRenderAction *action);
private:
SbColor selectionColor;
SbColor highlightColor;
SoColorPacker colorpacker;
};
} // namespace PartGui