Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Randomini

Pages: [1]
1
Graphics / Nonlinear Transformations
« on: August 01, 2013, 03:08:48 am »
Hi Everyone;

I've been messing around with SFML, and was wondering if there was any in-built method to perform nonlinear transforms on a sprite? When I say nonlinear, I've specifically got two aims: I want to be able to map a square sprite to the shape of the side of a cylinder (in other words, the 2D shape that is the side of https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Circular_cylinder_rh.svg/200px-Circular_cylinder_rh.svg.png). In addition (and this is a little trickier) I want to use a UV map for a sphere like https://en.wikipedia.org/wiki/File:UVMapping.png, but again only mapping to the 2D projection of the final 3D image.

Basically, the linear transforms in SFML let you map
Code: [Select]
[A B TX] [X]   [AX + BY + TX]
[C D TY] [Y] = [CX + DY + TY]
[0 0 1 ] [1]   [     1      ]

But what I'm after is an end result for any image in XY co-ordinates and arbitrary functions u and v to
Code: [Select]
[u(X,Y)]
[v(X,Y)]
[   1  ]

Is there support for this in SFML itself, or if not, has anyone written an extension to do this?

Pages: [1]
anything