Projected Texture

Blitz3D SDK Forums/Blitz3D SDK Programming/Projected Texture

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

So change this...

mesh=TReceiver.mesh
numsurfs=bbCountSurfaces(mesh)
For s=1 To numsurfs
	surf=bbGetSurface(mesh,s)
	numverts=bbCountVertices(surf)-1
	For vert=0 To numverts
		Select TTexProjector.mode
		Case PROJECT_CONE
			bbTFormPoint bbVertexX(surf,vert),bbVertexY(surf,vert),bbVertexZ(surf,vert),mesh,TTexProjector.entity
			
			x#=bbTFormedX()
			y#=bbTFormedY()
			z#=bbTFormedZ()
			
			dist#=Sqr(x*x+y*y+z*z)*TTexProjector.scale
			texu#=x/dist+.5
			texv#=1#-(y/dist+.5)
		Case PROJECT_LINE
			'currently not available
		End Select
		
		bbVertexTexCoords surf,vert,texu,texv
	Next
Next


to this...

mesh=TReceiver.mesh
numsurfs=bbCountSurfaces(mesh)
For s=1 To numsurfs
	surf=bbGetSurface(mesh,s)
	numverts=bbCountVertices(surf)-1
	For vert=0 To numverts
		bbTFormPoint bbVertexX(surf,vert),bbVertexY(surf,vert),..
		 bbVertexZ(surf,vert),mesh,TTexProjector.entity
		
		x#=bbTFormedX()
		y#=bbTFormedY()
		z#=bbTFormedZ()
		
		Select TTexProjector.mode
		Case PROJECT_CONE
			dist#=Sqr(x*x+y*y+z*z)*TTexProjector.scale
			texu#=x/dist+.5
			texv#=1#-(y/dist+.5)
		Case PROJECT_LINE
			texu#=x+.5
			texv#=1#-(y+.5)
		End Select
		
		bbVertexTexCoords surf,vert,texu,texv
	Next
Next


and it should work, right? :-/