tailieunhanh - Focus On 3D Terrain Programming phần 10
Mặc dù trong quan niệm, điều này tương tự như cây Tam giác nhị phân, chúng ta đã thảo luận đầu chương này, thực hiện nó là khá khác nhau. Chúng ta hãy thử nó! Một ảnh chụp màn hình kết cấu lập bản đồ và chi tiết ánh xạ từ demo7_2. | 194 8. Wrapping It Uũ Special Effects and More Velocity. This is the particle s direction and speed. Mass. This is used to accurately model particle motion. Color. This is the current color of the particle RGB triplet . Translucency. This is the current alpha value transparency of the particle. Size. This is the particle s visual size. Air Resistance. This is the particle s susceptibility to friction in the air. With that in mind we can create a simple particle structure for use with our particle engine. Remember We are greatly simplifying the whole particle engine architecture discussed earlier by cutting out the particle system and complex particle emitter middlemen. The particle structure that follows looks similar to the one we ll be using for our demos. struct SPARTICLE float m_fLife CVECTOR m_vecPosition CVECTOR m_vecVelocity float m_fMass float m_fSize CVECTOR m_vecColor float m_fTranslucency float m_fFriction As you can see we implemented all of the requirements in our previous particle-attribute list into our particle structure. How are we going to use this Well I ll show you but first let me demonstrate the particle engine class because it will be easier to understand everything if I show you this first class CPARTICLE_ENGINE Particle Engines and Their Outdoor Applications 195 private SPARTICLE m_pParticles int m_iNumParticles int m_iNumParticlesOnScreen gravity CVECTOR m_vecForces base particle attributes float m_fLife CVECTOR m_vecPosition float m_fMass float m_fSize CVECTOR m_vecColor float m_fFriction void CreateParticle float fVelX float fVelY float fVelZ public CPARTICLE_ENGINE void CPARTICLE_ENGINE void That is our engine structure as it stands now minus the member customization functions but those are all one line Set functions that you ve seen before namely in the CTERRAIN class . As you can see this structure has a lot of the same variables that our particle structure has. These are the parent or the default values that we are going to give each
đang nạp các trang xem trước