From becd0aa416c1467c916e7fb1280f079b1c326133 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 11 Jan 2016 18:23:52 +0100 Subject: [PATCH] Return diffuse color for get_base_color if neither base color nor metallic have been specified --- panda/src/gobj/material.I | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/panda/src/gobj/material.I b/panda/src/gobj/material.I index 8ab3ab183c..e41362a1d2 100644 --- a/panda/src/gobj/material.I +++ b/panda/src/gobj/material.I @@ -67,7 +67,7 @@ get_default() { //////////////////////////////////////////////////////////////////// // Function: Material::has_base_color // Access: Published -// Description: Returns true if the base_color color has been explicitly +// Description: Returns true if the base color has been explicitly // set for this material, false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool Material:: @@ -79,12 +79,16 @@ has_base_color() const { // Function: Material::get_base_color // Access: Published // Description: Returns the base_color color setting, if it has been -// set. Returns (0,0,0,0) if the base_color color has not -// been set. +// set. If neither the base color nor the metallic +// have been set, this returns the diffuse color. //////////////////////////////////////////////////////////////////// INLINE const LColor &Material:: get_base_color() const { - return _base_color; + if (!has_base_color() && !has_metallic()) { + return _diffuse; + } else { + return _base_color; + } } ////////////////////////////////////////////////////////////////////