X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftechnique.h;h=f80e2f6144e0f59d32bade49829c721df5b15d27;hp=3bb347ea4c98b9bb535cf132ec68dbb429383b4c;hb=a993091fbb8fdb76a1d02be9de59529c14b59cf0;hpb=927a1aa0a3a27e463ec0efc08bd08e7c4e969909 diff --git a/source/technique.h b/source/technique.h index 3bb347ea..f80e2f61 100644 --- a/source/technique.h +++ b/source/technique.h @@ -1,26 +1,17 @@ -/* $Id$ +#ifndef MSP_GL_TECHNIQUE_H_ +#define MSP_GL_TECHNIQUE_H_ -This file is part of libmspgl -Copyright © 2007 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. +Ties multiple tagged render passes together. */ class Technique { @@ -28,46 +19,42 @@ public: class Loader: public Msp::DataFile::CollectionObjectLoader { public: + Loader(Technique &); Loader(Technique &, Collection &); 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: - struct TextureSlot + class InheritLoader: public Msp::DataFile::CollectionObjectLoader { - std::string name; - const Texture *texture; + public: + InheritLoader(Technique &, Collection &); - TextureSlot(): texture(0) { } + private: + void material(const std::string &, const std::string &); + void texture(const std::string &, const std::string &); + void uniforms(); }; - typedef std::map PassMap; +public: + typedef std::map PassMap; - std::vector textures; - const Texture *main_texture; +private: PassMap passes; - ObjectPass *normal_pass; - const Material *material; public: - Technique(); - ~Technique(); - - bool has_pass(const GL::Tag &) const; - const ObjectPass &get_pass(const GL::Tag &) const; - unsigned get_n_textures() const { return textures.size(); } - unsigned get_texture_index(const std::string &) const; - const Texture *get_texture(unsigned) const; - const Texture *get_main_texture() const { return main_texture; } - const Material *get_material() const { return material; } + RenderPass &add_pass(const Tag &); + bool has_pass(const Tag &) const; + const RenderPass &get_pass(const Tag &) const; + const PassMap &get_passes() const { return passes; } + bool replace_texture(const std::string &, const Texture &); + bool replace_material(const std::string &, const Material &); + bool replace_uniforms(const ProgramData &); + bool has_shaders() const; }; } // namespace GL