示例#1
0
void Model::drawCockpit() {
		// Cockpit
		size = 6;
		glPushMatrix();
			setPosition();
//				drawTriangle(cockpit[0],cockpit[1],cockpit[2], 0, 1, 2, 3, heliWidth);
				drawSide(cockpit[0],cockpit[1],cockpit[2],1, size+1,"nLeft",heliWidth);			// Right
				drawSide(cockpit[0],cockpit[1],cockpit[2],1, size+1,"nRight");				// Left

/*
				drawTriangle(mainBody[0],mainBody[1], 2, 3, 4, 2, heliWidth);
				drawTriangle(mainBody[0],mainBody[1], 2, 4, 5, 2, heliWidth);
				drawTriangle(mainBody[0],mainBody[1], 2, 5, 6, 2, heliWidth);
				drawTriangle(mainBody[0],mainBody[1], 2, 6, 7, 2, heliWidth);
				drawTriangle(mainBody[0],mainBody[1], 2, 7, 8, 2, heliWidth);

				drawTriangle(mainBody[0],mainBody[1], 2, 4, 3, 2);
				drawTriangle(mainBody[0],mainBody[1], 2, 5, 4, 2);
				drawTriangle(mainBody[0],mainBody[1], 2, 6, 5, 2);
				drawTriangle(mainBody[0],mainBody[1], 2, 7, 6, 2);
				drawTriangle(mainBody[0],mainBody[1], 2, 8, 7, 2);
*/
				drawCenterfold(cockpit[0],cockpit[1],size,heliWidth);
			glPopMatrix();
		glPopMatrix();
}
示例#2
0
void LLCylinder::renderface(F32 pixel_area, S32 face)
{
	if (face < 0 || face > 2)
	{
		llerror("LLCylinder::renderface() invalid face number", face);
		return;
	}

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();

	S32 level_of_detail;

	if (pixel_area > 20000.f)
	{
		level_of_detail = 0;
	}
	else if (pixel_area > 1600.f)
	{
		level_of_detail = 1;
	}
	else if (pixel_area > 200.f)
	{
		level_of_detail = 2;
	}
	else
	{
		level_of_detail = 3;
	}

	if (level_of_detail < 0 || CYLINDER_LEVELS_OF_DETAIL <= level_of_detail)
	{
		llerror("LLCylinder::renderface() invalid level of detail", level_of_detail);
		return;
	}

	LLVertexBuffer::unbind();
	
	switch(face)
	{
	case 0:
		glTranslatef(0.f, 0.f, -0.5f);
		drawSide(level_of_detail);
		break;
	case 1:
		glTranslatef(0.0f, 0.f, 0.5f);
		drawTop(level_of_detail);
		break;
	case 2:
		glTranslatef(0.0f, 0.f, -0.5f);
		drawBottom(level_of_detail);
		break;
	default:
		llerror("LLCylinder::renderface() fell out of switch", 0);
		break;
	}

	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
}
示例#3
0
void LLCone::render(S32 level_of_detail)
{
	GLfloat height = 1.0f;

	if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
	{
		llerror("LLCone::render() invalid level of detail", level_of_detail);
		return;
	}

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();

	// center object at 0
	glTranslatef(0.f, 0.f, - height / 2.0f);

	drawSide(level_of_detail);
	drawBottom(level_of_detail);

	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
}
示例#4
0
void LLCone::renderface(S32 level_of_detail, S32 face)
{
	if (face < 0 || face > 1)
	{
		llerror("LLCone::renderface() invalid face number", face);
		return;
	}

	if (level_of_detail < 0 || CONE_LEVELS_OF_DETAIL <= level_of_detail)
	{
		llerror("LLCone::renderface() invalid level of detail", level_of_detail);
		return;
	}

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();

	LLVertexBuffer::unbind();
	
	switch(face)
	{
	case 0:
		glTranslatef(0.f, 0.f, -0.5f);
		drawSide(level_of_detail);
		break;
	case 1:
		glTranslatef(0.f, 0.f, -0.5f);
		drawBottom(level_of_detail);
		break;
	default:
		llerror("LLCylinder::renderface() fell out of switch", 0);
		break;
	}

	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
}
示例#5
0
int run() {
	int page = 0, npage;
	char *input = (char*)malloc(sizeof(char));
	do {
		npage = drawSide(page);
		drawBoard(page);

		Body *line = newLine(35, 1, 60, 'v', '-');
		Stroke *lineStroke = newStroke(1, newBorder("|"));
		line->addStroke(line, lineStroke);
		stroke.setStrokeJoint(lineStroke, '#');
		registerBody("NULL", line);

		draw();
		gets(input);

		handleInput(&page, npage, input);
		
		clearAndRefresh();
		clearBodies();
	} while(!isKeyword(input, "exit"));

	return 0;
}
示例#6
0
/* LineInfoOverlay::draw
 * Draws the overlay at [bottom] from 0 to [right]
 *******************************************************************/
void LineInfoOverlay::draw(int bottom, int right, float alpha)
{
	// Don't bother if invisible
	if (alpha <= 0.0f)
		return;

	// Init GL stuff
	glLineWidth(1.0f);
	glDisable(GL_LINE_SMOOTH);

	// Determine overlay height
	int sides_width = 2;
	if (side_front.exists)
		sides_width += 256;
	if (side_back.exists)
		sides_width += 256;
	if (last_size != right - sides_width)
	{
		last_size = right - sides_width;
		text_box->setSize(right - sides_width);
	}
	int height = text_box->getHeight() + 4;

	// Get colours
	rgba_t col_bg = ColourConfiguration::getColour("map_overlay_background");
	rgba_t col_fg = ColourConfiguration::getColour("map_overlay_foreground");
	col_fg.a = col_fg.a*alpha;
	col_bg.a = col_bg.a*alpha;
	rgba_t col_border(0, 0, 0, 140);

	// Slide in/out animation
	float alpha_inv = 1.0f - alpha;
	bottom += height*alpha_inv*alpha_inv;

	// Determine widths
	int n_side_panels = 0;
	if (side_front.exists)
		n_side_panels++;
	if (side_back.exists)
		n_side_panels++;

	// Draw overlay background
	scale = gl_font_size / 12.0;
	int tex_box_size = 80 * scale;
	int sinf_size = ((tex_box_size * 3) + 16);
	int main_panel_end = right - (n_side_panels * (sinf_size +2));
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glLineWidth(1.0f);
	Drawing::drawBorderedRect(0, bottom-height-4, main_panel_end, bottom+2, col_bg, col_border);

	// Draw info text lines
	text_box->setLineHeight(16 * scale);
	text_box->draw(2, bottom - height, col_fg);

	// Side info
	int x = right - sinf_size;
	if (side_front.exists)
	{
		// Background
		glDisable(GL_TEXTURE_2D);
		Drawing::drawBorderedRect(x, bottom-height-4, x + sinf_size, bottom+2, col_bg, col_border);

		drawSide(bottom-4, right, alpha, side_front, x);
		x -= (sinf_size + 2);
	}
	if (side_back.exists)
	{
		// Background
		glDisable(GL_TEXTURE_2D);
		Drawing::drawBorderedRect(x, bottom-height-4, x + sinf_size, bottom+2, col_bg, col_border);

		drawSide(bottom-4, right, alpha, side_back, x);
	}

	// Done
	glEnable(GL_LINE_SMOOTH);
}