Sswift EntityScale functions

Blitz3D Forums/Blitz3D Programming/Sswift EntityScale functions

It doesn't need to be maximised specifically, just to ensure that the entities are clearly visible.

I also notice that Sprites hold very low original scale values compared to meshes and primitives.

I guess it's a lot harder because I have spheres scaled up by hundreds (even over 1000) and sprites and smaller meshes approximately 20 units in diameter.

If there was a way of perhaps reading the actual diameter of scaled-up meshes even just in one dimension, then I could translate the camera to a distance proportional to this.




The problem lies with Blitz' internal code 'remembering' the initial entity sizes.











-________________________________________________________-



@Sswift
(2003-06-24 23:20:48)

You're going to have to explain further because I can't understand what it is you want to accomplish.



Please see the difference between these two examples:



;ORIGINAL SCALE VERSION
Graphics3d 1024,768,16,1
setbuffer backbuffer()
Camera target=createcamera()
cameraviewport target,0,0,1024,768
targetentity=createsphere(20)

	Vx# = GetMatElement(targetEntity, 0, 0)
	Vy# = GetMatElement(targetEntity, 0, 1)
	Vz# = GetMatElement(targetEntity, 0, 2)	
	
	ScaleX# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)

	Vx# = GetMatElement(targetEntity, 1, 0)
	Vy# = GetMatElement(targetEntity, 1, 1)
	Vz# = GetMatElement(targetEntity, 1, 2)	
	
	ScaleY# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)

	Vx# = GetMatElement(targetEntity, 2, 0)
	Vy# = GetMatElement(targetEntity, 2, 1)
	Vz# = GetMatElement(targetEntity, 2, 2)		
	ScaleZ# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)


PositionEntity target,EntityX#(targetentity,1),EntityY#(targetentity,1),EntityZ#(targetentity,1)

TranslateEntity target,0,0,((scaleX#+ScaleY#+ScaleZ)/3)

PointEntity target,targetentity
while not keydown(1)
updateworld
renderworld
flip
wend
end







;LARGE SCALE VERSION
Graphics3d 1024,768,16,1
setbuffer backbuffer()
Camera target=createcamera()
cameraviewport target,0,0,1024,768
targetentity=createsphere(20)
scaleentity targetentity,500,500,500

	Vx# = GetMatElement(targetEntity, 0, 0)
	Vy# = GetMatElement(targetEntity, 0, 1)
	Vz# = GetMatElement(targetEntity, 0, 2)	
	
	ScaleX# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)

	Vx# = GetMatElement(targetEntity, 1, 0)
	Vy# = GetMatElement(targetEntity, 1, 1)
	Vz# = GetMatElement(targetEntity, 1, 2)	
	
	ScaleY# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)

	Vx# = GetMatElement(targetEntity, 2, 0)
	Vy# = GetMatElement(targetEntity, 2, 1)
	Vz# = GetMatElement(targetEntity, 2, 2)		
	ScaleZ# = Sqr(Vx#*Vx# + Vy#*Vy# + Vz#*Vz#)


PositionEntity target,EntityX#(targetentity,1),EntityY#(targetentity,1),EntityZ#(targetentity,1)

TranslateEntity target,0,0,((scaleX#+ScaleY#+ScaleZ)/3)

PointEntity target,targetentity

while not keydown(1)
updateworld
renderworld
flip
wend
end