2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Concentric circles
[Re: Michael_McCrickard]
#189501
03/20/08 17:18
03/20/08 17:18
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
mediocre history: tD, C-Script, 6.40.5, 6.60 Circles with forgotten old custom C-Script function utilizing draw line commands, and parameters resolution=60, radius=90,60,30, position=?, color=red,green,blue are less appealing than ads on page. http://testdummy93.tripod.com/3DGS/3DGS_samples.html
|
|
|
Re: Concentric circles
[Re: testDummy]
#189502
03/20/08 18:39
03/20/08 18:39
|
Joined: Sep 2003
Posts: 208
Michael_McCrickard
OP
Member
|
OP
Member
Joined: Sep 2003
Posts: 208
|
That's it! I had forgotten all about that draw_line() command. Time to relearn my trigonometry. Thanks a lot, testDummy!
Last edited by Michael_McCrickard; 03/20/08 18:51.
|
|
|
Re: Concentric circles
[Re: Michael_McCrickard]
#189505
03/21/08 10:10
03/21/08 10:10
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
Why not make a animated (transparent) sprite with a growing circle? You can easy define the number of frames, can make the growing logarithmic, and save a lot of cpu power...
|
|
|
Re: Concentric circles
[Re: ]
#189506
03/21/08 15:08
03/21/08 15:08
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
For those that like to throw pies, here is a cached draw circle function, simple, raw and unoptimized. Code:
/************************************ drawCircle3D0 *************************************/ var drawCircleS0[3]; var drawCircleE0[3];
function drawCircle3D0(&_pos, _radius, _res, &_color) { var angle0; angle0 = 0; var i0; i0 = 0; var vec11[3];
while (i0 < (_res + 1)) { angle0 = 360 / _res * i0; drawCircleE0[0] = 0; drawCircleE0[1] = _radius; drawCircleE0[2] = 0; vec_rotate(drawCircleE0, vector(0, 0, angle0)); vec_add(drawCircleE0, _pos); if (i0 > 0) { drawLine3D0(drawCircleS0, drawCircleE0, _color, 100); //printVec0("drawCircleS0 = ", drawCircleS0); //printVec0("drawCircleE0 = ", drawCircleE0); } //printVar0("angle0 = ", angle0); i0 += 1; vec_set(drawCircleS0, drawCircleE0); } }
The previously shown sample, uses a res of 60 divisions or so. A7 users must pay a fee of 55 Euros to use derivatives of the above function (sub par or not).
|
|
|
Re: Concentric circles
[Re: Michael_McCrickard]
#189508
03/27/08 17:30
03/27/08 17:30
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
I would solve that with a shader and a sprite... passing the distance to the shader and it sets transparence to 0 or 1... here's the shader...: Code:
float4x4 matWorldViewProj; float3 lineColor = {0.0,1.0,0.0}; float2 vecSkill41; float4 vecColor;
void circleVS( in float4 pos :POSITION, in float2 tex :TEXCOORD0, out float4 oPos:POSITION, out float2 oTex:TEXCOORD0) { oPos = mul(pos,matWorldViewProj); oTex = tex; }
float4 circlePS(in float2 texcrd:TEXCOORD0):COLOR { float pDist = distance(float2(0.5,0.5),texcrd); float4 Color; Color.rgb = lineColor; if(pDist>vecSkill41.x-vecSkill41.y&&pDist<vecSkill41.x) Color.w = vecColor.w; else Color.w = 0; return Color; }
technique circle { pass p0 { vertexshader = compile vs_2_0 circleVS(); pixelshader = compile ps_2_0 circlePS(); } }
...and here a little script you can try it with Code:
MATERIAL* circleMtl = { effect="circle.fx"; }
void main() { float circleAnm = 0; level_load(NULL); you=ent_create("circle.tga",nullvector,NULL); your.tilt = 90; your.skill42 = floatv(0.02); your.material = circleMtl; set(your,TRANSLUCENT); watched=you; while(1) { circleAnm += 0.7*time_step; if(circleAnm>50) circleAnm=0; your.skill41 = floatv(circleAnm/100); your.alpha = 100-circleAnm*2; wait(1); } }
have fun with it...(ofc you can also use more than one line with it  )
Last edited by Scorpion; 03/27/08 17:31.
|
|
|
Re: Concentric circles
[Re: Scorpion]
#189509
03/27/08 17:39
03/27/08 17:39
|
Joined: Sep 2003
Posts: 208
Michael_McCrickard
OP
Member
|
OP
Member
Joined: Sep 2003
Posts: 208
|
Well, thanks very much for this. I will certainly try this out! This reminded me that I haven't posted the code that I came up with from the functions that testDummy provided. If anyone wants to try it, it's here: http://mccrickard.net/circles.wdl
|
|
|
|