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
Vector lines in Kos
-
- 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
-
- DC Developer
- Posts: 2285
- Joined: Fri Feb 21, 2003 7:37 am
- Location: Chicago, IL
- Has thanked: 0
- Been thanked: 1 time
- Contact:
-
- DC Developer
- Posts: 80
- Joined: Wed Oct 17, 2001 7:44 pm
- Location: Sweden
- Has thanked: 0
- Been thanked: 1 time
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:
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.
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));
}