Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/particlesystem/sphereSurfaceEmitter.cxx

Go to the documentation of this file.
00001 // Filename: sphereSurfaceEmitter.cxx
00002 // Created by:  charles (22Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "sphereSurfaceEmitter.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //    Function : SphereSurfaceEmitter
00023 //      Access : Public
00024 // Description : constructor
00025 ////////////////////////////////////////////////////////////////////
00026 SphereSurfaceEmitter::
00027 SphereSurfaceEmitter(void) {
00028   _radius = 1.0f;
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //    Function : SphereSurfaceEmitter
00033 //      Access : Public
00034 // Description : copy constructor
00035 ////////////////////////////////////////////////////////////////////
00036 SphereSurfaceEmitter::
00037 SphereSurfaceEmitter(const SphereSurfaceEmitter &copy) :
00038   BaseParticleEmitter(copy) {
00039   _radius = copy._radius;
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //    Function : ~SphereSurfaceEmitter
00044 //      Access : Public
00045 // Description : destructor
00046 ////////////////////////////////////////////////////////////////////
00047 SphereSurfaceEmitter::
00048 ~SphereSurfaceEmitter(void) {
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //    Function : make_copy
00053 //      Access : Public
00054 // Description : copier
00055 ////////////////////////////////////////////////////////////////////
00056 BaseParticleEmitter *SphereSurfaceEmitter::
00057 make_copy(void) {
00058   return new SphereSurfaceEmitter(*this);
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //    Function : SphereSurfaceEmitter::assign_initial_position
00063 //      Access : Public
00064 // Description : Generates a location for a new particle
00065 ////////////////////////////////////////////////////////////////////
00066 void SphereSurfaceEmitter::
00067 assign_initial_position(LPoint3f& pos) {
00068   float z, theta, r;
00069 
00070   z = SPREAD(_radius);
00071   r = sqrtf((_radius * _radius) - (z * z));
00072   theta = NORMALIZED_RAND() * 2.0f * MathNumbers::pi_f;
00073 
00074   pos.set(r * cosf(theta), r * sinf(theta), z);
00075 }
00076 
00077 ////////////////////////////////////////////////////////////////////
00078 //    Function : SphereSurfaceEmitter::assign_initial_velocity
00079 //      Access : Public
00080 // Description : Generates a velocity for a new particle
00081 ////////////////////////////////////////////////////////////////////
00082 void SphereSurfaceEmitter::
00083 assign_initial_velocity(LVector3f& vel) {
00084   vel.set(0,0,0);
00085 }

Generated on Fri May 2 00:41:00 2003 for Panda by doxygen1.3