virtual ~invalid_variable_definition() throw() { }
};
+/**
+Generates shaders with common features.
+*/
class ProgramBuilder
{
public:
+ /**
+ Describes the features of a standard shader program.
+ */
struct StandardFeatures
{
class Loader: public DataFile::ObjectLoader<StandardFeatures>
bool material;
bool lighting;
unsigned max_lights;
+ bool skylight;
bool specular;
bool normalmap;
bool shadow;
enum VariableScope
{
NO_SCOPE,
+ TYPE,
UNIFORM,
ATTRIBUTE,
VERTEX,
{
std::string name;
const VariableDefinition *variable;
+ const VariableDefinition *type;
std::string resolved_name;
+ std::string resolved_block;
bool fuzzy_space;
std::string resolved_space;
bool array_sum;
void resolve(const VariableDefinition &);
void resolve(ShaderVariable &);
+ void resolve_type(const VariableDefinition &);
void resolve_space(const std::string &);
void resolve_array(const StandardFeatures &, unsigned = 0);
void add_reference(ShaderVariable &);
void check_inline(bool, bool);
bool is_referenced_from(VariableScope) const;
InterfaceFlags get_interface_flags(VariableScope) const;
+ std::string create_type_declaration() const;
std::string create_declaration(char = 0, bool = false) const;
std::string create_replacement(VariableScope, const char * = 0) const;
std::string create_expression(const char * = 0) const;
private:
std::string create_source(const std::list<ShaderVariable *> &, VariableScope) const;
bool evaluate_flags(const char *) const;
+ static const char *unqualified_name(const char *);
static MatchType name_match(const char *, const char *, const char ** = 0);
static bool parse_identifier(const char *, unsigned &, unsigned &);
static std::vector<std::string> extract_identifiers(const char *);