Esempio n. 1
0
void RenderSingleFrame (double timestep) {
	if (!must_render) return;
	check_gl_error ();

	// ------------------ 3d scenery ----------------------------------
	set_gl_options (TUX);
    ClearRenderContext (colDDBackgr);

	string hlname = TestFrame.GetHighlightName (curr_joint);
	TestChar.highlight_node = TestChar.GetNodeName (hlname);

	glPushMatrix ();
 	SetToolLight ();
	GluCamera.Update (timestep);

	TestFrame.CalcKeyframe (curr_frame, &TestChar, ref_position);
	TestChar.Draw ();
	glPopMatrix ();

	// ----------------- 2d screen ------------------------------------
	SetupGuiDisplay ();
	set_gl_options (TEXFONT);

	if (FrameHasChanged ()) DrawChanged ();

	FT.SetFont ("bold");
	FT.SetSize (20);
	FT.SetColor (colYellow);
	FT.DrawString (-1, 10, "Keyframe mode");

	FT.SetFont ("normal");
	FT.SetSize (16);
	int xl, yt;
	for (int i=0; i<TestFrame.numFrames; i++) {
		if (i != curr_frame) {
			FT.SetColor (colLGrey); 
			FT.SetFont ("normal");
		} else {
			FT.SetColor (colYellow);
			FT.SetFont ("bold");
		}
		xl = ITrunc (i, framebase) * 100 + 20;
		yt = IFrac (i, framebase) * 18 + 20;
		FT.DrawString (xl, yt, Int_StrN (i));		
	}

	FT.SetFont ("normal");
	FT.SetColor (colLGrey); 
	PrintFrameParams (param.y_resolution - 330, TestFrame.GetFrame (curr_frame));

	if (ToolsFinalStage ()) {
		FT.SetSize (20);
		FT.SetColor (colYellow);
		FT.DrawString (-1, param.y_resolution - 50, "Quit program. Save character list (y/n)");
	}

	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers();
	must_render = false;
}
Esempio n. 2
0
void RenderChar (double timestep) {
	if (!must_render) return;
	bool is_visible = false;
	check_gl_error();

	// ------------- 3d scenery ---------------------------------------
	set_gl_options (TUX);
    ClearRenderContext (colDDBackgr);
	TestChar.highlight_node = TestChar.GetNodeName (curr_node);

	glLoadIdentity ();
	glPushMatrix ();
 	SetToolLight ();

	TestChar.ResetRoot ();
	TestChar.ResetJoints ();
	glTranslatef (xposition, yposition, zposition);	
	glRotatef (xrotation, 1, 0, 0);
	glRotatef (yrotation, 0, 1, 0);
	glRotatef (zrotation, 0, 0, 1);

	if (drawcount > 0) TestChar.Draw ();
	glPopMatrix ();
	drawcount++;

	// --------------- 2d screen --------------------------------------
	SetupGuiDisplay ();
	set_gl_options (TEXFONT);

	FT.SetFont ("bold");
	FT.SetSize (20);
	FT.SetColor (colYellow);
	FT.DrawString (-1, 10, "Edit mode");

	if (CharHasChanged ()) DrawChanged ();

	FT.SetFont ("normal");
	FT.SetSize (16);
	int xl, yt;
	for (int i=0; i<=lastnode; i++) {
		if (i != curr_node) {
			FT.SetColor (colLGrey); 
			FT.SetFont ("normal");
		} else {
			FT.SetColor (colYellow);
			FT.SetFont ("bold");
		}
		xl = ITrunc (i, charbase) * 100 + 20;
		yt = IFrac (i, charbase) * 18 + 60;
		FT.DrawString (xl, yt, TestChar.GetNodeJoint (i));		
	}

	int num = action->num;
	int type;
	if (num > 0) {
		for (int i=0; i<num; i++) {
			is_visible = false;
			type = action->type[i];
			yt = param.y_resolution - 120 + i * 18;
			switch (type) {
				case 0: DrawActionVec (i, "trans", yt, action->vec[i]); break;
				case 1: DrawActionFloat (i, "x-rot", yt, action->dval[i]); break;
				case 2: DrawActionFloat (i, "y-rot", yt, action->dval[i]); break;
				case 3: DrawActionFloat (i, "z-rot", yt, action->dval[i]); break;
				case 4: DrawActionVec (i, "scale", yt, action->vec[i]); break;
				case 5: DrawActionFloat (i, "vis", yt, action->dval[i]); 
					is_visible = true; break;
				default: break;
			}
		}
	}

	if (is_visible) FT.SetColor (colYellow); else FT.SetColor (colLGrey);
	FT.DrawString (20, 20, action->name);

	if (ToolsFinalStage ()) {
		FT.SetSize (20);
		FT.SetColor (colYellow);
		FT.DrawString (-1, param.y_resolution - 50, "Quit program. Save character list (y/n)");
	}

	Reshape (param.x_resolution, param.y_resolution);
    Winsys.SwapBuffers ();
	if (drawcount > 3) must_render = false;
}