Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TMinimalObject::RenderShadowsFOV()
- {
- if (fovshadows)
- {
- b2Vec2 pos=game->GetPlayerPosition();
- pos*=C_SCALE;
- b2PolygonShape* sh;
- for (b2Fixture* f=rbody->GetFixtureList(); f; f=f->GetNext())
- {
- sh=(b2PolygonShape*)f->GetShape();
- int nrverts=sh->GetVertexCount();
- b2Vec2 worldvert;
- b2Vec2 offset1;
- b2Vec2 offset2;
- SetTexture(0);
- SetBlend(BM_SOLID);
- SetColor(0,0,0,1);
- glBegin(GL_TRIANGLE_STRIP);
- for (int i=0; i<nrverts+1; i++)
- {
- int i2=i%nrverts;
- worldvert=rbody->GetWorldPoint(sh->GetVertex(i2));
- worldvert*=C_SCALE;
- offset1=worldvert;
- offset1-=pos;
- offset1.Normalize();
- offset2=offset1;
- offset2*=4;
- offset1*=1000000;
- glVertex2f(worldvert.x+offset1.x,worldvert.y+offset1.y);
- glVertex2f(worldvert.x+offset2.x,worldvert.y+offset2.y);
- }
- glEnd();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement