Ejemplo n.º 1
0
void uiSequenceNode::draw (uiNode_t *node)
{
	if (EXTRADATA(node).context != NULL && EXTRADATA(node).playing) {
		bool finished = false;
		vec2_t pos;
		vec2_t screenPos;
		UI_GetNodeAbsPos(node, pos);
		UI_GetNodeScreenPos(node, screenPos);

		R_PushMatrix();
		R_CleanupDepthBuffer(pos[0], pos[1], node->box.size[0], node->box.size[1]);
		R_PushClipRect(screenPos[0], screenPos[1], node->box.size[0], node->box.size[1]);

		SEQ_SetView(EXTRADATA(node).context, pos, node->box.size);
		finished = !SEQ_Render(EXTRADATA(node).context);

		R_PopClipRect();
		R_PopMatrix();

		if (finished && EXTRADATA(node).onEnd) {
			UI_ExecuteEventActions(node, EXTRADATA(node).onEnd);
			EXTRADATA(node).playing = true;
		}
	}
}
Ejemplo n.º 2
0
/**
 * @brief Pushes a new matrix, normalize to current resolution and move, rotate and
 * scale the matrix to the given values.
 * @note Will pop the matrix if @c transform is @c nullptr
 * @param transform Translation (if @c nullptr the matrix is removed from stack)
 * @param rotate Rotation
 * @param scale Scale
 * @sa R_Transform
 * @sa R_PopMatrix
 * @sa R_PushMatrix
 */
void UI_Transform (const vec3_t transform, const vec3_t rotate, const vec3_t scale)
{
	vec3_t pos;

	if (transform != nullptr) {
		R_PushMatrix();
		VectorCopy(transform, pos);
		pos[0] *= viddef.rx;
		pos[1] *= viddef.ry;

		R_Transform(pos, rotate, scale);
	} else {
		R_PopMatrix();
	}
}
Ejemplo n.º 3
0
/**
 * @brief Applies translation, rotation, and scale for the specified entity.
 */
void R_RotateForEntity(const r_entity_t *e) {

	if (!e) {
		R_PopMatrix(R_MATRIX_MODELVIEW);
		return;
	}

	R_PushMatrix(R_MATRIX_MODELVIEW);

	matrix4x4_t modelview;

	R_GetMatrix(R_MATRIX_MODELVIEW, &modelview);

	Matrix4x4_Concat(&modelview, &modelview, &e->matrix);

	R_SetMatrix(R_MATRIX_MODELVIEW, &modelview);
}
Ejemplo n.º 4
0
/**
 * @sa CL_Sequence2D
 * @sa CL_ViewRender
 * @sa CL_SequenceEnd_f
 * @sa UI_PopWindow
 * @sa CL_SequenceFindEnt
 */
static void SEQ_Render3D (sequenceContext_t *context)
{
	entity_t ent;
	seqEnt_t *se;
	int i;

	if (context->numEnts == 0)
		return;

	/* set camera */
	SEQ_SetCamera(context);

	refdef.numEntities = 0;
	refdef.mapTiles = cl.mapTiles;

	/* render sequence */
	for (i = 0, se = context->ents; i < context->numEnts; i++, se++) {
		if (!se->inuse)
			continue;

		/* advance in time */
		VectorMA(se->origin, cls.frametime, se->speed, se->origin);
		VectorMA(se->angles, cls.frametime, se->omega, se->angles);
		R_AnimRun(&se->as, se->model, context->animspeed * cls.frametime);

		/* add to scene */
		OBJZERO(ent);
		ent.model = se->model;
		ent.skinnum = se->skin;
		ent.as = se->as;
		ent.alpha = se->alpha;

		R_EntitySetOrigin(&ent, se->origin);
		VectorCopy(se->origin, ent.oldorigin);
		VectorCopy(se->angles, ent.angles);

		if (se->parent && se->tag) {
			seqEnt_t *parent;

			parent = SEQ_FindEnt(context, se->parent);
			if (parent)
				ent.tagent = parent->ep;
			ent.tagname = se->tag;
		}

		/* add to render list */
		se->ep = R_GetFreeEntity();
		R_AddEntity(&ent);
	}

	refdef.rendererFlags |= RDF_NOWORLDMODEL;

	/* use a relative fixed size */
	viddef.x = context->pos[0];
	viddef.y = context->pos[1];
	viddef.viewWidth = context->size[0];
	viddef.viewHeight = context->size[1];

	/* update refdef */
	CL_ViewUpdateRenderData();

	/** @todo Models are not at the right position (relative to the node position). Maybe R_SetupFrustum erase matrix. Not a trivialous task. */
	/* render the world */
	R_PushMatrix();
	R_RenderFrame();
	R_PopMatrix();
}