Definition in file primitive_configuration.cpp.
#include <nel/ligo/primitive_configuration.h>
#include <nel/ligo/ligo_config.h>
#include <nel/ligo/primitive.h>
#include <nel/misc/i_xml.h>
Go to the source code of this file.
Functions | |
| bool | ReadColor (CRGBA &color, xmlNodePtr node) |
|
||||||||||||
|
Definition at line 91 of file primitive_class.cpp. References NLMISC::clamp(), DEFAULT_PRIMITIVE_COLOR, r, NLLIGO::ReadFloat(), and uint8. Referenced by NLLIGO::CPrimitiveConfigurations::read(), and NLLIGO::CPrimitiveClass::read().
00092 {
00093 // Read the color
00094 float r = DEFAULT_PRIMITIVE_COLOR.R;
00095 float g = DEFAULT_PRIMITIVE_COLOR.G;
00096 float b = DEFAULT_PRIMITIVE_COLOR.B;
00097 float a = DEFAULT_PRIMITIVE_COLOR.A;
00098
00099 // Read the value
00100 if (!ReadFloat ("R", r, node))
00101 return false;
00102 if (!ReadFloat ("G", g, node))
00103 return false;
00104 if (!ReadFloat ("B", b, node))
00105 return false;
00106 if (!ReadFloat ("A", a, node))
00107 a = 255;
00108
00109 // Clamp
00110 clamp (r, 0.f, 255.f);
00111 clamp (g, 0.f, 255.f);
00112 clamp (b, 0.f, 255.f);
00113 clamp (a, 0.f, 255.f);
00114
00115 // Set
00116 color.set((uint8)r, (uint8)g, (uint8)b, (uint8)a);
00117 return true;
00118 }
|
1.3.6