Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Papervision3D Essentials

You're reading from  Papervision3D Essentials

Product type Book
Published in Sep 2009
Publisher Packt
ISBN-13 9781847195722
Pages 428 pages
Edition 1st Edition
Languages

Table of Contents (18) Chapters

Papervision3D Essentials
Credits
About the Authors
About the Reviewers
1. Preface
1. Setting Up 2. Building Your First Application 3. Primitives 4. Materials 5. Cameras 6. Moving Things Around 7. Shading 8. External Models 9. Z-Sorting 10. Particles 11. Filters and Effects 12. 3D Vector Drawing and Text 13. Optimizing Performance

BitmapParticleMaterial


The BitmapParticleMaterial class lets you use a bitmap as particle material. The bitmap can be created in two ways:

  • A dynamically drawn bitmap

  • A loaded bitmap

The next two sections will show an example for each of them. Let's start with a drawn bitmap.

Using a dynamically drawn bitmap as BitmapParticleMaterial

Again we will use the ParticleTemplate class as our starting point. In this example named BitmapParticleMaterialShapeExample, we need to import the BitmapParticleMaterial class.

import org.papervision3d.materials.special.BitmapParticleMaterial;

Add the following code at the top of the init() method to instantiate the Particles class and add it to the scene:

var particles:Particles = new Particles();
scene.addChild(particles);

Add the following inside the for loop:

var triangle:Shape = new Shape();
triangle.graphics.beginFill(Math.random() * 0xFFFFFF);
triangle.graphics.moveTo(0,0);
triangle.graphics.lineTo(20,20);
triangle.graphics.lineTo(40,0);
var bitmapData:BitmapData...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}