Attr-Texture Space copy

From Vectorlab
Jump to: navigation, search

Transfers texture space between two objects. This is not finished yet! By Orso B. Schmid

{ Orso ***************************** }
{ Copy object's mapping to another. 
This fails on object's texture repeats, no idea how to get them }
FUNCTION A_TextureSpaceCopy(texSpSource, texSpTarget: HANDLE): BOOLEAN;
		p, o, u, v, w : VECTOR;	
		A_TextureSpaceCopy := FALSE;
		IF (texSpSource <> NIL) & (texSpTarget <> NIL) THEN BEGIN
			SetTexSpaceKind(texSpTarget, GetTexSpaceKind(texSpSource)); { Maptype: plane, cilinder, sphere }
			SetTexSpace2DRadius(texSpTarget, GetTexSpace2DRadius(texSpSource)); { Radius }
			SetTexSpace2DScale(texSpTarget, GetTexSpace2DScale(texSpSource)); { Space Scale }
			SetTexSpace2DRot(texSpTarget, GetTexSpace2DRot(texSpSource)); { rotation }
			GetTexSpaceOrigin(texSpSource, p.x, p.y, p.z); { origin }
			SetTexSpaceOrigin(texSpTarget, p.x, p.y, p.z);
			GetTexSpace2DOffset(texSpSource, o.x, o.y); { offset }
			SetTexSpace2DOffset(texSpTarget, o.x, o.y);
			{ if image is flipped horiz. then p.x = bitmapSize and p.y = -0 }
			{ if image is flipped vert. then p.y = bitmapSize and p.y = -0 }
			GetTexSpaceOrientU(texSpSource, u.x, u.y, u.z);
			SetTexSpaceOrientU(texSpTarget, u.x, u.y, u.z);
			{ this is now removed because it makes the rendering fail if its RW and not OpenGL }
			GetTexSpaceOrientV(texSpSource, v.x, v.y, v.z);
			SetTexSpaceOrientV(texSpTarget, v.x, v.y, v.z);
			GetTexSpaceOrientW(texSpSource, w.x, w.y, w.z);
			SetTexSpaceOrientW(texSpTarget, p.x, p.y, p.z);
			A_TextureSpaceCopy := TRUE;