Example #1
0
 private bool parseModifier(SunflowAPI api)
 {
     p.checkNextToken("{");
     p.checkNextToken("name");
     string name = p.getNextToken();
     UI.printInfo(UI.Module.API, "Reading shader: {0} ...", name);
     p.checkNextToken("type");
     if (p.peekNextToken("bump"))
     {
         p.checkNextToken("texture");
         api.parameter("texture", p.getNextToken());
         p.checkNextToken("scale");
         api.parameter("scale", p.getNextFloat());
         api.modifier(name, new BumpMappingModifier());
     }
     else if (p.peekNextToken("normalmap"))
     {
         p.checkNextToken("texture");
         api.parameter("texture", p.getNextToken());
         api.modifier(name, new NormalMapModifier());
     }
     else
     {
         UI.printWarning(UI.Module.API, "Unrecognized modifier type: {0}", p.getNextToken());
     }
     p.checkNextToken("}");
     return true;
 }