Mercurial > hg > forks > gldragon
changeset 33:2e85c180afdf
Add support for specifying shader file filenames in the scene for each model.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Nov 2019 23:11:02 +0200 |
parents | 1215fdd0a8ab |
children | c0b85b0615d2 |
files | dmmodel.cpp |
diffstat | 1 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dmmodel.cpp Fri Nov 22 22:57:14 2019 +0200 +++ b/dmmodel.cpp Fri Nov 22 23:11:02 2019 +0200 @@ -664,7 +664,7 @@ DMModel newmodel; if (tokens.size() != 2) { - return dmError(info, + return dmSyntaxError(info, "Keyword model expects a filename argument"); } @@ -674,6 +674,30 @@ info.state = 1; } else + if (info.state == 1 && (key == "shaderfile")) + { + if (tokens.size() != 3) + { + return dmSyntaxError(info, + "Keyword shaderfile expects shader type (fs, vs) and filename arguments"); + } + + std::string + &shtype = tokens[1], + &shfile = tokens[2]; + + if (shtype == "fs") + model->fragShaderFile = shfile; + else + if (shtype == "vs") + model->vertShaderFile = shfile; + else + { + return dmSyntaxError(info, + "Invalid shaderfile type '"+ shtype +"'"); + } + } + else if (info.state == 1 && (key == "translate" || key == "rotate" || key == "scale")) { DMVector3 vec; @@ -709,7 +733,7 @@ { if (tokens.size() != 2) { - return dmError(info, + return dmSyntaxError(info, "Expected argument for shininess"); }