//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- Color4ub::Color4ub(const Color4f& other) { m_rgba[0] = static_cast<ubyte>(other.r()*255.0f); m_rgba[1] = static_cast<ubyte>(other.g()*255.0f); m_rgba[2] = static_cast<ubyte>(other.b()*255.0f); m_rgba[3] = static_cast<ubyte>(other.a()*255.0f); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void UniformFloat::set(const Color4f& value) { m_type = FLOAT_VEC4; m_data.resize(4); m_data[0] = value.r(); m_data[1] = value.g(); m_data[2] = value.b(); m_data[3] = value.a(); }
void Triangle::draw(const Color4f& _color) const { glColor4f(_color.r(),_color.g(),_color.b(),_color.a()); glBegin(GL_TRIANGLES); glNormal3f(COORDS(n_)); glVertex3f(COORDS(v0())); glVertex3f(COORDS(v1())); glVertex3f(COORDS(v2())); glEnd(); }
void VertexTriangle::draw(const Color4f& _color) const { glColor4f(_color.r(),_color.g(),_color.b(),_color.a()); glBegin(GL_TRIANGLES); glNormal3f(COORDS(v[0]->n)); glVertex3f(COORDS(v[0]->v)); glNormal3f(COORDS(v[1]->n)); glVertex3f(COORDS(v[1]->v)); glNormal3f(COORDS(v[2]->n)); glVertex3f(COORDS(v[2]->v)); glEnd(); }
void ColorTest::access() { Color3f c3(15, 255, 10); const Color3f cc3(15, 255, 10); CORRADE_COMPARE(c3.r(), 15); CORRADE_COMPARE(c3.g(), 255); CORRADE_COMPARE(c3.b(), 10); CORRADE_COMPARE(cc3.r(), 15); CORRADE_COMPARE(cc3.g(), 255); CORRADE_COMPARE(cc3.b(), 10); Color4 c4(125, 98, 51, 22); const Color4f cc4(125, 98, 51, 22); CORRADE_COMPARE(c4.r(), 125); CORRADE_COMPARE(c4.g(), 98); CORRADE_COMPARE(c4.b(), 51); CORRADE_COMPARE(c4.a(), 22); CORRADE_COMPARE(cc4.r(), 125); CORRADE_COMPARE(cc4.g(), 98); CORRADE_COMPARE(cc4.b(), 51); CORRADE_COMPARE(cc4.a(), 22); }