X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftechnique.h;h=7c384f469bb0084770191484e4bcea315691efc6;hb=f9b2b3330ad7234721ad3f971a7cbc0226a017d7;hp=410e7fb46928ad812cfe39187557fbe984647a6c;hpb=be74989b0300adecc0062f701ff987cf79d1935a;p=libs%2Fgl.git diff --git a/source/technique.h b/source/technique.h index 410e7fb4..7c384f46 100644 --- a/source/technique.h +++ b/source/technique.h @@ -1,72 +1,58 @@ /* $Id$ This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Copyright © 2008-2011 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ #ifndef TECHNIQUE_H_ #define TECHNIQUE_H_ -#include "objectpass.h" +#include "renderpass.h" +#include "tag.h" namespace Msp { namespace GL { class Material; -class Tag; class Texture; /** -Stores a complete multipass rendering technique for an Object. This includes -shaders, textures and a material. A Technique can also specify empty texture -slots which Objects must override. */ class Technique { public: - class Loader: public Msp::DataFile::Loader + class Loader: public Msp::DataFile::CollectionObjectLoader { public: - typedef DataFile::Collection Collection; - - protected: - Technique &tech; - Collection &coll; - - public: + Loader(Technique &); Loader(Technique &, Collection &); - Technique &get_object() const { return tech; } - Collection &get_collection() const { return coll; } private: - virtual void finish(); - void material_inline(); + void init(); + void inherit(const std::string &); void pass(const std::string &); - void shader(const std::string &); - void shader_texture(const std::string &); - void texture(const std::string &); - void texture_slot(const std::string &); }; private: - std::vector tex_names; - std::vector textures; - const Texture *main_texture; - std::map passes; - ObjectPass *normal_pass; - const Material *material; + class InheritLoader: public Msp::DataFile::CollectionObjectLoader + { + public: + InheritLoader(Technique &, Collection &); + + private: + void texture(const std::string &, const std::string &); + }; -public: - Technique(); - ~Technique(); + typedef std::map PassMap; + PassMap passes; + +public: + RenderPass &add_pass(const GL::Tag &); bool has_pass(const GL::Tag &) const; - const ObjectPass &get_pass(const GL::Tag &) const; - unsigned get_n_textures() const { return tex_names.size(); } - unsigned get_texture_index(const std::string &) const; - const Texture *get_texture(unsigned) const; - const Material *get_material() const { return material; } + const RenderPass &get_pass(const GL::Tag &) const; + const PassMap &get_passes() const { return passes; } }; } // namespace GL