コード例 #1
0
ファイル: Color3f.cpp プロジェクト: 4og/guacamole
Color3f operator-(Color3f const& lhs, Color3f const& rhs) {
  Color3f result;
  result.r(lhs.r() - rhs.r());
  result.g(lhs.g() - rhs.g());
  result.b(lhs.b() - rhs.b());
  return result;
}
コード例 #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
TEST(VariantTest, TypeColor3f)
{
    const Color3f val(0.2f, 0.2f, 0.3f);
    Variant var(val);
    ASSERT_EQ(Variant::COLOR3F, var.type());
    ASSERT_TRUE(var.isValid());

    Color3f v = var.getColor3f();
    ASSERT_EQ(val.r(), v.r());
    ASSERT_EQ(val.g(), v.g());
    ASSERT_EQ(val.b(), v.b());
}
コード例 #3
0
ファイル: cvfColor4.cpp プロジェクト: akva2/ResInsight
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
Color4f::Color4f(const Color3f& rgbColor, float alpha)
{
    m_rgba[0] = rgbColor.r();
    m_rgba[1] = rgbColor.g();
    m_rgba[2] = rgbColor.b();
    m_rgba[3] = alpha;
}
コード例 #4
0
ファイル: cvfColor4.cpp プロジェクト: akva2/ResInsight
//--------------------------------------------------------------------------------------------------
/// Construct from 3 component RGB color. Alpha value will be set to 1.0
//--------------------------------------------------------------------------------------------------
Color4f::Color4f(const Color3f& rgbColor)
{
    m_rgba[0] = rgbColor.r();
    m_rgba[1] = rgbColor.g();
    m_rgba[2] = rgbColor.b();
    m_rgba[3] = 1.0f;
}
コード例 #5
0
ファイル: cvfUniform.cpp プロジェクト: akva2/ResInsight
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void UniformFloat::set(const Color3f& value)
{
    m_type = FLOAT_VEC3;
    m_data.resize(3);
    m_data[0] = value.r();
    m_data[1] = value.g();
    m_data[2] = value.b();
}
コード例 #6
0
void FrameBufferObject::
clear_color_buffers(RenderContext const& ctx, Color3f const& color) {

    if (ctx.id < fbos_.size())
        ctx.render_context->clear_color_buffers(
                                fbos_[ctx.id], math::vec4(color.r(), color.g(),
                                                          color.b(), 0.f));
}
コード例 #7
0
void ShaderProgram::
set_color3f(RenderContext const& context, std::string const& color_name,
            Color3f const& color) {

    if (programs_.size() > context.id)
        programs_[context.id]->uniform(
                    color_name, math::vec3(color.r(), color.g(), color.b()));
}
コード例 #8
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
String PropertyXmlSerializer::valueTextFromColor3fVariant(const Variant& variant)
{
    CVF_ASSERT(variant.type() == Variant::COLOR3F);
    Color3f val = variant.getColor3f();

    String txt =  String::number(val.r()) + " " + String::number(val.g()) + " " + String::number(val.b());
    return txt;
}
コード例 #9
0
ファイル: ColorTest.cpp プロジェクト: JanDupal/magnum
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);
}
コード例 #10
0
ファイル: Color3f.cpp プロジェクト: 4og/guacamole
bool operator==(Color3f const& lhs, Color3f const& rhs) {
  return lhs.r() == rhs.r() &&
         lhs.g() == rhs.g() &&
         lhs.b() == rhs.b();

}
コード例 #11
0
ファイル: Color3f.cpp プロジェクト: 4og/guacamole
Color3f operator/(Color3f const& lhs, float rhs) {
  return Color3f(lhs.r() / rhs, lhs.g() / rhs, lhs.b() / rhs);
}
コード例 #12
0
ファイル: Color3f.cpp プロジェクト: 4og/guacamole
Color3f operator*(float const& lhs, Color3f rhs) {
  return Color3f(rhs.r() * lhs, rhs.g() * lhs, rhs.b() * lhs);
}
コード例 #13
0
ファイル: MathEngine.cpp プロジェクト: victorsand/raytracer
Color3f operator*(float _f, const Color3f& _c) {
    return Color3f(_c.r()*_f, _c.g()*_f, _c.b()*_f); 
}
コード例 #14
0
ファイル: MathEngine.cpp プロジェクト: victorsand/raytracer
Color3f operator+(const Color3f& _c1, const Color3f& _c2) {
    return Color3f(_c1.r()+_c2.r(),
                   _c1.g()+_c2.g(),
                   _c1.b()+_c2.b());
}
コード例 #15
0
ファイル: MathEngine.cpp プロジェクト: victorsand/raytracer
void Color3f::operator+=(const Color3f& _c) {
    r_ += _c.r();
    g_ += _c.g();
    b_ += _c.b();
}
コード例 #16
0
ファイル: MathEngine.cpp プロジェクト: victorsand/raytracer
Color3f::Color3f(const Color3f& _c) 
    : r_(_c.r()), g_(_c.g()), b_(_c.b()) {}