From 5b2df63f54819a0023f9e3d7128b2ee5d4a8ecf2 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 26 Mar 2002 16:10:53 +0000 Subject: [PATCH] Patches from Melchior Franz: The first hunk might not be necessary, but the light_coverage property was the only one that wasn't explicitly defaulted, which is unfair. ;-) The second hunk adds the missing initialization to the init routine. This is necessary, because (unlike the material entries from material.xml) the generated light entries don't get the light coverage set. Yet obj.cxx:795 reads this information out fot every leaf, although not needed in the case of lights. Avoiding this isn't worth the trouble. The last hunk sets the missing normal_index. The POINTS branch in gen_leaf was always called with this int_list empty, which made the normals handling use data garbage. --- src/Objects/newmat.cxx | 3 ++- src/Objects/obj.cxx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Objects/newmat.cxx b/src/Objects/newmat.cxx index dab03e1eb..9d11efa97 100644 --- a/src/Objects/newmat.cxx +++ b/src/Objects/newmat.cxx @@ -119,7 +119,7 @@ FGNewMat::read_properties (const SGPropertyNode * props) wrapu = props->getBoolValue("wrapu", true); wrapv = props->getBoolValue("wrapv", true); mipmap = props->getBoolValue("mipmap", true); - light_coverage = props->getDoubleValue("light-coverage"); + light_coverage = props->getDoubleValue("light-coverage", 0.0); ambient[0] = props->getDoubleValue("ambient/r", 0.0); ambient[1] = props->getDoubleValue("ambient/g", 0.0); @@ -160,6 +160,7 @@ FGNewMat::init () wrapu = true; wrapv = true; mipmap = true; + light_coverage = 0.0; texture_loaded = false; refcount = 0; for (int i = 0; i < 4; i++) diff --git a/src/Objects/obj.cxx b/src/Objects/obj.cxx index 5ad88014a..dba84040c 100644 --- a/src/Objects/obj.cxx +++ b/src/Objects/obj.cxx @@ -942,6 +942,7 @@ bool fgBinObjLoad( const string& path, const bool is_base, material = tmp_mat; } vertex_index = pts_v[i]; + normal_index = pts_n[i]; tex_index.clear(); ssgLeaf *leaf = gen_leaf( path, GL_POINTS, material, nodes, normals, texcoords,