SVertexManipulator.h 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2009-2012 Christian Stehno
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include "matrix4.h"
  6. #include "S3DVertex.h"
  7. #include "SColor.h"
  8. namespace irr
  9. {
  10. namespace scene
  11. {
  12. class IMesh;
  13. class IMeshBuffer;
  14. struct SMesh;
  15. //! Interface for vertex manipulators.
  16. /** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex.
  17. */
  18. struct IVertexManipulator
  19. {
  20. };
  21. //! Vertex manipulator which scales the position of the vertex
  22. class SVertexPositionScaleManipulator : public IVertexManipulator
  23. {
  24. public:
  25. SVertexPositionScaleManipulator(const core::vector3df &factor) :
  26. Factor(factor) {}
  27. template <typename VType>
  28. void operator()(VType &vertex) const
  29. {
  30. vertex.Pos *= Factor;
  31. }
  32. private:
  33. core::vector3df Factor;
  34. };
  35. } // end namespace scene
  36. } // end namespace irr