Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct EdEmitter : EDGUILayoutRow
- {
- EdEmitter() :
- grpSpawn( false, "Spawn properties" ),
- spawn_MaxCount( 0, 0, MAX_PARTICLES ),
- spawn_Count( 0, 0, MAX_PARTICLES ),
- spawn_CountExt( 0, 0, MAX_PARTICLES ),
- spawn_TimeExt( V2(0), 2, V2(0), V2(MAX_TIME) ),
- grpPosition( false, "Initial position" ),
- create_Pos( V3(0), 2, V3(-MAX_POS), V3(MAX_POS) ),
- create_PosBox( V3(0), 2, V3(0), V3(MAX_POS) ),
- create_PosRadius( 0, 2, 0, MAX_POS ),
- grpVelocity( false, "Initial velocity" ),
- create_VelMicroDir( V3(0), 2, V3(-MAX_NORMAL), V3(MAX_NORMAL) ),
- create_VelMicroDvg( 0, 2, 0, 1 ),
- create_VelMicroDistExt( V2(0), 2, V2(0), V2(MAX_VEL) ),
- create_VelMacroDir( V3(0), 2, V3(-MAX_NORMAL), V3(MAX_NORMAL) ),
- create_VelMacroDvg( 0, 2, 0, 1 ),
- create_VelMacroDistExt( V2(0), 2, V2(0), V2(MAX_VEL) ),
- create_VelCluster( 0, 0, MAX_PARTICLES ),
- create_VelClusterExt( 0, 0, MAX_PARTICLES ),
- grpMisc( false, "Misc. properties" ),
- create_LifetimeExt( V2(0), 2, V2(0), V2(MAX_TIME) ),
- create_AngleDirDvg( V2(0), 2, V2(0,0), V2(360,180) ),
- create_AngleVelDvg( V2(0), 2, V2(-1000), V2(1000) ),
- tick_AngleAcc( 0, 2, -10000, 10000 ),
- absolute( true ),
- grpSizeColor( false, "Size/color curves" ),
- curve_Size( false, "Size" ),
- curve_ColorHue( false, "Color - hue" ),
- curve_ColorSat( false, "Color - saturation" ),
- curve_ColorVal( false, "Color - value" ),
- curve_Opacity( false, "Opacity" ),
- grpRender( true, "Rendering data" ),
- render_Texture0( g_UITexPicker, "bullet" ),
- render_Texture1( g_UITexPicker, "" ),
- render_Texture2( g_UITexPicker, "" ),
- render_Texture3( g_UITexPicker, "" ),
- render_Shader( g_UIShaderPicker, "particle" ),
- render_Additive( false ),
- render_Stretch( false ),
- m_psys( NULL ), m_emitter( NULL )
- {
- spawn_MaxCount.caption = "Max. particle count";
- spawn_Count.caption = "# of particles to spawn";
- spawn_CountExt.caption = "# + random";
- spawn_TimeExt.caption = "Spawn time / rand.ext.";
- create_Pos.caption = "Origin";
- create_PosBox.caption = "Random extents";
- create_PosRadius.caption = "Random radius";
- create_VelMicroDir.caption = "V/micro/direction";
- create_VelMicroDvg.caption = "V/micro/divergence";
- create_VelMicroDistExt.caption = "V/micro/dist+rand.ext.";
- create_VelMacroDir.caption = "V/macro/direction";
- create_VelMacroDvg.caption = "V/macro/divergence";
- create_VelMacroDistExt.caption = "V/macro/dist+rand.ext.";
- create_VelCluster.caption = "V - cluster size";
- create_VelClusterExt.caption = "V - cluster rand.ext.";
- create_LifetimeExt.caption = "Lifetime + rand.ext.";
- create_AngleDirDvg.caption = "Angle / divergence";
- create_AngleVelDvg.caption = "Angular velocity / divergence";
- tick_AngleAcc.caption = "Angle - acceleration";
- absolute.caption = "World space";
- render_Texture0.caption = "Texture #1";
- render_Texture1.caption = "Texture #2";
- render_Texture2.caption = "Texture #3";
- render_Texture3.caption = "Texture #4";
- render_Shader.caption = "Shader";
- render_Additive.caption = "Is additive+unlit?";
- render_Stretch.caption = "Is velocity-stretched?";
- grpSpawn.Add( &spawn_MaxCount );
- grpSpawn.Add( &spawn_Count );
- grpSpawn.Add( &spawn_CountExt );
- grpSpawn.Add( &spawn_TimeExt );
- Add( &grpSpawn );
- grpPosition.Add( &create_Pos );
- grpPosition.Add( &create_PosBox );
- grpPosition.Add( &create_PosRadius );
- Add( &grpPosition );
- grpVelocity.Add( &create_VelMicroDir );
- grpVelocity.Add( &create_VelMicroDvg );
- grpVelocity.Add( &create_VelMicroDistExt );
- grpVelocity.Add( &create_VelMacroDir );
- grpVelocity.Add( &create_VelMacroDvg );
- grpVelocity.Add( &create_VelMacroDistExt );
- grpVelocity.Add( &create_VelCluster );
- grpVelocity.Add( &create_VelClusterExt );
- Add( &grpVelocity );
- grpMisc.Add( &create_LifetimeExt );
- grpMisc.Add( &create_AngleDirDvg );
- grpMisc.Add( &create_AngleVelDvg );
- grpMisc.Add( &tick_AngleAcc );
- grpMisc.Add( &absolute );
- Add( &grpMisc );
- grpSizeColor.Add( &curve_Size );
- grpSizeColor.Add( &curve_ColorHue );
- grpSizeColor.Add( &curve_ColorSat );
- grpSizeColor.Add( &curve_ColorVal );
- grpSizeColor.Add( &curve_Opacity );
- Add( &grpSizeColor );
- grpRender.Add( &render_Texture0 );
- grpRender.Add( &render_Texture1 );
- grpRender.Add( &render_Texture2 );
- grpRender.Add( &render_Texture3 );
- grpRender.Add( &render_Shader );
- grpRender.Add( &render_Additive );
- grpRender.Add( &render_Stretch );
- Add( &grpRender );
- }
- int OnEvent( EDGUIEvent* e )
- {
- switch( e->type )
- {
- case EDGUI_EVENT_PROPEDIT:
- if( e->target == &spawn_MaxCount ){ m_emitter->spawn_MaxCount = spawn_MaxCount.m_value; _U(false); }
- if( e->target == &spawn_Count ){ m_emitter->spawn_Count = spawn_Count.m_value; _U(false); }
- if( e->target == &spawn_CountExt ){ m_emitter->spawn_CountExt = spawn_CountExt.m_value; _U(false); }
- if( e->target == &spawn_TimeExt ){ m_emitter->spawn_TimeExt = spawn_TimeExt.m_value; _U(false); }
- if( e->target == &create_Pos ){ m_emitter->create_Pos = create_Pos.m_value; _U(false); }
- if( e->target == &create_PosBox ){ m_emitter->create_PosBox = create_PosBox.m_value; _U(false); }
- if( e->target == &create_PosRadius ){ m_emitter->create_PosRadius = create_PosRadius.m_value; _U(false); }
- if( e->target == &create_VelMicroDir ){ m_emitter->create_VelMicroDir = create_VelMicroDir.m_value; _U(false); }
- if( e->target == &create_VelMicroDvg ){ m_emitter->create_VelMicroDvg = create_VelMicroDvg.m_value; _U(false); }
- if( e->target == &create_VelMicroDistExt ){ m_emitter->create_VelMicroDistExt = create_VelMicroDistExt.m_value; _U(false); }
- if( e->target == &create_VelMacroDir ){ m_emitter->create_VelMacroDir = create_VelMacroDir.m_value; _U(false); }
- if( e->target == &create_VelMacroDvg ){ m_emitter->create_VelMacroDvg = create_VelMacroDvg.m_value; _U(false); }
- if( e->target == &create_VelMacroDistExt ){ m_emitter->create_VelMacroDistExt = create_VelMacroDistExt.m_value; _U(false); }
- if( e->target == &create_VelCluster ){ m_emitter->create_VelCluster = create_VelCluster.m_value; _U(false); }
- if( e->target == &create_VelClusterExt ){ m_emitter->create_VelClusterExt = create_VelClusterExt.m_value; _U(false); }
- if( e->target == &create_LifetimeExt ){ m_emitter->create_LifetimeExt = create_LifetimeExt.m_value; _U(false); }
- if( e->target == &create_AngleDirDvg ){ m_emitter->create_AngleDirDvg = DEG2RAD( create_AngleDirDvg.m_value ); _U(false); }
- if( e->target == &create_AngleVelDvg ){ m_emitter->create_AngleVelDvg = DEG2RAD( create_AngleVelDvg.m_value ); _U(false); }
- if( e->target == &tick_AngleAcc ){ m_emitter->tick_AngleAcc = DEG2RAD( tick_AngleAcc.m_value ); _U(false); }
- if( e->target == &absolute ){ m_emitter->absolute = absolute.m_value; _U(false); }
- if( e->target == &render_Texture0 ){ m_emitter->render_Textures[0] = GetParticleTexHandle( render_Texture0.m_value ); _U(true); }
- if( e->target == &render_Texture1 ){ m_emitter->render_Textures[1] = GetParticleTexHandle( render_Texture1.m_value ); _U(true); }
- if( e->target == &render_Texture2 ){ m_emitter->render_Textures[2] = GetParticleTexHandle( render_Texture2.m_value ); _U(true); }
- if( e->target == &render_Texture3 ){ m_emitter->render_Textures[3] = GetParticleTexHandle( render_Texture3.m_value ); _U(true); }
- if( e->target == &render_Shader ){ m_emitter->render_Shader = render_Shader.m_value; _U(true); }
- if( e->target == &render_Additive ){ m_emitter->render_Additive = render_Additive.m_value; _U(true); }
- if( e->target == &render_Stretch ){ m_emitter->render_Stretch = render_Stretch.m_value; _U(true); }
- break;
- }
- return EDGUILayoutRow::OnEvent( e );
- }
- void _U( bool renderupdate )
- {
- if( renderupdate )
- m_psys->OnRenderUpdate();
- }
- void Prepare( ParticleSystem* PS, size_t emid )
- {
- m_psys = PS;
- m_emitter = &PS->emitters[ emid ];
- spawn_MaxCount.SetValue( m_emitter->spawn_MaxCount );
- spawn_Count.SetValue( m_emitter->spawn_Count );
- spawn_CountExt.SetValue( m_emitter->spawn_CountExt );
- spawn_TimeExt.SetValue( m_emitter->spawn_TimeExt );
- create_Pos.SetValue( m_emitter->create_Pos );
- create_PosBox.SetValue( m_emitter->create_PosBox );
- create_PosRadius.SetValue( m_emitter->create_PosRadius );
- create_VelMicroDir.SetValue( m_emitter->create_VelMicroDir );
- create_VelMicroDvg.SetValue( m_emitter->create_VelMicroDvg );
- create_VelMicroDistExt.SetValue( m_emitter->create_VelMicroDistExt );
- create_VelMacroDir.SetValue( m_emitter->create_VelMacroDir );
- create_VelMacroDvg.SetValue( m_emitter->create_VelMacroDvg );
- create_VelMacroDistExt.SetValue( m_emitter->create_VelMacroDistExt );
- create_VelCluster.SetValue( m_emitter->create_VelCluster );
- create_VelClusterExt.SetValue( m_emitter->create_VelClusterExt );
- create_LifetimeExt.SetValue( m_emitter->create_LifetimeExt );
- create_AngleDirDvg.SetValue( RAD2DEG( m_emitter->create_AngleDirDvg ) );
- create_AngleVelDvg.SetValue( RAD2DEG( m_emitter->create_AngleVelDvg ) );
- tick_AngleAcc.SetValue( RAD2DEG( m_emitter->tick_AngleAcc ) );
- absolute.SetValue( m_emitter->absolute );
- curve_Size.SetValue( m_emitter->curve_Size );
- curve_ColorHue.SetValue( m_emitter->curve_ColorHue );
- curve_ColorSat.SetValue( m_emitter->curve_ColorSat );
- curve_ColorVal.SetValue( m_emitter->curve_ColorVal );
- curve_Opacity.SetValue( m_emitter->curve_Opacity );
- render_Texture0.SetValue( GetParticleTexName( m_emitter->render_Textures[0] ) );
- render_Texture1.SetValue( GetParticleTexName( m_emitter->render_Textures[1] ) );
- render_Texture2.SetValue( GetParticleTexName( m_emitter->render_Textures[2] ) );
- render_Texture3.SetValue( GetParticleTexName( m_emitter->render_Textures[3] ) );
- render_Shader.SetValue( m_emitter->render_Shader );
- render_Additive.SetValue( m_emitter->render_Additive );
- render_Stretch.SetValue( m_emitter->render_Stretch );
- }
- EDGUIGroup grpSpawn;
- EDGUIPropInt spawn_MaxCount;
- EDGUIPropInt spawn_Count;
- EDGUIPropInt spawn_CountExt;
- EDGUIPropVec2 spawn_TimeExt;
- EDGUIGroup grpPosition;
- EDGUIPropVec3 create_Pos;
- EDGUIPropVec3 create_PosBox;
- EDGUIPropFloat create_PosRadius;
- EDGUIGroup grpVelocity;
- EDGUIPropVec3 create_VelMicroDir;
- EDGUIPropFloat create_VelMicroDvg;
- EDGUIPropVec2 create_VelMicroDistExt;
- EDGUIPropVec3 create_VelMacroDir;
- EDGUIPropFloat create_VelMacroDvg;
- EDGUIPropVec2 create_VelMacroDistExt;
- EDGUIPropInt create_VelCluster;
- EDGUIPropInt create_VelClusterExt;
- EDGUIGroup grpMisc;
- EDGUIPropVec2 create_LifetimeExt;
- EDGUIPropVec2 create_AngleDirDvg;
- EDGUIPropVec2 create_AngleVelDvg;
- EDGUIPropFloat tick_AngleAcc;
- EDGUIPropBool absolute;
- EDGUIGroup grpSizeColor;
- EdEmitCurve curve_Size;
- EdEmitCurve curve_ColorHue;
- EdEmitCurve curve_ColorSat;
- EdEmitCurve curve_ColorVal;
- EdEmitCurve curve_Opacity;
- EDGUIGroup grpRender;
- EDGUIPropRsrc render_Texture0;
- EDGUIPropRsrc render_Texture1;
- EDGUIPropRsrc render_Texture2;
- EDGUIPropRsrc render_Texture3;
- EDGUIPropRsrc render_Shader;
- EDGUIPropBool render_Additive;
- EDGUIPropBool render_Stretch;
- ParticleSystem* m_psys;
- ParticleSystem::Emitter* m_emitter;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement