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

panda/src/particlesystem/boxEmitter.cxx

Go to the documentation of this file.
00001 // Filename: boxEmitter.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 "boxEmitter.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //    Function : BoxEmitter
00023 //      Access : Public
00024 // Description : constructor
00025 ////////////////////////////////////////////////////////////////////
00026 BoxEmitter::
00027 BoxEmitter(void) :
00028   BaseParticleEmitter() {
00029   _vmin.set(-0.5f, -0.5f, -0.5f);
00030   _vmax.set( 0.5f,  0.5f,  0.5f);
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //    Function : BoxEmitter
00035 //      Access : Public
00036 // Description : copy constructor
00037 ////////////////////////////////////////////////////////////////////
00038 BoxEmitter::
00039 BoxEmitter(const BoxEmitter &copy) :
00040   BaseParticleEmitter(copy) {
00041   _vmin = copy._vmin;
00042   _vmax = copy._vmax;
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //    Function : ~BoxEmitter
00047 //      Access : Public
00048 // Description : destructor
00049 ////////////////////////////////////////////////////////////////////
00050 BoxEmitter::
00051 ~BoxEmitter(void) {
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //    Function : make_copy
00056 //      Access : Public
00057 // Description : copier
00058 ////////////////////////////////////////////////////////////////////
00059 BaseParticleEmitter *BoxEmitter::
00060 make_copy(void) {
00061   return new BoxEmitter(*this);
00062 }
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //    Function : BoxEmitter::assign_initial_position
00066 //      Access : Public
00067 // Description : Generates a location for a new particle
00068 ////////////////////////////////////////////////////////////////////
00069 void BoxEmitter::
00070 assign_initial_position(LPoint3f& pos) {
00071   float t_x = NORMALIZED_RAND();
00072   float t_y = NORMALIZED_RAND();
00073   float t_z = NORMALIZED_RAND();
00074 
00075   LVector3f v_diff = _vmax - _vmin;
00076 
00077   float lerp_x = _vmin[0] + t_x * v_diff[0];
00078   float lerp_y = _vmin[1] + t_y * v_diff[1];
00079   float lerp_z = _vmin[2] + t_z * v_diff[2];
00080 
00081   pos.set(lerp_x, lerp_y, lerp_z);
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //    Function : BoxEmitter::assign_initial_velocity
00086 //      Access : Public
00087 // Description : Generates a velocity for a new particle
00088 ////////////////////////////////////////////////////////////////////
00089 void BoxEmitter::
00090 assign_initial_velocity(LVector3f& vel) {
00091   vel.set(0,0,0);
00092 }

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