What are you thoughts on this implementation? Do you have suggestions for improvements or perhaps an entirely different system? S.SetParameter(ShaderParam::Generic::position(), Vec4()) S.SetParameter(ShaderParam::Generic::projection(), Mat4()) MY_PARAMETER( Generic, Mat4, projection ) Private: static const char* ShaderParameterStr#shader#type#name#() \ Shaderparameters.inl: #define MY_PARAMETER(shader, type, name) \ If(program != -1 & Param::program != program)Ĭonst char* Shader::Parameter::name = Name() static_assert(!std::is_same::value, "Unsupported type, needs specialization.") Void SetParameter(const Parameter&, const Type& value ) I could potentially move the Name out of the template parameters for Parameter and store it as a member variable, which would get assigned in the default constructor. There is a lot of potential for code bloat. There's really only one place this can go wrong: if you mistype the name of the uniform when defining it. Some design goals I aimed for is to avoid passing a string to a function as this is error prone and has no type checking. For now, I'm just trying to get basic outline for handling uniforms.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |