Implements texture transforms #1643
Labels
hacktoberfest
help wanted
Please help with this issue!
source:F3DApplication
source:libf3d
type:enhancement
New feature or request
Milestone
It's already possible to specify custom textures in both F3D and libf3d
--texture-XXX
options.Some file formats are expecting textures to be Y-flipped like GLTF for example (Flipping the texture is already done in the GLTF importer, but not the reader).
It could be useful to allow the user to transform the texture coordinates to do take that into account.
VTK supports texture coordinates transform, by setting a specific key on the actor, like the code below:
VTK expects a 4x4 matrix, but in our case we only support 2D texture coordinates, so we should expose the option as a 3x3 matrix.
Suggested F3D option is
--textures-transform
, suggested libf3d option ismodel.textures_transform
.Ideally, the option should be a new type
transform2d_t
defined intypes.h
storing 9 float values, and parsing methods should support things like:flipY
->1, 0, 0, 0, -1, 0, 0, 0, 1
rotate(x) ->
cos(x), -sin(x), 0, sin(x), cos(x), 0, 0, 0, 1`translate(x, y)
->1, 0, 0, 0, 1, 0, x, y, 1
scale(x, y)
->x, 0, 0, 0, y, 0, 0, 0, 1
The text was updated successfully, but these errors were encountered: