1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-21 23:01:45 +08:00

ovis: consistently use 0..1 value range for colors

matches Ogre and makes more sense given float render targets are possible.
This commit is contained in:
Pavel Rojtberg
2021-12-22 14:15:52 +01:00
parent f31d203452
commit 0ad33e776b

View File

@@ -168,12 +168,10 @@ static SceneNode& _getSceneNode(SceneManager* sceneMgr, const String& name)
return *mo->getParentSceneNode(); return *mo->getParentSceneNode();
} }
/// BGR to RGB 0..1
static ColourValue convertColor(const Scalar& val) static ColourValue convertColor(const Scalar& val)
{ {
// BGR 0..255 (uchar) to RGB 0..1 return ColourValue(val[2], val[1], val[0]).saturateCopy();
ColourValue ret = ColourValue(val[2], val[1], val[0]) / 255;
ret.saturate();
return ret;
} }
class WindowSceneImpl; class WindowSceneImpl;
@@ -614,9 +612,8 @@ public:
const Scalar& specularColour) CV_OVERRIDE const Scalar& specularColour) CV_OVERRIDE
{ {
Light* light = sceneMgr->createLight(name); Light* light = sceneMgr->createLight(name);
// convert to BGR light->setDiffuseColour(convertColor(diffuseColour));
light->setDiffuseColour(ColourValue(diffuseColour[2], diffuseColour[1], diffuseColour[0])); light->setSpecularColour(convertColor(specularColour));
light->setSpecularColour(ColourValue(specularColour[2], specularColour[1], specularColour[0]));
Quaternion q; Quaternion q;
Vector3 t; Vector3 t;