Difference between revisions of "Neurocam Particle Engine"

From Second Life Wiki
Jump to navigation Jump to search
m (added line breaks for better readability on mobile screens and removed deprecated LSL code)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<lsl>
//  Written By Draconis Neurocam
//
//  You are free:
//
//      * to Share — to copy, distribute and transmit the work
//      * to Remix — to adapt the work
//
//  Under the following conditions:
//
//    * Attribution:
//          You must attribute the work in the manner specified by the author or
//          licensor (but not in any way that suggests that they endorse you or
//          your use of the work).
//      Attribute this work:
//          What does "Attribute this work" mean?
//          The page you came from contained embedded licensing metadata,
//          including how the creator wishes to be attributed for re-use. You
//          can use the HTML here to cite the work.
//      Doing so will also include metadata on your page so that others can find
//      the original work as well.
//    * For any reuse or distribution, you must make clear to others the license
//      terms of this work. The best way to do this is with a link to this web
//      page.
//    * Any of the above conditions can be waived if you get permission from the
//      copyright holder.
//    * Nothing in this license impairs or restricts the author's moral rights.
//
//  http://creativecommons.org/licenses/by/3.0/


float burst_radius          = 1.0;
<source lang="lsl2">
float angle_begin            = PI_BY_TWO;
//Written By Draconis Neurocam
float angle_end              = PI_BY_TWO;
//You are free:
key   target                = "";
//    * to Share — to copy, distribute and transmit the work
//    * to Remix — to adapt the work
//Under the following conditions:
//    *
//      Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).    
//      Attribute this work:
//      What does "Attribute this work" mean?
//      The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work.
//      Doing so will also include metadata on your page so that others can find the original work as well.   
//    * For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
//    * Any of the above conditions can be waived if you get permission from the copyright holder.
//    * Nothing in this license impairs or restricts the author's moral rights.
//http://creativecommons.org/licenses/by/3.0/


vector  start_color          = <0.5, 0.0, 1.0>;
float burst_radius = 1.0;
vector  end_color            = ZERO_VECTOR;                            //  black
float angle_begin = PI_BY_TWO;
float   start_alpha          = 1.0;                                     //  opaque
float angle_end    = PI_BY_TWO;
float   end_alpha            = 0.1;
key   target      = "";
vector start_scale          = <0.5, 0.5, 0.5>;
vector  end_scale            = <1.0, 1.0, 1.0>;
key     texture              = "dcab6cc4-172f-e30d-b1d0-f558446f20d4";
float  start_glow          = 0.0;                                    //  none
float  end_glow            = 0.0;                                    //  none


float  source_max_age      = 0.0;
vector  start_color = <0.5,0.0,1.0>;
float   particle_max_age    = 2.0;
vector  end_color  = <0.0,0.0,0.0>;
float  burst_rate          = 0.02;
float  start_alpha = 1.0;
integer burst_particle_count = 2;
float  end_alpha  = 0.1;
vector  start_scale = <0.5,0.5,0.5>;
vector  end_scale   = <1.0,1.0,1.0>;
key    texture    = "dcab6cc4-172f-e30d-b1d0-f558446f20d4";
float  start_glow  = 0.0;
float  end_glow    = 0.0;


vector  acceleration        = <0.0, 1.0, 1.0>;
float  source_max_age      = 0.0;
vector  omega                = <2.0, 0.0, 0.0>;
float  particle_max_age    = 2.0;
float  speed_min            = 1.0;
float  burst_rate          = 0.02;
float  speed_max            = 1.0;
integer burst_particle_count = 2;


Particles()
vector  acceleration = <0.0,1.0,1.0>;
{
vector  omega        = <2.0,0.0,0.0>;
    llParticleSystem([
float  speed_min    = 1.0;
float  speed_max    = 1.0;


//      System Behaviour
Particles()
        PSYS_PART_FLAGS,
{
//                      PSYS_PART_BOUNCE_MASK
llParticleSystem([
                        PSYS_PART_EMISSIVE_MASK
//                      | PSYS_PART_FOLLOW_SRC_MASK
                        | PSYS_PART_FOLLOW_VELOCITY_MASK
                        | PSYS_PART_INTERP_COLOR_MASK
                        | PSYS_PART_INTERP_SCALE_MASK
//                      | PSYS_PART_RIBBON_MASK
//                      | PSYS_PART_TARGET_LINEAR_MASK
//                      | PSYS_PART_TARGET_POS_MASK
//                      | PSYS_PART_WIND_MASK
                        ,


//     System Presentation
//System Behaviour
        PSYS_SRC_PATTERN,
PSYS_PART_FLAGS,
//                     PSYS_SRC_PATTERN_ANGLE
//PSYS_PART_BOUNCE_MASK
//                     PSYS_SRC_PATTERN_ANGLE_CONE
PSYS_PART_EMISSIVE_MASK
//                     PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
//| PSYS_PART_FOLLOW_SRC_MASK
                        PSYS_SRC_PATTERN_DROP
| PSYS_PART_FOLLOW_VELOCITY_MASK
//                     PSYS_SRC_PATTERN_EXPLODE
| PSYS_PART_INTERP_COLOR_MASK
                        ,
| PSYS_PART_INTERP_SCALE_MASK
        PSYS_SRC_BURST_RADIUS, burst_radius,
//| PSYS_PART_RIBBON_MASK
        PSYS_SRC_ANGLE_BEGIN,  angle_begin,    //Either or
//| PSYS_PART_TARGET_LINEAR_MASK
        PSYS_SRC_ANGLE_END,    angle_end,
//| PSYS_PART_TARGET_POS_MASK
        PSYS_SRC_TARGET_KEY,  target,
//| PSYS_PART_WIND_MASK
,
//System Presentation
PSYS_SRC_PATTERN,
//PSYS_SRC_PATTERN_ANGLE
//PSYS_SRC_PATTERN_ANGLE_CONE
//PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
PSYS_SRC_PATTERN_DROP
//PSYS_SRC_PATTERN_EXPLODE
,
PSYS_SRC_BURST_RADIUS, burst_radius,
//PSYS_SRC_INNERANGLE, angle_begin,    //Either or
//PSYS_SRC_OUTERANGLE, angle_end,
PSYS_SRC_ANGLE_BEGIN,  angle_begin,    //Either or
PSYS_SRC_ANGLE_END,    angle_end,
PSYS_SRC_TARGET_KEY,  target,
//Particle appearance
PSYS_PART_START_COLOR, start_color,
PSYS_PART_END_COLOR,  end_color,
PSYS_PART_START_ALPHA, start_alpha,
PSYS_PART_END_ALPHA,  end_alpha,
PSYS_PART_START_SCALE, start_scale,
PSYS_PART_END_SCALE,  end_scale,
PSYS_SRC_TEXTURE,      texture,
PSYS_PART_START_GLOW,  start_glow,
PSYS_PART_END_GLOW,    end_glow,


//     Particle appearance
//Particle Blending
        PSYS_PART_START_COLOR, start_color,
PSYS_PART_BLEND_FUNC_SOURCE,
        PSYS_PART_END_COLOR,   end_color,
  //PSYS_PART_BF_ONE
        PSYS_PART_START_ALPHA, start_alpha,
  //PSYS_PART_BF_ZERO
         PSYS_PART_END_ALPHA,   end_alpha,
  //PSYS_PART_BF_DEST_COLOR
        PSYS_PART_START_SCALE, start_scale,
  //PSYS_PART_BF_SOURCE_COLOR
        PSYS_PART_END_SCALE,   end_scale,
  //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
        PSYS_SRC_TEXTURE,     texture,
  //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
        PSYS_PART_START_GLOW, start_glow,
  PSYS_PART_BF_SOURCE_ALPHA
        PSYS_PART_END_GLOW,    end_glow,
  //PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
  ,
PSYS_PART_BLEND_FUNC_DEST,
  //PSYS_PART_BF_ONE
  //PSYS_PART_BF_ZERO
  //PSYS_PART_BF_DEST_COLOR
  //PSYS_PART_BF_SOURCE_COLOR
  //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
  //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
  //PSYS_PART_BF_SOURCE_ALPHA
  PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
  ,
//Particle Flow
PSYS_SRC_MAX_AGE,         source_max_age,
PSYS_PART_MAX_AGE,         particle_max_age,
PSYS_SRC_BURST_RATE,      burst_rate,
PSYS_SRC_BURST_PART_COUNT, burst_particle_count,  
//Particle Motion
PSYS_SRC_ACCEL,           acceleration,
PSYS_SRC_OMEGA,           omega,
PSYS_SRC_BURST_SPEED_MIN, speed_min,
PSYS_SRC_BURST_SPEED_MAX, speed_max
]);
}


//      Particle Blending
default  
        PSYS_PART_BLEND_FUNC_SOURCE,
{
//                                  PSYS_PART_BF_ONE
state_entry()
//                                  PSYS_PART_BF_ZERO
{
//                                  PSYS_PART_BF_DEST_COLOR
Particles();
//                                  PSYS_PART_BF_SOURCE_COLOR
}
//                                  PSYS_PART_BF_ONE_MINUS_DEST_COLOR
}
//                                  PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
</source>
                                    PSYS_PART_BF_SOURCE_ALPHA
//                                  PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
                                  ,
        PSYS_PART_BLEND_FUNC_DEST,
//                                  PSYS_PART_BF_ONE
//                                  PSYS_PART_BF_ZERO
//                                  PSYS_PART_BF_DEST_COLOR
//                                  PSYS_PART_BF_SOURCE_COLOR
//                                  PSYS_PART_BF_ONE_MINUS_DEST_COLOR
//                                  PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
//                                  PSYS_PART_BF_SOURCE_ALPHA
                                    PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
                                    ,
 
//      Particle Flow
        PSYS_SRC_MAX_AGE,          source_max_age,
        PSYS_PART_MAX_AGE,        particle_max_age,
        PSYS_SRC_BURST_RATE,      burst_rate,
        PSYS_SRC_BURST_PART_COUNT, burst_particle_count,
 
//      Particle Motion
        PSYS_SRC_ACCEL,          acceleration,
        PSYS_SRC_OMEGA,          omega,
        PSYS_SRC_BURST_SPEED_MIN, speed_min,
        PSYS_SRC_BURST_SPEED_MAX, speed_max
        ]);
}
 
default
{
    state_entry()
    {
        Particles();
    }
}
</lsl>

Latest revision as of 14:50, 25 April 2015

 
	//Written By Draconis Neurocam
	//You are free:
	//    * to Share — to copy, distribute and transmit the work
	//    * to Remix — to adapt the work
	//Under the following conditions:
	//    *
	//      Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).   
	//      Attribute this work:
	//      What does "Attribute this work" mean?
	//      The page you came from contained embedded licensing metadata, including how the creator wishes to be attributed for re-use. You can use the HTML here to cite the work. 
	//      Doing so will also include metadata on your page so that others can find the original work as well.     
	//    * For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.
	//    * Any of the above conditions can be waived if you get permission from the copyright holder.
	//    * Nothing in this license impairs or restricts the author's moral rights.
	//http://creativecommons.org/licenses/by/3.0/

	float burst_radius = 1.0;
	float angle_begin  = PI_BY_TWO;
	float angle_end    = PI_BY_TWO;
	key   target       = "";

	vector  start_color = <0.5,0.0,1.0>;
	vector  end_color   = <0.0,0.0,0.0>;
	float   start_alpha = 1.0;
	float   end_alpha   = 0.1;
	vector  start_scale = <0.5,0.5,0.5>;
	vector  end_scale   = <1.0,1.0,1.0>;
	key     texture     = "dcab6cc4-172f-e30d-b1d0-f558446f20d4";
	float   start_glow  = 0.0;
	float   end_glow    = 0.0;

	float   source_max_age       = 0.0;
	float   particle_max_age     = 2.0;
	float   burst_rate           = 0.02;
	integer burst_particle_count = 2;

	vector  acceleration = <0.0,1.0,1.0>;
	vector  omega        = <2.0,0.0,0.0>;
	float   speed_min    = 1.0;
	float   speed_max    = 1.0;

	Particles()
	{
		llParticleSystem([

			//System Behaviour
			PSYS_PART_FLAGS, 
							 //PSYS_PART_BOUNCE_MASK 
							 PSYS_PART_EMISSIVE_MASK 
							 //| PSYS_PART_FOLLOW_SRC_MASK 
							 | PSYS_PART_FOLLOW_VELOCITY_MASK 
							 | PSYS_PART_INTERP_COLOR_MASK 
							 | PSYS_PART_INTERP_SCALE_MASK 
							 //| PSYS_PART_RIBBON_MASK 
							 //| PSYS_PART_TARGET_LINEAR_MASK 
							 //| PSYS_PART_TARGET_POS_MASK 
							 //| PSYS_PART_WIND_MASK
							 ,
							 
			//System Presentation
			PSYS_SRC_PATTERN,
							//PSYS_SRC_PATTERN_ANGLE
							//PSYS_SRC_PATTERN_ANGLE_CONE
							//PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
							PSYS_SRC_PATTERN_DROP
							//PSYS_SRC_PATTERN_EXPLODE
							,
							
			PSYS_SRC_BURST_RADIUS, burst_radius,
			//PSYS_SRC_INNERANGLE, angle_begin,     //Either or
			//PSYS_SRC_OUTERANGLE, angle_end,
			PSYS_SRC_ANGLE_BEGIN,  angle_begin,     //Either or
			PSYS_SRC_ANGLE_END,    angle_end,
			PSYS_SRC_TARGET_KEY,   target,
			
			//Particle appearance
			PSYS_PART_START_COLOR, start_color,
			PSYS_PART_END_COLOR,   end_color,
			PSYS_PART_START_ALPHA, start_alpha,
			PSYS_PART_END_ALPHA,   end_alpha,
			PSYS_PART_START_SCALE, start_scale,
			PSYS_PART_END_SCALE,   end_scale,
			PSYS_SRC_TEXTURE,      texture,
			PSYS_PART_START_GLOW,  start_glow,
			PSYS_PART_END_GLOW,    end_glow,

			//Particle Blending
			PSYS_PART_BLEND_FUNC_SOURCE,
									   //PSYS_PART_BF_ONE
									   //PSYS_PART_BF_ZERO
									   //PSYS_PART_BF_DEST_COLOR
									   //PSYS_PART_BF_SOURCE_COLOR
									   //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
									   //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
									   PSYS_PART_BF_SOURCE_ALPHA
									   //PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
									   ,
			PSYS_PART_BLEND_FUNC_DEST,
									   //PSYS_PART_BF_ONE
									   //PSYS_PART_BF_ZERO
									   //PSYS_PART_BF_DEST_COLOR
									   //PSYS_PART_BF_SOURCE_COLOR
									   //PSYS_PART_BF_ONE_MINUS_DEST_COLOR
									   //PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR
									   //PSYS_PART_BF_SOURCE_ALPHA
									   PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA
									   ,
			
			//Particle Flow
			PSYS_SRC_MAX_AGE,          source_max_age,
			PSYS_PART_MAX_AGE,         particle_max_age,
			PSYS_SRC_BURST_RATE,       burst_rate,
			PSYS_SRC_BURST_PART_COUNT, burst_particle_count, 
			
			//Particle Motion
			PSYS_SRC_ACCEL,           acceleration,
			PSYS_SRC_OMEGA,           omega,
			PSYS_SRC_BURST_SPEED_MIN, speed_min,
			PSYS_SRC_BURST_SPEED_MAX, speed_max
			
			]);
	}

	default 
	{
		state_entry()
		{
			Particles();
		}
	}