public static void push_object_transform( ClassTransformManager obj, CompoundTransform transform) { if (object_transform_stack_count < TRANSFORM_STACK_SIZE) { CompoundTransformRow r0 = transform.property_r0; CompoundTransformRow r1 = transform.property_r1; object_transform_stack[object_transform_stack_count++] = new Matrix2x3( r0.property_c0, r0.property_c1, r0.property_c2, r1.property_c0, r1.property_c1, r1.property_c2 ); object_transform_stack_modified = true; } }
public static void pop_object_transform( ClassTransformManager obj ) { if (--object_transform_stack_count < 0) object_transform_stack_count = 0; object_transform_stack_modified = true; }
public static CompoundTransform current( ClassTransformManager obj ) { update(); return new CompoundTransform( new CompoundTransformRow(transform.r1c1,transform.r1c2,transform.r1c3), new CompoundTransformRow(transform.r2c1,transform.r2c2,transform.r2c3) ); }
public static void pop_camera_transform( ClassTransformManager obj ) { if (--camera_transform_stack_count < 0) camera_transform_stack_count = 0; camera_transform_stack_modified = true; }
public static CompoundTransform create_from( ClassTransformManager obj, CompoundVector2 size, CompoundVector2 handle, CompoundRadians angle, CompoundVector2 scale, CompoundVector2 position, bool hflip, bool vflip) { double handle_x = handle.property_x; double handle_y = handle.property_y; double size_x = size.property_x; double size_y = size.property_y; double scale_x = scale.property_x; double scale_y = scale.property_y; if (hflip || vflip) { handle_x -= size_x / 2.0; handle_y -= size_y / 2.0; } double cost = Math.Cos(angle.property_value); double sint = Math.Sin(angle.property_value); double r1c1 = cost*scale_x; double r1c2 = -sint*scale_y; double r1c3 = position.property_x - scale_x*handle_x*cost + sint*scale_y*handle_y; double r2c1 = sint*scale_x; double r2c2 = cost*scale_y; double r2c3 = position.property_y - scale_x*handle_x*sint - cost*scale_y*handle_y; Matrix2x3 m = new Matrix2x3(r1c1,r1c2,r1c3,r2c1,r2c2,r2c3); if (hflip || vflip) { if (hflip) { if (vflip) { m = m.times( new Matrix2x3(-1,0,0,0,-1,0) ); } else { m = m.times( new Matrix2x3(-1,0,0,0,1,0) ); } } else { m = m.times( new Matrix2x3(1,0,0,0,-1,0) ); } // translate by -size/2 m = m.times( new Matrix2x3(1,0,-size_x/2.0,0,1,-size_y/2.0) ); } return new CompoundTransform( new CompoundTransformRow(m.r1c1,m.r1c2,m.r1c3), new CompoundTransformRow(m.r2c1,m.r2c2,m.r2c3) ); }