コード例 #1
0
ファイル: transform3_param.cpp プロジェクト: JohanAberg/Ramen
transform3_param_t::matrix_type transform3_param_t::matrix_at_frame( float frame, float aspect, int subsample) const
{
	Imath::V3f c = get_center_at_frame( frame) / subsample;
    Imath::V3f t = get_value_at_frame<Imath::V3f>( translate_param(), frame) / subsample;
    Imath::V3f s = get_value_at_frame<Imath::V3f>( scale_param(), frame);
    Imath::V3f r = get_value_at_frame<Imath::V3f>( rotate_param(), frame) * math::constants<float>::deg2rad();

	transform3_param_t::matrix_type m = matrix_type().setTranslation( -c) *
										matrix_type().setScale( Imath::V3f( aspect, 1.0f, 1.0f)) *
										matrix_type().setScale( s) *
										matrix_type().setEulerAngles( r) *
										matrix_type().setTranslation( t) *
										matrix_type().setScale( Imath::V3f( 1.0f / aspect, 1.0f, 1.0f)) *
										matrix_type().setTranslation( c);

    return m;
}
コード例 #2
0
ファイル: transform2_param.cpp プロジェクト: apextw/Ramen
boost::optional<Imath::M33d> transform2_param_t::matrix_at_time( float time, int subsample) const
{
    const double deg2rad = 0.01745329251;

    Imath::V2f s = get_value_at_time<Imath::V2f>( scale_param(), time);

    if( s.x == 0.0f && s.y == 0.0f)
        return boost::optional<Imath::M33d>();

    Imath::V2f c = get_absolute_value_at_time<Imath::V2f>( center_param(), time);
    Imath::V2f t = get_value_at_time<Imath::V2f>( translate_param(), time) / (float) subsample;
    float angle  = get_value_at_time<float>( rotate_param(), time);

    Imath::M33d m = Imath::M33d().setTranslation( -c) *
                    Imath::M33d().setScale( s) *
                    Imath::M33d().setRotation( angle * deg2rad) *
                    Imath::M33d().setTranslation( c + t);

    return boost::optional<Imath::M33d>( m);
}
コード例 #3
0
ファイル: transform2_param.cpp プロジェクト: apextw/Ramen
boost::optional<Imath::M33d> transform2_param_t::xform_blur_matrix_at_time( float time, float t, int subsample) const
{
    const double deg2rad = 0.01745329251f;

    Imath::V2f s = get_value_at_time<Imath::V2f>( scale_param(), time);

    if( s.x == 0.0f && s.y == 0.0f)
        return boost::optional<Imath::M33d>();

    Imath::V2f c = get_absolute_value_at_time<Imath::V2f>( center_param(), time);
    Imath::V2f d = get_value_at_time<Imath::V2f>( translate_param(), time) / (float) subsample;
    float angle  = get_value_at_time<float>( rotate_param(), time);

    s = Imath::lerp( Imath::V2f( 1, 1), s, t);
    d = Imath::lerp( Imath::V2f( 0, 0), d, t);
    angle = Imath::lerp( 0.0f, angle, t);

    Imath::M33d m = Imath::M33d().setTranslation( -c) *
                    Imath::M33d().setScale( s) *
                    Imath::M33d().setRotation( angle * deg2rad) *
                    Imath::M33d().setTranslation( c + d);

    return boost::optional<Imath::M33d>( m);
}