Exemplo n.º 1
0
void
render_objects(r_context_t *c)
{
    int i;
    
    c->r_leafcount = 0;

#if 0
    /* Useful for exploring face culling effectiveness */
    if (g->r_lockpvs)
    {
	render_backend(&facelist);
	return;
    }
#endif

    c->cos_fov = cos(g->r_eyefov/2.0f * DEG2RAD);

    /* Get clip coordinate transformation matrix */
    gen_clipmat(c);

    c->facelist.numfaces = c->translist.numfaces = 0;
    c->numsky = 0;
    /* Clear "included" faces list */
    memset(c->r_faceinc, 0, g->r_numfaces * sizeof(int));

    /* "Walk" the BSP tree to generate a list of faces to render */
    /* FIXME: include other models */
    render_walk_model(c, 0);

    /* Sort the face list */
    sort_faces(c);

    /* FIXME: Reset depth buffer range based on max/min Z in facelist */
    
    /* Draw sky first -- on first pipe if geometry decomposed */
    if (c->numsky && g->r_sky && c->range[0] == 0.0)
		render_backend_sky(c);


    /* Draw normal faces */
    render_backend(c, &(c->facelist));

    /* Draw visible mapents (md3 models) -- on last pipe if geometry decomposed */

	if (g->r_drawitems && c->range[1] == 1.0)
	{
	  for(i=0; i < g->g_mapent_numinst; i++)
	  {
		if (c->r_eyecluster < 0 ||
		    BSP_TESTVIS(c->r_eyecluster, g->g_mapent_inst[i].cluster))
		render_backend_mapent(c, i);
	  }
	}

    /* Draw transparent faces last */
    if (c->translist.numfaces)
	render_backend(c, &(c->translist));
}
Exemplo n.º 2
0
void GLApp::displayWorld()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadMatrixf(camera.GetMatrix());
	gen_clipmat();
	glGetIntegerv(GL_VIEWPORT, viewPort);
	glGetDoublev(GL_MODELVIEW_MATRIX, modelViewMatrix);
	glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix);

	glEnable(GL_TEXTURE_2D);

	DrawSky();
	DrawSea();
	terrain.Render(camera.position);//();
	Environment::instance().Render();
	pman.Render();

	checkError("displayWorld");


}