~ubuntu-branches/ubuntu/hardy/sauerbraten/hardy-backports

« back to all changes in this revision

Viewing changes to engine/grass.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert, Bruno "Fuddl" Kleinert, Cyril Brulebois
  • Date: 2007-08-26 17:45:25 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070826174525-uiv5yjjk092m95cl
Tags: 0.0.20070819.dfsg-1
[ Bruno "Fuddl" Kleinert ]
* Update the Debian menu file to the latest menu structure
* Remove 10_save_and_load_maps_from_home_directory.dpatch (Upstream solved
  this in this release) (Closes: #426691)
* Remove 10_search_home_for_config.dpatch (Upstream solved this in this
  release)
* Add 10_fix_clean_target.dpatch to avoid calling autotools in clean target
* Add NEWS.Debian

[ Cyril Brulebois ]
* Added XS-Vcs-Svn and XS-Vcs-Browser fields in the control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
307
307
    if(grasstest>1) return;
308
308
 
309
309
    extern int fullbright;
310
 
    if(fullbright) glColor3ub(128, 128, 128);
 
310
    if(nolights || (fullbright && editmode)) glColor3ub(128, 128, 128);
311
311
    else glColor3ubv(g.color);
312
312
    float offset = detrnd((size_t)&g * (seed + 1)*13, grasstex->xs)/float(grasstex->xs);
313
313
    glTexCoord2f(offset, 1); glVertex3fv(b1.v);
314
314
    glTexCoord2f(offset, 0); glVertex3fv(t1.v);
315
315
    glTexCoord2f(offset + float(grasswidth)*64.0f/grasstex->xs, 0); glVertex3fv(t2.v);
316
316
    glTexCoord2f(offset + float(grasswidth)*64.0f/grasstex->xs, 1); glVertex3fv(b2.v);
 
317
    xtraverts += 4;
317
318
}
318
319
 
319
320
void rendergrasssamples(vtxarray *va, const vec &dir)
329
330
            case GRASS_BOUNDS:
330
331
            {
331
332
                grassbounds &b = *(grassbounds *)&g;
 
333
                if(reflecting && (refracting ? o.z-b.radius>=refracting : o.z+b.radius<reflecting))
 
334
                {
 
335
                    i += b.numsamples;
 
336
                    continue;
 
337
                }
332
338
                float dist = o.dist(camera1->o, tograss);
333
339
                if(dist > grassdist + b.radius || (dir.dot(tograss)<0 && dist > b.radius + 2*(grassgrid + player->eyeheight)))
334
340
                    i += b.numsamples;
352
358
 
353
359
            case GRASS_SAMPLE:
354
360
            {
 
361
                if(reflecting && (refracting ? o.z>=reflecting : o.z+grassheight<=reflecting)) continue;
355
362
                float dist = o.dist(camera1->o, tograss);
356
363
                if(dist > grassdist || (dir.dot(tograss)<0 && dist > grasswidth/2 + 2*(grassgrid + player->eyeheight))) continue;
357
364
 
388
395
 
389
396
    grasstex = NULL;
390
397
 
391
 
    glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2.0f);
 
398
    setuptmu(0, "C * T x 2");
392
399
 
393
400
    glBegin(GL_QUADS);
394
401
}
397
404
{
398
405
    glEnd();
399
406
 
400
 
    glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.0f);
 
407
    resettmu(0);
401
408
 
402
409
    defaultshader->set();
403
410
 
421
428
    {
422
429
        if(!va->grasstris || va->occluded >= OCCLUDE_GEOM || va->curlod) continue;
423
430
        if(va->distance > grassdist) continue;
 
431
        if(reflecting && (refracting ? va->z>=refracting : va->z+va->size<reflecting)) continue;
424
432
        if(!va->grasssamples) gengrasssamples(va);
425
433
        if(!rendered++) setupgrass();
426
434
        rendergrasssamples(va, dir);