fltTransformScale.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file fltTransformScale.h
  10. * @author drose
  11. * @date 2000-08-30
  12. */
  13. #ifndef FLTTRANSFORMSCALE_H
  14. #define FLTTRANSFORMSCALE_H
  15. #include "pandatoolbase.h"
  16. #include "fltTransformRecord.h"
  17. /**
  18. * A transformation that applies a (possibly nonuniform) scale.
  19. */
  20. class FltTransformScale : public FltTransformRecord {
  21. public:
  22. FltTransformScale(FltHeader *header);
  23. void set(const LPoint3d &center, const LVecBase3 &scale);
  24. bool has_center() const;
  25. const LPoint3d &get_center() const;
  26. const LVecBase3 &get_scale() const;
  27. private:
  28. void recompute_matrix();
  29. LPoint3d _center;
  30. LVecBase3 _scale;
  31. protected:
  32. virtual bool extract_record(FltRecordReader &reader);
  33. virtual bool build_record(FltRecordWriter &writer) const;
  34. public:
  35. virtual TypeHandle get_type() const {
  36. return get_class_type();
  37. }
  38. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  39. static TypeHandle get_class_type() {
  40. return _type_handle;
  41. }
  42. static void init_type() {
  43. FltTransformRecord::init_type();
  44. register_type(_type_handle, "FltTransformScale",
  45. FltTransformRecord::get_class_type());
  46. }
  47. private:
  48. static TypeHandle _type_handle;
  49. };
  50. #endif