lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is very interesting, but if i were to use this i would need a way of coupling the input of a shader with the actual shader. the shader code itself is half the battle.

On Mon, Apr 26, 2010 at 9:20 AM, Wesley Smith <wesley.hoke@gmail.com> wrote:
I've been using Lua to manage GLSL files for a while as well.  For my
needs, I wanted the files to have a more data description feel, which
Lua does nicely.  The functions in the file end up calling into C++
with the entire file returning a C++ object representing a shader.
Here's what a Lua file looks like:

http://www.mat.ucsb.edu/projects/luaAV/browser/branches/luaav3/extra/resources/shaders/material/mat.phong.shl

Shader{
       name = "mat.phong.shl",
       description = [[ per-pixel lighting model ]],
       language = "GLSL",

       parameters = {
               Parameter {
                       {0., 0., 0., 1.},
                       name = "La", type = "vec4",
                       description = "ambient light",
               },

.... continues ....

For handling GLSL 120 v. 130, I would probably add a version field to
the description.  Anyway, hope this provides food for thought.  Thanks
for the article!

wes