From 89cfd47bdf4c425e7a87613f8960d3c1513fb492 Mon Sep 17 00:00:00 2001 From: diiigle Date: Mon, 6 Jan 2014 13:24:56 +0100 Subject: [PATCH] Add loading of alpha and emissive materials --- code/LDrawImporter.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/code/LDrawImporter.cpp b/code/LDrawImporter.cpp index 3f25e33b7..058924c4f 100644 --- a/code/LDrawImporter.cpp +++ b/code/LDrawImporter.cpp @@ -178,8 +178,20 @@ void LDrawImporter::ReadMaterials(std::string filename){ edge.b = HexOctetToDecimal(cmd); cmd += 2; edge = edge * (1 / 255.0f); - //TODO ALPHA and LUMINANCE - LDrawMaterial mat = LDrawMaterial(name,code, value, edge); + + LDrawMaterial mat = LDrawMaterial(name, code, value, edge); + SkipSpaces(&cmd); + if (TokenMatchI(cmd, "alpha", 5)){ + SkipSpaces(&cmd); + unsigned int al = strtoul10(cmd, &cmd); + mat.alpha = float(al) / 255.0f; + } + SkipSpaces(&cmd); + if (TokenMatchI(cmd, "luminance", 9)){ + SkipSpaces(&cmd); + unsigned int l = strtoul10(cmd, &cmd); + mat.luminance = float(l) / 255.0f; + } materials.insert(std::pair(code, mat)); } }