ATLAS Offline Software
Loading...
Searching...
No Matches
VP1ColorUtils Class Reference

#include <VP1ColorUtils.h>

Collaboration diagram for VP1ColorUtils:

Static Public Member Functions

static void setMatColorFromRGB (SoMaterial *mat, const std::string &type, const unsigned int r, const unsigned int g, const unsigned int b)
static SbColor getSbColorFromRGB (const unsigned int r, const unsigned int g, const unsigned int b)
static float getValFromRGB (const unsigned int rgb)

Detailed Description

Definition at line 25 of file VP1ColorUtils.h.

Member Function Documentation

◆ getSbColorFromRGB()

SbColor VP1ColorUtils::getSbColorFromRGB ( const unsigned int r,
const unsigned int g,
const unsigned int b )
static

Definition at line 46 of file VP1ColorUtils.cxx.

47{
48 const float fr = getValFromRGB(r);
49 const float fg = getValFromRGB(g);
50 const float fb = getValFromRGB(b);
51 return SbColor(fr, fg, fb);
52}
static float getValFromRGB(const unsigned int rgb)
int r
Definition globals.cxx:22

◆ getValFromRGB()

float VP1ColorUtils::getValFromRGB ( const unsigned int rgb)
static

Definition at line 18 of file VP1ColorUtils.cxx.

19{
20 if (rgb > 255) {
21 std::cout << "ERROR! RGB color value is expected in the the range [0,255]. Here we get: " << rgb << ". Exiting..." << std::endl;
22 std::exit(EXIT_FAILURE);
23 }
24 return rgb/255.0;
25}

◆ setMatColorFromRGB()

void VP1ColorUtils::setMatColorFromRGB ( SoMaterial * mat,
const std::string & type,
const unsigned int r,
const unsigned int g,
const unsigned int b )
static

Definition at line 27 of file VP1ColorUtils.cxx.

28{
29 const float fr = getValFromRGB(r);
30 const float fg = getValFromRGB(g);
31 const float fb = getValFromRGB(b);
32 if (type == "ambient")
33 mat->ambientColor.setValue(fr, fg, fb);
34 else if (type == "diffuse")
35 mat->diffuseColor.setValue(fr, fg, fb);
36 else if (type == "specular")
37 mat->specularColor.setValue(fr, fg, fb);
38 else
39 std::cout << "ERROR! Color type not supported ==> " << type << std::endl;
40
41 // Debug Msg
42 //std::cout << "Set color (" << r << "," << g << "," << b << ") to (" << fr << "," << fg << "," << fb << ")" << std::endl;
43 return;
44}

The documentation for this class was generated from the following files: