示例#1
0
void uiLineChartNode::draw (uiNode_t *node)
{
	lineStrip_t *lineStrip;
	const int dataId = EXTRADATA(node).dataId;
	vec3_t pos;

	if (dataId == 0)
		return;

	if (ui_global.sharedData[dataId].type != UI_SHARED_LINESTRIP) {
		Com_Printf("UI_LineStripNodeDraw: Node '%s' have use an invalide dataId type. LineStrip expected. dataId invalidated\n", UI_GetPath(node));
		EXTRADATA(node).dataId = 0;
		return;
	}

	UI_GetNodeAbsPos(node, pos);
	pos[2] = 0;

	UI_Transform(pos, nullptr, nullptr);

	/* Draw axes */
	if (EXTRADATA(node).displayAxes) {
		int axes[6];
		axes[0] = 0;
		axes[1] = 0;
		axes[2] = 0;
		axes[3] = (int) node->box.size[1];
		axes[4] = (int) node->box.size[0];
		axes[5] = (int) node->box.size[1];
		R_Color(EXTRADATA(node).axesColor);
		R_DrawLineStrip(3, axes);
	}

	/* Draw all linestrips. */
	lineStrip = ui_global.sharedData[dataId].data.lineStrip;
	for (; lineStrip; lineStrip = lineStrip->next) {
		/* Draw this line if it's valid. */
		if (lineStrip->pointList && lineStrip->numPoints > 0) {
			R_Color(lineStrip->color);
			R_DrawLineStrip(lineStrip->numPoints, lineStrip->pointList);
		}
	}
	R_Color(nullptr);

	UI_Transform(nullptr, nullptr, nullptr);
}
示例#2
0
/**
 * @brief Execute and render a sequence
 * @param context Sequence context
 * @return True if the sequence is alive.
 */
bool SEQ_Render (sequenceContext_t* context)
{
	if (!context->size[0] || !context->size[1])
		return true;

	if (!SEQ_Execute(context))
		return false;

	/* center screen */
	vec3_t pos;
	pos[0] = context->pos[0] + (context->size[0] - VID_NORM_WIDTH) / 2;
	pos[1] = context->pos[1] + (context->size[1] - VID_NORM_HEIGHT) / 2;
	pos[2] = 0;
	UI_Transform(pos, nullptr, nullptr);

	SEQ_Render2D(context, true);
	SEQ_Render3D(context);
	SEQ_Render2D(context, false);

	UI_Transform(nullptr, nullptr, nullptr);
	return true;
}