#include <vector>
#include <string>
+#include <boost/tr1/unordered_map.hpp>
-#include <boost/unordered_map.hpp>
+#include <boost/functional/hash.hpp>
#include <osg/Object>
#include <osgDB/ReaderWriter>
{
class Technique;
class Effect;
+class SGReaderWriterXMLOptions;
/**
* Object to be initialized at some point after an effect -- and its
Effect(const Effect& rhs,
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
osg::StateSet* getDefaultStateSet();
+
+ // Define what needs to be generated for this effect
+ enum Generator
+ {
+ NORMAL,
+ TANGENT,
+ BINORMAL
+ };
+ void setGenerator(Generator what, int where) { generator[what] = where; }
+ int getGenerator(Generator what) const; // Returns -1 if generator should not be used
+ std::map<Generator, int> generator; // What is generated into which attribute location
+
std::vector<osg::ref_ptr<Technique> > techniques;
SGPropertyNode_ptr root;
// Pointer to the parameters node, if it exists
/**
* Build the techniques from the effect properties.
*/
- bool realizeTechniques(const osgDB::ReaderWriter::Options* options = 0);
+ bool realizeTechniques(const SGReaderWriterXMLOptions* options = 0);
/**
* Updaters that should be derefed when the effect is
* deleted. Updaters arrange to be run by listening on properties
bool operator()(const Key& lhs, const Key& rhs) const;
};
};
- typedef boost::unordered_map<Key, osg::ref_ptr<Effect>, boost::hash<Key>,
- Key::EqualTo> Cache;
+ typedef std::tr1::unordered_map<Key, osg::ref_ptr<Effect>,
+ boost::hash<Key>, Key::EqualTo> Cache;
Cache* getCache()
{
if (!_cache)
Cache* _cache;
friend size_t hash_value(const Key& key);
friend Effect* makeEffect(SGPropertyNode* prop, bool realizeTechniques,
- const osgDB::ReaderWriter::Options* options);
+ const SGReaderWriterXMLOptions* options);
bool _isRealized;
};
// Automatic support for boost hash function
Effect* makeEffect(const std::string& name,
bool realizeTechniques,
- const osgDB::ReaderWriter::Options* options = 0);
+ const SGReaderWriterXMLOptions* options = 0);
Effect* makeEffect(SGPropertyNode* prop,
bool realizeTechniques,
- const osgDB::ReaderWriter::Options* options = 0);
+ const SGReaderWriterXMLOptions* options = 0);
bool makeParametersFromStateSet(SGPropertyNode* paramRoot,
const osg::StateSet* ss);