Announcement

Collapse
No announcement yet.

How to "Highlite" a vertex or triangle

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to "Highlite" a vertex or triangle

    Hello!
    Please, I'd like to know if is there a way to highlite a triangle or an edge belong to a 3D model.

    My scenario is the following:
    a simple scene graph with a SoSelection node, adding to it a cube or cone;
    the selection node has also a Selection Callback, which provides informations about picked point and picked node in the scene graph.

    Now, supposing i retrive the information about the triangle primitive belonging to 3D model, how can i select the triangle so it can be highlited in the scene graph?

    Thanks to all.

    Vincenzo

  • #2
    UPDATE: Please, is the SoBufferedShape picking Demo the right example?

    Comment


    • #3
      Originally posted by vlagala@smrobotica.it View Post
      I'd like to know if is there a way to highlite a triangle or an edge belong to a 3D model.

      My scenario is the following:
      a simple scene graph with a SoSelection node,
      <snip>
      Is the SoBufferedShape picking Demo the right example?
      Hi Vincenzo,
      Short answer: Yes, you are on the right track!

      Some notes:
      • BufferedShapePicking illustrates a technique for highlighting a face, edge or vertex.
        • Note that the rendering part of this example is specific to SoBufferedShape, but the highlighting technique is NOT specific to SoBufferedShape.
        • I.e., for any shape, you can get the vertices of the selected face from the SoFaceDetail object.
        • (Sorry there are no comments in this unnecessarily complex example. We need to fix that.)
      • You need the SoFaceDetail (or SoLineDetail, etc) object in order to get the vertices of the selected face.
        • SoSelection does not provide this information in the Selection callback. It only tells you the path to the selected object.
        • Using SoSelection you CAN get the Detail object using setPickFilterCallback(). An SoPickedPoint object will be passed to the callback. Get the Detail from this object and return the result of calling getPath() on this object.
        • You can also get an SoPickedPoint object and then the Detail object, doing picking directly (SoRayPickAction, SoHandleEventAction::getPickedPoint, etc)
      Regards,
      Mike

      Comment


      • #4
        Ok Mike,
        thank You for Your suggestions and help.
        I'll try to follow that example modified for a generic shape.

        Regards,

        Vincenzo

        Comment


        • #5
          Originally posted by mikeheck View Post
          Hi Vincenzo,
          Short answer: Yes, you are on the right track!

          Some notes:
          • BufferedShapePicking illustrates a technique for highlighting a face, edge or vertex.
            • Note that the rendering part of this example is specific to SoBufferedShape, but the highlighting technique is NOT specific to SoBufferedShape.
            • I.e., for any shape, you can get the vertices of the selected face from the SoFaceDetail object.
            • (Sorry there are no comments in this unnecessarily complex example. We need to fix that.)
          • You need the SoFaceDetail (or SoLineDetail, etc) object in order to get the vertices of the selected face.
            • SoSelection does not provide this information in the Selection callback. It only tells you the path to the selected object.
            • Using SoSelection you CAN get the Detail object using setPickFilterCallback(). An SoPickedPoint object will be passed to the callback. Get the Detail from this object and return the result of calling getPath() on this object.
            • You can also get an SoPickedPoint object and then the Detail object, doing picking directly (SoRayPickAction, SoHandleEventAction::getPickedPoint, etc)
          Regards,
          Mike
          Dear Mike,
          Following Your suggestions, i've built my scene graph using:
          • a SoSelection node as main root separator
          • adding a SoSphere
          • setting a pick filter callback for the SoSelection node
          • setting my own event callback performing a SoRayPickingAction

          Now, both pick filter callback and SoRayPickingAction (performed by event callback) give me a SoPickedPoint;

          now calling SoPickedPoint::getDetail(), it returns Always null pointer to SoDetail.

          Please, can You explain where i'm wrong in this simple approach?

          Thank You in advance for You time and Your support.

          Regards,

          Vincenzo

          Comment


          • #6
            Originally posted by vlagala@smrobotica.it View Post
            Following Your suggestions, i've built my scene graph using:
            • a SoSelection node as main root separator
            • adding a SoSphere
            • setting a pick filter callback for the SoSelection node
            • setting my own event callback performing a SoRayPickingAction

            now calling SoPickedPoint::getDetail(), it returns Always null pointer to SoDetail.
            Please, can You explain where i'm wrong in this simple approach?
            Hi Vincenzo,
            Your choice of geometry... :-)

            There is no SoDetail object defined for the SoSphere node. (This is documented in SoSphere.) It's because we want to consider the simple shapes as canonical shapes, not faceted geometry that looks like a canonical shape. Of course the SoSphere implementation _is_ a faceted shape, but the newer implementation - SoAlgebraicSphere - is not faceted (it's generated by algorithm in a shader, so there are no 'faces').

            Generally any shape derived from SoVertexShape will have an associated SoDetail that casts down to SoFaceDetail (and a few other special cases).
            Regards,
            Mike

            Comment


            • #7
              Dear Mike,
              Thank You for your explanation, i read the documentation too late...excuse me.

              Best Regards,

              Vincenzo

              Comment

              Working...
              X