Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

chrissi

LenseFlares

This topic is 5307 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I saw the article about Lense-Flares here and now I want to render Lense-Flares in my game. Fortunately I can't see them: Can somebody help me? Here the code:
// Weltmatrix zurücksetzen 

   tbDirect3D::GetDevice()->SetTransform(D3DTS_WORLD, (D3DMATRIX*)(&tbMatrixIdentity())); 

   // Sonne und LenseFlares rendern 

   D3DLIGHT9      PointLight; 
   ZeroMemory(&PointLight, sizeof(D3DLIGHT9)); 
   PointLight.Type         = D3DLIGHT_POINT;            // Punktlicht 

   PointLight.Diffuse      = tbColor(1.0f, 1.0f, 0.75f);   // Gelbe Streufarbe 

   PointLight.Ambient      = tbColor(1.0f, 1.0f, 0.75f);   // Gelbe Hintergrundfarbe 

   PointLight.Position      = tbVector3(0,0,0);            // Die Position der Sonne 

   PointLight.Range      = m_fLast/2;               // Reichweite 

   PointLight.Attenuation0   = 0.75f;                  // Lichtabschwächung 

   PointLight.Attenuation1   = 0.0f;                     // ... 

   PointLight.Attenuation2   = 0.0f;                     // ... 


   tbDirect3D::SetRS(D3DRS_AMBIENT, (DWORD)tbColor(1.0f, 1.0f, 1.0f)); 

   tbVector2 vTranslation, vDirection, vNorm; 

   float fLenght; 

   float fTrans[]={1.0f,2.0f,3.0f,8.0f,-2.0f,-4.0f,-5.5f}; 
   float fScale[]={1.0f,0.5f,0.25f,1.0f,5.0f,0.25f,0.25f}; 
   int iSprite[]={0,1,0,3,2,0,3}; 

   D3DXVECTOR3 vLightPos=PointLight.Position; 

   // ---------------------------------------- 


   D3DXVec3Project(&vLightPos, 
                  &vLightPos, 
                  &m_vp, 
                  (const D3DXMATRIX*)&m_mProjection, 
                  (const D3DXMATRIX*)&m_mCamera, 
                  (const D3DXMATRIX*)&tbMatrixIdentity()); 

   vDirection=tbVector2(m_vScreenCenter.x-vLightPos.x,m_vScreenCenter.y-vLightPos.y); 

   fLenght=tbVector2Length(vDirection); 

   vNorm=tbVector2Normalize(vDirection); 

   for(int i=0; i<7;i++) 
   { 
      fLenght/=fTrans[i]; 

      vNorm.x*=fLenght; 
      vNorm.y*=fLenght; 

      m_pSpriteEngine->AddSprite(iSprite[i], tbVector3(vNorm.x+m_vScreenCenter.x, vNorm.y+m_vScreenCenter.y, m_vCameraPos.z+0.5f), tbColor(1.0f), tbVector2(fScale[i])); 
    
   } 

   // Licht einsetzen und aktivieren 

   tbDirect3D::GetDevice()->SetLight(0, &PointLight); 
   tbDirect3D::GetDevice()->LightEnable(0, TRUE);  
Thanks, Chrissi [edited by - chrissi on January 4, 2004 12:27:32 PM]

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Where is it found? I can''t see anything about 3d rendering at ati.it.

But,
Maybe somebody has a source code for me or an example, although I think that my code is right.

Thanks,

Chrissi

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!