From 7e37a9a64d8302fae5756f069bc1565e6d3525d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 13 Dec 2011 15:24:47 +0100 Subject: [PATCH] Base class for materials. Material is just a shader with some user-defined uniform values, so why not have class for it. --- src/AbstractMaterial.h | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/AbstractMaterial.h diff --git a/src/AbstractMaterial.h b/src/AbstractMaterial.h new file mode 100644 index 000000000..96ab820a5 --- /dev/null +++ b/src/AbstractMaterial.h @@ -0,0 +1,46 @@ +#ifndef Magnum_AbstractMaterial_h +#define Magnum_AbstractMaterial_h +/* + Copyright © 2010, 2011 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +/** @file + * @brief Class Magnum::AbstractMaterial + */ + +#include "Magnum.h" + +namespace Magnum { + +/** @brief Base class for materials */ +class AbstractMaterial { + AbstractMaterial(const AbstractMaterial& other) = delete; + AbstractMaterial(AbstractMaterial&& other) = delete; + AbstractMaterial& operator=(const AbstractMaterial& other) = delete; + AbstractMaterial& operator=(AbstractMaterial&& other) = delete; + + public: + AbstractMaterial() = default; + + /** + * @brief Use material + * + * Uses associated shader and sets uniforms. + */ + virtual bool use(const Matrix4& transformationMatrix, const Matrix4& projectionMatrix) = 0; +}; + +} + +#endif