|
-
May 21st, 2002, 10:02 AM
#1
Thread Starter
PowerPoster
Cropping Textures in Direct3D
I'm using D3D8 and want to crop textures, is there any better way than dealing with texture coordinates?
-
May 21st, 2002, 02:14 PM
#2
Member
I suppose you mean cropping like in 3ds max? If so texture coordinates are the only way I can think of...
-
May 21st, 2002, 04:26 PM
#3
Good Ol' Platypus
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?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 21st, 2002, 04:34 PM
#4
Thread Starter
PowerPoster
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
-
May 21st, 2002, 07:12 PM
#5
Good Ol' Platypus
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?
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
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.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|