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

Author Topic: Isometric perspective to screen perspective  (Read 1897 times)

0 Members and 1 Guest are viewing this topic.

lucas92

  • Newbie
  • *
  • Posts: 16
    • View Profile
Isometric perspective to screen perspective
« on: December 27, 2013, 10:34:45 pm »
Hi, I have the following transform:

const static sf::Transform worldToScreen(sqrt(3) / sqrt(6), 0, -sqrt(3) / sqrt(6), 1 / sqrt(6), 2 / sqrt(6), 1 / sqrt(6), 0, 0, 1);

I see that the transform method of sf::Transform will always return a sf::Vector2f and take a sf::Vector2f as a parameter. Any way to make it return a sf::Vector3f and passing the parameter as a sf::Vector3f?

What I'd like to do is simply convert isometric world coordinates to screen coordinates by using this equation: [x',y',z']'=[T][x,y,z]' where x',y',z' are the screen coordinates (z' is ignored), T is the transformation matrix shown above and x,y,z are the world coordinates to convert.

Is this the correct way to use sf::Transforms?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Isometric perspective to screen perspective
« Reply #1 on: December 28, 2013, 01:06:29 am »
sf::Transform is just a transformation matrix which is specifically made for SFML's internal usage. You can get the matrix as an float array with getMatrix, but other than that sf::Transform was not built for your usage, you can however pretty easily create your own class/version with a similar interface. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Isometric perspective to screen perspective
« Reply #2 on: December 28, 2013, 08:52:49 am »
sf::Transform is not an internal detail, it's part of the public API. But it represents a 2D transform, it's not designed to handle 3D (it would need an extra dimension to do so).
Laurent Gomila - SFML developer