builderNormalVisualizer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Filename: builderNormalVisualizer.h
  2. // Created by: drose (08Sep99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, 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://etc.cmu.edu/panda3d/docs/license/ .
  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. private:
  43. void add_normal(const BuilderV &center, const BuilderN &normal);
  44. BuilderBucket &_bucket;
  45. BuilderV _net_vertex;
  46. int _num_vertices;
  47. pvector<BuilderPrim> _lines;
  48. };
  49. #include "builderNormalVisualizer.I"
  50. #endif // SUPPORT_SHOW_NORMALS
  51. #endif