Commit Graph

24 Commits

Author SHA1 Message Date
Robert Osfield
b91bd278cc Ported across from SimpleViewer to using Viewer 2007-06-02 16:23:07 +00:00
Robert Osfield
30a06a033e From Peter Hrenka, (note from Robert Osfield, renamed GenericPrimitiveFunctor mention below to TemplatePrimitiveFunctor).
"Since we desperately needed a means for picking Lines
and Points I implemented (hopefully!) proper geometrical tests
for the PolytopeIntersector.

First of all I implemented a new "GenericPrimiteFunctor"
which is basically an extended copy TriangleFunctor which also
handles Points, Lines and Quads through suitable overloads of
operator(). I would have liked to call it "PrimitiveFunctor"
but that name was already used...
I used a template method to remove redundancy in the
drawElements method overloads. If you know of platforms where
this will not work I can change it to the style used
in TriangleFunctor.

In PolytopeIntersector.cpp I implemented a
"PolytopePrimitiveIntersector" which provides the needed
overloads for Points, Lines, Triangles and Quads to
the GenericPrimitiveFunctor. This is then used in the
intersect method of PolytopeIntersector.

Implementation summary:
- Points: Check distance to all planes
- Lines: Check distance of both ends against each plane.
  If both are outside -> line is out
  If both are in -> continue checking
  One is in, one is out -> compute intersection point (candidate)
  Then check all candidates against all other polytope
  planes. The remaining candidates are the proper
  intersection points of the line with the polytope.
- Triangles: Perform Line-Checks for all edges of the
  triangle as above. If there is an proper intersection
  -> done.
  In the case where there are more than 2 polytope
  plane to check against we have to check for the case
  where the triangle encloses the polytope.
  In that case the intersection lines of the polytope
  planes are computed and checked against the triangle.
- Quads: handled as two triangles.

This is implementation is certainly not the fastest.
There are certainly ways and strategies to improve it.


I also enabled the code for PolytopeIntersector
in osgkeyboardmouse and added keybindings to
switch the type of intersector ('p') and the picking
coordinate system ('c') on the fly. Since the
PolytopeIntersector does not have a canonical
ordering for its intersections (as opposed to
the LineSegementIntersector) I chaged the
implementation to toggle all hit geometries.


I tested the functionality with osgkeyboardmouse
and several models and it seems to work for
polygonal models. Special nodes such as billboards
do not work.


The next thing on my todo-list is to implement
a an improved Intersection-Structure for the
PolytopeIntersector. We need to know
which primitives where hit (and where).

"
2007-05-23 11:05:59 +00:00
Robert Osfield
e2ba8d91c0 Added extra check to prevent calling frame() when the window has been closed. 2007-04-06 19:38:22 +00:00
Robert Osfield
6b47ea31b5 Added delete selected object using delete and back space key, and added save option 2007-01-23 14:10:10 +00:00
Robert Osfield
4d494c0014 Fixed comment 2007-01-12 10:28:06 +00:00
Robert Osfield
b121c9686f Ported following examples to osgViewer:
osgteapot
osgtessellate
osgtext
osgtexture1D
osgtexture2D
osgtexture3D
osgtexturerectangle
osgvertexprogram
osgvolume
osgwindows
osgsimple
osgkeyboardmouse
2007-01-11 15:19:59 +00:00
Robert Osfield
2255771b74 Further work osgViewer::Viewer and related classes. 2006-12-20 21:13:29 +00:00
Robert Osfield
a2e79f6a38 Moved osgUtil::PolytopeIntersector, osgUtil::PlaneIntersector and osgUtil::LineSegmentIntersector out from include/osgUtil/IntersecionVisitor into their own seperate files. 2006-11-28 16:30:38 +00:00
Robert Osfield
06cca16a2a Added convinience constructors to help support picking with the new osgUtil::Intersector classes. 2006-11-02 17:05:46 +00:00
Robert Osfield
7d12b85632 Added basic PolytopeIntersector functionality based on checking vertices against
polytopes.
2006-11-02 15:50:04 +00:00
Robert Osfield
e0f395fd07 Moved SimpleViewer and GraphicsWindow into their own osgViewer library, updated simpleviewer examples to reflect this change 2006-11-02 12:27:15 +00:00
Robert Osfield
15f7abe100 Improved handling of projected coords in new intersection classes 2006-11-01 17:18:45 +00:00
Robert Osfield
75169ad16f Added support for osgUtil::Intersectors being in WINDOW, PROJECTION, VIEW or MODEL coordinates 2006-11-01 14:41:32 +00:00
Robert Osfield
e6b08dcda3 Various clean ups to comments 2006-09-30 16:30:31 +00:00
Robert Osfield
5c0eb0b013 Added bare bones osgGA::SimpleViewer class to help simplify OSG setup when embedding the OSG
into existing GUI applications, and for one one a single camera, single window is required.
2006-09-25 16:25:53 +00:00
Robert Osfield
8d111fd147 Added pick handler. 2006-06-12 14:04:40 +00:00
Robert Osfield
ac20eca87a Revamped osgkeyboardmouse to use the osgGA. 2006-06-12 11:32:11 +00:00
Robert Osfield
3235f4fa22 Added ability to write out the selected parts of the scene graph. 2006-01-03 16:52:06 +00:00
Robert Osfield
6fe4be23e6 Ported picking across to using PickVisitor. 2005-12-23 10:59:31 +00:00
Robert Osfield
edf4598838 From Geoff Michel, Fix to prevent Producer::Trackball being set up with a negative
radius.
2005-12-05 10:08:52 +00:00
Robert Osfield
91855e7c50 Replaced tabs with spaces in examples. 2005-11-17 20:22:55 +00:00
Robert Osfield
4de8199011 Added #include <osg/io_utils> 2005-04-08 09:45:06 +00:00
Robert Osfield
6bdbe942b1 From Marco Jez, fixes to osgFX so that effects are compiled correctly.
Fixed title name of osgkeyboardmouse example.
2003-12-16 23:43:37 +00:00
Robert Osfield
b1226cc4a9 Added two news examples, osgsimple just loads a model and then renders it in
a single window.  osgkeyboardmouse adds to osgsimple support for keyboard mouse
and picking interactions.
2003-12-15 16:46:06 +00:00