Vector lines in Kos

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
qatmix
Mental DCEmu
Mental DCEmu
Posts: 393
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Vector lines in Kos

Post by qatmix »

Hi

Does anyone her know how i can draw a basic vector line In KOS? Im trying to do some wireframe models and I can only see how do do polys not lines.

Thanks
Q
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Strapping Scherzo »

May I revive this topic? I'm curious to see what the answer is.
Image
quarn
DC Developer
DC Developer
Posts: 80
Joined: Wed Oct 17, 2001 7:44 pm
Location: Sweden
Has thanked: 0
Been thanked: 1 time

Post by quarn »

Don't know if there is something built in into kos, but you can draw lines by using regular polygons. Here is some code I wrote a couple of years ago to do just that:

Code: Select all

// Draw a line between p1(x,y,z) to p2(x,y,z) with the specified thickness
void q3dFillerWireframeDrawLine(pvr_vertex_t *p1, pvr_vertex_t *p2, float thickness) {
	// create lineVector
	q3dTypeVector lineVector;
	q3dVectorSet3f(&lineVector, p1->x - p2->x, p1->y - p2->y, p1->z - p2->z);
	q3dVectorNormalize(&lineVector);

	// rotate 90 degrees
	float tmp = lineVector.y;
	lineVector.y = lineVector.x;
	lineVector.x = -tmp;

	// apply thickness
	lineVector.x *= thickness/2;
	lineVector.y *= thickness/2;

	// draw
	pvr_vertex_t vert;
	vert.argb = PVR_PACK_COLOR(1, 0, 0, 0);

	// top left
	vert.flags = PVR_CMD_VERTEX;
	vert.x = p1->x - lineVector.x;
	vert.y = p1->y - lineVector.y;
	vert.z = p1->z;
	pvr_prim(&vert, sizeof(pvr_vertex_t));

	// bottom left
	vert.x = p1->x + lineVector.x;
	vert.y = p1->y + lineVector.y;
	vert.z = p1->z;
	pvr_prim(&vert, sizeof(pvr_vertex_t));

	// top right
	vert.x = p2->x - lineVector.x;
	vert.y = p2->y - lineVector.y;
	vert.z = p2->z;
	pvr_prim(&vert, sizeof(pvr_vertex_t));

	// bottom right;
	vert.flags = PVR_CMD_VERTEX_EOL;
	vert.x = p2->x + lineVector.x;
	vert.y = p2->y + lineVector.y;
	vert.z = p2->z;
	pvr_prim(&vert, sizeof(pvr_vertex_t));
}
I'm not sure if this works with newer versions of kos or not, and you should convert it to make use of direct rendering. Ofcourse the line looks pretty edgy if you make the thickness to large, but you can fix that by applying a smooth texture to the polygon with brightnesslevels running from low to high and then to low again, like this: .oOo.
nymus
DC Developer
DC Developer
Posts: 968
Joined: Tue Feb 11, 2003 4:12 pm
Location: In a Dream
Has thanked: 5 times
Been thanked: 6 times

Post by nymus »

You could use polygons with a "wireframe texture" ie you draw the object just as if you were drawing a normal polygonal object but texture it using a texture with plain middle and coloured edges.
behold the mind
inspired by Dreamcast
Post Reply