Scale 3d object from image width and height ?

Blitz3D Forums/Blitz3D Programming/Scale 3d object from image width and height ?

Filax(Posted 2007) [#1]
Hi :)

Anybody can post a formula to resize a 3D object
from image size (width and height),to keep the
good aspect ratio ?

See ya :)


fredborg(Posted 2007) [#2]
Je ne comprend pas, mais c'est une question tres fantastique!


Filax(Posted 2007) [#3]
Lol :)

Imagine, i load a texture, and i want to texture a cube with
this texture. But i want to scale the 3D object from the
width and the height of the image because i want to keep
the image ratio on the textured cube.

I'm clear or not now ? :)

Example :



fredborg(Posted 2007) [#4]
w# = ImageWidth(image)
h# = ImageHeight(image)
ScaleEntity cube,w/w,h/w,1.0
Comme ca?

Vous etes clair comme etang boueux :P


Filax(Posted 2007) [#5]
Lol :) Many thanks Fredborg :) But stop google trad :)


fredborg(Posted 2007) [#6]
But stop google trad
You too :)


Filax(Posted 2007) [#7]
Hum don't work :/ I search another way...

"You too :)" i try to do my best :) !


fredborg(Posted 2007) [#8]
image = LoadImage("filaxrocks.png")
w# = ImageWidth(image)
h# = ImageHeight(image)
FreeImage image
texture = LoadTexture("filaxrocks.png")
cube = CreateCube()
EntityTexture cube,texture
ScaleEntity cube,w/w,h/w,1.0
Doesn't that work?


Filax(Posted 2007) [#9]
It's good :) many thanks fredborg.