I'm using D3D8 and want to crop textures, is there any better way than dealing with texture coordinates?
Printable View
I'm using D3D8 and want to crop textures, is there any better way than dealing with texture coordinates?
I suppose you mean cropping like in 3ds max? If so texture coordinates are the only way I can think of...
Why don't you want to use Texture coordinates? If they come in percentages I can see where you're coming from, but if not whats the problem?
It's not a problem, I'm just looking for another way. As you can see in my mDXGraphics I'm using tex coords but there's always a better way.. maybe ;)
Actually I haven't had a chance - I've got to reinstall Win2k (in about 3 minutes actually ;)), so I won't have a chance.
The only other way I can think of is offsetting a bit array (how you do it is up to you). If you're thinking of zooming them in and out, how about making yourself a custom fuction?Of course this is just a sample, but the function should work (I have no way of checking it at the time being). Ta for now.VB Code:
Function ZoomTexCoord(Orig() As PointAPI, ZoomFactor As Single, NewPoints() As PointAPI Dim Width As Long Dim Height As Long Dim cX As Long Dim cY As Long 'Let me explain; the Orig() array is the texture coordinates for a quad, ex: ' 0.....1 ' ..... ' 2.....3 Width = Orig(1).X - Orig(0).X Height = Orig(2).Y - Orig(0).Y cX = Orig(0).X + Width / 2 cY = Orig(0).Y + Height / 2 Width = Width * ZoomFactor Height = Height * ZoomFactor NewPoints(0).X = cX - Width / 2 NewPoints(0).Y = cY - Height/ 2 NewPoints(1).X = cX + Width / 2 NewPoints(1).Y = cY - Height / 2 NewPoints(2).X = cX - Width / 2 NewPoints(2).Y = cY + Height / 2 NewPoints(3).X = cX + Width / 2 NewPoints(3).Y = cY + Height / 2 End Function