daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Jan 3rd, 2013 2,600 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void TMinimalObject::RenderShadowsFOV()
  2. {
  3.     if (fovshadows)
  4.     {
  5.         b2Vec2 pos=game->GetPlayerPosition();
  6.         pos*=C_SCALE;
  7.         b2PolygonShape* sh;
  8.         for (b2Fixture* f=rbody->GetFixtureList(); f; f=f->GetNext())
  9.         {
  10.             sh=(b2PolygonShape*)f->GetShape();
  11.  
  12.             int nrverts=sh->GetVertexCount();
  13.             b2Vec2 worldvert;
  14.             b2Vec2 offset1;
  15.             b2Vec2 offset2;
  16.             SetTexture(0);
  17.             SetBlend(BM_SOLID);
  18.             SetColor(0,0,0,1);
  19.             glBegin(GL_TRIANGLE_STRIP);
  20.             for (int i=0; i<nrverts+1; i++)
  21.             {
  22.                 int i2=i%nrverts;
  23.                 worldvert=rbody->GetWorldPoint(sh->GetVertex(i2));
  24.                 worldvert*=C_SCALE;
  25.                 offset1=worldvert;
  26.                 offset1-=pos;
  27.                 offset1.Normalize();
  28.                 offset2=offset1;
  29.                 offset2*=4;
  30.                 offset1*=1000000;
  31.                 glVertex2f(worldvert.x+offset1.x,worldvert.y+offset1.y);
  32.                 glVertex2f(worldvert.x+offset2.x,worldvert.y+offset2.y);
  33.             }
  34.             glEnd();
  35.         }
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand