[V2.x OGE tutorial 20] particle effect

Source: Internet
Author: User
1. Introduction

Particle systems represent techniques used to simulate certain fuzzy phenomena in 3D computer graphics. These phenomena use other traditional rendering techniques to achieve realistic game physics. We often use particle systems to simulate fire, explosion, smoke, water flow, Sparks, fallen leaves, clouds, fog, snow, dust, meteor trails, or abstract visual effects like trajectory.

 

2. Particle System Structure

The particle system of the OGE engine is represented by particles, particle transmitters, particle initiators, and particle modifiers.

Particle System: it is a subclass of entity, a system that manages particle transmitters, emission ratios, particle hatching, and particle modifiers.

Particle transmitter: inherits iupdatehandler and randomly generates emission coordinates within a fixed range.

Particle initializer: initializes some entity parameters. Example: Alpha Value

Particle modifier: a subclass of the particle initializer. It also modifies some entity parameters, but is updated in onmanagedupdate of the particle system, similar to the effect of registering modifier in entity.

Particle: encapsulate an entity that contains attributes of some particles.

 

3. instance code:

Public void setmyparticle (float PX, float py, textureregion region, scene pscene ){

Pointparticipant leemitter maid = new pointparticipant leemitter (PX, Py );

Spriteparticlesystem mparticlesystem = new spriteparticlesystem (maid, 10, 10, 30, region, pscene. getvertexbufferobjectmanager ());

Mparticlesystem. addparticipant leinitializer (New velocityparticipant leinitializer <sprite> (-150,150,-380, 0 ));

Mparticlesystem. addparticipant leinitializer (New expireparticipant leinitializer <sprite> (5f, 6f ));

Mparticlesystem. addparticipant lemodifier (New scaleparticlemodifier <sprite> (0f, 5f, 0, 1.3f ));

Mparticlesystem. addparticipant lemodifier (New alphaparticlemodifier <sprite> (0.8f, 1, 0.2f, 1f ));

Pscene. attachchild (mparticlesystem );

}

 

 

 

 

[V2.x OGE tutorial 20] particle effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.