Author Topic: Texture flip with TextToTexture?  (Read 160 times)

Offline SchindlerLift2844

  • Contributor Level I
  • *
  • Posts: 152
  • Credit to Lester Controls for the profile picture.
    • View Profile
Texture flip with TextToTexture?
« on: March 02, 2023, 07:31:27 am »
Is there a known way to flip textures that use TextToTexture? In some lifts I'm currently working on, one of the panels needs to have flipped buttons where the numbers on the pressels are reversed. In the building code, I tried setting "tw" to -1 in the parameters of the AddTextRange command that adds the text to the buttons, and also tried SetPlanarMapping, but neither of them worked. I looked at the script guide entry for TextureFlip and it looks like it only works for walls and stuff. Idk how lift buttons are drawn in the simulator but I'm sure there must be a way to get the buttons to be flipped. If you have any information, leave it as a reply here.

Share on Facebook Share on Twitter


Offline eventhorizon

  • Administrator
  • Contributor Level II
  • *****
  • Posts: 389
  • Location: Chicago, IL
    • View Profile
    • Ryan Thoryk's Website
Re: Texture flip with TextToTexture?
« Reply #1 on: March 03, 2023, 01:22:51 am »
The AddTextRange doesn't have the standard tw and th parameters because it just writes to a texture.  I can see if those options can be added, or if a new command can be created that flips textures.

Offline eventhorizon

  • Administrator
  • Contributor Level II
  • *****
  • Posts: 389
  • Location: Chicago, IL
    • View Profile
    • Ryan Thoryk's Website
Re: Texture flip with TextToTexture?
« Reply #2 on: March 04, 2023, 07:59:27 pm »
After looking at the code, the tw and th (widthmult and heightmult) values for the resulting texture created with TextToTexture are taken from the original loaded texture, they're simply copied over.

This code loads the "Open" button with horizontally-flipped text.

Code: [Select]
Load data/black.jpg, BlackFlipped, -1, 1
AddText BlackFlipped, ButtonOpen, nimbus_sans.ttf, 28, Open, -1, -1, -1, -1, center, center, 255, 255, 255

The only real difference there is that the Load command uses the -1 value for "th", and I used a new name for that texture.  The "AddText" command reads the "-1, 1" value from the original texture, creates a new texture, applies the text, and applies the same "-1, 1" to that texture.

« Last Edit: March 04, 2023, 08:01:08 pm by eventhorizon »