Skip to content
Snippets Groups Projects
Commit e6ca645a authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

fixed color problem in map iso; removed predefined colors in C++

parent 269e5b28
Branches
Tags
No related merge requests found
......@@ -26,12 +26,12 @@
namespace ost { namespace gfx {
Color::Color(int code)
Color::Color(uint code)
{
rgba[0]=static_cast<float>((code>>16)&0xff)/255.0;
rgba[1]=static_cast<float>((code>>8)&0xff)/255.0;
rgba[2]=static_cast<float>(code&0xff)/255.0;
rgba[3]=1.0;
rgba[0]=static_cast<float>((code>>24)&0xff)/255.0;
rgba[1]=static_cast<float>((code>>16)&0xff)/255.0;
rgba[2]=static_cast<float>((code>>8)&0xff)/255.0;
rgba[3]=static_cast<float>((code)&0xff)/255.0;
}
std::ostream& operator<<(std::ostream& s, const Color& c)
......
......@@ -51,21 +51,7 @@ public:
rgba[3]=a;
}
enum COLOR_NAME {
WHITE=0xffffff,
LIGHT_GREY=0xaaaaff,
GREY=0x999999ff,
DARK_GREY=0x333333ff,
BLACK=0x000000,
RED=0xff0000,
GREEN=0x00ff00,
BLUE=0x0000ff,
CYAN=0x00ffff,
MAGENTA=0xff00ff,
YELLOW=0xffff00
};
Color(int hex_code);
explicit Color(uint hex_code);
float& Red() {return rgba[0];}
const float& Red() const {return rgba[0];}
......
......@@ -59,38 +59,6 @@ namespace ost {
namespace gfx {
MapIso::MapIso(const String& name, const img::MapHandle& mh, float level):
GfxObj(name),
original_mh_(mh),
downsampled_mh_(),
mh_(MapIso::DownsampleMap(mh)),
octree_(mh_),
stat_calculated_(false),
histogram_calculated_(false),
histogram_bin_count_(100),
level_(level),
normals_calculated_(false),
alg_(0),
smoothf_(0.2),
debug_octree_(false),
color_(Color::GREY)
{
// TODO replace with def mat for this gfx obj type
if (mh_ != original_mh_) {
downsampled_mh_ = mh_;
}
octree_.Initialize();
SetMatAmb(Color(0,0,0));
SetMatDiff(Color(1,1,1));
SetMatSpec(Color(0.1,0.1,0.1));
SetMatShin(32);
mol::Transform tf=this->GetTF();
tf.SetCenter(this->GetCenter());
tf.SetTrans(this->GetCenter());
this->SetTF(tf);
Rebuild();
}
MapIso::MapIso(const String& name, const img::MapHandle& mh,
float level, uint a):
GfxObj(name),
......@@ -105,7 +73,7 @@ MapIso::MapIso(const String& name, const img::MapHandle& mh,
normals_calculated_(false),
alg_(a),
debug_octree_(false),
color_(Color::GREY)
color_(1.0,1.0,1.0)
{
// TODO replace with def mat for this gfx obj type
if (mh_ != original_mh_) {
......
......@@ -51,10 +51,7 @@ typedef boost::shared_ptr<MapIso> MapIsoP;
/// \sa gfx::MapSlab
class DLLEXPORT_OST_GFX MapIso: public GfxObj {
public:
MapIso(const String& name, const img::MapHandle& mh,float level);
MapIso(const String& name, const img::MapHandle& mh,
float level, uint a);
MapIso(const String& name, const img::MapHandle& mh,float level, uint a=0);
virtual geom::AlignedCuboid GetBoundingBox() const;
......
......@@ -30,8 +30,8 @@
namespace ost { namespace gfx {
Primitive::Primitive(const String& name):
GfxNode(name), fill_(true), line_(true), outline_color_(gfx::Color::WHITE),
fill_color_(gfx::Color::LIGHT_GREY), line_width_(1.0)
GfxNode(name), fill_(true), line_(true), outline_color_(1.0,1.0,1.0),
fill_color_(0.8,0.8,0.8), line_width_(1.0)
{
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment