/******************************************************************************* 関数名: void DrawGame(void) 引数: なし 戻り値: なし 説明: ゲームの描画関数 *******************************************************************************/ void DrawGame(void) { //カメラの設置 SetCamera(); //ステージの描画処理 DrawStageManager(); DrawMeshDome(); //DrawModel(); DrawParticle(); DrawEnemy(); DrawEnemyBullet(); DrawItemBullet(); if( IsDebugMode()) DrawPlayer(); DrawPlayerBullet(); DrawGun(); DrawShadow(); //DrawBillBoard(); DrawTime(); DrawGunSight(); DrawNumBullet(); DrawNumLife(); DrawClock(); DrawEnemyNum(); }
void ParticleManager::DrawParticles( float tween /*= 1.0f*/, int layer /*= -1*/ ) { // tween origin _currentTween = tween; _camtx = -TweenValues(_oldOriginX, _originX, tween); _camty = -TweenValues(_oldOriginY, _originY, tween); _camtz = TweenValues(_oldOriginZ, _originZ, tween); // record current GFX states /* not used float cAlpha = GetAlpha(); float cRotation = GetRotation(); float cScaleX = GetScaleX(); float cScaleY = GetScaleY(); int cRed = GetR(); int cGreen = GetG(); int cBlue = GetB(); */ // rendercount = 0 if (_angle != 0) { _angleTweened = TweenValues(_oldAngle, _angle, tween); _matrix.Set(cosf(_angleTweened / 180.0f * (float)M_PI), sinf(_angleTweened / 180.0f * (float)M_PI), -sinf(_angleTweened / 180.0f * (float)M_PI), cosf(_angleTweened / 180.0f * (float)M_PI)); } int layers = 0; int startLayer = 0; if (layer == -1 || layer >= _effectLayers) { layers = _effectLayers - 1; } else { layers = layer; startLayer = layer; } for (int el = startLayer; el <= layers; ++el) { for (int i = 0; i < 10; ++i) { auto& plist = _inUse[el][i]; for (auto it = plist.begin(); it != plist.end(); ++it) { DrawParticle(*it); } } } DrawEffects(); // restore GFX states /* not used SetAlpha(cAlpha); SetRotation(cRotation); SetScale(cScaleX, cScaleY); SetColor(cR, cG, cB); */ }
void ParticleSystem::DrawSystem() { vec3_t normal, forward, right, up; gEngfuncs.GetViewAngles((float*)normal); AngleVectors(normal, forward, right, up); particle* pParticle = m_pActiveParticle; for( pParticle = m_pActiveParticle; pParticle; pParticle = pParticle->nextpart ) { DrawParticle( pParticle, right, up ); } }
void ParticleSystem :: DrawSystem( void ) { Vector normal, forward, right, up; GetViewAngles( normal ); AngleVectors( normal, forward, right, up ); particle* pParticle = m_pActiveParticle; for( pParticle = m_pActiveParticle; pParticle; pParticle = pParticle->nextpart ) { DrawParticle( pParticle, right, up ); } }
void ParticleSystem::Render(Effect * effect) { ParticleEffect *pParticleEffect = static_cast<ParticleEffect*>(effect); if(!m_finalized) { Finalize(); m_finalized = true; } pParticleEffect->SetTime(m_time); DrawParticle(indexObject, vertexObject, pixelObject, *pParticleEffect); }
void Scene::Update(const ObjectList& objList, float dt) { UNREFERENCED_PARAMETER(objList); //Refresh the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(m_bgColor.x, m_bgColor.y, m_bgColor.z, m_bgColor.w); // Set mouse position GetPerspPosition(); GetOrthoPosition(); //Todo: Lambda loop expression //std::for_each(m_DrawList.begin(), m_DrawList.end(), [&](DrawList::iterator& it) //{ for (auto it = m_DrawList.begin(); it != m_DrawList.end(); ++it) { if ((*it)->GetType() != PARTICLE) { //Update pipeline Pipeline((*it), dt); vec4 sptColor = (*it)->GetColor(); glUniform4f(m_GSM->GetGLManager()->GetUnifrom(COLOR), sptColor.x, sptColor.y, sptColor.z, sptColor.w); glUniform1i(m_GSM->GetGLManager()->GetUnifrom(TYPE), (*it)->GetType()); glUniform1f(m_GSM->GetGLManager()->GetUnifrom(TIME), Timer::GetInstance().GetElapsedTime()); //Todo: high quality? //glUniformMatrix4fv(); // Draw Texts if ((*it)->GetType() == TEXT) DrawTexts(static_cast<Text*>(*it)); else if ((*it)->GetType() == LIGHT) DrawLights(static_cast<Light*>(*it)); // Draw Sprites else if ((*it)->GetType() == SPRITE || (*it)->GetType() == DARKNESS) DrawSprites(*it); } // Draw Particles else DrawParticle(static_cast<Emitter*>(*it), dt); } }
void CParticleSystem :: DrawSystem( void ) { CParticle *pParticle = m_pActiveParticle; if( m_pEntity != NULL ) { // don't draw if the system is outside the player's PVS. if( m_pEntity->curstate.messagenum != r_currentMessageNum ) return; } for( pParticle = m_pActiveParticle; pParticle; pParticle = pParticle->nextpart ) { DrawParticle( pParticle, RI.vright, RI.vup ); } }
void ParticleManager::DrawEffect( Effect *e ) { for (int i = 0; i < 10; ++i) { // particle const auto& plist = e->GetParticles(i); for (auto it = plist.begin(); it != plist.end(); ++it) { DrawParticle(*it); // effect auto& subeffects = (*it)->GetChildren(); for (auto it2 = subeffects.begin(); it2 != subeffects.end(); ++it2) { DrawEffect(static_cast<Effect*>(*it2)); } } } }
void PARTICLE::Draw() { glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthMask(0); int i; for (i = 0; i < MAX_PARTICLES; i++) { if (particle[i].active) { if (curtime - particle[i].timestamp > particle[i].longevity) particle[i].active = false; else DrawParticle(particle[i]); } } glDepthMask(1); glPopAttrib(); }
void NETHER::draw_game(bool shadows) { { MINY=-8*zoom; MINX=-(10+viewp.z*4)*zoom; MAXY=(9+viewp.z*4)*zoom; MAXX=8*zoom; } if (!explosions.EmptyP()) { int minstep=128; List<EXPLOSION> l; EXPLOSION *n; float offs=0.0,r; l.Instance(explosions); l.Rewind(); while(l.Iterate(n)) { if (n->size==2 && n->step<minstep) minstep=n->step; } /* while */ r=(128-minstep)/256.0; offs=sin(minstep)*r; gluLookAt(viewp.x+camera.x*zoom+offs,viewp.y+camera.y*zoom+offs,viewp.z+camera.z*zoom,viewp.x+offs,viewp.y+offs,viewp.z,0,0,1); } else { gluLookAt(viewp.x+camera.x*zoom,viewp.y+camera.y*zoom,viewp.z+camera.z*zoom,viewp.x,viewp.y,viewp.z,0,0,1); } /* if */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* Draw: */ /* Draw the map: */ drawmap(shadows); /* Draw the robots and bullets: */ { int i; List<ROBOT> l; List<BULLET> l2; ROBOT *r; BULLET *b; for(i=0;i<2;i++) { l.Instance(robots[i]); l.Rewind(); while(l.Iterate(r)) { if (r->pos.y>=(viewp.y+MINY) && r->pos.y<=(viewp.y+MAXY) && r->pos.x>=(viewp.x+MINX) && r->pos.x<=(viewp.x+MAXX)) { glPushMatrix(); glTranslatef(r->pos.x,r->pos.y,r->pos.z); DrawRobot(r,i,shadows); glPopMatrix(); } /* if */ } /* while */ } /* for */ l2.Instance(bullets); l2.Rewind(); while(l2.Iterate(b)) { if (b->pos.y>=(viewp.y+MINY) && b->pos.y<=(viewp.y+MAXY) && b->pos.x>=(viewp.x+MINX) && b->pos.x<=(viewp.x+MAXX)) { glPushMatrix(); glTranslatef(b->pos.x,b->pos.y,b->pos.z); DrawBullet(b,shadows); glPopMatrix(); } /* if */ } /* while */ } /* Draw the ship: */ glPushMatrix(); glTranslatef(shipp.x,shipp.y,shipp.z); if (!shadows) ship->draw(0.7,0.7,0.7); glPopMatrix(); if (shadows) { float sx,sy; float x[2],y[2]; float minz; Vector light; light=lightposv; light=light/light.z; sx=shipp.x-light.x*shipp.z; sy=shipp.y-light.y*shipp.z; if (controlled==0) { x[0]=sx+ship->shdw_cmc.x[0]; x[1]=sx+ship->shdw_cmc.x[1]; y[0]=sy+ship->shdw_cmc.y[0]; y[1]=sy+ship->shdw_cmc.y[1]; minz=MapMaxZ(x,y); } else { minz=controlled->pos.z; } /* if */ glPushMatrix(); glTranslatef(sx,sy,minz+0.05); if (shadows) ship->DrawShadow(0,0,0,0.5); glPopMatrix(); } /* Draw the extras: */ /* Draw nuclear explosions: */ if (!shadows) { List<EXPLOSION> l; EXPLOSION *n; float a,r; l.Instance(explosions); l.Rewind(); while(l.Iterate(n)) { a=(128.0f-n->step)/80.0f; r=1.0; if (n->size==0) { r=(float(n->step)/512.0f)+0.1; } /* if */ if (n->size==1) { r=(float(n->step)/96.0f)+0.5; } /* if */ if (n->size==2) { r=(float(n->step)/48.0f)+1.0; } /* if */ if (a<0) a=0; if (a>1) a=1; glPushMatrix(); glTranslatef(n->pos.x,n->pos.y,n->pos.z); glColor4f(1.0f,0.5f,0.0,a); glDepthMask(GL_FALSE); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glutSolidSphere(r,8,8); glDisable(GL_BLEND); glDepthMask(GL_TRUE); glPopMatrix(); } /* while */ } /* Draw the particles: */ if (!shadows) { List<PARTICLE> l; PARTICLE *p; l.Instance(particles); l.Rewind(); while(l.Iterate(p)) { if (p->pos.y>=(viewp.y+MINY) && p->pos.y<=(viewp.y+MAXY) && p->pos.x>=(viewp.x+MINX) && p->pos.x<=(viewp.x+MAXX)) DrawParticle(p); } /* if */ } /* if */ } /* NETHER::draw_screen */