rtyshdrtrdg

 avatar
unknown
c_cpp
3 years ago
1.3 kB
6
Indexable
void drawtriangle(SVECTOR p1, SVECTOR p2, SVECTOR p3, VECTOR LPos, SVECTOR LRot){

		SVECTOR temp1={Rotate.vx+LRot.vx,Rotate.vy+LRot.vy,Rotate.vz+LRot.vz,Rotate.pad+LRot.pad};
		VECTOR temp2={Trans.vx+LPos.vx,Trans.vy+LPos.vy,Trans.vz+LPos.vz};

        TransMatrix(&Matrix,&temp2);
		RotMatrix(&temp1, &Matrix);
        ScaleMatrix(&Matrix, &Scale);
         
        SetTransMatrix(&Matrix);
		SetRotMatrix(&Matrix);

 			poly = (POLY_G3 *)nextpri;

            SetPolyG3(poly);

            setRGB0(poly, 255,255,255);
            setRGB1(poly, 255,255,0);
            setRGB2(poly, 255,0,0);
            // Rotate, translate, and project the vectors and output the results into a primitive

            OTz  = TransRotPers(&p1, (long*)&poly->x0, &p, &Flag);
            OTz += TransRotPers(&p2, (long*)&poly->x1, &p, &Flag);
            OTz += TransRotPers(&p3, (long*)&poly->x2, &p, &Flag);
            
            // Sort the primitive into the OT
            OTz /= 3;
            if ((OTz > 0) && (OTz < OTLEN))
                AddPrim(&ot[db][OTz-2], poly);
            
            nextpri += sizeof(POLY_G3);
            
            dr_mode = (DR_MODE *)nextpri;
        
            AddPrim(&ot[db], dr_mode);
            
            nextpri += sizeof(DR_MODE);
}
Editor is loading...