void drawHudScreen(Texture *tex, intf x1, intf y1, intf x2, intf y2)
{	// Draw a HUD where the co-ordinates represent screen co-ordinates where the top left is 0,0
	hudobj.mtl->texture[0]=tex;					// ### Changing material properties
	HudUniforms.x1 = ((float)(x1*2)/(float)screenWidth)-1.0f;
	HudUniforms.y1 = -(((float)(y1*2)/(float)screenHeight)-1.0f);
	HudUniforms.x2 = ((float)(x2*2)/(float)screenWidth)-1.0f;
	HudUniforms.y2 = -(((float)(y2*2)/(float)screenHeight)-1.0f);
	drawObj3D(&hudobj, hudobj.matrix, &HudUniforms);
}
void drawBillboard(Texture *tex, float *mtx, float sizeX, float sizeY)
{	float tmpMtx[16];
	bbobj.mtl->texture[0]=tex;					// ### Changing material properties
	bbUniforms.scaleX = sizeX;
	bbUniforms.scaleY = sizeY;
	matmult(tmpMtx, invcammat, mtx);
	bbUniforms.worldView.x = tmpMtx[mat_xpos];
	bbUniforms.worldView.y = tmpMtx[mat_ypos];
	bbUniforms.worldView.z = tmpMtx[mat_zpos];
	drawObj3D(&bbobj, mtx, &bbUniforms);
}
void drawHudScaledUV(Texture *tex, float x1, float y1, float x2, float y2)
{	// Draw a HUD where the co-ordinates represent values between -1 to +1 (-1 is left / bottom of screen)

	hudobj.mtl->texture[0]=tex;					// ### Changing material properties
	HudUniforms.x1 = x1*2.0f-1.0f;
	HudUniforms.y1 = 1.0f-y1*2.0f;
	HudUniforms.x2 = x2*2.0f-1.0f;
	HudUniforms.y2 = 1.0f-y2*2.0f;
	HudUniforms.UVScale = tex->UVscale;
	drawObj3D(&hudobj, hudobj.matrix, &HudUniforms);
}
void Viewport::drawObj(Object* obj){
    if(obj->getType() != ObjType::OBJECT3D &&
        obj->getNCoordsSize() == 0) return;

    switch(obj->getType()){
    case ObjType::OBJECT:
        break;
    case ObjType::POINT:
        drawPoint(obj);
        break;
    case ObjType::LINE:
        drawLine(obj);
        break;
    case ObjType::POLYGON:
        drawPolygon(obj);
        break;
    case ObjType::BEZIER_CURVE:
    case ObjType::BSPLINE_CURVE:
        drawCurve(obj);
        break;
    case ObjType::OBJECT3D:
        drawObj3D((Object3D*) obj);
    }
}