builderNormalVisualizer.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Filename: builderNormalVisualizer.h
  2. // Created by: drose (08Sep99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef BUILDERNORMALVISUALIZER_H
  19. #define BUILDERNORMALVISUALIZER_H
  20. #include <pandabase.h>
  21. #include "mesherConfig.h"
  22. #ifdef SUPPORT_SHOW_NORMALS
  23. #include "builderBucket.h"
  24. #include "builderAttrib.h"
  25. #include "builderVertex.h"
  26. #include "builderPrim.h"
  27. #include "pvector.h"
  28. ///////////////////////////////////////////////////////////////////
  29. // Class : BuilderNormalVisualizer
  30. // Description : A useful class for collecting information about
  31. // vertices and their associated normals as geometry is
  32. // built, so that its normals may be visualized via
  33. // renderable geometry. This is activated by the
  34. // _show_normals flag in the BuilderProperties.
  35. ////////////////////////////////////////////////////////////////////
  36. class EXPCL_PANDAEGG BuilderNormalVisualizer {
  37. public:
  38. INLINE BuilderNormalVisualizer(BuilderBucket &bucket);
  39. void add_prim(const BuilderPrim &prim);
  40. void add_prim(const BuilderPrimI &prim);
  41. void show_normals(GeomNode *node);
  42. void show_normals(qpGeomNode *node);
  43. private:
  44. void add_normal(const BuilderV &center, const BuilderN &normal);
  45. BuilderBucket &_bucket;
  46. BuilderV _net_vertex;
  47. int _num_vertices;
  48. pvector<BuilderPrim> _lines;
  49. };
  50. #include "builderNormalVisualizer.I"
  51. #endif // SUPPORT_SHOW_NORMALS
  52. #endif