mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-01 06:17:58 +03:00
Imported Upstream version 0.26.0
This commit is contained in:
commit
9a2b6c69b6
1398 changed files with 212217 additions and 0 deletions
71
extern/shiny/Main/ShaderInstance.hpp
vendored
Normal file
71
extern/shiny/Main/ShaderInstance.hpp
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
#ifndef SH_SHADERINSTANCE_H
|
||||
#define SH_SHADERINSTANCE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Platform.hpp"
|
||||
|
||||
namespace sh
|
||||
{
|
||||
class ShaderSet;
|
||||
|
||||
typedef std::map< std::string, std::pair<std::string, ValueType > > UniformMap;
|
||||
|
||||
struct Passthrough
|
||||
{
|
||||
Language lang; ///< language to generate for
|
||||
|
||||
int num_components; ///< e.g. 4 for a float4
|
||||
|
||||
int passthrough_number;
|
||||
int component_start; ///< 0 = x
|
||||
|
||||
std::string expand_assign(std::string assignTo);
|
||||
std::string expand_receive();
|
||||
};
|
||||
typedef std::map<std::string, Passthrough> PassthroughMap;
|
||||
|
||||
/**
|
||||
* @brief A specific instance of a \a ShaderSet with a deterministic shader source
|
||||
*/
|
||||
class ShaderInstance
|
||||
{
|
||||
public:
|
||||
ShaderInstance (ShaderSet* parent, const std::string& name, PropertySetGet* properties);
|
||||
|
||||
std::string getName();
|
||||
|
||||
bool getSupported () const;
|
||||
|
||||
std::vector<std::string> getUsedSamplers();
|
||||
std::vector<std::string> getSharedParameters() { return mSharedParameters; }
|
||||
|
||||
void setUniformParameters (boost::shared_ptr<Pass> pass, PropertySetGet* properties);
|
||||
|
||||
private:
|
||||
boost::shared_ptr<GpuProgram> mProgram;
|
||||
std::string mName;
|
||||
ShaderSet* mParent;
|
||||
bool mSupported; ///< shader compilation was sucessful?
|
||||
|
||||
std::vector<std::string> mUsedSamplers;
|
||||
///< names of the texture samplers that are used by this shader
|
||||
|
||||
std::vector<std::string> mSharedParameters;
|
||||
|
||||
UniformMap mUniformProperties;
|
||||
///< uniforms that this depends on, and their property names / value-types
|
||||
/// @note this lists shared uniform parameters as well
|
||||
|
||||
int mCurrentPassthrough; ///< 0 - x
|
||||
int mCurrentComponent; ///< 0:x, 1:y, 2:z, 3:w
|
||||
|
||||
PassthroughMap mPassthroughMap;
|
||||
|
||||
std::vector<std::string> extractMacroArguments (size_t pos, const std::string& source); ///< take a macro invocation and return vector of arguments
|
||||
|
||||
void parse (std::string& source, PropertySetGet* properties);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue