show wireframe view on entitys

Posted By: dakilla

show wireframe view on entitys - 12/26/09 22:39

i have modified a script to try and create a wireframe effect but i know i have done it wrong, and whatever i try i cannot find out how to do it properly.

heres what i have:

(proberly completely wrong!)

action show_my_lines(ENTITY* me)
{
var i;
while(1)
{
i = ent_vertices(my);
var pos[3];
while (i > 0)
{

for (i = ent_vertices(me); i > 0; i--)
{
VECTOR v;
vec_for_vertex(v, me, i);
if (vec_dist(pos,v) < 10)
break;
}
draw_line3d(vec_for_vertex(pos,my,i),vector(0,0,255),100);
}
wait(1);
}
}
Posted By: DJBMASTER

Re: show wireframe view on entitys - 12/27/09 12:42

It is probably better to use a simple effect in a material and then apply this to your entity. Set this as the 'effect' parameter of your material...
Code:
technique wireframe 
{ 
pass one { Fillmode = WireFrame; }
}


Posted By: XD1v0

Re: show wireframe view on entitys - 12/27/09 13:06

DJBMASTER make small corrections in your code grin for two sided wireframe
Code:
technique wireframe
 {
			pass p1
			{
				CullMode = None;
				FillMode = Wireframe;
			}
 }


Posted By: rojart

Re: show wireframe view on entitys - 12/27/09 13:41

or just include the mtlFX.c Predefined Surface Shaders library.

Code:
//#include <acknex.h>
#include <default.c>
#include <mtlFX.c>

function main()
{
	level_load("");
	vec_set(camera.x,vector(-30,0,10));
	vec_set(camera.pan,vector(0,-20,0));
	
	ENTITY* ent = ent_create ("sphere.mdl", nullvector, NULL);

	ent.material = mtl_wireframe;
}


Posted By: dakilla

Re: show wireframe view on entitys - 12/27/09 15:16

oh, didnt know there was wireframe in the library, thanks!
© 2024 lite-C Forums