- return m_data[index];
- }
- const value_type& operator[](std::size_t index) const
- {
-#if defined(_DEBUG)
- ASSERT_MESSAGE(index < size(), "array index out of bounds");
-#endif
- return m_data[index];
- }
- value_type& operator()(std::size_t x, std::size_t y)
- {
-#if defined(_DEBUG)
- ASSERT_MESSAGE(x < m_x && y < m_y, "array index out of bounds");
-#endif
- return m_data[x * m_y + y];
- }
- const value_type& operator()(std::size_t x, std::size_t y) const
- {
-#if defined(_DEBUG)
- ASSERT_MESSAGE(x < m_x && y < m_y, "array index out of bounds");
-#endif
- return m_data[x * m_y + y];
- }
- value_type* data()
- {
- return m_data;
- }
- const value_type* data() const
- {
- return m_data;
- }
- std::size_t x() const
- {
- return m_x;
- }
- std::size_t y() const
- {
- return m_y;
- }
- std::size_t size() const
- {
- return m_x * m_y;
- }
- bool empty() const
- {
- return m_x == 0;
- }
-};
-
-class PatchControl
-{
-public:
- Vector3 m_vertex;
- Vector2 m_texcoord;
-};
-
-typedef Matrix<PatchControl> PatchControlMatrix;
-
-
-class PatchCreator
-{
-public:
- INTEGER_CONSTANT(Version, 1);
- STRING_CONSTANT(Name, "patch");
- virtual scene::Node& createPatch() = 0;
- virtual void Patch_undoSave(scene::Node& patch) const = 0;
- virtual void Patch_resize(scene::Node& patch, std::size_t width, std::size_t height) const = 0;
- virtual PatchControlMatrix Patch_getControlPoints(scene::Node& patch) const = 0;
- virtual void Patch_controlPointsChanged(scene::Node& patch) const = 0;
- virtual const char* Patch_getShader(scene::Node& patch) const = 0;
- virtual void Patch_setShader(scene::Node& patch, const char* shader) const = 0;
-};
-
-#include "modulesystem.h"
-
-template<typename Type>
-class ModuleRef;
-typedef ModuleRef<PatchCreator> PatchModuleRef;
-
-template<typename Type>
-class GlobalModule;
-typedef GlobalModule<PatchCreator> GlobalPatchModule;
-
-template<typename Type>
-class GlobalModuleRef;
-typedef GlobalModuleRef<PatchCreator> GlobalPatchModuleRef;
-
-inline PatchCreator& GlobalPatchCreator()
-{
- return GlobalPatchModule::getTable();
-}