Forum

rotate an image

Discuss CSQC related programming.

Moderator: InsideQC Admins

rotate an image

Postby Nahuel » Tue Jul 22, 2014 9:50 pm

There is an easy way to rotate an image in csqc? drawpic has no an option to change the angles of an image, but I guess there must be a way to do it. Thanks in advance :D :D
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 480
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: rotate an image

Postby gnounc » Wed Jul 23, 2014 5:50 pm

Unfortunately there is not. Not in the 2d drawing routines. It's a feature I think is sorely missing.
If you need to rotate something, you can attatch it to a model in 3d space and rotate it.
Not pefect, but it should do the trick
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Re: rotate an image

Postby goldenboy » Wed Jul 23, 2014 6:05 pm

Draw a polygon with the image applied as a shader, and rotate that. This also allows you to have perspectivic HUD images, like Crysis 2 and all those other modern games. Alternatively, perhaps use a particle if you want to do crazier things wth images.

Otherwise, if someone creates a patch that adds the feature without breaking other stuff, it can't hurt to post it. :wink:
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: rotate an image

Postby Spike » Wed Jul 23, 2014 10:30 pm

there's two methods, neither is pretty.

the official method is to use the beginpolygon+polygonvertex+endpolygon builtins. 2d-mode is achieved with some flag to beginpolygon. then do your own sin+cos stuff to work out the 2d coords of the various verts and job done.

things to bear in mind:
FTE expects shader names with the argument to beginpolygon (overriding blend modes is thus considered evil, but should work).
DP expects texture names, and does not support shaders (this means you can't override things like culling, alpha masking, etc, and can't combine masks with textures or other weird and whacky stuff).



the fun method (which is excessive and isn't possible/practical in dp) is to write some glsl to do the rotation for you, however it can be a challenge compacting the info enough for it to be useful.
obviously, this method is much more work, but if you're doing weird distortion effects then this method wins.


there is no specific 'drawpicrotated' builtin. the issue is that then people would ask for a drawsubpicrotated builtin too, or something like that. you have to draw the line somewhere.
the 2d-mode of drawpolygon is meant to allow you to just generate your own damn geometry, instead of relying upon the engine for every little thing. :P
as a side note, 2d-mode could also be known as immediate mode as these calls go directly to the screen. note that it uses the 2d virtual size (consistant with drawpic), with depth, rather than 3d world coords.
Spike
 
Posts: 2859
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: rotate an image

Postby pitchatan » Mon Jul 28, 2014 10:24 am

Wouldnt a shader using tcMod rotate work in fte?
pitchatan
 
Posts: 27
Joined: Sun Aug 10, 2008 6:54 pm
Location: sweden

Re: rotate an image

Postby Spike » Mon Jul 28, 2014 11:05 am

yeah, tcmods should work. the problem is that the only input a tcmod can use is time, if you want it spinning at a constant rate with no other control then sure.
Spike
 
Posts: 2859
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: rotate an image

Postby goldenboy » Mon Jul 28, 2014 2:12 pm

good thinking there pitchatan.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: rotate an image

Postby gnounc » Sun Feb 08, 2015 12:57 am

an omission no more!

viewtopic.php?f=16&t=5619&p=55604#p55604

fte now supports void(vector pivot, vector mins, vector maxs, string pic, vector rgb, float alpha, float angle) drawrotpic = #0;

the link above will show you how to use it
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am


Return to CSQC Programming

Who is online

Users browsing this forum: No registered users and 1 guest