mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Ribbon particle (#1606)
This commit is contained in:
parent
d33ebbe417
commit
9d0fe6a1d8
5 changed files with 153 additions and 1 deletions
|
@ -171,6 +171,10 @@
|
||||||
<td class="name" ><a href="#GetWind">GetWind()</a></td>
|
<td class="name" ><a href="#GetWind">GetWind()</a></td>
|
||||||
<td class="summary">Get the wind vector for the current game frame.</td>
|
<td class="summary">Get the wind vector for the current game frame.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" ><a href="#EmitStreamer">EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID])</a></td>
|
||||||
|
<td class="summary">Emit an extending streamer effect.</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2><a href="#Tables">Tables</a></h2>
|
<h2><a href="#Tables">Tables</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
|
@ -711,6 +715,95 @@ EmitAdvancedParticle(particle)</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "EmitStreamer"></a>
|
||||||
|
<strong>EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID])</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Emit an extending streamer effect.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">mov</span>
|
||||||
|
<span class="types"><span class="type">Moveable</span></span>
|
||||||
|
Moveable object with which to associate the effect.
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">tag</span>
|
||||||
|
<span class="types"><span class="type">int[opt]</span></span>
|
||||||
|
Numeric tag with which to associate the effect on the moveable. <strong>Default: 0</strong>
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">pos</span>
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||||
|
World position.
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">dir</span>
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Vec3.html#">Vec3</a></span>
|
||||||
|
Direction vector of movement velocity.
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">rot</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Start rotation in degrees. <strong>Default: 0</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">startColor</span>
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
|
||||||
|
Color at the start of life. <strong>Default: Color(255, 255, 255, 255))</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">endColor</span>
|
||||||
|
<span class="types"><a class="type" href="../3 primitive classes/Color.html#">Color</a></span>
|
||||||
|
Color at the end of life. <strong>Default: Color(0, 0, 0, 0))</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">width</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Width in world units. <strong>Default: 0</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">life</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Lifetime in seconds. <strong>Default: 1</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">vel</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Movement velocity in world units per second. <strong>Default: 0</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">expRate</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Width expansion rate in world units per second. <strong>Default: 0</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">rotRate</span>
|
||||||
|
<span class="types"><span class="type">float</span></span>
|
||||||
|
Rotation rate in degrees per second. <strong>Default: 0</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">edgeFeatherMode</span>
|
||||||
|
<span class="types"><span class="type">Effects.StreamerFeatherMode</span></span>
|
||||||
|
Edge feather mode. <strong>Default: Effects.FeatherID.NONE</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">lengthFeatherMode</span>
|
||||||
|
<span class="types"><span class="type">Effects.StreamerFeatherMode</span></span>
|
||||||
|
Length feather mode. <strong>Not implemented yet.</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">blendID</span>
|
||||||
|
<span class="types"><a class="type" href="../4 enums/Effects.BlendID.html#">BlendID</a></span>
|
||||||
|
Renderer blend ID. <strong>Default: Effects.BlendID.ALPHA_BLEND</strong>
|
||||||
|
(<em>optional</em>)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
<dd>
|
<dd>
|
||||||
|
|
||||||
<p>Table of Effects.FeatherMode constants.
|
<p>Table of Effects.FeatherMode constants.
|
||||||
To be used with ??? function.</p>
|
To be used with <a href="../1 modules/Effects.html#EmitStreamer">Effects.EmitStreamer</a> function.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>NONE</code></li>
|
<li><code>NONE</code></li>
|
||||||
|
|
|
@ -505,6 +505,11 @@ DAMOCLES_SWORD
|
||||||
ELECTRIC_CLEANER
|
ELECTRIC_CLEANER
|
||||||
SLAMMING_DOORS
|
SLAMMING_DOORS
|
||||||
SWINGING_BLADE
|
SWINGING_BLADE
|
||||||
|
ELECTRIC_BALL
|
||||||
|
ELECTRIC_BALL_IMPACT_POINT
|
||||||
|
THOR_HAMMER_HANDLE
|
||||||
|
THOR_HAMMER_HEAD
|
||||||
|
MOVING_LASER
|
||||||
PUZZLE_ITEM1
|
PUZZLE_ITEM1
|
||||||
PUZZLE_ITEM2
|
PUZZLE_ITEM2
|
||||||
PUZZLE_ITEM3
|
PUZZLE_ITEM3
|
||||||
|
@ -940,6 +945,7 @@ FISHTANK
|
||||||
DOPPELGANGER_ORIGIN
|
DOPPELGANGER_ORIGIN
|
||||||
CORPSE
|
CORPSE
|
||||||
WRAITH_TRAP
|
WRAITH_TRAP
|
||||||
|
WATERFALL_EMITTER
|
||||||
MESHSWAP1
|
MESHSWAP1
|
||||||
MESHSWAP2
|
MESHSWAP2
|
||||||
MESHSWAP3
|
MESHSWAP3
|
||||||
|
|
|
@ -321,6 +321,7 @@ static constexpr char ScriptReserved_EmitSpotLight[] = "EmitSpotLight";
|
||||||
static constexpr char ScriptReserved_EmitBlood[] = "EmitBlood";
|
static constexpr char ScriptReserved_EmitBlood[] = "EmitBlood";
|
||||||
static constexpr char ScriptReserved_EmitAirBubble[] = "EmitAirBubble";
|
static constexpr char ScriptReserved_EmitAirBubble[] = "EmitAirBubble";
|
||||||
static constexpr char ScriptReserved_EmitFire[] = "EmitFire";
|
static constexpr char ScriptReserved_EmitFire[] = "EmitFire";
|
||||||
|
static constexpr char ScriptReserved_EmitStreamer[] = "EmitStreamer";
|
||||||
static constexpr char ScriptReserved_MakeExplosion[] = "MakeExplosion";
|
static constexpr char ScriptReserved_MakeExplosion[] = "MakeExplosion";
|
||||||
static constexpr char ScriptReserved_MakeEarthquake[] = "MakeEarthquake";
|
static constexpr char ScriptReserved_MakeEarthquake[] = "MakeEarthquake";
|
||||||
|
|
||||||
|
@ -388,6 +389,7 @@ static constexpr char ScriptReserved_EventType[] = "EventType";
|
||||||
static constexpr char ScriptReserved_AlignMode[] = "AlignMode";
|
static constexpr char ScriptReserved_AlignMode[] = "AlignMode";
|
||||||
static constexpr char ScriptReserved_ScaleMode[] = "ScaleMode";
|
static constexpr char ScriptReserved_ScaleMode[] = "ScaleMode";
|
||||||
static constexpr char ScriptReserved_ParticleAnimationType[] = "ParticleAnimationType";
|
static constexpr char ScriptReserved_ParticleAnimationType[] = "ParticleAnimationType";
|
||||||
|
static constexpr char ScriptReserved_FeatherMode[] = "StreamerFeatherMode";
|
||||||
|
|
||||||
static constexpr char ScriptReserved_LevelVars[] = "LevelVars";
|
static constexpr char ScriptReserved_LevelVars[] = "LevelVars";
|
||||||
static constexpr char ScriptReserved_GameVars[] = "GameVars";
|
static constexpr char ScriptReserved_GameVars[] = "GameVars";
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Game/effects/Electricity.h"
|
#include "Game/effects/Electricity.h"
|
||||||
#include "Game/effects/explosion.h"
|
#include "Game/effects/explosion.h"
|
||||||
#include "Game/effects/spark.h"
|
#include "Game/effects/spark.h"
|
||||||
|
#include "Game/effects/Streamer.h"
|
||||||
#include "Game/effects/tomb4fx.h"
|
#include "Game/effects/tomb4fx.h"
|
||||||
#include "Game/effects/weather.h"
|
#include "Game/effects/weather.h"
|
||||||
#include "Game/Setup.h"
|
#include "Game/Setup.h"
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
#include "Scripting/Internal/TEN/Effects/BlendIDs.h"
|
#include "Scripting/Internal/TEN/Effects/BlendIDs.h"
|
||||||
#include "Scripting/Internal/TEN/Effects/EffectIDs.h"
|
#include "Scripting/Internal/TEN/Effects/EffectIDs.h"
|
||||||
#include "Scripting/Internal/TEN/Effects/ParticleAnimTypes.h"
|
#include "Scripting/Internal/TEN/Effects/ParticleAnimTypes.h"
|
||||||
|
#include "Scripting/Internal/TEN/Effects/FeatherModes.h"
|
||||||
#include "Scripting/Internal/TEN/Types/Color/Color.h"
|
#include "Scripting/Internal/TEN/Types/Color/Color.h"
|
||||||
#include "Scripting/Internal/TEN/Types/Rotation/Rotation.h"
|
#include "Scripting/Internal/TEN/Types/Rotation/Rotation.h"
|
||||||
#include "Scripting/Internal/TEN/Types/Vec3/Vec3.h"
|
#include "Scripting/Internal/TEN/Types/Vec3/Vec3.h"
|
||||||
|
@ -28,6 +30,7 @@
|
||||||
#include "Sound/sound.h"
|
#include "Sound/sound.h"
|
||||||
#include "Specific/clock.h"
|
#include "Specific/clock.h"
|
||||||
#include "Specific/trutils.h"
|
#include "Specific/trutils.h"
|
||||||
|
#include <Scripting/Internal/TEN/Objects/Moveable/MoveableObject.h>
|
||||||
|
|
||||||
/// Functions to generate effects.
|
/// Functions to generate effects.
|
||||||
// @tentable Effects
|
// @tentable Effects
|
||||||
|
@ -39,6 +42,7 @@ using namespace TEN::Effects::Electricity;
|
||||||
using namespace TEN::Effects::Environment;
|
using namespace TEN::Effects::Environment;
|
||||||
using namespace TEN::Effects::Explosion;
|
using namespace TEN::Effects::Explosion;
|
||||||
using namespace TEN::Effects::Spark;
|
using namespace TEN::Effects::Spark;
|
||||||
|
using namespace TEN::Effects::Streamer;
|
||||||
using namespace TEN::Math;
|
using namespace TEN::Math;
|
||||||
using namespace TEN::Scripting::Types;
|
using namespace TEN::Scripting::Types;
|
||||||
|
|
||||||
|
@ -543,6 +547,51 @@ namespace TEN::Scripting::Effects
|
||||||
return Vec3(Weather.Wind());
|
return Vec3(Weather.Wind());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Emit an extending streamer effect.
|
||||||
|
// @function EmitStreamer
|
||||||
|
// @tparam Moveable mov Moveable object with which to associate the effect.
|
||||||
|
// @tparam int[opt] tag Numeric tag with which to associate the effect on the moveable. __Default: 0__
|
||||||
|
// @tparam Vec3 pos World position.
|
||||||
|
// @tparam Vec3 dir Direction vector of movement velocity.
|
||||||
|
// @tparam[opt] float rot Start rotation in degrees. __Default: 0__
|
||||||
|
// @tparam[opt] Color startColor Color at the start of life. __Default: Color(255, 255, 255, 255))__
|
||||||
|
// @tparam[opt] Color endColor Color at the end of life. __Default: Color(0, 0, 0, 0))__
|
||||||
|
// @tparam[opt] float width Width in world units. __Default: 0__
|
||||||
|
// @tparam[opt] float life Lifetime in seconds. __Default: 1__
|
||||||
|
// @tparam[opt] float vel Movement velocity in world units per second. __Default: 0__
|
||||||
|
// @tparam[opt] float expRate Width expansion rate in world units per second. __Default: 0__
|
||||||
|
// @tparam[opt] float rotRate Rotation rate in degrees per second. __Default: 0__
|
||||||
|
// @tparam[opt] Effects.StreamerFeatherMode edgeFeatherMode Edge feather mode. __Default: Effects.FeatherID.NONE__
|
||||||
|
// @tparam[opt] Effects.StreamerFeatherMode lengthFeatherMode Length feather mode. __Not implemented yet.__
|
||||||
|
// @tparam[opt] Effects.BlendID blendID Renderer blend ID. __Default: Effects.BlendID.ALPHA_BLEND__
|
||||||
|
static void EmitStreamer(const Moveable& mov, TypeOrNil<int> tag, const Vec3& pos, const Vec3& dir, TypeOrNil<float> rot, TypeOrNil<ScriptColor> startColor, TypeOrNil<ScriptColor> endColor,
|
||||||
|
TypeOrNil<float> width, TypeOrNil<float> life, TypeOrNil<float> vel, TypeOrNil<float> expRate, TypeOrNil<float> rotRate,
|
||||||
|
TypeOrNil<StreamerFeatherMode> edgeFeatherMode, TypeOrNil<StreamerFeatherMode> lengthFeatherMode, TypeOrNil<BlendMode> blendID)
|
||||||
|
{
|
||||||
|
int movID = mov.GetIndex();
|
||||||
|
int convertedTag = ValueOr<int>(tag, 0);
|
||||||
|
auto convertedPos = pos.ToVector3();
|
||||||
|
auto convertedDir = dir.ToVector3();
|
||||||
|
auto convertedRot = ANGLE(ValueOr<float>(rot, 0));
|
||||||
|
auto convertedStartColor = ValueOr<ScriptColor>(startColor, ScriptColor(255, 255, 255, 255));
|
||||||
|
auto convertedEndColor = ValueOr<ScriptColor>(endColor, ScriptColor(0, 0, 0, 0));
|
||||||
|
|
||||||
|
auto convertedWidth = ValueOr<float>(width, 0.0f);
|
||||||
|
auto convertedLife = ValueOr<float>(life, 1.0f);
|
||||||
|
auto convertedVel = ValueOr<float>(vel, 0.0f) / (float)FPS;
|
||||||
|
auto convertedExpRate = ValueOr<float>(expRate, 0.0f) / (float)FPS;
|
||||||
|
auto convertedRotRate = ANGLE(ValueOr<float>(rotRate, 0.0f) / (float)FPS);
|
||||||
|
|
||||||
|
auto convertedEdgeFeatherID = ValueOr<StreamerFeatherMode>(edgeFeatherMode, StreamerFeatherMode::None);
|
||||||
|
auto convertedLengthFeatherID = ValueOr<StreamerFeatherMode>(lengthFeatherMode, StreamerFeatherMode::None);
|
||||||
|
auto convertedBlendID = ValueOr<BlendMode>(blendID, BlendMode::AlphaBlend);
|
||||||
|
|
||||||
|
StreamerEffect.Spawn(
|
||||||
|
movID, convertedTag, convertedPos, convertedDir, convertedRot, convertedStartColor, convertedEndColor,
|
||||||
|
convertedWidth, convertedLife, convertedVel, convertedExpRate, convertedRotRate,
|
||||||
|
convertedEdgeFeatherID, convertedBlendID);
|
||||||
|
}
|
||||||
|
|
||||||
void Register(sol::state* state, sol::table& parent)
|
void Register(sol::state* state, sol::table& parent)
|
||||||
{
|
{
|
||||||
auto tableEffects = sol::table(state->lua_state(), sol::create);
|
auto tableEffects = sol::table(state->lua_state(), sol::create);
|
||||||
|
@ -557,6 +606,7 @@ namespace TEN::Scripting::Effects
|
||||||
tableEffects.set_function(ScriptReserved_EmitSpotLight, &EmitSpotLight);
|
tableEffects.set_function(ScriptReserved_EmitSpotLight, &EmitSpotLight);
|
||||||
tableEffects.set_function(ScriptReserved_EmitBlood, &EmitBlood);
|
tableEffects.set_function(ScriptReserved_EmitBlood, &EmitBlood);
|
||||||
tableEffects.set_function(ScriptReserved_EmitAirBubble, &EmitAirBubble);
|
tableEffects.set_function(ScriptReserved_EmitAirBubble, &EmitAirBubble);
|
||||||
|
tableEffects.set_function(ScriptReserved_EmitStreamer, &EmitStreamer);
|
||||||
tableEffects.set_function(ScriptReserved_EmitFire, &EmitFire);
|
tableEffects.set_function(ScriptReserved_EmitFire, &EmitFire);
|
||||||
|
|
||||||
tableEffects.set_function(ScriptReserved_MakeExplosion, &MakeExplosion);
|
tableEffects.set_function(ScriptReserved_MakeExplosion, &MakeExplosion);
|
||||||
|
@ -566,6 +616,7 @@ namespace TEN::Scripting::Effects
|
||||||
auto handler = LuaHandler(state);
|
auto handler = LuaHandler(state);
|
||||||
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_BlendID, BLEND_IDS);
|
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_BlendID, BLEND_IDS);
|
||||||
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_EffectID, EFFECT_IDS);
|
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_EffectID, EFFECT_IDS);
|
||||||
|
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_FeatherMode, FEATHER_MODES);
|
||||||
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_ParticleAnimationType, PARTICLE_ANIM_TYPES);
|
handler.MakeReadOnlyTable(tableEffects, ScriptReserved_ParticleAnimationType, PARTICLE_ANIM_TYPES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue